Import bss for audio and elsewhere (#416)

This commit is contained in:
MegaMech
2023-09-12 19:43:54 -06:00
committed by GitHub
parent f20221fab6
commit 4ee09e005f
29 changed files with 333 additions and 513 deletions
+87 -22
View File
@@ -9,12 +9,79 @@
#include "audio/data.h"
#include <sounds.h>
#include "port_eu.h"
#include "code_80091750.h"
/** bss
s8 D_8018EF10;
*/
typedef struct {
s32 unk0;
s32 unk4;
s32 unk8;
s32 unkC;
} UnkStruct8018EF18;
UnkStruct8018EF18 D_8018EF18[12]; // probably wrong
struct Unk_8018EFD8 D_8018EFD8[50];
u8 D_8018FB90;
u8 D_8018FB91;
Camera *D_8018FB98[4]; // Is this real?
Vec3f D_8018FBA8[4];
Vec3f D_8018FBD8[4];
u8 D_8018FC08;
s32 D_8018FC10[4]; // probably wrong.
struct Unk_8018FC20 sSoundRequests[0x100];
struct Unk_80191420 sSoundBanks[SOUND_BANK_COUNT][20];
u8 sSoundBankUsedListBack[SOUND_BANK_COUNT];
u8 sSoundBankFreeListFront[SOUND_BANK_COUNT];
extern u8 sNumSoundsInBank[SOUND_BANK_COUNT];
extern u8 sSoundBankDisabled[];
extern u8 D_801930D0[];
extern u8 D_80192C38;
// Warning: D_801930D0 appears to be an array of struct.
// D_80193318 has been treated as a fake pr in the assembly.
// This may not be correct.
/** Could not figure out these structs.
u8 D_80192AB8[384]; // probably wrong.
struct UnkStruct_80192C38 {
u8 unk0;
//u8 unk1[3];
u8 sSoundBankDisabled[16];
};
struct UnkStruct_80192C38 D_80192C38;
//u8 D_80192C38;
//s32 a;
//u8 sSoundBankDisabled[15]; // 0x80192C3C
typedef struct {
f32 unk0;
f32 unk4;
f32 unk8;
f32 unkC;
} UnkStruct_80192C48; // size 0x10
UnkStruct_80192C48 D_80192C48;
typedef struct {
u8 unk0[9];
} UnkStruct_80192CA8; // size 0xA
UnkStruct_80192CA8 D_80192CA8[3];
u8 D_80192CC6[10]; // unconfirmed
u32 D_80192CD0[256];
typedef struct {
u8 unk0[0x24C];
} UnkStruct_801930D0;
UnkStruct_801930D0 D_801930D0[3];
//UnkStruct_801930D0 D_80193318[2]; // Likely fake var. Probably apart of 801930D0.
*/
// Requires void in the argument list to match properly.
void func_800C13F0(void) {
@@ -690,11 +757,11 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C284C.s")
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80193318;
//extern ? D_80193318;
void func_800C29B4(u8 arg0, s32 arg1) {
func_800CBBB8((arg0 << 0x10) | 0x83000000, arg1 & 0xFFFF);
*(&D_80193318 + (arg0 * 0x24C)) = 0xFFFF;
*(&D_801930D0 + (arg0 * 0x24C)) = 0xFFFF;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C29B4.s")
@@ -1080,7 +1147,7 @@ void func_800C3478(void) {
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80193318;
//extern ? D_80193318;
u16 func_800C3508(s32 player) {
s32 temp_t6;
@@ -1090,7 +1157,7 @@ u16 func_800C3508(s32 player) {
if (((u32) gSequencePlayers[temp_t6] >> 0x1F) == 0) {
return 0xFFFFU;
}
return *(&D_80193318 + (temp_t6 * 0x24C));
return *(&D_801930D0 + (temp_t6 * 0x24C));
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3508.s")
@@ -1166,7 +1233,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C36C4.s")
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_801930D0;
//extern ? D_801930D0;
void func_800C3724(void) {
f32 temp_f2;
@@ -1527,7 +1594,7 @@ void func_800C4084(u16 bankMask) {
}
extern u16 D_800EA1C4;
extern u8 D_801930D0[];
//extern u8 D_801930D0[];
void func_800C40F0(u8 arg0) {
D_800EA1C4 &= ((1 << (arg0)) ^ (u16) -1);
@@ -2090,8 +2157,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4888.s")
? func_800C19D0(s32, s32, u8); /* extern */
? func_800C473C(s32, s32); /* extern */
extern ? D_80192AB8;
extern u8 D_80192C38;
extern ? D_801930D0;
//extern ? D_801930D0;
extern ? D_803B17D0;
static ? D_800EA188; /* unable to generate initializer */
u8 D_800EA1C0 = 0;
@@ -2120,27 +2186,28 @@ void func_800C4FE4(s32 arg0) {
temp_s0 = (temp_s3 * 0x3C0) + (temp_s1 * 0x30) + sSoundBanks;
temp_v0 = temp_s0->unk28;
if (temp_v0 == 2) {
temp_s0->unk2C = (u8) D_80192C38;
temp_s0->unk2C = (u8) D_80192C38.unk0;
if (temp_s0->unk24 & 0x80000) {
D_800EA1C4 |= 1 << D_80192C38;
D_800EA1C4 |= 1 << D_80192C38.unk0;
D_801930D0.unk12 = 1;
D_801930D0.unk10 = 0x28;
}
func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38);
func_800CBBE8((D_80192C38 << 8) | 0x06020000, 1);
func_800CBBE8((D_80192C38 << 8) | 0x06020000 | 4, (s8) temp_s0->unk24);
func_800CBBE8((D_80192C38.unk0 << 8) | 0x06020000, 1);
func_800CBBE8((D_80192C38.unk0 << 8) | 0x06020000 | 4, (s8) temp_s0->unk24);
temp_s0->unk28 = 4U;
var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
goto block_11;
}
if ((*(&D_803B17D0 + (D_80192C38 * 4)))->unk5F == 0x80) {
func_800CBBE8(((D_80192C38 & 0xFF) << 8) | 0x06020000 | 7, 0);
// gSequencePlayers + 0x2C0 gSequencePlayers[1].channels
if ((*(&D_803B17D0 + (D_80192C38.unk0 * 4)))->unk5F == 0x80) {
func_800CBBE8(((D_80192C38.unk0 & 0xFF) << 8) | 0x06020000 | 7, 0);
func_800C473C(temp_s3 & 0xFF, temp_s1 & 0xFF);
var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
goto block_11;
}
if (temp_v0 == 3) {
func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38);
func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38.unk0);
temp_s0->unk28 = 4U;
var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
block_11:
@@ -2150,7 +2217,7 @@ block_11:
temp_t7 = (var_s4 + 1) & 0xFF;
temp_at = temp_t7 < (s32) var_v1;
var_s4 = temp_t7;
D_80192C38 += 1;
D_80192C38.unk0 += 1;
} while (temp_at != 0);
}
}
@@ -2395,14 +2462,13 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5968.s")
#endif
extern s8 D_80192C38;
extern s32 D_803B17D0;
void func_800C59C4(void) {
u8 i;
if (D_803B17D0 != (u32) &gSequenceChannelNone) {
if (gSequencePlayers[2].channels[0] != &gSequenceChannelNone) {
D_80192C38 = 0;
for(i = 0; i < 6; i++) {
func_800C4888(i);
@@ -3070,7 +3136,6 @@ void func_800C70A8(u8 playerId) {
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-09-2023
extern s8 D_801657E5;
extern u8 D_8018ED90;
s32 D_800E9E74[4] = { 0, 0, 0, 0 };
static ? D_800E9E94; /* unable to generate initializer */
static s32 D_800E9EA4[4] = { 0, 0, 0, 0 };
@@ -4105,7 +4170,6 @@ void func_800CA59C(u8 playerId) {
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-09-2023
s32 func_800C357C(?); /* extern */
? func_800C3608(?, ?, u8); /* extern */
extern u32 D_803B1658;
struct Unk_800E9F7C D_800E9F7C[4]; /* unable to generate initializer */
u8 D_800EA0EC[1] = { 0 };
u8 D_800EA104 = 0;
@@ -4139,6 +4203,7 @@ void func_800CA730(u8 playerId) {
func_800C9018(playerId & 0xFF, 0x0100FF2C);
} else if ((D_800EA10C->unk0 == 0) && (D_800EA10C->unk1 == 0)) {
if (D_8018FC08 != 0) {
// gSequencePlayers+0x148
if (((u32) D_803B1658 >> 0x1F) == 0) {
func_800C3608(1, 5, playerId);
func_800C8EAC(D_800EA15C);