mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 06:54:33 +00:00
Match func_800EEA50 + some surrounding doc (#916)
* Match func_800EEA50 * Document some audio debug stuff * more doc * more doc * formatting * Fix enums, and some more bits of doc * review * LIM -> MAX * missed review suggestion... * more review * ganon comments * more review * 🐍☠️ * more review * Update functions.h * quotes * review Co-authored-by: zelda2774 <zelda2774@invalid>
This commit is contained in:
parent
28e72bb486
commit
a75c70358c
37 changed files with 1562 additions and 5496 deletions
|
@ -673,7 +673,7 @@ void func_800DF7C4(void) {
|
|||
s32 i;
|
||||
s32 j;
|
||||
|
||||
if (gAudioContext.audioBufferParameters.presetUnk4 == 2) {
|
||||
if (gAudioContext.audioBufferParameters.specUnk4 == 2) {
|
||||
count = 2;
|
||||
} else {
|
||||
count = 1;
|
||||
|
@ -703,7 +703,7 @@ s32 Audio_ResetStep(void) {
|
|||
s32 j;
|
||||
s32 sp24;
|
||||
|
||||
if (gAudioContext.audioBufferParameters.presetUnk4 == 2) {
|
||||
if (gAudioContext.audioBufferParameters.specUnk4 == 2) {
|
||||
sp24 = 2;
|
||||
} else {
|
||||
sp24 = 1;
|
||||
|
@ -787,11 +787,11 @@ void Audio_InitHeap(void) {
|
|||
s32 i;
|
||||
s32 j;
|
||||
s32 pad2;
|
||||
AudioSessionSettings* preset = &gAudioSessionPresets[gAudioContext.audioResetPresetIdToLoad];
|
||||
AudioSpec* spec;
|
||||
|
||||
preset = &gAudioSessionPresets[gAudioContext.audioResetPresetIdToLoad];
|
||||
spec = &gAudioSpecs[gAudioContext.audioResetSpecIdToLoad];
|
||||
gAudioContext.sampleDmaReqCnt = 0;
|
||||
gAudioContext.audioBufferParameters.frequency = preset->frequency;
|
||||
gAudioContext.audioBufferParameters.frequency = spec->frequency;
|
||||
gAudioContext.audioBufferParameters.aiFrequency = osAiSetFrequency(gAudioContext.audioBufferParameters.frequency);
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget =
|
||||
((gAudioContext.audioBufferParameters.frequency / gAudioContext.refreshRate) + 0xF) & 0xFFF0;
|
||||
|
@ -811,15 +811,15 @@ void Audio_InitHeap(void) {
|
|||
(1.0f / 256.0f) / gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.audioBufferParameters.unk_24 = gAudioContext.audioBufferParameters.updatesPerFrame * 0.25f;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrameInv = 1.0f / gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.unk_2874 = preset->unk_10;
|
||||
gAudioContext.unk_2878 = preset->unk_12;
|
||||
gAudioContext.unk_2874 = spec->unk_10;
|
||||
gAudioContext.unk_2878 = spec->unk_12;
|
||||
|
||||
gAudioContext.maxSimultaneousNotes = preset->maxSimultaneousNotes;
|
||||
gAudioContext.audioBufferParameters.numSequencePlayers = preset->numSequencePlayers;
|
||||
gAudioContext.maxSimultaneousNotes = spec->maxSimultaneousNotes;
|
||||
gAudioContext.audioBufferParameters.numSequencePlayers = spec->numSequencePlayers;
|
||||
if (gAudioContext.audioBufferParameters.numSequencePlayers > 4) {
|
||||
gAudioContext.audioBufferParameters.numSequencePlayers = 4;
|
||||
}
|
||||
gAudioContext.unk_2 = preset->unk_14;
|
||||
gAudioContext.unk_2 = spec->unk_14;
|
||||
gAudioContext.tempoInternalToExternal = (u32)(gAudioContext.audioBufferParameters.updatesPerFrame * 2880000.0f /
|
||||
gTatumsPerBeat / gAudioContext.unk_2960);
|
||||
|
||||
|
@ -828,22 +828,22 @@ void Audio_InitHeap(void) {
|
|||
gAudioContext.unk_2870 /= gAudioContext.audioBufferParameters.aiFrequency;
|
||||
gAudioContext.unk_2870 /= gAudioContext.tempoInternalToExternal;
|
||||
|
||||
gAudioContext.audioBufferParameters.presetUnk4 = preset->unk_04;
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.minAiBufferLength *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.specUnk4 = spec->unk_04;
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.minAiBufferLength *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
|
||||
if (gAudioContext.audioBufferParameters.presetUnk4 >= 2) {
|
||||
if (gAudioContext.audioBufferParameters.specUnk4 >= 2) {
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength -= 0x10;
|
||||
}
|
||||
|
||||
gAudioContext.maxAudioCmds =
|
||||
gAudioContext.maxSimultaneousNotes * 0x10 * gAudioContext.audioBufferParameters.updatesPerFrame +
|
||||
preset->numReverbs * 0x18 + 0x140;
|
||||
spec->numReverbs * 0x18 + 0x140;
|
||||
|
||||
persistentMem = preset->persistentSeqMem + preset->persistentBankMem + preset->persistentUnusedMem + 0x10;
|
||||
temporaryMem = preset->temporarySeqMem + preset->temporaryBankMem + preset->temporaryUnusedMem + 0x10;
|
||||
persistentMem = spec->persistentSeqMem + spec->persistentBankMem + spec->persistentUnusedMem + 0x10;
|
||||
temporaryMem = spec->temporarySeqMem + spec->temporaryBankMem + spec->temporaryUnusedMem + 0x10;
|
||||
totalMem = persistentMem + temporaryMem;
|
||||
wantMisc = gAudioContext.audioSessionPool.size - totalMem - 0x100;
|
||||
|
||||
|
@ -857,13 +857,13 @@ void Audio_InitHeap(void) {
|
|||
gAudioContext.seqAndBankPoolSplit.wantPersistent = persistentMem;
|
||||
gAudioContext.seqAndBankPoolSplit.wantTemporary = temporaryMem;
|
||||
Audio_SeqAndBankPoolInit(&gAudioContext.seqAndBankPoolSplit);
|
||||
gAudioContext.persistentCommonPoolSplit.wantSeq = preset->persistentSeqMem;
|
||||
gAudioContext.persistentCommonPoolSplit.wantBank = preset->persistentBankMem;
|
||||
gAudioContext.persistentCommonPoolSplit.wantUnused = preset->persistentUnusedMem;
|
||||
gAudioContext.persistentCommonPoolSplit.wantSeq = spec->persistentSeqMem;
|
||||
gAudioContext.persistentCommonPoolSplit.wantBank = spec->persistentBankMem;
|
||||
gAudioContext.persistentCommonPoolSplit.wantUnused = spec->persistentUnusedMem;
|
||||
Audio_PersistentPoolsInit(&gAudioContext.persistentCommonPoolSplit);
|
||||
gAudioContext.temporaryCommonPoolSplit.wantSeq = preset->temporarySeqMem;
|
||||
gAudioContext.temporaryCommonPoolSplit.wantBank = preset->temporaryBankMem;
|
||||
gAudioContext.temporaryCommonPoolSplit.wantUnused = preset->temporaryUnusedMem;
|
||||
gAudioContext.temporaryCommonPoolSplit.wantSeq = spec->temporarySeqMem;
|
||||
gAudioContext.temporaryCommonPoolSplit.wantBank = spec->temporaryBankMem;
|
||||
gAudioContext.temporaryCommonPoolSplit.wantUnused = spec->temporaryUnusedMem;
|
||||
Audio_TemporaryPoolsInit(&gAudioContext.temporaryCommonPoolSplit);
|
||||
|
||||
Audio_ResetLoadStatus();
|
||||
|
@ -886,9 +886,9 @@ void Audio_InitHeap(void) {
|
|||
gAudioContext.synthesisReverbs[i].useReverb = 0;
|
||||
}
|
||||
|
||||
gAudioContext.numSynthesisReverbs = preset->numReverbs;
|
||||
gAudioContext.numSynthesisReverbs = spec->numReverbs;
|
||||
for (i = 0; i < gAudioContext.numSynthesisReverbs; i++) {
|
||||
ReverbSettings* settings = &preset->reverbSettings[i];
|
||||
ReverbSettings* settings = &spec->reverbSettings[i];
|
||||
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[i];
|
||||
reverb->downsampleRate = settings->downsampleRate;
|
||||
reverb->windowSize = settings->windowSize * 64;
|
||||
|
@ -961,7 +961,7 @@ void Audio_InitHeap(void) {
|
|||
Audio_ResetSequencePlayer(&gAudioContext.seqPlayers[j]);
|
||||
}
|
||||
|
||||
func_800E0634(preset->unk_30, preset->unk_34);
|
||||
func_800E0634(spec->unk_30, spec->unk_34);
|
||||
func_800E1618(gAudioContext.maxSimultaneousNotes);
|
||||
gAudioContext.unk_176C = 0;
|
||||
Audio_SyncLoadsInit();
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef enum { LOAD_STATUS_WAITING, LOAD_STATUS_START, LOAD_STATUS_LOADING, LOAD
|
|||
|
||||
/* forward declarations */
|
||||
s32 func_800E217C(s32 playerIdx, s32, s32);
|
||||
unk_ldr* func_800E2454(u32 arg0);
|
||||
unk_ldr* func_800E2454(u32 bankId);
|
||||
AudioBankSample* Audio_GetBankSample(s32 bankId, s32 sfxId);
|
||||
void Audio_ProcessAsyncLoads(s32 arg0);
|
||||
void Audio_HandleAsyncMsg(AsyncLoadReq* arg0, s32 arg1);
|
||||
|
@ -16,7 +16,7 @@ void func_800E4198(s32, unk_ldr*, RelocInfo*, s32);
|
|||
void Audio_SampleReloc(AudioBankSound* sound, u32, RelocInfo*);
|
||||
void func_800E202C(s32 arg0);
|
||||
u32 func_800E2338(u32 arg0, u32* arg1, s32 arg2);
|
||||
u8* func_800E2558(u32 tableType, u32 bankId, s32* didAllocate);
|
||||
u8* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate);
|
||||
u32 Audio_GetTableIndex(s32 tableType, u32 tableIdx);
|
||||
void* func_800E27A4(s32 tableType, s32 id);
|
||||
void* Audio_GetLoadTable(s32 tableType);
|
||||
|
@ -83,8 +83,8 @@ void func_800E1618(s32 arg0) {
|
|||
gAudioContext.unk_288C = gAudioContext.unk_2874;
|
||||
gAudioContext.sampleDmaReqs =
|
||||
Audio_Alloc(&gAudioContext.notesAndBuffersPool, 4 * gAudioContext.maxSimultaneousNotes * sizeof(SampleDmaReq) *
|
||||
gAudioContext.audioBufferParameters.presetUnk4);
|
||||
t2 = 3 * gAudioContext.maxSimultaneousNotes * gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.specUnk4);
|
||||
t2 = 3 * gAudioContext.maxSimultaneousNotes * gAudioContext.audioBufferParameters.specUnk4;
|
||||
for (i = 0; i < t2; i++) {
|
||||
temp_s0 = &gAudioContext.sampleDmaReqs[gAudioContext.sampleDmaReqCnt];
|
||||
temp_s0->ramAddr = func_800DE2B0(&gAudioContext.notesAndBuffersPool, gAudioContext.unk_288C);
|
||||
|
@ -310,8 +310,8 @@ s32 func_800E1D64(s32 arg0, s32 arg1, s32 arg2) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio_AsyncLoad(s32 arg0, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue* queue) {
|
||||
if (Audio_AsyncLoadInner(arg0, arg1, arg2, arg3, queue) == NULL) {
|
||||
void Audio_AsyncLoad(s32 tableType, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue* queue) {
|
||||
if (Audio_AsyncLoadInner(tableType, arg1, arg2, arg3, queue) == NULL) {
|
||||
osSendMesg(queue, -1, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
|
@ -352,8 +352,8 @@ void func_800E1F7C(s32 arg0) {
|
|||
|
||||
while (phi_s2 > 0) {
|
||||
phi_s2--;
|
||||
temp_s0 = Audio_GetTableIndex(1, gAudioContext.unk_283Cb[phi_s1++]);
|
||||
if (func_800E04E8(1, temp_s0) == NULL) {
|
||||
temp_s0 = Audio_GetTableIndex(BANK_TABLE, gAudioContext.unk_283Cb[phi_s1++]);
|
||||
if (func_800E04E8(BANK_TABLE, temp_s0) == NULL) {
|
||||
func_800E202C(temp_s0);
|
||||
Audio_SetBankLoadStatus(temp_s0, 0);
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ s32 func_800E217C(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||
|
||||
Audio_ResetSequencePlayer(seqPlayer);
|
||||
seqPlayer->seqId = seqId;
|
||||
seqPlayer->defaultBank = Audio_GetTableIndex(1, phi_s2);
|
||||
seqPlayer->defaultBank = Audio_GetTableIndex(BANK_TABLE, phi_s2);
|
||||
seqPlayer->seqData = seqData;
|
||||
seqPlayer->enabled = 1;
|
||||
seqPlayer->scriptState.pc = seqData;
|
||||
|
@ -446,11 +446,11 @@ u8* func_800E22C4(s32 seqId) {
|
|||
s32 pad;
|
||||
s32 sp20;
|
||||
|
||||
if (gAudioContext.seqLoadStatus[Audio_GetTableIndex(0, seqId)] == 1) {
|
||||
if (gAudioContext.seqLoadStatus[Audio_GetTableIndex(SEQUENCE_TABLE, seqId)] == 1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return func_800E2558(0, seqId, &sp20);
|
||||
return func_800E2558(SEQUENCE_TABLE, seqId, &sp20);
|
||||
}
|
||||
|
||||
u32 func_800E2318(u32 arg0, u32* arg1) {
|
||||
|
@ -460,12 +460,11 @@ u32 func_800E2318(u32 arg0, u32* arg1) {
|
|||
u32 func_800E2338(u32 arg0, u32* arg1, s32 arg2) {
|
||||
void* temp_v0;
|
||||
AudioTable* audioTable;
|
||||
u32 temp_s0;
|
||||
u32 temp_s0 = Audio_GetTableIndex(AUDIO_TABLE, arg0);
|
||||
s8 tmp;
|
||||
|
||||
temp_s0 = Audio_GetTableIndex(2, arg0);
|
||||
audioTable = Audio_GetLoadTable(2);
|
||||
if (temp_v0 = func_800E27A4(2, temp_s0), temp_v0 != NULL) {
|
||||
audioTable = Audio_GetLoadTable(AUDIO_TABLE);
|
||||
if (temp_v0 = func_800E27A4(AUDIO_TABLE, temp_s0), temp_v0 != NULL) {
|
||||
if (gAudioContext.audioTableLoadStatus[temp_s0] != 1) {
|
||||
Audio_SetAudtabLoadStatus(temp_s0, 2);
|
||||
}
|
||||
|
@ -474,7 +473,7 @@ u32 func_800E2338(u32 arg0, u32* arg1, s32 arg2) {
|
|||
} else if (tmp = audioTable->entries[arg0].unk_09, tmp == 4 || arg2 == 1) {
|
||||
*arg1 = audioTable->entries[arg0].unk_08;
|
||||
return audioTable->entries[temp_s0].romAddr;
|
||||
} else if (temp_v0 = func_800E2558(2, arg0, &arg2), temp_v0 != NULL) {
|
||||
} else if (temp_v0 = func_800E2558(AUDIO_TABLE, arg0, &arg2), temp_v0 != NULL) {
|
||||
*arg1 = 0;
|
||||
return temp_v0;
|
||||
} else {
|
||||
|
@ -483,15 +482,14 @@ u32 func_800E2338(u32 arg0, u32* arg1, s32 arg2) {
|
|||
}
|
||||
}
|
||||
|
||||
unk_ldr* func_800E2454(u32 arg0) {
|
||||
unk_ldr* func_800E2454(u32 bankId) {
|
||||
u8* temp_ret;
|
||||
s32 unk02;
|
||||
s32 unk03;
|
||||
s32 sp38;
|
||||
RelocInfo relocInfo;
|
||||
s32 idx;
|
||||
s32 idx = Audio_GetTableIndex(BANK_TABLE, bankId);
|
||||
|
||||
idx = Audio_GetTableIndex(BANK_TABLE, arg0);
|
||||
if (gAudioContext.bankLoadStatus[idx] == 1) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -512,7 +510,7 @@ unk_ldr* func_800E2454(u32 arg0) {
|
|||
relocInfo.unk_0C = 0;
|
||||
}
|
||||
|
||||
temp_ret = func_800E2558(1, arg0, &sp38);
|
||||
temp_ret = func_800E2558(BANK_TABLE, bankId, &sp38);
|
||||
if (temp_ret == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -523,7 +521,7 @@ unk_ldr* func_800E2454(u32 arg0) {
|
|||
return temp_ret;
|
||||
}
|
||||
|
||||
u8* func_800E2558(u32 tableType, u32 bankId, s32* didAllocate) {
|
||||
u8* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate) {
|
||||
u32 size;
|
||||
AudioTable* table;
|
||||
s32 pad;
|
||||
|
@ -534,7 +532,7 @@ u8* func_800E2558(u32 tableType, u32 bankId, s32* didAllocate) {
|
|||
u8* ret;
|
||||
u32 id;
|
||||
|
||||
id = Audio_GetTableIndex(tableType, bankId);
|
||||
id = Audio_GetTableIndex(tableType, tableIdx);
|
||||
ret = func_800E27A4(tableType, id);
|
||||
if (ret != NULL) {
|
||||
*didAllocate = false;
|
||||
|
@ -543,8 +541,8 @@ u8* func_800E2558(u32 tableType, u32 bankId, s32* didAllocate) {
|
|||
table = Audio_GetLoadTable(tableType);
|
||||
size = table->entries[id].size;
|
||||
size = ALIGN16(size);
|
||||
sp40 = table->entries[bankId].unk_08;
|
||||
sp24 = table->entries[bankId].unk_09;
|
||||
sp40 = table->entries[tableIdx].unk_08;
|
||||
sp24 = table->entries[tableIdx].unk_09;
|
||||
romAddr = table->entries[id].romAddr;
|
||||
switch (sp24) {
|
||||
case 0:
|
||||
|
@ -804,10 +802,10 @@ s32 Audio_DMA(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void* ra
|
|||
void func_800E2CB8(void) {
|
||||
}
|
||||
|
||||
void func_800E2CC0(u32 arg0, u32 arg1) {
|
||||
void func_800E2CC0(u32 tableType, u32 bankId) {
|
||||
s32 sp1C;
|
||||
|
||||
func_800E2558(arg0, arg1, &sp1C);
|
||||
func_800E2558(tableType, bankId, &sp1C);
|
||||
}
|
||||
|
||||
void* Audio_AsyncLoadInner(s32 tableType, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue* retQueue) {
|
||||
|
@ -1018,7 +1016,7 @@ void Audio_ContextInit(void* heap, u32 heapSize) {
|
|||
gAudioContext.unk_283C = &D_80155340;
|
||||
gAudioContext.seqTabEntCnt = gAudioContext.sequenceTable->header.entryCnt;
|
||||
|
||||
gAudioContext.audioResetPresetIdToLoad = 0;
|
||||
gAudioContext.audioResetSpecIdToLoad = 0;
|
||||
gAudioContext.resetStatus = 1;
|
||||
|
||||
Audio_ResetStep();
|
||||
|
@ -1205,8 +1203,8 @@ s32 Audio_SyncLoadSeq(s32 seqIdx, u8* ramAddr, u8* isDone) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
seqIdx = Audio_GetTableIndex(0, seqIdx);
|
||||
seqTable = Audio_GetLoadTable(0);
|
||||
seqIdx = Audio_GetTableIndex(SEQUENCE_TABLE, seqIdx);
|
||||
seqTable = Audio_GetLoadTable(SEQUENCE_TABLE);
|
||||
syncLoad = &gAudioContext.syncLoads[gAudioContext.syncLoadPos];
|
||||
if (syncLoad->status == LOAD_STATUS_DONE) {
|
||||
syncLoad->status = LOAD_STATUS_WAITING;
|
||||
|
@ -1618,10 +1616,10 @@ void func_800E4EDC(void) {
|
|||
void func_800E4EE4(void) {
|
||||
}
|
||||
|
||||
void func_800E4EEC(s32 arg0, s32 arg1, u8* arg2) {
|
||||
void func_800E4EEC(s32 tableType, s32 arg1, u8* arg2) {
|
||||
static u32 D_801304DC = 0;
|
||||
D_8016B738[D_801304DC] = arg2;
|
||||
Audio_AsyncLoad(arg0, arg1, 0, D_801304DC, &D_8016B6E0);
|
||||
Audio_AsyncLoad(tableType, arg1, 0, D_801304DC, &D_8016B6E0);
|
||||
D_801304DC++;
|
||||
if (D_801304DC == 0x10) {
|
||||
D_801304DC = 0;
|
||||
|
|
|
@ -55,13 +55,13 @@ AudioTask* func_800E5000(void) {
|
|||
s32 i;
|
||||
|
||||
gAudioContext.totalTaskCnt++;
|
||||
if (gAudioContext.totalTaskCnt % (gAudioContext.audioBufferParameters.presetUnk4) != 0) {
|
||||
if (gAudioContext.totalTaskCnt % (gAudioContext.audioBufferParameters.specUnk4) != 0) {
|
||||
if (D_801755D0 != NULL) {
|
||||
D_801755D0();
|
||||
}
|
||||
|
||||
if ((gAudioContext.totalTaskCnt % gAudioContext.audioBufferParameters.presetUnk4) + 1 ==
|
||||
gAudioContext.audioBufferParameters.presetUnk4) {
|
||||
if ((gAudioContext.totalTaskCnt % gAudioContext.audioBufferParameters.specUnk4) + 1 ==
|
||||
gAudioContext.audioBufferParameters.specUnk4) {
|
||||
return sWaitingAudioTask;
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -114,7 +114,7 @@ AudioTask* func_800E5000(void) {
|
|||
if (gAudioContext.resetStatus != 0) {
|
||||
if (Audio_ResetStep() == 0) {
|
||||
if (gAudioContext.resetStatus == 0) {
|
||||
osSendMesg(gAudioContext.audioResetQueueP, gAudioContext.audioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
osSendMesg(gAudioContext.audioResetQueueP, gAudioContext.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
sWaitingAudioTask = NULL;
|
||||
|
@ -196,7 +196,7 @@ AudioTask* func_800E5000(void) {
|
|||
sMaxAbiCmdCnt = abiCmdCnt;
|
||||
}
|
||||
|
||||
if (gAudioContext.audioBufferParameters.presetUnk4 == 1) {
|
||||
if (gAudioContext.audioBufferParameters.specUnk4 == 1) {
|
||||
return gAudioContext.currTask;
|
||||
} else {
|
||||
sWaitingAudioTask = gAudioContext.currTask;
|
||||
|
@ -289,7 +289,7 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
return;
|
||||
case 0xF9:
|
||||
gAudioContext.resetStatus = 5;
|
||||
gAudioContext.audioResetPresetIdToLoad = cmd->asUInt;
|
||||
gAudioContext.audioResetSpecIdToLoad = cmd->asUInt;
|
||||
return;
|
||||
case 0xFB:
|
||||
D_801755D0 = (void (*)(void))cmd->asUInt;
|
||||
|
@ -508,7 +508,7 @@ s32 func_800E5EDC(void) {
|
|||
|
||||
if (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) {
|
||||
return 0;
|
||||
} else if (gAudioContext.audioResetPresetIdToLoad != sp18) {
|
||||
} else if (gAudioContext.audioResetSpecIdToLoad != sp18) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
|
@ -531,10 +531,10 @@ s32 func_800E5F88(u32 resetPreloadID) {
|
|||
resetStatus = gAudioContext.resetStatus;
|
||||
if (resetStatus != 0) {
|
||||
Audio_ResetCmdQueue();
|
||||
if (gAudioContext.audioResetPresetIdToLoad == resetPreloadID) {
|
||||
if (gAudioContext.audioResetSpecIdToLoad == resetPreloadID) {
|
||||
return -2;
|
||||
} else if (resetStatus > 2) {
|
||||
gAudioContext.audioResetPresetIdToLoad = resetPreloadID;
|
||||
gAudioContext.audioResetSpecIdToLoad = resetPreloadID;
|
||||
return -3;
|
||||
} else {
|
||||
osRecvMesg(gAudioContext.audioResetQueueP, &msg, OS_MESG_BLOCK);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,10 +6,10 @@ typedef struct {
|
|||
/* 0x00 */ u16 sfxId;
|
||||
/* 0x04 */ Vec3f* pos;
|
||||
/* 0x08 */ u8 unk_8;
|
||||
/* 0x0C */ f32* unk_C;
|
||||
/* 0x0C */ f32* freqScale;
|
||||
/* 0x10 */ f32* unk_10;
|
||||
/* 0x14 */ s8* unk_14;
|
||||
} Struct_800F738C; // size = 0x18
|
||||
/* 0x14 */ s8* reverbAdd;
|
||||
} SoundRequest; // size = 0x18
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ f32 unk_0;
|
||||
|
@ -18,7 +18,8 @@ typedef struct {
|
|||
/* 0x0C */ u16 unk_C;
|
||||
} Struct_800F8EA0; // size = 0x10
|
||||
|
||||
// rodata for func_800F7680 (this file)
|
||||
// rodata for Audio_ProcessSoundRequest (this file)
|
||||
// (probably moved to .data due to -use_readwrite_const)
|
||||
char D_80133340[] = "SE";
|
||||
|
||||
// rodata for func_800F7CEC (this file)
|
||||
|
@ -32,9 +33,10 @@ char D_80133390[] = "SEQ H";
|
|||
char D_80133398[] = " L";
|
||||
|
||||
// data
|
||||
u8 D_801333A0 = 0;
|
||||
|
||||
u8 D_801333A4 = 0;
|
||||
// sSoundRequests ring buffer endpoints. read index <= write index, wrapping around mod 256.
|
||||
u8 sSoundRequestWriteIndex = 0;
|
||||
u8 sSoundRequestReadIndex = 0;
|
||||
|
||||
/**
|
||||
* Array of pointers to arrays of SoundBankEntry of sizes: 9, 12, 22, 20, 8, 3, 5
|
||||
|
@ -60,36 +62,36 @@ u8 D_801333CC = 0;
|
|||
|
||||
u16 D_801333D0 = 0;
|
||||
|
||||
Vec3f D_801333D4 = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f D_801333D4 = { 0.0f, 0.0f, 0.0f }; // default pos
|
||||
|
||||
f32 D_801333E0 = 1.0f;
|
||||
f32 D_801333E0 = 1.0f; // default freqScale
|
||||
|
||||
UNK_TYPE D_801333E4 = 0;
|
||||
s32 D_801333E4 = 0; // unused
|
||||
|
||||
s8 D_801333E8 = 0;
|
||||
s8 D_801333E8 = 0; // default reverbAdd
|
||||
|
||||
UNK_TYPE D_801333EC = 0;
|
||||
s32 D_801333EC = 0; // unused
|
||||
|
||||
u8 D_801333F0 = 0;
|
||||
|
||||
u8 D_801333F4 = 0;
|
||||
u8 gAudioSEFlagSwapOff = 0;
|
||||
|
||||
u8 D_801333F8 = 0;
|
||||
|
||||
extern Struct_800F738C D_8016C9A0[];
|
||||
extern Struct_800F8EA0 D_8016E270[];
|
||||
extern SoundRequest sSoundRequests[0x100];
|
||||
extern Struct_800F8EA0 D_8016E270[7];
|
||||
extern Struct_8013331C* D_8013331C[9];
|
||||
|
||||
void func_800F7260(u16 arg0) {
|
||||
void Audio_SetSoundBanksMute(u16 muteMask) {
|
||||
u8 bankId;
|
||||
|
||||
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
|
||||
if (arg0 & 1) {
|
||||
D_8016E264[bankId] = 1;
|
||||
if (muteMask & 1) {
|
||||
gSoundBankMuted[bankId] = true;
|
||||
} else {
|
||||
D_8016E264[bankId] = 0;
|
||||
gSoundBankMuted[bankId] = false;
|
||||
}
|
||||
arg0 = (arg0 >> 1) & 0xFFFF;
|
||||
muteMask = muteMask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,98 +109,96 @@ void Audio_ClearBGMMute(u8 arg0) {
|
|||
}
|
||||
}
|
||||
|
||||
// a3 = freq scale factor for ocarina
|
||||
// a5 = reverb add
|
||||
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* a1, u8 a2, f32* a3, f32* a4, s8* a5) {
|
||||
// a4 is often the same as freqScale. (u8)(*a4 * 127.0f) is sent to script on IO port 2
|
||||
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 a2, f32* freqScale, f32* a4, s8* reverbAdd) {
|
||||
u8 i;
|
||||
Struct_800F738C* phi_v0;
|
||||
SoundRequest* req;
|
||||
|
||||
if (D_8016E264[SFX_BANK_SHIFT(sfxId)] == 0) {
|
||||
phi_v0 = &D_8016C9A0[D_801333A0];
|
||||
if (D_801333F4 == 0) {
|
||||
if (!gSoundBankMuted[SFX_BANK_SHIFT(sfxId)]) {
|
||||
req = &sSoundRequests[sSoundRequestWriteIndex];
|
||||
if (!gAudioSEFlagSwapOff) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (sfxId == D_8016E2E0[i]) {
|
||||
if (D_8016E310[i] == 0) {
|
||||
sfxId = D_8016E2F8[i];
|
||||
} else {
|
||||
phi_v0->sfxId = D_8016E2F8[i];
|
||||
phi_v0->pos = a1;
|
||||
phi_v0->unk_8 = a2;
|
||||
phi_v0->unk_C = a3;
|
||||
phi_v0->unk_10 = a4;
|
||||
phi_v0->unk_14 = a5;
|
||||
D_801333A0++;
|
||||
phi_v0 = &D_8016C9A0[D_801333A0];
|
||||
if (sfxId == gAudioSEFlagSwapSource[i]) {
|
||||
if (gAudioSEFlagSwapMode[i] == 0) { // "SWAP"
|
||||
sfxId = gAudioSEFlagSwapTarget[i];
|
||||
} else { // "ADD"
|
||||
req->sfxId = gAudioSEFlagSwapTarget[i];
|
||||
req->pos = pos;
|
||||
req->unk_8 = a2;
|
||||
req->freqScale = freqScale;
|
||||
req->unk_10 = a4;
|
||||
req->reverbAdd = reverbAdd;
|
||||
sSoundRequestWriteIndex++;
|
||||
req = &sSoundRequests[sSoundRequestWriteIndex];
|
||||
}
|
||||
i = 10;
|
||||
i = 10; // "break;"
|
||||
}
|
||||
}
|
||||
}
|
||||
phi_v0->sfxId = sfxId;
|
||||
phi_v0->pos = a1;
|
||||
phi_v0->unk_8 = a2;
|
||||
phi_v0->unk_C = a3;
|
||||
phi_v0->unk_10 = a4;
|
||||
phi_v0->unk_14 = a5;
|
||||
D_801333A0++;
|
||||
req->sfxId = sfxId;
|
||||
req->pos = pos;
|
||||
req->unk_8 = a2;
|
||||
req->freqScale = freqScale;
|
||||
req->unk_10 = a4;
|
||||
req->reverbAdd = reverbAdd;
|
||||
sSoundRequestWriteIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F74E0(u8 arg0, SoundBankEntry* arg1) {
|
||||
Struct_800F738C* entry;
|
||||
s32 phi_a0;
|
||||
u8 i = D_801333A4;
|
||||
void Audio_RemoveMatchingSoundRequests(u8 aspect, SoundBankEntry* cmp) {
|
||||
SoundRequest* req;
|
||||
s32 remove;
|
||||
u8 i = sSoundRequestReadIndex;
|
||||
|
||||
for (i; i != D_801333A0; i++) {
|
||||
phi_a0 = false;
|
||||
entry = &D_8016C9A0[i];
|
||||
switch (arg0) {
|
||||
for (; i != sSoundRequestWriteIndex; i++) {
|
||||
remove = false;
|
||||
req = &sSoundRequests[i];
|
||||
switch (aspect) {
|
||||
case 0:
|
||||
if (SFX_BANK_MASK(entry->sfxId) == SFX_BANK_MASK(arg1->unk_28)) {
|
||||
phi_a0 = true;
|
||||
if (SFX_BANK_MASK(req->sfxId) == SFX_BANK_MASK(cmp->unk_28)) {
|
||||
remove = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SFX_BANK_MASK(entry->sfxId) == SFX_BANK_MASK(arg1->unk_28) && (&entry->pos->x == arg1->posX)) {
|
||||
phi_a0 = true;
|
||||
if (SFX_BANK_MASK(req->sfxId) == SFX_BANK_MASK(cmp->unk_28) && (&req->pos->x == cmp->posX)) {
|
||||
remove = true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (&entry->pos->x == arg1->posX) {
|
||||
phi_a0 = true;
|
||||
if (&req->pos->x == cmp->posX) {
|
||||
remove = true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (&entry->pos->x == arg1->posX && entry->sfxId == arg1->unk_28) {
|
||||
phi_a0 = true;
|
||||
if (&req->pos->x == cmp->posX && req->sfxId == cmp->unk_28) {
|
||||
remove = true;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (entry->unk_8 == arg1->unk_C && entry->sfxId == arg1->unk_28) {
|
||||
phi_a0 = true;
|
||||
if (req->unk_8 == cmp->unk_C && req->sfxId == cmp->unk_28) {
|
||||
remove = true;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (entry->sfxId == arg1->unk_28) {
|
||||
phi_a0 = true;
|
||||
if (req->sfxId == cmp->unk_28) {
|
||||
remove = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (phi_a0) {
|
||||
entry->sfxId = 0;
|
||||
if (remove) {
|
||||
req->sfxId = 0;
|
||||
}
|
||||
// i++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Down to a/v regalloc and some stuff where the compiler gets confused about reusing values. There's some fake matching
|
||||
// stuff to improve regalloc enough to verify equivalence.
|
||||
void func_800F7680(void) {
|
||||
void Audio_ProcessSoundRequest(void) {
|
||||
u16 flag1;
|
||||
u8 sp55;
|
||||
u8 phi_a1;
|
||||
Struct_800F738C* sp50;
|
||||
SoundRequest* req; // sp50
|
||||
SoundBankEntry* temp_v0;
|
||||
Struct_8013331C* sp48;
|
||||
s32 phi_s5;
|
||||
|
@ -206,25 +206,25 @@ void func_800F7680(void) {
|
|||
u8 phi_s1;
|
||||
u16 flag2;
|
||||
|
||||
sp50 = &D_8016C9A0[D_801333A4];
|
||||
req = &sSoundRequests[sSoundRequestReadIndex];
|
||||
phi_s1 = 0x80;
|
||||
if (sp50->sfxId == 0) {
|
||||
if (req->sfxId == 0) {
|
||||
return;
|
||||
}
|
||||
phi_s5 = SFX_BANK(sp50->sfxId);
|
||||
phi_s5 = SFX_BANK(req->sfxId);
|
||||
if ((1 << phi_s5) & D_801333F0) {
|
||||
func_800F2D6C(D_80133340, sp50->sfxId);
|
||||
phi_s5 = SFX_BANK(sp50->sfxId);
|
||||
AudioDebug_ScrPrt((const s8*)D_80133340, req->sfxId);
|
||||
phi_s5 = SFX_BANK(req->sfxId);
|
||||
}
|
||||
sp55 = 0;
|
||||
phi_a1 = gSoundBanks[phi_s5][0].next;
|
||||
while (phi_a1 != 0xFF && phi_a1 != 0) {
|
||||
if (gSoundBanks[phi_s5][phi_a1].posX == &sp50->pos->x) {
|
||||
sp48 = &D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)];
|
||||
if (gSoundBanks[phi_s5][phi_a1].posX == &req->pos->x) {
|
||||
sp48 = &D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
|
||||
if (!(!(sp48->unk_2 & 0x20) || sp48->unk_0 != gSoundBanks[phi_s5][phi_a1].unk_24)) {
|
||||
return;
|
||||
}
|
||||
if (gSoundBanks[phi_s5][phi_a1].unk_28 == sp50->sfxId) {
|
||||
if (gSoundBanks[phi_s5][phi_a1].unk_28 == req->sfxId) {
|
||||
sp55 = D_80130594[D_801333CC][phi_s5];
|
||||
} else {
|
||||
//! @bug possibly uninitialized sp43 ? confirm when matching
|
||||
|
@ -243,20 +243,20 @@ void func_800F7680(void) {
|
|||
}
|
||||
}
|
||||
if (D_80130594[D_801333CC][phi_s5] == sp55) {
|
||||
flag2 = sp50->sfxId & 0xC00; // Problem is around here
|
||||
sp48 = &D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)];
|
||||
if ((flag2) || (D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)].unk_2 & 4) ||
|
||||
flag2 = req->sfxId & 0xC00; // Problem is around here
|
||||
sp48 = &D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
|
||||
if ((flag2) || (D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].unk_2 & 4) ||
|
||||
(phi_a1 == phi_s1)) {
|
||||
if ((gSoundBanks[phi_s5][phi_a1].unk_26 & 8) && gSoundBanks[phi_s5][phi_a1].unk_2A != 1) {
|
||||
Audio_ClearBGMMute(gSoundBanks[phi_s5][phi_a1].unk_2E);
|
||||
}
|
||||
gSoundBanks[phi_s5][phi_a1].unk_C = sp50->unk_8;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_28 = sp50->sfxId;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_C = req->unk_8;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_28 = req->sfxId;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_2A = 1;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_2B = 2;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_10 = sp50->unk_C;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_14 = sp50->unk_10;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_18 = sp50->unk_14;
|
||||
gSoundBanks[phi_s5][phi_a1].freqScale = req->freqScale;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_14 = req->unk_10;
|
||||
gSoundBanks[phi_s5][phi_a1].reverbAdd = req->reverbAdd;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_26 = sp48->unk_2;
|
||||
gSoundBanks[phi_s5][phi_a1].unk_24 = sp48->unk_0;
|
||||
if (!sp48->unk_2) {}
|
||||
|
@ -273,17 +273,17 @@ void func_800F7680(void) {
|
|||
if (gSoundBanks[phi_s5][D_8016E1A8[phi_s5]].next != 0xFF && phi_a1 != 0) {
|
||||
phi_a1 = D_8016E1A8[phi_s5];
|
||||
temp_v0 = &gSoundBanks[phi_s5][phi_a1];
|
||||
temp_v0->posX = &sp50->pos->x;
|
||||
temp_v0->posY = &sp50->pos->y;
|
||||
temp_v0->posZ = &sp50->pos->z;
|
||||
temp_v0->unk_C = sp50->unk_8;
|
||||
temp_v0->unk_10 = sp50->unk_C;
|
||||
temp_v0->unk_14 = sp50->unk_10;
|
||||
temp_v0->unk_18 = sp50->unk_14;
|
||||
sp48 = &D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)];
|
||||
temp_v0->posX = &req->pos->x;
|
||||
temp_v0->posY = &req->pos->y;
|
||||
temp_v0->posZ = &req->pos->z;
|
||||
temp_v0->unk_C = req->unk_8;
|
||||
temp_v0->freqScale = req->freqScale;
|
||||
temp_v0->unk_14 = req->unk_10;
|
||||
temp_v0->reverbAdd = req->reverbAdd;
|
||||
sp48 = &D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
|
||||
temp_v0->unk_26 = sp48->unk_2;
|
||||
temp_v0->unk_24 = sp48->unk_0;
|
||||
temp_v0->unk_28 = sp50->sfxId;
|
||||
temp_v0->unk_28 = req->sfxId;
|
||||
temp_v0->unk_2A = 1;
|
||||
temp_v0->unk_2B = 2;
|
||||
temp_v0->prev = D_8016E1A0[phi_s5];
|
||||
|
@ -295,8 +295,8 @@ void func_800F7680(void) {
|
|||
}
|
||||
}
|
||||
#else
|
||||
void func_800F7680(void);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F7260/func_800F7680.s")
|
||||
void Audio_ProcessSoundRequest(void);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F7260/Audio_ProcessSoundRequest.s")
|
||||
#endif
|
||||
|
||||
void func_800F7B54(u8 bankId, u8 bankIndex) {
|
||||
|
@ -327,27 +327,26 @@ void func_800F7B54(u8 bankId, u8 bankIndex) {
|
|||
}
|
||||
|
||||
void func_800F7CEC(u8 arg0) {
|
||||
u8 phi_a1;
|
||||
u8 phi_s3;
|
||||
u8 spAE;
|
||||
u8 phi_s4;
|
||||
u8 spAC;
|
||||
u8 phi_s3;
|
||||
u8 i;
|
||||
u8 j;
|
||||
u8 phi_s0;
|
||||
u8 spA9;
|
||||
u8 phi_v1_5;
|
||||
u8 temp1;
|
||||
u8 temp2;
|
||||
u16 temp3;
|
||||
f32 tempf1;
|
||||
SoundBankEntry* temp_s2;
|
||||
SoundBankEntry* entry;
|
||||
Struct_800F7CEC sp84[3];
|
||||
Struct_800F7CEC* temp_s4_3;
|
||||
s32 pad;
|
||||
|
||||
phi_s3 = 0;
|
||||
for (spAC = 0; spAC < 3; spAC++) {
|
||||
sp84[spAC].unk_0 = 0x7FFFFFFF;
|
||||
sp84[spAC].unk_4 = 0xFF;
|
||||
for (i = 0; i < 3; i++) {
|
||||
sp84[i].unk_0 = 0x7FFFFFFF;
|
||||
sp84[i].unk_4 = 0xFF;
|
||||
}
|
||||
phi_s4 = gSoundBanks[arg0][0].next;
|
||||
phi_s0 = 0;
|
||||
|
@ -361,51 +360,51 @@ void func_800F7CEC(u8 arg0) {
|
|||
if (gSoundBanks[arg0][phi_s4].unk_2B == 0) {
|
||||
func_800F7B54(arg0, phi_s4);
|
||||
} else if (gSoundBanks[arg0][phi_s4].unk_2A != 0) {
|
||||
temp_s2 = &gSoundBanks[arg0][phi_s4];
|
||||
entry = &gSoundBanks[arg0][phi_s4];
|
||||
|
||||
if (&D_801333D4.x == temp_s2[0].posX) {
|
||||
temp_s2->unk_1C = 0.0f;
|
||||
if (&D_801333D4.x == entry[0].posX) {
|
||||
entry->dist = 0.0f;
|
||||
} else {
|
||||
tempf1 = *temp_s2->posY * 1;
|
||||
temp_s2->unk_1C = (SQ(*temp_s2->posX) + SQ(tempf1) + SQ(*temp_s2->posZ)) * 1;
|
||||
tempf1 = *entry->posY * 1;
|
||||
entry->dist = (SQ(*entry->posX) + SQ(tempf1) + SQ(*entry->posZ)) * 1;
|
||||
}
|
||||
spA9 = temp_s2->unk_24;
|
||||
if (temp_s2->unk_26 & 0x10) {
|
||||
temp_s2->unk_20 = SQ(0xFF - spA9) * 0x1690;
|
||||
spA9 = entry->unk_24;
|
||||
if (entry->unk_26 & 0x10) {
|
||||
entry->unk_20 = SQ(0xFF - spA9) * 0x1690;
|
||||
} else {
|
||||
if (temp_s2->unk_1C > 0x7FFFFFD0) {
|
||||
temp_s2->unk_1C = 0x70000008;
|
||||
osSyncPrintf(D_80133344, temp_s2->unk_28, temp_s2->posX, temp_s2->posZ, *temp_s2->posX,
|
||||
*temp_s2->posY, *temp_s2->posZ);
|
||||
if (entry->dist > 0x7FFFFFD0) {
|
||||
entry->dist = 0x70000008;
|
||||
osSyncPrintf(D_80133344, entry->unk_28, entry->posX, entry->posZ, *entry->posX,
|
||||
*entry->posY, *entry->posZ);
|
||||
}
|
||||
temp3 = temp_s2->unk_28;
|
||||
temp_s2->unk_20 = (u32)temp_s2->unk_1C + (SQ(0xFF - spA9) * 0x1690) + temp3 - temp3;
|
||||
if (*temp_s2->posZ < 0.0f) {
|
||||
temp_s2->unk_20 += (s32)(-*temp_s2->posZ * 6.0f);
|
||||
temp3 = entry->unk_28;
|
||||
entry->unk_20 = (u32)entry->dist + (SQ(0xFF - spA9) * 0x1690) + temp3 - temp3;
|
||||
if (*entry->posZ < 0.0f) {
|
||||
entry->unk_20 += (s32)(-*entry->posZ * 6.0f);
|
||||
}
|
||||
}
|
||||
if (temp_s2->unk_1C > 1.0e10f) {
|
||||
if (temp_s2->unk_2A == 4) {
|
||||
Audio_QueueCmdS8((temp_s2->unk_2E << 8) | 0x6020000, 0);
|
||||
if (temp_s2->unk_28 & 0xC00) {
|
||||
if (entry->dist > SQ(1e5f)) {
|
||||
if (entry->unk_2A == 4) {
|
||||
Audio_QueueCmdS8((entry->unk_2E << 8) | 0x6020000, 0);
|
||||
if (entry->unk_28 & 0xC00) {
|
||||
func_800F7B54(arg0, phi_s4);
|
||||
phi_s4 = phi_s0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
spAE = D_80130578[D_801333CC][arg0];
|
||||
for (spAC = 0; spAC < spAE; spAC++) {
|
||||
if (sp84[spAC].unk_0 >= temp_s2->unk_20) {
|
||||
for (i = 0; i < spAE; i++) {
|
||||
if (sp84[i].unk_0 >= entry->unk_20) {
|
||||
if (phi_s3 < D_80130578[D_801333CC][arg0]) {
|
||||
phi_s3++;
|
||||
}
|
||||
for (phi_a1 = spAE - 1; phi_a1 > spAC; phi_a1--) {
|
||||
sp84[phi_a1].unk_0 = sp84[phi_a1 - 1].unk_0;
|
||||
sp84[phi_a1].unk_4 = sp84[phi_a1 - 1].unk_4;
|
||||
for (j = spAE - 1; j > i; j--) {
|
||||
sp84[j].unk_0 = sp84[j - 1].unk_0;
|
||||
sp84[j].unk_4 = sp84[j - 1].unk_4;
|
||||
}
|
||||
sp84[spAC].unk_0 = temp_s2->unk_20;
|
||||
sp84[spAC].unk_4 = phi_s4;
|
||||
spAC = spAE;
|
||||
sp84[i].unk_0 = entry->unk_20;
|
||||
sp84[i].unk_4 = phi_s4;
|
||||
i = spAE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,40 +412,39 @@ void func_800F7CEC(u8 arg0) {
|
|||
}
|
||||
phi_s4 = gSoundBanks[arg0][phi_s0].next;
|
||||
}
|
||||
for (spAC = 0; spAC < phi_s3; spAC++) {
|
||||
temp_s2 = &gSoundBanks[arg0][sp84[spAC].unk_4];
|
||||
if (temp_s2->unk_2A == 1) {
|
||||
temp_s2->unk_2A = 2;
|
||||
} else if (temp_s2->unk_2A == 4) {
|
||||
temp_s2->unk_2A = 3;
|
||||
for (i = 0; i < phi_s3; i++) {
|
||||
entry = &gSoundBanks[arg0][sp84[i].unk_4];
|
||||
if (entry->unk_2A == 1) {
|
||||
entry->unk_2A = 2;
|
||||
} else if (entry->unk_2A == 4) {
|
||||
entry->unk_2A = 3;
|
||||
}
|
||||
}
|
||||
|
||||
spAE = D_80130578[D_801333CC][arg0];
|
||||
for (spAC = 0; spAC < spAE; spAC++) {
|
||||
for (i = 0; i < spAE; i++) {
|
||||
phi_v1_5 = 0;
|
||||
temp_s4_3 = &D_8016E1B8[arg0][spAC];
|
||||
temp1 = temp_s4_3->unk_4;
|
||||
temp_s4_3 = &D_8016E1B8[arg0][i];
|
||||
|
||||
if (temp_s4_3->unk_4 == 0xFF) {
|
||||
phi_v1_5 = 1;
|
||||
} else {
|
||||
temp_s2 = &gSoundBanks[arg0][temp_s4_3[0].unk_4];
|
||||
if (temp_s2->unk_2A == 4) {
|
||||
if (temp_s2->unk_28 & 0xC00) {
|
||||
entry = &gSoundBanks[arg0][temp_s4_3[0].unk_4];
|
||||
if (entry->unk_2A == 4) {
|
||||
if (entry->unk_28 & 0xC00) {
|
||||
func_800F7B54(arg0, temp_s4_3->unk_4);
|
||||
} else {
|
||||
temp_s2->unk_2A = 1;
|
||||
entry->unk_2A = 1;
|
||||
}
|
||||
phi_v1_5 = 1;
|
||||
} else if (temp_s2->unk_2A == 0) {
|
||||
} else if (entry->unk_2A == 0) {
|
||||
temp_s4_3->unk_4 = 0xFF;
|
||||
phi_v1_5 = 1;
|
||||
} else {
|
||||
for (phi_a1 = 0; phi_a1 < spAE; phi_a1++) {
|
||||
if (temp_s4_3->unk_4 == sp84[phi_a1].unk_4) {
|
||||
sp84[phi_a1].unk_4 = 0xFF;
|
||||
phi_a1 = spAE;
|
||||
for (j = 0; j < spAE; j++) {
|
||||
if (temp_s4_3->unk_4 == sp84[j].unk_4) {
|
||||
sp84[j].unk_4 = 0xFF;
|
||||
j = spAE;
|
||||
}
|
||||
}
|
||||
phi_s3--;
|
||||
|
@ -454,8 +452,8 @@ void func_800F7CEC(u8 arg0) {
|
|||
}
|
||||
|
||||
if (phi_v1_5 == 1) {
|
||||
for (phi_a1 = 0; phi_a1 < spAE; phi_a1++) {
|
||||
temp2 = sp84[phi_a1].unk_4;
|
||||
for (j = 0; j < spAE; j++) {
|
||||
temp2 = sp84[j].unk_4;
|
||||
if ((temp2 != 0xFF) && (gSoundBanks[arg0][temp2].unk_2A != 3)) {
|
||||
for (phi_s0 = 0; phi_s0 < spAE; phi_s0++) {
|
||||
if (temp2 == D_8016E1B8[arg0][phi_s0].unk_4) {
|
||||
|
@ -466,14 +464,14 @@ void func_800F7CEC(u8 arg0) {
|
|||
if (phi_v1_5 == 1) {
|
||||
temp_s4_3->unk_4 = temp2;
|
||||
|
||||
sp84[phi_a1].unk_4 = 0xFF;
|
||||
sp84[j].unk_4 = 0xFF;
|
||||
|
||||
phi_a1 = spAE + 1;
|
||||
j = spAE + 1;
|
||||
phi_s3--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (phi_a1 == spAE) {
|
||||
if (j == spAE) {
|
||||
temp_s4_3->unk_4 = 0xFF;
|
||||
}
|
||||
}
|
||||
|
@ -512,7 +510,7 @@ void func_800F8480(u8 bankId) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
func_800F3A08(bankId, bankIndex, D_8016E260);
|
||||
Audio_SetSoundProperties(bankId, bankIndex, D_8016E260);
|
||||
Audio_QueueCmdS8(0x06020000 | ((D_8016E260 & 0xFF) << 8), 1);
|
||||
Audio_QueueCmdS8(0x06020000 | ((D_8016E260 & 0xFF) << 8) | 4, entry->unk_28 & 0xFF);
|
||||
if (D_80130570[bankId] != 0) {
|
||||
|
@ -526,7 +524,7 @@ void func_800F8480(u8 bankId) {
|
|||
} else if ((u8)seqChannel->soundScriptIO[1] == 0xFF) {
|
||||
func_800F7B54(bankId, bankIndex);
|
||||
} else if (entry->unk_2A == 3) {
|
||||
func_800F3A08(bankId, bankIndex, D_8016E260);
|
||||
Audio_SetSoundProperties(bankId, bankIndex, D_8016E260);
|
||||
if (entry->unk_28 & 0xC00) {
|
||||
entry->unk_2A = 4;
|
||||
} else {
|
||||
|
@ -541,7 +539,7 @@ void func_800F8480(u8 bankId) {
|
|||
void func_800F87A0(u8 bankId) {
|
||||
SoundBankEntry* entry;
|
||||
s32 pad;
|
||||
SoundBankEntry sp48;
|
||||
SoundBankEntry cmp;
|
||||
u8 bankIndex = gSoundBanks[bankId][0].next;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
|
@ -554,8 +552,8 @@ void func_800F87A0(u8 bankId) {
|
|||
}
|
||||
bankIndex = gSoundBanks[bankId][0].next;
|
||||
}
|
||||
sp48.unk_28 = bankId << 12;
|
||||
func_800F74E0(0, &sp48);
|
||||
cmp.unk_28 = bankId << 12;
|
||||
Audio_RemoveMatchingSoundRequests(0, &cmp);
|
||||
}
|
||||
|
||||
void func_800F8884(u8 bankId, Vec3f* pos) {
|
||||
|
@ -580,30 +578,30 @@ void func_800F8884(u8 bankId, Vec3f* pos) {
|
|||
}
|
||||
|
||||
void func_800F89A0(u8 bankId, Vec3f* pos) {
|
||||
SoundBankEntry sp18;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
func_800F8884(bankId, pos);
|
||||
sp18.unk_28 = bankId << 12;
|
||||
sp18.posX = &pos->x;
|
||||
func_800F74E0(1, &sp18);
|
||||
cmp.unk_28 = bankId << 12;
|
||||
cmp.posX = &pos->x;
|
||||
Audio_RemoveMatchingSoundRequests(1, &cmp);
|
||||
}
|
||||
|
||||
void func_800F89E8(Vec3f* pos) {
|
||||
u8 i;
|
||||
SoundBankEntry sp24;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSoundBanks); i++) {
|
||||
func_800F8884(i, pos);
|
||||
}
|
||||
sp24.posX = &pos->x;
|
||||
func_800F74E0(2, &sp24);
|
||||
cmp.posX = &pos->x;
|
||||
Audio_RemoveMatchingSoundRequests(2, &cmp);
|
||||
}
|
||||
|
||||
void func_800F8A44(Vec3f* pos, u16 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 bankIndex2 = 0;
|
||||
SoundBankEntry sp50;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
|
||||
|
@ -622,16 +620,16 @@ void func_800F8A44(Vec3f* pos, u16 sfxId) {
|
|||
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
|
||||
}
|
||||
}
|
||||
sp50.posX = &pos->x;
|
||||
sp50.unk_28 = sfxId;
|
||||
func_800F74E0(3, &sp50);
|
||||
cmp.posX = &pos->x;
|
||||
cmp.unk_28 = sfxId;
|
||||
Audio_RemoveMatchingSoundRequests(3, &cmp);
|
||||
}
|
||||
|
||||
void func_800F8BA0(u8 arg0, u16 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 bankIndex2 = 0;
|
||||
SoundBankEntry sp58;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
|
||||
|
@ -649,16 +647,16 @@ void func_800F8BA0(u8 arg0, u16 sfxId) {
|
|||
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
|
||||
}
|
||||
}
|
||||
sp58.unk_C = arg0;
|
||||
sp58.unk_28 = sfxId;
|
||||
func_800F74E0(4, &sp58);
|
||||
cmp.unk_C = arg0;
|
||||
cmp.unk_28 = sfxId;
|
||||
Audio_RemoveMatchingSoundRequests(4, &cmp);
|
||||
}
|
||||
|
||||
void Audio_StopSfx(u32 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 bankIndex2 = 0;
|
||||
SoundBankEntry sp50;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
|
||||
|
@ -674,14 +672,14 @@ void Audio_StopSfx(u32 sfxId) {
|
|||
}
|
||||
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
|
||||
}
|
||||
sp50.unk_28 = sfxId;
|
||||
func_800F74E0(5, &sp50);
|
||||
cmp.unk_28 = sfxId;
|
||||
Audio_RemoveMatchingSoundRequests(5, &cmp);
|
||||
}
|
||||
|
||||
void func_800F8E3C(void) {
|
||||
while (D_801333A0 != D_801333A4) {
|
||||
func_800F7680();
|
||||
D_801333A4++;
|
||||
void Audio_ProcessSoundRequests(void) {
|
||||
while (sSoundRequestWriteIndex != sSoundRequestReadIndex) {
|
||||
Audio_ProcessSoundRequest();
|
||||
sSoundRequestReadIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -718,7 +716,7 @@ void func_800F8F88(void) {
|
|||
}
|
||||
}
|
||||
|
||||
u8 func_800F8FF4(u32 sfxId) {
|
||||
u8 Audio_IsSfxPlaying(u32 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
|
||||
|
@ -737,14 +735,14 @@ void func_800F905C(void) {
|
|||
u8 i;
|
||||
u8 bankIndex;
|
||||
|
||||
D_801333A0 = 0;
|
||||
D_801333A4 = 0;
|
||||
sSoundRequestWriteIndex = 0;
|
||||
sSoundRequestReadIndex = 0;
|
||||
D_801333D0 = 0;
|
||||
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
|
||||
D_8016E1A0[bankId] = 0;
|
||||
D_8016E1A8[bankId] = 1;
|
||||
D_8016E1B0[bankId] = 0;
|
||||
D_8016E264[bankId] = 0;
|
||||
gSoundBankMuted[bankId] = false;
|
||||
D_8016E270[bankId].unk_0 = 1.0f;
|
||||
D_8016E270[bankId].unk_C = 0;
|
||||
}
|
||||
|
@ -765,9 +763,9 @@ void func_800F905C(void) {
|
|||
}
|
||||
if (D_801333F8 == 0) {
|
||||
for (bankId = 0; bankId < 10; bankId++) {
|
||||
D_8016E2E0[bankId] = 0;
|
||||
D_8016E2F8[bankId] = 0;
|
||||
D_8016E310[bankId] = 0;
|
||||
gAudioSEFlagSwapSource[bankId] = 0;
|
||||
gAudioSEFlagSwapTarget[bankId] = 0;
|
||||
gAudioSEFlagSwapMode[bankId] = 0;
|
||||
}
|
||||
D_801333F8++;
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
|||
|
||||
GfxPrint_Init(&printer);
|
||||
GfxPrint_Open(&printer, newDList);
|
||||
func_800EEA50(&printer);
|
||||
AudioDebug_Draw(&printer);
|
||||
newDList = GfxPrint_Close(&printer);
|
||||
GfxPrint_Destroy(&printer);
|
||||
}
|
||||
|
|
|
@ -361,13 +361,13 @@ Gfx* GfxPrint_Close(GfxPrint* this) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
|
||||
PrintUtils_VPrintf((PrintCallback*)&this->callback, fmt, args);
|
||||
s32 GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
|
||||
return PrintUtils_VPrintf((PrintCallback*)&this->callback, fmt, args);
|
||||
}
|
||||
|
||||
void GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {
|
||||
s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
GfxPrint_VPrintf(this, fmt, args);
|
||||
return GfxPrint_VPrintf(this, fmt, args);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "global.h"
|
||||
|
||||
void PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args) {
|
||||
_Printf(*pfn, pfn, fmt, args);
|
||||
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args) {
|
||||
return _Printf(*pfn, pfn, fmt, args);
|
||||
}
|
||||
|
||||
void PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...) {
|
||||
s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
PrintUtils_VPrintf(pfn, fmt, args);
|
||||
return PrintUtils_VPrintf(pfn, fmt, args);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
|||
ShrinkWindow_SetVal(0x20);
|
||||
|
||||
if (func_8006472C(globalCtx, csCtx, 1.0f)) {
|
||||
func_800F68BC(1);
|
||||
Audio_SetCutsceneFlag(1);
|
||||
csCtx->state++;
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
|||
ShrinkWindow_SetVal(0x20);
|
||||
|
||||
if (func_8006472C(globalCtx, csCtx, 1.0f)) {
|
||||
func_800F68BC(1);
|
||||
Audio_SetCutsceneFlag(1);
|
||||
csCtx->state++;
|
||||
}
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
|||
((csCtx->frames > 20) && CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) &&
|
||||
(gSaveContext.fileNum != 0xFEDC))) {
|
||||
csCtx->state = CS_STATE_UNSKIPPABLE_EXEC;
|
||||
func_800F68BC(0);
|
||||
Audio_SetCutsceneFlag(0);
|
||||
gSaveContext.unk_1410 = 1;
|
||||
|
||||
// Translates to: "FUTURE FORK DESIGNATION=No. [%d]"
|
||||
|
@ -781,7 +781,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
|||
break;
|
||||
case 54:
|
||||
gSaveContext.gameMode = 3;
|
||||
func_800F7260(0x6F);
|
||||
Audio_SetSoundBanksMute(0x6F);
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->nextEntranceIndex = 0x0117;
|
||||
gSaveContext.cutsceneIndex = 0xFFF2;
|
||||
|
@ -1161,7 +1161,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
|||
break;
|
||||
case 117:
|
||||
gSaveContext.gameMode = 3;
|
||||
func_800F7260(0x6F);
|
||||
Audio_SetSoundBanksMute(0x6F);
|
||||
globalCtx->linkAgeOnLoad = 0;
|
||||
globalCtx->nextEntranceIndex = 0x00CD;
|
||||
gSaveContext.cutsceneIndex = 0xFFF7;
|
||||
|
@ -1887,7 +1887,7 @@ void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
|||
|
||||
void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
||||
if (func_8006472C(globalCtx, csCtx, 0.0f)) {
|
||||
func_800F68BC(0);
|
||||
Audio_SetCutsceneFlag(0);
|
||||
csCtx->state = CS_STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
@ -1921,7 +1921,7 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
|||
func_8005B1A4(globalCtx->cameraPtrs[D_8015FCC6]);
|
||||
}
|
||||
|
||||
func_800F68BC(0);
|
||||
Audio_SetCutsceneFlag(0);
|
||||
csCtx->state = CS_STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
@ -1948,7 +1948,7 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
|||
csCtx->state++;
|
||||
|
||||
if (csCtx->state == CS_STATE_SKIPPABLE_INIT) {
|
||||
func_800F68BC(1);
|
||||
Audio_SetCutsceneFlag(1);
|
||||
|
||||
csCtx->frames = 0xFFFF;
|
||||
csCtx->unk_18 = 0xFFFF;
|
||||
|
|
|
@ -619,5 +619,5 @@ void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx) {
|
|||
if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20))) {
|
||||
Map_SavePlayerInitialInfo(globalCtx);
|
||||
}
|
||||
func_800F66C0(globalCtx->roomCtx.curRoom.echo);
|
||||
Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue