Glitch City Laboratories Archives

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.

Pokémon Discussion

Debug menus in Japanese Crystal - Page 2

Re: Debug menus in Japanese Crystal

Posted by: SatoMew
Date: 2016-03-20 11:07:58
While looking up "unlimited battle mobile adapter" elsewhere, I found a thread on The Azure Heights Forums from 2001 and another thread on the Serebii.Net Forums from 2006 with posts mentioning some of the debug text found here. I still don't know what it is, though.

Re: Debug menus in Japanese Crystal

Posted by: Bent`
Date: 2016-04-08 16:39:21

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.

Re: Debug menus in Japanese Crystal

Posted by: SatoMew
Date: 2016-04-09 17:13:20

Its worth noting that it is used as a victory theme in Stadium 2.


Huh :P

Re: Debug menus in Japanese Crystal

Posted by: Torchickens
Date: 2016-05-13 15:32:42
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?

Re: Debug menus in Japanese Crystal

Posted by: Háčky
Date: 2016-06-15 15:26:36
[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]


This script initiates a Colosseum mobile battle using the first three Pokémon in the party. It can be either a time-limited battle or an unlimited one depending on the unlimited battle mobile adapter flag.

The palette of the Mobile Adapter prompt depends on the location where its accessed. In an area such as the first floor of the PokéCom Center, the prompt will be the usual dark blue.

Also, I realize I never mentioned how to access those unreferenced scripts. The Game Genie codes ??4-819-D58 · ??4-829-7FB will replace the pointer to Test 1.

[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.)


Theres dummied-out code for the main menu in the English version of Pokémon Crystal? When I say it like that, the reason for it becomes a lot more obvious :P

That flag is used in the Japanese version to hide the Mobile and Mobile Stadium options from the main menu until the Mystery Egg is delivered 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?


175178 are used for the moves Moonlight, Encore, Beat Up, and Baton Pass.

206 is used when unlocking the Card Folder. 205 is probably also used for some mobile feature, but I dont know which one.

045 and 146 dont seem to be used. Notably, 045 (called [tt]SFX_FANFARE[/tt] in pokecrystal) can be played by a text script, but there dont appear to be any text scripts that use that command.

Re: Debug menus in Japanese Crystal

Posted by: Torchickens
Date: 2016-06-15 15:59:59
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?

Re: Debug menus in Japanese Crystal

Posted by: Háčky
Date: 2016-06-15 21:50:02

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.)

Re: Debug menus in Japanese Crystal

Posted by: Torchickens
Date: 2016-06-16 08:28:13


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.)


Neat! Thanks for information, going to look into writing code that does that.

Re: Debug menus in Japanese Crystal

Posted by: Háčky
Date: 2017-02-22 16:52:26
I found some more debug code that Id missed! Okay, I shouldnt get too excited, its only 9 bytes ;D

Its at the end of bank 1, corresponding to the [tt]Predef1[/tt] function which is dummied out in the release build. It calls 3F:56DB, which is the debug menu with ROM Version on it, and then returns to the title screen:
Predef1: ; 7e79
callba $fd6db
jp StartTitleScreen.TitleScreen

Re: Debug menus in Japanese Crystal

Posted by: Unused Trainer
Date: 2017-02-23 02:34:23
This is not the same debug menu from other GSC Pokemon game?

Re: Debug menus in Japanese Crystal

Posted by: Stackout
Date: 2017-02-23 04:09:08

This is not the same debug menu from other GSC Pokemon game?


If you're talking about the trainer/Pokémon sprite viewer, that's actually a part of it.

Re: Debug menus in Japanese Crystal

Posted by: Hexatendo
Date: 2017-05-19 15:06:09
Sorry, I'm new here, but, is there any patch that enables all debugging functions? I tried one patch a few months ago, but that didn't work. And the patch I found on TCRF a few days ago only enables the ROM Debug (The one that displays a build date). Maybe in the case of the latter, there were different button combinations to enable the different functions? Also, I tried Game Genie codes to enable the quick start debug, but it didn't work in either. Is there at least different patches for different debug functions? (Although I would rather access all of them at once). And I tested the patches in VBA-M. Thank you.

Re: Debug menus in Japanese Crystal

Posted by: ISSOtm
Date: 2017-05-19 16:20:20
It also depends on the ROM's localization AFAIK, but I'd need Wakc0 to confirm that.

Re: Debug menus in Japanese Crystal

Posted by: Hexatendo
Date: 2017-05-20 14:10:19
If you're talking about region, then I used Japanese Crystal.

Re: Debug menus in Japanese Crystal

Posted by: Hexatendo
Date: 2017-06-03 15:36:22
Sorry to double post, but I think I have an idea. Why don't we enable various debug menus with a button combination. I do not want to enable and disable codes everytime I want to use a different debug menu. I think B+left should be the ROM DEBUG (Build date one), B+up for the SUPER debug, and B+right for the quick start debug. Also, is the 5th page of the super debug menu dummied out or removed completely? If the former, we should find the game genie code for it. If my idea is approved, what should be B+down?