Audio_Load OK and Documented (#620)

* Copy audio_load progress from main branch

* Fix warning

* fix UB

* cleanup WIP

* Add docs, bss still broken

* bss fix

* bytesRemaining with size_t

* PR Suggestions

* PR Suggestions

* Fix bss

* Fix bss

* PR Suggestions
This commit is contained in:
engineer124
2022-03-24 12:22:13 +11:00
committed by GitHub
parent 92c4d42f44
commit b852a9a930
18 changed files with 2558 additions and 568 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ void* Yaz0_FirstDMA() {
curSize = (u32)sYaz0CurDataEnd - (u32)sYaz0DataBuffer;
dmaSize = (curSize > sYaz0CurSize) ? sYaz0CurSize : curSize;
DmaMgr_DMARomToRam(sYaz0CurRomStart, sYaz0DataBuffer, dmaSize);
DmaMgr_DmaRomToRam(sYaz0CurRomStart, sYaz0DataBuffer, dmaSize);
sYaz0CurRomStart += dmaSize;
sYaz0CurSize -= dmaSize;
return sYaz0DataBuffer;
@@ -41,7 +41,7 @@ void* Yaz0_NextDMA(void* curSrcPos) {
}
if (dmaSize != 0) {
DmaMgr_DMARomToRam(sYaz0CurRomStart, dst + restSize, dmaSize);
DmaMgr_DmaRomToRam(sYaz0CurRomStart, dst + restSize, dmaSize);
sYaz0CurRomStart += dmaSize;
sYaz0CurSize -= dmaSize;
if (!sYaz0CurSize) {
+5 -5
View File
@@ -10,7 +10,7 @@ OSMesg sDmaMgrMsgs[32];
OSThread sDmaMgrThread;
u8 sDmaMgrStack[0x500];
s32 DmaMgr_DMARomToRam(uintptr_t rom, void* ram, size_t size) {
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
OSIoMesg ioMsg;
OSMesgQueue queue;
OSMesg msg[1];
@@ -56,8 +56,8 @@ END:
return ret;
}
void DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
osEPiStartDma(pihandle, mb, direction);
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
return osEPiStartDma(pihandle, mb, direction);
}
DmaEntry* DmaMgr_FindDmaEntry(u32 vrom) {
@@ -130,7 +130,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
if (dmaEntry->vromEnd < (vrom + size)) {
Fault_AddHungupAndCrash("../z_std_dma.c", 499);
}
DmaMgr_DMARomToRam((dmaEntry->romStart + vrom) - dmaEntry->vromStart, (u8*)ram, size);
DmaMgr_DmaRomToRam((dmaEntry->romStart + vrom) - dmaEntry->vromStart, (u8*)ram, size);
return;
}
@@ -211,7 +211,7 @@ s32 DmaMgr_SendRequest0(void* vramStart, uintptr_t vromStart, size_t size) {
}
void DmaMgr_Start(void) {
DmaMgr_DMARomToRam(SEGMENT_ROM_START(dmadata), dmadata, SEGMENT_ROM_SIZE(dmadata));
DmaMgr_DmaRomToRam(SEGMENT_ROM_START(dmadata), dmadata, SEGMENT_ROM_SIZE(dmadata));
{
DmaEntry* iter = dmadata;
+14 -14
View File
@@ -6,29 +6,29 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B250.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B318.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_DiscardFont.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B3FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B474.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B4F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_WritebackDCache.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B520.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B578.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_AllocAttemptExternal.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_AllocDmaMemory.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B608.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B640.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_AllocZeroed.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B69C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B6E8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_Alloc.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B740.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_AllocPoolInit.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B768.s")
@@ -38,7 +38,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B7BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B8FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_InitMainPool.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018B95C.s")
@@ -48,9 +48,9 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018BB28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018BBEC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_AllocCached.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018C380.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_SearchCaches.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018C3D8.s")
@@ -70,15 +70,15 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018CC3C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018CCA8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_ResetStep.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018CFAC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018D57C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_SearchPermanentCache.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018D5D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_AllocPermanent.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018D658.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_AllocSampleCache.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018D6C8.s")
@@ -100,7 +100,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018DFE0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018E00C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/AudioHeap_ApplySampleBankCache.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_heap/func_8018E03C.s")
+2159 -159
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -982,7 +982,7 @@ void AudioPlayback_NoteInitAll(void) {
note->playbackState.portamento.speed = 0;
note->playbackState.stereoHeadsetEffects = false;
note->playbackState.unk_84 = 0;
note->synthesisState.synthesisBuffers = AudioHeap_AllocDmaMemory(&gAudioContext.notesAndBuffersPool, 0x2E0);
note->playbackState.attributes.filterBuf = AudioHeap_AllocDmaMemory(&gAudioContext.notesAndBuffersPool, 0x10);
note->synthesisState.synthesisBuffers = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x2E0);
note->playbackState.attributes.filterBuf = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x10);
}
}
+1 -1
View File
@@ -64,7 +64,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019AAF0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019AB40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_ResetSequencePlayer.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019AC10.s")
+1 -1
View File
@@ -78,4 +78,4 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_80194668.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_801946E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/Audio_InitMesgQueues.s")
+1 -1
View File
@@ -79,7 +79,7 @@ void AudioMgr_ThreadEntry(void* arg) {
s32 exit;
func_801A4C30();
func_80190B38(DmaMgr_DmaCallback0);
AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
func_801A4D00();
osSendMesg(&audioMgr->lockMsgQ, NULL, OS_MESG_BLOCK);
IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptMsgQ);
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
Vec3f D_801EDE00;