Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions config/GSNE8P/stg13D/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ stg13_cityescape/o_ce_truck.c:
.text start:0x0000CCE8 end:0x000116C4
.rodata start:0x000002A0 end:0x00000398

stg13D_16.c:
.text start:0x000118C8 end:0x0001251C
.rodata start:0x00000428 end:0x00000458
stg13_cityescape/cityescape.c:
Comment thread
ieee802dot11ac marked this conversation as resolved.
.text start:0x000116C4 end:0x0001251C
.rodata start:0x00000398 end:0x00000458
.data start:0x00202228 end:0x00202414

stg13D_17.c:
.text start:0x0001294C end:0x00012A98
Expand All @@ -86,6 +87,9 @@ stg13D_19.c:
.text start:0x00012D0C end:0x000138B0
.rodata start:0x00000470 end:0x00000478

stg13D_19.5.c:
.text start:0x000138B0 end:0x00013DC8

stg13D_20.c:
.text start:0x00013DC8 end:0x00018B74
.rodata start:0x00000478 end:0x00000580
Expand Down Expand Up @@ -246,7 +250,7 @@ stg13D_60.c:
.text start:0x0002CFA4 end:0x0002D060
.rodata start:0x00000C38 end:0x00000C40

stg13D_61.c:
OBJECT/o_goalring.c:
.text start:0x0002D208 end:0x0002E520
.rodata start:0x00000C40 end:0x00000C98

