diff options
Diffstat (limited to 'arm9/src')
-rw-r--r-- | arm9/src/bg_window.c | 2 | ||||
-rw-r--r-- | arm9/src/communication_error.c | 5 | ||||
-rw-r--r-- | arm9/src/error_message_reset.c | 5 | ||||
-rw-r--r-- | arm9/src/render_window.c | 1027 | ||||
-rw-r--r-- | arm9/src/save_data_read_error.c | 7 | ||||
-rw-r--r-- | arm9/src/save_data_write_error.c | 5 | ||||
-rw-r--r-- | arm9/src/scrcmd.c | 32 | ||||
-rw-r--r-- | arm9/src/text_02054590.c | 20 | ||||
-rw-r--r-- | arm9/src/wfc_user_info_warning.c | 5 |
9 files changed, 1057 insertions, 51 deletions
diff --git a/arm9/src/bg_window.c b/arm9/src/bg_window.c index 2986645f..f1a5e525 100644 --- a/arm9/src/bg_window.c +++ b/arm9/src/bg_window.c @@ -1366,7 +1366,7 @@ THUMB_FUNC void CopyBgTilemapRectAffine(struct Bg *bg, } THUMB_FUNC void FillBgTilemapRect(struct BgConfig *bgConfig, - u32 bgId, + u8 bgId, u16 fillValue, u8 x, u8 y, diff --git a/arm9/src/communication_error.c b/arm9/src/communication_error.c index 04058b83..848e3d0a 100644 --- a/arm9/src/communication_error.c +++ b/arm9/src/communication_error.c @@ -7,9 +7,8 @@ #include "msgdata/msg.naix" #include "text.h" #include "brightness.h" +#include "render_window.h" -extern void FUN_0200CB00(struct BgConfig* bg_config, enum GFBgLayer layer, u32 num_tiles, u32, u8, u32 heap_id); -extern void FUN_0200CCA4(struct Window* window, BOOL copy_to_vram, u16 fill_value, u32 palette_num); extern void FUN_0200E394(BOOL set_brightness_on_bottom_screen); extern void FUN_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); @@ -136,7 +135,7 @@ THUMB_FUNC void ShowCommunicationError(u32 heap_id, u32 error, u32 error_code) AddWindow(bg_config, &window, &sCommunicationErrorWindowTemplate); FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); - FUN_0200CCA4(&window, FALSE, 0x01F7, 2); + DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); BufferIntegerAsString(mgr, 0, (s32)error_code, 5, 2, 1); ReadMsgDataIntoString(error_message_data, error_message_no, tmp_str); diff --git a/arm9/src/error_message_reset.c b/arm9/src/error_message_reset.c index 97bc7c70..12af3c6f 100644 --- a/arm9/src/error_message_reset.c +++ b/arm9/src/error_message_reset.c @@ -7,6 +7,7 @@ #include "PAD_pad.h" #include "font.h" #include "brightness.h" +#include "render_window.h" const struct WindowTemplate UNK_020FF49C = { @@ -44,8 +45,6 @@ const struct GraphicsBanks UNK_020FF4D8 = { .bg = 3 }; u32 sErrorMessagePrinterLock; extern void FUN_0200E3A0(PMLCDTarget, int); -extern void FUN_0200CB00(struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5); -extern void FUN_0200CCA4(struct Window *param0, u32 param1, u32 param2, u32 param3); extern void FUN_0200E394(u32 param0); THUMB_FUNC void VBlankHandler() @@ -114,7 +113,7 @@ THUMB_FUNC void PrintErrorMessageAndReset() FUN_0201BD5C(); AddWindow(ptr, &buf, &UNK_020FF49C); FillWindowPixelRect(&buf, 15, 0, 0, 0xd0, 0x90); - FUN_0200CCA4(&buf, 0, 0x1f7, 2); + DrawFrameAndWindow1(&buf, 0, 0x1f7, 2); ReadMsgDataIntoString(msg_data, 3, str); diff --git a/arm9/src/render_window.c b/arm9/src/render_window.c new file mode 100644 index 00000000..7a682eb6 --- /dev/null +++ b/arm9/src/render_window.c @@ -0,0 +1,1027 @@ +#include "global.h" +#include "render_window.h" +#include "filesystem.h" +#include "gf_gfx_loader.h" +#include "graphic/field_board.naix" +#include "graphic/winframe.naix" +#include "pokemon.h" +#include "render_text.h" +#include "unk_020061E8.h" +#include "unk_0200BB14.h" +#include "unk_0200CA44.h" + +const struct UnkStruct_0200CABC_3 UNK_020ECE88 = { + 10, + 0, + 10, + 10, +}; + +const struct UnkStruct_0200CABC_3 UNK_020ECE98 = { + 0, + 0, + 10, + 10, +}; + +extern void FUN_02020130(u32 param0, u32 param1); +extern u32 FUN_0202022C(u32 param0); +extern void FUN_020201E4(u32 param0, u32 param1); +extern void FUN_0201FDEC(u32 param0); +extern void MOD05_021D99F8(struct UnkStruct_0200CABC_2 *param0); +extern void *FUN_0201B6C8(BOOL); +extern void MOD05_021D959C( + struct UnkStruct_0200CABC_2 *param0, void *param1, u32 param2, u32 param3); +extern void MOD05_021D967C(struct UnkStruct_0200CABC_2 *param0, + NarcId narcId, + s32 memberId, + u32 param3, + u32 param4, + u32 param5, + u32 param6); +extern void MOD05_021D96F4( + struct UnkStruct_0200CABC_2 *param0, NarcId narcId, s32 memberId, u32 param3, u32 param4); +extern void MOD05_021D9708( + struct UnkStruct_0200CABC_2 *param0, NarcId narcId, s32 memberId, u32 param3, u32 param4); +extern void MOD05_021D971C(struct UnkStruct_0200CABC_2 *param0, + NarcId narcId, + s32 memberId, + u32 param3, + u32 param4, + u32 param5); +extern u32 *MOD05_021D9820(struct UnkStruct_0200CABC_2 *param0, void *); +extern struct UnkStruct63_021DB450 *FUN_02006D98(u32); +extern void FUN_020072E8(struct UnkStruct63_021DB450 *param0); +extern void FUN_02012400(u16, u16, u16, void *, void *); +extern u32 NNS_G2dGetImageLocation(u32, u32); +extern void *FUN_02012470(u16, u16, u16); +extern u32 NNS_G2dGetImagePaletteLocation(u32, u32); + +THUMB_FUNC u32 FUN_0200CABC( + struct BgConfig *bgConfig, u32 layer, u32 numTiles, u32 param3, u32 heap_id) +{ + if (param3 == 0) + { + return GfGfxLoader_LoadCharData(NARC_GRAPHIC_WINFRAME, + NARC_winframe_narc_0000_NCGR, + bgConfig, + layer, + numTiles, + 0, + FALSE, + heap_id); + } + + return GfGfxLoader_LoadCharData(NARC_GRAPHIC_WINFRAME, + NARC_winframe_narc_0001_NCGR, + bgConfig, + layer, + numTiles, + 0, + FALSE, + heap_id); +} + +THUMB_FUNC s32 FUN_0200CAFC(void) +{ + return NARC_winframe_narc_0024_NCLR; +} + +THUMB_FUNC void FUN_0200CB00( + struct BgConfig *bg_config, u32 layer, u32 num_tiles, u32 param3, u8 param4, u32 heap_id) +{ + s32 r1; + if (param4 != 0) + { + r1 = NARC_winframe_narc_0001_NCGR; + } + else + { + r1 = NARC_winframe_narc_0000_NCGR; + } + + GfGfxLoader_LoadCharData( + NARC_GRAPHIC_WINFRAME, r1, bg_config, layer, num_tiles, 0, FALSE, heap_id); + + if (param4 == 2) + { + r1 = NARC_winframe_narc_0045_NCLR; + } + else + { + r1 = NARC_winframe_narc_0024_NCLR; + } + + if (layer < 4) + { + GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, r1, 0, param3 << 5, 32, heap_id); + return; + } + + GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, r1, 4, param3 << 5, 32, heap_id); +} + +THUMB_FUNC void DrawFrame1(struct BgConfig *bgConfig, + u8 bgId, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum, + u16 fillValue) +{ + FillBgTilemapRect(bgConfig, bgId, fillValue, (u8)(x - 1), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 1), x, (u8)(y - 1), width, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 2), (u8)(x + width), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 3), (u8)(x - 1), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 5), (u8)(x + width), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 6), (u8)(x - 1), (u8)(y + height), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 7), x, (u8)(y + height), width, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 8), (u8)(x + width), (u8)(y + height), 1, 1, paletteNum); +} + +THUMB_FUNC void DrawFrameAndWindow1( + struct Window *window, BOOL copy_to_vram, u16 fill_value, u8 palette_num) +{ + DrawFrame1(window->bgConfig, + GetWindowBgId(window), + GetWindowX(window), + GetWindowY(window), + GetWindowWidth(window), + GetWindowHeight(window), + palette_num, + fill_value); + + if (!copy_to_vram) + { + CopyWindowToVram(window); + } +} + +THUMB_FUNC void ClearFrameAndWindow1(struct Window *window, BOOL copy_to_vram) +{ + + FillBgTilemapRect(window->bgConfig, + GetWindowBgId(window), + 0, + (u8)(GetWindowX(window) - 1), + (u8)(GetWindowY(window) - 1), + (u8)(GetWindowWidth(window) + 2), + (u8)(GetWindowHeight(window) + 2), + 0); + + if (!copy_to_vram) + { + ClearWindowTilemapAndCopyToVram(window); + } +} + +THUMB_FUNC s32 FUN_0200CD60(s32 param0) +{ + return param0 + 2; +} + +THUMB_FUNC s32 FUN_0200CD64(s32 param0) +{ + return param0 + 25; +} + +THUMB_FUNC void FUN_0200CD68( + struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5) +{ + + GfGfxLoader_LoadCharData( + NARC_GRAPHIC_WINFRAME, FUN_0200CD60(param4), param0, param1, param2, 0, FALSE, param5); + + if (param1 < 4) + { + GfGfxLoader_GXLoadPal( + NARC_GRAPHIC_WINFRAME, FUN_0200CD64(param4), 0, param3 << 5, 32, param5); + return; + } + + GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, FUN_0200CD64(param4), 4, param3 << 5, 32, param5); +} + +THUMB_FUNC void DrawFrame2(struct BgConfig *bgConfig, + u8 bgId, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum, + u16 fillValue) +{ + FillBgTilemapRect(bgConfig, bgId, fillValue, (u8)(x - 2), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 1), (u8)(x - 1), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 2), x, (u8)(y - 1), width, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 3), (u8)(x + width), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 4), (u8)(x + width + 1), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 5), (u8)(x + width + 2), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 6), (u8)(x - 2), y, 1, height, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 7), (u8)(x - 1), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 9), (u8)(x + width), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 10), (u8)(x + width + 1), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 11), (u8)(x + width + 2), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 12), (u8)(x - 2), (u8)(y + height), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 13), (u8)(x - 1), (u8)(y + height), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 14), x, (u8)(y + height), width, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 15), (u8)(x + width), (u8)(y + height), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, + bgId, + (u16)(fillValue + 16), + (u8)(x + width + 1), + (u8)(y + height), + 1, + 1, + paletteNum); + FillBgTilemapRect(bgConfig, + bgId, + (u16)(fillValue + 17), + (u8)(x + width + 2), + (u8)(y + height), + 1, + 1, + paletteNum); +} + +THUMB_FUNC void DrawWindowFrame2(struct Window *window, u32 fill_value, u32 palette_num) +{ + DrawFrame2(window->bgConfig, + GetWindowBgId(window), + GetWindowX(window), + GetWindowY(window), + GetWindowWidth(window), + GetWindowHeight(window), + (u8)palette_num, + (u16)fill_value); +} + +THUMB_FUNC void DrawFrameAndWindow2( + struct Window *window, BOOL copy_to_vram, u16 fill_value, u8 palette_num) +{ + DrawWindowFrame2(window, fill_value, palette_num); + if (!copy_to_vram) + { + CopyWindowToVram(window); + } + + FUN_0200D18C(window, fill_value); +} + +THUMB_FUNC void ClearFrameAndWindow2(struct Window *window, BOOL param1) +{ + FillBgTilemapRect(window->bgConfig, + GetWindowBgId(window), + 0, + (u8)(GetWindowX(window) - 2), + (u8)(GetWindowY(window) - 1), + (u8)(GetWindowWidth(window) + 5), + (u8)(GetWindowHeight(window) + 2), + 0); + + if (!param1) + { + ClearWindowTilemapAndCopyToVram(window); + } +} + +THUMB_FUNC void BlitRect4Bit(u8 *srcPixels, + u16 srcX, + u16 srcY, + u16 srcWidth, + u16 srcHeight, + u8 *dstPixels, + u16 dstWidth, + u16 dstHeight, + u16 dstX, + u16 dstY, + u16 width, + u16 height) +{ + struct Bitmap src; + src.pixels = srcPixels; + src.width = srcWidth; + src.height = srcHeight; + + struct Bitmap dst; + dst.pixels = dstPixels; + dst.width = dstWidth; + dst.height = dstHeight; + + BlitBitmapRect4Bit(&src, &dst, srcX, srcY, dstX, dstY, width, height, 0); +} + +THUMB_FUNC void FUN_0200D18C(struct Window *window, u16 fill_value) +{ + u32 heap_id = BgConfig_GetHeapId(window->bgConfig); + u8 bg_id = GetWindowBgId(window); + + void *ptr = AllocFromHeap(heap_id, 0x180); + void *charptr = BgGetCharPtr(bg_id); + + NNSG2dCharacterData *pCharData; + void *st30; + void *st2c; + st2c = GfGfxLoader_GetCharData( + NARC_GRAPHIC_WINFRAME, NARC_winframe_narc_0022_NCGR, FALSE, &pCharData, heap_id); + st30 = pCharData->pRawData; + + for (u8 i = 0; i < 3; i++) + { + memcpy(ptr + (i << 7), charptr + ((fill_value + 10) << 5), 0x20); + memcpy(ptr + ((i << 7) + 0x20), charptr + ((fill_value + 11) << 5), 0x20); + memcpy(ptr + ((i << 7) + 0x40), charptr + ((fill_value + 10) << 5), 0x20); + memcpy(ptr + ((i << 7) + 0x60), charptr + ((fill_value + 11) << 5), 0x20); + } + + BlitRect4Bit(st30, 4, 0, 12, 0x30, ptr, 12, 0x30, 1, 0, 12, 0x30); + BG_LoadCharTilesData(window->bgConfig, bg_id, ptr, 0x180, (u32)(fill_value + 18)); + FUN_02002840(fill_value); + FreeToHeap(st2c); + FreeToHeap(ptr); +} + +THUMB_FUNC void FUN_0200D274( + struct BgConfig *bg_config, u8 bg_id, u16 param2, u8 param3, u8 param4, u32 heap_id) +{ + + NNSG2dCharacterData *pCharData; + void *stc = GfGfxLoader_GetCharData( + NARC_GRAPHIC_WINFRAME, FUN_0200CD60(param4), FALSE, &pCharData, heap_id); + u8 *ptr = AllocFromHeap(heap_id, 0x240); + memcpy(ptr, pCharData->pRawData, 0x240); + + for (u32 r3 = 0; r3 < 0x240; r3++) + { + u8 r6 = (u8)(ptr[r3] >> 4); + u8 r2 = (u8)(ptr[r3] & 0xf); + if (r6 == 0) + { + r6 = param3; + } + if (r2 == 0) + { + r2 = param3; + } + + ptr[r3] = (u8)(r2 | (r6 << 4)); + } + + BG_LoadCharTilesData(bg_config, bg_id, (u32 *)ptr, 0x240, param2); + FreeToHeap(stc); + FreeToHeap(ptr); +} + +THUMB_FUNC void FUN_0200D300(struct BgConfig *bg_config, + u8 bg_id, + u16 numtiles, + u8 param3, + u8 param4, + u16 param5, + u32 heap_id) +{ + GfGfxLoader_LoadCharData(NARC_GRAPHIC_FIELD_BOARD, + NARC_field_board_narc_0000_NCGR, + bg_config, + bg_id, + numtiles, + 0x3C0, + FALSE, + heap_id); + + NNSG2dPaletteData *pPltData; + void *st14; + st14 = AllocAndReadWholeNarcMemberByIdPair( + NARC_GRAPHIC_FIELD_BOARD, NARC_field_board_narc_0001_NCLR, heap_id); + NNS_G2dGetUnpackedPaletteData(st14, &pPltData); + BG_LoadPlttData(bg_id, pPltData->pRawData + param4 * 0x20, 0x20, (u16)(param3 << 5)); + FreeToHeapExplicit(heap_id, st14); + + if (param4 <= 1) + { + FUN_0200D378(bg_config, bg_id, (u16)(numtiles + 30), param4, param5, heap_id); + } +} + +THUMB_FUNC void FUN_0200D378( + struct BgConfig *bg_config, u8 bg_id, u16 numtiles, u8 param3, u16 param4, u32 heap_id) +{ + if (param3 == 0) + { + param4 += 33; + } + else + { + param4 += 2; + } + + GfGfxLoader_LoadCharData( + NARC_GRAPHIC_FIELD_BOARD, param4, bg_config, bg_id, numtiles, 0x300, FALSE, heap_id); +} + +THUMB_FUNC void DrawFrame3(struct BgConfig *bgConfig, + u8 bgId, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum, + u16 fillValue) +{ + FillBgTilemapRect(bgConfig, bgId, fillValue, (u8)(x - 9), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 1), (u8)(x - 8), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, + bgId, + (u16)(fillValue + 2), + (u8)(x - 7), + (u8)(y - 1), + (u8)(width + 7), + 1, + paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 3), (u8)(x + width), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 4), (u8)(x + width + 1), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 5), (u8)(x + width + 2), (u8)(y - 1), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 6), (u8)(x - 9), y, 1, height, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 7), (u8)(x - 8), y, 1, height, paletteNum); + FillBgTilemapRect(bgConfig, bgId, (u16)(fillValue + 8), (u8)(x - 1), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 9), (u8)(x + width), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 10), (u8)(x + width + 1), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 11), (u8)(x + width + 2), y, 1, height, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 12), (u8)(x - 9), (u8)(y + height), 1, 1, paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 13), (u8)(x - 8), (u8)(y + height), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, + bgId, + (u16)(fillValue + 14), + (u8)(x - 7), + (u8)(y + height), + (u8)(width + 7), + 1, + paletteNum); + FillBgTilemapRect( + bgConfig, bgId, (u16)(fillValue + 15), (u8)(x + width), (u8)(y + height), 1, 1, paletteNum); + FillBgTilemapRect(bgConfig, + bgId, + (u16)(fillValue + 16), + (u8)(x + width + 1), + (u8)(y + height), + 1, + 1, + paletteNum); + FillBgTilemapRect(bgConfig, + bgId, + (u16)(fillValue + 17), + (u8)(x + width + 2), + (u8)(y + height), + 1, + 1, + paletteNum); +} + +THUMB_FUNC void DrawWindowCorner(struct Window *window, u16 fillValue, u8 paletteNum) +{ + u16 i, j; + u16 x, y; + u8 bg_id; + + bg_id = GetWindowBgId(window); + x = (u16)(GetWindowX(window) - 7); + y = GetWindowY(window); + + for (i = 0; i < 4; i++) + { + for (j = 0; j < 6; j++) + { + FillBgTilemapRect(window->bgConfig, + bg_id, + (u16)(fillValue + 6 * i + j), + (u8)(x + j), + (u8)(y + i), + 1, + 1, + paletteNum); + } + } +} + +THUMB_FUNC void DrawFrameAndWindow3( + struct Window *window, BOOL copy_to_vram, u16 fillValue, u8 paletteNum, u8 param4) +{ + u8 bg_id = GetWindowBgId(window); + if (param4 <= 1) + { + DrawFrame3(window->bgConfig, + bg_id, + GetWindowX(window), + GetWindowY(window), + GetWindowWidth(window), + GetWindowHeight(window), + paletteNum, + fillValue); + DrawWindowCorner(window, (u16)(fillValue + 30), paletteNum); + } + else + { + DrawFrame2(window->bgConfig, + bg_id, + GetWindowX(window), + GetWindowY(window), + GetWindowWidth(window), + GetWindowHeight(window), + paletteNum, + fillValue); + } + + if (!copy_to_vram) + { + CopyWindowToVram(window); + } + + FUN_0200D18C(window, fillValue); +} + +THUMB_FUNC void ClearFrameAndWindow3(struct Window *window, u8 param1, BOOL copy_to_vram) +{ + u8 bg_id = GetWindowBgId(window); + if (param1 <= 1) + { + FillBgTilemapRect(window->bgConfig, + bg_id, + 0, + (u8)(GetWindowX(window) - 9), + (u8)(GetWindowY(window) - 1), + (u8)(GetWindowWidth(window) + 11), + (u8)(GetWindowHeight(window) + 2), + 0); + } + else + { + FillBgTilemapRect(window->bgConfig, + bg_id, + 0, + (u8)(GetWindowX(window) - 2), + (u8)(GetWindowY(window) - 1), + (u8)(GetWindowWidth(window) + 4), + (u8)(GetWindowHeight(window) + 2), + 0); + } + + if (!copy_to_vram) + { + ClearWindowTilemapAndCopyToVram(window); + } +} + +THUMB_FUNC struct UnkStruct_0200CABC_1 *FUN_0200D858(struct Window *window, u32 param1) +{ + u32 heap_id = BgConfig_GetHeapId(window->bgConfig); + void *charptr = BgGetCharPtr(GetWindowBgId(window)); + + struct UnkStruct_0200CABC_1 *ptr = AllocFromHeap(heap_id, sizeof(struct UnkStruct_0200CABC_1)); + memcpy(ptr->unk004[8], charptr + (param1 + 18) * 32, 0x80); + void *ptr2 = AllocFromHeap(heap_id, 0x80); + memcpy(ptr2, charptr + (param1 + 10) * 32, 0x20); + memcpy(ptr2 + 0x20, charptr + (param1 + 11) * 32, 0x20); + memcpy(ptr2 + 0x40, charptr + (param1 + 10) * 32, 0x20); + memcpy(ptr2 + 0x60, charptr + (param1 + 11) * 32, 0x20); + + for (u8 i = 0; i < 8; i++) + { + memcpy(ptr->unk004[i], ptr2, 0x80); + } + FreeToHeap(ptr2); + + NNSG2dCharacterData *pCharData; + void *r5 = GfGfxLoader_GetCharData( + NARC_GRAPHIC_WINFRAME, NARC_winframe_narc_0023_NCGR, FALSE, &pCharData, heap_id); + BlitRect4Bit( + pCharData->pRawData, 0, 0, 0x10, 0x80, ptr->unk004[0], 0x10, 0x80, 0, 0, 0x10, 0x80); + FreeToHeap(r5); + + ptr->unk000 = window; + ptr->fillValue = (u16)param1; + ptr->unk486 = 0; + ptr->unk487 = 0; + ptr->unk488 = 0; + + FUN_0200CA60(FUN_0200DB7C, ptr, 0); + FUN_0200D980(ptr, 1); + + return ptr; +} + +THUMB_FUNC void FUN_0200D980(struct UnkStruct_0200CABC_1 *param0, u32 param1) +{ + u8 bg_id = GetWindowBgId(param0->unk000); + u8 x = GetWindowX(param0->unk000); + u8 y = GetWindowY(param0->unk000); + u8 width = GetWindowWidth(param0->unk000); + + if (param1 == 2) + { + BG_LoadCharTilesData(param0->unk000->bgConfig, + bg_id, + (u32 *)param0->unk004[8], + 0x80, + (u32)(param0->fillValue + 18)); + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 10), + (u8)(x + width + 1), + (u8)(y + 2), + 1, + 1, + 0x10); + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 11), + (u8)(x + width + 2), + (u8)(y + 2), + 1, + 1, + 0x10); + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 10), + (u8)(x + width + 1), + (u8)(y + 3), + 1, + 1, + 0x10); + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 11), + (u8)(x + width + 2), + (u8)(y + 3), + 1, + 1, + 0x10); + BgCommitTilemapBufferToVram(param0->unk000->bgConfig, bg_id); + return; + } + + BG_LoadCharTilesData(param0->unk000->bgConfig, + bg_id, + (u32 *)param0->unk004[param0->unk487], + 0x80, + (u32)(param0->fillValue + 18)); + if (param1 != 0) + { + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 18), + (u8)(x + width + 1), + (u8)(y + 2), + 1, + 1, + 0x10); + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 19), + (u8)(x + width + 2), + (u8)(y + 2), + 1, + 1, + 0x10); + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 20), + (u8)(x + width + 1), + (u8)(y + 3), + 1, + 1, + 0x10); + FillBgTilemapRect(param0->unk000->bgConfig, + bg_id, + (u16)(param0->fillValue + 21), + (u8)(x + width + 2), + (u8)(y + 3), + 1, + 1, + 0x10); + BgCommitTilemapBufferToVram(param0->unk000->bgConfig, bg_id); + } +} + +THUMB_FUNC void FUN_0200DB7C(u32 param0, void *param1) +{ + struct UnkStruct_0200CABC_1 *r1 = (struct UnkStruct_0200CABC_1 *)param1; + + if (r1->unk488 != 0) + { + if (r1->unk488 == 1) + { + FUN_0200D980(r1, 2); + } + FUN_0200CAB4((s32)param0); + return; + } + + r1->unk486++; + if (r1->unk486 == 16) + { + r1->unk486 = 0; + r1->unk487 = (r1->unk487 + 1) & 7; + FUN_0200D980(r1, 0); + } +} + +THUMB_FUNC void FUN_0200DBE8(u32 param0, void *param1) +{ + FreeToHeap(param1); + FUN_0200CAB4((s32)param0); +} + +THUMB_FUNC void FUN_0200DBFC(struct UnkStruct_0200CABC_1 *param0) +{ + FUN_0200CA98(FUN_0200DBE8, param0, 0); + param0->unk488 = 1; +} + +THUMB_FUNC void FUN_0200DC24(struct UnkStruct_0200CABC_1 *param0) +{ + FUN_0200CA98(FUN_0200DBE8, param0, 0); + param0->unk488 = 2; +} + +THUMB_FUNC u8 *FUN_0200DC4C(struct BgConfig *bg_config, + u8 bg_id, + u8 param2, + u8 param3, + u8 param4, + u16 param5, + u16 param6, + u8 param7, + s32 param8) +{ + struct UnkStruct_0200CABC_2 *r4 = FUN_0200DD70(bg_config, bg_id, param2, param3, (u32)param8); + FUN_0200DDAC(r4, (u32)param8); + FUN_0200DDD8(r4); + FUN_0200DE30(r4, param2, param3); + FUN_0200DE80(r4, param6, param7); + DrawFramed10x10Square(r4, param4, param5); + BgCommitTilemapBufferToVram(bg_config, bg_id); + + return &r4->unk16f; +} + +THUMB_FUNC u8 *FUN_0200DCA4(struct BgConfig *bg_config, + u8 bg_id, + u8 param2, + u8 param3, + u8 param4, + u16 param5, + struct Pokemon *param6, + s32 param7) +{ + struct UnkStruct_0200CABC_2 *r4 = FUN_0200DD70(bg_config, bg_id, param2, param3, (u32)param7); + FUN_0200DDAC(r4, (u32)param7); + FUN_0200DDD8(r4); + FUN_0200DE30(r4, param2, param3); + FUN_0200DEC0(r4, param6); + DrawFramed10x10Square(r4, param4, param5); + BgCommitTilemapBufferToVram(bg_config, bg_id); + + return &r4->unk16f; +} + +THUMB_FUNC void FUN_0200DCF8(u32 param0, void *param1) +{ + struct UnkStruct_0200CABC_2 *unk = (struct UnkStruct_0200CABC_2 *)param1; + switch (unk->unk16f) + { + case 1: + ClearFramed10x10Square(unk); + FUN_0200C3DC(unk->unk164); + MOD05_021D99F8(unk); + FUN_0200621C((s32)param0); + return; + case 2: + unk->unk16f = 3; + FUN_02020130(*unk->unk164, 1); + break; + case 3: + if (FUN_0202022C(*unk->unk164) == 6) + { + unk->unk16f = 0; + } + } + + FUN_020201E4(*unk->unk164, 0x1000); + FUN_0201FDEC(unk->unk000); +} + +THUMB_FUNC struct UnkStruct_0200CABC_2 *FUN_0200DD70( + struct BgConfig *bg_config, u8 bg_id, u8 param2, u8 param3, u32 param4) +{ + struct UnkStruct_0200CABC_2 *res = FUN_0201B6C8(FUN_020061E8(FUN_0200DCF8, 0x170, 0, param4)); + + res->unk16f = 0; + res->bgConfig = bg_config; + res->bgId = bg_id; + res->x = param2; + res->y = param3; + + return res; +} + +THUMB_FUNC void FUN_0200DDAC(struct UnkStruct_0200CABC_2 *param0, u32 param1) +{ + + const u32 UNK_020ECEA8[] = { + 0x01, + 0x01, + 0x01, + 0x01, + 0x00, + 0x00, + }; + MOD05_021D959C(param0, UNK_020ECEA8, 1, param1); +} + +THUMB_FUNC void FUN_0200DDD8(struct UnkStruct_0200CABC_2 *param0) +{ + MOD05_021D967C(param0, NARC_GRAPHIC_WINFRAME, NARC_winframe_narc_0049_NCLR, 0, 1, 1, 0x15CD5); + MOD05_021D96F4(param0, NARC_GRAPHIC_WINFRAME, NARC_winframe_narc_0047_NCER, 0, 0x15CD5); + MOD05_021D9708(param0, NARC_GRAPHIC_WINFRAME, NARC_winframe_narc_0046_NANR, 0, 0x15CD5); + MOD05_021D971C(param0, NARC_GRAPHIC_WINFRAME, NARC_winframe_narc_0048_NCGR, 0, 1, 0x15CD5); +} + +THUMB_FUNC void FUN_0200DE30(struct UnkStruct_0200CABC_2 *param0, u8 param1, u8 param2) +{ + u32 UNK_020ECEC0[] = { + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x015CD5, + 0x015CD5, + 0x015CD5, + 0x015CD5, + 0x00, + 0x00, + 0x00, + 0x00, + }; + ((u16 *)UNK_020ECEC0)[0] = (u16)((param1 + 5) * 8); + ((u16 *)UNK_020ECEC0)[1] = (u16)((param2 + 5) * 8); + param0->unk164 = MOD05_021D9820(param0, UNK_020ECEC0); + FUN_0201FDEC(param0->unk000); + GX_EngineBToggleLayers(0x10, GX_LAYER_TOGGLE_ON); +} + +THUMB_FUNC void FUN_0200DE80(struct UnkStruct_0200CABC_2 *param0, u16 param1, u8 param2) +{ + struct UnkStruct63_021DB450 *r7 = FUN_02006D98(param0->unk162); + struct SomeDrawPokemonStruct stc; + FUN_02068C00(&stc, param1, param2, 2, 0, 0, 0); + FUN_0200DEF4(param0, &stc); + FUN_020072E8(r7); +} + +THUMB_FUNC void FUN_0200DEC0(struct UnkStruct_0200CABC_2 *param0, struct Pokemon *param1) +{ + struct UnkStruct63_021DB450 *r6 = FUN_02006D98(param0->unk162); + struct SomeDrawPokemonStruct st0; + FUN_02068B68(&st0, param1, 2); + FUN_0200DEF4(param0, &st0); + FUN_020072E8(r6); +} + +THUMB_FUNC void FUN_0200DEF4( + struct UnkStruct_0200CABC_2 *param0, struct SomeDrawPokemonStruct *param1) +{ + void *r4 = AllocFromHeap(param0->unk162, 0x1900); + + struct UnkStruct_0200CABC_3 st18 = UNK_020ECE98; + FUN_02012400(param1->unk0, param1->unk2, param0->unk162, &st18, r4); + + struct UnkStruct_0200CABC_3 st8 = UNK_020ECE88; + FUN_02012400(param1->unk0, param1->unk2, param0->unk162, &st8, r4 + 0xc80); + + u32 st4 = FUN_02009C5C(FUN_020094F0(param0->unk130, 0x15CD5)); + + u32 r7 = NNS_G2dGetImageLocation(st4, 1); + DC_FlushRange(r4, 0x1900); + GX_LoadOBJ(r4, r7, 0x1900); + FreeToHeap(r4); + void *res = FUN_02012470(param1->unk0, param1->unk4, param0->unk162); + + u32 r5 = + NNS_G2dGetImagePaletteLocation(FUN_02009E54(FUN_020094F0(param0->unk134, 0x15CD5), st4), 1); + DC_FlushRange(res, 0x20); + GX_LoadOBJPltt(res, r5, 0x20); + FreeToHeap(res); +} + +THUMB_FUNC void DrawFramed10x10Square( + struct UnkStruct_0200CABC_2 *param0, u8 paletteNum, u16 fillValue) +{ + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + fillValue, + (u8)(param0->x - 1), + (u8)(param0->y - 1), + 1, + 1, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 1), + param0->x, + (u8)(param0->y - 1), + 10, + 1, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 2), + (u8)(param0->x + 10), + (u8)(param0->y - 1), + 1, + 1, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 4), + param0->x, + param0->y, + 10, + 10, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 3), + (u8)(param0->x - 1), + param0->y, + 1, + 10, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 5), + (u8)(param0->x + 10), + param0->y, + 1, + 10, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 6), + (u8)(param0->x - 1), + (u8)(param0->y + 10), + 1, + 1, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 7), + param0->x, + (u8)(param0->y + 10), + 10, + 1, + paletteNum); + FillBgTilemapRect(param0->bgConfig, + param0->bgId, + (u16)(fillValue + 8), + (u8)(param0->x + 10), + (u8)(param0->y + 10), + 1, + 1, + paletteNum); + + ScheduleBgTilemapBufferTransfer(param0->bgConfig, param0->bgId); +} + +THUMB_FUNC void ClearFramed10x10Square(struct UnkStruct_0200CABC_2 *param0) +{ + FillBgTilemapRect( + param0->bgConfig, param0->bgId, 0, (u8)(param0->x - 1), (u8)(param0->y - 1), 12, 12, 0); + ScheduleBgTilemapBufferTransfer(param0->bgConfig, param0->bgId); +} diff --git a/arm9/src/save_data_read_error.c b/arm9/src/save_data_read_error.c index 9524475c..45a0c7bd 100644 --- a/arm9/src/save_data_read_error.c +++ b/arm9/src/save_data_read_error.c @@ -6,10 +6,9 @@ #include "msgdata/msg.naix" #include "save_data_read_error.h" #include "text.h" +#include "render_window.h" extern void FUN_02002ED0(enum GFBgLayer layer, u32 base_addr, u32 heap_id); -extern void FUN_0200CB00(struct BgConfig* bg_config, enum GFBgLayer layer, u32 num_tiles, u32, u8, u32 heap_id); -extern void FUN_0200CCA4(struct Window* window, BOOL copy_to_vram, u16 fill_value, u32 palette_num); extern void FUN_0200E394(BOOL set_brightness_on_bottom_screen); extern void FUN_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); @@ -104,7 +103,7 @@ THUMB_FUNC void ShowSaveDataReadError(u32 heap_id) AddWindow(bg_config, &window, &sSaveDataReadErrorWindowTemplate); FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); - FUN_0200CCA4(&window, FALSE, 0x01F7, 2); + DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); ReadMsgDataIntoString(msg_data, 0, str); AddTextPrinterParameterized(&window, 0, str, 0, 0, 0, NULL); @@ -167,7 +166,7 @@ THUMB_FUNC void ShowGBACartRemovedError(u32 heap_id) AddWindow(bg_config, &window, &sSaveDataReadErrorWindowTemplate); FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); - FUN_0200CCA4(&window, FALSE, 0x01F7, 2); + DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); ReadMsgDataIntoString(msg_data, 1, str); AddTextPrinterParameterized(&window, 0, str, 0, 0, 0, NULL); diff --git a/arm9/src/save_data_write_error.c b/arm9/src/save_data_write_error.c index 71edb91d..3f03fb4b 100644 --- a/arm9/src/save_data_write_error.c +++ b/arm9/src/save_data_write_error.c @@ -6,10 +6,9 @@ #include "msgdata/msg.naix" #include "save_data_write_error.h" #include "text.h" +#include "render_window.h" extern void FUN_02002ED0(enum GFBgLayer layer, u32 base_addr, u32 heap_id); -extern void FUN_0200CB00(struct BgConfig* bg_config, enum GFBgLayer layer, u32 num_tiles, u32, u8, u32 heap_id); -extern void FUN_0200CCA4(struct Window* window, BOOL copy_to_vram, u16 fill_value, u32 palette_num); extern void FUN_0200E394(BOOL set_brightness_on_bottom_screen); extern void FUN_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); @@ -112,7 +111,7 @@ THUMB_FUNC void ShowSaveDataWriteError(u32 heap_id, u32 err_no) AddWindow(bg_config, &window, &sSaveDataWriteErrorWindowTemplate); FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); - FUN_0200CCA4(&window, FALSE, 0x01F7, 2); + DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); ReadMsgDataIntoString(msg_data, msg_no, str); AddTextPrinterParameterized(&window, 0, str, 0, 0, 0, NULL); diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index ceb1a1cf..2d57f0b1 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -6,6 +6,9 @@ #include "player_data.h" #include "text.h" #include "bg_window.h" +#include "render_window.h" +#include "text_02054590.h" + extern void *FUN_02039438(struct UnkSavStruct80* arg, u32 id); extern void *CreateScriptContext(struct UnkSavStruct80* arg, u16 id); @@ -22,27 +25,19 @@ extern void MOD05_021E2C58(struct ScriptContext *ctx, u16 typ, u16 id, u16 word1 extern struct ScrStrBufs *MOD06_02244210(struct SaveBlock2 *sav, u16 poke, u16 sex, u8 flag, u8 *unk); extern void MOD05_021E2CBC(struct ScriptContext *ctx, struct ScrStrBufs *str, u8 param2, u32 param3); extern void MOD05_021E2BB8(void *param0, struct ScriptContext *ctx); -extern BOOL FUN_020546C8(u8 param0); extern u32 FUN_02058488(u32 param0); extern BOOL FUN_02030F40(void); extern void FUN_02055304(u32 param0, u32 param1); extern void FUN_02039460(struct UnkSavStruct80 *arg); -extern void FUN_020545B8(u32 param0, u8 *param1, u32 param2); -extern void FUN_02054608(u8 *param0, struct Options *options); -extern void FUN_0200D0E0(struct Window *param0, u32 param1); extern u32 FUN_02058510(u32 param0, u32 param1); extern void MOD05_021E8128(u32 param0, u8 type, u16 map); extern void MOD05_021E8130(u32 param0, u32 param1); extern void MOD05_021E8158(struct UnkSavStruct80 *unk80); extern struct Window * MOD05_021E8140(u32 param0); extern BOOL MOD05_021E8148(u32 param0); -extern u8 FUN_02054658(struct Window * param0, struct String *str, struct Options *opt, u32 param3); extern void MOD05_021E8144(u32 param0); -extern void FUN_0200CB00(u32 param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); -extern u32 Std_CreateYesNoMenu(u32 param0, u8 **param1, u32 param2, u32 param3, u32 param4); +extern u32 Std_CreateYesNoMenu(struct BgConfig *param0, u8 **param1, u32 param2, u32 param3, u32 param4); extern u32 FUN_020021AC(u32 param0, u32 param1); -extern u32 FUN_0200D858(u32 *param0, u32 param1); -extern void FUN_0200DBFC(u32 param0); extern u32 MOD05_021E1BF8(struct UnkSavStruct80 *arg, u8 param1, u8 param2, u8 param3, u8 param4, u16 *param5, u32 param6, u32 *param7, struct MsgData *msgData); extern void MOD05_021E1C4C(u32 param0, u32 param1, u32 param2); extern void MOD05_021E1C54(u32 param0); @@ -773,8 +768,8 @@ THUMB_FUNC BOOL ScrCmd_Unk0033(struct ScriptContext *ctx) { struct UnkSavStruct80 *unk80 = ctx->unk80; u8 *unk = (u8 *)FUN_02039438(unk80, 6); - FUN_020545B8(unk80->unk08, FUN_02039438(unk80, 1), 3); - FUN_02054608(FUN_02039438(unk80, 1), Sav2_PlayerData_GetOptionsAddr(ctx->unk80->saveBlock2)); + FUN_020545B8(unk80->unk08, (struct Window *)FUN_02039438(unk80, 1), 3); + FUN_02054608((struct Window *)FUN_02039438(unk80, 1), Sav2_PlayerData_GetOptionsAddr(ctx->unk80->saveBlock2)); *unk = 1; return FALSE; } @@ -784,7 +779,7 @@ THUMB_FUNC BOOL ScrCmd_CloseMessageBox(struct ScriptContext* ctx) struct UnkSavStruct80 *unk80 = ctx->unk80; struct Window *unk = FUN_02039438(unk80, 0x1); u8 *unk2 = FUN_02039438(unk80, 0x6); - FUN_0200D0E0(unk, 0); //clear window? + ClearFrameAndWindow2(unk, 0); //clear window? RemoveWindow(unk); *unk2 = 0; return FALSE; @@ -958,7 +953,7 @@ THUMB_FUNC BOOL ScrCmd_Unk003A(struct ScriptContext *ctx) ReadMsgDataIntoString(ctx->msgData, msg, *unk2); StringExpandPlaceholders(*unk4, *unk3, *unk2); - *unk1 = FUN_02054658(MOD05_021E8140(unk80->unk60), *unk3, Sav2_PlayerData_GetOptionsAddr(ctx->unk80->saveBlock2), 1); + *unk1 = (u8)FUN_02054658(MOD05_021E8140(unk80->unk60), *unk3, Sav2_PlayerData_GetOptionsAddr(ctx->unk80->saveBlock2), 1); ctx->data[0] = wk; SetupNativeScript(ctx, FUN_0203A94C); return TRUE; @@ -1112,15 +1107,16 @@ THUMB_FUNC static BOOL FUN_0203AB00(struct ScriptContext *ctx) THUMB_FUNC BOOL ScrCmd_ShowSaveClock(struct ScriptContext *ctx) { - u32 *unk = FUN_02039438(ctx->unk80, 1); - u32 *unk2 = FUN_02039438(ctx->unk80, 18); + struct Window *unk = (struct Window *)FUN_02039438(ctx->unk80, 1); + struct UnkStruct_0200CABC_1 **unk2 = (struct UnkStruct_0200CABC_1 **)FUN_02039438(ctx->unk80, 18); *unk2 = FUN_0200D858(unk, 994); return FALSE; } + THUMB_FUNC BOOL ScrCmd_HideSaveClock(struct ScriptContext *ctx) { - u32 *unk = FUN_02039438(ctx->unk80, 18); + struct UnkStruct_0200CABC_1 **unk = (struct UnkStruct_0200CABC_1 **)FUN_02039438(ctx->unk80, 18); FUN_0200DBFC(*unk); return FALSE; } @@ -1345,13 +1341,13 @@ THUMB_FUNC BOOL ScrCmd_Unk02A1(struct ScriptContext *ctx) { unk4[0] = 15; pos++; - unk4[1] = unk1 - unk5; + unk4[1] = (u16)(unk1 - unk5); } else if (unk5 > unk1) { unk4[0] = 14; pos++; - unk4[1] = unk5 - unk1; + unk4[1] = (u16)(unk5 - unk1); } if (unk6 < unk2) diff --git a/arm9/src/text_02054590.c b/arm9/src/text_02054590.c index 3c3d0fed..03d01ae6 100644 --- a/arm9/src/text_02054590.c +++ b/arm9/src/text_02054590.c @@ -3,22 +3,10 @@ #include "bg_window.h" #include "font.h" #include "render_text.h" +#include "render_window.h" extern void FUN_0201BD5C(void); -extern void FUN_0200CD68( - struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5); -extern void FUN_0200D0BC(struct Window *param0, u32 param1, u32 param2, u32 param3); - -extern void FUN_0200D300(struct BgConfig *param0, - u32 param1, - u32 param2, - u32 param3, - u8 param4, - u32 param5, - u32 param6); -extern void FUN_0200D6F8(struct Window *param0, u32 param1, u32 param2, u32 param3, u8 param4); - THUMB_FUNC void FUN_02054590(u32 param0, u32 param1) { if (param1 == 1) @@ -45,7 +33,7 @@ THUMB_FUNC void FUN_02054608(struct Window *param0, struct Options *options) { FUN_0200CD68(param0->bgConfig, GetWindowBgId(param0), 994, 10, (u8)Options_GetFrame(options), 4); FUN_0205464C(param0); - FUN_0200D0BC(param0, 0, 994, 10); + DrawFrameAndWindow2(param0, 0, 994, 10); } THUMB_FUNC void FUN_0205464C(struct Window *param0) @@ -99,9 +87,9 @@ THUMB_FUNC void FUN_020546E0( } } -THUMB_FUNC void FUN_02054744(struct Window *param0, u32 param1, u32 param2) +THUMB_FUNC void FUN_02054744(struct Window *param0, u32 param1, u16 param2) { FUN_0200D300(param0->bgConfig, GetWindowBgId(param0), 0x399, 9, (u8)param1, param2, 4); FillWindowPixelBuffer(param0, 15); - FUN_0200D6F8(param0, 0, 0x399, 9, (u8)param1); + DrawFrameAndWindow3(param0, 0, 0x399, 9, (u8)param1); } diff --git a/arm9/src/wfc_user_info_warning.c b/arm9/src/wfc_user_info_warning.c index da547f3d..e48262b0 100644 --- a/arm9/src/wfc_user_info_warning.c +++ b/arm9/src/wfc_user_info_warning.c @@ -11,10 +11,9 @@ #include "text.h" #include "wfc_user_info_warning.h" #include "brightness.h" +#include "render_window.h" extern void FUN_02002ED0(enum GFBgLayer layer, u32 base_addr, u32 heap_id); -extern void FUN_0200CB00(struct BgConfig* bg_config, enum GFBgLayer layer, u32 num_tiles, u32, u8, u32 heap_id); -extern void FUN_0200CCA4(struct Window* window, BOOL copy_to_vram, u16 fill_value, u32 palette_num); extern void FUN_0200E394(BOOL set_brightness_on_bottom_screen); extern void FUN_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); @@ -109,7 +108,7 @@ THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) FUN_0201BD5C(); AddWindow(bg_config, &window, &sWFCWarningMsgWindowTemplate); FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); - FUN_0200CCA4(&window, FALSE, 0x01F7, 2); + DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); ReadMsgDataIntoString(warning_messages_data, 15, warning_message); AddTextPrinterParameterized(&window, 0, warning_message, 0, 0, 0, 0); |