StageSelect

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search

StageSelect (uking::StageSelect) is a development-only feature that allows the user to select and load a stage directly.

In release builds, code for the stage select screen is still present in the executable to a certain extent; however its functionality is entirely unused. Furthermore, it is completely broken because of the following reasons:

  • When GameScene constructs uking::StageSelect[1], a nullptr heap is passed to it because the code that would normally create the StageSelect heap is no longer present.
  • The list of stages the user can choose from is loaded from a subsystem that is missing from release executables[2]. When StageSelect is initialized, it attempts to access the global subsystem instance[3], which promptly causes the game to dereference a null pointer and crash.
  • Revision information (i.e. versions, build info, etc.) will not show up properly because the Revision subsystem is also stubbed in release builds. Moreover, the game will also crash when it tries to dereference Revision::sInstance, as Revision is not initialized at all when not in debug mode[4].
  • The game attempts to use the SeadMenu subsystem, which also does not exist anymore in release builds[5]

Restoring its functionality is technically possible but difficult.

  1. 0x71007B1200 in Switch 1.5.0
  2. The instance pointer for that subsystem is stored at 0x00000071025CE6D8 in .bss. It is never written to.
  3. 0x71007CD4DC
  4. 0x7100F3ADC8
  5. SeadMenu::sInstance @ 0x00000071025F8A88 (.bss) is never set.