Expand Down
62 changes: 31 additions & 31 deletions config/GSNE8P/stg13D/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn_13_B900 = .text:0x0000B900; // type:function size:0x70
fn_13_B970 = .text:0x0000B970; // type:function size:0x4
fn_13_B974 = .text:0x0000B974; // type:function size:0x108
fn_13_BA7C = .text:0x0000BA7C; // type:function size:0x4
fn_13_BA80 = .text:0x0000BA80; // type:function size:0x70
ObjectCeSeKaze = .text:0x0000BA80; // type:function size:0x70
fn_13_BAF0 = .text:0x0000BAF0; // type:function size:0x4
fn_13_BAF4 = .text:0x0000BAF4; // type:function size:0x264
fn_13_BD58 = .text:0x0000BD58; // type:function size:0x4
Expand Down Expand Up @@ -145,14 +145,14 @@ fn_13_116C4 = .text:0x000116C4; // type:function size:0x74
fn_13_11738 = .text:0x00011738; // type:function size:0x164
_prolog = .text:0x0001189C; // type:function size:0x28 scope:global
_epilog = .text:0x000118C4; // type:function size:0x4 scope:global
fn_13_118C8 = .text:0x000118C8; // type:function size:0x4C4
fn_13_11D8C = .text:0x00011D8C; // type:function size:0xE0
fn_13_11E6C = .text:0x00011E6C; // type:function size:0xD8
fn_13_11F44 = .text:0x00011F44; // type:function size:0x154
fn_13_12098 = .text:0x00012098; // type:function size:0x4
fn_13_1209C = .text:0x0001209C; // type:function size:0x20
fn_13_120BC = .text:0x000120BC; // type:function size:0x244
fn_13_12300 = .text:0x00012300; // type:function size:0x21C
CityEscapeProlog = .text:0x000118C8; // type:function size:0x4C4
CityEscapeEpilog = .text:0x00011D8C; // type:function size:0xE0
BgmStart = .text:0x00011E6C; // type:function size:0xD8 scope:local
CityEscapeExec = .text:0x00011F44; // type:function size:0x154
BgExec = .text:0x00012098; // type:function size:0x4 scope:local
BgExecDest = .text:0x0001209C; // type:function size:0x20 scope:local
BgExecDisp = .text:0x000120BC; // type:function size:0x244 scope:local
BgExecDispSort = .text:0x00012300; // type:function size:0x21C scope:local
fn_13_1251C = .text:0x0001251C; // type:function size:0x34
fn_13_12550 = .text:0x00012550; // type:function size:0x58
fn_13_125A8 = .text:0x000125A8; // type:function size:0x4C
Expand All @@ -170,7 +170,7 @@ fn_13_12D0C = .text:0x00012D0C; // type:function size:0x544
fn_13_13250 = .text:0x00013250; // type:function size:0x660
fn_13_138B0 = .text:0x000138B0; // type:function size:0x194
fn_13_13A44 = .text:0x00013A44; // type:function size:0x4
fn_13_13A48 = .text:0x00013A48; // type:function size:0x260
LoadLightFile = .text:0x00013A48; // type:function size:0x260
fn_13_13CA8 = .text:0x00013CA8; // type:function size:0x120
fn_13_13DC8 = .text:0x00013DC8; // type:function size:0x78
fn_13_13E40 = .text:0x00013E40; // type:function size:0x244
Expand Down Expand Up @@ -468,14 +468,14 @@ fn_13_2D0EC = .text:0x0002D0EC; // type:function size:0x38
fn_13_2D124 = .text:0x0002D124; // type:function size:0x4
fn_13_2D128 = .text:0x0002D128; // type:function size:0xDC
fn_13_2D204 = .text:0x0002D204; // type:function size:0x4
fn_13_2D208 = .text:0x0002D208; // type:function size:0x2EC
fn_13_2D4F4 = .text:0x0002D4F4; // type:function size:0x44
fn_13_2D538 = .text:0x0002D538; // type:function size:0x7F4
ObjectGoalRing = .text:0x0002D208; // type:function size:0x2EC
ObjectGoalRingDest = .text:0x0002D4F4; // type:function size:0x44
ObjectGoalRingExec = .text:0x0002D538; // type:function size:0x7F4
fn_13_2DD2C = .text:0x0002DD2C; // type:function size:0x34
fn_13_2DD60 = .text:0x0002DD60; // type:function size:0xF0
fn_13_2DE50 = .text:0x0002DE50; // type:function size:0x214
fn_13_2E064 = .text:0x0002E064; // type:function size:0x254
fn_13_2E2B8 = .text:0x0002E2B8; // type:function size:0x268
ObjectGoalRingDisp = .text:0x0002DE50; // type:function size:0x214
ObjectGoalRingDispSort = .text:0x0002E064; // type:function size:0x254
ObjectGoalRingDispShad = .text:0x0002E2B8; // type:function size:0x268
fn_13_2E520 = .text:0x0002E520; // type:function size:0x8C
fn_13_2E5AC = .text:0x0002E5AC; // type:function size:0x12C
fn_13_2E6D8 = .text:0x0002E6D8; // type:function size:0x4C
Expand Down Expand Up @@ -15165,24 +15165,24 @@ lbl_13_data_202178 = .data:0x00202178; // type:object size:0x30
lbl_13_data_2021A8 = .data:0x002021A8; // type:object size:0x28
lbl_13_data_2021D0 = .data:0x002021D0; // type:object size:0x38
lbl_13_data_202208 = .data:0x00202208; // type:object size:0x20
lbl_13_data_202228 = .data:0x00202228; // type:object size:0x40
lbl_13_data_202268 = .data:0x00202268; // type:object size:0x9 data:string
lbl_13_data_202228 = .data:0x00202228; // type:object size:0x40 data:float
_rename_CityEscapeSubprgHeader = .data:0x00202268; // type:object size:0x18
lbl_13_data_202280 = .data:0x00202280; // type:object size:0x88
lbl_13_data_202308 = .data:0x00202308; // type:object size:0x88
lbl_13_data_202390 = .data:0x00202390; // type:object size:0xC
lbl_13_data_20239C = .data:0x0020239C; // type:object size:0xC
lbl_13_data_2023A8 = .data:0x002023A8; // type:object size:0x9 data:string
lbl_13_data_2023B4 = .data:0x002023B4; // type:object size:0x10 data:string
lbl_13_data_2023C4 = .data:0x002023C4; // type:object size:0x10 data:string
lbl_13_data_2023D4 = .data:0x002023D4; // type:object size:0xD data:string
lbl_13_data_2023E4 = .data:0x002023E4; // type:object size:0xD data:string
lbl_13_data_2023F4 = .data:0x002023F4; // type:object size:0x7 data:string
lbl_13_data_2023FC = .data:0x002023FC; // type:object size:0xE data:string
lbl_13_data_20240C = .data:0x0020240C; // type:object size:0x7 data:string
lbl_13_data_202414 = .data:0x00202414; // type:object size:0xD data:string
lbl_13_data_202424 = .data:0x00202424; // type:object size:0xD data:string
lbl_13_data_202434 = .data:0x00202434; // type:object size:0xC data:string
lbl_13_data_202440 = .data:0x00202440; // type:object size:0xC data:string
lbl_13_data_2023A8 = .data:0x002023A8; // type:object size:0x9 scope:local data:string
lbl_13_data_2023B4 = .data:0x002023B4; // type:object size:0x10 scope:local data:string
lbl_13_data_2023C4 = .data:0x002023C4; // type:object size:0x10 scope:local data:string
lbl_13_data_2023D4 = .data:0x002023D4; // type:object size:0xD scope:local data:string
lbl_13_data_2023E4 = .data:0x002023E4; // type:object size:0xD scope:local data:string
lbl_13_data_2023F4 = .data:0x002023F4; // type:object size:0x7 scope:local data:string
lbl_13_data_2023FC = .data:0x002023FC; // type:object size:0xE scope:local data:string
lbl_13_data_20240C = .data:0x0020240C; // type:object size:0x7 scope:local data:string
lbl_13_data_202414 = .data:0x00202414; // type:object size:0xD scope:local data:string
lbl_13_data_202424 = .data:0x00202424; // type:object size:0xD scope:local data:string
lbl_13_data_202434 = .data:0x00202434; // type:object size:0xC scope:local data:string
lbl_13_data_202440 = .data:0x00202440; // type:object size:0xC scope:local data:string
lbl_13_data_20244C = .data:0x0020244C; // type:object size:0x24
lbl_13_data_202470 = .data:0x00202470; // type:object size:0x8
lbl_13_data_202478 = .data:0x00202478; // type:object size:0x1E0
Expand Down Expand Up @@ -18361,7 +18361,7 @@ lbl_13_bss_68 = .bss:0x00000068; // type:object size:0x4 data:4byte
lbl_13_bss_6C = .bss:0x0000006C; // type:object size:0x4 data:4byte
lbl_13_bss_70 = .bss:0x00000070; // type:object size:0x8 align:4 data:float
lbl_13_bss_78 = .bss:0x00000078; // type:object size:0x4 data:4byte
lbl_13_bss_7C = .bss:0x0000007C; // type:object size:0x4 data:4byte
current_bg_tp = .bss:0x0000007C; // type:object size:0x4 data:4byte
lbl_13_bss_80 = .bss:0x00000080; // type:object size:0x4 data:4byte
lbl_13_bss_84 = .bss:0x00000084; // type:object size:0x214
lbl_13_bss_298 = .bss:0x00000298; // type:object size:0x8 data:4byte
Expand Down
12 changes: 6 additions & 6 deletions config/GSNE8P/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ fn_80010E38 = .text:0x80010E38; // type:function size:0x44
fn_80010E7C = .text:0x80010E7C; // type:function size:0x34
fn_80010EB0 = .text:0x80010EB0; // type:function size:0xB0
fn_80010F60 = .text:0x80010F60; // type:function size:0xC4
_rename_PlayQueuedAdxFile = .text:0x80011024; // type:function size:0x2C
_rename_PlayOrQueueAdxFile = .text:0x80011050; // type:function size:0x54
BGM_Replay = .text:0x80011024; // type:function size:0x2C
BGM_SetFile = .text:0x80011050; // type:function size:0x54
Jingle_Play = .text:0x800110A4; // type:function size:0x214
fn_800112B8 = .text:0x800112B8; // type:function size:0xA8
fn_80011360 = .text:0x80011360; // type:function size:0x1BC
Expand All @@ -136,7 +136,7 @@ fn_80011E4C = .text:0x80011E4C; // type:function size:0x108
fn_80011F54 = .text:0x80011F54; // type:function size:0x5C
fn_80011FB0 = .text:0x80011FB0; // type:function size:0x124
fn_800120D4 = .text:0x800120D4; // type:function size:0x144
_rename_PlayAdxFile = .text:0x80012218; // type:function size:0x88
BGM_Play = .text:0x80012218; // type:function size:0x88
fn_800122A0 = .text:0x800122A0; // type:function size:0xAC
fn_8001234C = .text:0x8001234C; // type:function size:0xAC
fn_800123F8 = .text:0x800123F8; // type:function size:0xD4
Expand Down Expand Up @@ -247,8 +247,8 @@ fn_80019D78 = .text:0x80019D78; // type:function size:0xA0
fn_80019E18 = .text:0x80019E18; // type:function size:0x2C
fn_80019E44 = .text:0x80019E44; // type:function size:0x2C
fn_80019E70 = .text:0x80019E70; // type:function size:0x1A4
fn_8001A014 = .text:0x8001A014; // type:function size:0x8
fn_8001A01C = .text:0x8001A01C; // type:function size:0x8
_rename_CurrentSubprogram = .text:0x8001A014; // type:function size:0x8
_rename_LoadSubprogram = .text:0x8001A01C; // type:function size:0x8
fn_8001A024 = .text:0x8001A024; // type:function size:0x64
fn_8001A088 = .text:0x8001A088; // type:function size:0x54
fn_8001A0DC = .text:0x8001A0DC; // type:function size:0x60
Expand Down Expand Up @@ -7147,7 +7147,7 @@ lbl_803AD7F0 = .sbss:0x803AD7F0; // type:object size:0x8 data:4byte
lbl_803AD7F8 = .sbss:0x803AD7F8; // type:object size:0x4 data:4byte
lbl_803AD7FC = .sbss:0x803AD7FC; // type:object size:0x4 data:4byte
lbl_803AD800 = .sbss:0x803AD800; // type:object size:0x4 data:4byte
lbl_803AD804 = .sbss:0x803AD804; // type:object size:0x4 data:4byte
_rename_ActiveSubprg = .sbss:0x803AD804; // type:object size:0x4 data:4byte
lbl_803AD808 = .sbss:0x803AD808; // type:object size:0x4 data:4byte
lbl_803AD80C = .sbss:0x803AD80C; // type:object size:0x4 data:4byte
lbl_803AD810 = .sbss:0x803AD810; // type:object size:0x4
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ def MatchingFor(*versions):
Object(Matching, "stg13_cityescape/o_ce_board.c"),
Object(Matching, "stg13_cityescape/o_ce_board_col.c"),
Object(NonMatching, "stg13_cityescape/o_ce_sobj.c"),
Object(NonMatching, "stg13_cityescape/cityescape.c"),
CHAOPIPE_C,
SPRING_C,
RING_C,
Expand Down
16 changes: 10 additions & 6 deletions include/samt/sonic/file_ctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ enum
*/
typedef struct
{
void(__cdecl* subprgprolog)(void); /* sub-program init function */
void(__cdecl* subprgepilog)(void); /* sub-program exit function */
void(__cdecl* subprgmanager)(task*); /* sub-program task exec function */
void (*subprgprolog)(void); /* sub-program init function */
void (*subprgepilog)(void); /* sub-program exit function */
void (*subprgmanager)(task*); /* sub-program task exec function */
}
SUBPRG_EXEC;

