Table of Contents
Static Code Analysis
We’ve found some functions key in determining how the game works.
FUN_80020170- the game’s decompress function for files.
FUN_8007d334- used to load a rectangle for an image to be drawn in.
- The actual function to load an image, that uses this, is in
sub_8007d578.
FUN_8001bad8- used to draw Japanese characters from the main text box Overlay.
FUN_8001bc9cfor English/ASCII characters (such as enemy names in the top right)sub_8001F57C- utilizes
DAT_800E0190which holds an array of 6 elements, which is populated by the file to handle/track to every BIN file.
- utilizes
sub_8001F57Clooks up a blob/Overlay part from one of those 6 BIN files, by a size-offset pair, and return a pointer to that blob.- then receives the index to the BIN file it should take the blob from (which is indirectly clamped by
sub_8001E12Cdue to it loading 6 files) - And the
sizeOffsetPairis size in the lower0x1FFFFbits, shifted right by 2. And the top0x7FFFbits are the offset into the BIN file. - it can be assumed that there ISN’T necessarily a global lookup table to all the blobs in the BIN files, but the game might just hardcode the offset and sizes where it needs it.
- Need to find all the references to
sub_8001F57C, collect the size offset pairs, and later patch them, if any of the blobs changed in size or offset. Maybe by a script or something.
- then receives the index to the BIN file it should take the blob from (which is indirectly clamped by
sub_8001E208is used to load the blobs fromOVR.BIN- Used this to confirm that the table in
OVR.BINencapsulates the whole file. - there seems to be a hard cap for
0x3Fsectors inOVR.BIN
- Used this to confirm that the table in
sub_8001e504loads textures with magic identifierTEXfrom eitherCHR.BINorMAP.BIN.- these textures type may only be in those two BIN files.
Quick Function Key
FUN_80020170= decompressFUN_8007d2cc= DrawSyncFUN_8007d234= SetDispMaskFUN_8007cf50= ResetGraphFUN_8007d0c4= SetGraphDebugFUN_8007d334= StoreImageFUN_8007d7b8= ClearOTagRFUN_8007d1d4= DrawSyncCallbackFUN_8001f74c= SystemErrorFUN_800872a4= GetVideoModeFUN_800976f0= SpuVoiceAttrFUN_8009b830= SpuVolumeFUN_80099480= SpuInitHotFUN_8007ba20= SetGeomOffsetFUN_8007ba40= SetGeomScreenFUN_8009d0c0= SsSetStereoFUN_8001bc9c= GetCharacterDataFUN_8001bad8= DrawLargeCharacterFUN_8001d58c= DrawSmallCharacterFUN_8001cd14= PrintText (Brightis Specific)FUN_8001cd34= PrintTextBuffer (Brightis Specific)FUN_8001fb94= LoadProgOverlay (Brightis Specific)FUN_801540b4= RenderTextBuffer (Brightis Specific)FUN_80020014= InitializeOnmOverlayTable (Brightis Specific)FUN_800200ac= InitializeOverlayTable (Brightis Specific)
Keep an eye on:
FUN_8001bad8- SJIS Controller(?)FUN_8001fb94- Related to “Ovr Prog” (Prgressive Overlay)FUN_8001fd8c- Related to “CnstOvr” (Constant Overlay)FUN_8002a4b8- Mentions of “DEMO PLAY” “DEMO REC” etc.
Triggering DEBUG MODE
DAT_800aebeahas to be0x800(or any value that has that bit set at least) (Part of Controler input?)DAT_800aec04set to0x20(or any value that has this bit set)0x801ffffc(in RAM) must be set to “DeV” or “PrV”
The game has verious checks to see if it’s in Debug. We’ve noticed there are various values it can be set to. All of these Debug modes seem to assume that “no CD (is) inserted.”
1: Best for testing and activating the debug mode (will not access Debug Menu 2)2: Same as above with access to Debug Menu 2 options4: Testing mode(?)- This runs into issues when loading the BIN files actually, if mode is >
2, it runs into not only into this trap, but also throws an error when it gets out of it. 4is also specially checked throughout the game, which might lead to different, non-desirable behaviour.- Maybe a mode to load files from an external drive or something?
- This runs into issues when loading the BIN files actually, if mode is >
8: proper debug mode. Makes frequent use of the hardware breakpoint0x101from which we don’t know how to recover from.
TODO: Figure out how to get this working outside of Code Patching.