diff options
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/crash.c | 55 | ||||
-rw-r--r-- | src/debug/matsuda_debug_menu.c | 62 |
2 files changed, 56 insertions, 61 deletions
diff --git a/src/debug/crash.c b/src/debug/crash.c new file mode 100644 index 000000000..702dbc32a --- /dev/null +++ b/src/debug/crash.c @@ -0,0 +1,55 @@ +#include "global.h" +#include "main.h" +#include "task.h" +#include "text.h" +#include "palette.h" + +extern struct Window gUnknown_03004210; + +static void CB2_CrashIdle(void); + +// unused exception handler. Takes a string input describing the exception +// and halts on a black screen. Used in German Debug Ruby. +void Crash(u8 *text) +{ + u16 savedIme; + + REG_BG0HOFS = 0; + REG_BG0VOFS = 0; + REG_BG1HOFS = 0; + REG_BG1VOFS = 0; + REG_BG2HOFS = 0; + REG_BG2VOFS = 0; + REG_BG3HOFS = 0; + REG_BG3VOFS = 0; + REG_WIN0H = 0; + REG_WIN0V = 0; + REG_WIN1H = 0; + REG_WIN1V = 0; + REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON; + savedIme = REG_IME; + REG_IME = 0; + REG_IE |= INTR_FLAG_VBLANK; + REG_IME = savedIme; + REG_DISPSTAT = 8; + ResetTasks(); + ResetSpriteData(); + SetMainCallback2(CB2_CrashIdle); + DmaFill32Large(3, 0, (void *)VRAM, 0x18000, 0x1000); + Text_LoadWindowTemplate(&gWindowTemplate_81E6FD8); + Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6FD8); + LoadFontDefaultPalette(&gWindowTemplate_81E6FD8); + Text_InitWindowAndPrintText(&gUnknown_03004210, text, 1, 9, 7); +} + +static void CB2_CrashIdle(void) +{ + REG_BG0HOFS = 0; + REG_BG0VOFS = 0; + REG_BG1HOFS = 0; + REG_BG1VOFS = 0; + REG_BG2HOFS = 0; + REG_BG2VOFS = 0; + REG_BG3HOFS = 0; + REG_BG3VOFS = 0; +} diff --git a/src/debug/matsuda_debug_menu.c b/src/debug/matsuda_debug_menu.c index 1da337b04..b879584dd 100644 --- a/src/debug/matsuda_debug_menu.c +++ b/src/debug/matsuda_debug_menu.c @@ -37,7 +37,7 @@ extern u16 gBattle_BG2_X; extern u16 gBattle_BG2_Y; extern u16 gBattle_BG3_X; extern u16 gBattle_BG3_Y; -extern struct Window gUnknown_03004210; + extern u8 (*gCallback_03004AE8)(void); extern bool8 gReceivedRemoteLinkPlayers; @@ -1032,63 +1032,3 @@ u8 MatsudaDebugMenu_SetArtMuseumItems(void) CloseMenu(); return 1; } - -void unref_sub_80AB084(u8 *text) -{ - u16 savedIme; - u8 *addr; - size_t size; - - REG_BG0HOFS = 0; - REG_BG0VOFS = 0; - REG_BG1HOFS = 0; - REG_BG1VOFS = 0; - REG_BG2HOFS = 0; - REG_BG2VOFS = 0; - REG_BG3HOFS = 0; - REG_BG3VOFS = 0; - REG_WIN0H = 0; - REG_WIN0V = 0; - REG_WIN1H = 0; - REG_WIN1V = 0; - REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON; - - savedIme = REG_IME; - REG_IME = 0; - REG_IE |= INTR_FLAG_VBLANK; - REG_IME = savedIme; - REG_DISPSTAT = 8; - ResetTasks(); - ResetSpriteData(); - SetMainCallback2(sub_80AB184); - - addr = (void *)VRAM; - size = 0x18000; - while (1) - { - DmaFill32(3, 0, addr, 0x1000); - addr += 0x1000; - size -= 0x1000; - if (size <= 0x1000) - { - DmaFill32(3, 0, addr, size); - break; - } - } - Text_LoadWindowTemplate(&gWindowTemplate_81E6FD8); - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6FD8); - LoadFontDefaultPalette(&gWindowTemplate_81E6FD8); - Text_InitWindowAndPrintText(&gUnknown_03004210, text, 1, 9, 7); -} - -void sub_80AB184(void) -{ - REG_BG0HOFS = 0; - REG_BG0VOFS = 0; - REG_BG1HOFS = 0; - REG_BG1VOFS = 0; - REG_BG2HOFS = 0; - REG_BG2VOFS = 0; - REG_BG3HOFS = 0; - REG_BG3VOFS = 0; -} |