diff --git a/data/data_8270000.s b/data/data_8270000.s index af84011b6..a60aa4d2a 100644 --- a/data/data_8270000.s +++ b/data/data_8270000.s @@ -4,27 +4,6 @@ gUnknown_8270000: @ 8270000 @ replacing .incbin "baserom.gba", 0x00270000, 0x2724 - - -.byte 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00 -.4byte Ground_Text -.4byte GroundScript_Text -.4byte Dungeon_Text -.4byte Sound_Text -.4byte Bgm_Text -.4byte Se_Text -.4byte Flag_Text -.4byte Memory_Text -.4byte MemoryCard_Text -.4byte Performance_Text -.byte 0x00, 0x00, 0x00, 0x00 -.4byte sGameInternalVersion -.byte 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x02, 0x00, 0x0f, 0x00 diff --git a/include/save.h b/include/save.h index dfd000e0f..6b6113082 100644 --- a/include/save.h +++ b/include/save.h @@ -78,7 +78,7 @@ u32 sub_8011C1C(void); void sub_8011C28(u32 in); s32 sub_8011C34(void); void sub_8011C40(s32 in); -char *GetGameInternalName(void); +const char *GetGameInternalName(void); void sub_8011CA8(u32 *out, s32 size); u32 ReadSaveFromPak(u32 *a); u32 WriteSavetoPak(s32 *param_1, u32 param_2); @@ -103,4 +103,4 @@ bool8 ValidateChecksum(u8 *in, u32 size); s32 sub_80121D4(s32 *a, u8 *src, s32 size); u32 sub_80121E0(u32); -#endif // GUARD_SAVE_H \ No newline at end of file +#endif // GUARD_SAVE_H diff --git a/src/debug.c b/src/debug.c index 8e0aba6f9..7c3b310e6 100644 --- a/src/debug.c +++ b/src/debug.c @@ -7,8 +7,8 @@ extern void Hang(); static void FatalErrorHang(void) __attribute__((noreturn)); -EWRAM_DATA_2 bool32 gNDS_DebugEnabled = {0}; -EWRAM_DATA_2 u8 gUnknown_203B150 = {0}; +EWRAM_INIT bool32 gNDS_DebugEnabled = {0}; +EWRAM_INIT u8 gUnknown_203B150 = {0}; ALIGNED(4) const char gFuncFileLineString[] = "func = '%s'\nfile = '%s' line = %5d"; @@ -21,17 +21,19 @@ ALIGNED(4) const char debug_fill14[] = "pksdir0"; ALIGNED(4) const char gDebugPrintPrefix[] = " Print "; ALIGNED(4) static const char debug_fill13[] = "pksdir0"; -ALIGNED(4) const char Performance_Text[] = "Performance"; -ALIGNED(4) const char MemoryCard_Text[] = "Memory Card"; -ALIGNED(4) const char Memory_Text[] = "Memory"; -ALIGNED(4) const char Flag_Text[] = "Flag"; -ALIGNED(4) const char Se_Text[] = "Se"; -ALIGNED(4) const char Bgm_Text[] = "Bgm"; -ALIGNED(4) const char Sound_Text[] = "Sound"; -ALIGNED(4) const char Dungeon_Text[] = "Dungeon"; -ALIGNED(4) const char GroundScript_Text[] = "GroundScript"; -ALIGNED(4) const char Ground_Text[] = "Ground"; - +static UNUSED EWRAM_INIT const char *sUnusedEwramDebugStrings[] = +{ + "Ground", + "GroundScript", + "Dungeon", + "Sound", + "Bgm", + "Se", + "Flag", + "Memory", + "Memory Card", + "Performance", +}; ALIGNED(4) const char gNotMountText[] = "not mount log system"; ALIGNED(4) static const char debug_fill9[] = "pksdir0"; diff --git a/src/quick_save_read.c b/src/quick_save_read.c index 2a16f9d4f..f9fff3920 100644 --- a/src/quick_save_read.c +++ b/src/quick_save_read.c @@ -5,7 +5,7 @@ #include "quick_save_read.h" #include "save.h" -static EWRAM_DATA_2 QuickSaveRead *sQuickSaveRead = {0}; +static EWRAM_INIT QuickSaveRead *sQuickSaveRead = {NULL}; #include "data/quick_save_read.h" @@ -62,4 +62,4 @@ void FinishQuickSaveRead(void) MemoryFree(sQuickSaveRead); sQuickSaveRead = 0; } -} \ No newline at end of file +} diff --git a/src/quick_save_write.c b/src/quick_save_write.c index bec6b1ff2..841e6f460 100644 --- a/src/quick_save_write.c +++ b/src/quick_save_write.c @@ -5,7 +5,7 @@ #include "quick_save_write.h" #include "save.h" -static EWRAM_DATA_2 QuickSaveWrite *sQuickSaveWrite = {0}; +static EWRAM_INIT QuickSaveWrite *sQuickSaveWrite = {NULL}; #include "data/quick_save_write.h" @@ -89,4 +89,4 @@ void FinishQuickSaveWrite() MemoryFree(sQuickSaveWrite); sQuickSaveWrite = NULL; } -} \ No newline at end of file +} diff --git a/src/save.c b/src/save.c index f8c84a9e1..fc5d3ecee 100644 --- a/src/save.c +++ b/src/save.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "code_80118A4.h" #include "string_format.h" #include "code_8097670.h" @@ -12,12 +13,6 @@ #include "random.h" #include "save.h" -EWRAM_DATA s32 gUnknown_202DE28 = {0}; - -EWRAM_DATA_2 u32 gUnknown_203B17C = {0}; -EWRAM_DATA_2 char *gUnknown_203B180 = {0}; -EWRAM_DATA_2 struct UnkStruct_203B184 *gUnknown_203B184 = {0}; - // size: 0x800 struct unk_struct { @@ -30,8 +25,11 @@ struct unk_struct u32 padding[503]; }; -ALIGNED(4) static const char debug_fill8[] = "pksdir0"; -ALIGNED(4) const char sGameInternalVersion[] = _("POKE_DUNGEON__05"); +EWRAM_DATA s32 gUnknown_202DE28 = {0}; + +EWRAM_INIT u32 gUnknown_203B17C = {0}; +EWRAM_INIT const char *gUnknown_203B180 = {"POKE_DUNGEON__05"}; +EWRAM_INIT struct UnkStruct_203B184 *gUnknown_203B184 = {0}; ALIGNED(4) static const char fill_save0[] = _("pksdir0"); ALIGNED(4) static const char fill_save1[] = _("pksdir0"); @@ -72,7 +70,7 @@ void sub_8011C40(s32 x) gUnknown_202DE28 = x; } -char *GetGameInternalName(void) +const char *GetGameInternalName(void) { return gUnknown_203B180; // returns POKE_DUNGEON__05 } @@ -321,7 +319,7 @@ bool8 IsSaveCorrupted(void) u32 WriteSavetoPak(s32 *param_1, u32 param_2) { struct UnkStruct_sub_8011DAC *playerSave; - char *gameName; + const char *gameName; int saveStatus1; int saveStatus2; u8 *array_ptr; @@ -384,7 +382,7 @@ s32 sub_80121D4(s32 *a, u8 *src, s32 size) u32 sub_80121E0(u32 r0) { u32 temp; - char *gameName; + const char *gameName; u32 saveStatus; struct unk_struct *r4 = MemoryAlloc(sizeof(struct unk_struct), 5); temp = 0x1F; diff --git a/src/save_read.c b/src/save_read.c index de8870b24..5cb152502 100644 --- a/src/save_read.c +++ b/src/save_read.c @@ -5,7 +5,7 @@ #include "save.h" #include "save_read.h" -EWRAM_DATA_2 SavePakRead *gSavePakRead = {0}; +EWRAM_INIT SavePakRead *gSavePakRead = {NULL}; #include "data/save_read.h" @@ -62,4 +62,4 @@ void FinishReadSavePak(void) MemoryFree(gSavePakRead); gSavePakRead = NULL; } -} \ No newline at end of file +} diff --git a/src/save_write.c b/src/save_write.c index b295510cb..6cbfaeaa4 100644 --- a/src/save_write.c +++ b/src/save_write.c @@ -6,7 +6,7 @@ #include "save.h" #include "save_write.h" -static EWRAM_DATA_2 SavePakWrite *sSavePakWrite = {0}; +static EWRAM_INIT SavePakWrite *sSavePakWrite = {NULL}; #include "data/save_write.h" diff --git a/sym_ewram2.txt b/sym_ewram2.txt index d6c76999d..d699a0d05 100644 --- a/sym_ewram2.txt +++ b/sym_ewram2.txt @@ -1,13 +1,9 @@ .align 2 -.include "src/debug.o" - .space 0x2B -.include "src/save.o" -.include "src/save_read.o" -.include "src/save_write.o" -.include "src/quick_save_read.o" -.include "src/quick_save_write.o" + + + gUnknown_203B198: /* 203B198 (sub_8014248 - sub_8014A88) */ .space 0x60 diff --git a/sym_ewram_init.txt b/sym_ewram_init.txt index e33c03b52..c1f2b5fbb 100644 --- a/sym_ewram_init.txt +++ b/sym_ewram_init.txt @@ -15,3 +15,9 @@ .include "src/code_800DAC0.o" .include "src/code_800ED38.o" .include "src/code_8010EF0.o" +.include "src/debug.o" +.include "src/save.o" +.include "src/save_read.o" +.include "src/save_write.o" +.include "src/quick_save_read.o" +.include "src/quick_save_write.o"