Skip to content

Commit

Permalink
Merge pull request #138 from Kelebek1/various
Browse files Browse the repository at this point in the history
45720
RevoSucks authored Sep 24, 2024

Verified

This commit was signed with the committer’s verified signature.
theasianpianist Lawrence Lee
2 parents b74a731 + efdfc44 commit 8b69bff
Showing 13 changed files with 559 additions and 28 deletions.
20 changes: 19 additions & 1 deletion src/334D0.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#include "334D0.h"
#include "src/12D80.h"
#include "src/30640.h"
#include "src/6A40.h"
#include "src/F420.h"

typedef struct unk_D_800AFFC8 {
/* 0x000 */ s16 unk_000;
/* 0x002 */ char unk002[0x7CE];
} unk_D_800AFFC8; // size = 0x7D0

extern unk_D_800AFFC8 D_800AFFC8[2][3];

#pragma GLOBAL_ASM("asm/us/nonmatchings/334D0/func_800328D0.s")

@@ -10,7 +21,14 @@

#pragma GLOBAL_ASM("asm/us/nonmatchings/334D0/func_80032990.s")

#pragma GLOBAL_ASM("asm/us/nonmatchings/334D0/func_80032A34.s")
void func_80032A34(s32 arg0) {
s32 i;
unk_D_800AFFC8* var_v1 = &D_800AFFC8[arg0];

for (i = 0; i < 3; i++) {
var_v1[i].unk_000 = 0;
}
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/334D0/func_80032A7C.s")

2 changes: 1 addition & 1 deletion src/373A0.c
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ u8* D_800FC6B0[3];
u8* D_800FC6C0[3];
unk_D_800FC6CC* D_800FC6CC;
u8* D_800FC6D0;
u32* D_800FC6D4;
unk_D_800FC6D4* D_800FC6D4;
u8* D_800FC6D8;
u8* D_800FC6DC;
u32* D_800FC6E0;
29 changes: 28 additions & 1 deletion src/373A0.h
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@

#include "global.h"

#ifdef M2C
#define ENTRY_SIZE 1
#else
#define ENTRY_SIZE
#endif

typedef struct File1Header {
/* 0x00 */ u32 offset1;
/* 0x04 */ u32 wave_tables_offset;
@@ -33,6 +39,27 @@ typedef struct unk_D_800FC6CC {
/* 0x04 */ u32 unk_04;
} unk_D_800FC6CC; // size = 0x8

typedef struct unk_D_800FC6D4_entry {
/* 0x00 */ u16 unk_00;
/* 0x02 */ u8 unk_02;
/* 0x03 */ u8 unk_03;
} unk_D_800FC6D4_entry; // size = 0x4

typedef struct testme {
u32 unk_00;
u32 unk_04;
} testme;

typedef struct unk_D_800FC6D4 {
/* 0x00 */ u16 flags;
/* 0x02 */ u16 num_entries;
/* 0x04 */ u16 unk_04;
/* 0x06 */ u16 unk_06;
/* 0x08 */ testme* offset;
/* 0x0C */ char unk_0C[0x4];
/* 0x10 */ unk_D_800FC6D4_entry entries[ENTRY_SIZE];
} unk_D_800FC6D4; // size = 0x10

extern u8 D_800B32A0[0x493E0];
extern u32* D_800FC680;
extern u8* D_800FC684;
@@ -47,7 +74,7 @@ extern u8* D_800FC6B0[3];
extern u8* D_800FC6C0[3];
extern unk_D_800FC6CC* D_800FC6CC;
extern u8* D_800FC6D0;
extern u32* D_800FC6D4;
extern unk_D_800FC6D4* D_800FC6D4;
extern u8* D_800FC6D8;
extern u8* D_800FC6DC;
extern u32* D_800FC6E0;
15 changes: 14 additions & 1 deletion src/3D140.c
Original file line number Diff line number Diff line change
@@ -566,7 +566,20 @@ s32 func_8003D494(void) {
return D_80077D90;
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D4A0.s")
s32 func_8003D4A0(s32 arg0) {
if (arg0 == 0) {
if (D_800FC818 != D_800FCAD8) {
return 0;
}
D_80077DA8 = 1;
} else {
osAiSetFrequency(D_800FCAD4);
lastInfo = NULL;
dmaState.initialized = 0;
D_80077DA8 = 0;
}
return 1;
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D514.s")

2 changes: 1 addition & 1 deletion src/3D140.h
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ OSTask* func_8003CADC(OSTask*);
void __clearAudioDMA(void);
void func_8003D32C(void);
s32 func_8003D494(void);
void func_8003D4A0(s32);
s32 func_8003D4A0(s32);
void func_8003D68C(s32);
void func_8003D918(u32 arg0, u32 arg1);
void func_8003DB84(s32 arg0);
69 changes: 67 additions & 2 deletions src/435D0.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
#include "435D0.h"

#pragma GLOBAL_ASM("asm/us/nonmatchings/435D0/func_800429D0.s")
extern u8 D_800FCD48[8];
extern s8 D_800FCEB4;
extern s32 D_800FCEC8;
extern u8 D_800FCECC;
extern u8 D_800FCECD;

void func_800429D0(void) {
s32 i;

for (i = 0; i < 8; i++) {
if (D_800FCD48[i] != 0) {
func_80042B8C(i);
}
}
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/435D0/func_80042A2C.s")

#pragma GLOBAL_ASM("asm/us/nonmatchings/435D0/func_80042AB0.s")
s32 func_80042AB0(u16 arg0) {
s32 a;
s32 offset;

if (func_800449F8() != 0) {
return 0;
}

func_80044A50(D_800FC6D4);

if (D_800FC6D4->num_entries < arg0) {
return 0;
}

offset = D_800FC6D4->offset;
func_8004473C();

arg0--;

a = D_800FC6D4->entries[arg0].unk_00;
D_800FCEB4 = a;
D_800FCECC = D_800FC6D4->entries[arg0].unk_02;
D_800FCECD = D_800FC6D4->entries[arg0].unk_03;
D_800FCEC8 = offset + (a * 0x18);

func_80044568(a);

return 1;
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/435D0/func_80042B8C.s")

@@ -86,4 +128,27 @@

#pragma GLOBAL_ASM("asm/us/nonmatchings/435D0/func_800449F8.s")

#ifdef NON_MATCHING
void func_80044A50(unk_D_800FC6D4* arg0) {
u32 i;
u32 end;
testme* ptr;
u32 a0 = arg0;

if (arg0->flags != 0) {
return;
}

end = arg0->unk_04 * 3;
ptr = arg0->offset + a0;
arg0->offset = ptr;

for (i = 0; i < end; i++) {
ptr[i].unk_00 += a0;
}

arg0->flags = 1;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/435D0/func_80044A50.s")
#endif
7 changes: 6 additions & 1 deletion src/435D0.h
Original file line number Diff line number Diff line change
@@ -2,9 +2,14 @@
#define _435D0_H_

#include "global.h"
#include "src/373A0.h"

void func_800429D0(void);
void func_80042AB0(u16);
s32 func_80042AB0(u16);
void func_80042B8C(s32);
void func_80044568(u8);
void func_8004473C(void);
s32 func_800449F8(void);
void func_80044A50(unk_D_800FC6D4*);

#endif // _435D0_H_
362 changes: 350 additions & 12 deletions src/45720.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,78 @@
#include "45720.h"

extern u8 D_800FCEF0[2];
extern u32 D_800FCF00[2];
extern s16 D_800FCF1C[2];
u8 D_800785F0 = 0;

extern s8 D_800785F0;
s32 D_800FCED0;
unk_D_800FCED8* D_800FCED8[2];
s16* D_800FCEE0[2];
u32 D_800FCEE8;
u32 D_800FCEEC;
u8 D_800FCEF0[2];
s32 D_800FCEF8[2];
u32 D_800FCF00[2];
s32 D_800FCF08[2];
s32 D_800FCF10[2];
s32 pad_D_800FCF18;
s16 D_800FCF1C[2];
u8 D_800FCF20[2];
OSPiHandle* D_800FCF24;
unk_D_800FCF28* D_800FCF28[2];
u32 D_800FCF30[2];
s32 D_800FCF38[2];
OSMesgQueue D_800FCF40;
OSMesg D_800FCF58;

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_80044B20.s")
void func_80044B20(ALHeap* arg0, u32 arg1, u32 arg2) {
s32 i;

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_80044CBC.s")
D_800FCEE8 = arg1 >> 1;
D_800FCEEC = arg2 >> 1;

for (i = 0; i < 2; i++) {
D_800FCED8[i] = alHeapDBAlloc(NULL, 0, arg0, 1, sizeof(unk_D_800FCED8));
D_800FCF28[i] = alHeapDBAlloc(NULL, 0, arg0, sizeof(*D_800FCF28[0]) / 2, 2);

D_800FCEE0[i] = (u32)D_800FCED8[i] + 0x198;
D_800FCF30[i] = 0;
D_800FCF38[i] = 0x400;
D_800FCEF0[i] = 2;

bzero(D_800FCF28[i], 0x1140);
bzero(D_800FCEE0[i], 0x1400);

func_800456D0(D_800FCED8[i], 0, 0);
D_800FCF20[i] = 0;
}

D_800FCF24 = osCartRomInit();
osCreateMesgQueue(&D_800FCF40, &D_800FCF58, 1);
D_800FCED0 = 0;
D_800785F0 = 0;
}

void func_80044CBC(u32 arg0, u32 arg1, u32 arg2, u32 arg3) {
u32 temp_a0;

if ((arg0 < 2) && (D_800785F0 == 0)) {
if (arg2 >= 0x81) {
arg2 = 0x80;
}

temp_a0 = osSetIntMask(1);

if (arg3 == 0) {
D_800FCEF0[arg0] = 0;
} else {
D_800FCEF0[arg0] = 3;
}

D_800FCEF8[arg0] = arg1;
D_800FCF10[arg0] = arg3;
D_800FCF08[arg0] = arg2;

osSetIntMask(temp_a0);
}
}

void func_80044D78(u32 arg0, u32 arg1) {
u32 temp_a0;
@@ -42,16 +106,290 @@ void func_80044E80(s32 arg0) {
}
}

#ifdef NON_MATCHING
void func_80044EA4(void) {
s32 i;
s32 j;
s32 sp70;
u8* sp5C;
void** sp44;
unk_D_800FCF28* temp_s4;
s16** temp_s0;
s32 temp_a0;
s32 temp_a0_2;
s32 temp_a0_3;
s32 temp_a1;
s32 temp_a2_2;
s32 temp_a3;
s32 temp_fp;
s32 temp_t5;
s32 temp_v0_2;
s32 temp_v0_9;
s32 temp_v1;
s32 var_s1;
s32 var_v0;
s32 temp_s3;
s32* temp_v0_8;
u32 temp_a2;
u32 temp_lo;
u32 temp_lo_2;
u32 temp_lo_3;
u32 temp_t9;
u32 temp_t9_2;
u32 temp_v0_3;
u32 temp_v0_4;
u32 temp_v0_5;
u32 temp_v0_6;
u32 temp_v0_7;
u32 var_s7;
u32 var_t0;
u32 var_t1;
u32 var_t2;
u32 var_v1;
u32 var_v1_2;
u32* temp_s2_2;
u32* temp_s2_3;
u8 temp_t6;
u8 temp_v0;
u8 temp_v1_2;
u8* temp_s2;
u8* var_a1;
void* var_a0;
s16 tmp;

for (i = 0; i < 2; i++) {
if (D_800FCEF0[i] != 2) {
if (D_800FCF30[i] < D_800FCF38[i]) {
if ((D_800FCF38[i] - D_800FCF30[i]) < D_800FCEEC) {
var_s7 = D_800FCEEC;
} else {
var_s7 = D_800FCEE8;
}
} else if ((0x8A0 - D_800FCEEC) < (D_800FCF30[i] - D_800FCF38[i])) {
var_s7 = D_800FCEEC;
} else {
var_s7 = D_800FCEE8;
}

func_80045780(D_800FCED8[i]);
if (D_800FCED8[i]->unk_25D1 == 2) {
osWritebackDCache(D_800FCF28[i], 0x1140);
func_80045A48(D_800FCED8[i]);
D_800FCED0 = 1;
D_800FCF20[i] = 0;
} else {
if ((D_800FCEF0[i] != 0) && (D_800FCEF0[i] != 3) && (D_800FCED8[i]->unk_25D1 == 4)) {
if (D_800FCF20[i] == 0) {
func_80045A68(D_800FCED8[i]);
D_800FCF20[i] = 1;
}
D_800FCED0 = 0;
D_800FCEF0[i] = 2;
bzero(D_800FCEE0[i], 0x1400);
bzero(D_800FCF28[i], 0x1140);
}
}

func_800459E0(D_800FCED8[i], var_s7);

temp_a2 = D_800FCED8[i]->unk_25C8 - var_s7;
for (j = 0; j < var_s7; j++) {
D_800FCF28[i]->unk_000[(D_800FCF38[i] + j * 2) % 2208] =
(D_800FCF00[i] * D_800FCEE0[i][temp_a2 % 2560]) >> 7;
}

D_800FCF38[i] += var_s7 * 2;
D_800FCF38[i] %= 2208;
osWritebackDCache(D_800FCF28[i], 0x1140);

switch (D_800FCEF0[i]) {
case 2:
case 4:
break;

case 0:
func_800456D0(D_800FCED8[i], D_800FCEF8[i], func_800455DC);
D_800FCEF0[i] = 4;
if (D_800FCED0 != 0) {
D_800FCED0 = 0;
}
D_800FCF00[i] = D_800FCF08[i];
break;

case 1:
func_80045A68(D_800FCED8[i]);
bzero(D_800FCEE0[i], 0x1400);
D_800FCF20[i] = 1;
break;

case 3:
D_800FCF10[i]--;
if (D_800FCF10[i] == 0) {
D_800FCEF0[i] = 0;
}
break;

case 5:
temp_v0_9 = D_800FCF00[i] - D_800FCF1C[i];
if (temp_v0_9 <= 0) {
D_800FCF00[i] = 0;
D_800FCEF0[i] = 1;
} else {
D_800FCF00[i] = temp_v0_9;
}
break;
}
}
}
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_80044EA4.s")
#endif

void func_800455DC(u32 arg0, u32 arg1, u32 arg2, OSMesgQueue* arg3) {
OSIoMesg sp48;
u32 var_s1;
u32 var_s2;
u32 var_s3;

var_s2 = arg0;
var_s3 = arg1;

while (arg2) {
if (arg2 >= 0x1001) {
var_s1 = 0x1000;
} else {
var_s1 = arg2;
}

sp48.hdr.pri = 0;
sp48.hdr.retQueue = &D_800FCF40;
sp48.dramAddr = var_s3;
sp48.devAddr = var_s2;
sp48.size = var_s1;

osInvalDCache(arg1, arg2);
osEPiStartDma(D_800FCF24, &sp48, 0);
osRecvMesg(&D_800FCF40, NULL, 1);

arg2 -= var_s1;
var_s2 += var_s1;
var_s3 += var_s1;
}

osSendMesg(arg3, NULL, 1);
}

void func_800456D0(unk_D_800FCED8* arg0, s32 arg1, s32 arg2) {
bzero(&arg0->unk_0000, sizeof(unk_D_800FCED8_0000));

arg0->unk_0000.unk_166 = 0x28;
arg0->unk_0190 = arg2;
arg0->unk_0194 = arg1;

osCreateMesgQueue(&arg0->unk_25A0, &arg0->unk_25B8, 1);

if ((arg1 == 0) || (arg2 == 0)) {
arg0->unk_25D1 = 0;
} else {
arg0->unk_25D1 = 1;
}

arg0->unk_25D0 = 0;
arg0->unk_2598 = arg0->unk_259C = arg0->unk_259A = 0;
arg0->unk_25BC = 0;
arg0->unk_25C4 = 0;
arg0->unk_25C0 = 0;
arg0->unk_25CC = 0;
arg0->unk_25C8 = 0;
arg0->unk_25D2 = 2;
}

void func_80045780(unk_D_800FCED8* arg0) {
s32 var_a2;
s32 var_s2;
u32 var_v1;

var_s2 = arg0->unk_25D2;

if ((arg0->unk_25D0 != 0) && (osRecvMesg(&arg0->unk_25A0, NULL, 0) >= 0)) {
if (arg0->unk_25C4 == 0) {
arg0->unk_2598 = (arg0->unk_1598[0].unk_04 >> 0x10) & 0xFFFF;
arg0->unk_259A = arg0->unk_1598[0].unk_04 & 0xFFFF;
arg0->unk_259C = arg0->unk_15A0 & 0xFFFFFF;
arg0->unk_25BC = 0x60;
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_800455DC.s")
arg0->unk_25C4 += 0x400;
if (arg0->unk_259C >= 0x100) {
arg0->unk_259C -= 0x100;
} else {
arg0->unk_259C = 0;
}
arg0->unk_25D0 = 0;
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_800456D0.s")
if ((arg0->unk_25D0 == 0) && ((arg0->unk_25D1 == 1) || (arg0->unk_25D1 == 2) || (arg0->unk_25D1 == 3))) {
if ((arg0->unk_25C4 - arg0->unk_25C0) < 0xC01) {
if (arg0->unk_25C4 == 0) {
var_a2 = 0x400;
} else if (arg0->unk_259C >= 0x101) {
var_a2 = 0x400;
} else {
var_a2 = arg0->unk_259C * 4;
}

if (var_a2 > 0) {
arg0->unk_25D0 = 1;
arg0->unk_0190(arg0->unk_0194 + arg0->unk_25C4, &arg0->unk_1598[(arg0->unk_25C4 & 0xFFF) >> 3], var_a2,
&arg0->unk_25A0);
}
}
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_80045780.s")
var_v1 = arg0->unk_25CC - arg0->unk_25C8;
while ((var_v1 < 0x960) && ((arg0->unk_25D1 == 1) || (arg0->unk_2598 > 0)) &&
((arg0->unk_25C4 - arg0->unk_25C0) >= 0x25) && (var_s2 > 0)) {
func_80045FF0(arg0, arg0->unk_0198.unk_0000 + (((arg0->unk_25CC % 2560) >> 2) * 8));
arg0->unk_25C0 = (arg0->unk_25BC >> 3) & ~3;
arg0->unk_25CC += 0xA0;
arg0->unk_2598--;
var_v1 = arg0->unk_25CC - arg0->unk_25C8;
var_s2--;
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_800459E0.s")
if ((arg0->unk_25D1 == 1) && (var_v1 >= 0x8C0)) {
arg0->unk_25D1 = 2;
}
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_80045A48.s")
u32 func_800459E0(unk_D_800FCED8* arg0, u32 arg1) {
u32 temp_v0;
u32 var_a2;

#pragma GLOBAL_ASM("asm/us/nonmatchings/45720/func_80045A68.s")
if (arg0->unk_25D1 == 3) {
temp_v0 = arg0->unk_25CC - arg0->unk_25C8;
if (arg1 < temp_v0) {
var_a2 = arg1;
} else {
var_a2 = temp_v0;
if (arg0->unk_2598 <= 0) {
arg0->unk_25D1 = 4;
}
}
arg0->unk_25C8 += var_a2;
return var_a2;
}

return 0;
}

void func_80045A48(unk_D_800FCED8* arg0) {
if (arg0->unk_25D1 == 2) {
arg0->unk_25D1 = 3;
}
}

void func_80045A68(unk_D_800FCED8* arg0) {
arg0->unk_25D1 = 4;
}
18 changes: 16 additions & 2 deletions src/45720.h
Original file line number Diff line number Diff line change
@@ -2,12 +2,26 @@
#define _45720_H_

#include "global.h"
#include "src/46680.h"

void func_80044B20(ALHeap*, s32, s32);
void func_80044CBC(s32, s32, s32, s32);
typedef struct unk_D_800FCF28 {
/* 0x000 */ s16 unk_000[0x8A0];
} unk_D_800FCF28; // size = 0x1140

extern unk_D_800FCF28* D_800FCF28[2];
extern u32 D_800FCF30[2];

void func_80044B20(ALHeap*, u32, u32);
void func_80044CBC(u32, u32, u32, u32);
void func_80044D78(u32, u32);
s32 func_80044E54(s32);
void func_80044E80(s32);
void func_80044EA4(void);
void func_800455DC(u32 arg0, u32 arg1, u32 arg2, OSMesgQueue* arg3);
void func_800456D0(unk_D_800FCED8*, s32, s32);
void func_80045780(unk_D_800FCED8*);
u32 func_800459E0(unk_D_800FCED8*, u32);
void func_80045A48(unk_D_800FCED8*);
void func_80045A68(unk_D_800FCED8*);

#endif // _45720_H_
2 changes: 1 addition & 1 deletion src/46680.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "global.h"
#include "46680.h"

#pragma GLOBAL_ASM("asm/us/nonmatchings/46680/func_80045A80.s")

49 changes: 49 additions & 0 deletions src/46680.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ifndef _46680_H_
#define _46680_H_

#include "global.h"

typedef struct unk_D_800FCED8_0000 {
/* 0x000 */ char unk000[0x166];
/* 0x166 */ s16 unk_166;
/* 0x168 */ char unk168[0x28];
} unk_D_800FCED8_0000; // size = 0x190

typedef struct unk_D_800FCED8_0198 {
/* 0x000 */ char unk_0000[0x1400];
} unk_D_800FCED8_0198; // size = 0x1400

typedef struct unk_D_800FCED8_01598 {
/* 0x00 */ char unk00[0x4];
/* 0x04 */ u32 unk_04;
} unk_D_800FCED8_01598; // size = 0x8

typedef void (*unk_D_800FCED8_190)(s32, unk_D_800FCED8_01598*, s32, OSMesgQueue*);

typedef struct unk_D_800FCED8 {
/* 0x0000 */ unk_D_800FCED8_0000 unk_0000;
/* 0x0190 */ unk_D_800FCED8_190 unk_0190;
/* 0x0194 */ s32 unk_0194;
/* 0x0198 */ unk_D_800FCED8_0198 unk_0198;
/* 0x1598 */ unk_D_800FCED8_01598 unk_1598[1];
/* 0x15A0 */ u32 unk_15A0;
/* 0x15A4 */ char unk_15A4[0xFF4];
/* 0x2598 */ u16 unk_2598;
/* 0x259A */ u16 unk_259A;
/* 0x259C */ u32 unk_259C;
/* 0x25A0 */ OSMesgQueue unk_25A0;
/* 0x25B8 */ OSMesg unk_25B8;
/* 0x25BC */ u32 unk_25BC;
/* 0x25C0 */ u32 unk_25C0;
/* 0x25C4 */ u32 unk_25C4;
/* 0x25C8 */ s32 unk_25C8;
/* 0x25CC */ u32 unk_25CC;
/* 0x25D0 */ s8 unk_25D0;
/* 0x25D1 */ s8 unk_25D1;
/* 0x25D2 */ s8 unk_25D2;
/* 0x25D3 */ char unk25D3[0x5];
} unk_D_800FCED8; // size = 0x25D8

s32 func_80045FF0(unk_D_800FCED8*, void*);

#endif // _46680_H_
8 changes: 3 additions & 5 deletions src/libnaudio/n_mainbus.c
Original file line number Diff line number Diff line change
@@ -18,15 +18,14 @@
*====================================================================*/

#include "n_synthInternals.h"
#include "../45720.h"

// This function appears to be different than the stock n_alMainBusPull.

extern u8 D_800FC824;
extern u8 D_80077D98;
extern u8* D_800FC6D8;
extern u32 D_800FD6F0;
extern u8* D_800FCF28[];
extern u32 D_800FCF30[];

Acmd* n_alMainBusPull(s32 sampleOffset, Acmd* p) {
Acmd* ptr = p;
@@ -39,7 +38,6 @@ Acmd* n_alMainBusPull(s32 sampleOffset, Acmd* p) {
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);

// theres more code after?
if (D_800FC824 != 0) {
aClearBuffer(ptr++, 0x7C0, 0x2E0);
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FC6D8[D_800FD6F0 * 2]));
@@ -57,8 +55,8 @@ Acmd* n_alMainBusPull(s32 sampleOffset, Acmd* p) {
if (D_80077D98 != 0) {
for (i = 0; i < 2; i++) {
aClearBuffer(ptr++, 0x7C0, 0x2E0);
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(D_800FCF28[i]->unk_000 + D_800FCF30[i]));
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(D_800FCF28[i]->unk_000 + D_800FCF30[i]));

D_800FCF30[i] += 0xB8;
if (D_800FCF30[i] >= 0x8A0) {
4 changes: 4 additions & 0 deletions yamls/us/rom.yaml
Original file line number Diff line number Diff line change
@@ -355,6 +355,7 @@
- [0x78990, data, rom_data_78990]
- [0x79180, .data, libnaudio/n_sl]
- [0x79190, data, rom_data_79190]
- [0x791F0, .data, 45720]
- [0x79200, .data, libnaudio/n_env]
- [0x79300, data, rom_data_79300]
- [0x79630, .data, 49790]
@@ -429,6 +430,7 @@
- [0x7D340, .rodata, 38BB0]
- [0x7D3C0, rodata, rom_rodata_7D3C0]
- [0x7D3E0, rodata, rom_rodata_7D3E0]
- [0x7D860, .rodata, 45720]
- [0x7D880, .rodata, libnaudio/n_env]
- [0x7D8D0, rodata, rom_rodata_7D8D0]
- [0x7DF80, rodata, rom_rodata_7DF80]
@@ -503,6 +505,8 @@
- {vram: 0x800B32A0, type: .bss, name: 373A0}
- {vram: 0x800FC7A0, type: .bss, name: 38BB0}
- {vram: 0x800FC820, type: bss, name: unk_bss_12}
- {vram: 0x800FCED0, type: .bss, name: 45720}
- {vram: 0x800FCF60, type: bss, name: unk_bss_15}
- {vram: 0x800FF990, type: .bss, name: 4B940}
- {vram: 0x800FF9B0, type: .bss, name: 4BDC0}
- {vram: 0x800FF9C0, type: bss, name: unk_bss_10}

0 comments on commit 8b69bff

Please sign in to comment.