typedef struct
{
void(__cdecl* subprgprolog)(void); /* sub-program init function */
void(__cdecl* subprgepilog)(void); /* sub-program exit function */
s32 (__cdecl* subprgmanager)(void); /* sub-program game control function */
void (*subprgprolog)(void); /* sub-program init function */
void (*subprgepilog)(void); /* sub-program exit function */
s32 (*subprgmanager)(void); /* sub-program game control function */
}
SUBPRG_CTRL;

Expand Down Expand Up @@ -88,6 +88,10 @@ SUBPRG_HEADER;
*/
void FreeFile( void* file );

// sa2b time woohoo
void _rename_LoadSubprogram(SUBPRG_HEADER* header);
SUBPRG_HEADER* _rename_CurrentSubprogram(void);

EXTERN_END

#endif/*H_SA2B_FILECTL*/
3 changes: 2 additions & 1 deletion include/samt/sonic/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,8 @@ extern void SetVelocityYAndRotationAndNoconTimeP(Uint8 pno, Float y, Sint32 *ang
extern Sint32 GetPlayerRunningSpeed(Sint8 pno, Float *v);

typedef struct {
u8 pad[0x1e];
s8 unk_0x0;
u8 pad[0x1d];
/* 0x1e */ s8 TWO_PLAYER;
artificial_padding(0x1e, 0xf0, s8);
} lbl_801CC168_t;
Expand Down
157 changes: 157 additions & 0 deletions src/stg13_cityescape/cityescape.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
#include "sa2b_types.h"
#include "samt/sonic/adx.h"
#include "samt/sonic/file_ctl.h"
#include "samt/sonic/light.h"
#include "samt/sonic/player.h"
#include "samt/sonic/task.h"
#include "set.h"
extern void fn_80011A04(u32);
extern void fn_80011DF4(void);
extern s32 fn_8001CD40(void);
extern void fn_8002506C(u32, float *);
extern void fn_8003D7D4(mtnwk *mp);
extern void fn_8005523C(taskwk *tp, motionwk *mp, playerwk *pwp);
extern void fn_8005D0EC(void *);

typedef struct unk_struct { // i have no clue
s16 idx, unk_0x2;
void *unk_0x4;
} unk_struct_t;

extern unk_struct_t lbl_801E5D28[];
extern void *lbl_13_data_200DF0[];

// ^ extern
// v in this file

void CityEscapeProlog();
void CityEscapeEpilog();
static void CityEscapeExec(task *tp);
static void BgmStart(task *tp);
static void BgExec(task *tp);
static void BgExecDest(task *tp);
static void BgExecDisp(task *tp);
static void BgExecDispSort(task *tp);

float lbl_13_data_202228[16] = {0.3f, 0.1f, 1.0f, 1.0f, 0.45f, 1.0f,
1.0f, 1.0f, 0.3f, 0.1f, 1.0f, 0.5f,
0.43f, 1.0f, 1.0f, 1.0f};
SUBPRG_HEADER _rename_CityEscapeSubprgHeader = {
"STG13 ", 0, {CityEscapeProlog, CityEscapeEpilog, CityEscapeExec}};
unk_struct_t lbl_13_data_1FD2B0[57];
s32 lbl_13_bss_80 = 0;

void fn_13_116C4(void) {
unk_struct_t *s, *table = lbl_13_data_1FD2B0, *entry;
for (s = table;; s++) {
if (s->idx == -1)
break; // this feels fake as hell but i have zero clue what it could be
if (s->idx < 0 || s->idx >= 300)
continue;
entry = &lbl_801E5D28[s->idx];
if (entry->unk_0x4 == NULL) {
void *ptr = s->unk_0x4;
entry->unk_0x2 = s->unk_0x2;
lbl_801E5D28[s->idx].unk_0x4 = ptr;
}
}
}

void fn_13_11738(void) {
unk_struct_t *s, *table = lbl_13_data_1FD2B0, *entry;
playerwk *pwp = playerpwp[0];
if (pwp) {
fn_8003D7D4(&pwp->m);
playerpwp[pwp->player]->m.flag |= 4;
fn_8005523C(playertwp[0], playermwp[0], pwp);
}
pwp = playerpwp[1];
if (pwp) {
fn_8003D7D4(&pwp->m);
playerpwp[pwp->player]->m.flag |= 4;
fn_8005523C(playertwp[1], playermwp[1], pwp);
}

for (s = table;; s++) {
if (s->idx == -1)
break; // see above comment
if (s->idx < 0 || s->idx >= 300)
continue;
entry = &lbl_801E5D28[s->idx];
if (entry->unk_0x4 == s->unk_0x4) {
lbl_801E5D28[s->idx].unk_0x4 = NULL;
lbl_801E5D28[s->idx].unk_0x2 = 0;
}
}
}

void _prolog() { _rename_LoadSubprogram(&_rename_CityEscapeSubprgHeader); }

void _epilog() {}

void CityEscapeProlog() {
task *bgexec;
if (lbl_801CC168.unk_0x0 == 0 && lbl_801CC168.TWO_PLAYER) {
CreateElementalTask(2, LEV_0, BgmStart, "BgmStart");
}
// +0x274
fn_8002506C(0, &lbl_13_data_202228[0]);
fn_8002506C(1, &lbl_13_data_202228[8]);
fn_8002506C(2, &lbl_13_data_202228[0]);
fn_8002506C(3, &lbl_13_data_202228[0]);
// +0x334
LoadLightFile("stg13_light.bin");
if (lbl_801CC168.unk_0x0 == 0) {
if (!lbl_801CC168.TWO_PLAYER) {
fn_80011A04(0);
BGM_SetFile("c_escap1.adx");
}
} else {
fn_80011A04(0);
BGM_SetFile("t9_sonic.adx"); // this file does not exist
}
fn_8005D0EC(lbl_13_data_200DF0);
bgexec = CreateElementalTask(2, LEV_1, BgExec, "BgExec");
if (bgexec) {
// idk why it's like this and bgexec's ctor doesn't do it
bgexec->disp = BgExecDisp;
bgexec->disp_sort = BgExecDispSort;
bgexec->dest = BgExecDest;
}
}

void CityEscapeEpilog() {}

// TODO this might be a TU split? not sure
void BgmStart(task *tp) {
if (fn_8001CD40() == 7) {
fn_80011DF4();
lbl_13_bss_80 = 0;
} else if (fn_8001CD40() == 16) {
if (playertwp[0]->mode == 54 && playertwp[1]->mode == 54) {
fn_80011DF4();
lbl_13_bss_80 = 0;
} else if (lbl_13_bss_80++ == 9) {
fn_80011A04(0);
BGM_SetFile("c_escap1.adx");
} else if (lbl_13_bss_80 < 9) {
fn_80011DF4();
}
}
}

void CityEscapeExec(task *tp) {}

static task *current_bg_tp = NULL;

static void BgExec(task *tp) {}

static void BgExecDest(task *tp) {
if (current_bg_tp == tp) {
current_bg_tp = NULL;
}
}

static void BgExecDisp(task *tp) {}

static void BgExecDispSort(task *tp) {}
Loading
Loading