Merge pull request #508 from Bl00D4NGEL/match/debug_render_audio_effects

match: debug_render_audio_effects
This commit is contained in:
David Benepe
2025-04-12 18:08:45 -04:00
committed by GitHub
9 changed files with 143 additions and 70 deletions
+5 -5
View File
@@ -7,7 +7,7 @@ All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fd
<!-- README_SCORE_SUMMARY_BEGIN -->
As of April 11, 2025, this is our current score:
&emsp;&emsp;&emsp;&emsp;Decomp progress: 78.84%
&emsp;&emsp;&emsp;&emsp;Decomp progress: 78.88%
&emsp;&emsp;&emsp;&emsp;Documentation progress: 49.86%
<!-- README_SCORE_SUMMARY_END -->
@@ -121,11 +121,11 @@ As of April 11, 2025, this is our current score:
```
===================================================================
ADVENTURE ONE (ASM -> C Decompilation)
-------------- 78.84% Complete (81.41% NON_MATCHING) --------------
# Decompiled functions: 1849
# GLOBAL_ASM remaining: 102
-------------- 78.88% Complete (81.45% NON_MATCHING) --------------
# Decompiled functions: 1850
# GLOBAL_ASM remaining: 101
# NON_MATCHING functions: 12
# NON_EQUIVALENT WIP functions: 31
# NON_EQUIVALENT WIP functions: 30
--------------------------- Game Status ---------------------------
Balloons: 38/47, Keys: 4/4, Trophies: 3/5
T.T. Amulets: 4/4, Wizpig Amulets: 3/4
+2 -1
View File
@@ -8,6 +8,7 @@
#include "level_object_entries.h"
#include "object_properties.h"
#include "gbi.h"
#include "PR/libaudio.h"
// Stolen from PD
// This hacky structure allows coords to be accessed using
@@ -98,7 +99,7 @@ typedef struct SoundMask {
/* 0x11 */ u8 unk11;
/* 0x12 */ u8 unk12;
/* 0x14 */ s32 distance;
/* 0x18 */ s32 unk18;
/* 0x18 */ ALSoundState *soundPtr;
/* 0x1C */ struct SoundMask **soundMask;
/* 0x20 */ u8 unk20;
/* 0x21 */ u8 unk21;
+129 -58
View File
@@ -57,10 +57,10 @@ void audioline_init(void) {
gSoundMaskHeapUsed = mempool_alloc_safe(sizeof(uintptr_t) * SOUND_MASK_HEAP_COUNT, COLOUR_TAG_CYAN);
gUsedMasks = 0;
for (i = 0; i < ARRAY_COUNT(D_80119C58); i++) {
D_80119C58[i].unk178 = NULL;
D_80119C58[i].soundPtr = NULL;
}
for (i = 0; i < SOUND_MASK_HEAP_COUNT; i++) {
gSoundMaskHeap[i].unk18 = 0;
gSoundMaskHeap[i].soundPtr = NULL;
}
func_80008174();
}
@@ -83,57 +83,123 @@ void audioline_on(void) {
}
#ifdef NON_EQUIVALENT
// extern f32 D_80119C60[672];
// extern f32 D_8011A6E0[7][48];
extern unk8011A6D8 **D_8011A6DC;
extern unk80119C58 **D_80119C5C;
// extern void sound_stop(u8 *arg0);
s16 D_8011AC20[128];
// audioline_reset
void func_80008174(void) {
s32 i;
s32 j;
u8 *sound;
ALSoundState *sound;
SoundMask *heap;
// unk8011A6D8 *var_a1;
// unk8011A6D8 *var_a2;
// unk8011A6E0 *var_a3;
// unk80119C58 *var_s1;
// u32 target;
// f32 *var_v0;
for (gFreeMasks = 0; gFreeMasks < SOUND_MASK_HEAP_COUNT; gFreeMasks++) {
gSoundMaskHeapFree[gFreeMasks] = &gSoundMaskHeap[gFreeMasks];
heap = gSoundMaskHeap;
gFreeMasks = 0;
while (gFreeMasks < SOUND_MASK_HEAP_COUNT) {
gSoundMaskHeapFree[gFreeMasks] = heap;
heap++;
gFreeMasks++;
}
gFreeMasks--;
for (i = 0; i < gUsedMasks; i++) {
sound = (u8 *) gSoundMaskHeapUsed[i]->unk18;
sound = gSoundMaskHeapUsed[i]->soundPtr;
gSoundMaskHeapUsed[i]->unk12 = 0;
if (sound != NULL) {
sound_stop(sound);
}
}
gUsedMasks = 0;
// var_s1 = D_80119C58;
// do {
// var_s1->soundID = 0;
// sound = var_s1->soundPtr;
// if (sound != 0) {
// if (var_s1->unk0.unk0_02 == 0) {
// sound_stop(sound);
// } else if (var_s1->unk0.unk0_02 == 1) {
// music_jingle_stop();
// }
// var_s1->soundPtr = NULL;
// var_s1->unk17C = -1;
// }
// var_s1->unk4.unk4_floats[0] = -100000.0f;;
// var_s1->unk4.unk4_floats[1] = -100000.0f;
// var_v0 = var_s1->unk4.unk4_floats;
// var_v0[4] = -100000.0f;
// var_v0[3] = -100000.0f;
// var_v0[2] = -100000.0f;
// var_v0[1] = -100000.0f;
for (i = 0; i < ARRAY_COUNT(D_80119C58); i++) {
D_80119C58[i].soundID = 0;
if (D_80119C58[i].unk178 != 0) {
if (D_80119C58[i].unk0.unk0_02 == 0) {
sound_stop(D_80119C58[i].unk178);
} else if (D_80119C58[i].unk0.unk0_02 == 1) {
music_jingle_stop();
}
D_80119C58[i].unk178 = 0;
}
D_80119C58[i].unk17C = -1;
D_80119C5C[i]->unk0.unk0_01 = -100000.0f;
// var_v0 = &var_s1->unk4.unk4_floats[5];
// for (j = 2; j != 30; j++, j+= 3) {// this should be j+=4 but has to be split up to match?
// // 2, 6, 10, 14, 18, 22, 26
// var_v0[3] = -100000.0f;;
// var_v0[4] = -100000.0f;
// var_v0[5] = -100000.0f;
// var_v0[6] = -100000.0f;
// var_v0[7] = -100000.0f;
// var_v0[8] = -100000.0f;
// var_v0[9] = -100000.0f;
// var_v0[10] = -100000.0f;
// var_v0[11] = -100000.0f;
// var_v0+= 12;
// var_v0[-12] = -100000.0f;
// var_v0[-11] = -100000.0f;
// var_v0[-10] = -100000.0f;
// };
// var_s1++;
// i++;
// } while (i != ARRAY_COUNT(D_80119C58));
// D_80119C58[i] = -100000.0f;
}
// target = D_8011AC20;
// var_a3 = D_8011A6E0;
// var_a2 = &D_8011A6DC;
// var_a1 = D_8011A6D8;
// do {
// var_a1->unkB8 = -1;
// var_a1->unk0.unk0_02 = 0;
// var_a1->unkBC = 0.0f;
// var_a1 = var_a2;
// var_a1->unk0.unk0_01 = -100000.0f;
// for (i = 0; i < ARRAY_COUNT(D_8011A6E0); i++) {
// D_8011A6D8[i].unkB8 = -1;
// D_8011A6D8[i].unk0.unk0_01 = 0.0f;
// D_8011A6D8[i].unkBC = 0.0f;
// D_8011A6DC[i]->unk0.unk0_01 = -100000.0f;
// D_8011A6E0[i][0] = -100000.0f;
// for (j = 0; j < ARRAY_COUNT(D_8011A6E0[0]); j++) {
// D_8011A6E0[i][j] = -100000.0f;
// }
// }
// var_a3->unk0 = -100000.0f;
// var_a3->unk1C = -100000.0f;
// var_a3->unk18 = -100000.0f;
// var_a3->unk14 = -100000.0f;
// var_a3->unk10 = -100000.0f;
// var_a3->unkC = -100000.0f;;
// var_a3->unk8 = -100000.0f;
// var_a3->unk4 = -100000.0f;
// var_v0_2 = var_a3->unk20;
// for (j = 3; j != 15; j++, j+= 3) {// this should be j+=4 but has to be split up to match?
// // 3, 7, 11
// var_v0_2->unkC = -100000.0f;;
// var_v0_2->unk10 = -100000.0f;
// var_v0_2->unk14 = -100000.0f;
// var_v0_2->unk18 = -100000.0f;
// var_v0_2->unk1C = -100000.0f;
// var_v0_2->unk20 = -100000.0f;
// var_v0_2->unk24 = -100000.0f;
// var_v0_2->unk28 = -100000.0f;
// var_v0_2->unk2C = -100000.0f;
// var_v0_2++;
// var_v0_2[-1].unk0 = -100000.0f;
// var_v0_2[-1].unk4 = -100000.0f;
// var_v0_2[-1].unk8 = -100000.0f;
// };
// var_a3++;
// var_a1++;
// var_a2++;
// } while((s32)var_a3 != target);
gAudioLinesOff = 0;
}
@@ -443,39 +509,44 @@ void func_80009B7C(s32 *soundState, f32 x, f32 y, f32 z) {
#pragma GLOBAL_ASM("asm/nonmatchings/audio_spatial/func_80009D6C.s")
#ifdef NON_EQUIVALENT
// debug_render_audio_effects
void func_8000A184(Gfx **arg0, Vertex **arg1, Triangle **arg2) {
void debug_render_audio_effects(Gfx **arg0, Vertex **arg1, Triangle **arg2) {
s32 i, j;
unk80119C58 *temp;
unk8011A6D8 *temp2;
for (i = 0; i < ARRAY_COUNT(D_80119C58); i++) {
temp = &D_80119C58[i];
if (temp->soundID != 0) {
for (j = 0; j < temp->unk17C; j++) {
debug_render_line(arg0, arg1, arg2, &temp->unk4.unk4_vec[j], 0xFF, 0xFF, 0);
f32 *var_s1;
unk80119C58 *var_s2;
unk8011A6D8 *var_s2_2;
i = 0;
do {
var_s2 = &D_80119C58[i];
var_s1 = var_s2->unk4.unk4_floats;
if (D_80119C58[i].soundID != 0) {
for (j = 0; j < var_s2->unk17C; j++) {
debug_render_line(arg0, arg1, arg2, var_s1, 0xFF, 0xFF, 0);
var_s1 += 3;
}
}
}
i++;
} while (ARRAY_COUNT(D_80119C58) > i);
for (i = 0; i < ARRAY_COUNT(D_8011A6D8); i++) {
temp2 = &D_8011A6D8[i];
if (temp2->unk0.unk0_02 != 0) {
for (j = 0; j < temp2->unkB8; j++) {
debug_render_line(arg0, arg1, arg2, &temp->unk4.unk4_vec[j], 0xFF, 0, 0xFF);
i = 0;
do {
var_s2_2 = &D_8011A6D8[i];
var_s1 = var_s2_2->unk4.unk4_floats;
if (D_8011A6D8[i].unk0.unk0_02 != 0) {
for (j = 0; j < var_s2_2->unkB8; j++) {
debug_render_line(arg0, arg1, arg2, var_s1, 0xFF, 0, 0xFF);
var_s1 += 3;
}
}
}
i++;
} while (i != ARRAY_COUNT(D_8011A6D8));
}
#else
#pragma GLOBAL_ASM("asm/nonmatchings/audio_spatial/func_8000A184.s")
#endif
void func_8000A2E8(s32 arg0) {
if (gUsedMasks != 0) {
if (gSoundMaskHeapUsed[arg0]->unk18 != 0) {
sound_stop(gSoundMaskHeapUsed[arg0]->unk18);
if (gSoundMaskHeapUsed[arg0]->soundPtr != 0) {
sound_stop(gSoundMaskHeapUsed[arg0]->soundPtr);
}
if (gSoundMaskHeapUsed[arg0]->soundMask != NULL) {
*gSoundMaskHeapUsed[arg0]->soundMask = NULL;
+2 -1
View File
@@ -5,6 +5,7 @@
#include "libc/math.h"
#include "structs.h"
#include "PR/gbi.h"
#include "PR/libaudio.h"
typedef struct floatXYZVals {
f32 x1;
@@ -39,7 +40,7 @@ typedef struct unk80119C58 {
/* 0x175 */ u8 unk175;
/* 0x176 */ u8 unk176;
/* 0x177 */ u8 unk177;
/* 0x178 */ s32 unk178;
/* 0x178 */ ALSoundState *soundPtr;
/* 0x17C */ s8 unk17C;
/* 0x17D */ u8 unk17D;
/* 0x17E */ u8 unk17E;
+1 -1
View File
@@ -151,7 +151,7 @@ func_800099EC = 0x800099EC;
func_80009AB4 = 0x80009AB4;
func_80009B7C = 0x80009B7C;
func_80009D6C = 0x80009D6C;
func_8000A184 = 0x8000A184;
debug_render_audio_effects = 0x8000A184;
func_8000A2E8 = 0x8000A2E8;
debug_render_line = 0x8000A414;
+1 -1
View File
@@ -151,7 +151,7 @@ func_800099EC = 0x800099EC;
func_80009AB4 = 0x80009AB4;
func_80009B7C = 0x80009B7C;
func_80009D6C = 0x80009D6C;
func_8000A184 = 0x8000A184;
debug_render_audio_effects = 0x8000A184;
func_8000A2E8 = 0x8000A2E8;
debug_render_line = 0x8000A414;
+1 -1
View File
@@ -151,7 +151,7 @@ func_800099EC = 0x800099EC;
func_80009AB4 = 0x80009AB4;
func_80009B7C = 0x80009B7C;
func_80009D6C = 0x80009D6C;
func_8000A184 = 0x8000A184;
debug_render_audio_effects = 0x8000A184;
func_8000A2E8 = 0x8000A2E8;
debug_render_line = 0x8000A414;
+1 -1
View File
@@ -151,7 +151,7 @@ func_800099EC = 0x800099EC;
func_80009AB4 = 0x80009AB4;
func_80009B7C = 0x80009B7C;
func_80009D6C = 0x80009D6C;
func_8000A184 = 0x8000A184;
debug_render_audio_effects = 0x8000A184;
func_8000A2E8 = 0x8000A2E8;
debug_render_line = 0x8000A414;
+1 -1
View File
@@ -151,7 +151,7 @@ func_800099EC = 0x800099EC;
func_80009AB4 = 0x80009AB4;
func_80009B7C = 0x80009B7C;
func_80009D6C = 0x80009D6C;
func_8000A184 = 0x8000A184;
debug_render_audio_effects = 0x8000A184;
func_8000A2E8 = 0x8000A2E8;
debug_render_line = 0x8000A414;