diff --git a/data/graphics.s b/data/graphics.s index e1b76565a..1a5856c50 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -910,8 +910,116 @@ gCableCarCord_Gfx:: @ 8DBC2C0 gUnknown_08DBC2E8:: @ 8DBC2E8 .incbin "baserom.gba", 0xdbc2e8, 0x72c -gUnknown_08DBCA14:: @ 8DBCA14 - .incbin "baserom.gba", 0xdbca14, 0x3d00 +gUnknown_08DBCA14:: @ 0x08DBCA14 + .incbin "baserom.gba", 0xdbca14, 0x1e04 + +gUnknown_08DBE818:: @ 0x08DBE818 + .incbin "baserom.gba", 0xdbe818, 0x20 + +gUnknown_08DBE838:: @ 0x08DBE838 + .incbin "baserom.gba", 0xdbe838, 0x20 + +gUnknown_08DBE858:: @ 0x08DBE858 + .incbin "baserom.gba", 0xdbe858, 0x20 + +gUnknown_08DBE878:: @ 0x08DBE878 + .incbin "baserom.gba", 0xdbe878, 0x20 + +gUnknown_08DBE898:: @ 0x08DBE898 + .incbin "baserom.gba", 0xdbe898, 0x20 + +gUnknown_08DBE8B8:: @ 0x08DBE8B8 + .incbin "baserom.gba", 0xdbe8b8, 0x20 + +gUnknown_08DBE8D8:: @ 0x08DBE8D8 + .incbin "baserom.gba", 0xdbe8d8, 0x20 + +gUnknown_08DBE8F8:: @ 0x08DBE8F8 + .incbin "baserom.gba", 0xdbe8f8, 0x20 + +gUnknown_08DBE918:: @ 0x08DBE918 + .incbin "baserom.gba", 0xdbe918, 0x20 + +gUnknown_08DBE938:: @ 0x08DBE938 + .incbin "baserom.gba", 0xdbe938, 0x20 + +gUnknown_08DBE958:: @ 0x08DBE958 + .incbin "baserom.gba", 0xdbe958, 0x20 + +gUnknown_08DBE978:: @ 0x08DBE978 + .incbin "baserom.gba", 0xdbe978, 0x20 + +gUnknown_08DBE998:: @ 0x08DBE998 + .incbin "baserom.gba", 0xdbe998, 0x1a0 + +gUnknown_08DBEB38:: @ 0x08DBEB38 + .incbin "baserom.gba", 0xdbeb38, 0x13c + +gUnknown_08DBEC74:: @ 0x08DBEC74 + .incbin "baserom.gba", 0xdbec74, 0x210 + +gUnknown_08DBEE84:: @ 0x08DBEE84 + .incbin "baserom.gba", 0xdbee84, 0xd8 + +gUnknown_08DBEF5C:: @ 0x08DBEF5C + .incbin "baserom.gba", 0xdbef5c, 0x1f8 + +gUnknown_08DBF154:: @ 0x08DBF154 + .incbin "baserom.gba", 0xdbf154, 0x180 + +gUnknown_08DBF2D4:: @ 0x08DBF2D4 + .incbin "baserom.gba", 0xdbf2d4, 0xa8 + +gUnknown_08DBF37C:: @ 0x08DBF37C + .incbin "baserom.gba", 0xdbf37c, 0x190 + +gUnknown_08DBF50C:: @ 0x08DBF50C + .incbin "baserom.gba", 0xdbf50c, 0x140 + +gUnknown_08DBF64C:: @ 0x08DBF64C + .incbin "baserom.gba", 0xdbf64c, 0x168 + +gUnknown_08DBF7B4:: @ 0x08DBF7B4 + .incbin "baserom.gba", 0xdbf7b4, 0x150 + +gUnknown_08DBF904:: @ 0x08DBF904 + .incbin "baserom.gba", 0xdbf904, 0x2a0 + +gUnknown_08DBFBA4:: @ 0x08DBFBA4 + .incbin "baserom.gba", 0xdbfba4, 0xd8 + +gUnknown_08DBFC7C:: @ 0x08DBFC7C + .incbin "baserom.gba", 0xdbfc7c, 0xe0 + +gUnknown_08DBFD5C:: @ 0x08DBFD5C + .incbin "baserom.gba", 0xdbfd5c, 0x10c + +gUnknown_08DBFE68:: @ 0x08DBFE68 + .incbin "baserom.gba", 0xdbfe68, 0xdc + +gUnknown_08DBFF44:: @ 0x08DBFF44 + .incbin "baserom.gba", 0xdbff44, 0xf0 + +gUnknown_08DC0034:: @ 0x08DC0034 + .incbin "baserom.gba", 0xdc0034, 0xe0 + +gUnknown_08DC0114:: @ 0x08DC0114 + .incbin "baserom.gba", 0xdc0114, 0xe0 + +gUnknown_08DC01F4:: @ 0x08DC01F4 + .incbin "baserom.gba", 0xdc01f4, 0x10c + +gUnknown_08DC0300:: @ 0x08DC0300 + .incbin "baserom.gba", 0xdc0300, 0xf0 + +gUnknown_08DC03F0:: @ 0x08DC03F0 + .incbin "baserom.gba", 0xdc03f0, 0xf8 + +gUnknown_08DC04E8:: @ 0x08DC04E8 + .incbin "baserom.gba", 0xdc04e8, 0x118 + +gUnknown_08DC0600:: @ 0x08DC0600 + .incbin "baserom.gba", 0xdc0600, 0x114 gUnknown_08DC0714:: @ 8DC0714 .incbin "baserom.gba", 0xdc0714, 0x40 diff --git a/data/mail.s b/data/mail.s deleted file mode 100644 index 5dc8270bc..000000000 --- a/data/mail.s +++ /dev/null @@ -1,26 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gUnknown_0859F290:: @ 859F290 - .incbin "baserom.gba", 0x59f290, 0xc - -gUnknown_0859F29C:: @ 859F29C - .incbin "baserom.gba", 0x59f29c, 0x10 - -gUnknown_0859F2AC:: @ 859F2AC - .incbin "baserom.gba", 0x59f2ac, 0x4 - -gUnknown_0859F2B0:: @ 859F2B0 - .incbin "baserom.gba", 0x59f2b0, 0x8 - -gUnknown_0859F2B8:: @ 859F2B8 - .incbin "baserom.gba", 0x59f2b8, 0xfc - -gUnknown_0859F3B4:: @ 859F3B4 - .incbin "baserom.gba", 0x59f3b4, 0xa4 - -gUnknown_0859F458:: @ 859F458 - .incbin "baserom.gba", 0x59f458, 0xbc diff --git a/include/menu.h b/include/menu.h index d143c8a7c..957bed9b4 100644 --- a/include/menu.h +++ b/include/menu.h @@ -20,7 +20,7 @@ void sub_8198070(u8 windowId, bool8 copyToVram); void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock); void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette); void reset_temp_tile_data_buffers(void); -int decompress_and_copy_tile_data_to_vram(u8 bg_id, void *src, int size, u16 offset, u8 mode); +int decompress_and_copy_tile_data_to_vram(u8 bg_id, const void *src, int size, u16 offset, u8 mode); bool8 free_temp_tile_data_buffers_if_possible(void); #endif // GUARD_MENU_H diff --git a/ld_script.txt b/ld_script.txt index dfc790530..1191c9c8e 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -401,7 +401,7 @@ SECTIONS { data/easy_chat.o(.rodata); data/mon_markings.o(.rodata); data/mauville_old_man.o(.rodata); - data/mail.o(.rodata); + src/mail.o(.rodata); data/menu_helpers.o(.rodata); data/heal_location.o(.rodata); data/region_map.o(.rodata); diff --git a/src/mail.c b/src/mail.c index 0f0530c04..3febf1d08 100644 --- a/src/mail.c +++ b/src/mail.c @@ -26,6 +26,8 @@ struct UnkMailStruct u8 unk_0_0:2; u8 unk_0_2:2; u8 unk_0_4:4; + u8 unk_1_0:4; + u8 unk_1_4:1; }; struct MailLayout @@ -35,8 +37,8 @@ struct MailLayout u8 var2; u8 var3_0:4; u8 var3_4:4; - struct UnkMailStruct *var4; - u32 var8; + u32 var4; + const struct UnkMailStruct *var8; }; struct Unk203A134 @@ -61,9 +63,9 @@ struct Unk203A134 struct MailGraphics { - u16 (*palette)[]; - u8 (*tiles)[]; - u8 (*tileMap)[]; + const u16 *palette; + const u8 *tiles; + const u8 *tileMap; u16 var0C; u16 var0E; u16 color10; @@ -85,12 +87,180 @@ void sub_8121C98(void); // .rodata -extern const struct BgTemplate gUnknown_0859F290[]; -extern const struct WindowTemplate gUnknown_0859F29C; -extern const u16 gUnknown_0859F2B0[][2]; -extern const struct MailGraphics gUnknown_0859F2B8[]; -extern const struct MailLayout gUnknown_0859F3B4[]; -extern const struct MailLayout gUnknown_0859F458[]; +const struct BgTemplate gUnknown_0859F290[] = { + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 31, + .priority = 0 + }, { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .priority = 1 + }, { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 29, + .priority = 2 + } +}; + +const struct WindowTemplate gUnknown_0859F29C[] = { + { + .priority = 0, + .tilemapLeft = 2, + .tilemapTop = 3, + .width = 26, + .height = 15, + .paletteNum = 15, + .baseBlock = 1 + }, { + .priority = -1 + } +}; + +const u8 gUnknown_0859F2AC[] = { + 0, + 10, + 11 +}; + +const u16 gUnknown_0859F2B0[][2] = { + { 0x6ACD, 0x51A5 }, + { 0x45FC, 0x38D4 } +}; + +extern const u16 gUnknown_08DBE818[]; +extern const u16 gUnknown_08DBE838[]; +extern const u16 gUnknown_08DBE858[]; +extern const u16 gUnknown_08DBE878[]; +extern const u16 gUnknown_08DBE898[]; +extern const u16 gUnknown_08DBE8B8[]; +extern const u16 gUnknown_08DBE8D8[]; +extern const u16 gUnknown_08DBE8F8[]; +extern const u16 gUnknown_08DBE918[]; +extern const u16 gUnknown_08DBE938[]; +extern const u16 gUnknown_08DBE958[]; +extern const u16 gUnknown_08DBE978[]; +extern const u8 gUnknown_08DBE998[]; +extern const u8 gUnknown_08DBFBA4[]; +extern const u8 gUnknown_08DBEB38[]; +extern const u8 gUnknown_08DBFC7C[]; +extern const u8 gUnknown_08DBEC74[]; +extern const u8 gUnknown_08DBFD5C[]; +extern const u8 gUnknown_08DBEE84[]; +extern const u8 gUnknown_08DBFE68[]; +extern const u8 gUnknown_08DBEF5C[]; +extern const u8 gUnknown_08DBFF44[]; +extern const u8 gUnknown_08DBF154[]; +extern const u8 gUnknown_08DC0034[]; +extern const u8 gUnknown_08DBF2D4[]; +extern const u8 gUnknown_08DC0114[]; +extern const u8 gUnknown_08DBF37C[]; +extern const u8 gUnknown_08DC01F4[]; +extern const u8 gUnknown_08DBF50C[]; +extern const u8 gUnknown_08DC0300[]; +extern const u8 gUnknown_08DBF64C[]; +extern const u8 gUnknown_08DC03F0[]; +extern const u8 gUnknown_08DBF7B4[]; +extern const u8 gUnknown_08DC04E8[]; +extern const u8 gUnknown_08DBF904[]; +extern const u8 gUnknown_08DC0600[]; + +const struct MailGraphics gUnknown_0859F2B8[] = { + { + gUnknown_08DBE818, gUnknown_08DBE998, gUnknown_08DBFBA4, 0x02c0, 0x0000, 0x294a, 0x6739 + }, { + gUnknown_08DBE838, gUnknown_08DBEB38, gUnknown_08DBFC7C, 0x02e0, 0x0000, 0x7fff, 0x4631 + }, { + gUnknown_08DBE858, gUnknown_08DBEC74, gUnknown_08DBFD5C, 0x0400, 0x0000, 0x294a, 0x6739 + }, { + gUnknown_08DBE878, gUnknown_08DBEE84, gUnknown_08DBFE68, 0x01e0, 0x0000, 0x7fff, 0x4631 + }, { + gUnknown_08DBE898, gUnknown_08DBEF5C, gUnknown_08DBFF44, 0x02e0, 0x0000, 0x7fff, 0x4631 + }, { + gUnknown_08DBE8B8, gUnknown_08DBF154, gUnknown_08DC0034, 0x0300, 0x0000, 0x294a, 0x6739 + }, { + gUnknown_08DBE8D8, gUnknown_08DBF2D4, gUnknown_08DC0114, 0x0140, 0x0000, 0x7fff, 0x4631 + }, { + gUnknown_08DBE8F8, gUnknown_08DBF37C, gUnknown_08DC01F4, 0x0300, 0x0000, 0x7fff, 0x4631 + }, { + gUnknown_08DBE918, gUnknown_08DBF50C, gUnknown_08DC0300, 0x0220, 0x0000, 0x294a, 0x6739 + }, { + gUnknown_08DBE938, gUnknown_08DBF64C, gUnknown_08DC03F0, 0x0340, 0x0000, 0x294a, 0x6739 + }, { + gUnknown_08DBE958, gUnknown_08DBF7B4, gUnknown_08DC04E8, 0x02a0, 0x0000, 0x294a, 0x6739 + }, { + gUnknown_08DBE978, gUnknown_08DBF904, gUnknown_08DC0600, 0x0520, 0x0000, 0x294a, 0x6739 + } +}; + +const struct UnkMailStruct Unknown_0859F3A8[] = { + { .unk_0_0 = 3, .unk_1_4 = TRUE }, + { .unk_0_0 = 3, .unk_1_4 = TRUE }, + { .unk_0_0 = 3, .unk_1_4 = TRUE } +}; + +const struct MailLayout gUnknown_0859F3B4[] = { + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x08, 0x00, 0x2, 0x0, 0x04, Unknown_0859F3A8 }, + { 0x03, 0x00, 0x00, 0x2, 0x0, 0x00, Unknown_0859F3A8 } +}; + +const struct UnkMailStruct Unknown_0859F444[] = { + { .unk_0_0 = 2, .unk_1_4 = TRUE }, + { .unk_0_0 = 2, .unk_1_4 = TRUE }, + { .unk_0_0 = 2, .unk_1_4 = TRUE }, + { .unk_0_0 = 2, .unk_1_4 = TRUE }, + { .unk_0_0 = 1, .unk_1_4 = TRUE } +}; + +const struct MailLayout gUnknown_0859F458[] = { + { 0x05, 0x07, 0x58, 0xb, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x0a, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x0c, 0x68, 0x5, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x05, 0x60, 0x8, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x0a, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x09, 0x70, 0x5, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x0c, 0x68, 0x9, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x0d, 0x68, 0xd, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x09, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x09, 0x60, 0x9, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x11, 0x68, 0xf, 0x0, 0x1e, Unknown_0859F444 }, + { 0x05, 0x09, 0x60, 0x5, 0x0, 0x1e, Unknown_0859F444 } +}; + +const u16 Unknown_0859F4E8[] = { + 0x00, 0x4000, 0x00, 0x00 +}; + +const u16 Unknown_0859F4F0[] = { + 0x00, 0x00, -1, 0x00 +}; + +const u16 Unknown_0859F4F8[] = { + 0x04, 0x00, -1, 0x00 +}; + +const u16 Unknown_0859F500[] = { + 0x00, 0x40, -1, 0x00 +}; + +const u16 *const gUnknown_0859F508[] = { + Unknown_0859F4F0, + Unknown_0859F4F8, + Unknown_0859F500 +}; // .text @@ -191,7 +361,7 @@ bool8 sub_81215EC(void) SetBgTilemapBuffer(2, gUnknown_0203A134->bg2TilemapBuffer); break; case 7: - InitWindows(&gUnknown_0859F29C); + InitWindows(gUnknown_0859F29C); DeactivateAllTextPrinters(); break; case 8: