diff --git a/Makefile b/Makefile index cf1eab79..81ce5d49 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,7 @@ else # we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff. CFLAGS += -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(IINC) -nostdinc -Wab,-r4300_mul -woff 649,838,712,516 MIPS_VERSION := -mips2 - WARNINGS := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594,709 + WARNINGS := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594,709,807 endif ifeq ($(COMPILER),ido) diff --git a/include/sf64audio_provisional.h b/include/sf64audio_provisional.h index 0b14777f..ef688f35 100644 --- a/include/sf64audio_provisional.h +++ b/include/sf64audio_provisional.h @@ -1,7 +1,7 @@ /** * This file is provisional, some of the structs need to be corrected, and others might be unused * This file is only meant to be used as reference to help audio decompilation -*/ + */ #ifndef SF64_AUDIO_H #define SF64_AUDIO_H @@ -57,7 +57,7 @@ typedef void (*AudioCustomUpdateFunction)(void); // Both left and right channels #define DMEM_2CH_SIZE (2 * DMEM_1CH_SIZE) -#define AIBUF_LEN (170 * SAMPLES_PER_FRAME) // number of samples +#define AIBUF_LEN (170 * SAMPLES_PER_FRAME) // number of samples #define AIBUF_SIZE (AIBUF_LEN * SAMPLE_SIZE) // number of bytes // Filter sizes @@ -216,16 +216,16 @@ typedef struct { /* 0x04 */ u32 end; /* 0x08 */ u32 count; /* 0x10 */ u64 predictorState[4]; // only exists if count != 0. 8-byte aligned -} AdpcmLoop; // size = 0x30 or 0x10, 0x8 aligned +} AdpcmLoop; // size = 0x30 or 0x10, 0x8 aligned typedef struct { /* 0x00 */ s32 order; /* 0x04 */ s32 numPredictors; - #ifdef AVOID_UB +#ifdef AVOID_UB /* 0x08 */ u64 book[]; // size 8 * order * numPredictors. - #else +#else /* 0x08 */ u64 book[1]; // size 8 * order * numPredictors. - #endif +#endif } AdpcmBook; // size >= 8, 0x8 aligned typedef struct { @@ -290,7 +290,7 @@ typedef struct { /* 0x0C */ s32 startPos; // start pos in ring buffer /* 0x10 */ s16 lengthA; // first length in ring buffer (from startPos, at most until end) /* 0x12 */ s16 lengthB; // second length in ring buffer (from pos 0) -} ReverbRingBufferItem; // size = 0x14 +} ReverbRingBufferItem; // size = 0x14 typedef struct { /* 0x000 */ u8 resampleFlags; @@ -300,7 +300,7 @@ typedef struct { /* 0x004 */ u8 downsampleRate; /* 0x005 */ s8 unk_05; /* 0x006 */ u16 windowSize; - /* 0x008 */ u16 decayRatio; // determines how much reverb persists + /* 0x008 */ u16 decayRatio; // determines how much reverb persists /* 0x00A */ u16 unk_0A; /* 0x00C */ u16 leakRtL; /* 0x00E */ u16 leakLtR; @@ -341,7 +341,7 @@ typedef struct { /* 0x004 */ u8 seqId; /* 0x005 */ u8 defaultFont; /* 0x006 */ u8 unk_06[1]; - /* 0x007 */ s8 unk_07[1]; // indexed like an array, but that can't be + /* 0x007 */ s8 unk_07[1]; // indexed like an array, but that can't be /* 0x008 */ u16 tempo; // seqTicks per minute /* 0x00A */ u16 tempoAcc; // tempo accumulation, used in a discretized algorithm to apply tempo. /* 0x00C */ u16 tempoChange; // Used to adjust the tempo without altering the base tempo. @@ -365,8 +365,8 @@ typedef struct { /* 0x0D8 */ s32 skipTicks; /* 0x0DC */ u32 scriptCounter; /* 0x0E0 */ char - padE4[0x6C]; // unused struct members for sequence/sound font dma management, according to sm64 decomp -} SequencePlayer; // size = 0x14C + padE4[0x6C]; // unused struct members for sequence/sound font dma management, according to sm64 decomp +} SequencePlayer; // size = 0x14C typedef struct { /* 0x0 */ u8 decayIndex; // index used to obtain adsr decay rate from adsrDecayTable @@ -381,7 +381,7 @@ typedef struct { /* 0x00 */ u8 hang : 1; /* 0x00 */ u8 decay : 1; /* 0x00 */ u8 release : 1; - /* 0x00 */ + /* 0x00 */ } s; /* 0x00 */ u8 asByte; } action; @@ -475,7 +475,7 @@ typedef struct SequenceChannel { /* 0x7C */ NotePool notePool; /* 0xBC */ s8 seqScriptIO[8]; // bridge between .seq script and audio lib, "io ports" /* 0xC4 */ u16 unkC4; -} SequenceChannel; // size = 0xC8 +} SequenceChannel; // size = 0xC8 // Might also be known as a Track, according to sm64 debug strings (?). typedef struct SequenceLayer { @@ -502,19 +502,19 @@ typedef struct SequenceLayer { /* 0x28 */ f32 velocitySquare; /* 0x2C */ f32 noteVelocity; /* 0x30 */ f32 noteFreqMod; - /* 0x34 */ u16 shortNoteDefaultDelay; + /* 0x34 */ u16 shortNoteDefaultDelay; /* 0x36 */ u16 lastDelay; /* 0x38 */ s16 delay; /* 0x3A */ s16 gateDelay; /* 0x3C */ s16 delay2; - /* 0x40 */ struct Note *note; + /* 0x40 */ struct Note* note; /* 0x44 */ Instrument* instrument; - /* 0x48 */ TunedSample *tunedSample; - /* 0x4C */ SequenceChannel *channel; + /* 0x48 */ TunedSample* tunedSample; + /* 0x4C */ SequenceChannel* channel; /* 0x50 */ SeqScriptState state; /* 0x6C */ AudioListItem listItem; /* 0x7C */ char pad7C[4]; -} SequenceLayer; //size = 0x80 +} SequenceLayer; // size = 0x80 typedef struct UnkStruct_800097A8 { /* 0x00 */ s16* unk_0; @@ -525,7 +525,7 @@ typedef struct UnkStruct_800097A8 { /* 0x14 */ struct SampleDma* unk_14; /* 0x18 */ s16 unk18; /* 0x1A */ char pad1A[6]; -} UnkStruct_800097A8; /* size = 0x20 */ +} UnkStruct_800097A8; /* size = 0x20 */ typedef struct { /* 0x000 */ s16 adpcmdecState[16]; @@ -834,20 +834,13 @@ typedef struct { /* 0x00 */ s16 numEntries; /* 0x02 */ s16 unkMediumParam; /* 0x04 */ u32 romAddr; - /* 0x08 */ char pad[0x8]; + /* 0x08 */ char pad[8]; } AudioTableBase; typedef struct { - /* 0x00 */ s16 numEntries; - /* 0x02 */ s16 unkMediumParam; - /* 0x04 */ u32 romAddr; - /* 0x08 */ char pad[0x8]; - #ifdef AVOID_UB + /* 0x00 */ AudioTableBase base; /* 0x10 */ AudioTableEntry entries[]; // (dynamic size) - #else - /* 0x10 */ AudioTableEntry entries[1]; // (dynamic size) - #endif -} AudioTable; // size >= 0x20 +} AudioTable; // size >= 0x20 typedef struct SampleDma { /* 0x00 */ u8* ramAddr; @@ -914,13 +907,13 @@ typedef struct { } SoundTestTrack; // size: 0x6 typedef struct { - /* 0x00 */ f32 *xPos; - /* 0x04 */ f32 *yPos; - /* 0x08 */ f32 *zPos; + /* 0x00 */ f32* xPos; + /* 0x04 */ f32* yPos; + /* 0x08 */ f32* zPos; /* 0x0C */ u8 token; - /* 0x10 */ f32 *freqMod; - /* 0x14 */ f32 *volMod; - /* 0x18 */ s8 *reverbAdd; + /* 0x10 */ f32* freqMod; + /* 0x14 */ f32* volMod; + /* 0x18 */ s8* reverbAdd; /* 0x1C */ f32 distance; /* 0x20 */ u32 priority; /* 0x24 */ u32 sfxId; @@ -943,7 +936,7 @@ typedef struct { typedef struct { /* 0x0 */ u32 priority; // lower is more prioritized /* 0x4 */ u8 entryIndex; -} ActiveSfx; // size 0x8 +} ActiveSfx; // size 0x8 typedef struct { /* 0x0 */ u8 seqId; @@ -977,19 +970,19 @@ typedef struct { /* 0x014 */ u32 tempoCmd; /* 0x018 */ u16 tempoOriginal; // stores the original tempo before modifying it (to reset back to) /* 0x01C */ Modulation tempo; - /* 0x02C */ u32 setupCmd[5]; // a queue of cmds to execute once the player is disabled - /* 0x040 */ u8 setupCmdTimer; // only execute setup commands when the timer is at 0. - /* 0x041 */ u8 setupCmdNum; // number of setup commands requested once the player is disabled + /* 0x02C */ u32 setupCmd[5]; // a queue of cmds to execute once the player is disabled + /* 0x040 */ u8 setupCmdTimer; // only execute setup commands when the timer is at 0. + /* 0x041 */ u8 setupCmdNum; // number of setup commands requested once the player is disabled /* 0x042 */ u8 setupFadeTimer; /* 0x044 */ ChannelModulation channelMod[16]; /* 0x244 */ u16 freqModChannelFlags; /* 0x246 */ u16 volChannelFlags; - /* 0x248 */ u16 seqId; // active seqId currently playing. Resets when sequence stops - /* 0x24A */ u16 prevSeqId; // last seqId played on a player. Does not reset when sequence stops + /* 0x248 */ u16 seqId; // active seqId currently playing. Resets when sequence stops + /* 0x24A */ u16 prevSeqId; // last seqId played on a player. Does not reset when sequence stops /* 0x24C */ u16 channelPortMask; - /* 0x250 */ u32 startSeqCmd; // This name comes from MM + /* 0x250 */ u32 startSeqCmd; // This name comes from MM /* 0x254 */ u8 isWaitingForFonts; // This name comes from MM -} ActiveSequence; // size 0x258 +} ActiveSequence; // size 0x258 typedef struct { /* 0x0 */ f32 volMod; @@ -1022,12 +1015,12 @@ typedef struct { #define SEQ_HEX0(seqId) ((seqId) >> 28 & 0xFF) #define SEQ_HEX1(seqId) (((seqId) & (0xF << 24)) >> 24 & 0xFF) -#define SEQ_BYTE4(seqId) ((seqId) & 0xFF) -#define SEQ_BYTE3(seqId) (((seqId) & (0xFF << 8)) >>8 & 0xFF) -#define SEQ_BYTE2(seqId) (((seqId) & (0xFF << 16)) >>13 & 0xFFFF) +#define SEQ_BYTE4(seqId) ((seqId) &0xFF) +#define SEQ_BYTE3(seqId) (((seqId) & (0xFF << 8)) >> 8 & 0xFF) +#define SEQ_BYTE2(seqId) (((seqId) & (0xFF << 16)) >> 13 & 0xFFFF) // audio_synthesis -void func_80008780(f32 *, s32, f32 *); +void func_80008780(f32*, s32, f32*); Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen); // audio_effects @@ -1077,7 +1070,7 @@ void func_800128B4(void); void func_80012964(NotePool* pool); void func_80012AC4(NotePool* pool, s32); void func_80012C40(Note* note); -Note *func_8001301C(SequenceLayer* layer); +Note* func_8001301C(SequenceLayer* layer); void func_800132E8(void); // audio_seqplayer @@ -1091,18 +1084,15 @@ void func_800168BC(void); // audio_thread void AudioThread_ScheduleProcessCmds(void); -u32 AudioThread_GetAsyncLoadStatus(u32 *); +u32 AudioThread_GetAsyncLoadStatus(u32*); u8* AudioThread_GetFontsForSequence(s32 seqId, u32* outNumFonts); bool AudioThread_ResetComplete(void); void AudioThread_ResetAudioHeap(s32); void AudioThread_Init(void); -extern AudioTableBase gSampleBankTableInit; -// extern AudioTableEntry gSampleBankTableInitEntries[]; -extern AudioTableBase gSeqTableInit; -// extern AudioTableEntry gSeqTableInitEntries[]; -extern AudioTableBase gSoundFontTableInit; -// extern AudioTableEntry gSoundFontTableInitEntries[]; +extern AudioTable gSampleBankTableInit; +extern AudioTable gSeqTableInit; +extern AudioTable gSoundFontTableInit; extern u8 gSeqFontTableInit[]; extern AudioSpec gAudioSpecs[]; @@ -1150,7 +1140,7 @@ extern u8 gSeqLoadStatus[256]; extern volatile u8 gAudioResetStep; extern u8 gAudioSpecId; extern s32 gResetFadeoutFramesLeft; -extern u8 sAudioContextPad1000[0x1000];// 0x1000 gap +extern u8 sAudioContextPad1000[0x1000]; // 0x1000 gap extern Note* gNotes; // 0x4 extern SequencePlayer gSeqPlayers[4]; @@ -1186,10 +1176,10 @@ extern u8 gSampleDmaReuseQueue1RdPos; extern u8 gSampleDmaReuseQueue2RdPos; extern u8 gSampleDmaReuseQueue1WrPos; extern u8 gSampleDmaReuseQueue2WrPos; -extern AudioTable *gSequenceTable; +extern AudioTable* gSequenceTable; extern AudioTable* gSoundFontTable; -extern AudioTable *gSampleBankTable; -extern u8 *gSeqFontTable; +extern AudioTable* gSampleBankTable; +extern u8* gSeqFontTable; extern s16 gNumSequences; extern SoundFont* gSoundFontList; // 0x4 diff --git a/src/audio/audio_heap.c b/src/audio/audio_heap.c index ab2a6127..f19b6b21 100644 --- a/src/audio/audio_heap.c +++ b/src/audio/audio_heap.c @@ -915,7 +915,7 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) { s32 sampleBankId2; s32 sampleBankId1; - numFonts = gSoundFontTable->numEntries; + numFonts = gSoundFontTable->base.numEntries; for (fondId = 0; fondId < numFonts; fondId++) { sampleBankId1 = gSoundFontList[fondId].sampleBankId1; sampleBankId2 = gSoundFontList[fondId].sampleBankId2; @@ -974,7 +974,7 @@ SampleCacheEntry* AudioHeap_AllocPersistentSampleCacheEntry(u32 size) { void AudioHeap_DiscardSampleCaches(void) { s32 fontId; s32 i; - s32 numFonts = gSoundFontTable->numEntries; + s32 numFonts = gSoundFontTable->base.numEntries; s32 pad; s32 sampleBankId2; s32 sampleBankId1; diff --git a/src/audio/audio_load.c b/src/audio/audio_load.c index 486e3deb..4be5eaf8 100644 --- a/src/audio/audio_load.c +++ b/src/audio/audio_load.c @@ -207,10 +207,10 @@ void AudioLoad_InitSampleDmaBuffers(s32 numNotes) { void AudioLoad_InitTable(AudioTable* table, u8* romAddr, u16 unkMediumParam) { s32 i; - table->unkMediumParam = unkMediumParam; - table->romAddr = romAddr; + table->base.unkMediumParam = unkMediumParam; + table->base.romAddr = romAddr; - for (i = 0; i < table->numEntries; i++) { + for (i = 0; i < table->base.numEntries; i++) { if ((table->entries[i].size != 0) && (table->entries[i].medium == MEDIUM_CART)) { table->entries[i].romAddr += (u32) romAddr; } @@ -253,7 +253,8 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { return -1; } if (sample->medium == MEDIUM_UNK) { - AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleAddr, sample->size, gSampleBankTable->unkMediumParam); + AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleAddr, sample->size, + gSampleBankTable->base.unkMediumParam); } else { AudioLoad_SyncDma(sample->sampleAddr, sampleAddr, sample->size, sample->medium); } @@ -509,7 +510,7 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) { *didAllocate = true; if (medium == MEDIUM_UNK) { - AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, table->unkMediumParam); + AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, table->base.unkMediumParam); } else { AudioLoad_SyncDma(romAddr, ramAddr, size, medium); } @@ -882,11 +883,11 @@ void AudioLoad_Init(void) { gSoundFontTable = (AudioTable*) &gSoundFontTableInit; gSampleBankTable = (AudioTable*) &gSampleBankTableInit; gSeqFontTable = gSeqFontTableInit; - gNumSequences = gSequenceTable->numEntries; + gNumSequences = gSequenceTable->base.numEntries; AudioLoad_InitTable(gSequenceTable, SEGMENT_ROM_START(audio_seq), gSequenceMedium); AudioLoad_InitTable(gSoundFontTable, SEGMENT_ROM_START(audio_bank), gSoundFontMedium); AudioLoad_InitTable(gSampleBankTable, SEGMENT_ROM_START(audio_table), gSampleBankMedium); - numFonts = gSoundFontTable->numEntries; + numFonts = gSoundFontTable->base.numEntries; gSoundFontList = AudioHeap_Alloc(&gInitPool, numFonts * sizeof(SoundFont)); for (i = 0; i < numFonts; i++) { gSoundFontList[i].sampleBankId1 = (gSoundFontTable->entries[i].shortData1 >> 8) & 0xFF; @@ -1003,7 +1004,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) { } else if (slowLoad->bytesRemaining < 0x1000) { if (slowLoad->medium == MEDIUM_UNK) { AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, - slowLoad->bytesRemaining, sampleBankTable->unkMediumParam); + slowLoad->bytesRemaining, sampleBankTable->base.unkMediumParam); } else { AudioLoad_DmaSlowCopy(&gSlowLoads.slowLoad[i], slowLoad->bytesRemaining); } @@ -1011,7 +1012,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) { } else { if (slowLoad->medium == MEDIUM_UNK) { AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, 0x1000, - sampleBankTable->unkMediumParam); + sampleBankTable->base.unkMediumParam); } else { AudioLoad_DmaSlowCopy(&gSlowLoads.slowLoad[i], 0x1000); } @@ -1161,7 +1162,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { } else if (asyncLoad->bytesRemaining < asyncLoad->chunkSize) { if (asyncLoad->medium == MEDIUM_UNK) { AudioLoad_AsyncDmaUnkMedium(asyncLoad->curDevAddr, asyncLoad->curRamAddr, asyncLoad->bytesRemaining, - sampleTable->unkMediumParam); + sampleTable->base.unkMediumParam); } else { AudioLoad_AsyncDma(asyncLoad, asyncLoad->bytesRemaining); } @@ -1169,7 +1170,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { } else { if (asyncLoad->medium == MEDIUM_UNK) { AudioLoad_AsyncDmaUnkMedium(asyncLoad->curDevAddr, asyncLoad->curRamAddr, asyncLoad->chunkSize, - sampleTable->unkMediumParam); + sampleTable->base.unkMediumParam); } else { AudioLoad_AsyncDma(asyncLoad, asyncLoad->chunkSize); } @@ -1296,7 +1297,7 @@ s32 AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, u32 fontDataAddr, Sample case AUDIOLOAD_SYNC: if (sample->medium == MEDIUM_UNK) { AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleRamAddr, sample->size, - gSampleBankTable->unkMediumParam); + gSampleBankTable->base.unkMediumParam); sample->sampleAddr = sampleRamAddr; sample->medium = MEDIUM_RAM; } else { diff --git a/src/audio/audio_tables.c b/src/audio/audio_tables.c index 370e7c67..2bfea4c3 100644 --- a/src/audio/audio_tables.c +++ b/src/audio/audio_tables.c @@ -1,49 +1,53 @@ #include "sys.h" #include "sf64audio_provisional.h" -AudioTableBase gSampleBankTableInit = { 4, 0, 0 }; -AudioTableEntry gSampleBankTableInitEntries[4] = { - { 0x000000, 0x0E1E30, MEDIUM_CART, CACHEPOLICY_4 }, - { 0x0E1E30, 0x0FF9D0, MEDIUM_CART, CACHEPOLICY_4 }, - { 0x1E1800, 0x497480, MEDIUM_CART, CACHEPOLICY_4 }, - { 0x678C80, 0x0C3900, MEDIUM_CART, CACHEPOLICY_4 }, +AudioTable gSampleBankTableInit = { + { 4, 0, 0 }, + { + { 0x000000, 0x0E1E30, MEDIUM_CART, CACHEPOLICY_4 }, + { 0x0E1E30, 0x0FF9D0, MEDIUM_CART, CACHEPOLICY_4 }, + { 0x1E1800, 0x497480, MEDIUM_CART, CACHEPOLICY_4 }, + { 0x678C80, 0x0C3900, MEDIUM_CART, CACHEPOLICY_4 }, + }, }; -AudioTableBase gSeqTableInit = { SEQ_ID_MAX, 0, 0 }; -AudioTableEntry gSeqTableInitEntries[SEQ_ID_MAX] = { - { 0x00000, 0x3AF0, MEDIUM_CART, CACHEPOLICY_0 }, { 0x03AF0, 0x56B0, MEDIUM_CART, CACHEPOLICY_0 }, - { 0x091A0, 0x2D80, MEDIUM_CART, CACHEPOLICY_3 }, { 0x0BF20, 0x1410, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x0D330, 0x1600, MEDIUM_CART, CACHEPOLICY_3 }, { 0x0E930, 0xF20, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x0F850, 0x13A0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x10BF0, 0x1100, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x11CF0, 0x19E0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x136D0, 0x13E0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x14AB0, 0x12F0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_SECTOR_Y, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x15DA0, 0xB70, MEDIUM_CART, CACHEPOLICY_3 }, { 0x16910, 0x2460, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x18D70, 0xD40, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_FORTUNA, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_TITANIA, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x19AB0, 0x7F0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x1A2A0, 0x1440, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1B6E0, 0x1B20, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1D200, 0x1B30, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x1ED30, 0x10B0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_BO, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_BO, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1FDE0, 0x1410, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x211F0, 0xF30, MEDIUM_CART, CACHEPOLICY_3 }, { 0x22120, 0x2B30, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x24C50, 0x7F0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x25440, 0x13B0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x267F0, 0xC70, MEDIUM_CART, CACHEPOLICY_3 }, { 0x27460, 0x180, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x275E0, 0x5C0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_TITLE, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x27BA0, 0x4E40, MEDIUM_CART, CACHEPOLICY_3 }, { 0x2C9E0, 0x14E0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x2DEC0, 0x400, MEDIUM_CART, CACHEPOLICY_3 }, { 0x2E2C0, 0x800, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x2EAC0, 0x1AB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x30570, 0x1AA0, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x32010, 0x1370, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x33380, 0xB80, MEDIUM_CART, CACHEPOLICY_3 }, { 0x33F00, 0x5C0, MEDIUM_CART, CACHEPOLICY_3 }, - { SEQ_ID_CO_INTRO, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_CO_INTRO, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x344C0, 0x550, MEDIUM_CART, CACHEPOLICY_3 }, { 0x34A10, 0x360, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x34D70, 0x620, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_VS_MENU, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x35390, 0xA70, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_STAR_WOLF, 0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x35E00, 0xAB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x368B0, 0x13D0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x37C80, 0x250, MEDIUM_CART, CACHEPOLICY_3 }, { 0x37ED0, 0x6F0, MEDIUM_CART, CACHEPOLICY_3 }, - { 0x385C0, 0xFB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x39570, 0x1780, MEDIUM_CART, CACHEPOLICY_3 }, +AudioTable gSeqTableInit = { + { SEQ_ID_MAX, 0, 0 }, + { + { 0x00000, 0x3AF0, MEDIUM_CART, CACHEPOLICY_0 }, { 0x03AF0, 0x56B0, MEDIUM_CART, CACHEPOLICY_0 }, + { 0x091A0, 0x2D80, MEDIUM_CART, CACHEPOLICY_3 }, { 0x0BF20, 0x1410, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x0D330, 0x1600, MEDIUM_CART, CACHEPOLICY_3 }, { 0x0E930, 0xF20, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x0F850, 0x13A0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x10BF0, 0x1100, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x11CF0, 0x19E0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x136D0, 0x13E0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x14AB0, 0x12F0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_SECTOR_Y, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x15DA0, 0xB70, MEDIUM_CART, CACHEPOLICY_3 }, { 0x16910, 0x2460, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x18D70, 0xD40, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_FORTUNA, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_TITANIA, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x19AB0, 0x7F0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x1A2A0, 0x1440, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1B6E0, 0x1B20, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1D200, 0x1B30, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x1ED30, 0x10B0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_BO, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_BO, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1FDE0, 0x1410, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x211F0, 0xF30, MEDIUM_CART, CACHEPOLICY_3 }, { 0x22120, 0x2B30, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x24C50, 0x7F0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x25440, 0x13B0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x267F0, 0xC70, MEDIUM_CART, CACHEPOLICY_3 }, { 0x27460, 0x180, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x275E0, 0x5C0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_TITLE, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x27BA0, 0x4E40, MEDIUM_CART, CACHEPOLICY_3 }, { 0x2C9E0, 0x14E0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x2DEC0, 0x400, MEDIUM_CART, CACHEPOLICY_3 }, { 0x2E2C0, 0x800, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x2EAC0, 0x1AB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x30570, 0x1AA0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x32010, 0x1370, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x33380, 0xB80, MEDIUM_CART, CACHEPOLICY_3 }, { 0x33F00, 0x5C0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_CO_INTRO, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_CO_INTRO, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x344C0, 0x550, MEDIUM_CART, CACHEPOLICY_3 }, { 0x34A10, 0x360, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x34D70, 0x620, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_VS_MENU, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x35390, 0xA70, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_STAR_WOLF, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x35E00, 0xAB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x368B0, 0x13D0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x37C80, 0x250, MEDIUM_CART, CACHEPOLICY_3 }, { 0x37ED0, 0x6F0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x385C0, 0xFB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x39570, 0x1780, MEDIUM_CART, CACHEPOLICY_3 }, + }, }; #define SOUNDFONT_ENTRY(offset, size, medium, cachePolicy, bank1, bank2, numInst, numDrums) \ { \ @@ -51,41 +55,43 @@ AudioTableEntry gSeqTableInitEntries[SEQ_ID_MAX] = { (((numInst) &0xFF) << 8) | ((numDrums) &0xFF) \ } -AudioTableBase gSoundFontTableInit = { 33, 0, 0 }; -AudioTableEntry gSoundFontTableInitEntries[33] = { - SOUNDFONT_ENTRY(0x00000, 0x2F00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_SFX, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x02F00, 0x0FE0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_MAP, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x03EE0, 0x0640, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x04520, 0x1560, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x05A80, 0x0C00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x06680, 0x0DE0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x07460, 0x1200, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x08660, 0x1040, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x096A0, 0x0E40, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x0A4E0, 0x0C20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x0B100, 0x1920, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x0CA20, 0x0A20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x0D440, 0x0A00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x0DE40, 0x0D60, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x0EBA0, 0x0C20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x0F7C0, 0x0F00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x106C0, 0x0F20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x115E0, 0x0E20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x12400, 0x10A0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x134A0, 0x2580, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x15A20, 0x09E0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), - SOUNDFONT_ENTRY(0x16400, 0x1220, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64), - SOUNDFONT_ENTRY(0x17620, 0x0180, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 3, 0), - SOUNDFONT_ENTRY(0x177A0, 0x11C0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64), - SOUNDFONT_ENTRY(0x18960, 0x0940, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x192A0, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x19C80, 0x0920, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x1A5A0, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x1AF80, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x1B960, 0x0A10, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x1C370, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x1CD50, 0x0A00, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), - SOUNDFONT_ENTRY(0x1D750, 0x08D0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), +AudioTable gSoundFontTableInit = { + { 33, 0, 0 }, + { + SOUNDFONT_ENTRY(0x00000, 0x2F00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_SFX, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x02F00, 0x0FE0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_MAP, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x03EE0, 0x0640, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x04520, 0x1560, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x05A80, 0x0C00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x06680, 0x0DE0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x07460, 0x1200, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x08660, 0x1040, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x096A0, 0x0E40, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x0A4E0, 0x0C20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x0B100, 0x1920, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x0CA20, 0x0A20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x0D440, 0x0A00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x0DE40, 0x0D60, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x0EBA0, 0x0C20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x0F7C0, 0x0F00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x106C0, 0x0F20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x115E0, 0x0E20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x12400, 0x10A0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x134A0, 0x2580, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x15A20, 0x09E0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x16400, 0x1220, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64), + SOUNDFONT_ENTRY(0x17620, 0x0180, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 3, 0), + SOUNDFONT_ENTRY(0x177A0, 0x11C0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64), + SOUNDFONT_ENTRY(0x18960, 0x0940, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x192A0, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x19C80, 0x0920, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1A5A0, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1AF80, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1B960, 0x0A10, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1C370, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1CD50, 0x0A00, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1D750, 0x08D0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + }, }; #define AS_BYTES(x) (((x) >> 8) & 0xFF), ((x) &0xFF)