Mario Kart 64
|
#include <ultra64.h>
#include <macros.h>
#include "audio/load.h"
#include "audio/data.h"
#include "audio/heap.h"
#include "audio/internal.h"
#include "audio/playback.h"
#include "audio/synthesis.h"
#include "audio/seqplayer.h"
#include "audio/port_eu.h"
#include "buffers/gfx_output_buffer.h"
Macros | |
#define | ALIGN16(val) (((val) + 0xF) & ~0xF) |
#define | j i |
#define | PATCH(SRC, BASE, TYPE) SRC = (TYPE) ((uintptr_t) SRC + (uintptr_t) BASE) |
#define | PATCH(x, base) (patched = (void*) ((uintptr_t) (x) + (uintptr_t) base)) |
#define | BASE_OFFSET_REAL(x, base) (void*) ((uintptr_t) (x) + (uintptr_t) base) |
#define | PATCH(x, base) (patched = BASE_OFFSET_REAL(x, base)) |
#define | PATCH_MEM(x) x = PATCH(x, mem) |
#define | BASE_OFFSET(x, base) BASE_OFFSET_REAL(base, x) |
Functions | |
void | audio_dma_copy_immediate (u8 *devAddr, void *vAddr, size_t nbytes) |
void | audio_dma_copy_async (uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) |
void | audio_dma_partial_copy_async (uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg) |
void | decrease_sample_dma_ttls () |
void * | dma_sample_data (uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) |
void | func_800BB030 (UNUSED s32 arg0) |
s32 | func_800BB304 (struct AudioBankSample *sample) |
s32 | func_800BB388 (s32 bankId, s32 instId, s32 arg2) |
void | func_800BB43C (ALSeqFile *f, u8 *base) |
void | patch_sound (struct AudioBankSound *sound, u8 *memBase, u8 *offsetBase) |
void | func_800BB584 (s32 bankId) |
void | patch_audio_bank (struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums) |
struct AudioBank * | bank_load_immediate (s32 bankId, s32 arg1) |
struct AudioBank * | bank_load_async (s32 bankId, s32 arg1, struct SequencePlayer *seqPlayer) |
void * | sequence_dma_immediate (s32 seqId, s32 arg1) |
void * | sequence_dma_async (s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer) |
u8 | get_missing_bank (u32 seqId, s32 *nonNullCount, s32 *nullCount) |
struct AudioBank * | load_banks_immediate (s32 seqId, u8 *outDefaultBank) |
void | preload_sequence (u32 seqId, u8 preloadMask) |
void | load_sequence (u32 player, u32 seqId, s32 loadAsync) |
void | load_sequence_internal (u32 player, u32 seqId, s32 loadAsync) |
Variables | |
struct SequencePlayer | gSequencePlayers [SEQUENCE_PLAYERS] |
struct SequenceChannel | gSequenceChannels [SEQUENCE_CHANNELS] |
struct SequenceChannelLayer | gSequenceLayers [SEQUENCE_LAYERS] |
struct SequenceChannel | gSequenceChannelNone |
struct AudioListItem | gLayerFreeList |
struct NotePool | gNoteFreeLists |
OSMesgQueue | gCurrAudioFrameDmaQueue |
OSMesg | gCurrAudioFrameDmaMesgBufs [AUDIO_FRAME_DMA_QUEUE_SIZE] |
OSIoMesg | gCurrAudioFrameDmaIoMesgBufs [AUDIO_FRAME_DMA_QUEUE_SIZE] |
OSMesgQueue | D_803B6720 |
OSMesg | D_803B6738 |
OSIoMesg | D_803B6740 |
struct SharedDma | sSampleDmas [0x70] |
u32 | gSampleDmaNumListItems |
u32 | sSampleDmaListSize1 |
s32 | D_803B6E60 |
s32 | load_bss_pad |
u8 | sSampleDmaReuseQueue1 [256] |
u8 | sSampleDmaReuseQueue2 [256] |
u8 | sSampleDmaReuseQueueTail1 |
u8 | sSampleDmaReuseQueueTail2 |
u8 | sSampleDmaReuseQueueHead1 |
u8 | sSampleDmaReuseQueueHead2 |
ALSeqFile * | gSeqFileHeader |
ALSeqFile * | gAlCtlHeader |
ALSeqFile * | gAlTbl |
u8 * | gAlBankSets |
u16 | gSequenceCount |
struct CtlEntry * | gCtlEntries |
struct AudioBufferParametersEU | gAudioBufferParameters |
u32 | D_803B70A8 |
s32 | gMaxAudioCmds |
s32 | gMaxSimultaneousNotes |
s16 | gTempoInternalToExternal |
s8 | gAudioLibSoundMode |
volatile s32 | gAudioFrameCount |
s32 | gCurrAudioFrameDmaCount |
char | loadAudioString00 [] = "Romcopy %x -> %x ,size %x\n" |
char | loadAudioString01 [] = "Romcopyend\n" |
char | loadAudioString02 [] = "CAUTION:WAVE CACHE FULL %d" |
char | loadAudioString03 [] = "LOAD Rom :%x -> Ram :%x Len:%x\n" |
char | loadAudioString04 [] = "BASE %x %x\n" |
char | loadAudioString05 [] = "LOAD %x %x %x\n" |
char | loadAudioString06 [] = "INSTTOP %x\n" |
char | loadAudioString07 [] = "INSTMAP[0] %x\n" |
char | loadAudioString08 [] = "already flags %d\n" |
char | loadAudioString09 [] = "already flags %d\n" |
char | loadAudioString10 [] = "ERR:SLOW BANK DMA BUSY\n" |
char | loadAudioString11 [] = "ERR:SLOW DMA BUSY\n" |
char | loadAudioString12 [] = "Check %d bank %d\n" |
char | loadAudioString13 [] = "Cache Check\n" |
char | loadAudioString14 [] = "NO BANK ERROR\n" |
char | loadAudioString15 [] = "BANK %d LOADING START\n" |
char | loadAudioString16 [] = "BANK %d LOAD MISS (NO MEMORY)!\n" |
char | loadAudioString17 [] = "BANK %d ALREADY CACHED\n" |
char | loadAudioString18 [] = "BANK LOAD MISS! FOR %d\n" |
char | loadAudioString19 [] = "Seq %d Loading Start\n" |
char | loadAudioString20 [] = "Heap Overflow Error\n" |
char | loadAudioString21 [] = "SEQ %d ALREADY CACHED\n" |
char | loadAudioString22 [] = "Ok,one bank slow load Start \n" |
char | loadAudioString23 [] = "Sorry,too many %d bank is none.fast load Start \n" |
char | loadAudioString24 [] = "Seq %d:Default Load Id is %d\n" |
char | loadAudioString25 [] = "Seq Loading Start\n" |
char | loadAudioString26 [] = "Error:Before Sequence-SlowDma remain.\n" |
char | loadAudioString27 [] = " Cancel Seq Start.\n" |
char | loadAudioString28 [] = "SEQ %d ALREADY CACHED\n" |
char | loadAudioString29 [] = "Clear Workarea %x -%x size %x \n" |
char | loadAudioString30 [] = "AudioHeap is %x\n" |
char | loadAudioString31 [] = "Heap reset.Synth Change %x \n" |
char | loadAudioString32 [] = "Heap %x %x %x\n" |
char | loadAudioString33 [] = "Main Heap Initialize.\n" |
char | loadAudioString34 [] = "---------- Init Completed. ------------\n" |
char | loadAudioString35 [] = " Syndrv :[%6d]\n" |
char | loadAudioString36 [] = " Seqdrv :[%6d]\n" |
char | loadAudioString37 [] = " audiodata :[%6d]\n" |
char | loadAudioString38 [] = "---------------------------------------\n" |
#define ALIGN16 | ( | val | ) | (((val) + 0xF) & ~0xF) |
#define BASE_OFFSET | ( | x, | |
base ) BASE_OFFSET_REAL(base, x) |
#define BASE_OFFSET_REAL | ( | x, | |
base ) (void*) ((uintptr_t) (x) + (uintptr_t) base) |
#define j i |
#define PATCH | ( | SRC, | |
BASE, | |||
TYPE ) SRC = (TYPE) ((uintptr_t) SRC + (uintptr_t) BASE) |
#define PATCH | ( | x, | |
base ) (patched = (void*) ((uintptr_t) (x) + (uintptr_t) base)) |
#define PATCH | ( | x, | |
base ) (patched = BASE_OFFSET_REAL(x, base)) |
#define PATCH_MEM | ( | x | ) | x = PATCH(x, mem) |
void audio_dma_copy_async | ( | uintptr_t | devAddr, |
void * | vAddr, | ||
size_t | nbytes, | ||
OSMesgQueue * | queue, | ||
OSIoMesg * | mesg ) |
Performs an asynchronus (normal priority) DMA copy
void audio_dma_copy_immediate | ( | u8 * | devAddr, |
void * | vAddr, | ||
size_t | nbytes ) |
Performs an immediate DMA copy
void audio_dma_partial_copy_async | ( | uintptr_t * | devAddr, |
u8 ** | vAddr, | ||
ssize_t * | remaining, | ||
OSMesgQueue * | queue, | ||
OSIoMesg * | mesg ) |
Performs a partial asynchronous (normal priority) DMA copy. This is limited to 0x1000 bytes transfer at once.
struct AudioBank * bank_load_async | ( | s32 | bankId, |
s32 | arg1, | ||
struct SequencePlayer * | seqPlayer ) |
void decrease_sample_dma_ttls | ( | void | ) |
s32 func_800BB304 | ( | struct AudioBankSample * | sample | ) |
void func_800BB584 | ( | s32 | bankId | ) |
Doesn't affect EU, but required for US/JP
Doesn't affect EU, but required for US/JP
void patch_sound | ( | struct AudioBankSound * | sound, |
u8 * | memBase, | ||
u8 * | offsetBase ) |
void * sequence_dma_async | ( | s32 | seqId, |
s32 | arg1, | ||
struct SequencePlayer * | seqPlayer ) |
OSMesgQueue D_803B6720 |
OSMesg D_803B6738 |
OSIoMesg D_803B6740 |
s32 D_803B6E60 |
u32 D_803B70A8 |
u8* gAlBankSets |
ALSeqFile* gAlCtlHeader |
ALSeqFile* gAlTbl |
struct AudioBufferParametersEU gAudioBufferParameters |
volatile s32 gAudioFrameCount |
s8 gAudioLibSoundMode |
struct CtlEntry* gCtlEntries |
s32 gCurrAudioFrameDmaCount |
OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE] |
OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE] |
OSMesgQueue gCurrAudioFrameDmaQueue |
struct AudioListItem gLayerFreeList |
s32 gMaxAudioCmds |
s32 gMaxSimultaneousNotes |
struct NotePool gNoteFreeLists |
u32 gSampleDmaNumListItems |
ALSeqFile* gSeqFileHeader |
struct SequenceChannel gSequenceChannelNone |
struct SequenceChannel gSequenceChannels[SEQUENCE_CHANNELS] |
u16 gSequenceCount |
struct SequenceChannelLayer gSequenceLayers[SEQUENCE_LAYERS] |
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS] |
s16 gTempoInternalToExternal |
s32 load_bss_pad |
char loadAudioString00[] = "Romcopy %x -> %x ,size %x\n" |
Given that (almost) all of these are format strings, it is highly likely that they are meant to be used in some sort of printf variant. But I don't care to try and figure out which function gets which string(s) So I've place them all here instead.
char loadAudioString01[] = "Romcopyend\n" |
char loadAudioString02[] = "CAUTION:WAVE CACHE FULL %d" |
char loadAudioString03[] = "LOAD Rom :%x -> Ram :%x Len:%x\n" |
char loadAudioString04[] = "BASE %x %x\n" |
char loadAudioString05[] = "LOAD %x %x %x\n" |
char loadAudioString06[] = "INSTTOP %x\n" |
char loadAudioString07[] = "INSTMAP[0] %x\n" |
char loadAudioString08[] = "already flags %d\n" |
char loadAudioString09[] = "already flags %d\n" |
char loadAudioString10[] = "ERR:SLOW BANK DMA BUSY\n" |
char loadAudioString11[] = "ERR:SLOW DMA BUSY\n" |
char loadAudioString12[] = "Check %d bank %d\n" |
char loadAudioString13[] = "Cache Check\n" |
char loadAudioString14[] = "NO BANK ERROR\n" |
char loadAudioString15[] = "BANK %d LOADING START\n" |
char loadAudioString16[] = "BANK %d LOAD MISS (NO MEMORY)!\n" |
char loadAudioString17[] = "BANK %d ALREADY CACHED\n" |
char loadAudioString18[] = "BANK LOAD MISS! FOR %d\n" |
char loadAudioString19[] = "Seq %d Loading Start\n" |
char loadAudioString20[] = "Heap Overflow Error\n" |
char loadAudioString21[] = "SEQ %d ALREADY CACHED\n" |
char loadAudioString22[] = "Ok,one bank slow load Start \n" |
char loadAudioString23[] = "Sorry,too many %d bank is none.fast load Start \n" |
char loadAudioString24[] = "Seq %d:Default Load Id is %d\n" |
char loadAudioString25[] = "Seq Loading Start\n" |
char loadAudioString26[] = "Error:Before Sequence-SlowDma remain.\n" |
char loadAudioString27[] = " Cancel Seq Start.\n" |
char loadAudioString28[] = "SEQ %d ALREADY CACHED\n" |
char loadAudioString29[] = "Clear Workarea %x -%x size %x \n" |
char loadAudioString30[] = "AudioHeap is %x\n" |
char loadAudioString31[] = "Heap reset.Synth Change %x \n" |
char loadAudioString32[] = "Heap %x %x %x\n" |
char loadAudioString33[] = "Main Heap Initialize.\n" |
char loadAudioString34[] = "---------- Init Completed. ------------\n" |
char loadAudioString35[] = " Syndrv :[%6d]\n" |
char loadAudioString36[] = " Seqdrv :[%6d]\n" |
char loadAudioString37[] = " audiodata :[%6d]\n" |
char loadAudioString38[] = "---------------------------------------\n" |
u32 sSampleDmaListSize1 |
u8 sSampleDmaReuseQueue1[256] |
u8 sSampleDmaReuseQueue2[256] |
u8 sSampleDmaReuseQueueHead1 |
u8 sSampleDmaReuseQueueHead2 |
u8 sSampleDmaReuseQueueTail1 |
u8 sSampleDmaReuseQueueTail2 |
struct SharedDma sSampleDmas[0x70] |