Migrate audio/port_eu data (#370)

* All work done in audio

* Migrate audio/port_eu data

* Refereshed m2c

* Got the bss segment matching too

Signed-off-by: Taggerung <tyler.taggerung@email.com>
This commit is contained in:
Tyler McGavran
2023-08-15 15:40:01 -04:00
committed by GitHub
parent 27af470a46
commit 2b0d20a84f
13 changed files with 1635 additions and 2103 deletions
-30
View File
@@ -73,33 +73,3 @@ glabel D_801930D0
glabel D_80193318
.skip 1192
glabel D_801937C0
.skip 24
glabel D_801937D8
.skip 24
glabel D_801937F0
.skip 24
glabel D_80193808
.skip 24
glabel D_80193820
.skip 2048
glabel D_80194020
.skip 8
glabel D_80194028
.skip 16
glabel D_80194038
.skip 4
glabel D_8019403C
.skip 4
glabel D_80194040
.skip 16
+6
View File
@@ -0,0 +1,6 @@
.include "macros.inc"
.section .bss
glabel D_80194040
.skip 16
+1 -95
View File
@@ -1,6 +1,6 @@
.include "macros.inc"
.section .rodata
.section .data
glabel D_800E9A40
.asciiz "Audio:Track:Warning: No Free Notetrack\n"
@@ -408,97 +408,3 @@ glabel D_800EA244
.asciiz "SEQ FADE OUT TIME %d\n"
.balign 4
.word 0x00000000, 0x00000000, 0x00000000
# Begin port_eu.c data
glabel D_800EA3A0
.byte 0x00, 0x00, 0x00, 0x00
glabel D_800EA3A4
.byte 0x00, 0x00, 0x00, 0x00
glabel D_800EA3A8
.word D_801937C0
glabel D_800EA3AC
.word D_801937D8
glabel D_800EA3B0
.word D_801937F0
glabel D_800EA3B4
.word D_80193808
.asciiz "DAC:Lost 1 Frame.\n"
.balign 4
.asciiz "DMA: Request queue over.( %d )\n"
.balign 4
.asciiz "DMA [ %d lines] TIMEOUT\n"
.balign 4
.asciiz "Warning: WaveDmaQ contains %d msgs.\n"
.balign 4
.asciiz "Audio:now-max tasklen is %d / %d\n"
.balign 4
.asciiz "Audio:Warning:ABI Tasklist length over (%d)\n"
.balign 4
glabel D_800EA484
.word 0x00000080
.asciiz "AudioSend: %d -> %d (%d)\n"
.balign 4
glabel D_800EA4A4
.word 0x00000000
.asciiz "Undefined Port Command %d\n"
.balign 4
.word 0x00000000, 0x00000000, 0x00000000
.balign 4
glabel D_800EA4D0
.word 0x01284fff
glabel D_800EA4D4
.word 0x01145fff
glabel D_800EA4D8
.word 0x000068b0, 0x01180100, D_800EA4D0, 0x7fff0000
.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
.word 0x00002800, 0x00000000, 0x000068b0, 0x01140100
.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
.word 0x000068b0, 0x011c0100, D_800EA4D0, 0x7fff0000
.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
.word 0x00002800, 0x00000000, 0x000068b0, 0x011c0100
.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
.word 0x000068b0, 0x01100100, D_800EA4D0, 0x7fff0000
.word 0x00002a00, 0x00004600, 0x00000000, 0x00004800
.word 0x00002000, 0x00000000, 0x000068b0, 0x01100100
.word D_800EA4D4, 0x7fff0000, 0x00002a00, 0x00004600
.word 0x00000000, 0x00004800, 0x00002000, 0x00000000
.word 0x1c000000
glabel D_800EA5CC
.hword 0x0030, 0x0000
glabel D_800EA5D0
.word 0x00048c00
glabel D_800EA5D4
.word 0x00002600
glabel D_800EA5D8
.word 0x00000000
glabel D_800EA5DC
.word 0x00000000
+43
View File
@@ -0,0 +1,43 @@
.include "macros.inc"
.section .data
.balign 4
glabel D_800EA4D0
.word 0x01284fff
glabel D_800EA4D4
.word 0x01145fff
glabel D_800EA4D8
.word 0x000068b0, 0x01180100, D_800EA4D0, 0x7fff0000
.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
.word 0x00002800, 0x00000000, 0x000068b0, 0x01140100
.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
.word 0x000068b0, 0x011c0100, D_800EA4D0, 0x7fff0000
.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
.word 0x00002800, 0x00000000, 0x000068b0, 0x011c0100
.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
.word 0x000068b0, 0x01100100, D_800EA4D0, 0x7fff0000
.word 0x00002a00, 0x00004600, 0x00000000, 0x00004800
.word 0x00002000, 0x00000000, 0x000068b0, 0x01100100
.word D_800EA4D4, 0x7fff0000, 0x00002a00, 0x00004600
.word 0x00000000, 0x00004800, 0x00002000, 0x00000000
.word 0x1c000000
glabel D_800EA5CC
.hword 0x0030, 0x0000
glabel D_800EA5D0
.word 0x00048c00
glabel D_800EA5D4
.word 0x00002600
glabel D_800EA5D8
.word 0x00000000
glabel D_800EA5DC
.word 0x00000000
+6 -2
View File
@@ -265,13 +265,15 @@ SECTIONS
BUILD_DIR/src/audio/heap.o(.data);
BUILD_DIR/src/audio/load.o(.data);
BUILD_DIR/src/audio/playback.o(.data);
BUILD_DIR/src/audio/effects.o(.data);
BUILD_DIR/src/audio/effects.o(.data);
#if DEBUG
BUILD_DIR/src/debug/crash_screen_enhancement.o(.data);
BUILD_DIR/src/debug/debug.o(.data);
BUILD_DIR/src/os/sprintf.o(.data);
#endif
BUILD_DIR/data/data_0DD0A0_2_1_1.o(.rodata);
BUILD_DIR/data/data_0DD0A0_2_1_1.o(.data);
BUILD_DIR/src/audio/port_eu.o(.data);
BUILD_DIR/data/data_0DD0A0_2_1_2.o(.data);
BUILD_DIR/src/os/osInitialize.o(.data*);
BUILD_DIR/src/os/osCreateViManager.o(.data);
BUILD_DIR/src/os/osViTable.o(.data);
@@ -354,6 +356,8 @@ SECTIONS
BUILD_DIR/src/os/sprintf.o(.bss);
#endif
BUILD_DIR/asm/bss_main_audio.o(.bss);
BUILD_DIR/src/audio/port_eu.o(.bss);
BUILD_DIR/asm/bss_main_audio2.o(.bss);
BUILD_DIR/src/os/osCreateViManager.o(.bss);
BUILD_DIR/src/os/osCreatePiManager.o(.bss);
BUILD_DIR/src/os/osSetEventMesg.o(.bss);
+676 -880
View File
File diff suppressed because it is too large Load Diff
+133 -182
View File
@@ -198,36 +198,27 @@ void temporary_pools_init(struct PoolSplit *a) {
}
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
? discard_bank(s16, s32, s16, struct TemporaryPool *); /* extern */
? discard_sequence(s16, s32); /* extern */
extern ? gUnkLoadStatus;
extern ? gBankLoadStatus;
extern ? gSeqLoadStatus;
extern void *gNotes;
extern ? gSequencePlayers;
extern ? gSequenceChannels;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-15-2023
void *func_800B93BC(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id) {
? *sp34;
u8 *sp34;
u8 sp33;
struct TemporaryPool *sp28;
struct SoundAllocPool *sp24;
s32 sp20;
? *var_v0_4;
? *var_v0_5;
s16 temp_a0;
s16 temp_a2;
s16 temp_v1_2;
s32 temp_a1;
s32 temp_a1_2;
s32 temp_a1_3;
s32 temp_a1_4;
s32 var_a3;
s32 var_v1_2;
s32 var_v1_3;
s32 var_v1_4;
s32 var_v1_5;
struct Note *var_v0;
struct Note *var_v0_2;
struct Note *var_v0_6;
struct Note *var_v0_7;
struct SequencePlayer *var_v0_4;
struct SequencePlayer *var_v0_5;
struct SoundAllocPool *temp_v1_3;
struct SoundAllocPool *temp_v1_4;
struct TemporaryPool *var_a3_2;
@@ -242,55 +233,50 @@ void *func_800B93BC(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s
u8 *var_v1;
u8 var_t1;
u8 var_t2;
void *var_v0;
void *var_v0_2;
void *var_v0_6;
void *var_v0_7;
var_a3 = arg3;
loop_1:
if (var_a3 == 0) {
var_a3_2 = &arg0->temporary;
if (arg0 == &gSeqLoadedPool) {
sp34 = &gSeqLoadStatus;
sp34 = gSeqLoadStatus;
sp33 = 0;
} else if (arg0 == &gBankLoadedPool) {
sp33 = 1;
sp34 = &gBankLoadStatus;
sp34 = gBankLoadStatus;
} else if (arg0 == &gUnusedLoadedPool) {
sp33 = 2;
sp34 = &gUnkLoadStatus;
sp34 = gUnkLoadStatus;
}
temp_a2 = var_a3_2->entries[0].id;
if (temp_a2 == -1) {
var_t1 = 0;
} else {
var_t1 = *(temp_a2 + sp34);
var_t1 = sp34[temp_a2];
}
temp_a0 = var_a3_2->entries[1].id;
if (temp_a0 == -1) {
var_t2 = 0;
} else {
var_t2 = *(temp_a0 + sp34);
var_t2 = sp34[temp_a0];
}
sp20 = (s32) sp33;
if (sp33 == 1) {
if (var_t1 == 4) {
temp_a1 = gMaxSimultaneousNotes;
var_v1_2 = 0;
if (temp_a1 > 0) {
if (gMaxSimultaneousNotes > 0) {
var_v0 = gNotes;
loop_18:
if ((var_v0->unkB2 != temp_a2) || (((u32) var_v0->unkB0 >> 0x1F) == 0)) {
if ((var_v0->noteSubEu.bankId != temp_a2) || (((u32) var_v0->unkB0 >> 0x1F) == 0)) {
var_v1_2 += 1;
var_v0 += 0xC0;
if (var_v1_2 < temp_a1) {
if (var_v1_2 < gMaxSimultaneousNotes) {
goto loop_18;
}
}
}
temp_v0 = &gBankLoadStatus + temp_a2;
if (var_v1_2 == temp_a1) {
temp_v0 = &gBankLoadStatus[temp_a2];
if (var_v1_2 == gMaxSimultaneousNotes) {
var_t1 = 3;
if (*temp_v0 != 5) {
*temp_v0 = 3;
@@ -298,21 +284,20 @@ loop_18:
}
}
if (var_t2 == 4) {
temp_a1_2 = gMaxSimultaneousNotes;
var_v1_3 = 0;
if (temp_a1_2 > 0) {
if (gMaxSimultaneousNotes > 0) {
var_v0_2 = gNotes;
loop_27:
if ((var_v0_2->unkB2 != var_a3_2->entries[1].id) || (((u32) var_v0_2->unkB0 >> 0x1F) == 0)) {
if ((var_v0_2->noteSubEu.bankId != var_a3_2->entries[1].id) || (((u32) var_v0_2->unkB0 >> 0x1F) == 0)) {
var_v1_3 += 1;
var_v0_2 += 0xC0;
if (var_v1_3 < temp_a1_2) {
if (var_v1_3 < gMaxSimultaneousNotes) {
goto loop_27;
}
}
}
if (var_v1_3 == temp_a1_2) {
temp_v0_2 = &gBankLoadStatus + var_a3_2->entries[1].id;
if (var_v1_3 == gMaxSimultaneousNotes) {
temp_v0_2 = &gBankLoadStatus[var_a3_2->entries[1].id];
var_t2 = 3;
if (*temp_v0_2 != 5) {
*temp_v0_2 = 3;
@@ -346,15 +331,15 @@ loop_27:
}
if (sp20 == 0) {
if (var_t1 == 2) {
var_v0_4 = &gSequencePlayers;
var_v0_4 = gSequencePlayers;
loop_47:
if ((((u32) var_v0_4->unk0 >> 0x1F) == 0) || (var_v0_4->unk4 != var_a3_2->entries[0].id)) {
if ((((u32) var_v0_4->unk0 >> 0x1F) == 0) || (var_v0_4->seqId != var_a3_2->entries[0].id)) {
var_v0_4 += 0x148;
if (var_v0_4 != &gSequenceChannels) {
if (var_v0_4 != gSequenceChannels) {
goto loop_47;
}
}
if (var_v0_4 == &gSequenceChannels) {
if (var_v0_4 == gSequenceChannels) {
var_a3_2->nextSide = 0;
var_v0_3 = 0;
goto block_84;
@@ -363,16 +348,16 @@ loop_47:
}
block_52:
if (var_t2 == 2) {
var_v0_5 = &gSequencePlayers;
var_v0_5 = gSequencePlayers;
loop_54:
if ((((u32) var_v0_5->unk0 >> 0x1F) == 0) || (var_v0_5->unk4 != var_a3_2->entries[1].id)) {
if ((((u32) var_v0_5->unk0 >> 0x1F) == 0) || (var_v0_5->seqId != var_a3_2->entries[1].id)) {
var_v0_5 += 0x148;
if (var_v0_5 != &gSequenceChannels) {
if (var_v0_5 != gSequenceChannels) {
goto loop_54;
}
}
var_v0_3 = 1;
if (var_v0_5 == &gSequenceChannels) {
if (var_v0_5 == gSequenceChannels) {
var_a3_2->nextSide = 1;
goto block_84;
}
@@ -382,21 +367,20 @@ loop_54:
}
if (sp20 == (s32) 1U) {
if (var_t1 == 2) {
temp_a1_3 = gMaxSimultaneousNotes;
var_v1_4 = 0;
if (temp_a1_3 > 0) {
if (gMaxSimultaneousNotes > 0) {
var_v0_6 = gNotes;
loop_63:
if ((var_v0_6->unkB2 != var_a3_2->entries[0].id) || (((u32) var_v0_6->unkB0 >> 0x1F) == 0)) {
if ((var_v0_6->noteSubEu.bankId != var_a3_2->entries[0].id) || (((u32) var_v0_6->unkB0 >> 0x1F) == 0)) {
var_v1_4 += 1;
var_v0_6 += 0xC0;
if (var_v1_4 < temp_a1_3) {
if (var_v1_4 < gMaxSimultaneousNotes) {
goto loop_63;
}
}
}
var_v0_3 = 0;
if (var_v1_4 == temp_a1_3) {
if (var_v1_4 == gMaxSimultaneousNotes) {
var_a3_2->nextSide = 0;
goto block_84;
}
@@ -404,21 +388,20 @@ loop_63:
}
block_68:
if (var_t2 == 2) {
temp_a1_4 = gMaxSimultaneousNotes;
var_v1_5 = 0;
if (temp_a1_4 > 0) {
if (gMaxSimultaneousNotes > 0) {
var_v0_7 = gNotes;
loop_71:
if ((var_v0_7->unkB2 != var_a3_2->entries[1].id) || (((u32) var_v0_7->unkB0 >> 0x1F) == 0)) {
if ((var_v0_7->noteSubEu.bankId != var_a3_2->entries[1].id) || (((u32) var_v0_7->unkB0 >> 0x1F) == 0)) {
var_v1_5 += 1;
var_v0_7 += 0xC0;
if (var_v1_5 < temp_a1_4) {
if (var_v1_5 < gMaxSimultaneousNotes) {
goto loop_71;
}
}
}
var_v0_3 = 1;
if (var_v1_5 == temp_a1_4) {
if (var_v1_5 == gMaxSimultaneousNotes) {
var_a3_2->nextSide = 1;
goto block_84;
}
@@ -451,10 +434,10 @@ block_83:
block_84:
temp_v1_2 = var_a3_2->entries[var_v0_3].id;
if (temp_v1_2 != -1) {
*(sp34 + temp_v1_2) = 0;
sp34[temp_v1_2] = 0;
if (sp20 == (s32) 1U) {
sp28 = var_a3_2;
discard_bank(var_a3_2->entries[var_a3_2->nextSide].id, sp20, var_a3_2->entries[0].id, var_a3_2);
discard_bank((s32) var_a3_2->entries[var_a3_2->nextSide].id);
}
}
temp_a0_2 = var_a3_2->nextSide;
@@ -469,19 +452,19 @@ block_84:
var_a3_2->entries[1].ptr = var_v0_8;
var_a3_2->entries[1].size = (u32) size;
if ((u32) var_v0_8 < (u32) temp_v1_4->cur) {
*(sp34 + var_a3_2->entries[0].id) = 0;
sp34[var_a3_2->entries[0].id] = 0;
switch (sp20) { /* switch 1; irregular */
case 0: /* switch 1 */
sp28 = var_a3_2;
sp24 = temp_v1_4;
discard_sequence(var_a3_2->entries[0].id, sp20);
discard_sequence((s32) var_a3_2->entries[0].id);
block_106:
var_a3_2 = sp28;
break;
case 1: /* switch 1 */
sp28 = var_a3_2;
sp24 = temp_v1_4;
discard_bank(var_a3_2->entries[0].id, sp20);
discard_bank((s32) var_a3_2->entries[0].id);
goto block_106;
}
var_a3_2->entries[0].id = -1;
@@ -497,19 +480,19 @@ block_106:
temp_v0_3 = &temp_v1_3->start[size];
temp_v1_3->cur = temp_v0_3;
if ((u32) var_a3_2->entries[1].ptr < (u32) temp_v0_3) {
*(sp34 + var_a3_2->entries[1].id) = 0;
sp34[var_a3_2->entries[1].id] = 0;
switch (sp20) { /* irregular */
case 0:
sp28 = var_a3_2;
sp24 = temp_v1_3;
discard_sequence(var_a3_2->entries[1].id, sp20);
discard_sequence((s32) var_a3_2->entries[1].id);
block_96:
var_a3_2 = sp28;
break;
case 1:
sp28 = var_a3_2;
sp24 = temp_v1_3;
discard_bank(var_a3_2->entries[1].id, sp20);
discard_bank((s32) var_a3_2->entries[1].id);
goto block_96;
}
var_a3_2->entries[1].id = -1;
@@ -634,105 +617,86 @@ void func_800B9FB8(void) {
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
void func_800B9FB8(); /* extern */
void func_800BA250(); /* extern */
void sequence_player_disable(? *); /* extern */
extern u32 gSequencePlayers;
extern ? gSequenceChannels;
extern ? gAudioBufferParameters;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800B9FB8(); /* extern */
? func_800BA250(); /* extern */
extern u8 D_803B0500;
extern s32 D_803B0504;
extern s32 D_803B7180;
extern ? D_803B718C;
s32 func_800BA00C(void) {
? *temp_s0;
s32 *temp_v1;
s32 temp_a0;
s32 temp_a2;
s32 temp_v0;
s32 temp_v0_4;
s32 temp_v0_5;
s32 temp_v0_6;
u8 temp_t6;
s32 *var_v1_2;
s32 var_a0;
s32 var_v0;
s32 var_v1;
struct SequencePlayer *var_s0;
void *temp_t1;
void *temp_v0;
void *temp_v0_2;
void *temp_v0_3;
? *phi_s0;
s32 phi_v1;
s32 phi_a0;
s32 phi_a2;
s32 *phi_v1_2;
s32 phi_v0;
temp_t6 = D_803B0500;
switch (temp_t6) {
switch (D_803B0500) {
case 5:
phi_s0 = &gSequencePlayers;
var_s0 = gSequencePlayers;
do {
sequence_player_disable(phi_s0);
temp_s0 = phi_s0 + 0x148;
phi_s0 = temp_s0;
} while (temp_s0 != &gSequenceChannels);
sequence_player_disable(var_s0);
var_s0 += 0x148;
} while (var_s0 != gSequenceChannels);
D_803B0504 = 4;
D_803B0500 += -1;
D_803B0500 -= 1;
break;
case 4:
temp_v0 = D_803B0504;
if (temp_v0 != 0) {
D_803B0504 = temp_v0 - 1;
if (D_803B0504 != 0) {
D_803B0504 -= 1;
func_800B9FB8();
} else {
temp_a2 = gMaxSimultaneousNotes;
phi_v1 = 0;
phi_a0 = 0;
phi_a2 = temp_a2;
if (temp_a2 > 0) {
var_a0 = 0;
var_v1 = 0;
if (gMaxSimultaneousNotes > 0) {
do {
temp_a0 = phi_a0 + 1;
temp_v0_2 = gNotes + phi_v1;
phi_a0 = temp_a0;
if (((temp_v0_2->unkB0 >> 0x1F) != 0) && (temp_v0_2->unk59 != 0)) {
temp_v0_2->unk68 = gAudioBufferParameters.unk18;
temp_v0_3 = gNotes + phi_v1;
temp_v0_3->unk58 = temp_v0_3->unk58 | 0x10;
phi_a2 = gMaxSimultaneousNotes;
var_a0 += 1;
temp_v0 = gNotes + var_v1;
if ((((u32) temp_v0->unkB0 >> 0x1F) != 0) && (temp_v0->unk59 != 0)) {
temp_v0->unk68 = (f32) gAudioBufferParameters.updatesPerFrameInv;
temp_v0_2 = gNotes + var_v1;
temp_v0_2->unk58 = (u8) (temp_v0_2->unk58 | 0x10);
}
phi_v1 += 0xC0;
} while (temp_a0 < phi_a2);
var_v1 += 0xC0;
} while (var_a0 < gMaxSimultaneousNotes);
}
D_803B0504 = 0x10;
D_803B0500 += -1;
D_803B0504 = 0x00000010;
D_803B0500 -= 1;
}
break;
case 3:
temp_v0_4 = D_803B0504;
phi_v1_2 = &D_803B7180;
if (temp_v0_4 != 0) {
D_803B0504 = temp_v0_4 - 1;
var_v1_2 = &D_803B7180;
if (D_803B0504 != 0) {
D_803B0504 -= 1;
func_800B9FB8();
} else {
do {
phi_v0 = 0;
var_v0 = 0;
loop_18:
*(*phi_v1_2 + phi_v0) = 0;
(*phi_v1_2 + phi_v0)->unk2 = 0;
(*phi_v1_2 + phi_v0)->unk4 = 0;
temp_v0_5 = phi_v0 + 8;
(*phi_v1_2 + phi_v0)->unk6 = 0;
phi_v0 = temp_v0_5;
if (temp_v0_5 != 0xA00) {
*(*var_v1_2 + var_v0) = 0;
(*var_v1_2 + var_v0)->unk2 = 0;
(*var_v1_2 + var_v0)->unk4 = 0;
temp_t1 = *var_v1_2 + var_v0;
var_v0 += 8;
temp_t1->unk6 = 0;
if (var_v0 != 0xA00) {
goto loop_18;
}
temp_v1 = phi_v1_2 + 4;
phi_v1_2 = temp_v1;
} while (temp_v1 != &D_803B718C);
var_v1_2 += 4;
} while (var_v1_2 != &D_803B718C);
D_803B0504 = 4;
D_803B0500 += -1;
D_803B0500 -= 1;
}
break;
case 2:
temp_v0_6 = D_803B0504;
if (temp_v0_6 != 0) {
D_803B0504 = temp_v0_6 - 1;
if (D_803B0504 != 0) {
D_803B0504 -= 1;
} else {
D_803B0500 += -1;
D_803B0500 -= 1;
}
break;
case 1:
@@ -740,7 +704,7 @@ loop_18:
D_803B0500 = 0;
break;
}
if (D_803B0500 < 3) {
if ((s32) D_803B0500 < 3) {
return 0;
}
return 1;
@@ -750,38 +714,34 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800BA00C.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
? reset_bank_and_seq_load_status(); /* extern */
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-15-2023
? func_800B914C(? *, s16, s16, u16); /* extern */
? init_note_free_list(); /* extern */
? note_init_all(); /* extern */
? reset_bank_and_seq_load_status(); /* extern */
extern s32 D_803AFBD0;
extern ? D_803B0348;
extern struct PoolSplit2 D_803B0358;
extern struct PoolSplit D_803B0360;
extern struct PoolSplit D_803B0370;
extern u8 D_803B0501;
extern void *gNotes;
extern s32 D_803B70AC;
extern s16 D_803B70B4;
extern ? D_803B70C8;
extern ? D_803B70D0;
extern f32 D_803B7178;
extern s32 D_803B717C;
extern s32 gSampleDmaNumListItems;
extern u16 gVolume;
extern ? sAudioSynthesisPad;
static ? D_800EA4D8; /* unable to generate initializer; const */
static s16 D_800EA5CC; /* unable to generate initializer; const */
static ? D_800EA4D8; /* unable to generate initializer */
static s16 D_800EA5CC; /* unable to generate initializer */
void func_800BA250(void) {
? *var_s0;
f32 temp_f0;
s16 *temp_v0_2;
s16 *temp_v0_3;
s16 temp_a1;
s16 temp_a2;
s16 temp_t0;
s16 temp_t1;
s16 temp_v1;
s32 temp_t2;
s32 temp_t9;
s32 var_s1;
@@ -789,11 +749,10 @@ void func_800BA250(void) {
struct SynthesisReverb *var_s0_2;
struct SynthesisReverb *var_s2;
struct SynthesisReverb *var_s2_2;
u16 temp_a3;
u16 temp_t7;
u32 temp_s0;
u32 temp_s1;
u8 temp_v1_2;
u8 temp_v1;
void *temp_s6;
void *temp_v0;
@@ -802,38 +761,34 @@ void func_800BA250(void) {
temp_t9 = temp_s6->unk0;
gAudioBufferParameters.frequency = (u16) temp_t9;
gAudioBufferParameters.aiFrequency = osAiSetFrequency(temp_t9 & 0xFFFF);
temp_a3 = gAudioBufferParameters.frequency;
gAudioBufferParameters.samplesPerFrameTarget = (((s32) temp_a3 / (s32) D_803B717C) + 0xF) & 0xFFF0;
temp_v1 = gAudioBufferParameters.samplesPerFrameTarget;
temp_t0 = temp_v1 + 0x10;
gAudioBufferParameters.minAiBufferLength = temp_v1 - 0x10;
gAudioBufferParameters.samplesPerFrameTarget = (((s32) gAudioBufferParameters.frequency / (s32) D_803B717C) + 0xF) & 0xFFF0;
temp_t0 = gAudioBufferParameters.samplesPerFrameTarget + 0x10;
gAudioBufferParameters.minAiBufferLength = gAudioBufferParameters.samplesPerFrameTarget - 0x10;
gAudioBufferParameters.maxAiBufferLength = temp_t0;
gAudioBufferParameters.updatesPerFrame = (temp_t0 / 192) + 1;
temp_a2 = gAudioBufferParameters.updatesPerFrame;
gAudioBufferParameters.samplesPerUpdate = (temp_v1 / temp_a2) & 0xFFF8;
temp_t1 = gAudioBufferParameters.samplesPerUpdate;
gAudioBufferParameters.samplesPerUpdate = ((s16) gAudioBufferParameters.samplesPerFrameTarget / temp_a2) & 0xFFF8;
temp_f0 = (f32) temp_a2;
gAudioBufferParameters.samplesPerUpdateMax = temp_t1 + 8;
gAudioBufferParameters.samplesPerUpdateMin = temp_t1 - 8;
gAudioBufferParameters.resampleRate = 32000.0f / (f32) temp_a3;
gAudioBufferParameters.samplesPerUpdateMax = gAudioBufferParameters.samplesPerUpdate + 8;
gAudioBufferParameters.samplesPerUpdateMin = gAudioBufferParameters.samplesPerUpdate - 8;
gAudioBufferParameters.resampleRate = 32000.0f / (f32) gAudioBufferParameters.frequency;
gAudioBufferParameters.unkUpdatesPerFrameScaled = 0.001171875f / temp_f0;
gAudioBufferParameters.updatesPerFrameInv = 1.0f / temp_f0;
gMaxSimultaneousNotes = (s32) temp_s6->unk5;
gVolume = (s16) temp_s6->unkC;
gVolume = temp_s6->unkC;
D_803B70B4 = (s16) (u32) (((temp_f0 * 2880000.0f) / (f32) D_800EA5CC) / D_803B7178);
gAudioBufferParameters.presetUnk4 = (s16) temp_s6->unk4;
temp_a1 = gAudioBufferParameters.presetUnk4;
gAudioBufferParameters.samplesPerFrameTarget = temp_v1 * temp_a1;
gAudioBufferParameters.maxAiBufferLength *= temp_a1;
gAudioBufferParameters.minAiBufferLength *= temp_a1;
gAudioBufferParameters.updatesPerFrame = temp_a2 * temp_a1;
gAudioBufferParameters.samplesPerFrameTarget *= gAudioBufferParameters.presetUnk4;
gAudioBufferParameters.maxAiBufferLength *= gAudioBufferParameters.presetUnk4;
gAudioBufferParameters.minAiBufferLength *= gAudioBufferParameters.presetUnk4;
gAudioBufferParameters.updatesPerFrame = temp_a2 * gAudioBufferParameters.presetUnk4;
D_803B70AC = (gMaxSimultaneousNotes * 0x14 * gAudioBufferParameters.updatesPerFrame) + (temp_s6->unk6 << 5) + 0x1E0;
temp_s0 = temp_s6->unk10 + temp_s6->unk14 + temp_s6->unk18;
temp_s1 = temp_s6->unk1C + temp_s6->unk20 + temp_s6->unk24;
temp_t2 = temp_s0 + temp_s1;
D_803B0348.unk0 = (s32) ((D_803AFBD0 - temp_t2) - 0x100);
D_803B0348.unkC = temp_t2;
func_800B914C(&D_803B0348, temp_a1, temp_a2, temp_a3);
func_800B914C(&D_803B0348, gAudioBufferParameters.presetUnk4, temp_a2, gAudioBufferParameters.frequency);
D_803B0358.wantPersistent = temp_s0;
D_803B0358.wantTemporary = temp_s1;
seq_and_bank_pool_init(&D_803B0358);
@@ -872,16 +827,16 @@ void func_800BA250(void) {
var_s2_2->useReverb = 8;
var_s2_2->reverbGain = temp_v0->unk2;
var_s2_2->ringBuffer.left = soundAlloc(&gNotesAndBuffersPool, (temp_t7 & 0xFFFF) * 2);
temp_v1_2 = var_s2_2->downsampleRate;
temp_v1 = var_s2_2->downsampleRate;
var_s2_2->ringBuffer.right = soundAlloc(&gNotesAndBuffersPool, var_s2_2->windowSize * 2);
var_s2_2->nextRingBufferPos = 0;
var_s2_2->unkC = 0;
var_s2_2->curFrame = 0;
var_s2_2->framesLeftToIgnore = 2;
var_s2_2->bufSizePerChannel = (s32) var_s2_2->windowSize;
if (temp_v1_2 != 1) {
if (temp_v1 != 1) {
var_s2_2->resampleFlags = 1;
var_s2_2->resampleRate = (u16) (0x8000 / (s32) temp_v1_2);
var_s2_2->resampleRate = (u16) (0x8000 / (s32) temp_v1);
var_s1 = 0;
var_s2_2->resampleStateLeft = soundAlloc(&gNotesAndBuffersPool, 0x00000020U);
var_s2_2->resampleStateRight = soundAlloc(&gNotesAndBuffersPool, 0x00000020U);
@@ -924,26 +879,22 @@ void *unk_pool1_lookup(s32 poolIdx, s32 id) {
}
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
? audio_dma_copy_immediate(s32, u8 *, u32, s32); /* extern */
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800BB584(s32); /* extern */
extern ? gBankLoadStatus;
extern ? gSeqLoadStatus;
extern s32 D_803B706C;
extern s32 D_803B7070;
extern s32 D_803B7074;
extern s32 gCtlEntries;
void func_800BA8B0(s16 arg0, s32 arg1) {
void func_800BA8B0(s32 arg0, s32 arg1) {
s32 sp3C;
s32 sp38;
u32 sp34;
s32 sp30;
u32 sp30;
void *sp20;
s32 temp_a2;
s32 var_a3;
s32 var_s1;
u32 temp_a1;
u32 var_a3;
u8 *temp_v0_3;
u8 *temp_v0_4;
u8 *temp_v0_5;
@@ -966,7 +917,7 @@ void func_800BA8B0(s16 arg0, s32 arg1) {
if (temp_v0->unk8 == 0) {
var_s1 = temp_v0->unk4;
}
if (unk_pool1_lookup((s32) arg0, var_s1) == NULL) {
if (unk_pool1_lookup(arg0, var_s1) == NULL) {
temp_v0_2 = sp3C + (var_s1 * 8);
temp_a2 = gUnkPool1.pool.numAllocatedEntries;
temp_a1 = temp_v0_2->unk8;
@@ -981,22 +932,22 @@ void func_800BA8B0(s16 arg0, s32 arg1) {
gUnkPool1.entries[temp_a2].ptr = temp_v0_3;
if (temp_v0_3 != NULL) {
sp20 = (temp_a2 * 0xC) + &gUnkPool1;
audio_dma_copy_immediate(var_a3, temp_v0_3, sp34, var_a3);
gUnkPool1.entries[temp_a2].poolIndex = arg0;
audio_dma_copy_immediate(var_a3, temp_v0_3, sp34);
gUnkPool1.entries[temp_a2].poolIndex = (s16) arg0;
gUnkPool1.entries[temp_a2].id = (s16) var_s1;
gUnkPool1.entries[temp_a2].size = sp34;
switch (arg0) { /* switch 1; irregular */
case 0: /* switch 1 */
temp_v0_4 = var_s1 + &gSeqLoadStatus;
temp_v0_4 = &gSeqLoadStatus[var_s1];
if (*temp_v0_4 != 5) {
*temp_v0_4 = 5;
return;
}
break;
case 1: /* switch 1 */
(gCtlEntries + (var_s1 * 0xC))->unk4 = (u8 *) (gUnkPool1.entries[temp_a2].ptr + 4);
gCtlEntries[var_s1].instruments = (struct Instrument **) (gUnkPool1.entries[temp_a2].ptr + 4);
func_800BB584(var_s1);
temp_v0_5 = var_s1 + &gBankLoadStatus;
temp_v0_5 = &gBankLoadStatus[var_s1];
if (*temp_v0_5 != 5) {
*temp_v0_5 = 5;
}
+204 -265
View File
@@ -478,28 +478,21 @@ s32 func_800BB388(s32 bankId, s32 instId, s32 arg2) {
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void func_800BB43C(void *arg0, s32 arg1) {
s16 temp_v1;
s32 temp_v0;
void *phi_a2;
s32 phi_v0;
s32 phi_v1;
s32 var_v0;
void *var_a2;
temp_v1 = arg0->unk2;
phi_a2 = arg0;
phi_v0 = 0;
phi_v1 = temp_v1;
if (temp_v1 > 0) {
var_v0 = 0;
var_a2 = arg0;
if (arg0->unk2 > 0) {
do {
temp_v0 = phi_v0 + 1;
phi_v0 = temp_v0;
if (phi_a2->unk8 != 0) {
phi_a2->unk4 = phi_a2->unk4 + arg1;
phi_v1 = arg0->unk2;
var_v0 += 1;
if (var_a2->unk8 != 0) {
var_a2->unk4 = (s32) (var_a2->unk4 + arg1);
}
phi_a2 += 8;
} while (temp_v0 < phi_v1);
var_a2 += 8;
} while (var_v0 < arg0->unk2);
}
}
#else
@@ -541,33 +534,27 @@ void patch_sound(struct AudioBankSound *sound, u8 *memBase, u8 *offsetBase) {
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void patch_audio_bank(s32, s32, u8, u8); // extern
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern s32 D_803B7074;
extern s32 gCtlEntries;
void func_800BB584(s32 arg0) {
s32 sp18;
s32 temp_v1;
s32 temp_v1_2;
s32 var_a1;
struct CtlEntry *temp_v0_2;
struct CtlEntry *temp_v0_3;
void *temp_v0;
void *temp_v0_2;
void *temp_v0_3;
s32 phi_a1;
temp_v1 = D_803B7074;
temp_v0 = temp_v1 + (arg0 * 8);
temp_v0 = D_803B7074 + (arg0 * 8);
if (temp_v0->unk8 == 0) {
phi_a1 = (temp_v1 + (temp_v0->unk4 * 8))->unk4;
var_a1 = (D_803B7074 + (temp_v0->unk4 * 8))->unk4;
} else {
phi_a1 = temp_v0->unk4;
var_a1 = temp_v0->unk4;
}
temp_v1_2 = arg0 * 0xC;
temp_v0_2 = gCtlEntries + temp_v1_2;
sp18 = temp_v1_2;
patch_audio_bank(temp_v0_2->unk4 - 4, phi_a1, temp_v0_2->unk1, temp_v0_2->unk2);
temp_v0_3 = gCtlEntries + temp_v1_2;
temp_v0_3->unk8 = temp_v0_3->unk4->unk-4;
temp_v0_2 = &gCtlEntries[arg0];
sp18 = arg0 * 0xC;
patch_audio_bank((struct AudioBank *) (temp_v0_2->instruments - 4), (u8 *) var_a1, (u32) temp_v0_2->numInstruments, (u32) temp_v0_2->numDrums);
temp_v0_3 = &gCtlEntries[arg0];
temp_v0_3->drums = temp_v0_3->instruments->unk-4;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB584.s")
@@ -642,40 +629,34 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
#undef BASE_OFFSET
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
void audio_dma_copy_immediate(s32, s32, s32); // extern
void func_800BB584(s32); // extern
extern u32 gBankLoadedPool;
extern u8 gBankLoadStatus;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void *func_800B93BC(struct SoundMultiPool *, ?, u32, s32, s32); /* extern */
? func_800BB584(s32); /* extern */
extern s32 D_803B7070;
extern s32 gCtlEntries;
s32 func_800BB780(s32 arg0, ? arg1) {
s32 sp54;
s32 sp2C;
void *func_800BB780(s32 arg0, s32 arg1) {
u32 sp54;
void *sp2C;
s32 sp28;
s32 temp_a2;
s32 temp_v0_2;
u32 temp_a2;
u8 *temp_v0_3;
void *temp_v0;
void *temp_v0_2;
temp_v0 = D_803B7070 + (arg0 * 8);
temp_a2 = ((temp_v0->unk8 + 0x1E) & ~0xF) - 0x10;
sp54 = temp_a2;
sp28 = temp_v0->unk4;
temp_v0_2 = func_800B93BC(&gBankLoadedPool, 1, temp_a2, arg1, arg0);
if (temp_v0_2 == 0) {
return 0;
if (temp_v0_2 == NULL) {
return NULL;
}
sp2C = temp_v0_2;
audio_dma_copy_immediate(sp28 + 0x10, temp_v0_2, temp_a2);
(gCtlEntries + (arg0 * 0xC))->unk4 = sp2C + 4;
gCtlEntries[arg0].instruments = sp2C + 4;
func_800BB584(arg0);
temp_v0_3 = arg0 + &gBankLoadStatus;
temp_v0_3 = &gBankLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
}
@@ -686,23 +667,18 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB780.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
void audio_dma_partial_copy_async(void *, void *, void *, OSMesgQueue *, void *); // extern
extern u32 gBankLoadedPool;
extern u8 gBankLoadStatus;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
u8 *func_800B93BC(struct SoundMultiPool *, ?, s32, s32, s32); /* extern */
extern s32 D_803B7070;
extern s32 gCtlEntries;
s32 func_800BB864(s32 arg0, ? arg1, void *arg2) {
s32 func_800BB864(s32 arg0, s32 arg1, struct SequencePlayer *arg2) {
s32 sp64;
s32 sp3C;
u8 *sp3C;
s32 sp38;
OSMesgQueue *sp2C;
OSMesgQueue *temp_a3;
s32 temp_a2;
s32 temp_v0_2;
s32 temp_v1;
u8 *temp_v0_2;
u8 *temp_v0_3;
void *temp_v0;
@@ -712,46 +688,42 @@ s32 func_800BB864(s32 arg0, ? arg1, void *arg2) {
sp38 = temp_v0->unk4;
temp_v0_2 = func_800B93BC(&gBankLoadedPool, 1, temp_a2, arg1, arg0);
sp3C = temp_v0_2;
if (temp_v0_2 == 0) {
if (temp_v0_2 == NULL) {
return 0;
}
arg2->unk6 = arg0;
temp_v1 = arg0 * 0xC;
(gCtlEntries + temp_v1)->unk4 = temp_v0_2 + 4;
temp_a3 = arg2 + 0x108;
(gCtlEntries + temp_v1)->unk8 = 0;
arg2->unk13C = temp_v0_2;
arg2->unk144 = temp_a2;
arg2->unk140 = sp38 + 0x10;
arg2->loadingBankId = (u8) arg0;
gCtlEntries[arg0].instruments = (struct Instrument **) (temp_v0_2 + 4);
temp_a3 = &arg2->bankDmaMesgQueue;
gCtlEntries[arg0].drums = NULL;
arg2->bankDmaCurrMemAddr = temp_v0_2;
arg2->bankDmaRemaining = temp_a2;
arg2->bankDmaCurrDevAddr = sp38 + 0x10;
sp2C = temp_a3;
osCreateMesgQueue(temp_a3, arg2 + 0x120, 1);
arg2->unk0 = arg2->unk0 | 8;
audio_dma_partial_copy_async(arg2 + 0x140, arg2 + 0x13C, arg2 + 0x144, temp_a3, arg2 + 0x124);
temp_v0_3 = arg0 + &gBankLoadStatus;
osCreateMesgQueue(temp_a3, &arg2->bankDmaMesg, 1);
arg2->unk0 = (u8) (arg2->unk0 | 8);
audio_dma_partial_copy_async(&arg2->bankDmaCurrDevAddr, &arg2->bankDmaCurrMemAddr, &arg2->bankDmaRemaining, temp_a3, &arg2->bankDmaIoMesg);
temp_v0_3 = &gBankLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 1;
}
return sp3C;
return (s32) sp3C;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB864.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
void audio_dma_copy_immediate(s32, s32, s32); // extern
extern u32 gSeqLoadedPool;
extern ? gSeqLoadStatus;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void *func_800B93BC(struct SoundMultiPool *, ?, u32, s32, s32); /* extern */
extern s32 D_803B706C;
s32 func_800BB99C(s32 arg0, ? arg1) {
s32 sp2C;
s32 sp28;
s32 sp24;
s32 temp_t9;
s32 temp_v0;
void *func_800BB99C(s32 arg0, s32 arg1) {
u32 sp2C;
void *sp28;
u32 sp24;
u32 temp_t9;
u8 *temp_v0_3;
void *temp_v0;
void *temp_v0_2;
temp_v0_2 = D_803B706C + (arg0 * 8);
@@ -759,12 +731,12 @@ s32 func_800BB99C(s32 arg0, ? arg1) {
sp2C = temp_t9;
sp24 = temp_v0_2->unk4;
temp_v0 = func_800B93BC(&gSeqLoadedPool, 1, temp_t9, arg1, arg0);
if (temp_v0 == 0) {
return 0;
if (temp_v0 == NULL) {
return NULL;
}
sp28 = temp_v0;
audio_dma_copy_immediate(sp24, temp_v0, sp2C);
temp_v0_3 = arg0 + &gSeqLoadStatus;
temp_v0_3 = &gSeqLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
}
@@ -775,47 +747,41 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB99C.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
void audio_dma_copy_immediate(s32, s32, s32); // extern
void audio_dma_copy_async(s32, s32, s32, OSMesgQueue *, void *); // extern
extern u32 gSeqLoadedPool;
extern ? gSeqLoadStatus;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void *func_800B93BC(struct SoundMultiPool *, ?, s32, s32, s32); /* extern */
extern s32 D_803B706C;
s32 func_800BBA50(s32 arg0, ? arg1, u8 *arg2) {
s32 sp3C;
void *func_800BBA50(s32 arg0, s32 arg1, struct SequencePlayer *arg2) {
u32 sp3C;
OSMesgQueue *sp34;
OSMesgQueue *temp_a3;
s32 temp_a2;
s32 temp_s0;
s32 temp_v0;
u8 *temp_v0_3;
u8 *temp_v0_4;
void *temp_v0;
void *temp_v0_2;
temp_v0_2 = D_803B706C + (arg0 * 8);
temp_a2 = (temp_v0_2->unk8 + 0xF) & ~0xF;
temp_s0 = temp_a2;
sp3C = temp_v0_2->unk4;
temp_v0 = func_800B93BC(&gSeqLoadedPool, 1, temp_a2, arg1, arg0);
if (temp_v0 == 0) {
return 0;
if (temp_v0 == NULL) {
return NULL;
}
if (temp_s0 < 0x41) {
audio_dma_copy_immediate(sp3C, temp_v0, temp_s0);
temp_v0_3 = arg0 + &gSeqLoadStatus;
if (temp_a2 < 0x41) {
audio_dma_copy_immediate(sp3C, temp_v0, (u32) temp_a2);
temp_v0_3 = &gSeqLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
}
} else {
audio_dma_copy_immediate(sp3C, temp_v0, 0x40);
temp_a3 = arg2 + 0xD4;
audio_dma_copy_immediate(sp3C, temp_v0, 0x00000040U);
temp_a3 = &arg2->seqDmaMesgQueue;
sp34 = temp_a3;
osCreateMesgQueue(temp_a3, arg2 + 0xEC, 1);
*arg2 = *arg2 | 0x10;
audio_dma_copy_async(sp3C + 0x40, temp_v0 + 0x40, temp_s0 - 0x40, temp_a3, arg2 + 0xF0);
temp_v0_4 = arg0 + &gSeqLoadStatus;
osCreateMesgQueue(temp_a3, &arg2->seqDmaMesg, 1);
*arg2 = (u8) (*arg2 | 0x10);
audio_dma_copy_async(sp3C + 0x40, temp_v0 + 0x40, temp_a2 - 0x40, temp_a3, &arg2->seqDmaIoMesg);
temp_v0_4 = &gSeqLoadStatus[arg0];
if (*temp_v0_4 != 5) {
*temp_v0_4 = 1;
}
@@ -857,49 +823,42 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 get_bank_or_seq(s32, ?, u8); // extern
s32 func_800BB780(u8, ?); // extern
extern u8 gBankLoadStatus;
extern s32 gAlBankSets;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void *func_800BB780(u8, ?); /* extern */
s32 func_800BBCD0(s32 arg0, s8 *arg1) {
s32 sp34;
void *func_800BBCD0(s32 arg0, s8 *arg1) {
void *sp34;
s32 sp30;
s32 temp_v0;
s32 var_s1;
u16 temp_s1;
u8 temp_s0;
u8 temp_s2;
u8 temp_t4;
u8 temp_t6;
s32 phi_s1;
s32 phi_v1;
u8 phi_s2;
s32 phi_v1_2;
u8 var_s2;
void *var_v1;
temp_v0 = gAlBankSets;
temp_s1 = *(temp_v0 + (arg0 * 2));
temp_s2 = *(temp_s1 + temp_v0);
phi_s1 = (temp_s1 + 1) & 0xFFFF;
phi_s2 = temp_s2;
if (temp_s2 != 0) {
temp_s1 = *(gAlBankSets + (arg0 * 2));
var_s2 = gAlBankSets[temp_s1];
var_s1 = (temp_s1 + 1) & 0xFFFF;
if (var_s2 != 0) {
do {
temp_s0 = *(phi_s1 + gAlBankSets);
phi_s1 = (phi_s1 + 1) & 0xFFFF;
phi_v1 = 0;
if (((*(&gBankLoadStatus + temp_s0) < 2) ^ 1) == 1) {
phi_v1 = get_bank_or_seq(1, 2, temp_s0);
temp_s0 = gAlBankSets[var_s1];
temp_t4 = gBankLoadStatus[temp_s0];
var_s1 = (var_s1 + 1) & 0xFFFF;
var_v1 = NULL;
if ((((s32) temp_t4 < 2) ^ 1) == 1) {
var_v1 = get_bank_or_seq(1, 2, (s32) temp_s0);
}
phi_v1_2 = phi_v1;
if (phi_v1 == 0) {
phi_v1_2 = func_800BB780(temp_s0, 2);
if (var_v1 == NULL) {
var_v1 = func_800BB780(temp_s0, 2);
}
temp_t6 = (phi_s2 - 1) & 0xFF;
phi_s2 = temp_t6;
temp_t6 = (var_s2 - 1) & 0xFF;
var_s2 = temp_t6;
} while (temp_t6 != 0);
sp34 = phi_v1_2;
sp30 = temp_s0;
sp34 = var_v1;
sp30 = (s32) temp_s0;
}
*arg1 = sp30;
*arg1 = (s8) sp30;
return sp34;
}
#else
@@ -907,49 +866,48 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBCD0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 get_bank_or_seq(?, ?, u32); // extern
s32 func_800BB99C(u32, ?, u32); // extern
s32 func_800BBCD0(u32, ? *, u32); // extern
extern s32 D_800EA5DC;
extern u8 gBankLoadStatus;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
s32 func_800BB99C(u32, ?, u32); /* extern */
? func_800BBCD0(u32, ? *, u32); /* extern */
extern s32 D_803B706C;
extern u16 D_803B707C;
static s32 D_800EA5DC = 0;
void func_800BBDDC(u32 arg0, s32 arg1) {
? sp23;
s32 sp1C;
s32 temp_t6;
s32 var_v1;
u32 var_a2;
void *temp_v0;
u32 phi_a2;
u32 phi_a2_2;
s32 phi_v1;
u32 phi_a2_3;
void *temp_v0_2;
void *var_v1_2;
temp_t6 = arg1 & 0xFF;
phi_a2 = arg0;
if (arg0 < D_803B707C) {
var_a2 = arg0;
if (arg0 < (u16) D_803B707C) {
temp_v0 = D_803B706C + (arg0 * 8);
if (temp_v0->unk8 == 0) {
phi_a2 = temp_v0->unk4;
var_a2 = temp_v0->unk4;
}
D_800EA5DC = 0x19710515;
phi_a2_2 = phi_a2;
if ((temp_t6 & 2) != 0) {
sp1C = temp_t6;
arg0 = phi_a2;
func_800BBCD0(phi_a2, &sp23, phi_a2);
phi_a2_2 = arg0;
var_v1 = temp_t6;
if (temp_t6 & 2) {
sp1C = var_v1;
arg0 = var_a2;
func_800BBCD0(var_a2, &sp23, var_a2);
var_v1 = sp1C;
var_a2 = arg0;
}
phi_a2_3 = phi_a2_2;
if ((arg1 & 0xFF & 1) != 0) {
phi_v1 = 0;
if (((*(&gBankLoadStatus + phi_a2_2) < 2) ^ 1) == 1) {
arg0 = phi_a2_2;
phi_v1 = get_bank_or_seq(0, 2, phi_a2_2);
phi_a2_3 = arg0;
if (var_v1 & 1) {
var_v1_2 = NULL;
if ((((s32) gBankLoadStatus[var_a2] < 2) ^ 1) == 1) {
arg0 = var_a2;
temp_v0_2 = get_bank_or_seq(0, 2, (s32) var_a2);
var_a2 = arg0;
var_v1_2 = temp_v0_2;
}
if ((phi_v1 == 0) && (func_800BB99C(phi_a2_3, 2, phi_a2_3) == 0)) {
if ((var_v1_2 == NULL) && (func_800BB99C(var_a2, 2, var_a2) == 0)) {
D_800EA5DC = 0x76557364;
return;
}
@@ -957,15 +915,13 @@ void func_800BBDDC(u32 arg0, s32 arg1) {
}
block_11:
D_800EA5DC = 0x76557364;
// Duplicate return node #12. Try simplifying control flow for better match
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBDDC.s")
#endif
extern volatile s32 D_800EA5DC;
//load_sequence_internal
void func_800BBF44(u32 player, u32 seqId, s32 loadAsync);
//load_sequence
void func_800BBEF0(u32 player, u32 seqId, s32 loadAsync) {
if (!loadAsync) {
@@ -976,96 +932,84 @@ void func_800BBEF0(u32 player, u32 seqId, s32 loadAsync) {
D_800EA5DC = AUDIO_LOCK_NOT_LOADING;
}
}
//GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBEF0.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 get_bank_or_seq(?, ?, s8); // extern
s32 func_800BB864(s32, ?, void *); // extern
s32 func_800BB99C(s8, ?); // extern
s32 func_800BBA50(s8, ?, void *); // extern
s32 get_missing_bank(s8, s32 *, s32 *); // extern
s32 func_800BBCD0(s8, void *, s32 *); // extern
void sequence_player_disable(void *); // extern
void init_sequence_player(s32); // extern
extern u32 gSequencePlayers;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
s32 func_800BB864(u8, ?, struct SequencePlayer *); /* extern */
u8 *func_800BB99C(u32, ?); /* extern */
u8 *func_800BBA50(u32, ?, struct SequencePlayer *); /* extern */
s32 func_800BBCD0(u32, u8 *, s32 *); /* extern */
extern s32 D_803B706C;
extern u16 D_803B707C;
void func_800BBF44(s32 arg0, u32 arg1, s32 arg2) {
s32 sp3C;
//load_sequence_internal
void func_800BBF44(u32 arg0, u32 arg1, s32 arg2) {
u8 *sp3C;
s32 sp2C;
s32 sp28;
s32 sp24;
s32 *temp_a1;
s32 *temp_a2;
s32 temp_a0;
s32 temp_v0_2;
s32 temp_v0_3;
void *temp_s0;
struct SequencePlayer *temp_s0;
u32 var_s1;
u8 *temp_v0_3;
u8 *var_v0;
u8 *var_v1;
u8 temp_a0;
u8 temp_v0_2;
void *temp_v0;
s8 phi_s1;
s32 phi_v0;
s32 phi_v1;
phi_s1 = arg1;
if (arg1 < D_803B707C) {
var_s1 = arg1;
if (arg1 < (u16) D_803B707C) {
temp_v0 = D_803B706C + (arg1 * 8);
if (temp_v0->unk8 == 0) {
phi_s1 = temp_v0->unk4;
var_s1 = temp_v0->unk4;
}
temp_s0 = (arg0 * 0x148) + &gSequencePlayers;
temp_s0 = &gSequencePlayers[arg0];
sequence_player_disable(temp_s0);
temp_a1 = &sp28;
temp_a2 = &sp2C;
if (arg2 != 0) {
sp2C = 0;
sp28 = 0;
temp_v0_2 = get_missing_bank(phi_s1, temp_a1, temp_a2);
temp_v0_2 = get_missing_bank(var_s1, &sp28, &sp2C);
temp_a0 = temp_v0_2;
if (sp2C == 1) {
sp24 = temp_v0_2;
sp24 = (s32) temp_v0_2;
if (func_800BB864(temp_a0, 2, temp_s0) != 0) {
temp_s0->unk5 = sp24;
temp_s0->defaultBank[0] = (u8) sp24;
goto block_10;
}
// Duplicate return node #17. Try simplifying control flow for better match
return;
} else {
if (func_800BBCD0(var_s1, temp_s0->defaultBank) == 0) {
return;
}
goto block_10;
}
if (func_800BBCD0(phi_s1, temp_s0 + 5) == 0) {
return;
}
goto block_10;
}
if (func_800BBCD0(phi_s1, temp_s0 + 5, temp_a2) != 0) {
} else if (func_800BBCD0(var_s1, temp_s0->defaultBank, &sp2C) != 0) {
block_10:
temp_s0->unk4 = phi_s1;
temp_v0_3 = get_bank_or_seq(0, 2, phi_s1);
phi_v1 = temp_v0_3;
if (temp_v0_3 == 0) {
if ((temp_s0->unk0 * 8) >= 0) {
temp_s0->seqId = (u8) var_s1;
temp_v0_3 = get_bank_or_seq(0, 2, (s32) var_s1);
var_v1 = temp_v0_3;
if (temp_v0_3 == NULL) {
if (!(temp_s0->unk0 & 0x10000000)) {
if (arg2 != 0) {
phi_v0 = func_800BBA50(phi_s1, 2, temp_s0);
var_v0 = func_800BBA50(var_s1, 2, temp_s0);
} else {
phi_v0 = func_800BB99C(phi_s1, 2);
var_v0 = func_800BB99C(var_s1, 2);
}
phi_v1 = phi_v0;
if (phi_v0 != 0) {
var_v1 = var_v0;
if (var_v0 != NULL) {
goto block_16;
}
}
} else {
block_16:
sp3C = phi_v1;
sp3C = var_v1;
init_sequence_player(arg0);
temp_s0->unk88 = 0;
temp_s0->unkE = 0;
temp_s0->unk0 = temp_s0->unk0 | 0x80;
temp_s0->unk14 = phi_v1;
temp_s0->unk70 = phi_v1;
temp_s0->scriptState.depth = 0;
temp_s0->delay = 0;
temp_s0->unk0 = (s8) ((u8) temp_s0->unk0 | 0x80);
temp_s0->seqData = var_v1;
temp_s0->scriptState.pc = var_v1;
}
}
// Duplicate return node #17. Try simplifying control flow for better match
}
}
#else
@@ -1073,23 +1017,18 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBF44.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
? audio_dma_copy_immediate(? *, s32 *, u32, void **); /* extern */
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800B90F0(s32); /* extern */
? func_800BA00C(); /* extern */
? func_800BB43C(s32 *, ? *); /* extern */
? init_sequence_players(); /* extern */
? func_800CBF48(u32 *); /* extern */
extern s8 D_803B0500;
extern s8 D_803B0501;
extern OSMesgQueue D_803B6720;
extern void *D_803B6738;
extern s32 *D_803B706C;
extern s32 *D_803B7070;
extern s32 *D_803B7074;
extern s32 *gAlBankSets;
extern s16 D_803B707C;
extern void *gCtlEntries;
extern s8 gAudioLibSoundMode;
extern s32 D_803B70B8;
extern s32 D_803B70C0;
extern s32 D_803B70C4;
@@ -1106,11 +1045,13 @@ extern ? _audio_banksSegmentRomStart;
extern ? _audio_tablesSegmentRomStart;
extern ? _instrument_setsSegmentRomStart;
extern ? _sequencesSegmentRomStart;
extern s32 osTvType;
static s32 D_800EA5D0 = 0x00048C00; /* const */
static s32 D_800EA5D4 = 0x00002600; /* const */
static u32 D_800EA5D8 = 0; /* const */
static s32 D_800EA5DC = 0; /* const */
extern void *gCurrAudioFrameDmaMesgBufs;
extern OSMesgQueue gCurrAudioFrameDmaQueue;
extern s32 gSampleDmaNumListItems;
static s32 D_800EA5D0 = 0x00048C00;
static s32 D_800EA5D4 = 0x00002600;
static u32 D_800EA5D8 = 0;
static s32 D_800EA5DC = 0;
void audio_init(void) {
s32 sp8C;
@@ -1120,12 +1061,10 @@ void audio_init(void) {
? *var_v0_3;
s16 temp_s3;
s16 temp_t1;
s32 *temp_v0;
s32 *temp_v0_2;
s32 *temp_v0_3;
s32 *temp_v0_4;
s32 *temp_v0_5;
s32 temp_t7;
s32 temp_v0;
s32 var_s0_2;
s32 var_s1;
s32 var_v1;
@@ -1135,6 +1074,7 @@ void audio_init(void) {
u32 temp_a1_2;
u32 temp_a1_3;
u32 var_s0;
u8 *temp_v0_4;
void **var_a2;
void *temp_t3;
void *temp_t7_2;
@@ -1159,8 +1099,7 @@ void audio_init(void) {
var_v0_2 += 8;
} while ((s32) var_s0 >= 0);
}
temp_v0 = osTvType;
switch (temp_v0) { /* irregular */
switch (osTvType) { /* irregular */
case 0:
D_803B7178 = 20.03042f;
D_803B717C = 0x00000032;
@@ -1189,7 +1128,7 @@ void audio_init(void) {
D_803B70D8.unk34 = 0;
D_803B70D8.unk84 = 0;
osCreateMesgQueue(&D_803B6720, &D_803B6738, 1);
osCreateMesgQueue(&gCurrAudioFrameDmaQueue, gCurrAudioFrameDmaMesgBufs, 0x00000040);
osCreateMesgQueue(&gCurrAudioFrameDmaQueue, &gCurrAudioFrameDmaMesgBufs, 0x00000040);
gCurrAudioFrameDmaCount = 0;
gSampleDmaNumListItems = 0;
func_800B90F0(D_800EA5D4);
@@ -1214,21 +1153,21 @@ loop_18:
D_803B0500 = 1;
func_800BA00C();
D_803B706C = &sp60;
audio_dma_copy_immediate(&_sequencesSegmentRomStart, &sp60, 0x00000010U);
audio_dma_copy_immediate((u32) &_sequencesSegmentRomStart, &sp60, 0x00000010U);
temp_t1 = D_803B706C->unk2;
temp_a1 = (((temp_t1 & 0xFFFF) * 8) + 0x13) & ~0xF;
D_803B707C = temp_t1;
temp_v0_2 = soundAlloc(&gAudioInitPool, temp_a1);
D_803B706C = temp_v0_2;
audio_dma_copy_immediate(&_sequencesSegmentRomStart, temp_v0_2, temp_a1);
temp_v0 = soundAlloc(&gAudioInitPool, temp_a1);
D_803B706C = temp_v0;
audio_dma_copy_immediate((u32) &_sequencesSegmentRomStart, temp_v0, temp_a1);
func_800BB43C(D_803B706C, &_sequencesSegmentRomStart);
D_803B7070 = &sp60;
audio_dma_copy_immediate(&_audio_banksSegmentRomStart, &sp60, 0x00000010U);
audio_dma_copy_immediate((u32) &_audio_banksSegmentRomStart, &sp60, 0x00000010U);
temp_s3 = D_803B7070->unk2;
temp_a1_2 = ((temp_s3 * 8) + 0x13) & ~0xF;
temp_v0_3 = soundAlloc(&gAudioInitPool, temp_a1_2);
D_803B7070 = temp_v0_3;
audio_dma_copy_immediate(&_audio_banksSegmentRomStart, temp_v0_3, temp_a1_2);
temp_v0_2 = soundAlloc(&gAudioInitPool, temp_a1_2);
D_803B7070 = temp_v0_2;
audio_dma_copy_immediate((u32) &_audio_banksSegmentRomStart, temp_v0_2, temp_a1_2);
func_800BB43C(D_803B7070, &_audio_banksSegmentRomStart);
gCtlEntries = soundAlloc(&gAudioInitPool, temp_s3 * 0xC);
var_v1_2 = 0;
@@ -1237,7 +1176,7 @@ loop_18:
var_s0_2 = 0;
do {
sp8C = var_v1_2;
audio_dma_copy_immediate((D_803B7070 + var_s1)->unk4, &sp60, 0x00000010U, &gCtlEntries);
audio_dma_copy_immediate((D_803B7070 + var_s1)->unk4, &sp60, 0x00000010U);
(gCtlEntries + var_s0_2)->unk1 = (s8) sp60;
var_v1_2 = sp8C + 1;
temp_t3 = gCtlEntries + var_s0_2;
@@ -1247,15 +1186,15 @@ loop_18:
} while (var_v1_2 != temp_s3);
}
D_803B7074 = &sp60;
audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, &sp60, 0x00000010U, &gCtlEntries);
audio_dma_copy_immediate((u32) &_audio_tablesSegmentRomStart, &sp60, 0x00000010U);
temp_a1_3 = ((D_803B7074->unk2 * 8) + 0x13) & ~0xF;
temp_v0_4 = soundAlloc(&gAudioInitPool, temp_a1_3);
D_803B7074 = temp_v0_4;
audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, temp_v0_4, temp_a1_3);
temp_v0_3 = soundAlloc(&gAudioInitPool, temp_a1_3);
D_803B7074 = temp_v0_3;
audio_dma_copy_immediate((u32) &_audio_tablesSegmentRomStart, temp_v0_3, temp_a1_3);
func_800BB43C(D_803B7074, &_audio_tablesSegmentRomStart);
temp_v0_5 = soundAlloc(&gAudioInitPool, 0x00000100U);
gAlBankSets = temp_v0_5;
audio_dma_copy_immediate(&_instrument_setsSegmentRomStart, temp_v0_5, 0x00000100U);
temp_v0_4 = soundAlloc(&gAudioInitPool, 0x00000100U);
gAlBankSets = temp_v0_4;
audio_dma_copy_immediate((u32) &_instrument_setsSegmentRomStart, temp_v0_4, 0x00000100U);
sound_alloc_pool_init(&gUnkPool1.pool, soundAlloc(&gAudioInitPool, D_800EA5D8), D_800EA5D8);
init_sequence_players();
D_800EA5DC = 0x76557364;
+3
View File
@@ -18,6 +18,9 @@ void decrease_sample_dma_ttls();
void func_800BB030(s32);
s32 func_800BB304(struct AudioBankSample*);
s32 func_800BB388(s32 bankId, s32 instId, s32 arg2);
void func_800BBEF0(u32 player, u32 seqId, s32 loadAsync);
void func_800BBF44(u32 player, u32 seqId, s32 loadAsync);
u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount);
void patch_sound(struct AudioBankSound *sound, u8 *memBase, u8 *offsetBase);
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums);
+209 -250
View File
@@ -1,26 +1,54 @@
#include <ultra64.h>
#include <macros.h>
#include "audio/internal.h"
#include "audio/port_eu.h"
#include "audio/load.h"
OSMesgQueue D_801937C0;
OSMesgQueue D_801937D8;
OSMesgQueue D_801937F0;
OSMesgQueue D_80193808;
struct EuAudioCmd D_80193820[0x100];
// Seems oversized by 1
OSMesg D_80194020[2];
OSMesg D_80194028[4];
OSMesg D_80194038[1];
OSMesg D_8019403C[1];
u8 D_800EA3A0[] = { 0, 0, 0, 0 };
u8 D_800EA3A4[] = { 0, 0, 0, 0 };
OSMesgQueue *D_800EA3A8 = &D_801937C0;
OSMesgQueue *D_800EA3AC = &D_801937D8;
OSMesgQueue *D_800EA3B0 = &D_801937F0;
OSMesgQueue *D_800EA3B4 = &D_80193808;
char port_eu_unused_string0[] = "DAC:Lost 1 Frame.\n";
char port_eu_unused_string1[] = "DMA: Request queue over.( %d )\n";
char port_eu_unused_string2[] = "DMA [ %d lines] TIMEOUT\n";
char port_eu_unused_string3[] = "Warning: WaveDmaQ contains %d msgs.\n";
char port_eu_unused_string4[] = "Audio:now-max tasklen is %d / %d\n";
char port_eu_unused_string5[] = "Audio:Warning:ABI Tasklist length over (%d)\n";
s32 D_800EA484 = 128;
char port_eu_unused_string6[] = "AudioSend: %d -> %d (%d)\n";
s32 D_800EA4A4 = 0;
char port_eu_unused_string7[] = "Undefined Port Command %d\n";
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B70EC(s32, s32 *, s32, s16); // extern
s32 func_800BA00C(); // extern
void decrease_sample_dma_ttls(); // extern
void func_800CBCB0(void *); // extern
extern OSMesgQueue *D_800EA3A8;
extern OSMesgQueue *D_800EA3AC;
extern OSMesgQueue *D_800EA3B0;
extern OSMesgQueue *D_800EA3B4;
extern s32 D_800EA484;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
s32 func_800B70EC(s32, s32 *, s32, s16); /* extern */
s32 func_800BA00C(); /* extern */
? func_800CBCB0(void *); /* extern */
extern u8 D_803B0500;
extern u8 D_803B0501;
extern OSMesgQueue gCurrAudioFrameDmaQueue;
extern ? gAudioBufferParameters;
extern s32 D_803B70B8;
extern s32 gCurrAudioFrameDmaCount;
extern s32 D_803B70C0;
extern s32 D_803B70C4;
extern ? D_803B70C8;
@@ -29,12 +57,10 @@ extern void *D_803B70D4;
extern ? D_803B70D8;
extern ? D_803B7180;
extern ? D_803B718C;
extern s32 gAudioRandom;
extern ? aspMainDataEnd;
extern ? aspMainDataStart;
extern ? aspMainTextStart;
extern ? rspbootTextEnd;
extern u64 rspbootTextStart;
extern OSMesgQueue gCurrAudioFrameDmaQueue;
void *create_next_audio_frame_task(void) {
u32 sp74;
@@ -43,132 +69,112 @@ void *create_next_audio_frame_task(void) {
void *sp58;
void *sp54;
s32 *sp40;
s16 *temp_s1_3;
s16 temp_a0;
s16 temp_v0_2;
s16 *temp_s1_2;
s16 temp_v1;
s32 *temp_a3;
s32 temp_hi;
s32 temp_s0;
s32 temp_s0_2;
s32 temp_s0_3;
s32 temp_s0_4;
s32 temp_hi_2;
s32 temp_s1;
s32 temp_s1_2;
s32 temp_t3;
s32 temp_t5;
s32 temp_v0;
void *temp_v1_2;
s32 phi_s0;
s32 phi_s1;
s32 phi_s0_2;
s32 phi_s0_3;
s32 phi_s1_2;
s32 phi_s1_3;
s32 var_s0;
s32 var_s0_2;
s32 var_s0_3;
s32 var_s1;
D_803B70B8 = D_803B70B8 + 1;
if ((D_803B70B8 % gAudioBufferParameters.unk0) != 0) {
D_803B70B8 += 1;
if (((s32) D_803B70B8 % (s16) gAudioBufferParameters.presetUnk4) != 0) {
return NULL;
}
osSendMesg(D_800EA3A8, D_803B70B8, 0);
osSendMesg(D_800EA3A8, (void *) D_803B70B8, 0);
temp_t3 = D_803B70C4 + 1;
temp_t5 = temp_t3 % 3;
temp_hi = (temp_t5 + 1) % 3;
temp_hi = temp_t3 % 3;
temp_hi_2 = (s32) (temp_hi + 1) % 3;
D_803B70C4 = temp_t3;
D_803B70C0 = D_803B70C0 ^ 1;
D_803B70C4 = temp_t5;
D_803B70C0 ^= 1;
D_803B70C4 = temp_hi;
sp74 = osAiGetLength() >> 2;
temp_v1 = *(&D_803B718C + (temp_hi * 2));
temp_v1 = *(&D_803B718C + (temp_hi_2 * 2));
if (temp_v1 != 0) {
osAiSetNextBuffer(*(&D_803B7180 + (temp_hi * 4)), temp_v1 * 4);
osAiSetNextBuffer(*(&D_803B7180 + (temp_hi_2 * 4)), temp_v1 * 4);
}
temp_s1 = gCurrAudioFrameDmaCount;
phi_s0 = 0;
phi_s1 = temp_s1;
phi_s0_2 = 0;
phi_s0_3 = 0;
phi_s1_3 = temp_s1;
if (temp_s1 > 0) {
var_s1 = gCurrAudioFrameDmaCount;
var_s0 = 0;
if (var_s1 > 0) {
do {
phi_s1_2 = phi_s1_3;
if (osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0) == 0) {
phi_s1_2 = phi_s1_3 - 1;
var_s1 -= 1;
}
temp_s0 = phi_s0 + 1;
phi_s0 = temp_s0;
phi_s1 = phi_s1_2;
phi_s1_3 = phi_s1_2;
} while (temp_s0 < gCurrAudioFrameDmaCount);
var_s0 += 1;
} while (var_s0 < gCurrAudioFrameDmaCount);
}
if ((phi_s1 != 0) && (phi_s1 > 0)) {
do {
osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 1);
temp_s0_2 = phi_s0_2 + 1;
phi_s0_2 = temp_s0_2;
} while (temp_s0_2 != phi_s1);
if (var_s1 != 0) {
var_s0_2 = 0;
if (var_s1 > 0) {
do {
osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 1);
var_s0_2 += 1;
} while (var_s0_2 != var_s1);
}
}
temp_s1_2 = gCurrAudioFrameDmaQueue.validCount;
if ((temp_s1_2 != 0) && (temp_s1_2 > 0)) {
do {
osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0);
temp_s0_3 = phi_s0_3 + 1;
phi_s0_3 = temp_s0_3;
} while (temp_s0_3 != temp_s1_2);
temp_s1 = gCurrAudioFrameDmaQueue.validCount;
if (temp_s1 != 0) {
var_s0_3 = 0;
if (temp_s1 > 0) {
do {
osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0);
var_s0_3 += 1;
} while (var_s0_3 != temp_s1);
}
}
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
if (osRecvMesg(D_800EA3B0, &sp58, 0) != -1) {
D_803B0501 = sp58;
D_803B0501 = (u8) sp58;
D_803B0500 = 5;
}
if ((D_803B0500 != 0) && (func_800BA00C() == 0)) {
if (D_803B0500 == 0) {
osSendMesg(D_800EA3B4, D_803B0501, 0);
osSendMesg(D_800EA3B4, (void *) D_803B0501, 0);
}
return NULL;
}
temp_v0 = D_803B70C0;
D_803B70D4 = (temp_v0 * 0x50) + &D_803B70D8;
temp_s0_4 = D_803B70C4;
temp_a3 = (temp_s0_4 * 4) + &D_803B7180;
D_803B70D0 = *(&D_803B70C8 + (temp_v0 * 4));
D_803B70D4 = (D_803B70C0 * 0x50) + &D_803B70D8;
temp_a3 = (D_803B70C4 * 4) + &D_803B7180;
D_803B70D0 = *(&D_803B70C8 + (D_803B70C0 * 4));
sp60 = *temp_a3;
temp_s1_3 = (temp_s0_4 * 2) + &D_803B718C;
*temp_s1_3 = (((gAudioBufferParameters.unk6 - sp74) + 0x40) & 0xFFF0) + 0x10;
temp_a0 = gAudioBufferParameters.unkA;
if (*temp_s1_3 < temp_a0) {
*temp_s1_3 = temp_a0;
temp_s1_2 = (D_803B70C4 * 2) + &D_803B718C;
*temp_s1_2 = (((gAudioBufferParameters.samplesPerFrameTarget - sp74) + 0x40) & 0xFFF0) + 0x10;
if (*temp_s1_2 < gAudioBufferParameters.minAiBufferLength) {
*temp_s1_2 = gAudioBufferParameters.minAiBufferLength;
}
temp_v0_2 = gAudioBufferParameters.unk8;
if (temp_v0_2 < *temp_s1_3) {
*temp_s1_3 = temp_v0_2;
if (gAudioBufferParameters.maxAiBufferLength < *temp_s1_2) {
*temp_s1_2 = gAudioBufferParameters.maxAiBufferLength;
}
sp40 = temp_a3;
if (osRecvMesg(D_800EA3AC, &sp54, 0) != -1) {
func_800CBCB0(sp54);
}
D_803B70D0 = func_800B70EC(D_803B70D0, &sp70, sp60, *temp_s1_3);
D_803B70D0 = func_800B70EC(D_803B70D0, &sp70, sp60, *temp_s1_2);
gAudioRandom = osGetCount() * (gAudioRandom + D_803B70B8);
gAudioRandom = *(*sp40 + ((D_803B70B8 & 0xFF) * 2)) + gAudioRandom;
gAudioRandom += *(*sp40 + ((D_803B70B8 & 0xFF) * 2));
D_803B70D4->unk40 = 0;
D_803B70D4->unk44 = 0;
temp_v1_2 = D_803B70D4;
temp_v1_2->unk0 = 2;
temp_v1_2->unk4 = 0;
temp_v1_2->unk8 = &rspbootTextStart;
temp_v1_2->unkC = &rspbootTextEnd - &rspbootTextStart;
temp_v1_2->unk10 = &aspMainTextStart;
temp_v1_2->unk18 = &aspMainDataStart;
temp_v1_2->unk14 = 0x1000;
temp_v1_2->unk1C = ((&aspMainDataEnd - &aspMainDataStart) >> 3) * 8;
temp_v1_2->unk20 = 0;
temp_v1_2->unk24 = 0;
temp_v1_2->unk28 = 0;
temp_v1_2->unk2C = 0;
temp_v1_2->unk30 = *(&D_803B70C8 + (D_803B70C0 * 4));
temp_v1_2->unk38 = 0;
temp_v1_2->unk3C = 0;
temp_v1_2->unk34 = sp70 * 8;
D_803B70D4->unk0 = 2;
D_803B70D4->unk4 = 0;
D_803B70D4->unk8 = rspbootTextStart;
D_803B70D4->unkC = (s32) (rspbootTextEnd - rspbootTextStart);
D_803B70D4->unk10 = &aspMainTextStart;
D_803B70D4->unk18 = &aspMainDataStart;
D_803B70D4->unk14 = 0x00001000;
D_803B70D4->unk1C = (s32) (((s32) (&aspMainDataEnd - &aspMainDataStart) >> 3) * 8);
D_803B70D4->unk20 = 0;
D_803B70D4->unk24 = 0;
D_803B70D4->unk28 = 0;
D_803B70D4->unk2C = 0;
D_803B70D4->unk30 = (s32) *(&D_803B70C8 + (D_803B70C0 * 4));
D_803B70D4->unk38 = 0;
D_803B70D4->unk3C = 0;
D_803B70D4->unk34 = (s32) (sp70 * 8);
if (D_800EA484 < sp70) {
D_800EA484 = sp70;
}
@@ -179,85 +185,60 @@ GLOBAL_ASM("asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void func_800BB388(u8, u8, u8, void *); // extern
void func_800BBDDC(u8, ?, void *); // extern
void func_800BBEF0(u8, u8, u8, void *); // extern
void sequence_player_disable(u32 *, s32, void *); // extern
void seq_player_fade_to_zero_volume(u8, s32, void *); // extern
void func_800CBA64(u8, s32); // extern
extern u8 gSequencePlayers;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800BBDDC(u8, ?); /* extern */
extern u8 D_803B1658;
extern u8 D_803B17A0;
extern u8 D_803B18E8;
extern s8 gAudioLibSoundMode;
void func_800CB818(void *arg0) {
s32 temp_a1;
u32 *temp_a0;
u8 temp_a0_2;
u8 temp_a1_2;
u8 temp_a2;
struct SequencePlayer *temp_a0;
u8 temp_v0;
u8 temp_v0_2;
void *temp_a3;
temp_v0 = arg0->unk0;
temp_a3 = arg0;
if (temp_v0 != 0x81) {
if (temp_v0 != 0x82) {
if (temp_v0 != 0x83) {
if (temp_v0 != 0x88) {
if (temp_v0 != 0xF0) {
if (temp_v0 != 0xF1) {
if (temp_v0 != 0xF2) {
if (temp_v0 != 0xF3) {
return;
}
func_800BB388(temp_a3->unk1, temp_a3->unk2, temp_a3->unk3, temp_a3);
// Duplicate return node #19. Try simplifying control flow for better match
return;
}
gSequencePlayers = (gSequencePlayers & 0xFFDF) | 4;
D_803B1658 = (D_803B1658 & 0xFFDF) | 4;
D_803B17A0 = (D_803B17A0 & 0xFFDF) | 4;
D_803B18E8 = (D_803B18E8 & 0xFFDF) | 4;
return;
}
gSequencePlayers = gSequencePlayers | 0x24;
D_803B1658 = D_803B1658 | 0x24;
D_803B17A0 = D_803B17A0 | 0x24;
D_803B18E8 = D_803B18E8 | 0x24;
return;
}
gAudioLibSoundMode = temp_a3->unk4;
return;
}
goto block_10;
}
temp_v0_2 = temp_a3->unk1;
temp_a0 = (temp_v0_2 * 0x148) + &gSequencePlayers;
if ((*temp_a0 >> 0x1F) != 0) {
temp_a1 = temp_a3->unk4;
if (temp_a1 == 0) {
sequence_player_disable(temp_a0, temp_a1, temp_a3);
return;
}
seq_player_fade_to_zero_volume(temp_v0_2, temp_a1, temp_a3);
switch (temp_v0) { /* irregular */
case 0x81:
func_800BBDDC(arg0->unk2, 3);
return;
case 0x82:
case 0x88:
func_800BBEF0((u32) arg0->unk1, (u32) arg0->unk2, (s32) arg0->unk3);
func_800CBA64((s32) arg0->unk1, arg0->unk4);
return;
case 0x83:
temp_v0_2 = arg0->unk1;
temp_a0 = &gSequencePlayers[temp_v0_2];
if (((u32) *temp_a0 >> 0x1F) != 0) {
temp_a1 = arg0->unk4;
if (temp_a1 == 0) {
sequence_player_disable(temp_a0);
return;
}
seq_player_fade_to_zero_volume((s32) temp_v0_2, temp_a1);
return;
}
block_10:
temp_a0_2 = temp_a3->unk1;
temp_a1_2 = temp_a3->unk2;
temp_a2 = temp_a3->unk3;
arg0 = temp_a3;
func_800BBEF0(temp_a0_2, temp_a1_2, temp_a2, temp_a3);
func_800CBA64(arg0->unk1, arg0->unk4);
return;
case 0xF0:
gAudioLibSoundMode = (s8) arg0->unk4;
return;
case 0xF1:
*gSequencePlayers |= 0x24;
D_803B1658 |= 0x24;
D_803B17A0 |= 0x24;
D_803B18E8 |= 0x24;
return;
case 0xF2:
*gSequencePlayers = (*gSequencePlayers & 0xFFDF) | 4;
D_803B1658 = (D_803B1658 & 0xFFDF) | 4;
D_803B17A0 = (D_803B17A0 & 0xFFDF) | 4;
D_803B18E8 = (D_803B18E8 & 0xFFDF) | 4;
return;
case 0xF3:
func_800BB388((s32) arg0->unk1, (s32) arg0->unk2, (s32) arg0->unk3);
break;
}
func_800BBDDC(temp_a3->unk2, 3, temp_a3);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/port_eu/func_800CB818.s")
@@ -288,31 +269,20 @@ void func_800CBA64(s32 playerIndex, s32 fadeInTime) {
}
}
extern u8 D_800EA3A0;
extern u8 D_800EA3A4;
extern OSMesgQueue *D_800EA3A8[4];
extern void *D_80194020;
extern void *D_80194028;
extern void *D_80194038;
extern void *D_8019403C;
void func_800CBAB4(void) {
D_800EA3A0 = 0;
D_800EA3A4 = 0;
osCreateMesgQueue(D_800EA3A8[0], &D_80194020, 1);
osCreateMesgQueue(D_800EA3A8[1], &D_80194028, 4);
osCreateMesgQueue(D_800EA3A8[2], &D_80194038, 1);
osCreateMesgQueue(D_800EA3A8[3], &D_8019403C, 1);
D_800EA3A0[0] = 0;
D_800EA3A4[0] = 0;
osCreateMesgQueue(D_800EA3A8, D_80194020, 1);
osCreateMesgQueue(D_800EA3AC, D_80194028, 4);
osCreateMesgQueue(D_800EA3B0, D_80194038, 1);
osCreateMesgQueue(D_800EA3B4, D_8019403C, 1);
}
extern struct EuAudioCmd D_80193820[0x100];
void func_800CBB48(s32 arg0, s32 *arg1){
struct EuAudioCmd *cmd = &D_80193820[D_800EA3A0 & 0xff];
void func_800CBB48(s32 arg0, s32 *arg1) {
struct EuAudioCmd *cmd = &D_80193820[D_800EA3A0[0] & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
D_800EA3A0++;
D_800EA3A0[0]++;
}
void func_800CBB88(u32 arg0, f32 arg1) {
@@ -354,96 +324,86 @@ GLOBAL_ASM("asm/non_matchings/audio/port_eu/func_800CBC24.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
void func_800CB818(void *); /* extern */
extern ? D_80193820;
extern u32 gSequencePlayers;
extern ? gSequenceChannelNone;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800CB818(struct EuAudioCmd *); /* extern */
void func_800CBCB0(u32 arg0) {
s32 temp_s1;
s32 temp_t1;
s32 temp_t8;
s32 var_s1;
s32 var_v0;
struct EuAudioCmd *temp_s0;
struct SequenceChannel *temp_v0_2;
struct SequencePlayer *temp_v1;
u8 temp_a0;
u8 temp_a1;
u8 temp_v0;
u8 temp_v1_2;
void *temp_s0;
void *temp_v0_2;
void *temp_v1;
s32 phi_v0;
s32 phi_s1;
temp_t8 = arg0 & 0xFF;
temp_s1 = (arg0 >> 8) & 0xFF;
phi_v0 = temp_s1;
phi_s1 = temp_s1;
if (temp_t8 != temp_s1) {
var_s1 = (arg0 >> 8) & 0xFF;
var_v0 = var_s1;
if (temp_t8 != var_s1) {
do {
temp_s0 = &D_80193820 + ((phi_v0 & 0xFF) * 8);
temp_a0 = temp_s0->unk0;
temp_t1 = (phi_s1 + 1) & 0xFF;
phi_s1 = temp_t1;
temp_s0 = &D_80193820[var_v0 & 0xFF];
temp_a0 = temp_s0->u.s.arg3;
var_s1 = (var_s1 + 1) & 0xFF;
if ((temp_a0 & 0xF0) == 0xF0) {
func_800CB818(temp_s0);
} else {
temp_v0 = temp_s0->unk1;
if (temp_v0 < 4) {
temp_v1 = &gSequencePlayers + (temp_v0 * 0x148);
if ((temp_a0 & 0x80) != 0) {
temp_v0 = temp_s0->u.s.arg2;
if ((s32) temp_v0 < 4) {
temp_v1 = &gSequencePlayers[temp_v0];
if (temp_a0 & 0x80) {
func_800CB818(temp_s0);
} else if ((temp_a0 & 0x40) != 0) {
if (temp_a0 != 0x41) {
if (temp_a0 != 0x46) {
if (temp_a0 != 0x47) {
if (temp_a0 != 0x48) {
} else {
temp_v1->unkC = temp_s0->unk4;
}
} else {
temp_v1->unk8 = temp_s0->unk4 * 0x30;
}
} else {
(temp_v1 + temp_s0->unk3)->unk7 = temp_s0->unk4;
}
} else {
temp_v1->unk0 = temp_v1->unk0 | 4;
temp_v1->unk28 = temp_s0->unk4;
} else if (temp_a0 & 0x40) {
switch (temp_a0) { /* switch 1; irregular */
case 0x41: /* switch 1 */
temp_v1->unk0 = (u8) (temp_v1->unk0 | 4);
temp_v1->fadeVolumeScale = (bitwise f32) temp_s0->u2.as_s32;
break;
case 0x47: /* switch 1 */
temp_v1->tempo = temp_s0->u2.as_s32 * 0x30;
break;
case 0x48: /* switch 1 */
temp_v1->transposition = (s16) (s8) temp_s0->u2.pad0[0];
break;
case 0x46: /* switch 1 */
temp_v1->seqVariationEu[temp_s0->u.s.op] = (s8) temp_s0->u2.pad0[0];
break;
}
} else if ((temp_v1->unk0 >> 0x1F) != 0) {
temp_a1 = temp_s0->unk2;
if (temp_a1 < 0x10) {
temp_v0_2 = (temp_v1 + (temp_a1 * 4))->unk30;
} else if (((u32) temp_v1->unk0 >> 0x1F) != 0) {
temp_a1 = temp_s0->u.s.arg1;
if ((s32) temp_a1 < 0x10) {
temp_v0_2 = temp_v1->channels[temp_a1];
if (temp_v0_2 != &gSequenceChannelNone) {
switch (temp_a0) {
case 1:
temp_v0_2->unk1 = temp_v0_2->unk1 | 0x40;
temp_v0_2->unk20 = temp_s0->unk4;
temp_v0_2->changes.as_u8 |= 0x40;
temp_v0_2->volumeScale = (bitwise f32) temp_s0->u2.as_s32;
break;
case 2:
temp_v0_2->unk1 = temp_v0_2->unk1 | 0x40;
temp_v0_2->unk24 = temp_s0->unk4;
temp_v0_2->changes.as_u8 |= 0x40;
temp_v0_2->volume = (bitwise f32) temp_s0->u2.as_s32;
break;
case 3:
temp_v0_2->unk1 = temp_v0_2->unk1 | 0x20;
temp_v0_2->unk9 = temp_s0->unk4;
temp_v0_2->changes.as_u8 |= 0x20;
temp_v0_2->newPan = (u8) (s8) temp_s0->u2.pad0[0];
break;
case 4:
temp_v0_2->unk1 = temp_v0_2->unk1 | 0x80;
temp_v0_2->unk30 = temp_s0->unk4;
temp_v0_2->changes.as_u8 |= 0x80;
temp_v0_2->freqScale = (bitwise f32) temp_s0->u2.as_s32;
break;
case 5:
temp_v0_2->unk4 = temp_s0->unk4;
temp_v0_2->reverbVol = (u8) (s8) temp_s0->u2.pad0[0];
break;
case 6:
temp_v1_2 = temp_s0->unk3;
if (temp_v1_2 < 8) {
(temp_v0_2 + temp_v1_2)->unk58 = temp_s0->unk4;
temp_v1_2 = temp_s0->u.s.op;
if ((s32) temp_v1_2 < 8) {
temp_v0_2->soundScriptIO[temp_v1_2] = (s8) temp_s0->u2.pad0[0];
}
break;
case 8:
temp_v0_2->unk0 = ((temp_s0->unk4 * 0x10) & 0x10) | (temp_v0_2->unk0 & 0xFFEF);
temp_v0_2->unk0 = (u8) ((((s8) temp_s0->u2.pad0[0] * 0x10) & 0x10) | (temp_v0_2->unk0 & 0xFFEF));
break;
}
}
@@ -451,16 +411,15 @@ void func_800CBCB0(u32 arg0) {
}
}
}
temp_s0->unk0 = 0;
phi_v0 = temp_t1;
} while (temp_t8 != temp_t1);
var_v0 = var_s1;
temp_s0->u.s.arg3 = 0;
} while (temp_t8 != var_s1);
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/port_eu/func_800CBCB0.s")
#endif
void func_800CBF48() {
func_800CBAB4();
}
+28
View File
@@ -1,8 +1,36 @@
#ifndef AUDIO_PORT_EU_H
#define AUDIO_PORT_EU_H
#include "audio/internal.h"
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime);
void func_800CBA64(s32 playerIndex, s32 fadeInTime);
void func_800CBAB4();
void func_800CBB48(s32, s32*);
void func_800CBB88(u32, f32);
void func_800CBBB8(u32, s32);
void func_800CBBE8(u32, s8);
void func_800CBF48();
extern OSMesgQueue D_801937C0;
extern OSMesgQueue D_801937D8;
extern OSMesgQueue D_801937F0;
extern OSMesgQueue D_80193808;
extern struct EuAudioCmd D_80193820[0x100];
extern OSMesg D_80194020[];
extern OSMesg D_80194028[];
extern OSMesg D_80194038[];
extern OSMesg D_8019403C[];
extern u8 D_800EA3A0[];
extern u8 D_800EA3A4[];
extern OSMesgQueue *D_800EA3A8;
extern OSMesgQueue *D_800EA3AC;
extern OSMesgQueue *D_800EA3B0;
extern OSMesgQueue *D_800EA3B4;
extern s32 D_800EA484;
extern s32 D_800EA4A4;
#endif
+271 -322
View File
@@ -287,8 +287,7 @@ u16 m64_read_compressed_u16(struct M64ScriptState *state) {
}
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
struct Note *alloc_note(struct SequenceChannelLayer *); /* extern */
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern s16 D_803B70B4;
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
@@ -760,10 +759,7 @@ void sequence_channel_set_volume(struct SequenceChannel *seqChannel, u8 volume)
}
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
? seq_channel_layer_process_script(struct SequenceChannelLayer *); /* extern */
extern s32 gAlBankSets;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void func_800BFD90(struct SequenceChannel *seqChannel) {
u8 sp55;
s16 sp52;
@@ -780,9 +776,7 @@ void func_800BFD90(struct SequenceChannel *seqChannel) {
s32 temp_s0_5;
s32 temp_t3;
s32 temp_v0_2;
s32 temp_v1_3;
s32 temp_v1_5;
s32 temp_v1_9;
s32 temp_v1_7;
s32 var_s0;
s32 var_s0_2;
s8 var_s3;
@@ -792,18 +786,18 @@ void func_800BFD90(struct SequenceChannel *seqChannel) {
struct SequenceChannel *var_s1_2;
struct SequenceChannelLayer *temp_a0;
struct SequenceChannelLayer *temp_a0_5;
struct SequenceChannelLayer *temp_v1_8;
struct SequenceChannelLayer *temp_v1_6;
struct SequencePlayer *temp_s4;
u16 temp_a3;
u16 temp_a3_2;
u16 temp_t5;
u16 temp_v1;
u16 temp_v1_4;
u16 temp_v1_3;
u16 var_v0;
u32 temp_t6;
u32 temp_v0;
u8 *temp_v0_6;
u8 *temp_v1_7;
u8 *temp_v1_5;
u8 temp_a0_2;
u8 temp_a0_3;
u8 temp_s0_3;
@@ -813,9 +807,9 @@ void func_800BFD90(struct SequenceChannel *seqChannel) {
u8 temp_v0_5;
u8 temp_v0_7;
void *temp_v0_3;
void *temp_v1_10;
void *temp_v1_2;
void *temp_v1_6;
void *temp_v1_4;
void *temp_v1_8;
temp_v0 = seqChannel->unk0;
if ((temp_v0 >> 0x1F) != 0) {
@@ -932,9 +926,8 @@ loop_12:
}
goto loop_12;
case 0xEB: /* switch 3 */
temp_v1_3 = gAlBankSets;
temp_a3 = *(temp_v1_3 + (temp_s4->seqId * 2));
temp_s0_3 = *(((temp_a3 + *(temp_a3 + temp_v1_3)) - m64_read_u8(temp_s1)) + temp_v1_3);
temp_a3 = *(gAlBankSets + (temp_s4->seqId * 2));
temp_s0_3 = gAlBankSets[(temp_a3 + gAlBankSets[temp_a3]) - m64_read_u8(temp_s1)];
if (get_bank_or_seq(1, 2, (s32) temp_s0_3) != NULL) {
seqChannel->bankId = temp_s0_3;
}
@@ -992,9 +985,9 @@ loop_12:
seqChannel->vibratoExtentChangeDelay = 0;
goto loop_12;
case 0xD7: /* switch 3 */
temp_v1_4 = m64_read_u8(temp_s1) << 5;
seqChannel->vibratoRateTarget = temp_v1_4;
seqChannel->vibratoRateStart = temp_v1_4;
temp_v1_3 = m64_read_u8(temp_s1) << 5;
seqChannel->vibratoRateTarget = temp_v1_3;
seqChannel->vibratoRateStart = temp_v1_3;
seqChannel->vibratoRateChangeDelay = 0;
goto loop_12;
case 0xE2: /* switch 3 */
@@ -1014,9 +1007,8 @@ loop_12:
seqChannel->reverbVol = m64_read_u8(temp_s1);
goto loop_12;
case 0xC6: /* switch 3 */
temp_v1_5 = gAlBankSets;
temp_a3_2 = *(temp_v1_5 + (temp_s4->seqId * 2));
temp_s0_4 = *(((temp_a3_2 + *(temp_a3_2 + temp_v1_5)) - m64_read_u8(temp_s1)) + temp_v1_5);
temp_a3_2 = *(gAlBankSets + (temp_s4->seqId * 2));
temp_s0_4 = gAlBankSets[(temp_a3_2 + gAlBankSets[temp_a3_2]) - m64_read_u8(temp_s1)];
if (get_bank_or_seq(1, 2, (s32) temp_s0_4) != NULL) {
seqChannel->bankId = temp_s0_4;
}
@@ -1059,25 +1051,25 @@ loop_12:
case 0xE4: /* switch 3 */
if (var_s3 != -1) {
temp_s1->stack[temp_s1->depth] = temp_s1->pc;
temp_v1_6 = seqChannel->dynTable + (var_s3 * 2);
temp_v1_4 = seqChannel->dynTable + (var_s3 * 2);
temp_s1->depth += 1;
temp_s1->pc = &temp_s4->seqData[(temp_v1_6->unk1 + (temp_v1_6->unk0 << 8)) & 0xFFFF];
temp_s1->pc = &temp_s4->seqData[(temp_v1_4->unk1 + (temp_v1_4->unk0 << 8)) & 0xFFFF];
}
goto loop_12;
case 0xE6: /* switch 3 */
seqChannel->bookOffset = m64_read_u8(temp_s1);
goto loop_12;
case 0xE7: /* switch 3 */
temp_v1_7 = &temp_s4->seqData[m64_read_s16(temp_s1) & 0xFFFF];
seqChannel->muteBehavior = *temp_v1_7;
seqChannel->noteAllocPolicy = temp_v1_7[7].unk-6;
seqChannel->notePriority = temp_v1_7[7].unk-5;
seqChannel->transposition = (s16) temp_v1_7[7].unk-4;
seqChannel->newPan = temp_v1_7[7].unk-3;
seqChannel->panChannelWeight = temp_v1_7[7].unk-2;
seqChannel->reverbVol = temp_v1_7[7].unk-1;
temp_v1_5 = &temp_s4->seqData[m64_read_s16(temp_s1) & 0xFFFF];
seqChannel->muteBehavior = *temp_v1_5;
seqChannel->noteAllocPolicy = temp_v1_5[7].unk-6;
seqChannel->notePriority = temp_v1_5[7].unk-5;
seqChannel->transposition = (s16) temp_v1_5[7].unk-4;
seqChannel->newPan = temp_v1_5[7].unk-3;
seqChannel->panChannelWeight = temp_v1_5[7].unk-2;
seqChannel->reverbVol = temp_v1_5[7].unk-1;
seqChannel->changes.as_u8 |= 0x20;
seqChannel->reverbIndex = temp_v1_7[7];
seqChannel->reverbIndex = temp_v1_5[7];
goto loop_12;
case 0xE8: /* switch 3 */
seqChannel->muteBehavior = m64_read_u8(temp_s1);
@@ -1112,9 +1104,9 @@ loop_12:
temp_t0 = temp_a0_4 & 0xFF;
switch (temp_t6) { /* switch 2 */
case 0x0: /* switch 2 */
temp_v1_8 = seqChannel->layers[temp_a0_4 & 0xFF];
if (temp_v1_8 != NULL) {
var_s3 = (s8) ((u32) (*temp_v1_8 * 2) >> 0x1F);
temp_v1_6 = seqChannel->layers[temp_a0_4 & 0xFF];
if (temp_v1_6 != NULL) {
var_s3 = (s8) ((u32) (*temp_v1_6 * 2) >> 0x1F);
} else {
var_s3 = -1;
}
@@ -1123,10 +1115,10 @@ loop_12:
seqChannel->soundScriptIO[temp_a0_4 & 0xFF] = var_s3;
goto loop_12;
case 0x80: /* switch 2 */
temp_v1_9 = temp_a0_4 & 0xFF;
var_s3 = seqChannel->soundScriptIO[temp_v1_9];
if (temp_v1_9 < 4) {
seqChannel->soundScriptIO[temp_v1_9] = -1;
temp_v1_7 = temp_a0_4 & 0xFF;
var_s3 = seqChannel->soundScriptIO[temp_v1_7];
if (temp_v1_7 < 4) {
seqChannel->soundScriptIO[temp_v1_7] = -1;
}
goto loop_12;
case 0x50: /* switch 2 */
@@ -1152,8 +1144,8 @@ loop_12:
temp_a1_2 = temp_s0 & 0xF;
sp34 = temp_a1_2;
if (seq_channel_set_layer(seqChannel, temp_a1_2) != -1) {
temp_v1_10 = seqChannel->dynTable + (var_s3 * 2);
seqChannel->layers[sp34]->scriptState.pc = &temp_s4->seqData[(temp_v1_10->unk1 + (temp_v1_10->unk0 << 8)) & 0xFFFF];
temp_v1_8 = seqChannel->dynTable + (var_s3 * 2);
seqChannel->layers[sp34]->scriptState.pc = &temp_s4->seqData[(temp_v1_8->unk1 + (temp_v1_8->unk0 << 8)) & 0xFFFF];
}
}
goto loop_12;
@@ -1193,357 +1185,320 @@ GLOBAL_ASM("asm/non_matchings/audio/seqplayer/func_800BFD90.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
void audio_dma_partial_copy_async(void *, void *, void *, void *, void *); /* extern */
void func_800BB584(u8, void *, void *); /* extern */
void note_pool_clear(void *); /* extern */
void note_pool_fill(void *, s8); /* extern */
void sequence_player_init_channels(void *, s32); /* extern */
void sequence_player_disable_channels(void *, s32); /* extern */
void sequence_channel_enable(void *, s32, s32); /* extern */
void sequence_player_disable(void *, u8, s32); /* extern */
void func_800BFD90(s32); /* extern */
s32 osRecvMesg(void *, ?, ?); /* extern */
extern u8 gBankLoadStatus;
extern ? gSeqLoadStatus;
extern ? gSequenceChannelNone;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800BB584(u8, u8 **, s32 *); /* extern */
? func_800BFD90(s32); /* extern */
extern s16 D_803B70B4;
void func_800C08CC(void *arg0) {
void *sp38;
void func_800C08CC(struct SequencePlayer *arg0) {
struct NotePool *sp38;
s32 sp34;
void *sp30;
f32 temp_f16;
s16 temp_v1_3;
s16 temp_v1_5;
s32 temp_a0_6;
struct SequencePlayer *sp30;
OSMesgQueue *temp_s0;
s16 temp_v0_10;
s16 temp_v0_7;
s32 *temp_a2;
s32 temp_s2;
s32 temp_t2_2;
s32 temp_v0_13;
s32 temp_v0_3;
s32 temp_v0_5;
s32 temp_v0_7;
s32 temp_v1_4;
s32 temp_v1_8;
s8 temp_v0_12;
s8 temp_v0_6;
s8 temp_v0_9;
u16 temp_a0_2;
s32 temp_v1_3;
s32 var_s3;
s32 var_v0_3;
struct M64ScriptState *temp_s0_2;
struct NotePool *temp_a0_4;
struct SequenceChannel *temp_a0_5;
struct SequencePlayer *var_v1;
u16 temp_a0;
u16 temp_t2;
u16 temp_v0_10;
u16 temp_v0_11;
u16 temp_v1_7;
u16 temp_v1_5;
u16 var_v0_2;
u32 temp_v0;
u8 **temp_a1;
u8 *temp_v0_2;
u8 *temp_v0_3;
u8 *temp_v0_4;
u8 *temp_v1;
u8 *temp_v1_2;
u8 temp_a0;
u8 *temp_v1_6;
u8 *var_v0;
u8 temp_a0_2;
u8 temp_a0_3;
u8 temp_a0_4;
u8 temp_a1_2;
u8 temp_s2_2;
u8 temp_t9;
u8 temp_v1_6;
void *temp_a0_5;
void *temp_a1;
void *temp_a2;
void *temp_s0;
void *temp_s0_2;
void *temp_v0_8;
u8 phi_a0;
u8 *phi_v0;
s32 phi_s3;
s16 phi_v0_2;
void *phi_v1;
s32 phi_v0_3;
u8 temp_v0_11;
u8 temp_v0_4;
u8 temp_v0_8;
u8 temp_v0_9;
u8 temp_v1_4;
u8 var_a0;
void *temp_v0_6;
temp_v0 = arg0->unk0;
if ((temp_v0 >> 0x1F) != 0) {
if (((temp_v0 * 0x10) >> 0x1F) == 1) {
temp_s0 = arg0 + 0x108;
if (osRecvMesg(temp_s0, 0, 0) != -1) {
temp_a1 = arg0 + 0x13C;
temp_a2 = arg0 + 0x144;
if (arg0->unk144 == 0) {
arg0->unk0 = arg0->unk0 & 0xFFF7;
func_800BB584(arg0->unk6, temp_a1, temp_a2);
temp_v0_2 = arg0->unk6 + &gBankLoadStatus;
if (((u32) (temp_v0 * 0x10) >> 0x1F) == 1) {
temp_s0 = &arg0->bankDmaMesgQueue;
if (osRecvMesg(temp_s0, NULL, 0) != -1) {
temp_a1 = &arg0->bankDmaCurrMemAddr;
temp_a2 = &arg0->bankDmaRemaining;
if (arg0->bankDmaRemaining == 0) {
arg0->unk0 = (s8) ((u8) arg0->unk0 & 0xFFF7);
func_800BB584(arg0->loadingBankId, temp_a1, temp_a2);
temp_v0_2 = &gBankLoadStatus[arg0->loadingBankId];
if (*temp_v0_2 != 5) {
*temp_v0_2 = 2;
return;
}
/* Duplicate return node #110. Try simplifying control flow for better match */
return;
} else {
audio_dma_partial_copy_async(&arg0->bankDmaCurrDevAddr, temp_a1, temp_a2, temp_s0, &arg0->bankDmaIoMesg);
}
audio_dma_partial_copy_async(arg0 + 0x140, temp_a1, temp_a2, temp_s0, arg0 + 0x124);
return;
}
/* Duplicate return node #110. Try simplifying control flow for better match */
return;
}
if (((temp_v0 * 8) >> 0x1F) == 1) {
if (osRecvMesg(arg0 + 0xD4, 0, 0) != -1) {
arg0->unk0 = arg0->unk0 & 0xFFEF;
temp_v1 = arg0->unk4 + &gSeqLoadStatus;
} else if (((u32) (temp_v0 * 8) >> 0x1F) == 1) {
if (osRecvMesg(&arg0->seqDmaMesgQueue, NULL, 0) != -1) {
arg0->unk0 = (s8) ((u8) arg0->unk0 & 0xFFEF);
temp_v1 = &gSeqLoadStatus[arg0->seqId];
if (*temp_v1 != 5) {
*temp_v1 = 2;
}
goto block_11;
}
/* Duplicate return node #110. Try simplifying control flow for better match */
return;
}
} else {
block_11:
temp_v1_2 = arg0->unk4 + &gSeqLoadStatus;
temp_a1_2 = *temp_v1_2;
if ((temp_a1_2 < 2) || (temp_v0_3 = arg0->unk5 + &gBankLoadStatus, temp_a0 = *temp_v0_3, phi_a0 = temp_a0, phi_v0 = temp_v0_3, ((temp_a0 < 2) != 0))) {
sequence_player_disable(arg0, temp_a1_2, 5);
return;
}
if (temp_a1_2 != 5) {
*temp_v1_2 = 2;
temp_v0_4 = arg0->unk5 + &gBankLoadStatus;
phi_a0 = *temp_v0_4;
phi_v0 = temp_v0_4;
}
if (phi_a0 != 5) {
*phi_v0 = 2;
}
if (((arg0->unk0 * 4) >= 0) || ((arg0->unk3 & 0x80) == 0)) {
temp_t2 = arg0->unkA + arg0->unk8;
arg0->unkA = temp_t2;
temp_v1_3 = D_803B70B4;
temp_v0_5 = temp_t2 & 0xFFFF;
if (temp_v0_5 >= temp_v1_3) {
temp_a0_2 = arg0->unkE;
arg0->unkA = temp_v0_5 - temp_v1_3;
if (temp_a0_2 >= 2) {
arg0->unkE = temp_a0_2 - 1;
} else {
temp_s0_2 = arg0 + 0x70;
arg0->unk0 = arg0->unk0 | 4;
phi_s3 = sp58;
loop_24:
temp_v0_6 = m64_read_u8(temp_s0_2);
temp_s2 = temp_v0_6 & 0xFF;
if (temp_v0_6 == 0xFF) {
temp_a0_3 = temp_s0_2->unk18;
if (temp_a0_3 == 0) {
sequence_player_disable(arg0);
} else {
temp_t9 = (temp_a0_3 - 1) & 0xFF;
temp_s0_2->unk18 = temp_t9;
temp_s0_2->unk0 = (temp_s0_2 + (temp_t9 * 4))->unk4;
goto block_28;
}
temp_v1_2 = &gSeqLoadStatus[arg0->seqId];
temp_a1_2 = *temp_v1_2;
if (((s32) temp_a1_2 < 2) || (var_v0 = &gBankLoadStatus[arg0->defaultBank[0]], var_a0 = *var_v0, (((s32) var_a0 < 2) != 0))) {
sequence_player_disable(arg0);
return;
}
if (temp_a1_2 != 5) {
*temp_v1_2 = 2;
var_v0 = &gBankLoadStatus[arg0->defaultBank[0]];
var_a0 = *var_v0;
}
if (var_a0 != 5) {
*var_v0 = 2;
}
if (!(arg0->unk0 & 0x20000000) || !(arg0->muteBehavior & 0x80)) {
temp_t2 = arg0->tempoAcc + arg0->tempo;
arg0->tempoAcc = temp_t2;
temp_v0_3 = temp_t2 & 0xFFFF;
if (temp_v0_3 >= D_803B70B4) {
temp_a0 = arg0->delay;
arg0->tempoAcc = temp_v0_3 - D_803B70B4;
if ((s32) temp_a0 >= 2) {
arg0->delay = temp_a0 - 1;
} else {
block_28:
temp_v1_4 = temp_v0_6 & 0xFF;
temp_v0_7 = temp_v1_4 & 0xF0;
if (temp_v1_4 == 0xFD) {
arg0->unkE = m64_read_compressed_u16(temp_s0_2);
} else if (temp_v1_4 == 0xFE) {
arg0->unkE = 1;
temp_s0_2 = &arg0->scriptState;
arg0->unk0 = (s8) ((u8) arg0->unk0 | 4);
var_s3 = sp58;
loop_24:
temp_v0_4 = m64_read_u8(temp_s0_2);
temp_s2 = temp_v0_4 & 0xFF;
if (temp_v0_4 == 0xFF) {
temp_a0_2 = temp_s0_2->depth;
if (temp_a0_2 == 0) {
sequence_player_disable(arg0);
} else {
temp_t9 = (temp_a0_2 - 1) & 0xFF;
temp_s0_2->depth = temp_t9;
temp_s0_2->pc = temp_s0_2->stack[temp_t9];
goto block_28;
}
} else {
if (temp_v1_4 >= 0xC0) {
switch (temp_v1_4) { /* switch 1 */
case 0xFC: /* switch 1 */
block_28:
temp_v1_3 = temp_v0_4 & 0xFF;
temp_v0_5 = temp_v1_3 & 0xF0;
if (temp_v1_3 == 0xFD) {
arg0->delay = m64_read_compressed_u16(temp_s0_2);
} else if (temp_v1_3 == 0xFE) {
arg0->delay = 1;
} else {
switch (temp_v1_3) { /* switch 3; irregular */
case 0xFC: /* switch 3 */
temp_t2_2 = m64_read_s16(temp_s0_2) & 0xFFFF;
(temp_s0_2 + (temp_s0_2->unk18 * 4))->unk4 = temp_s0_2->unk0;
temp_s0_2->unk18 = temp_s0_2->unk18 + 1;
temp_s0_2->unk0 = arg0->unk14 + temp_t2_2;
temp_s0_2->stack[temp_s0_2->depth] = temp_s0_2->pc;
temp_s0_2->depth += 1;
temp_s0_2->pc = &arg0->seqData[temp_t2_2];
break;
case 0xF8: /* switch 1 */
(temp_s0_2 + temp_s0_2->unk18)->unk14 = m64_read_u8(temp_s0_2);
(temp_s0_2 + (temp_s0_2->unk18 * 4))->unk4 = temp_s0_2->unk0;
temp_s0_2->unk18 = temp_s0_2->unk18 + 1;
case 0xF8: /* switch 3 */
temp_s0_2->remLoopIters[temp_s0_2->depth] = m64_read_u8(temp_s0_2);
temp_s0_2->stack[temp_s0_2->depth] = temp_s0_2->pc;
temp_s0_2->depth += 1;
break;
case 0xF7: /* switch 1 */
temp_v0_8 = temp_s0_2 + temp_s0_2->unk18;
temp_v0_8->unk13 = temp_v0_8->unk13 - 1;
temp_a0_4 = temp_s0_2->unk18;
if ((temp_s0_2 + temp_a0_4)->unk13 != 0) {
temp_s0_2->unk0 = *(temp_s0_2 + (temp_a0_4 * 4));
case 0xF7: /* switch 3 */
temp_v0_6 = temp_s0_2 + temp_s0_2->depth;
temp_v0_6->unk13 = (u8) (temp_v0_6->unk13 - 1);
temp_a0_3 = temp_s0_2->depth;
if ((temp_s0_2 + temp_a0_3)->unk13 != 0) {
temp_s0_2->pc = *(temp_s0_2 + (temp_a0_3 * 4));
} else {
temp_s0_2->unk18 = temp_a0_4 - 1;
temp_s0_2->depth = temp_a0_3 - 1;
}
break;
case 0xF5: /* switch 1 */
case 0xF9: /* switch 1 */
case 0xFA: /* switch 1 */
case 0xFB: /* switch 1 */
if (((temp_s2 != 0xFA) || (phi_s3 == 0)) && ((temp_s2 != 0xF9) || (phi_s3 < 0)) && ((temp_s2 != 0xF5) || (phi_s3 >= 0))) {
temp_s0_2->unk0 = arg0->unk14 + (m64_read_s16(temp_s0_2) & 0xFFFF);
case 0xF5: /* switch 3 */
case 0xF9: /* switch 3 */
case 0xFA: /* switch 3 */
case 0xFB: /* switch 3 */
temp_v0_7 = m64_read_s16(temp_s0_2);
if (((temp_s2 != 0xFA) || (var_s3 == 0)) && ((temp_s2 != 0xF9) || (var_s3 < 0)) && ((temp_s2 != 0xF5) || (var_s3 >= 0))) {
temp_s0_2->pc = &arg0->seqData[temp_v0_7 & 0xFFFF];
}
break;
case 0xF2: /* switch 1 */
case 0xF3: /* switch 1 */
case 0xF4: /* switch 1 */
if (((temp_s2 != 0xF3) || (phi_s3 == 0)) && ((temp_s2 != 0xF2) || (phi_s3 < 0))) {
temp_s0_2->unk0 = temp_s0_2->unk0 + m64_read_u8(temp_s0_2);
case 0xF2: /* switch 3 */
case 0xF3: /* switch 3 */
case 0xF4: /* switch 3 */
temp_v0_8 = m64_read_u8(temp_s0_2);
if (((temp_s2 != 0xF3) || (var_s3 == 0)) && ((temp_s2 != 0xF2) || (var_s3 < 0))) {
temp_s0_2->pc = &temp_s0_2->pc[(s8) temp_v0_8];
}
break;
case 0xF1: /* switch 1 */
temp_a0_5 = arg0 + 0x94;
sp38 = temp_a0_5;
note_pool_clear(temp_a0_5);
note_pool_fill(temp_a0_5, m64_read_u8(temp_s0_2));
case 0xF1: /* switch 3 */
temp_a0_4 = &arg0->notePool;
sp38 = temp_a0_4;
note_pool_clear(temp_a0_4);
note_pool_fill(temp_a0_4, m64_read_u8(temp_s0_2));
break;
case 0xF0: /* switch 1 */
note_pool_clear(arg0 + 0x94);
case 0xF0: /* switch 3 */
note_pool_clear(&arg0->notePool);
break;
case 0xDF: /* switch 1 */
arg0->unkC = 0;
case 0xDF: /* switch 3 */
arg0->transposition = 0;
/* fallthrough */
case 0xDE: /* switch 1 */
arg0->unkC = arg0->unkC + m64_read_u8(temp_s0_2);
case 0xDE: /* switch 3 */
arg0->transposition += m64_read_u8(temp_s0_2);
break;
case 0xDC: /* switch 1 */
case 0xDD: /* switch 1 */
case 0xDC: /* switch 3 */
case 0xDD: /* switch 3 */
temp_v0_9 = m64_read_u8(temp_s0_2);
if (temp_s2 == 0xDD) {
arg0->unk8 = (temp_v0_9 & 0xFF) * 0x30;
arg0->tempo = (temp_v0_9 & 0xFF) * 0x30;
} else {
arg0->unk8 = arg0->unk8 + (temp_v0_9 * 0x30);
arg0->tempo += (s8) temp_v0_9 * 0x30;
}
temp_v1_5 = D_803B70B4;
temp_v0_10 = arg0->unk8;
phi_v0_2 = temp_v0_10;
if (temp_v1_5 < temp_v0_10) {
arg0->unk8 = temp_v1_5;
phi_v0_2 = temp_v1_5 & 0xFFFF;
var_v0_2 = arg0->tempo;
if (D_803B70B4 < (s32) var_v0_2) {
arg0->tempo = (u16) D_803B70B4;
var_v0_2 = D_803B70B4 & 0xFFFF;
}
if (phi_v0_2 <= 0) {
arg0->unk8 = 1;
if ((s16) var_v0_2 <= 0) {
arg0->tempo = 1;
}
break;
case 0xDA: /* switch 1 */
case 0xDA: /* switch 3 */
temp_s2_2 = m64_read_u8(temp_s0_2) & 0xFF;
temp_v0_11 = m64_read_s16(temp_s0_2);
if ((temp_s2_2 != 0) && (temp_s2_2 != 1)) {
if (temp_s2_2 != 2) {
} else {
temp_f16 = temp_v0_11 & 0xFFFF;
arg0->unk10 = temp_v0_11;
arg0->unk1 = temp_s2_2;
arg0->unk1C = (0.0f - arg0->unk18) / temp_f16;
temp_v0_10 = m64_read_s16(temp_s0_2);
switch (temp_s2_2) { /* switch 4; irregular */
case 0: /* switch 4 */
case 1: /* switch 4 */
if (arg0->state != 2) {
arg0->fadeTimerUnkEu = (u16) temp_v0_10;
arg0->state = temp_s2_2;
}
} else if (arg0->unk1 != 2) {
arg0->unk12 = temp_v0_11;
arg0->unk1 = temp_s2_2;
break;
case 2: /* switch 4 */
arg0->fadeRemainingFrames = (u16) temp_v0_10;
arg0->state = temp_s2_2;
arg0->fadeVelocity = (0.0f - arg0->fadeVolume) / (f32) (temp_v0_10 & 0xFFFF);
break;
}
break;
case 0xDB: /* switch 1 */
temp_v0_12 = m64_read_u8(temp_s0_2);
temp_v1_6 = arg0->unk1;
if (temp_v1_6 != 0) {
if (temp_v1_6 != 1) {
if (temp_v1_6 != 2) {
}
case 0xDB: /* switch 3 */
temp_v0_11 = m64_read_u8(temp_s0_2);
temp_v1_4 = arg0->state;
switch (temp_v1_4) { /* switch 5; irregular */
case 2: /* switch 5 */
break;
case 1: /* switch 5 */
arg0->state = 0;
arg0->fadeVolume = 0.0f;
/* fallthrough */
case 0: /* switch 5 */
temp_v1_5 = arg0->fadeTimerUnkEu;
arg0->fadeRemainingFrames = temp_v1_5;
if (temp_v1_5 != 0) {
arg0->fadeVelocity = (((f32) temp_v0_11 / 127.0f) - arg0->fadeVolume) / (f32) (temp_v1_5 & 0xFFFF);
} else {
arg0->unk1 = 0;
arg0->unk18 = 0.0f;
goto block_76;
}
} else {
block_76:
temp_v1_7 = arg0->unk12;
arg0->unk10 = temp_v1_7;
if (temp_v1_7 != 0) {
arg0->unk1C = ((temp_v0_12 / 127.0f) - arg0->unk18) / (temp_v1_7 & 0xFFFF);
} else {
arg0->unk18 = temp_v0_12 / 127.0f;
arg0->fadeVolume = (f32) temp_v0_11 / 127.0f;
}
break;
}
break;
case 0xD9: /* switch 1 */
arg0->unk28 = m64_read_u8(temp_s0_2) / 127.0f;
case 0xD9: /* switch 3 */
arg0->fadeVolumeScale = (f32) m64_read_u8(temp_s0_2) / 127.0f;
break;
case 0xD7: /* switch 1 */
case 0xD7: /* switch 3 */
sequence_player_init_channels(arg0, m64_read_s16(temp_s0_2) & 0xFFFF);
break;
case 0xD6: /* switch 1 */
case 0xD6: /* switch 3 */
sequence_player_disable_channels(arg0, m64_read_s16(temp_s0_2) & 0xFFFF);
break;
case 0xD5: /* switch 1 */
arg0->unk24 = m64_read_u8(temp_s0_2) / 127.0f;
case 0xD5: /* switch 3 */
arg0->muteVolumeScale = (f32) m64_read_u8(temp_s0_2) / 127.0f;
break;
case 0xD4: /* switch 1 */
arg0->unk0 = arg0->unk0 | 0x20;
case 0xD4: /* switch 3 */
arg0->unk0 = (s8) ((u8) arg0->unk0 | 0x20);
break;
case 0xD3: /* switch 1 */
arg0->unk3 = m64_read_u8(temp_s0_2);
case 0xD3: /* switch 3 */
arg0->muteBehavior = m64_read_u8(temp_s0_2);
break;
case 0xD1: /* switch 1 */
case 0xD2: /* switch 1 */
temp_v1_8 = arg0->unk14 + (m64_read_s16(temp_s0_2) & 0xFFFF);
case 0xD1: /* switch 3 */
case 0xD2: /* switch 3 */
temp_v1_6 = &arg0->seqData[m64_read_s16(temp_s0_2) & 0xFFFF];
if (temp_s2 == 0xD2) {
arg0->unk8C = temp_v1_8;
arg0->shortNoteVelocityTable = temp_v1_6;
} else {
arg0->unk90 = temp_v1_8;
arg0->shortNoteDurationTable = temp_v1_6;
}
break;
case 0xD0: /* switch 1 */
arg0->unk2 = m64_read_u8(temp_s0_2);
case 0xD0: /* switch 3 */
arg0->noteAllocPolicy = m64_read_u8(temp_s0_2);
break;
case 0xCC: /* switch 1 */
phi_s3 = m64_read_u8(temp_s0_2);
case 0xCC: /* switch 3 */
var_s3 = m64_read_u8(temp_s0_2);
break;
case 0xC9: /* switch 1 */
phi_s3 &= m64_read_u8(temp_s0_2);
case 0xC9: /* switch 3 */
var_s3 &= m64_read_u8(temp_s0_2);
break;
case 0xC8: /* switch 1 */
phi_s3 -= m64_read_u8(temp_s0_2);
case 0xC8: /* switch 3 */
var_s3 -= m64_read_u8(temp_s0_2);
break;
}
} else if (temp_v0_7 >= 0x11) {
if (temp_v0_7 >= 0x21) {
switch (temp_v0_7) { /* switch 2 */
case 0x50: /* switch 2 */
phi_s3 -= arg0->unk7;
default: /* switch 3 */
switch (temp_v0_5) { /* switch 6; irregular */
case 0x0: /* switch 6 */
var_s3 = (s32) ((u32) (*arg0->channels[temp_v1_3 & 0xF] * 2) >> 0x1F);
break;
case 0x70: /* switch 2 */
arg0->unk7 = phi_s3;
case 0x50: /* switch 6 */
var_s3 -= arg0->seqVariationEu[0];
break;
case 0x80: /* switch 2 */
phi_s3 = arg0->unk7;
case 0x70: /* switch 6 */
arg0->seqVariationEu[0] = (s8) var_s3;
break;
case 0x90: /* switch 2 */
sequence_channel_enable(arg0, temp_s2 & 0xF, arg0->unk14 + (m64_read_s16(temp_s0_2) & 0xFFFF));
case 0x80: /* switch 6 */
var_s3 = (s32) arg0->seqVariationEu[0];
break;
case 0x90: /* switch 6 */
sequence_channel_enable(arg0, temp_s2 & 0xF, &arg0->seqData[m64_read_s16(temp_s0_2) & 0xFFFF]);
break;
}
} else if (temp_v0_7 != 0x20) {
break;
}
} else if (temp_v0_7 != 0) {
if (temp_v0_7 != 0x10) {
}
} else {
phi_s3 = (*(arg0 + ((temp_v1_4 & 0xF) * 4))->unk30 * 2) >> 0x1F;
goto loop_24;
}
goto loop_24;
}
}
var_v1 = arg0;
var_v0_3 = 0;
do {
temp_a0_5 = var_v1->channels[0];
if (((s32) &gSequenceChannelNone != (s32) temp_a0_5) == 1) {
sp34 = var_v0_3;
sp30 = var_v1;
func_800BFD90((s32) temp_a0_5);
}
var_v0_3 += 4;
var_v1 += 4;
} while (var_v0_3 != 0x00000040);
}
phi_v1 = arg0;
phi_v0_3 = 0;
do {
temp_a0_6 = phi_v1->unk30;
if ((&gSequenceChannelNone != temp_a0_6) == 1) {
sp34 = phi_v0_3;
sp30 = phi_v1;
func_800BFD90(temp_a0_6);
}
temp_v0_13 = phi_v0_3 + 4;
phi_v1 += 4;
phi_v0_3 = temp_v0_13;
} while (temp_v0_13 != 0x40);
}
}
/* Duplicate return node #110. Try simplifying control flow for better match */
}
}
#else
@@ -1551,26 +1506,20 @@ GLOBAL_ASM("asm/non_matchings/audio/seqplayer/func_800C08CC.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void process_notes(); // extern
void sequence_player_process_sound(u32 *); // extern
void func_800C08CC(u32 *); // extern
extern u32 gSequencePlayers;
extern ? gSequenceChannels;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C08CC(struct SequencePlayer *); /* extern */
void func_800C1138(s32 arg0) {
u32 *temp_s0;
u32 *phi_s0;
struct SequencePlayer *var_s0;
phi_s0 = &gSequencePlayers;
var_s0 = gSequencePlayers;
do {
if ((*phi_s0 >> 0x1F) == 1) {
func_800C08CC(phi_s0);
sequence_player_process_sound(phi_s0);
if (((u32) *var_s0 >> 0x1F) == 1) {
func_800C08CC(var_s0);
sequence_player_process_sound(var_s0);
}
temp_s0 = phi_s0 + 0x148;
phi_s0 = temp_s0;
} while (temp_s0 != &gSequenceChannels);
var_s0 += 0x148;
} while (var_s0 != gSequenceChannels);
process_notes();
}
#else
+55 -77
View File
@@ -158,29 +158,26 @@ void synthesis_load_note_subs_eu(s32 updateIndex) {
}
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
Acmd *func_800B775C(s16 *, s16, Acmd *, s32); /* extern */
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
Acmd *func_800B775C(s16 *, s32, Acmd *, s32); /* extern */
? func_800C1138(s16); /* extern */
? prepare_reverb_ring_buffer(s16, s32, s32); /* extern */
Acmd *func_800B70EC(Acmd *acmd, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
void *func_800B70EC(Acmd *acmd, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
Acmd *temp_v0;
Acmd *var_fp;
s16 *var_s7;
s16 temp_s0;
s16 temp_v1;
s16 temp_v1_2;
s16 temp_s2;
s16 var_s4;
s16 var_s4_2;
s32 temp_lo;
s32 var_s1;
s32 var_s3;
s32 var_s6;
s8 temp_v0_2;
struct SynthesisReverb *var_s0;
struct SynthesisReverb *var_s0_2;
u8 temp_t4;
u8 temp_v0_3;
u8 temp_v0_2;
var_s4 = gAudioBufferParameters.updatesPerFrame;
var_s6 = bufLen;
@@ -199,52 +196,48 @@ Acmd *func_800B70EC(Acmd *acmd, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
var_fp = acmd + 8;
if (var_s4_2 > 0) {
do {
temp_s2 = gAudioBufferParameters.updatesPerFrame;
var_s1 = 0;
if (var_s4_2 == 1) {
var_s3 = var_s6;
} else {
temp_lo = var_s6 / var_s4_2;
temp_v1 = gAudioBufferParameters.samplesPerUpdateMax;
if (temp_lo >= temp_v1) {
var_s3 = (s32) temp_v1;
if (temp_lo >= gAudioBufferParameters.samplesPerUpdateMax) {
var_s3 = (s32) gAudioBufferParameters.samplesPerUpdateMax;
} else if (gAudioBufferParameters.samplesPerUpdateMin >= temp_lo) {
var_s3 = (s32) gAudioBufferParameters.samplesPerUpdateMin;
} else {
temp_v1_2 = gAudioBufferParameters.samplesPerUpdateMin;
if (temp_v1_2 >= temp_lo) {
var_s3 = (s32) temp_v1_2;
} else {
var_s3 = (s32) gAudioBufferParameters.samplesPerUpdate;
}
var_s3 = (s32) gAudioBufferParameters.samplesPerUpdate;
}
}
if (gNumSynthesisReverbs > 0) {
var_s0 = gSynthesisReverbs;
do {
if (var_s0->useReverb != 0) {
prepare_reverb_ring_buffer((s16) var_s3, gAudioBufferParameters.updatesPerFrame - var_s4_2, var_s1);
prepare_reverb_ring_buffer(var_s3, temp_s2 - var_s4_2, var_s1);
}
var_s1 += 1;
var_s0 += 0x108;
} while (var_s1 < gNumSynthesisReverbs);
}
temp_v0 = func_800B775C(var_s7, (s16) var_s3, var_fp, gAudioBufferParameters.updatesPerFrame - var_s4_2);
temp_v0 = func_800B775C(var_s7, var_s3, var_fp, temp_s2 - var_s4_2);
var_s4_2 -= 1;
var_fp = temp_v0;
var_s6 -= var_s3;
var_s7 += var_s3 * 4;
} while (var_s4_2 > 0);
}
temp_v0_2 = gNumSynthesisReverbs;
var_s0_2 = gSynthesisReverbs;
if (temp_v0_2 > 0) {
if (gNumSynthesisReverbs > 0) {
do {
temp_v0_3 = var_s0_2->framesLeftToIgnore;
if (temp_v0_3 != 0) {
var_s0_2->framesLeftToIgnore = temp_v0_3 - 1;
temp_v0_2 = var_s0_2->framesLeftToIgnore;
if (temp_v0_2 != 0) {
var_s0_2->framesLeftToIgnore = temp_v0_2 - 1;
}
temp_t4 = var_s0_2->curFrame;
var_s0_2 += 0x108;
var_s0_2->unk-105 = (s8) (temp_t4 ^ 1);
} while ((u32) var_s0_2 < (u32) &gSynthesisReverbs[temp_v0_2]);
} while ((u32) var_s0_2 < (u32) &gSynthesisReverbs[gNumSynthesisReverbs]);
}
*writtenCmds = (s32) (var_fp - acmd) >> 3;
return var_fp;
@@ -310,8 +303,9 @@ Acmd *synthesis_load_reverb_samples(Acmd *acmd, s16 reverbIndex, s16 updateIndex
}
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
Acmd *func_800B7C30(u8, struct NoteSub *, struct NoteSynthesisState *, s16 *, s32, Acmd *, s32); /* extern */
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
Acmd *func_800B7C30(u8, struct NoteSubEu *, struct NoteSynthesisState *, s16 *, s32, Acmd *, s32); /* extern */
extern u8 gUseReverb;
Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
? sp84;
@@ -321,9 +315,6 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
Acmd *var_s4;
s16 var_s2;
s16 var_s3;
s32 temp_a0;
s32 temp_a0_2;
s32 temp_a0_3;
s32 temp_lo;
s32 temp_lo_2;
s32 temp_t3_2;
@@ -332,14 +323,11 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
s8 *temp_t4;
s8 *temp_t5;
s8 *temp_t8;
s8 temp_t1;
s8 var_s1;
s8 var_s1_2;
struct NoteSub *temp_t0;
struct NoteSub *temp_t0_2;
struct NoteSub *temp_v0;
struct NoteSub *temp_v0_2;
struct NoteSub *var_v0;
struct NoteSubEu *temp_v0;
struct NoteSubEu *temp_v0_2;
struct NoteSubEu *var_v0;
struct SynthesisReverb *temp_t9;
u8 *var_s0;
u8 *var_s0_2;
@@ -348,13 +336,11 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
u8 temp_v1;
u8 temp_v1_2;
temp_t1 = gNumSynthesisReverbs;
var_s2 = 0;
if (temp_t1 == 0) {
temp_a0 = gMaxSimultaneousNotes;
if (gNumSynthesisReverbs == 0) {
var_s1 = 0;
if (temp_a0 > 0) {
var_v0 = &gNoteSubsEu[temp_a0 * updateIndex];
if (gMaxSimultaneousNotes > 0) {
var_v0 = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex];
do {
temp_t4 = &sp84 + var_s2;
if (((u32) *var_v0 >> 0x1F) != 0) {
@@ -363,18 +349,17 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
}
var_s1 += 1;
var_v0 += 0x10;
} while (var_s1 < temp_a0);
} while (var_s1 < gMaxSimultaneousNotes);
var_s1 = 0;
}
var_s3 = 0;
} else {
var_s3 = 0;
if (temp_t1 > 0) {
temp_a0_2 = gMaxSimultaneousNotes;
if (gNumSynthesisReverbs > 0) {
do {
var_s1_2 = 0;
if (temp_a0_2 > 0) {
var_v1 = temp_a0_2 * updateIndex;
if (gMaxSimultaneousNotes > 0) {
var_v1 = gMaxSimultaneousNotes * updateIndex;
do {
temp_v0 = &gNoteSubsEu[var_v1];
if (((u32) temp_v0->unk0 >> 0x1F) != 0) {
@@ -386,28 +371,27 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
}
var_s1_2 += 1;
var_v1 += 1;
} while (var_s1_2 < temp_a0_2);
} while (var_s1_2 < gMaxSimultaneousNotes);
}
var_s3 += 1;
} while (var_s3 < temp_t1);
} while (var_s3 < gNumSynthesisReverbs);
var_s3 = 0;
}
temp_a0_3 = gMaxSimultaneousNotes;
var_s1 = 0;
if (temp_a0_3 > 0) {
var_v1_2 = temp_a0_3 * updateIndex;
if (gMaxSimultaneousNotes > 0) {
var_v1_2 = gMaxSimultaneousNotes * updateIndex;
do {
temp_v0_2 = &gNoteSubsEu[var_v1_2];
if (((u32) temp_v0_2->unk0 >> 0x1F) != 0) {
temp_t8 = &sp84 + var_s2;
if ((s32) ((u8) temp_v0_2->unk1 >> 5) >= temp_t1) {
if ((s32) ((u8) temp_v0_2->unk1 >> 5) >= gNumSynthesisReverbs) {
var_s2 += 1;
*temp_t8 = var_s1;
}
}
var_s1 += 1;
var_v1_2 += 1;
} while (var_s1 < temp_a0_3);
} while (var_s1 < gMaxSimultaneousNotes);
var_s1 = 0;
}
}
@@ -419,7 +403,7 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
temp_t9 = &gSynthesisReverbs[var_s3];
sp64 = temp_t9;
temp_t3 = temp_t9->useReverb;
gUseReverb = (s8) temp_t3;
gUseReverb = temp_t3;
if ((s8) temp_t3 != 0) {
var_s4 = synthesis_resample_and_mix_reverb(var_s4, bufLen, var_s3, (s16) updateIndex);
}
@@ -427,11 +411,10 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
var_s0 = var_s1 + &sp84;
loop_31:
temp_v1 = *var_s0;
temp_t0 = gNoteSubsEu;
temp_lo = updateIndex * gMaxSimultaneousNotes;
if (var_s3 == ((u8) (&temp_t0[temp_v1])[temp_lo].unk1 >> 5)) {
if (var_s3 == ((u8) (&gNoteSubsEu[temp_v1])[temp_lo].unk1 >> 5)) {
var_s1 += 1;
var_s4 = func_800B7C30(temp_v1, &temp_t0[temp_v1 + temp_lo], &gNotes[temp_v1].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
var_s4 = func_800B7C30(temp_v1, &gNoteSubsEu[temp_v1 + temp_lo], &gNotes[temp_v1].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
var_s0 += 1;
if (var_s1 < var_s2) {
goto loop_31;
@@ -448,11 +431,10 @@ loop_31:
var_s0_2 = var_s1 + &sp84;
do {
temp_v1_2 = *var_s0_2;
temp_t0_2 = gNoteSubsEu;
temp_lo_2 = updateIndex * gMaxSimultaneousNotes;
temp_a1 = (&temp_t0_2[temp_v1_2])[temp_lo_2].bankId;
temp_a1 = (&gNoteSubsEu[temp_v1_2])[temp_lo_2].bankId;
if ((((s32) gBankLoadStatus[temp_a1] < 2) ^ 1) == 1) {
var_s4 = func_800B7C30(temp_v1_2, &temp_t0_2[temp_v1_2 + temp_lo_2], &gNotes[temp_v1_2].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
var_s4 = func_800B7C30(temp_v1_2, &gNoteSubsEu[temp_v1_2 + temp_lo_2], &gNotes[temp_v1_2].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
} else {
gAudioErrorFlags = temp_a1 + (var_s1 << 8) + 0x10000000;
}
@@ -476,21 +458,17 @@ GLOBAL_ASM("asm/non_matchings/audio/synthesis/func_800B775C.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
Acmd *load_wave_samples(Acmd *, struct NoteSubEu *, struct NoteSynthesisState *, u32); /* extern */
s32 final_resample(Acmd *, struct NoteSynthesisState *, s32, u16, s32, s32); /* extern */
Acmd *func_800B86A0(s32, struct NoteSubEu *, struct NoteSynthesisState *, s32, s32, s32, s32); /* extern */
Acmd *note_apply_headset_pan_effects(Acmd *, struct NoteSubEu *, struct NoteSynthesisState *, s32, s32, s32); /* extern */
s32 func_800BAD0C(s32, s32, s32, u8 *); /* extern */
extern ? gUnknownData_800F6290;
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
Acmd *func_800B86A0(Acmd *, struct NoteSubEu *, struct NoteSynthesisState *, s32, s32, s32, u32); /* extern */
s32 func_800BAD0C(s32, s32, u32, u8 *); /* extern */
Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
void *sp130;
void *sp12C;
? *sp128;
s32 *sp128;
s32 sp11C;
s32 sp118;
s32 sp114;
u32 sp114;
u16 sp112;
s32 spFC;
s32 spEC;
@@ -503,7 +481,7 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
u16 sp9E;
struct Note *sp8C;
u32 sp50;
? *temp_a2_2;
Acmd *temp_a0_2;
Acmd *temp_s2;
Acmd *temp_s2_2;
Acmd *temp_s2_3;
@@ -516,8 +494,8 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
Acmd *var_s2;
Acmd *var_s2_2;
s16 var_t1;
s32 *temp_a2_2;
s32 temp_a0;
s32 temp_a0_2;
s32 temp_a1_2;
s32 temp_a1_3;
s32 temp_a2;
@@ -544,15 +522,15 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
s32 var_t2;
s32 var_t3;
s32 var_t4;
s32 var_v1;
s32 var_v1_3;
u16 temp_t7;
u16 temp_v0;
u32 temp_s0;
u32 temp_t7_3;
u32 var_t5;
u32 var_t6;
u32 var_v1;
u32 var_v1_2;
u32 var_v1_3;
void *temp_a1;
void *temp_t7_2;
void *temp_t9;
@@ -578,7 +556,7 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
temp_s0 = temp_v0 >> 0x10;
var_a0 = noteSubEu->unk0;
if (var_a0 & 0x20000) {
temp_v0_2 = load_wave_samples(acmd, noteSubEu, synthesisState, temp_s0);
temp_v0_2 = load_wave_samples(acmd, noteSubEu, synthesisState, (s32) temp_s0);
temp_a2 = synthesisState->samplePosInt;
sp9E = (temp_a2 * 2) + 0x1A0;
synthesisState->samplePosInt = temp_a2 + temp_s0;
@@ -619,7 +597,7 @@ loop_6:
sp128 = temp_a2_2;
}
if (((u32) (var_a0 << 0xB) >> 0x1D) != 0) {
sp128 = &gUnknownData_800F6290;
sp128 = gUnknownData_800F6290;
}
if (var_t5 != 0) {
loop_15:
@@ -810,7 +788,7 @@ block_60:
}
temp_a2_4 = bufLen * 2;
sp114 = var_v1_3;
temp_a0_2 = final_resample(acmd, synthesisState, temp_a2_4, sp112, (s32) sp9E, var_v1_3);
temp_a0_2 = final_resample(acmd, synthesisState, temp_a2_4, sp112, (u16) (s32) sp9E, var_v1_3);
if ((noteSubEu->headsetPanRight != 0) || (synthesisState->prevHeadsetPanRight != 0)) {
var_s0_2 = 1;
} else if ((noteSubEu->headsetPanLeft != 0) || (var_s0_2 = 0, (synthesisState->prevHeadsetPanLeft != 0))) {
@@ -819,7 +797,7 @@ block_60:
temp_v0_8 = func_800B86A0(temp_a0_2, noteSubEu, synthesisState, bufLen, 0, var_s0_2, sp114);
var_s2 = temp_v0_8;
if ((u8) noteSubEu->unk0 & 1) {
var_s2 = note_apply_headset_pan_effects(temp_v0_8, noteSubEu, synthesisState, temp_a2_4, sp114, var_s0_2);
var_s2 = note_apply_headset_pan_effects(temp_v0_8, noteSubEu, synthesisState, temp_a2_4, (s32) sp114, var_s0_2);
}
return var_s2;
}