papermario/src/code_303c0_len_3e10.c

462 lines
9.1 KiB
C
Raw Normal View History

2020-08-04 08:49:11 +02:00
#include "common.h"
2020-12-02 00:23:26 +01:00
#include "audio.h"
2020-12-12 10:07:53 +01:00
s32 D_80078DB0 = 0;
2020-12-12 09:12:45 +01:00
u16 D_80078DB4 = 0;
u16 D_80078DB6 = 0;
2020-12-12 10:07:53 +01:00
// chunks of data, not sure what
2020-12-12 09:12:45 +01:00
s32 D_80078DB8[] = { 0x025E0350, 0x04640554, 0x00000000, };
s32 D_80078DC4[] = { 0x0264036E, 0x045A0000, };
s32 D_80078DCC[] = { 0x025F0000, };
s32 D_80078DD0[] = { 0x0546065A, 0x075A0864, 0x00000000, };
s32 D_80078DDC[] = { 0x05000600, 0x07000800, 0x09000A00, 0x0B000C00, 0x0D000E00, 0x0F001000, 0x00000000, };
s32 D_80078DF8[] = { 0x05640666, 0x0758086E, 0x09000A00, 0x0B000C00, 0x0D000E00, 0x0F001000, 0x00000000, };
s32 D_80078E14[] = { 0x05640666, 0x0758086E, 0x097E0A58, 0x0B640C00, 0x0D000E00, 0x0F001000, 0x00000000, };
s32 D_80078E30[] = { 0x05640666, 0x0758086E, 0x097E0A58, 0x0B640C64, 0x0D6A0E64, 0x0F64106E, 0x00000000, 0x00000000, };
2020-10-29 01:29:30 +01:00
2020-12-02 01:13:24 +01:00
INCLUDE_ASM(void, "code_303c0_len_3e10", al_LoadBKHeaders, UnkAl19E0* arg0, ALHeap* arg1);
2020-10-29 01:29:30 +01:00
void func_80055050(void) {
D_80078DB4 = 1;
D_80078DB0 = 0;
}
2020-08-04 08:49:11 +02:00
INCLUDE_ASM(void, "code_303c0_len_3e10", func_80055068, u32 arg0);
2020-09-24 05:16:13 +02:00
2020-12-12 09:55:21 +01:00
void func_80055110(UnkAlA9C* arg0) {
2020-12-08 22:00:51 +01:00
s32 i;
for (i = 0; i < 8; i++) {
arg0->unk_238[i] = 0;
}
arg0->unk_25B = 0;
arg0->unk_25A = 0;
arg0->unk_259 = 0;
arg0->unk_258 = 0;
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_8005513C);
2020-09-24 05:16:13 +02:00
2020-12-12 09:21:27 +01:00
void func_800551E0(s32 arg0, u8 arg1, s8 arg2) {
UnkAl6CC* sym = D_8009A640;
s16 a1temp = arg1 * 256;
if (a1temp != 0) {
a1temp |= 0xFF;
}
if (arg2 < 0) {
arg2 = 0x7F;
}
func_8004B6D8(sym, arg0, a1temp, 0, arg2);
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:12:45 +01:00
void func_80055240(s32 arg0, u8 arg1, s8 arg2, s16 arg3) {
UnkAl6CC* sym = D_8009A640;
s16 a1temp = arg1 * 256;
if (a1temp != 0) {
a1temp |= 0xFF;
}
if (arg2 < 0) {
arg2 = 0x7F;
}
if (arg3 > 0x960) {
arg3 = 0x960;
} else if (arg3 < -0x960) {
arg3 = -0x960;
}
func_8004B6D8(sym, arg0, a1temp, arg3, arg2);
}
void func_800552D0(s32 arg0, u8 arg1, s8 arg2) {
UnkAl6CC* sym = D_8009A640;
s16 a1temp = arg1 * 256;
if (a1temp != 0) {
a1temp |= 0xFF;
}
if (arg2 < 0) {
arg2 = 0x7F;
}
2020-08-04 08:49:11 +02:00
2020-12-12 09:12:45 +01:00
func_8004B6D8(sym, arg0 | 0x1000, a1temp, 0, arg2);
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:21:27 +01:00
void func_80055330(s32 arg0, u8 arg1, s8 arg2, s16 arg3) {
UnkAl6CC* sym = D_8009A640;
s16 a1temp = arg1 * 256;
if (a1temp != 0) {
a1temp |= 0xFF;
}
if (arg2 < 0) {
arg2 = 0x7F;
}
if (arg3 > 0x960) {
arg3 = 0x960;
} else if (arg3 < -0x960) {
arg3 = -0x960;
}
func_8004B6D8(sym, arg0 | 0x1000, a1temp, arg3, arg2);
}
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
void func_800553C0(s32 arg0) {
func_8004B6D8(D_8009A640, arg0 | 0x8000, 0, 0, 0);
}
2020-08-04 08:49:11 +02:00
2020-12-02 01:13:24 +01:00
void func_800553F4(void) {
D_8009A640->unk_168 = 1;
}
2020-09-24 05:16:13 +02:00
2020-12-02 05:50:32 +01:00
void func_80055408(s32 arg0, s16 arg1, s16 arg2, s32 arg3) {
func_8004B6D8(D_8009A640, arg0, arg1, arg2, arg3);
}
s32 func_80055448(s32 arg0) {
return func_80053F80(arg0);
}
s32 func_80055464(s32 arg0, s32 arg1) {
if (func_80050C30(arg0) == 0) {
func_80050CA0(arg0, arg1);
}
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:12:45 +01:00
s32 func_800554A4(s32 arg0) {
2020-12-02 05:50:32 +01:00
s32 ret = func_80050C30(arg0);
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
if (ret == 0) {
func_80050EF0(arg0);
}
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
return ret;
}
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
s32 func_800554E8(s32 arg0, s32 arg1) {
s32 ret = func_80050C30(arg0);
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
if (ret == 0) {
func_80050F64(arg0, arg1);
}
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
return ret;
}
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
s32 func_8005553C(s32 arg0, s32 arg1) {
s32 ret = func_80050C30(arg0);
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
if (ret == 0) {
func_80050E18(arg0, arg1);
}
return ret;
}
2020-09-24 05:16:13 +02:00
2020-12-02 05:50:32 +01:00
s32 func_80055590(s32 arg0, s32 arg1) {
s32 ret = func_80050C30(arg0);
if (ret == 0) {
func_80050E84(arg0, arg1);
}
return ret;
}
void func_800555E4(s32 arg0) {
if (func_80050C30(arg0) == 0) {
func_80051050(arg0);
}
}
s32 func_80055618(s32 arg0, s32 arg1) {
s32 ret = func_80050C30(arg0);
if (ret == 0) {
func_80050C54(arg0, arg1);
}
return ret;
}
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
s32 func_8005566C(s32 arg0, s32 arg1, s32 arg2) {
s32 ret = func_80050C30(arg0);
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
if (ret == 0) {
func_80050FD0(arg0, arg1, arg2);
}
return ret;
}
s32 func_800556D0(s32 arg0) {
s32 ret = func_80050C30(arg0);
if (ret == 0) {
func_80050C64(arg0, 1);
}
return ret;
}
s32 func_80055718(s32 arg0) {
s32 ret = func_80050C30(arg0);
if (ret == 0) {
func_80050C64(arg0, 0);
}
return ret;
}
void func_80055760(s32 arg0) {
u32 i;
s32 lim = 4;
D_80078DB6 = 0xFF;
for (i = 0; i < lim; i++) {
if (func_80055464(i, 0) != 0) {
return;
}
}
func_80055848(arg0);
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:12:45 +01:00
s32 func_800557CC(s32 arg0) {
u32 i;
s32 lim = 4;
s32 phi_v1;
for (i = 0; i < lim; i++) {
if (i == D_80078DB6) {
phi_v1 = func_800554E8(i, arg0);
} else {
phi_v1 = func_800554A4(i);
}
if (phi_v1 != 0) {
break;
}
}
return phi_v1;
}
s32 func_80055848(s32 arg0) {
s32 lim = 4;
s32 phi_v1 = 0;
if (arg0 != D_80078DB6) {
u32 i;
for (i = 0; i < lim; i++) {
if (i == arg0) {
phi_v1 = func_80055718(arg0);
} else {
phi_v1 = func_800556D0(i);
}
if (phi_v1 != 0) {
break;
}
}
if (phi_v1 == 0) {
D_80078DB6 = arg0;
}
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:12:45 +01:00
return phi_v1;
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_800558D4);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_8005591C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055970);
2020-08-04 08:49:11 +02:00
2020-10-29 22:35:59 +01:00
s32 func_800559C4(UNK_TYPE arg0) {
return func_8004DA0C(arg0);
}
2020-08-04 08:49:11 +02:00
2020-12-02 05:50:32 +01:00
void func_800559E0(void) {
func_8004DA74();
}
2020-09-24 05:16:13 +02:00
2020-12-02 05:50:32 +01:00
void func_800559FC(void) {
func_8004DAE0();
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055A18);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055A6C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055ABC);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055AF0);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055B28);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055B80);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055BB8);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055BF0);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055C2C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055C64);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055C94);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055CC4);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055CE8);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055D38);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055D8C);
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055DDC);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055E48);
2020-08-04 08:49:11 +02:00
2020-12-12 09:12:45 +01:00
// needs rodata
#ifdef NON_MATCHING
s32* func_80055EB4(s32 arg0) {
s32* ret = NULL;
2020-12-12 09:55:21 +01:00
switch (arg0) {
2020-12-12 09:12:45 +01:00
case 0:
ret = &D_80078DB8;
break;
case 1:
ret = &D_80078DC4;
break;
case 2:
ret = &D_80078DCC;
break;
case 3:
ret = &D_80078DD0;
break;
case 4:
ret = &D_80078DDC;
break;
case 5:
ret = &D_80078DF8;
break;
case 6:
ret = &D_80078E14;
break;
case 7:
ret = &D_80078E30;
break;
}
return ret;
}
#else
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055EB4);
2020-12-12 09:12:45 +01:00
#endif
2020-08-04 08:49:11 +02:00
2020-12-12 09:55:21 +01:00
s32 func_80055F58(s32 arg0, u32 arg1, u32 arg2) {
s32* subroutine_arg4;
s32* subroutine_arg5;
s32 temp_s2 = func_80055CE8(arg0, &subroutine_arg4, &subroutine_arg5);
2020-08-04 08:49:11 +02:00
2020-12-12 09:55:21 +01:00
if (temp_s2 == 0) {
if (arg2 > 0x7F) {
arg2 = 0x7F;
}
if (arg1 > 0xF) {
arg1 = 0xF;
}
func_8005083C(subroutine_arg5, arg1, 0x60, (u8)arg2); // todo remove cast when func is defined
}
return temp_s2;
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:55:21 +01:00
s32 func_80055FD4(s32 arg0, s32 arg1) {
return func_80055F58(arg0, arg1, 0);
}
s32 func_80055FF0(s32 arg0, s32 arg1) {
return func_80055F58(arg0, arg1, 0x3F);
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:55:21 +01:00
s32 func_8005600C(s32 arg0, s32 arg1) {
return func_80055F58(arg0, arg1, 0x7F);
}
2020-09-24 05:16:13 +02:00
2020-12-12 09:55:21 +01:00
s32 func_80056028(s32 arg0, u8 arg1) {
return func_800506C8(arg0, arg1);
2020-12-12 09:34:56 +01:00
}
2020-08-04 08:49:11 +02:00
2020-12-12 09:55:21 +01:00
s32 func_80056044(s32 arg0, u8 arg1) {
return func_800506C8(arg0, arg1 | 0x57000000);
2020-12-12 09:34:56 +01:00
}
2020-08-04 08:49:11 +02:00
2020-12-12 09:55:21 +01:00
s32 func_80056068(s32 arg0, u8 arg1) {
return func_800506C8(arg0, arg1 | 0x7F000000);
2020-12-12 09:34:56 +01:00
}
2020-08-04 08:49:11 +02:00
2020-12-12 09:55:21 +01:00
void func_8005608C(s32* arg0, s32* arg1) {
UnkAl19E0* temp_v0 = D_8009A5C0;
2020-12-12 09:34:56 +01:00
*arg0 = temp_v0->unk_94;
*arg1 = temp_v0->unk_98;
}
2020-08-04 08:49:11 +02:00
2020-12-02 01:13:24 +01:00
void func_800560A8(void) {
D_8009A5C0->unk_9C = 1;
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_800560BC);
2020-08-04 08:49:11 +02:00
2020-12-01 05:45:05 +01:00
INCLUDE_ASM(void, "code_303c0_len_3e10", func_8005610C, void);
2020-08-04 08:49:11 +02:00
2020-12-12 09:21:27 +01:00
void func_80056144(UnkFuncAl arg0, s32 arg1) {
D_8009A5C0->unk_A4[arg1] = arg0;
}
2020-09-24 05:16:13 +02:00
2020-12-02 01:13:24 +01:00
void func_8005615C(void) {
func_80056D5C(1);
func_80054DA8(0);
}
2020-12-02 00:23:26 +01:00
2020-12-02 01:13:24 +01:00
void func_80056180(void) {
func_80056D5C(0);
func_80054DA8(1);
2020-12-02 00:23:26 +01:00
}
2020-08-04 08:49:11 +02:00
2020-12-02 01:13:24 +01:00
void func_800561A4(s32 arg0) {
func_80054CE0(1, arg0);
}
2020-08-04 08:49:11 +02:00
2020-12-02 01:13:24 +01:00
void func_800561C4(s32 arg0) {
func_80054CE0(16, arg0);
}
2020-08-04 08:49:11 +02:00
2020-12-02 01:13:24 +01:00
void func_800561E4(s32 arg0) {
func_80054D74(16, arg0);
}
2020-08-04 08:49:11 +02:00
2020-12-02 01:13:24 +01:00
void func_80056204(void) {
func_8004BA54(D_8009A640, 0);
}
2020-08-04 08:49:11 +02:00
2020-12-02 01:13:24 +01:00
void func_80056228(void) {
func_8004BA54(D_8009A640, 1);
}