Re: Debug menus in Japanese Crystal
Posted by: SatoMew
Date: 2016-03-20 11:07:58
Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.
You can join Glitch City Research Institute to ask questions or discuss current developments.
You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.
Looking over it again, another odd track name is ち Victory 4, which follows the three standard victory themes (Trainer Battle, Wild Pokémon, and Gym Leader). This track is used for Mt. Moon Square (confusingly called Mt. Moon on the HG/SS soundtrack, whereas the music played inside Mt. Moon is Rock Tunnel). If it was originally written as a victory theme, that would certainly explain why its so short.
Its worth noting that it is used as a victory theme in Stadium 2.
[table][tr][td]Unused
(3F:656E)[/td]
[td]Displays the Mobile Adapter connection prompt with an incorrect palette. Maybe it would do more than that if a connection could be made.[/td][/tr]
[/table]
[size=12pt]Quick-start (3F:5983)[/size]
Function 3F:5983 seems to be intended as some sort of accelerated start for debugging purposes. It does a bewildering variety of peculiar things:
- Sets bit 7 of $D83F ([tt]StatusFlags[/tt]). (Pokecrystal identifies this as ENGINE_BUG_CONTEST_ON, but I dont think its related to the Bug-Catching Contest at all. The only place I see that its used is in [tt]MainMenu_GetWhichMenu[/tt], which checks this flag but then does the same thing whether its set or not. The flag is set in-game when the Mystery Egg is given to Prof. Elm.)
These are incredible finds! Well done Háčky! There are a number of sound effects in the sound test I don't recognize, such as 45, 146, 175, 176-178, 205, 206. Are any of those used?
I see. Thanks for that. :)
Regarding the sound test, may I ask how would we go about activating it with arbitrary code execution (with a trick such as TM15 ACE)? Would it be as simple as bringing up the menu, or are there pointers within the menu code that were changed in the final game?
I see. Thanks for that. :)
Regarding the sound test, may I ask how would we go about activating it with arbitrary code execution (with a trick such as TM15 ACE)? Would it be as simple as bringing up the menu, or are there pointers within the menu code that were changed in the final game?
The sound test makes several calls to functions in the upper part of bank 0 that are offset by $3D bytes, including important ones like [tt]PlayMusic[/tt] and [tt]PlaySFX[/tt] ;)
In order to run it with ACE, youd have to copy the code (from 3F:72C373B1) into RAM and patch those calls. And once the code is moved into RAM, youd also need to patch calls to the sound tests own subroutines so they point to the new addresses in RAM. Probably the simplest patching method would be to loop through the code looking for the bytes $CD ([tt]call[/tt]) and $C3 ([tt]jp[/tt]) and checking the high byte of the address that follows. If its $40, then its pointing to its own code in bank $3F and needs to be offset to wherever youve put the patched code in RAM. If its $2B, then its pointing to the upper part of bank 0 and you need to subtract $003D. If its < $2B, then the address is fine. (This might not work properly if the bytes $CD or $C3 appeared as an operand rather than an instruction, but luckily they dont in the sound test code.)
Predef1: ; 7e79
callba $fd6db
jp StartTitleScreen.TitleScreen
This is not the same debug menu from other GSC Pokemon game?