From 99a2f5db7521815aa66b61e29588dd9d7d60157d Mon Sep 17 00:00:00 2001 From: Geared <114871309+SketchyGear@users.noreply.github.com> Date: Fri, 22 May 2026 17:12:49 -0300 Subject: [PATCH 1/4] sa1: match CreateStageUI & CreateSpecialStageUI now we only need to figure out StageUI_DrawTimer and sub_8053BAC, horray! --- src/game/sa1/stage/stage_ui.c | 38 ++++++++++++----------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/game/sa1/stage/stage_ui.c b/src/game/sa1/stage/stage_ui.c index 789bcea62..cf96ec470 100644 --- a/src/game/sa1/stage/stage_ui.c +++ b/src/game/sa1/stage/stage_ui.c @@ -596,51 +596,39 @@ void sub_8054068(void) void CreateStageUI(void) { -#ifndef NON_MATCHING - register void *dtor asm("r1") = 0; - StageUI_20 *unk20 = NULL; - register Task *t asm("r1") = TaskCreate(Task_StageUIMain, sizeof(StageUI), 0x2180, 0, dtor); -#else - void *dtor = 0; + Task *t = NULL; + + StageUI *ui; StageUI_20 *unk20 = NULL; - Task *t = TaskCreate(Task_StageUIMain, sizeof(StageUI), 0x2180, 0, dtor); -#endif - StageUI *ui = TASK_DATA(t); + t = TaskCreate(Task_StageUIMain, sizeof(StageUI), 0x2180, 0, NULL); + + ui = TASK_DATA(t); ui->unk40 = 0; // Colons ui = TASK_DATA(t); unk20 = &ui->unk20; - unk20->unk1 = 42; - unk20->unk4 = 42; + unk20->unk1 = UI_DIGIT(10); + unk20->unk4 = UI_DIGIT(10); UiGfxStackInit(); sub_80538BC(); } -// https://decomp.me/scratch/3QSHy void CreateSpecialStageUI(void) { -#ifndef NON_MATCHING - register void *dtor asm("r1") = 0; - register Task *t asm("r1"); -#else - void *dtor = 0; - Task *t; -#endif - s32 zero; StageUI *ui; - t = TaskCreate(Task_SpecialStageUIMain, sizeof(StageUI), 0x1180, (zero = 0), dtor); + Task *t = NULL; + t = TaskCreate(Task_SpecialStageUIMain, sizeof(StageUI), 0x1180, 0, NULL); ui = TASK_DATA(t); - ui->unk40 = zero; + ui->unk40 = 0; -#ifndef NON_MATCHING + // Colons ui = TASK_DATA(t); -#endif - ui->unk4C = zero; + ui->unk4C = 0; UiGfxStackInit(); sub_8054068(); From 52cef63936db459200346742155990439cfce5b5 Mon Sep 17 00:00:00 2001 From: Geared <114871309+SketchyGear@users.noreply.github.com> Date: Sat, 23 May 2026 14:44:04 -0300 Subject: [PATCH 2/4] oh yeah, there's this delete the target asm file, since, apparently, web github can't do multiple stuff at a single commit, for some reason --- .../stage/stage_ui__CreateSpecialStageUI.inc | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 asm/non_matching/game/sa1/stage/stage_ui__CreateSpecialStageUI.inc diff --git a/asm/non_matching/game/sa1/stage/stage_ui__CreateSpecialStageUI.inc b/asm/non_matching/game/sa1/stage/stage_ui__CreateSpecialStageUI.inc deleted file mode 100644 index df3b48e21..000000000 --- a/asm/non_matching/game/sa1/stage/stage_ui__CreateSpecialStageUI.inc +++ /dev/null @@ -1,36 +0,0 @@ -.include "constants/constants.inc" - -.syntax unified -.text - push {r4, lr} - sub sp, #4 - movs r1, #0 - ldr r0, _0805422C @ =Task_SpecialStageUIMain - movs r2, #0x8c - lsls r2, r2, #5 - movs r4, #0 - str r1, [sp] - movs r1, #0x50 - movs r3, #0 - bl TaskCreate - adds r1, r0, #0 - ldrh r0, [r1, #6] - ldr r2, _08054230 @ =0x03000040 - adds r0, r0, r2 - strh r4, [r0] - ldrh r0, [r1, #6] - ldr r1, _08054234 @ =0x0300004C - adds r0, r0, r1 - strh r4, [r0] - bl UiGfxStackInit - bl sub_8054068 - add sp, #4 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_0805422C: .4byte Task_SpecialStageUIMain -_08054230: .4byte 0x03000040 -_08054234: .4byte 0x0300004C - -.syntax divided From 82791acb6728e82764fafb5b5d3893c239a0333d Mon Sep 17 00:00:00 2001 From: Geared <114871309+SketchyGear@users.noreply.github.com> Date: Sat, 23 May 2026 15:22:56 -0300 Subject: [PATCH 3/4] little documentation/optimization hopefully, we find a way to make proper use of the original code's (possible) debug behavior... or i could be exaggerating over what was originally just the devs playing safe! eh, either theory works, i guess --- src/game/sa1/stage/stage_ui.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/game/sa1/stage/stage_ui.c b/src/game/sa1/stage/stage_ui.c index cf96ec470..dbdddb35b 100644 --- a/src/game/sa1/stage/stage_ui.c +++ b/src/game/sa1/stage/stage_ui.c @@ -596,6 +596,10 @@ void sub_8054068(void) void CreateStageUI(void) { +#ifndef NON_MATCHING + // why would anyone init a ptr to NULL, only to unconditionally + // set it with a proper address, right after? possibly stripped + // debug behavior? perhaps DEBUG would fit better in these... Task *t = NULL; StageUI *ui; @@ -604,11 +608,19 @@ void CreateStageUI(void) t = TaskCreate(Task_StageUIMain, sizeof(StageUI), 0x2180, 0, NULL); ui = TASK_DATA(t); +#else + Task *t = TaskCreate(Task_StageUIMain, sizeof(StageUI), 0x2180, 0, NULL); + + StageUI *ui = TASK_DATA(t); + StageUI_20 *unk20 = &ui->unk20; +#endif ui->unk40 = 0; // Colons - ui = TASK_DATA(t); +#ifndef NON_MATCHING + ui = TASK_DATA(t); // copy-paste? unk20 = &ui->unk20; +#endif unk20->unk1 = UI_DIGIT(10); unk20->unk4 = UI_DIGIT(10); @@ -618,16 +630,25 @@ void CreateStageUI(void) void CreateSpecialStageUI(void) { +#ifndef NON_MATCHING StageUI *ui; + // read the comment from CreateStageUI's initialization section Task *t = NULL; t = TaskCreate(Task_SpecialStageUIMain, sizeof(StageUI), 0x1180, 0, NULL); ui = TASK_DATA(t); +#else + Task *t = TaskCreate(Task_SpecialStageUIMain, sizeof(StageUI), 0x1180, 0, NULL); + + StageUI *ui = TASK_DATA(t); +#endif ui->unk40 = 0; // Colons - ui = TASK_DATA(t); +#ifndef NON_MATCHING + ui = TASK_DATA(t); // copy-paste? +#endif ui->unk4C = 0; UiGfxStackInit(); From b8e9b8e35017be304495257626ac9fa904357597 Mon Sep 17 00:00:00 2001 From: Geared <114871309+SketchyGear@users.noreply.github.com> Date: Sat, 23 May 2026 19:59:03 -0300 Subject: [PATCH 4/4] maybe i went a bit overboard... revert the previous commit, basically (web GitHub also doesn't support commit reverting, what a surprise!) --- src/game/sa1/stage/stage_ui.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/game/sa1/stage/stage_ui.c b/src/game/sa1/stage/stage_ui.c index dbdddb35b..c9679fbcc 100644 --- a/src/game/sa1/stage/stage_ui.c +++ b/src/game/sa1/stage/stage_ui.c @@ -596,10 +596,6 @@ void sub_8054068(void) void CreateStageUI(void) { -#ifndef NON_MATCHING - // why would anyone init a ptr to NULL, only to unconditionally - // set it with a proper address, right after? possibly stripped - // debug behavior? perhaps DEBUG would fit better in these... Task *t = NULL; StageUI *ui; @@ -608,19 +604,11 @@ void CreateStageUI(void) t = TaskCreate(Task_StageUIMain, sizeof(StageUI), 0x2180, 0, NULL); ui = TASK_DATA(t); -#else - Task *t = TaskCreate(Task_StageUIMain, sizeof(StageUI), 0x2180, 0, NULL); - - StageUI *ui = TASK_DATA(t); - StageUI_20 *unk20 = &ui->unk20; -#endif ui->unk40 = 0; // Colons -#ifndef NON_MATCHING ui = TASK_DATA(t); // copy-paste? unk20 = &ui->unk20; -#endif unk20->unk1 = UI_DIGIT(10); unk20->unk4 = UI_DIGIT(10); @@ -630,25 +618,16 @@ void CreateStageUI(void) void CreateSpecialStageUI(void) { -#ifndef NON_MATCHING StageUI *ui; - // read the comment from CreateStageUI's initialization section Task *t = NULL; t = TaskCreate(Task_SpecialStageUIMain, sizeof(StageUI), 0x1180, 0, NULL); ui = TASK_DATA(t); -#else - Task *t = TaskCreate(Task_SpecialStageUIMain, sizeof(StageUI), 0x1180, 0, NULL); - - StageUI *ui = TASK_DATA(t); -#endif ui->unk40 = 0; // Colons -#ifndef NON_MATCHING ui = TASK_DATA(t); // copy-paste? -#endif ui->unk4C = 0; UiGfxStackInit();