summaryrefslogtreecommitdiff
path: root/arm9/src/error_message_reset.c
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/src/error_message_reset.c')
-rw-r--r--arm9/src/error_message_reset.c70
1 files changed, 45 insertions, 25 deletions
diff --git a/arm9/src/error_message_reset.c b/arm9/src/error_message_reset.c
index 07c285a4..e0d01bde 100644
--- a/arm9/src/error_message_reset.c
+++ b/arm9/src/error_message_reset.c
@@ -3,26 +3,46 @@
#include "gx.h"
#include "unk_02031734.h"
#include "unk_0202F150.h"
-#include "unk_02016B94.h"
+#include "bg_window.h"
#include "PAD_pad.h"
-const struct UnkStruct_02016B94_4 UNK_020FF49C = { 0, 3, 3, 0x1a, 0x12, 1, 0x23 };
+const struct WindowTemplate UNK_020FF49C = {
+ .bgId = GF_BG_LYR_MAIN_0,
+ .tilemapLeft = 3,
+ .tilemapTop = 3,
+ .width = 26,
+ .height = 18,
+ .paletteNum = 1,
+ .baseTile = 0x23
+};
const struct HeapParam UNK_020FF4A4[] = {
{0x00020000, OS_ARENA_MAIN}
};
-const struct GraphicsModes UNK_020FF4AC = { dispMode : GX_DISPMODE_GRAPHICS };
-
-const struct UnkStruct_02016B94_1 UNK_020FF4BC = { 0, 0, 0x800, 0, 1, 0, 0, 6, 0, 1, 0, 0, 0 };
+const struct GraphicsModes UNK_020FF4AC = { .dispMode = GX_DISPMODE_GRAPHICS };
+
+const struct BgTemplate UNK_020FF4BC = {
+ .x = 0,
+ .y = 0,
+ .bufferSize = 0x800,
+ .baseTile = 0,
+ .size = GF_BG_SCR_SIZE_256x256,
+ .colorMode = GX_BG_COLORMODE_16,
+ .screenBase = GX_BG_SCRBASE_0x0000, .charBase = GX_BG_CHARBASE_0x18000,
+ .bgExtPltt = GX_BG_EXTPLTT_01,
+ .priority = 1,
+ .areaOver = 0,
+ .mosaic = FALSE
+};
-const struct GraphicsBanks UNK_020FF4D8 = { bg : 3 };
+const struct GraphicsBanks UNK_020FF4D8 = { .bg = 3 };
u32 sErrorMessagePrinterLock;
extern void FUN_0200E3A0(PMLCDTarget, int);
-extern void FUN_0200CB00(struct UnkStruct_02016B94_2 *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5);
+extern void FUN_0200CB00(struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5);
extern void FUN_02002ED0(u32 param0, u32 param1, u32 param2);
extern void FUN_0200CCA4(struct Window *param0, u32 param1, u32 param2, u32 param3);
extern void FUN_0200E394(u32 param0);
@@ -30,15 +50,14 @@ extern void FUN_0200A274(u32 param0, u32 param1, u32 param2);
THUMB_FUNC void VBlankHandler()
{
- *(vu32 *)HW_INTR_CHECK_BUF |= 1;
-
+ OS_SetIrqCheckFlag(OS_IE_V_BLANK);
MI_WaitDma(3);
}
THUMB_FUNC void PrintErrorMessageAndReset()
{
- struct UnkStruct_02016B94_2 *ptr;
+ struct BgConfig *ptr;
struct Window buf;
if (sErrorMessagePrinterLock != 1)
@@ -61,38 +80,39 @@ THUMB_FUNC void PrintErrorMessageAndReset()
GX_DisableEngineALayers();
GX_DisableEngineBLayers();
- reg_GX_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK;
- reg_GXS_DB_DISPCNT &= ~REG_GXS_DB_DISPCNT_DISPLAY_MASK;
+ GX_SetVisiblePlane(0);
+ GXS_SetVisiblePlane(0);
SetKeyRepeatTimers(4, 8);
gMain.unk65 = 0;
GX_SwapDisplay();
- reg_G2_BLDCNT = 0;
- reg_G2S_DB_BLDCNT = 0;
- reg_GX_DISPCNT &= ~(REG_GX_DISPCNT_OW_MASK | REG_GX_DISPCNT_W1_MASK | REG_GX_DISPCNT_W0_MASK);
- reg_GXS_DB_DISPCNT &= ~(REG_GXS_DB_DISPCNT_OW_MASK | REG_GXS_DB_DISPCNT_W1_MASK | REG_GXS_DB_DISPCNT_W0_MASK);
+ G2_BlendNone();
+ G2S_BlendNone();
+
+ GX_SetVisibleWnd(0);
+ GXS_SetVisibleWnd(0);
GX_SetBanks(&UNK_020FF4D8);
- ptr = FUN_02016B94(0);
- FUN_02016BBC(&UNK_020FF4AC);
+ ptr = BgConfig_Alloc(0);
+ SetBothScreensModesAndDisable(&UNK_020FF4AC);
- FUN_02016C18(ptr, 0, &UNK_020FF4BC, 0);
- FUN_02018744(ptr, 0);
+ InitBgFromTemplate(ptr, 0, &UNK_020FF4BC, 0);
+ BgClearTilemapBufferAndCommit(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);
+ BG_ClearCharDataRange(0, 0x20, 0, 0);
+ BG_SetMaskColor(0, 0x6C21);
+ BG_SetMaskColor(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);
+ AddWindow(ptr, &buf, &UNK_020FF49C);
FillWindowPixelRect(&buf, 15, 0, 0, 0xd0, 0x90);
FUN_0200CCA4(&buf, 0, 0x1f7, 2);
@@ -126,7 +146,7 @@ THUMB_FUNC void PrintErrorMessageAndReset()
FUN_0200E3A0(PM_LCD_TOP, 0x7FFF);
FUN_0200E3A0(PM_LCD_BOTTOM, 0x7FFF);
- FUN_02019178(&buf);
+ RemoveWindow(&buf);
DestroyMsgData(msg_data);
FreeToHeap(ptr);