From a1d32de779cce2d0755a3cc25fa51486e53d4673 Mon Sep 17 00:00:00 2001 From: Kieron Date: Tue, 7 Nov 2023 22:22:13 +0000 Subject: [PATCH] Inline data for select* overlays --- build/build.py | 1 + build/linker_command_file.txt | 1 - src/overlays/select/Takabe/vib_edit.c | 119 ++++++++++++-------------- src/overlays/select/overlay.c | 54 +----------- src/overlays/select/overlay2.c | 3 - src/overlays/select1/Game/select.c | 8 +- src/overlays/select1/overlay.c | 5 +- um/select.bin | 1 + 8 files changed, 59 insertions(+), 133 deletions(-) delete mode 100644 src/overlays/select/overlay2.c diff --git a/build/build.py b/build/build.py index fea09c53a..50c6b9e65 100755 --- a/build/build.py +++ b/build/build.py @@ -85,6 +85,7 @@ def ninja_run(): r'mts_new\.c:\d+: warning: control reaches end of non-void function', r'overlay_bss\.c:\d+: warning: `s00a_dword_800E1120\' defined but not used', r'mosaic\.c:\d+: warning: unused variable `unused\'', + r'vib_edit.c:\d+: warning: too many arguments for format', ] if os.environ.get('APPVEYOR'): diff --git a/build/linker_command_file.txt b/build/linker_command_file.txt index 9cd1b0035..c48cc7460 100644 --- a/build/linker_command_file.txt +++ b/build/linker_command_file.txt @@ -353,7 +353,6 @@ overlay_bss group file("{{OBJ_DIR}}\{{OVERLAY}}_{{OVERLAY_SUFFIX}}_bss.bin") include "{{OBJ_DIR}}\overlays\select\overlay.obj" include "{{OBJ_DIR}}\overlays\select1\Game\select.obj" include "{{OBJ_DIR}}\overlays\select\Takabe\vib_edit.obj" - include "{{OBJ_DIR}}\overlays\select\overlay2.obj" include "{{OBJ_DIR}}\overlays\s16b\unknown.obj" include "{{OBJ_DIR}}\overlays\s16b\unknown2.obj" diff --git a/src/overlays/select/Takabe/vib_edit.c b/src/overlays/select/Takabe/vib_edit.c index 7e50050d0..fed9ca102 100644 --- a/src/overlays/select/Takabe/vib_edit.c +++ b/src/overlays/select/Takabe/vib_edit.c @@ -46,36 +46,6 @@ extern int GM_GameStatus_800AB3CC; extern int GM_PlayerStatus_800ABA50; extern GV_PAD GV_PadData_800B05C0[4]; -extern const char select_aSavevibrationeditordata_800C52A4[]; // = "Save vibration editor data !\n" -extern char select_aVibeditdat_800C52C4[]; // = "VIB_EDIT.DAT" -extern const char select_aVibeditc_800C52D4[]; // = "vib_edit.c" -extern const char select_aDd_800C50E4[]; -extern const char select_aDd_800C5124[]; -extern const char select_aHigh_800C50DC[]; -extern const char select_aLow_800C50F0[]; -extern const char select_aPadvibationparameterforgcl_800C50B8[]; -extern const char select_aPadvibationparameterforprogram_800C50F8[]; -extern const char select_a_800C50EC[]; -extern const char select_a_800C5120[]; -extern const char select_a_800C512C[]; -extern const char select_aChangelengthlr_800C518C[]; -extern const char select_aChangepowerud_800C51A8[]; -extern const char select_aDdd_800C5280[]; -extern const char select_aDispparamy_800C520C[]; -extern const char select_aEddd_800C5270[]; -extern const char select_aEditmenu_800C5130[]; -extern const char select_aEditmenur_800C5224[]; -extern const char select_aEditvibrationtyped_800C5254[]; -extern const char select_aExitl_800C51C4[]; -extern const char select_aFilemenu_800C513C[]; -extern const char select_aFilemenul_800C523C[]; -extern const char select_aPlaya_800C51DC[]; -extern const char select_aSd_800C5148[]; -extern const char select_aSelectparamlr_800C5170[]; -extern const char select_aTypechangex_800C51F4[]; -extern const char select_aVibrationeditorver_800C5150[]; -extern char *select_dword_800C3220[4]; -extern char *select_dword_800C3230[5]; // VibEditGetResources is calling this with two missing parameters for some reason. int PCopen_80014B1C(const char *name); int PCread_80014B24(int fd, char *buff, int len); @@ -94,6 +64,23 @@ int THING_Gcl_GetInt(int param); #define EXEC_LEVEL 3 +const char *select_dword_800C3220[4] = +{ + "INS PARAM", + "DEL PARAM", + "SWAP BACK", + "SWAP FORWARD", +}; + +const char *select_dword_800C3230[5] = +{ + "CHANGE BANK", + "QUICK SAVE HIGH", + "QUICK SAVE LOW", + "QUICK LOAD HIGH", + "QUICK LOAD LOW", +}; + void VibEdit_800C34F0(VibEditWork *work) { VibEditPrims *prims; @@ -150,8 +137,8 @@ void select_800C3974(VibEditWork *work) int i; VibPair *iter; - printf(select_aPadvibationparameterforgcl_800C50B8); - printf(select_aHigh_800C50DC); + printf("pad vibation parameter (for gcl)\n"); + printf("high:{ "); iter = work->field_4C_pairs; for (i = 0; i < 16; iter++, i++) @@ -160,10 +147,10 @@ void select_800C3974(VibEditWork *work) { break; } - printf(select_aDd_800C50E4, iter->first, iter->second); + printf("%d,%d ", iter->first, iter->second); } - printf(select_a_800C50EC); - printf(select_aLow_800C50F0); + printf("}\n"); + printf("low:{ "); iter = work->field_70_pairs; for (i = 0; i < 16; iter++, i++) { @@ -171,35 +158,35 @@ void select_800C3974(VibEditWork *work) { break; } - printf(select_aDd_800C50E4, iter->first, iter->second); + printf("%d,%d ", iter->first, iter->second); } - printf(select_a_800C50EC); - printf(select_aPadvibationparameterforprogram_800C50F8); - printf(select_aHigh_800C50DC); + printf("}\n"); + printf("pad vibation parameter (for program)\n"); + printf("high:{ "); iter = work->field_4C_pairs; for (i = 0; i < 16; iter++, i++) { if (iter->first == 0 && iter->second == 0) { - printf(select_a_800C5120, iter->first, iter->second); // unnecessary args... + printf("0,0", iter->first, iter->second); // unnecessary args... break; } - printf(select_aDd_800C5124, iter->first, iter->second); + printf("%d,%d,", iter->first, iter->second); } - printf(select_a_800C50EC); - printf(select_aHigh_800C50DC); + printf("}\n"); + printf("high:{ "); iter = work->field_70_pairs; for (i = 0; i < 16; iter++, i++) { if (iter->first == 0 && iter->second == 0) { - printf(select_a_800C5120, iter->first, iter->second); // unnecessary args... + printf("0,0", iter->first, iter->second); // unnecessary args... break; } - printf(select_aDd_800C5124, iter->first, iter->second); + printf("%d,%d,", iter->first, iter->second); } - printf(select_a_800C512C); + printf("}\n\n"); } void select_800C3BB8(VibPair *ptr, int cnt) @@ -484,7 +471,7 @@ void VibEditAct_800C3DB0(VibEditWork *work) } } menu_Text_XY_Flags_80038B34(230, 160, 0); - menu_Text_80038C38(select_aEditmenu_800C5130); + menu_Text_80038C38("EDIT MENU"); for (i = 0; i < 4; i++) { if (work->field_2C == i) @@ -569,7 +556,7 @@ void VibEditAct_800C3DB0(VibEditWork *work) } menu_Text_XY_Flags_80038B34(230, 160, 0); - menu_Text_80038C38(select_aFilemenu_800C513C); + menu_Text_80038C38("FILE MENU"); if (work->field_2C == 0) { menu_Text_XY_Flags_80038B34(230, 172, 0); @@ -578,7 +565,7 @@ void VibEditAct_800C3DB0(VibEditWork *work) { menu_Text_XY_Flags_80038B34(238, 172, 0); } - menu_Text_80038C38(select_aSd_800C5148, select_dword_800C3230[0], work->field_28); + menu_Text_80038C38("%s %d", select_dword_800C3230[0], work->field_28); for (i = 1; i < 5; i++) { @@ -601,19 +588,19 @@ void VibEditAct_800C3DB0(VibEditWork *work) break; } menu_Text_XY_Flags_80038B34(32, 16, 0); - menu_Text_80038C38(select_aVibrationeditorver_800C5150); - menu_Text_80038C38(select_aSelectparamlr_800C5170); - menu_Text_80038C38(select_aChangelengthlr_800C518C); - menu_Text_80038C38(select_aChangepowerud_800C51A8); - menu_Text_80038C38(select_aExitl_800C51C4); + menu_Text_80038C38("Vibration Editor Ver 1.50\n"); + menu_Text_80038C38("Select param - < L1 R1 >\n"); + menu_Text_80038C38("Change length - < L R >\n"); + menu_Text_80038C38("Change power - < U D >\n"); + menu_Text_80038C38("EXIT - < L3 >\n"); menu_Text_XY_Flags_80038B34(168, 24, 0); - menu_Text_80038C38(select_aPlaya_800C51DC); - menu_Text_80038C38(select_aTypechangex_800C51F4); - menu_Text_80038C38(select_aDispparamy_800C520C); - menu_Text_80038C38(select_aEditmenur_800C5224); - menu_Text_80038C38(select_aFilemenul_800C523C); + menu_Text_80038C38("PLAY - < A >\n"); + menu_Text_80038C38("Type change - < X >\n"); + menu_Text_80038C38("Disp param - < Y >\n"); + menu_Text_80038C38("Edit menu - < R2 >\n"); + menu_Text_80038C38("File menu - < L2 >\n"); menu_Text_XY_Flags_80038B34(32, 64, 0); - menu_Text_80038C38(select_aEditvibrationtyped_800C5254, 2 - work->field_3C); + menu_Text_80038C38("Edit vibration - type %d\n", 2 - work->field_3C); for (j = 0; j < 2; j++) { @@ -624,11 +611,11 @@ void VibEditAct_800C3DB0(VibEditWork *work) menu_Text_XY_Flags_80038B34(32 + 100 * j, 160 + i * 8, 0); if (idx == work->field_38) { - menu_Text_80038C38(select_aEddd_800C5270, idx, cur_pair->first, cur_pair->second); + menu_Text_80038C38("E%2d- %3d %3d\n", idx, cur_pair->first, cur_pair->second); } else { - menu_Text_80038C38(select_aDdd_800C5280, idx, cur_pair->first, cur_pair->second); + menu_Text_80038C38(" %2d- %3d %3d\n", idx, cur_pair->first, cur_pair->second); } } } @@ -650,11 +637,11 @@ void VibEditDie_800C467C(VibEditWork *work) { int fd; - printf(select_aSavevibrationeditordata_800C52A4); + printf("Save vibration editor data !\n"); VibEdit_800C3CBC(work, work->field_28); - fd = PCcreat(select_aVibeditdat_800C52C4); + fd = PCcreat("VIB_EDIT.DAT"); PCwrite(fd, (char *)work->field_94_pairs, sizeof(work->field_94_pairs)); PCclose_80014B2C(fd); @@ -671,7 +658,7 @@ int VibEditGetResources_800C4720(VibEditWork *work, int flags, int perms) VibEdit_800C34F0(work); // Should have 3 args - fd = PCopen_80014B1C(select_aVibeditdat_800C52C4); + fd = PCopen_80014B1C("VIB_EDIT.DAT"); PCread_80014B24(fd, (char *)work->field_94_pairs, sizeof(work->field_94_pairs)); PCclose_80014B2C(fd); @@ -691,7 +678,7 @@ GV_ACT *NewVibEdit_800C47B4(int flags, int perms) if (work != NULL) { GV_SetNamedActor_8001514C(&work->actor, (TActorFunction)VibEditAct_800C3DB0, - (TActorFunction)VibEditDie_800C467C, select_aVibeditc_800C52D4); + (TActorFunction)VibEditDie_800C467C, "vib_edit.c"); if (VibEditGetResources_800C4720(work, flags, perms) < 0) { diff --git a/src/overlays/select/overlay.c b/src/overlays/select/overlay.c index 67fa47c01..dee6fc77d 100755 --- a/src/overlays/select/overlay.c +++ b/src/overlays/select/overlay.c @@ -8,57 +8,5 @@ GCL_ActorTableEntry selectOverlayCharas[] = { { CHARA_SELECT, NewSelect_800c3434 }, { 0x6C66, (TGCL_ActorCreateFn)NewVibEdit_800C47B4 }, - { 0, 0 } -}; - -// Game/select.c: -const char aNoMenu[] = "NO MENU\n"; -const char aSelect[] = {'s', 'e', 'l', 'e', 'c', 't', '.', 'c', 0x0, 'r', ':', ' '}; // "select.c" + padding filled with memleak ("r: ")? - -const char select_aSwapforward_800C5038[] = "SWAP FORWARD"; -const char select_aSwapback_800C5048[] = "SWAP BACK"; -const char select_aDelparam_800C5054[] = "DEL PARAM"; -const char select_aInsparam_800C5060[] = "INS PARAM"; -const char select_aQuickloadlow_800C506C[] = "QUICK LOAD LOW"; -const char select_aQuickloadhigh_800C507C[] = "QUICK LOAD HIGH"; -const char select_aQuicksavelow_800C508C[] = "QUICK SAVE LOW"; -const char select_aQuicksavehigh_800C509C[] = "QUICK SAVE HIGH"; -const char select_aChangebank_800C50AC[] = "CHANGE BANK"; -const char select_aPadvibationparameterforgcl_800C50B8[] = "pad vibation parameter (for gcl)\n"; -const char select_aHigh_800C50DC[] = "high:{ "; -const char select_aDd_800C50E4[] = "%d,%d "; -const char select_a_800C50EC[] = "}\n"; -const char select_aLow_800C50F0[] = "low:{ "; -const char select_aPadvibationparameterforprogram_800C50F8[] = "pad vibation parameter (for program)\n"; -const char select_a_800C5120[] = "0,0"; -const char select_aDd_800C5124[] = "%d,%d,"; -const char select_a_800C512C[] = "}\n\n"; -const char select_aEditmenu_800C5130[] = "EDIT MENU"; -const char select_aFilemenu_800C513C[] = "FILE MENU"; -const char select_aSd_800C5148[] = "%s %d"; -const char select_aVibrationeditorver_800C5150[] = "Vibration Editor Ver 1.50\n"; -const char select_aSelectparamlr_800C5170[] = "Select param - < L1 R1 >\n"; -const char select_aChangelengthlr_800C518C[] = "Change length - < L R >\n"; -const char select_aChangepowerud_800C51A8[] = "Change power - < U D >\n"; -const char select_aExitl_800C51C4[] = "EXIT - < L3 >\n"; -const char select_aPlaya_800C51DC[] = "PLAY - < A >\n"; -const char select_aTypechangex_800C51F4[] = "Type change - < X >\n"; -const char select_aDispparamy_800C520C[] = "Disp param - < Y >\n"; -const char select_aEditmenur_800C5224[] = "Edit menu - < R2 >\n"; -const char select_aFilemenul_800C523C[] = "File menu - < L2 >\n"; -const char select_aEditvibrationtyped_800C5254[] = "Edit vibration - type %d\n"; -const char select_aEddd_800C5270[] = "E%2d- %3d %3d\n"; -const char select_aDdd_800C5280[] = " %2d- %3d %3d\n"; - -const char *select_dword_800C3220[4] = -{ - select_aInsparam_800C5060, select_aDelparam_800C5054, - select_aSwapback_800C5048, select_aSwapforward_800C5038 -}; - -const char *select_dword_800C3230[5] = -{ - select_aChangebank_800C50AC, select_aQuicksavehigh_800C509C, - select_aQuicksavelow_800C508C, select_aQuickloadhigh_800C507C, - select_aQuickloadlow_800C506C + { 0, NULL } }; diff --git a/src/overlays/select/overlay2.c b/src/overlays/select/overlay2.c deleted file mode 100644 index 8e3f16d54..000000000 --- a/src/overlays/select/overlay2.c +++ /dev/null @@ -1,3 +0,0 @@ -const char select_aSavevibrationeditordata_800C52A4[] = "Save vibration editor data !\n"; -const char select_aVibeditdat_800C52C4[] = "VIB_EDIT.DAT"; -const char select_aVibeditc_800C52D4[] = "vib_edit.c"; diff --git a/src/overlays/select1/Game/select.c b/src/overlays/select1/Game/select.c index 6585c3720..06cd58312 100644 --- a/src/overlays/select1/Game/select.c +++ b/src/overlays/select1/Game/select.c @@ -86,13 +86,11 @@ void Select_Act_800c32d8(Work *work) menu_Text_80038C38(work->field_24); } -extern const char aNoMenu[]; // "NO MENU\n" - int Select_helper_800c33d0(Work *work, int param_2, int param_3) { if (GCL_GetOption_80020968('s') == 0) { - printf(aNoMenu); + printf("NO MENU\n"); return -1; } @@ -103,8 +101,6 @@ int Select_helper_800c33d0(Work *work, int param_2, int param_3) return 0; } -extern const char aSelect[]; // "select.c" - GV_ACT *NewSelect_800c3434(int name, int where, int argc, char **argv) { Work *pActor; @@ -112,7 +108,7 @@ GV_ACT *NewSelect_800c3434(int name, int where, int argc, char **argv) pActor = (Work *)GV_NewActor_800150E4(EXEC_LEVEL, sizeof(Work)); if (pActor) { - GV_SetNamedActor_8001514C(&pActor->actor, (TActorFunction)Select_Act_800c32d8, 0, aSelect); + GV_SetNamedActor_8001514C(&pActor->actor, (TActorFunction)Select_Act_800c32d8, 0, "select.c"); if (Select_helper_800c33d0(pActor, where, name) < 0) { GV_DestroyActor_800151C8(&pActor->actor); diff --git a/src/overlays/select1/overlay.c b/src/overlays/select1/overlay.c index 2d344b67a..ddaa7da27 100644 --- a/src/overlays/select1/overlay.c +++ b/src/overlays/select1/overlay.c @@ -4,8 +4,5 @@ GCL_ActorTableEntry Select1OverlayEntries_800C3208[] = { {CHARA_SELECT, NewSelect_800c3434}, - {0, 0} + {0, NULL} }; - -const char aNoMenu[] = "NO MENU\n"; -const char aSelect[] = "select.c"; diff --git a/um/select.bin b/um/select.bin index e69de29bb..c23a04ba2 100644 --- a/um/select.bin +++ b/um/select.bin @@ -0,0 +1 @@ +r: \ No newline at end of file