From bd4835f73f7e9f12eb8e3bf6ba2ca70edccd4c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sun, 21 Mar 2021 19:21:39 +0100 Subject: rename --- arm9/arm9.lsf | 2 +- arm9/global.inc | 8 +-- arm9/src/error_message_reset.c | 146 +++++++++++++++++++++++++++++++++++++++++ arm9/src/unk_0208A998.c | 146 ----------------------------------------- include/error_message_reset.h | 39 +++++++++++ include/unk_0208A998.h | 39 ----------- 6 files changed, 187 insertions(+), 193 deletions(-) create mode 100644 arm9/src/error_message_reset.c delete mode 100644 arm9/src/unk_0208A998.c create mode 100644 include/error_message_reset.h delete mode 100644 include/unk_0208A998.h diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 1b6a6d66..9bd6cb07 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -317,7 +317,7 @@ Static arm9 Object unk_0208A258.o Object unk_0208A300.o Object unk_0208A338.o - Object unk_0208A998.o + Object error_message_reset.o ### Third-party libraries ### Object unk_0208AC14.o Object custom_allocator.o diff --git a/arm9/global.inc b/arm9/global.inc index eb2a9be3..d269aed4 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8518,10 +8518,4 @@ .extern CARDi_InitCommon .extern MonNotFaintedOrEgg .extern CountAlivePokemon -.extern UNK_020FF49C -.extern UNK_020FF4A4 -.extern UNK_020FF4AC -.extern UNK_020FF4BC -.extern UNK_020FF4D8 -.extern sErrorMessagePrinterLock -.extern FUN_0208A998 + diff --git a/arm9/src/error_message_reset.c b/arm9/src/error_message_reset.c new file mode 100644 index 00000000..bbab7899 --- /dev/null +++ b/arm9/src/error_message_reset.c @@ -0,0 +1,146 @@ +#include "error_message_reset.h" + +const u32 UNK_020FF49C[2] = { 0x1a030300, 0x00230112 }; + +const u32 UNK_020FF4A4[2] = { 0x00020000, 0x00000000 }; + +const struct GraphicsModes UNK_020FF4AC = { mode1 : 1 }; + +const u32 UNK_020FF4BC[7] = { 0x00, 0x00, 0x0800, 0x00, 0x06000001, 0x0100, 0x00 }; + +const struct GraphicsBanks UNK_020FF4D8 = { bg : 3 }; + +u32 sErrorMessagePrinterLock; + +extern void FUN_0200E3A0(PMLCDTarget, int); +extern void FUN_0201E6D8(); +extern void FUN_0201E7A0(); +extern void FUN_0201E66C(const struct GraphicsBanks *banks); +extern u32 *FUN_02016B94(u32 param0); +extern void FUN_02016BBC(const struct GraphicsModes *modes); +extern void FUN_02016C18(u32 *param0, u32 param1, void *param2, u32 param3); +extern void FUN_02018744(u32 *param0, u32 param1); +extern void FUN_0200CB00(u32 *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5); +extern void FUN_02002ED0(u32 param0, u32 param1, u32 param2); +extern void FUN_02017F18(u32 param0, u32 param1, u32 param2, u32 param3); +extern void FUN_02017FE4(u32 param0, u32 param1); +extern void FUN_02019150(u32 *param0, u32 *param1, const u32 *param2); +extern void FUN_020196F4(u32 *, u8, u16, u16, u16, u16); +extern void FUN_0200CCA4(u32 *param0, u32 param1, u32 param2, u32 param3); +extern void FUN_0201E788(); +extern void FUN_0200E394(u32 param0); +extern void FUN_0200A274(u32 param0, u32 param1, u32 param2); +extern BOOL FUN_02032DAC(void); +extern BOOL FUN_0202FB80(void); +extern BOOL FUN_02033678(void); +extern void FUN_02019178(u32 *param0); +extern void FUN_0201E740(); + +THUMB_FUNC void VBlankHandler() +{ + *(vu32 *)HW_INTR_CHECK_BUF |= 1; + + MI_WaitDma(3); +} + +THUMB_FUNC void PrintErrorMessageAndReset() +{ + + u32 *ptr; + u32 buf[4]; + + if (sErrorMessagePrinterLock != 1) + { + sErrorMessagePrinterLock = 1; + OS_SetArenaHi(OS_ARENA_MAIN, OS_GetInitArenaHi(OS_ARENA_MAIN)); + OS_SetArenaLo(OS_ARENA_MAIN, OS_GetInitArenaLo(OS_ARENA_MAIN)); + + FUN_020166C8((u32 *)UNK_020FF4A4, 1, 1, 0); + FUN_0200E3A0(PM_LCD_TOP, 0); + FUN_0200E3A0(PM_LCD_BOTTOM, 0); + + OS_DisableIrqMask(1); + OS_SetIrqFunction(1, &VBlankHandler); + OS_EnableIrqMask(1); + + Main_SetVBlankIntrCB(NULL, NULL); + + FUN_02015F34(NULL, NULL); + FUN_0201E6D8(); + FUN_0201E740(); + + reg_GX_DISPCNT &= 0xFFFFE0FF; + reg_GXS_DB_DISPCNT &= 0xFFFFE0FF; + + FUN_0201669C(4, 8); + + gMain.unk65 = 0; + FUN_0201E7A0(); + + reg_G2_BLDCNT = 0; + reg_G2S_DB_BLDCNT = 0; + reg_GX_DISPCNT &= 0xFFFF1FFF; + reg_GXS_DB_DISPCNT &= 0xFFFF1FFF; + + FUN_0201E66C(&UNK_020FF4D8); + ptr = FUN_02016B94(0); + FUN_02016BBC(&UNK_020FF4AC); + + FUN_02016C18(ptr, 0, UNK_020FF4BC, 0); + FUN_02018744(ptr, 0); + + FUN_0200CB00(ptr, 0, 503, 2, 0, 0); + + FUN_02002ED0(0, 0x20, 0); + FUN_02017F18(0, 0x20, 0, 0); + FUN_02017FE4(0, 0x6C21); + FUN_02017FE4(4, 0x6C21); + + struct MsgData *msg_data = NewMsgDataFromNarc(1, NARC_MSGDATA_MSG, 0xc8, 0); + struct String *str = String_ctor(6 << 6, 0); + + FUN_0201BD5C(); + FUN_02019150(ptr, buf, UNK_020FF49C); + FUN_020196F4(buf, 15, 0, 0, 0xd0, 0x90); + FUN_0200CCA4(buf, 0, 0x1f7, 2); + + ReadMsgDataIntoString(msg_data, 3, str); + + AddTextPrinterParameterized((u32)buf, 0, (const u16 *)str, 0, 0, 0, NULL); // wtf + + String_dtor(str); + FUN_0201E788(); + FUN_0200E394(0); + FUN_0200E394(1); + FUN_0200A274(0, 0x3f, 3); + FUN_02032DAC(); + + lid: + HandleDSLidAction(); + FUN_0202FB80(); + if (!FUN_02033678()) + { + OS_WaitIrq(1, 1); + goto lid; + } + + + lid2: + HandleDSLidAction(); + if (!((u16)(((reg_PAD_KEYINPUT | *(vu16 *)HW_BUTTON_XY_BUF) ^ 0x2FFF) & 0x2FFF) & 1)) + { + OS_WaitIrq(1, 1); + goto lid2; + } + + FUN_0200E3A0(PM_LCD_TOP, 0x7FFF); + FUN_0200E3A0(PM_LCD_BOTTOM, 0x7FFF); + + FUN_02019178(buf); + + DestroyMsgData(msg_data); + FreeToHeap(ptr); + + OS_ResetSystem(0); + } +} \ No newline at end of file diff --git a/arm9/src/unk_0208A998.c b/arm9/src/unk_0208A998.c deleted file mode 100644 index 2112fbd1..00000000 --- a/arm9/src/unk_0208A998.c +++ /dev/null @@ -1,146 +0,0 @@ -#include "unk_0208A998.h" - -const u32 UNK_020FF49C[2] = { 0x1a030300, 0x00230112 }; - -const u32 UNK_020FF4A4[2] = { 0x00020000, 0x00000000 }; - -const struct GraphicsModes UNK_020FF4AC = { mode1 : 1 }; - -const u32 UNK_020FF4BC[7] = { 0x00, 0x00, 0x0800, 0x00, 0x06000001, 0x0100, 0x00 }; - -const struct GraphicsBanks UNK_020FF4D8 = { bg : 3 }; - -u32 sErrorMessagePrinterLock; - -extern void FUN_0200E3A0(PMLCDTarget, int); -extern void FUN_0201E6D8(); -extern void FUN_0201E7A0(); -extern void FUN_0201E66C(const struct GraphicsBanks *banks); -extern u32 *FUN_02016B94(u32 param0); -extern void FUN_02016BBC(const struct GraphicsModes *modes); -extern void FUN_02016C18(u32 *param0, u32 param1, void *param2, u32 param3); -extern void FUN_02018744(u32 *param0, u32 param1); -extern void FUN_0200CB00(u32 *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5); -extern void FUN_02002ED0(u32 param0, u32 param1, u32 param2); -extern void FUN_02017F18(u32 param0, u32 param1, u32 param2, u32 param3); -extern void FUN_02017FE4(u32 param0, u32 param1); -extern void FUN_02019150(u32 *param0, u32 *param1, const u32 *param2); -extern void FUN_020196F4(u32 *, u8, u16, u16, u16, u16); -extern void FUN_0200CCA4(u32 *param0, u32 param1, u32 param2, u32 param3); -extern void FUN_0201E788(); -extern void FUN_0200E394(u32 param0); -extern void FUN_0200A274(u32 param0, u32 param1, u32 param2); -extern BOOL FUN_02032DAC(void); -extern BOOL FUN_0202FB80(void); -extern BOOL FUN_02033678(void); -extern void FUN_02019178(u32 *param0); -extern void FUN_0201E740(); - -THUMB_FUNC void FUN_0208A998() -{ - *(vu32 *)HW_INTR_CHECK_BUF |= 1; - - MI_WaitDma(3); -} - -THUMB_FUNC void PrintErrorMessageAndReset() -{ - - u32 *ptr; - u32 buf[4]; - - if (sErrorMessagePrinterLock != 1) - { - sErrorMessagePrinterLock = 1; - OS_SetArenaHi(OS_ARENA_MAIN, OS_GetInitArenaHi(OS_ARENA_MAIN)); - OS_SetArenaLo(OS_ARENA_MAIN, OS_GetInitArenaLo(OS_ARENA_MAIN)); - - FUN_020166C8((u32 *)UNK_020FF4A4, 1, 1, 0); - FUN_0200E3A0(PM_LCD_TOP, 0); - FUN_0200E3A0(PM_LCD_BOTTOM, 0); - - OS_DisableIrqMask(1); - OS_SetIrqFunction(1, &FUN_0208A998); - OS_EnableIrqMask(1); - - Main_SetVBlankIntrCB(NULL, NULL); - - FUN_02015F34(NULL, NULL); - FUN_0201E6D8(); - FUN_0201E740(); - - reg_GX_DISPCNT &= 0xFFFFE0FF; - reg_GXS_DB_DISPCNT &= 0xFFFFE0FF; - - FUN_0201669C(4, 8); - - gMain.unk65 = 0; - FUN_0201E7A0(); - - reg_G2_BLDCNT = 0; - reg_G2S_DB_BLDCNT = 0; - reg_GX_DISPCNT &= 0xFFFF1FFF; - reg_GXS_DB_DISPCNT &= 0xFFFF1FFF; - - FUN_0201E66C(&UNK_020FF4D8); - ptr = FUN_02016B94(0); - FUN_02016BBC(&UNK_020FF4AC); - - FUN_02016C18(ptr, 0, UNK_020FF4BC, 0); - FUN_02018744(ptr, 0); - - FUN_0200CB00(ptr, 0, 503, 2, 0, 0); - - FUN_02002ED0(0, 0x20, 0); - FUN_02017F18(0, 0x20, 0, 0); - FUN_02017FE4(0, 0x6C21); - FUN_02017FE4(4, 0x6C21); - - struct MsgData *msg_data = NewMsgDataFromNarc(1, NARC_MSGDATA_MSG, 0xc8, 0); - struct String *str = String_ctor(6 << 6, 0); - - FUN_0201BD5C(); - FUN_02019150(ptr, buf, UNK_020FF49C); - FUN_020196F4(buf, 15, 0, 0, 0xd0, 0x90); - FUN_0200CCA4(buf, 0, 0x1f7, 2); - - ReadMsgDataIntoString(msg_data, 3, str); - - AddTextPrinterParameterized((u32)buf, 0, (const u16 *)str, 0, 0, 0, NULL); // wtf - - String_dtor(str); - FUN_0201E788(); - FUN_0200E394(0); - FUN_0200E394(1); - FUN_0200A274(0, 0x3f, 3); - FUN_02032DAC(); - - lid: - HandleDSLidAction(); - FUN_0202FB80(); - if (!FUN_02033678()) - { - OS_WaitIrq(1, 1); - goto lid; - } - - - lid2: - HandleDSLidAction(); - if (!((u16)(((reg_PAD_KEYINPUT | *(vu16 *)HW_BUTTON_XY_BUF) ^ 0x2FFF) & 0x2FFF) & 1)) - { - OS_WaitIrq(1, 1); - goto lid2; - } - - FUN_0200E3A0(PM_LCD_TOP, 0x7FFF); - FUN_0200E3A0(PM_LCD_BOTTOM, 0x7FFF); - - FUN_02019178(buf); - - DestroyMsgData(msg_data); - FreeToHeap(ptr); - - OS_ResetSystem(0); - } -} \ No newline at end of file diff --git a/include/error_message_reset.h b/include/error_message_reset.h new file mode 100644 index 00000000..90e70465 --- /dev/null +++ b/include/error_message_reset.h @@ -0,0 +1,39 @@ +#ifndef POKEDIAMOND_ERROR_MESSAGE_RESET_H +#define POKEDIAMOND_ERROR_MESSAGE_RESET_H + +#include "global.h" +#include "heap.h" +#include "SPI_pm.h" +#include "game_init.h" +#include "msgdata.h" +#include "text.h" + + + +struct GraphicsBanks +{ + s32 bg; + s32 bgextpltt; + s32 subbg; + s32 subbgextpltt; + s32 obj; + s32 objextpltt; + s32 subobj; + s32 subobjextpltt; + s32 tex; + s32 pltt; +}; + + +struct GraphicsModes { + u32 mode1; + u32 mode2; + u32 mode3; + u32 mode4; +}; + + +THUMB_FUNC void VBlankHandler(); +THUMB_FUNC void PrintErrorMessageAndReset(); + +#endif //POKEDIAMOND_ERROR_MESSAGE_RESET_H \ No newline at end of file diff --git a/include/unk_0208A998.h b/include/unk_0208A998.h deleted file mode 100644 index a3266398..00000000 --- a/include/unk_0208A998.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef POKEDIAMOND_ERROR_MESSAGE_RESET_H -#define POKEDIAMOND_ERROR_MESSAGE_RESET_H - -#include "global.h" -#include "heap.h" -#include "SPI_pm.h" -#include "game_init.h" -#include "msgdata.h" -#include "text.h" - - - -struct GraphicsBanks -{ - s32 bg; - s32 bgextpltt; - s32 subbg; - s32 subbgextpltt; - s32 obj; - s32 objextpltt; - s32 subobj; - s32 subobjextpltt; - s32 tex; - s32 pltt; -}; - - -struct GraphicsModes { - u32 mode1; - u32 mode2; - u32 mode3; - u32 mode4; -}; - - -THUMB_FUNC void FUN_0208A998(); -THUMB_FUNC void PrintErrorMessageAndReset(); - -#endif //POKEDIAMOND_ERROR_MESSAGE_RESET_H \ No newline at end of file -- cgit v1.2.3