From 0132ae654e3c57dbaf05ed5a32a2bd024367c78f Mon Sep 17 00:00:00 2001 From: Eebit Date: Sun, 17 Mar 2024 16:59:47 -0400 Subject: [PATCH] (finish_worldmap) Extract data --- data/const_data_20688C.s | 18 ----- data/data_A3E4D4.s | 163 +-------------------------------------- ldscript.txt | 6 +- src/worldmap_basemenu.c | 48 +++++++++++- src/worldmap_radar.c | 59 ++++++++++++-- src/worldmap_text.c | 29 ++++++- 6 files changed, 132 insertions(+), 191 deletions(-) delete mode 100644 data/const_data_20688C.s diff --git a/data/const_data_20688C.s b/data/const_data_20688C.s deleted file mode 100644 index 41049352..00000000 --- a/data/const_data_20688C.s +++ /dev/null @@ -1,18 +0,0 @@ - - .section .rodata - - .global gUnknown_08206B70 -gUnknown_08206B70: @ 0x08206B70 -@ Replacing .incbin "baserom.gba", 0x206B70, 0x2B4 - .4byte 0x00000003 - .4byte 0x01030100 - .4byte 0x02020101 - .4byte 0x03020203 - .4byte 0x03020303 - .4byte 0x70616d47 - .4byte 0x64615220 - .4byte 0x00007265 - .4byte 0x70616d47 - .4byte 0x73614220 - .4byte 0x654d2065 - .4byte 0x0000756e diff --git a/data/data_A3E4D4.s b/data/data_A3E4D4.s index 824b5363..22365af6 100644 --- a/data/data_A3E4D4.s +++ b/data/data_A3E4D4.s @@ -1,167 +1,6 @@ .section .data - .global gUnknown_08A3EE28 -gUnknown_08A3EE28: @ 0x08A3EE28 - .incbin "baserom.gba", 0xA3EE28, 0x1C - - .global gUnknown_08A3EE44 -gUnknown_08A3EE44: @ 0x08A3EE44 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C35C4 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C35EC - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - - - .global gUnknown_08A3EE6C -gUnknown_08A3EE6C: @ 0x08A3EE6C - .incbin "baserom.gba", 0x00a3ee6c, 0x4 - - .global gUnknown_08A3EE70 -gUnknown_08A3EE70: @ 0x08A3EE70 - .incbin "baserom.gba", 0xA3EE70, 0x4 - - .global ProcScr_GmapRader -ProcScr_GmapRader: @ 0x08A3EE74 - @ PROC_NAME - .short 0x1, 0x0 - .word 0x8206b84 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_15 - .short 0x15, 0x0 - .word 0x0 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3D9C - @ PROC_LABEL - .short 0xb, 0x0 - .word 0x0 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3AB8 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3D24 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3B40 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3D5C - @ PROC_GOTO - .short 0xc, 0x0 - .word 0x0 - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - - - .global gUnknown_08A3EED4 -gUnknown_08A3EED4: @ 0x08A3EED4 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3DAC - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - - - .global ProcScr_GmapBaseMenu -ProcScr_GmapBaseMenu: @ 0x08A3EEEC - @ PROC_NAME - .short 0x1, 0x0 - .word 0x8206b90 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_SET_END_CB - .short 0x4, 0x0 - .word nullsub_71 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3EC8 - @ PROC_LABEL - .short 0xb, 0x0 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3EDC - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3F24 - @ PROC_LABEL - .short 0xb, 0x1 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3F88 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_GOTO - .short 0xc, 0x4 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x2 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3FB4 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_GOTO - .short 0xc, 0x4 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x3 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3FE0 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_GOTO - .short 0xc, 0x4 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x4 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3F04 - @ PROC_GOTO - .short 0xc, 0x0 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x5 - .word 0x0 - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - .incbin "baserom.gba", 0xA3EEEC + 0xC8, 0x824 - 0xC8 + .incbin "baserom.gba", 0xA3EFB4, 0x75C .global gPal_CharacterEndingMenu gPal_CharacterEndingMenu: @ 0x08A3F710 diff --git a/ldscript.txt b/ldscript.txt index ee4ae264..5514615a 100644 --- a/ldscript.txt +++ b/ldscript.txt @@ -845,7 +845,8 @@ SECTIONS . = ALIGN(4); src/worldmap_timemons.o(.rodata); . = ALIGN(4); src/worldmap_rm.o(.rodata); . = ALIGN(4); src/worldmap_automu.o(.rodata); - . = ALIGN(4); data/const_data_20688C.o(.rodata); + . = ALIGN(4); src/worldmap_radar.o(.rodata); + . = ALIGN(4); src/worldmap_basemenu.o(.rodata); . = ALIGN(4); src/ending_credits.o(.rodata); . = ALIGN(4); src/opsubtitle.o(.rodata); . = ALIGN(4); src/classchg-main.o(.rodata); @@ -1177,6 +1178,9 @@ SECTIONS . = ALIGN(4); src/worldmap_timemons.o(.data); . = ALIGN(4); src/worldmap_rm.o(.data); . = ALIGN(4); src/worldmap_automu.o(.data); + . = ALIGN(4); src/worldmap_text.o(.data); + . = ALIGN(4); src/worldmap_radar.o(.data); + . = ALIGN(4); src/worldmap_basemenu.o(.data); . = ALIGN(4); data/data_A3E4D4.o(.data); . = ALIGN(4); src/ending_credits.o(.data); . = ALIGN(4); src/opsubtitle.o(.data); diff --git a/src/worldmap_basemenu.c b/src/worldmap_basemenu.c index cffb10d1..975e40ee 100644 --- a/src/worldmap_basemenu.c +++ b/src/worldmap_basemenu.c @@ -116,7 +116,53 @@ void sub_80C3FE0(struct GMapBaseMenuProc * proc) return; } -extern struct ProcCmd ProcScr_GmapBaseMenu[]; +// clang-format off + +struct ProcCmd CONST_DATA ProcScr_GmapBaseMenu[] = +{ + PROC_NAME("Gmap Base Menu"), + PROC_MARK(PROC_MARK_8), + + PROC_SET_END_CB(nullsub_71), + + PROC_CALL(sub_80C3EC8), + +PROC_LABEL(0), + PROC_CALL(sub_80C3EDC), + PROC_YIELD, + + PROC_CALL(sub_80C3F24), + + // fallthrough + +PROC_LABEL(1), + PROC_CALL(sub_80C3F88), + PROC_YIELD, + + PROC_GOTO(4), + +PROC_LABEL(2), + PROC_CALL(sub_80C3FB4), + PROC_YIELD, + + PROC_GOTO(4), + +PROC_LABEL(3), + PROC_CALL(sub_80C3FE0), + PROC_YIELD, + + PROC_GOTO(4), + +PROC_LABEL(4), + PROC_CALL(sub_80C3F04), + + PROC_GOTO(0), + +PROC_LABEL(5), + PROC_END, +}; + +// clang-format on //! FE8U = 0x080C400C ProcPtr sub_80C400C(int kind, ProcPtr parent) diff --git a/src/worldmap_radar.c b/src/worldmap_radar.c index b8dc317c..3d3a8f1a 100644 --- a/src/worldmap_radar.c +++ b/src/worldmap_radar.c @@ -210,7 +210,15 @@ void sub_80C3A8C(struct GMapRadarProc * unused) return; } -extern u8 gUnknown_08206B70[]; +// clang-format off + +u8 const gUnknown_08206B70[] = +{ + 3, 0, 0, 0, 0, 1, 3, 1, 1, 1, + 2, 2, 3, 2, 2, 3, 3, 3, 2, 3, +}; + +// clang-format on //! FE8U = 0x080C3AB8 void sub_80C3AB8(struct GMapRadarProc * proc) @@ -284,8 +292,6 @@ void sub_80C3B40(struct GMapRadarProc * proc) return; } -extern u8 gUnknown_08206B70[]; - extern u16 gUnknown_0201B430[]; extern u16 gUnknown_0201B458[]; @@ -332,7 +338,10 @@ void sub_80C3BE4(struct GMapRadarProc * proc, int b) return; } -extern s8 gUnknown_08A3EE6C[]; +s8 CONST_DATA gUnknown_08A3EE6C[] = +{ + 1, 2, 5, 8, +}; //! FE8U = 0x080C3D24 void sub_80C3D24(struct GMapRadarProc * proc) @@ -351,7 +360,10 @@ void sub_80C3D24(struct GMapRadarProc * proc) return; } -extern s8 gUnknown_08A3EE70[]; +s8 CONST_DATA gUnknown_08A3EE70[] = +{ + 5, 2, 1, 0, +}; //! FE8U = 0x080C3D5C void sub_80C3D5C(struct GMapRadarProc * proc) @@ -383,7 +395,30 @@ void sub_80C3D9C(struct GMapRadarProc * proc) extern u8 gUnknown_08AA1280[]; extern u16 gUnknown_08AA188C[]; -extern struct ProcCmd ProcScr_GmapRader[]; +// clang-format off + +struct ProcCmd CONST_DATA ProcScr_GmapRader[] = +{ + PROC_NAME("Gmap Rader"), + PROC_MARK(PROC_MARK_8), + + PROC_15, + PROC_YIELD, + + PROC_CALL(sub_80C3D9C), + +PROC_LABEL(0), + PROC_REPEAT(sub_80C3AB8), + PROC_REPEAT(sub_80C3D24), + PROC_REPEAT(sub_80C3B40), + PROC_REPEAT(sub_80C3D5C), + + PROC_GOTO(0), + + PROC_END, +}; + +// clang-format on //! FE8U = 0x080C3DAC void sub_80C3DAC(struct Proc * proc) @@ -413,7 +448,17 @@ void sub_80C3DAC(struct Proc * proc) return; } -extern struct ProcCmd gUnknown_08A3EED4[]; +// clang-format off + +struct ProcCmd CONST_DATA gUnknown_08A3EED4[] = +{ + PROC_MARK(PROC_MARK_8), + PROC_CALL(sub_80C3DAC), + + PROC_END, +}; + +// clang-format on //! FE8U = 0x080C3E80 ProcPtr sub_80C3E80(ProcPtr parent) diff --git a/src/worldmap_text.c b/src/worldmap_text.c index 88a0ecbf..1768f586 100644 --- a/src/worldmap_text.c +++ b/src/worldmap_text.c @@ -56,7 +56,18 @@ void sub_80C35C4(struct GMap8A3EE44Proc * proc) return; } -extern u16 gUnknown_08A3EE28[]; +// clang-format off + +u16 CONST_DATA gUnknown_08A3EE28[] = +{ + 4, + OAM0_SHAPE_64x32 + OAM0_Y(8), OAM1_SIZE_64x32 + OAM1_X(8), OAM2_CHR(0x200), + OAM0_SHAPE_64x32 + OAM0_Y(8), OAM1_SIZE_64x32 + OAM1_X(72), OAM2_CHR(0x208), + OAM0_SHAPE_64x32 + OAM0_Y(8), OAM1_SIZE_64x32 + OAM1_X(136), OAM2_CHR(0x210), + OAM0_SHAPE_32x32 + OAM0_Y(8), OAM1_SIZE_32x32 + OAM1_X(200), OAM2_CHR(0x218), +}; + +// clang-format on //! FE8U = 0x080C35EC void sub_80C35EC(struct GMap8A3EE44Proc * proc) @@ -80,7 +91,21 @@ void sub_80C35EC(struct GMap8A3EE44Proc * proc) return; } -extern struct ProcCmd gUnknown_08A3EE44[]; +// clang-format off + +struct ProcCmd CONST_DATA gUnknown_08A3EE44[] = +{ + PROC_MARK(PROC_MARK_8), + + PROC_CALL(sub_80C35C4), + PROC_YIELD, + + PROC_REPEAT(sub_80C35EC), + + PROC_END, +}; + +// clang-format on //! FE8U = 0x080C3624 void StartWmText(u8 flag)