Executable: Difference between revisions

Jump to navigation Jump to search
8,233 bytes added ,  4 years ago
imported>Leoetlino
imported>Leoetlino
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
The '''executable''' is where all the game code is stored. It is located in the title code directory on Wii U and in the [[switchbrew:ExeFS|ExeFS]] on Switch.
The '''executable''' is where all the game code is stored. It is located in the title code directory on Wii U and in the [[switchbrew:ExeFS|ExeFS]] on Switch.
Important note: unless otherwise stated, all addresses on this wiki are for the Switch 1.5.0 executable.


== File ==
== File ==
Line 5: Line 7:
BotW's executable is a standard, compressed [[switchbrew:NSO|NSO]] which is larger than most other games (about 20MB compressed).
BotW's executable is a standard, compressed [[switchbrew:NSO|NSO]] which is larger than most other games (about 20MB compressed).


The build path is <code>D:\home\Cafe\U-King\trunk\Game\App\Rom\NX64\Product\code\U-King.nss</code> and the build ID for 1.5.0 is <code>16A91992BBA71201E98756F3BC8F5D2F00000000000000000000000000000000</code>.
The build path is <code>D:\home\Cafe\U-King\trunk\Game\App\Rom\NX64\Product\code\U-King.nss</code>. For build IDs, see [[Versions#Switch_versions]].


=== Wii U ===
=== Wii U ===
Line 11: Line 13:


== Libraries ==
== Libraries ==
{{Link_to_article|link=[[Software libraries]]}}
{{Link_to_article|link=Software libraries}}


== Subsystems ==
== Subsystems ==
{{Link_to_article|link=[[Subsystems]]}}
{{Link_to_article|link=Subsystems}}


== Symbols ==
== Symbols ==
Unfortunately, release versions of ''The Legend of Zelda: Breath of the Wild'' are stripped and have absolutely no debugging symbols. This has been verified for Switch 1.0.0, Wii U 1.5.0 and Switch 1.5.0.
Unfortunately, release versions of ''The Legend of Zelda: Breath of the Wild'' are stripped and have absolutely no debugging symbols. This has been verified for Switch 1.0.0, Wii U 1.5.0, Switch 1.5.0, Switch 1.6.0 and Switch RID_Demo.


The Switch 1.5.0 executable only has some RTTI data for UI classes.
The Switch 1.5.0 and 1.6.0 executables only have some RTTI data for UI classes. This is likely also the case for all older versions.


However, the game uses lots of [[Software libraries|software libraries]], some of which are included in games that do ship with complete symbols such as ''Super Mario Odyssey''. BotW seems to have been compiled at a higher optimisation level that causes unused functions to be fully removed.
However, the game uses lots of [[Software libraries|software libraries]], some of which are included in games that do ship with complete symbols such as ''Super Mario Odyssey''. BotW seems to have been compiled at a higher optimisation level that causes unused functions to be fully removed.
== Init and main loop outline ==
=== Early init and main loop ===
* '''main'''
** nn::oe::Initialize
** sead::GameFrameworkNx::initialize (implicitly calls nn::oe::Initialize again; this looks like a mistake from the Zelda developers)
***sead::HeapMgr and root heap
***sead::ThreadMgr
***sead::GlobalRandom
***sead::ResourceMgr
***sead::FileDeviceMgr
** GameConfig
** Unknown 71025D1720
** uking::GameFramework (derived from sead::GameFrameworkNx)
** GraphicsSystem
** sead::GameFrameworkNx::initializeGraphicsSystem
** [Debug] sead::PrimitiveRenderer
** [Debug] sead::DebugFontMgrNvn
** [Debug] sead::DebugFontMgrJis1Nvn
** '''RootTask'''
*** sead::TaskBase::CreateArg
*** sead::Framework::RunArg
*** '''framework->run'''
**** Constructs a sead::MethodTreeMgr (note: a custom, derived MethodTreeMgr is used in BotW)
**** Constructs a sead::TaskMgr
***** sead::TaskMgr::doInit_
****** sead::TaskMgr::prepare (on the ''Prepare Thread'')
******* '''[[#RootTask::prepare|RootTask::prepare]]'''
**** framework->runImpl_
***** framework->waitStartDisplayLoop_
***** '''framework->mainLoop'''
****** framework->procFrame
******* framework->procCalc
******** '''methodTreeMgr->calc''' (sead::SingleScreenMethodTreeMgr). Runs the following methods (sead::MethodTreeNode):
********* RootCalc
********** SysCalc
********** AppCalc
*********** PreCalc
*********** Calc
************ '''[[#RootTask::calc|RootTask::calc]]'''
*********** PostCalc
*********** CalcDL
********* RootDraw
********** AppDraw
********** AppDrawFinal
********** SysDraw
******* framework->present
******* framework->procReset
******* framework->waitForGpuDone
****** framework->setVBlankWaitInterval
=== RootTask::prepare ===
* framework->createSystemTasks
** sead::ControllerMgr
** sead::ProcessMeter
** [Debug] sead::SeadMenuMgr
** [Debug] sead::HostIOMgr
** sead::InfLoopChecker
** [?] sead::CuckooClock
* InfLoopChecker setup
=== RootTask::calc ===
* Step 0
** ErrorViewer
** Volante
** ErrorViewerTask
** [[KingSystem]] heap
** SoundCalcThread
*** The name is extremely misleading. What the thread does is set up sead::RegionLanguageMgr and initialise it by reading System/RegionLangMask.txt.
* Step 1
** Wait for the sound calc thread to finish executing, before destroying it
* Step 2
** ScreenFactory
** '''ksys::PreInitializeApp'''
*** [[Patrol]]
*** [[Account]]
*** [[Terminal]]
*** [[GlobalMessage]]
*** [[ActorSystem]]
*** Physics Memory System
*** [Debug] [[CurrentResNameMgr]]
*** [[HavokWorkerMgr]]
*** SoundResource
*** [[OverlayArenaSystem]]
*** [[ResourceMgrTask]]
*** [Debug] [[Revision]]
*** RequestFontLoad
**** eui::FontMgr
**** [[LayoutResourceMgr]]
*** [Debug] Visualizer-shader
*** [[StarterPackMgr]]
**** Loads Bootup_Graphics, Bootup and (in non-debug mode) Title and TitleBG packs.
*** LayoutResourceMgr::loadVersion
*** [[aocManager]] (in post-1.0.0 versions)
**** Add-on content is mounted in aocManager::init (nn::fs::MountAddOnContent).
**** Set up the [[resource system]] (sead::FileDeviceMgr::mount + path prefix mapping) and load the version file.
* Step 3
** Wait for pre-initialised subsystems to be ready (StarterPackMgr ([[Bootup_Graphics.pack]], [[Bootup.pack]], lang-specific bootup pack), LayoutResourceMgr, aocManager).
* Step 4
** ScreenFactory (again, which leaks the previous factory)
** '''ksys::InitializeApp'''
*** [Release] Load [[AocMainField.pack]]
*** ''Switch active pack to Bootup_Graphics.''
*** gsys::SystemTask::init
*** ShaderArchives::load
*** ''Unload Bootup_Graphics and set active pack to TitleBG.''
*** [Debug] Log resource loads to %PROJECT_ROOT%/Log/BootupPatrol/res_bootup_graphics.csv.
*** Sound
*** Physics System Data
*** ''Start of ActorInfoData init.''
*** [[ActorInfoData]]
*** [[ActorTemplate]]
*** [[EffectInfoData]]
*** [[SoundInfoData]]
*** [[XLinkInfoData]]
*** ''End of ActorInfoData init.''
*** [[EventInfoData]]
*** [[ModelResourceDivide]]
*** [Debug] MemoryProfiler
*** [Debug] CPUProfiler
*** [[Controller]]
*** [[Camera]]
*** [[Hio]]
*** [[Effect]]
*** [[Reaction]]
*** [Debug] CameraEdtior (sic)
*** [Debug] KingEditor
*** [[PlayReport]] (see also [[Telemetry]])
*** [[ActorPreLoadMgr]]
*** [[Ecosystem]]
*** [[VideoRecorder]]
*** [[ModelCreator]]
*** Unknown 710261F9C8 (used from GameScene)
*** [Debug] Replay
*** [Debug] DebugInput
*** [[MoviePlayer]]
*** [[AnimSequence]] (AS)
*** [[Terrain]]
*** [[LODMgr]]
*** [Debug] Visualizer
*** [[NFP]]
*** Physics
*** Worker
*** [[HavokAI]]
*** [[SeadMenu]]
*** [[VFR]]
*** [[MCMgr]]
*** [[LowPrioThreadMgr]]
*** [[GameDataMgr]]
*** [[QuestMgr]]
*** [[EventMgr]]
*** aocManager init
*** [[AIClassDef]]
*** [[ActorParam]]
*** [[Chemical]]
*** [[Awareness]]
*** [[WorldMgr]]
*** [[UI]]
*** [[XLink]]
*** [Debug] ActorDebug
*** [Debug] DebugFinder
*** [Debug] ModelPicker
*** [Debug] GameTool
*** [[StagePreActorCache]]
*** [Debug] AutoGenFramework
*** [[StatisticsMgr]]
*** [[WorkerSupportThreadMgr]]
*** [[BaseProcMgr]]
*** [[Attention]]
*** [[Vibration]]
*** [[AutoDim]]
*** [Debug] MessageCapture
*** [Debug] InitResourceReload (resource live reloading)
** KingSystem heap is resized to fit.
** Attention: unknown init
* Step 5: noop
* Step 6: noop
* Step 7
** Rumble
** Unknown 71025D04D8
** Scene change functions
** MapStaticLoadMgr (loads Static.mubin)
** LayerMgrTask
** Unknown 71025D1790
** Unknown 71025D1A28
** Unknown 71025D04F0
** Debug board (?)
** Unknown 71025D16C0 (has to do with [[GameScene]], [[E3Mgr]] and [[AIDef:Action/PlayerPullSword]])
** Unknown 71025D1710
** Unknown 71025D1538 (has to do with frame and key input?)
** SeadController (derived from sead::Controller)
** CameraMgrTask
** LayerMgrTask
** Camera
** Unknown 71025D2508
** Unknown 71025D24C0
** [[ActorFactory]]
** AI system init
** [[SaveSystem]]
** [[TalkSystem]]
** [[SceneMgr]]
** '''uking::frm::System'''
*** '''[[GameScene]]'''
*** Attaches a few methods to the method tree manager from unknown subsystems and [[GameDataMgr]].
* '''End of RootTask init'''
* Step 8
** Wait for init to complete (GameScene, [[GlobalParameter]], E3Mgr, [[TipsMgr]], [[ResidentActorMgr]], [[AutoPlacementFlowMgr]], GameSceneUnknownSubsystem6, StarterPackMgr)
** GameScene::finaliseBootup
** MCMgr::sInstance->flags |= 0x10u
* Step 9
** 1
*** GameScene
** 2
*** Controller update (?)
*** SaveSystem update (?)
*** GameScene
** 3
*** GameScene


== Internal version ==
== Internal version ==
1.0.0's nnMain prints "00000010", whereas 1.5.0 prints "0000002d".
1.0.0's nnMain prints "00000010", whereas 1.5.0 prints "0000002d".
1.6.0 prints "0000002e".


== Unused content ==
== Unused content ==
Line 40: Line 262:
</pre>
</pre>


=== Leftover debug tools ===
=== Leftover debug or development tools ===
==== ActorCapture ====
See [[ActorCapture]] for more information.
 
The resource factory and resource classes are still present in release builds, but no ActorCapture parameter files are included in the ROM.
 
==== EventPatroller ====
Used to generate movies (prerendered cutscenes) for event flows. Receives orders via HostIO (in BYML format) in <code>%UKING_ROOT%/../workdir/EventPatroller/order.byml</code> and writes:
 
* A YAML report containing frame-by-frame data with camera position, actor information, etc. Written to <code>%s/report.yml</code> % (name).
* Screenshots for the entire event (maximum 18000 frames) captured using agl::utl::ScreenshotMgr, and written to <code>%s/%05d.tga</code> % (name, frame).
 
Throughout the execution of the order, <code>%%KSYS_ROOT%%/tools/EventPatroller/ChangeStatus.bat</code> is spawned to update the order status on the host computer.
 
EventPatroller can apparently make use of Havok script files (hks) in dev builds<ref><code>script_name</code> (in the order data) is a path to a hks file.</ref>. However, all script-related code is stubbed in release builds and both the <code>hks</code> and <code>lua</code> resource factories are unused.
 
==== Placement ====
The <code>bplacement</code> resource factory is stubbed in release builds. The associated resource class is also stubbed. It is unknown what Placement files would have contained. (Configuration for the [[PlacementMgr]]?)
 
Given the small resource size, it is likely that bplacement files are not [[AAMP]] resources but [[BYML]]s.
 
==== Demo ROM types ====
==== Demo ROM types ====
The game calls <code>sead::EnvUtil::getRomType()</code> to get the ROM type. The result is printed to a debug log along with SD card, revision and AoC (DLC) information.
The game calls <code>sead::EnvUtil::getRomType()</code> to get the ROM type. The result is printed to a debug log along with SD card, revision and AoC (DLC) information.
Line 47: Line 289:


* "Normal": used in retail versions (at least 1.0.0 and 1.5.0)
* "Normal": used in retail versions (at least 1.0.0 and 1.5.0)
* "Show_2017_1st": demo version?
* "Show_2017_1st": demo version, used for 12S?
* "RID_Demo": ?
* "RID_Demo": Retail Interactive Display demo (aka kiosk version). Seen in the Switch kiosk version.
* Anything else is treated as "Normal".
* Anything else is treated as "Normal".


Line 54: Line 296:


==== ErrorViewer and Stage Select ====
==== ErrorViewer and Stage Select ====
There are references to debugging tools like Error (an in-game integrated bug tracker) and a stage select mode (uking::StageSelect + more strings). UI data and structures for the ErrorViewerTask still exist to a certain extent, but whether these features can be reactivated or not is still unknown.
There are references to debugging tools like Error (an in-game integrated bug tracker) and a [[StageSelect|stage select]] mode (uking::StageSelect + more strings). UI data and structures for the ErrorViewerTask still exist to a certain extent, but whether these features can be reactivated or not is still unknown.


==== Disabled functionality ====
==== Disabled functionality ====
Line 124: Line 366:
.rodata.2:0000007101DC9A20 aDefaulttoolfro DCB "DefaultToolFrontEndPage",0
.rodata.2:0000007101DC9A20 aDefaulttoolfro DCB "DefaultToolFrontEndPage",0
</pre>
</pre>
Option values are hardcoded in the Switch kiosk version as well.
[[Category:Internals]]
Anonymous user

Navigation menu