Split out some unused asm and documented main.c (#242)

* Splitting out unused asm

* Documented main.c
This commit is contained in:
MegaMech
2022-07-11 01:02:41 -06:00
committed by GitHub
parent a8e984d2fd
commit fd7941e841
101 changed files with 4287 additions and 4260 deletions
+55 -13
View File
@@ -1783,6 +1783,32 @@ void func_800C400C(void) {
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C400C.s")
#endif
#ifdef MIPS_TO_C
UNUSED void func_800C4084(s32 arg0) {
s32 temp_at;
s32 temp_t1;
s32 var_a0;
s32 var_v0;
unksp-10.unk10 = arg0;
var_a0 = arg0 & 0xFFFF;
var_v0 = 0;
do {
if ((var_a0 & 1) != 0) {
*(&D_80192C3C + var_v0) = 1;
} else {
*(&D_80192C3C + var_v0) = 0;
}
temp_t1 = (var_v0 + 1) & 0xFF;
temp_at = temp_t1 < 6;
var_v0 = temp_t1;
var_a0 = (var_a0 >> 1) & 0xFFFF;
} while (temp_at != 0);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4084.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern u16 D_800EA1C4;
@@ -2730,6 +2756,20 @@ void func_800C5384(s32 arg0, s32 arg1) {
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5384.s")
#endif
#ifdef MIPS_TO_C
UNUSED void func_800C54B8(u8 arg0, s32 arg1) {
s32 sp54;
s32 sp30;
func_800C5384(arg0);
sp54 = arg0 << 0x1C;
sp30 = arg1;
func_800C41CC(1, &sp30);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C54B8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800C41CC(?, s32 *); // extern
@@ -3115,16 +3155,17 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5C40.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800C2474(); // extern
? func_800C284C(?, ?, ?, ?); // extern
? func_800C3F70(); // extern
? func_800C5A3C(); // extern
void func_800C2474(); // extern
void func_800C284C(u8, u8, u8, s32); // extern
void func_800C3F70(); // extern
void func_800C5A3C(); // extern
// game_audio_init?
void func_800C5CB8(void) {
func_800C2474();
func_800C3F70();
func_800C5A3C();
func_800C284C(2, 0, 0xFF, 1);
func_800C284C(2, 0, 255, 1);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5CB8.s")
@@ -6328,15 +6369,16 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800CB14C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800C1F8C(); // extern
? func_800C2274(?); // extern
? func_800C3478(); // extern
? func_800C3724(); // extern
? func_800C5848(); // extern
? func_800C59C4(); // extern
? func_800C8CCC(); // extern
? func_800CBC24(); // extern
//? func_800C1F8C(); // extern
//? func_800C2274(?); // extern
//? func_800C3478(); // extern
//? func_800C3724(); // extern
//? func_800C5848(); // extern
//? func_800C59C4(); // extern
//? func_800C8CCC(); // extern
//? func_800CBC24(); // extern
// run audio?
void func_800CB2C4(void) {
func_800C1F8C();
func_800C3724();
+59
View File
@@ -202,6 +202,17 @@ void func_800B90B0(void *arg0) {
#else
GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B90B0.s")
#endif
struct struct_800B90E0 {
s32 unk0;
s32 unk4;
s32 unk8;
s32 unkC;
};
UNUSED void func_800B90E0(struct struct_800B90E0 *arg0) {
arg0->unkC = 0;
arg0->unk4 = arg0->unk0;
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
@@ -825,6 +836,54 @@ block_17:
GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B9AD8.s")
#endif
#ifdef MIPS_TO_C
UNUSED void func_800B9BE4(f32 arg0, f32 arg1, void *arg2) {
? sp4C;
f32 sp30;
f32 sp2C;
? sp14;
f32 sp10;
f32 spC;
? *var_a0;
f32 *var_a0_2;
f32 temp_f0;
f32 temp_f10;
f32 temp_f6;
f32 temp_f8;
s16 *var_v1;
void *var_v1_2;
temp_f0 = D_800F2E80;
var_a0 = &sp14;
var_v1 = arg2 + 4;
spC = arg1 * temp_f0;
sp2C = arg0 * temp_f0;
sp10 = arg1 * arg0 * temp_f0;
sp30 = ((arg0 * arg0) + arg1) * temp_f0;
do {
*var_v1 = (s16) (u32) ((var_a0->unk-4 * arg0) + (arg1 * var_a0->unk-8));
temp_f8 = var_a0->unk18;
temp_f10 = var_a0->unk1C * arg0;
var_a0 += 4;
var_v1 += 2;
var_v1->unkE = (s16) (u32) (temp_f10 + (arg1 * temp_f8));
} while ((u32) var_a0 < (u32) &sp2C);
var_v1_2 = arg2;
var_a0_2 = &spC;
do {
var_v1_2->unk0 = (s16) (u32) var_a0_2->unk0;
var_v1_2->unk2 = (s16) (u32) var_a0_2->unk4;
var_v1_2->unk4 = (s16) (u32) var_a0_2->unk8;
temp_f6 = var_a0_2->unkC;
var_a0_2 += 0x10;
var_v1_2->unk6 = (s16) (u32) temp_f6;
var_v1_2 += 8;
} while (var_a0_2 != &sp4C);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B9BE4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern ? D_803AF790;
+153 -6
View File
@@ -1150,14 +1150,161 @@ block_16:
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBF44.s")
#endif
// L800BC170 is in a delay slot
// m2c may be inaccurate.
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
/*
Failed to decompile function audio_init:
void audio_init(void) {
s32 sp8C;
s32 sp60;
s32 **sp3C;
? *var_v0;
? *var_v0_2;
? *var_v0_3;
s16 temp_s3;
s16 temp_t1;
s32 **var_a2;
s32 *temp_v0_2;
s32 *temp_v0_3;
s32 *temp_v0_4;
s32 *temp_v0_5;
s32 temp_a1;
s32 temp_a1_2;
s32 temp_a1_3;
s32 temp_s0;
s32 temp_s0_2;
s32 temp_t7;
s32 temp_v0;
s32 var_s0_2;
s32 var_s1;
s32 var_v1;
s32 var_v1_2;
u32 var_s0;
void *temp_t3;
void *temp_t7_2;
Last instruction is missing a delay slot:
jr $ra
*/
D_800EA5DC = 0;
temp_t7 = (s32) D_800EA5D0 / 8;
if (temp_t7 > 0) {
var_v0 = &D_803B71B0;
do {
var_v0 += 8;
var_v0->unk-4 = 0;
var_v0->unk-8 = 0;
} while ((u32) var_v0 < (u32) ((temp_t7 * 8) + &D_803B71B0));
}
var_v0_2 = &gGfxSPTaskOutputBufferSize;
var_s0 = (u32) (&D_803B71A0 - &gGfxSPTaskOutputBufferSize) >> 3;
if ((s32) var_s0 >= 0) {
do {
var_s0 -= 1;
var_v0_2->unk4 = 0;
var_v0_2->unk0 = 0;
var_v0_2 += 8;
} while ((s32) var_s0 >= 0);
}
temp_v0 = osTvType;
switch (temp_v0) { /* irregular */
case 0:
D_803B7178 = D_800F2EA0;
D_803B717C = 0x32;
break;
case 2:
D_803B7178 = D_800F2EA4;
D_803B717C = 0x3C;
break;
default:
case 1:
D_803B7178 = D_800F2EA8;
D_803B717C = 0x3C;
break;
}
func_800CBF48(&gGfxSPTaskOutputBufferSize);
var_v0_3 = &D_803B718C;
do {
var_v0_3 += 2;
var_v0_3->unk-2 = 0xA0;
} while ((u32) var_v0_3 < (u32) &D_803B7192);
D_803B70B8 = 0;
D_803B70C0 = 0;
D_803B70C4 = 0;
D_803B70B6 = 0;
D_803B70D4 = 0;
D_803B70D8.unk34 = 0;
D_803B70D8.unk84 = 0;
osCreateMesgQueue(&D_803B6720, &D_803B6738, 1);
osCreateMesgQueue(&gCurrAudioFrameDmaQueue, &gCurrAudioFrameDmaMesgBufs, 0x40);
gCurrAudioFrameDmaCount = 0;
gSampleDmaNumListItems = 0;
func_800B90F0(D_800EA5D4);
var_a2 = &D_803B7180;
do {
sp3C = var_a2;
var_v1 = 0;
*var_a2 = soundAlloc(&D_803AFBD8, 0xA00, var_a2);
loop_16:
*(*var_a2 + var_v1) = 0;
(*var_a2 + var_v1)->unk2 = 0;
(*var_a2 + var_v1)->unk4 = 0;
temp_t7_2 = *var_a2 + var_v1;
var_v1 += 8;
temp_t7_2->unk6 = 0;
if (var_v1 != 0xA00) {
goto loop_16;
}
var_a2 += 4;
} while ((u32) var_a2 < (u32) &D_803B718C);
D_803B0501 = 0;
D_803B0500 = 1;
func_800BA00C();
D_803B706C = &sp60;
audio_dma_copy_immediate(&_sequencesSegmentRomStart, &sp60, 0x10);
temp_t1 = D_803B706C->unk2;
temp_a1 = (((temp_t1 & 0xFFFF) * 8) + 0x13) & ~0xF;
D_803B707C = temp_t1;
temp_v0_2 = soundAlloc(&D_803AFBD8, temp_a1);
D_803B706C = temp_v0_2;
audio_dma_copy_immediate(&_sequencesSegmentRomStart, temp_v0_2, temp_a1);
func_800BB43C(D_803B706C, &_sequencesSegmentRomStart);
D_803B7070 = &sp60;
audio_dma_copy_immediate(&_audio_banksSegmentRomStart, &sp60, 0x10);
temp_s3 = D_803B7070->unk2;
temp_a1_2 = ((temp_s3 * 8) + 0x13) & ~0xF;
temp_s0 = temp_a1_2;
temp_v0_3 = soundAlloc(&D_803AFBD8, temp_a1_2);
D_803B7070 = temp_v0_3;
audio_dma_copy_immediate(&_audio_banksSegmentRomStart, temp_v0_3, temp_s0);
func_800BB43C(D_803B7070, &_audio_banksSegmentRomStart);
D_803B7080 = soundAlloc(&D_803AFBD8, temp_s3 * 0xC);
var_v1_2 = 0;
if (temp_s3 > 0) {
var_s1 = 0;
var_s0_2 = 0;
do {
sp8C = var_v1_2;
audio_dma_copy_immediate((D_803B7070 + var_s1)->unk4, &sp60, 0x10, &D_803B7080);
(D_803B7080 + var_s0_2)->unk1 = (s8) sp60;
var_v1_2 = sp8C + 1;
temp_t3 = D_803B7080 + var_s0_2;
var_s0_2 += 0xC;
var_s1 += 8;
temp_t3->unk2 = (s8) sp64;
} while (var_v1_2 != temp_s3);
}
D_803B7074 = &sp60;
audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, &sp60, 0x10, &D_803B7080);
temp_a1_3 = ((D_803B7074->unk2 * 8) + 0x13) & ~0xF;
temp_s0_2 = temp_a1_3;
temp_v0_4 = soundAlloc(&D_803AFBD8, temp_a1_3);
D_803B7074 = temp_v0_4;
audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, temp_v0_4, temp_s0_2);
func_800BB43C(D_803B7074, &_audio_tablesSegmentRomStart);
temp_v0_5 = soundAlloc(&D_803AFBD8, 0x100);
D_803B7078 = temp_v0_5;
audio_dma_copy_immediate(&_instrument_setsSegmentRomStart, temp_v0_5, 0x100);
func_800B907C(&D_803B01B8, soundAlloc(&D_803AFBD8, D_800EA5D8), D_800EA5D8);
func_800C125C();
D_800EA5DC = 0x76557364;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/audio_init.s")
#endif