A bunch of unrelated, assorted changes (#263)

Couple matches functions, an update to a struct, a bunch of header
 files adjustments, and some mips_to_c regenerations

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran
2022-10-01 00:48:59 -04:00
committed by GitHub
parent 82b53f5928
commit b7e7b34998
26 changed files with 1247 additions and 1624 deletions
+25 -25
View File
@@ -26,22 +26,21 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C13FC.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b
extern ? D_80191420;
f32 func_800C1480(s32 arg0, s32 arg1) {
? sp-10;
f32 temp_f0;
f32 temp_f12;
f32 var_f2;
f32 var_f2_2;
s32 temp_v0_2;
s32 temp_v1;
s32 var_v0;
void *temp_v0;
s32 phi_v0;
f32 phi_f2;
f32 phi_f2_2;
sp-10.unk10 = arg0;
sp-10.unk14 = arg1;
unksp-10.unk10 = arg0;
unksp-10.unk14 = arg1;
temp_v0 = ((arg0 & 0xFF) * 0x3C0) + ((arg1 & 0xFF) * 0x30) + &D_80191420;
temp_v1 = temp_v0->unk24;
if (temp_v1 & 0x400000) {
@@ -50,30 +49,31 @@ f32 func_800C1480(s32 arg0, s32 arg1) {
temp_f0 = temp_v0->unk1C;
temp_v0_2 = temp_v1 & 0x30000;
if (temp_f0 > 2000.0f) {
phi_f2 = 0.0f;
var_f2 = 0.0f;
} else {
if (temp_v0_2 != 0x10000) {
if (temp_v0_2 != 0x20000) {
if (temp_v0_2 != 0x30000) {
phi_v0 = 0x190;
} else {
phi_v0 = 0x3E8;
}
} else {
phi_v0 = 0x29A;
}
} else {
phi_v0 = 0x1F4;
switch (temp_v0_2) { /* irregular */
default:
var_v0 = 0x190;
break;
case 0x10000:
var_v0 = 0x1F4;
break;
case 0x20000:
var_v0 = 0x29A;
break;
case 0x30000:
var_v0 = 0x3E8;
break;
}
temp_f12 = phi_v0;
temp_f12 = (f32) var_v0;
if (temp_f0 < temp_f12) {
phi_f2_2 = (((temp_f12 - temp_f0) / temp_f12) * 0.5) + 0.5;
var_f2_2 = (f32) (((f64) ((temp_f12 - temp_f0) / temp_f12) * 0.5) + 0.5);
} else {
phi_f2_2 = (1.0 - ((temp_f0 - temp_f12) / (2000.0f - temp_f12))) * 0.5;
var_f2_2 = (f32) ((1.0 - (f64) ((temp_f0 - temp_f12) / (2000.0f - temp_f12))) * 0.5);
}
phi_f2 = phi_f2_2 * phi_f2_2;
var_f2 = var_f2_2 * var_f2_2;
}
return phi_f2;
return var_f2;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1480.s")
+85 -118
View File
@@ -230,34 +230,27 @@ void *func_800BAD0C(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
return (devAddr - dmaDevAddr) + dma->buffer;
}
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 osPiStartDma(void *, ?, ?, s32, s32, s32, ? *); // extern
extern OSMesgQueue gCurrAudioFrameDmaQueue;
extern OSIoMesg gCurrAudioFrameDmaIoMesgBufs;
extern ? sSampleDmas;
extern u32 gSampleDmaNumListItems;
extern u32 sSampleDmaListSize1;
extern u8 sSampleDmaReuseQueue1;
extern u8 sSampleDmaReuseQueue2;
extern u8 sSampleDmaReuseQueueTail1;
extern u8 sSampleDmaReuseQueueTail2;
extern u8 sSampleDmaReuseQueueHead2;
//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b
extern s32 gCurrAudioFrameDmaCount;
s32 func_800BAD0C(s32 arg0, s32 arg1, s32 arg2, u8 *arg3) {
void *sp40;
void *func_800BAD0C(u32 devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
struct SharedDma *sp40;
s32 sp30;
s32 temp_s0;
s32 temp_t9;
s32 temp_v0_2;
s32 temp_v0_4;
s32 temp_v1_6;
s32 temp_v1_3;
s32 var_t2;
s32 var_t3;
struct SharedDma *temp_t0;
struct SharedDma *var_a0;
struct SharedDma *var_t0;
u16 temp_v0_6;
u32 temp_a1;
u32 temp_a1_2;
u32 temp_v1;
u32 temp_v1_3;
u32 temp_v1_4;
u32 temp_s0;
u32 var_v1;
u32 var_v1_2;
u8 *temp_v0_3;
u8 *temp_v0_5;
u8 temp_a0;
@@ -265,120 +258,102 @@ s32 func_800BAD0C(s32 arg0, s32 arg1, s32 arg2, u8 *arg3) {
u8 temp_a1_4;
u8 temp_a3;
u8 temp_t2;
u8 temp_t2_2;
u8 temp_v0;
u8 temp_v1;
u8 temp_v1_2;
u8 temp_v1_5;
void *temp_t0;
void *temp_t0_2;
void *phi_t0;
u32 phi_v1;
void *phi_a0;
u8 phi_v1_2;
s32 phi_t3;
void *phi_t0_2;
s32 phi_t2;
phi_t3 = 0;
phi_t3 = 0;
if ((arg2 != 0) || (temp_a1 = sSampleDmaListSize1, temp_v0 = *arg3, phi_v1 = 0, ((temp_v0 < temp_a1) == 0))) {
var_t3 = 0;
if ((arg2 != 0) || (temp_a1 = sSampleDmaListSize1, temp_v0 = *dmaIndexRef, var_v1 = 0, ((temp_v0 < temp_a1) == 0))) {
temp_a1_2 = gSampleDmaNumListItems;
temp_v1_3 = sSampleDmaListSize1;
phi_v1_2 = temp_v1_3;
if (temp_v1_3 < temp_a1_2) {
phi_a0 = (temp_v1_3 * 0x10) + &sSampleDmas;
var_v1_2 = sSampleDmaListSize1;
if (var_v1_2 < temp_a1_2) {
var_a0 = &sSampleDmas[var_v1_2];
loop_4:
temp_v0_4 = arg0 - phi_a0->unk4;
if ((temp_v0_4 >= 0) && ((phi_a0->unkA - arg1) >= temp_v0_4)) {
if (phi_a0->unkE == 0) {
temp_t0 = var_a0;
temp_v0_2 = devAddr - var_a0->source;
if ((temp_v0_2 >= 0) && ((u32) (var_a0->bufSize - size) >= (u32) temp_v0_2)) {
if (var_a0->ttl == 0) {
temp_a1_3 = sSampleDmaReuseQueueTail2;
if (sSampleDmaReuseQueueHead2 != temp_a1_3) {
temp_a3 = phi_a0->unkD;
temp_v0_5 = &sSampleDmaReuseQueue2 + temp_a1_3;
temp_a3 = var_a0->reuseIndex;
temp_v0_3 = &sSampleDmaReuseQueue2[temp_a1_3];
if (temp_a1_3 != temp_a3) {
*(&sSampleDmaReuseQueue2 + temp_a3) = *temp_v0_5;
(&sSampleDmas + (*temp_v0_5 * 0x10))->unkD = phi_a0->unkD;
sSampleDmaReuseQueue2[temp_a3] = *temp_v0_3;
sSampleDmas[*temp_v0_3].reuseIndex = var_a0->reuseIndex;
}
sSampleDmaReuseQueueTail2 = temp_a1_3 + 1;
}
}
phi_a0->unkE = 0x3C;
*arg3 = phi_v1_2;
return (phi_a0->unk0 + arg0) - phi_a0->unk4;
var_a0->ttl = 0x3C;
*dmaIndexRef = (u8) var_v1_2;
return &var_a0->buffer[devAddr] - var_a0->source;
}
temp_v1_4 = phi_v1_2 + 1;
phi_a0 += 0x10;
phi_v1_2 = temp_v1_4;
if (temp_v1_4 >= temp_a1_2) {
sp40 = phi_a0;
var_v1_2 += 1;
var_a0 += 0x10;
if (var_v1_2 >= temp_a1_2) {
sp40 = temp_t0;
goto block_14;
}
goto loop_4;
}
block_14:
temp_a1_4 = sSampleDmaReuseQueueTail2;
phi_t0_2 = sp40;
var_t0 = sp40;
if ((sSampleDmaReuseQueueHead2 != temp_a1_4) && (arg2 != 0)) {
temp_t2 = *(&sSampleDmaReuseQueue2 + temp_a1_4);
temp_t2 = sSampleDmaReuseQueue2[temp_a1_4];
sSampleDmaReuseQueueTail2 = temp_a1_4 + 1;
sp30 = temp_t2;
phi_t3 = 1;
phi_t0_2 = &sSampleDmas + (temp_t2 * 0x10);
var_t0 = &sSampleDmas[temp_t2];
var_t3 = 1;
sp30 = (s32) temp_t2;
}
goto block_27;
}
temp_t0 = &sSampleDmas + (temp_v0 * 0x10);
phi_t0 = temp_t0;
phi_t0_2 = temp_t0;
var_t0 = &sSampleDmas[temp_v0];
if (temp_a1 != 0) {
loop_19:
temp_v1 = phi_v1 + 1;
temp_v0_2 = arg0 - phi_t0->unk4;
phi_v1 = temp_v1;
if ((temp_v0_2 >= 0) && ((phi_t0->unkA - arg1) >= temp_v0_2)) {
if (phi_t0->unkE == 0) {
temp_v1_2 = sSampleDmaReuseQueueTail1;
temp_a0 = phi_t0->unkD;
temp_v0_3 = &sSampleDmaReuseQueue1 + temp_v1_2;
if (temp_v1_2 != temp_a0) {
*(&sSampleDmaReuseQueue1 + temp_a0) = *temp_v0_3;
(&sSampleDmas + (*temp_v0_3 * 0x10))->unkD = phi_t0->unkD;
temp_t9 = var_v1 * 0x10;
var_v1 += 1;
temp_v0_4 = devAddr - var_t0->source;
if ((temp_v0_4 >= 0) && ((u32) (var_t0->bufSize - size) >= (u32) temp_v0_4)) {
if (var_t0->ttl == 0) {
temp_v1 = sSampleDmaReuseQueueTail1;
temp_a0 = var_t0->reuseIndex;
temp_v0_5 = &sSampleDmaReuseQueue1[temp_v1];
if (temp_v1 != temp_a0) {
sSampleDmaReuseQueue1[temp_a0] = *temp_v0_5;
sSampleDmas[*temp_v0_5].reuseIndex = var_t0->reuseIndex;
}
sSampleDmaReuseQueueTail1 = temp_v1_2 + 1;
sSampleDmaReuseQueueTail1 = temp_v1 + 1;
}
phi_t0->unkE = 2;
return (phi_t0->unk0 + arg0) - phi_t0->unk4;
var_t0->ttl = 2;
return &var_t0->buffer[devAddr] - var_t0->source;
}
temp_t0_2 = &sSampleDmas + (phi_v1 * 0x10);
phi_t0 = temp_t0_2;
phi_t0_2 = temp_t0_2;
if (temp_v1 >= temp_a1) {
var_t0 = sSampleDmas + temp_t9;
if (var_v1 >= temp_a1) {
goto block_27;
}
goto loop_19;
}
block_27:
phi_t2 = sp30;
if (phi_t3 == 0) {
temp_v1_5 = sSampleDmaReuseQueueTail1;
temp_t2_2 = *(&sSampleDmaReuseQueue1 + temp_v1_5);
sSampleDmaReuseQueueTail1 = temp_v1_5 + 1;
phi_t0_2 = &sSampleDmas + (temp_t2_2 * 0x10);
phi_t2 = temp_t2_2;
var_t2 = sp30;
if (var_t3 == 0) {
temp_v1_2 = sSampleDmaReuseQueueTail1;
var_t2 = (s32) sSampleDmaReuseQueue1[temp_v1_2];
sSampleDmaReuseQueueTail1 = temp_v1_2 + 1;
var_t0 = sSampleDmas + (var_t2 * 0x10);
}
temp_v0_6 = phi_t0_2->unkA;
temp_s0 = arg0 & ~0xF;
phi_t0_2->unkE = 2;
phi_t0_2->unk4 = temp_s0;
phi_t0_2->unk8 = temp_v0_6;
temp_v1_6 = gCurrAudioFrameDmaCount;
temp_t9 = temp_v1_6 * 0x18;
gCurrAudioFrameDmaCount = temp_v1_6 + 1;
sp30 = phi_t2;
sp40 = phi_t0_2;./
osPiStartDma(temp_t9 + &gCurrAudioFrameDmaIoMesgBufs, 0, 0, temp_s0, phi_t0_2->unk0, temp_v0_6, &gCurrAudioFrameDmaQueue);
*arg3 = phi_t2;
return (arg0 - temp_s0) + phi_t0_2->unk0;
temp_v0_6 = var_t0->bufSize;
temp_s0 = devAddr & ~0xF;
var_t0->ttl = 2;
var_t0->source = temp_s0;
var_t0->sizeUnused = temp_v0_6;
temp_v1_3 = gCurrAudioFrameDmaCount;
gCurrAudioFrameDmaCount = temp_v1_3 + 1;
sp30 = var_t2;
sp40 = var_t0;
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[temp_v1_3], 0, 0, temp_s0, var_t0->buffer, (u32) temp_v0_6, &gCurrAudioFrameDmaQueue);
*dmaIndexRef = (u8) var_t2;
return &var_t0->buffer[devAddr - temp_s0];
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAD0C.s")
@@ -475,43 +450,35 @@ s32 func_800BB304(struct AudioBankSample *sample) {
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800BB304(s32); // extern
void *func_800BC948(); // extern
void *func_800BC9F8(?); // extern
//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b
void *func_800BC948(); /* extern */
void *func_800BC9F8(s32); /* extern */
void func_800BB388(s32 arg1, ? arg2) {
void func_800BB388(s32 arg0, s32 arg1, s32 arg2) {
void *sp1C;
void *temp_ret;
void *temp_v0;
void *temp_v0_2;
if (arg1 < 0x7F) {
temp_ret = func_800BC948();
temp_v0 = temp_ret;
if (temp_v0 == 0) {
temp_v0 = func_800BC948();
if (temp_v0 == NULL) {
return;
}
if (temp_v0->unk1 != 0) {
sp1C = temp_v0;
func_800BB304(temp_v0->unk8);
}
sp1C = temp_ret;
func_800BB304(temp_ret->unk10);
if (temp_ret->unk2 != 0x7F) {
func_800BB304(temp_ret->unk18);
return;
sp1C = temp_v0;
func_800BB304(temp_v0->unk10);
if (temp_v0->unk2 != 0x7F) {
func_800BB304(temp_v0->unk18);
}
// Duplicate return node #11. Try simplifying control flow for better match
return;
}
if (arg1 == 0x7F) {
} else if (arg1 == 0x0000007F) {
temp_v0_2 = func_800BC9F8(arg2);
if (temp_v0_2 == 0) {
if (temp_v0_2 == NULL) {
return;
}
func_800BB304(temp_v0_2->unk4);
// Duplicate return node #11. Try simplifying control flow for better match
}
}
#else
+6
View File
@@ -9,4 +9,10 @@
#define PRELOAD_BANKS 2
#define PRELOAD_SEQUENCE 1
void func_800BAAF8(uintptr_t, void*, size_t, OSMesgQueue*, OSIoMesg*);
void func_800BAB58(uintptr_t*, u8**, ssize_t*, OSMesgQueue*, OSIoMesg*);
void func_800BAC04();
void func_800BB030(s32);
s32 func_800BB304(struct AudioBankSample*);
#endif // AUDIO_LOAD_H