You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Refresh 3
This commit is contained in:
@@ -7,15 +7,15 @@
|
||||
// Format:
|
||||
// - frequency
|
||||
// - max number of simultaneous notes
|
||||
// - unk5 (chunk size/discretization step?)
|
||||
// - unk6 (some memory req)
|
||||
// - unk8 (gain?)
|
||||
// - reverb downsample rate (makes the ring buffer be downsampled to save memory)
|
||||
// - reverb window size (ring buffer size, length affects reverb delay)
|
||||
// - reverb gain (0 = min reverb, 32767 = max reverb, 32769 to 65535 = louder and louder...)
|
||||
// - volume
|
||||
// - memory used for persistent sequences
|
||||
// - memory used for persistent banks
|
||||
// - memory used for temporary sequences
|
||||
// - memory used for temporary banks
|
||||
struct Struct80332190 D_80332190[18] = {
|
||||
struct AudioSessionSettings gAudioSessionPresets[18] = {
|
||||
#ifdef VERSION_JP
|
||||
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
@@ -366,8 +366,8 @@ f32 gVolRampingRhs128[128] = {
|
||||
|
||||
s16 gTatumsPerBeat = TATUMS_PER_BEAT;
|
||||
s8 gUnusedCount80333EE8 = 16;
|
||||
s32 gAudioHeapSize = 0x31150;
|
||||
s32 D_80333EF0 = 0x2500;
|
||||
s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(0x31150);
|
||||
s32 D_80333EF0 = DOUBLE_SIZE_ON_64_BIT(0x2500);
|
||||
volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
||||
s8 sUnused8033EF8 = 24;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define NUMAIBUFFERS 3
|
||||
|
||||
// constant .data
|
||||
extern struct Struct80332190 D_80332190[18];
|
||||
extern struct AudioSessionSettings gAudioSessionPresets[18];
|
||||
extern u16 D_80332388[128]; // unused
|
||||
|
||||
extern f32 gPitchBendFrequencyScale[255];
|
||||
@@ -39,7 +39,7 @@ extern f32 gVolRampingRhs128[128];
|
||||
extern s16 gTatumsPerBeat;
|
||||
extern s8 gUnusedCount80333EE8;
|
||||
extern s32 gAudioHeapSize;
|
||||
extern s32 D_80333EF0; // amount of heap designated to gSoundPool, 0x2500
|
||||
extern s32 D_80333EF0; // amount of heap designated to gAudioInitPool, 0x2500
|
||||
extern volatile s32 gAudioLoadLock;
|
||||
|
||||
// .bss
|
||||
|
||||
@@ -683,7 +683,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
// across this function call.
|
||||
flags = 0;
|
||||
|
||||
gAudioCmd = func_80313CD4(gAudioCmd, &writtenCmds, gCurrAiBuffer, gAiBufferLengths[index]);
|
||||
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, gCurrAiBuffer, gAiBufferLengths[index]);
|
||||
D_80226EB8 = ((D_80226EB8 + gActiveAudioFrames) * gActiveAudioFrames);
|
||||
|
||||
index = gAudioTaskIndex;
|
||||
@@ -2074,7 +2074,7 @@ void sound_reset(u8 arg0) {
|
||||
sGameLoopTicked = 0;
|
||||
disable_all_sequence_players();
|
||||
sound_init();
|
||||
func_80316928(&D_80332190[arg0]);
|
||||
audio_reset_session(&gAudioSessionPresets[arg0]);
|
||||
osWritebackDCacheAll();
|
||||
if (arg0 != 7) {
|
||||
preload_sequence(SEQ_EVENT_SOLVE_PUZZLE, PRELOAD_BANKS | PRELOAD_SEQUENCE);
|
||||
|
||||
@@ -337,14 +337,14 @@ struct SequenceChannelLayer // Maybe SequenceTrack?
|
||||
struct Note
|
||||
{
|
||||
/*0x00*/ u8 enabled : 1;
|
||||
/*0x00*/ u8 unk0b40 : 1;
|
||||
/*0x00*/ u8 unk0b20 : 1;
|
||||
/*0x00*/ u8 unk0b10 : 1;
|
||||
/*0x00*/ u8 unk0b8 : 1;
|
||||
/*0x00*/ u8 needsInit : 1;
|
||||
/*0x00*/ u8 restart : 1;
|
||||
/*0x00*/ u8 finished : 1;
|
||||
/*0x00*/ u8 envMixerNeedsInit : 1;
|
||||
/*0x00*/ u8 stereoStrongRight : 1;
|
||||
/*0x00*/ u8 stereoStrongLeft : 1;
|
||||
/*0x00*/ u8 stereoHeadsetEffects : 1;
|
||||
/*0x01*/ u8 usesStereo;
|
||||
/*0x01*/ u8 usesHeadsetPanEffects;
|
||||
/*0x02*/ u8 unk2;
|
||||
/*0x03*/ u8 sampleDmaIndex;
|
||||
/*0x04*/ u8 priority;
|
||||
@@ -357,15 +357,15 @@ struct Note
|
||||
/*0x0E*/ u16 headsetPanLeft;
|
||||
/*0x10*/ u16 prevHeadsetPanRight;
|
||||
/*0x12*/ u16 prevHeadsetPanLeft;
|
||||
/*0x14*/ s32 unk14;
|
||||
/*0x14*/ s32 samplePosInt;
|
||||
/*0x18*/ f32 portamentoFreqScale;
|
||||
/*0x1C*/ f32 vibratoFreqScale;
|
||||
/*0x20*/ u16 unk20;
|
||||
/*0x20*/ u16 samplePosFrac;
|
||||
/*0x24*/ struct AudioBankSound *sound;
|
||||
/*0x28*/ struct SequenceChannelLayer *prevParentLayer;
|
||||
/*0x2C*/ struct SequenceChannelLayer *parentLayer;
|
||||
/*0x30*/ struct SequenceChannelLayer *wantedParentLayer;
|
||||
/*0x34*/ struct SubStruct_func_80318F04 *unk34; // or s16*
|
||||
/*0x34*/ struct NoteSynthesisBuffers *synthesisBuffers;
|
||||
/*0x38*/ f32 frequency;
|
||||
/*0x3C*/ u16 targetVolLeft;
|
||||
/*0x3E*/ u16 targetVolRight;
|
||||
@@ -383,25 +383,24 @@ struct Note
|
||||
/* */ u8 pad2[0xc];
|
||||
}; // size = 0xC0
|
||||
|
||||
//this is probably just an array with a bunch of indexes
|
||||
struct SubStruct_func_80318F04
|
||||
struct NoteSynthesisBuffers
|
||||
{
|
||||
s16 unk00[0x10];
|
||||
s16 unk20[0x10];
|
||||
s16 unk40[0x28];
|
||||
s16 unk90[0x10];
|
||||
s16 unkB0[0x20];
|
||||
s16 unkF0[0x10];
|
||||
s16 adpcmdecState[0x10];
|
||||
s16 finalResampleState[0x10];
|
||||
s16 mixEnvelopeState[0x28];
|
||||
s16 panResampleState[0x10];
|
||||
s16 panSamplesBuffer[0x20];
|
||||
s16 dummyResampleState[0x10];
|
||||
s16 samples[0x40];
|
||||
};
|
||||
|
||||
struct Struct80332190
|
||||
struct AudioSessionSettings
|
||||
{
|
||||
/*0x00*/ u32 frequency;
|
||||
/*0x04*/ u8 maxSimultaneousNotes;
|
||||
/*0x05*/ u8 unk5; // stored to D_802212A2, always 1
|
||||
/*0x06*/ u16 unk6; // memory requirement of some sort
|
||||
/*0x08*/ u16 unk8; // gain? stored to D_802211B0.unk4
|
||||
/*0x05*/ u8 reverbDownsampleRate; // always 1
|
||||
/*0x06*/ u16 reverbWindowSize;
|
||||
/*0x08*/ u16 reverbGain;
|
||||
/*0x0A*/ u16 volume;
|
||||
/*0x0C*/ u32 persistentSeqMem;
|
||||
/*0x10*/ u32 persistentBankMem;
|
||||
|
||||
@@ -12,11 +12,11 @@ struct SharedDma {
|
||||
/*0x0*/ u8 *buffer; // target, points to pre-allocated buffer
|
||||
/*0x4*/ uintptr_t source; // device address
|
||||
/*0x8*/ u16 sizeUnused; // set to bufSize, never read
|
||||
/*0xA*/ u16 bufSize;
|
||||
/*0xC*/ u8 unused2; // set to 0, never read
|
||||
/*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
|
||||
}; // size = 0x10
|
||||
/*0xA*/ u16 bufSize; // size of buffer
|
||||
/*0xC*/ u8 unused2; // set to 0, never read
|
||||
/*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
|
||||
}; // size = 0x10
|
||||
|
||||
struct Note *gNotes;
|
||||
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];
|
||||
@@ -126,25 +126,23 @@ void decrease_sample_dma_ttls() {
|
||||
sUnused80226B40 = 0;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
|
||||
void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
ssize_t bufferPos; // v0
|
||||
struct SharedDma *dma; // sp58, v1, t0
|
||||
u32 transfer; // v0
|
||||
u32 dmaDevAddr; // s0
|
||||
u32 i; // a0
|
||||
u32 dmaIndex; // sp48, t2
|
||||
s32 hasDma = 0; // t4
|
||||
UNUSED s32 pad;
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
s32 hasDma = FALSE;
|
||||
struct SharedDma *dma;
|
||||
uintptr_t dmaDevAddr;
|
||||
u32 transfer;
|
||||
u32 i;
|
||||
u32 dmaIndex;
|
||||
ssize_t bufferPos;
|
||||
UNUSED u32 pad;
|
||||
|
||||
if (arg2 != 0 || *arg3 >= sSampleDmaListSize1) {
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
dma = sSampleDmas + i;
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
// We already have a DMA request for this memory range.
|
||||
if (dma->ttl == 0 && sSampleDmaReuseQueueHead2 != sSampleDmaReuseQueueTail2) {
|
||||
if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2) {
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail2) {
|
||||
@@ -157,21 +155,21 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
}
|
||||
dma->ttl = 60;
|
||||
*arg3 = (u8) i;
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
return dma->buffer + bufferPos;
|
||||
return (devAddr - dma->source) + dma->buffer;
|
||||
}
|
||||
}
|
||||
|
||||
if (sSampleDmaReuseQueueHead2 != sSampleDmaReuseQueueTail2 && arg2 != 0) {
|
||||
if (sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2 && arg2 != 0) {
|
||||
// Allocate a DMA from reuse queue 2. This queue can be empty, since
|
||||
// TTL 60 is pretty large.
|
||||
dmaIndex = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2++];
|
||||
dma = &sSampleDmas[dmaIndex];
|
||||
hasDma = 1;
|
||||
dmaIndex = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
sSampleDmaReuseQueueTail2++;
|
||||
dma = sSampleDmas + dmaIndex;
|
||||
hasDma = TRUE;
|
||||
}
|
||||
} else {
|
||||
dma = &sSampleDmas[*arg3];
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
dma = sSampleDmas + *arg3;
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
// We already have DMA for this memory range.
|
||||
if (dma->ttl == 0) {
|
||||
@@ -184,10 +182,9 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
dma->reuseIndex;
|
||||
}
|
||||
sSampleDmaReuseQueueTail1++;
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
}
|
||||
dma->ttl = 2;
|
||||
return dma->buffer + bufferPos;
|
||||
return (devAddr - dma->source) + dma->buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,12 +192,12 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
// Allocate a DMA from reuse queue 1. This queue will hopefully never
|
||||
// be empty, since TTL 2 is so small.
|
||||
dmaIndex = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1++];
|
||||
dma = &sSampleDmas[dmaIndex];
|
||||
hasDma = 1;
|
||||
dma = sSampleDmas + dmaIndex;
|
||||
hasDma = TRUE;
|
||||
}
|
||||
|
||||
transfer = dma->bufSize;
|
||||
dmaDevAddr = (uintptr_t) devAddr & ~0xF;
|
||||
dmaDevAddr = devAddr & ~0xF;
|
||||
dma->ttl = 2;
|
||||
dma->source = dmaDevAddr;
|
||||
dma->sizeUnused = transfer;
|
||||
@@ -211,15 +208,9 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*arg3 = dmaIndex;
|
||||
return dma->buffer + (uintptr_t) devAddr - dmaDevAddr;
|
||||
return dma->buffer + (devAddr - dmaDevAddr);
|
||||
}
|
||||
|
||||
#elif defined(VERSION_JP)
|
||||
GLOBAL_ASM("asm/non_matchings/dma_sample_data_jp.s")
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/dma_sample_data_us.s")
|
||||
#endif
|
||||
|
||||
// called from sound_reset
|
||||
void func_8031758C(UNUSED s32 arg0) {
|
||||
s32 i;
|
||||
@@ -227,7 +218,7 @@ void func_8031758C(UNUSED s32 arg0) {
|
||||
|
||||
D_80226D68 = 144 * 9;
|
||||
for (i = 0; i < gMaxSimultaneousNotes * 3; i++) {
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&D_802212C8, D_80226D68);
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, D_80226D68);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
goto out1;
|
||||
}
|
||||
@@ -255,7 +246,7 @@ out1:
|
||||
|
||||
D_80226D68 = 160 * 9;
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&D_802212C8, D_80226D68);
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, D_80226D68);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
goto out2;
|
||||
}
|
||||
@@ -726,17 +717,17 @@ void audio_init() {
|
||||
gCurrAudioFrameDmaCount = 0;
|
||||
gSampleDmaNumListItems = 0;
|
||||
|
||||
func_80316108(D_80333EF0);
|
||||
sound_init_main_pools(D_80333EF0);
|
||||
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
gAiBuffers[i] = soundAlloc(&gSoundPool, 0xa00);
|
||||
gAiBuffers[i] = soundAlloc(&gAudioInitPool, 0xa00);
|
||||
|
||||
for (j = 0; j < 0x500; j++) {
|
||||
gAiBuffers[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
func_80316928(&D_80332190[0]);
|
||||
audio_reset_session(&gAudioSessionPresets[0]);
|
||||
|
||||
// Load header for sequence data (assets/music_data.sbk.s)
|
||||
gSeqFileHeader = (ALSeqFile *) buf;
|
||||
@@ -744,7 +735,7 @@ void audio_init() {
|
||||
audio_dma_copy_immediate((uintptr_t) data, gSeqFileHeader, 0x10);
|
||||
gSequenceCount = gSeqFileHeader->seqCount;
|
||||
size = ALIGN16(gSequenceCount * sizeof(ALSeqData) + 4);
|
||||
gSeqFileHeader = soundAlloc(&gSoundPool, size);
|
||||
gSeqFileHeader = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate((uintptr_t) data, gSeqFileHeader, size);
|
||||
alSeqFileNew(gSeqFileHeader, data);
|
||||
|
||||
@@ -754,8 +745,8 @@ void audio_init() {
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlCtlHeader, 0x10);
|
||||
size = gAlCtlHeader->seqCount * sizeof(ALSeqData) + 4;
|
||||
size = ALIGN16(size);
|
||||
gCtlEntries = soundAlloc(&gSoundPool, gAlCtlHeader->seqCount * sizeof(struct CtlEntry));
|
||||
gAlCtlHeader = soundAlloc(&gSoundPool, size);
|
||||
gCtlEntries = soundAlloc(&gAudioInitPool, gAlCtlHeader->seqCount * sizeof(struct CtlEntry));
|
||||
gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlCtlHeader, size);
|
||||
alSeqFileNew(gAlCtlHeader, data);
|
||||
|
||||
@@ -764,12 +755,12 @@ void audio_init() {
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlTbl, 0x10);
|
||||
size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
|
||||
size = ALIGN16(size);
|
||||
gAlTbl = soundAlloc(&gSoundPool, size);
|
||||
gAlTbl = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate((uintptr_t) gSoundDataRaw, gAlTbl, size);
|
||||
alSeqFileNew(gAlTbl, gSoundDataRaw);
|
||||
|
||||
// Load bank sets for each sequence (assets/bank_sets.s)
|
||||
gAlBankSets = soundAlloc(&gSoundPool, 0x100);
|
||||
gAlBankSets = soundAlloc(&gAudioInitPool, 0x100);
|
||||
audio_dma_copy_immediate((uintptr_t) gBankSetsData, gAlBankSets, 0x100);
|
||||
|
||||
func_8031D4B8();
|
||||
|
||||
@@ -38,7 +38,7 @@ extern u8 *gAlBankSets;
|
||||
|
||||
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg);
|
||||
void decrease_sample_dma_ttls(void);
|
||||
void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3);
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3);
|
||||
void func_8031758C(s32 arg0);
|
||||
void func_8031784C(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums);
|
||||
void preload_sequence(u32 seqId, u8 preloadMask);
|
||||
|
||||
@@ -10,37 +10,37 @@
|
||||
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
struct Struct803161E0 {
|
||||
struct PoolSplit {
|
||||
u32 wantSeq;
|
||||
u32 wantBank;
|
||||
u32 wantUnused;
|
||||
u32 wantCustom;
|
||||
}; // size = 0x10
|
||||
|
||||
struct U32Pair {
|
||||
struct PoolSplit2 {
|
||||
u32 wantPersistent;
|
||||
u32 wantTemporary;
|
||||
}; // size = 0x8
|
||||
|
||||
s16 D_802212A0;
|
||||
s8 D_802212A2;
|
||||
u8 D_802212A3;
|
||||
s16 gVolume;
|
||||
s8 gReverbDownsampleRate;
|
||||
u8 sReverbDownsampleRateLog; // never read
|
||||
|
||||
struct SoundAllocPool D_802212A8;
|
||||
struct SoundAllocPool gSoundPool;
|
||||
struct SoundAllocPool D_802212C8;
|
||||
struct SoundAllocPool gAudioSessionPool;
|
||||
struct SoundAllocPool gAudioInitPool;
|
||||
struct SoundAllocPool gNotesAndBuffersPool;
|
||||
u8 sAudioMemoryPad[0x20]; // probably two unused pools
|
||||
struct SoundAllocPool D_802212F8;
|
||||
struct SoundAllocPool D_80221308;
|
||||
struct SoundAllocPool D_80221318;
|
||||
struct SoundAllocPool gSeqAndBankPool;
|
||||
struct SoundAllocPool gPersistentCommonPool;
|
||||
struct SoundAllocPool gTemporaryCommonPool;
|
||||
struct SoundMultiPool gSeqLoadedPool;
|
||||
struct SoundMultiPool gBankLoadedPool;
|
||||
struct SoundMultiPool gUnusedLoadedPool;
|
||||
|
||||
struct Struct803161E0 D_80221898;
|
||||
struct U32Pair D_802218A8;
|
||||
struct Struct803161E0 D_802218B0;
|
||||
struct Struct803161E0 D_802218C0;
|
||||
struct PoolSplit sSessionPoolSplit;
|
||||
struct PoolSplit2 sSeqAndBankPoolSplit;
|
||||
struct PoolSplit sPersistentCommonPoolSplit;
|
||||
struct PoolSplit sTemporaryCommonPoolSplit;
|
||||
|
||||
u8 gBankLoadStatus[0x40];
|
||||
u8 gSeqLoadStatus[0x100];
|
||||
@@ -108,19 +108,19 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
||||
return start;
|
||||
}
|
||||
|
||||
void func_80316094(struct SoundAllocPool *pool, void *arg1, u32 arg2) {
|
||||
pool->cur = pool->start = (u8 *) (((uintptr_t) arg1 + 0xf) & -0x10);
|
||||
pool->size = arg2;
|
||||
void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size) {
|
||||
pool->cur = pool->start = (u8 *) (((uintptr_t) memAddr + 0xf) & -0x10);
|
||||
pool->size = size;
|
||||
pool->unused = 0;
|
||||
}
|
||||
|
||||
void func_803160B4(struct PersistentPool *persistent) {
|
||||
void persistent_pool_clear(struct PersistentPool *persistent) {
|
||||
persistent->pool.unused = 0;
|
||||
persistent->pool.cur = persistent->pool.start;
|
||||
persistent->numEntries = 0;
|
||||
}
|
||||
|
||||
void func_803160C8(struct TemporaryPool *temporary) {
|
||||
void temporary_pool_clear(struct TemporaryPool *temporary) {
|
||||
temporary->pool.unused = 0;
|
||||
temporary->pool.cur = temporary->pool.start;
|
||||
temporary->nextSide = 0;
|
||||
@@ -135,43 +135,43 @@ void unused_803160F8(struct SoundAllocPool *pool) {
|
||||
pool->cur = pool->start;
|
||||
}
|
||||
|
||||
void func_80316108(s32 arg0) {
|
||||
func_80316094(&gSoundPool, gAudioHeap, arg0);
|
||||
func_80316094(&D_802212A8, gAudioHeap + arg0, gAudioHeapSize - arg0);
|
||||
void sound_init_main_pools(s32 sizeForAudioInitPool) {
|
||||
sound_alloc_pool_init(&gAudioInitPool, gAudioHeap, sizeForAudioInitPool);
|
||||
sound_alloc_pool_init(&gAudioSessionPool, gAudioHeap + sizeForAudioInitPool, gAudioHeapSize - sizeForAudioInitPool);
|
||||
}
|
||||
|
||||
void func_80316164(struct Struct803161E0 *a) {
|
||||
D_802212A8.cur = D_802212A8.start;
|
||||
func_80316094(&D_802212C8, soundAlloc(&D_802212A8, a->wantSeq), a->wantSeq);
|
||||
func_80316094(&D_802212F8, soundAlloc(&D_802212A8, a->wantCustom), a->wantCustom);
|
||||
void session_pools_init(struct PoolSplit *a) {
|
||||
gAudioSessionPool.cur = gAudioSessionPool.start;
|
||||
sound_alloc_pool_init(&gNotesAndBuffersPool, soundAlloc(&gAudioSessionPool, a->wantSeq), a->wantSeq);
|
||||
sound_alloc_pool_init(&gSeqAndBankPool, soundAlloc(&gAudioSessionPool, a->wantCustom), a->wantCustom);
|
||||
}
|
||||
|
||||
void func_803161E0(struct U32Pair *a) {
|
||||
D_802212F8.cur = D_802212F8.start;
|
||||
func_80316094(&D_80221308, soundAlloc(&D_802212F8, a->wantPersistent), a->wantPersistent);
|
||||
func_80316094(&D_80221318, soundAlloc(&D_802212F8, a->wantTemporary), a->wantTemporary);
|
||||
void seq_and_bank_pool_init(struct PoolSplit2 *a) {
|
||||
gSeqAndBankPool.cur = gSeqAndBankPool.start;
|
||||
sound_alloc_pool_init(&gPersistentCommonPool, soundAlloc(&gSeqAndBankPool, a->wantPersistent), a->wantPersistent);
|
||||
sound_alloc_pool_init(&gTemporaryCommonPool, soundAlloc(&gSeqAndBankPool, a->wantTemporary), a->wantTemporary);
|
||||
}
|
||||
|
||||
void func_8031625C(struct Struct803161E0 *a) {
|
||||
D_80221308.cur = D_80221308.start;
|
||||
func_80316094(&gSeqLoadedPool.persistent.pool, soundAlloc(&D_80221308, a->wantSeq), a->wantSeq);
|
||||
func_80316094(&gBankLoadedPool.persistent.pool, soundAlloc(&D_80221308, a->wantBank), a->wantBank);
|
||||
func_80316094(&gUnusedLoadedPool.persistent.pool, soundAlloc(&D_80221308, a->wantUnused),
|
||||
void persistent_pools_init(struct PoolSplit *a) {
|
||||
gPersistentCommonPool.cur = gPersistentCommonPool.start;
|
||||
sound_alloc_pool_init(&gSeqLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantSeq), a->wantSeq);
|
||||
sound_alloc_pool_init(&gBankLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantBank), a->wantBank);
|
||||
sound_alloc_pool_init(&gUnusedLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantUnused),
|
||||
a->wantUnused);
|
||||
func_803160B4(&gSeqLoadedPool.persistent);
|
||||
func_803160B4(&gBankLoadedPool.persistent);
|
||||
func_803160B4(&gUnusedLoadedPool.persistent);
|
||||
persistent_pool_clear(&gSeqLoadedPool.persistent);
|
||||
persistent_pool_clear(&gBankLoadedPool.persistent);
|
||||
persistent_pool_clear(&gUnusedLoadedPool.persistent);
|
||||
}
|
||||
|
||||
void func_80316318(struct Struct803161E0 *a) {
|
||||
D_80221318.cur = D_80221318.start;
|
||||
func_80316094(&gSeqLoadedPool.temporary.pool, soundAlloc(&D_80221318, a->wantSeq), a->wantSeq);
|
||||
func_80316094(&gBankLoadedPool.temporary.pool, soundAlloc(&D_80221318, a->wantBank), a->wantBank);
|
||||
func_80316094(&gUnusedLoadedPool.temporary.pool, soundAlloc(&D_80221318, a->wantUnused),
|
||||
void temporary_pools_init(struct PoolSplit *a) {
|
||||
gTemporaryCommonPool.cur = gTemporaryCommonPool.start;
|
||||
sound_alloc_pool_init(&gSeqLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantSeq), a->wantSeq);
|
||||
sound_alloc_pool_init(&gBankLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantBank), a->wantBank);
|
||||
sound_alloc_pool_init(&gUnusedLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantUnused),
|
||||
a->wantUnused);
|
||||
func_803160C8(&gSeqLoadedPool.temporary);
|
||||
func_803160C8(&gBankLoadedPool.temporary);
|
||||
func_803160C8(&gUnusedLoadedPool.temporary);
|
||||
temporary_pool_clear(&gSeqLoadedPool.temporary);
|
||||
temporary_pool_clear(&gBankLoadedPool.temporary);
|
||||
temporary_pool_clear(&gUnusedLoadedPool.temporary);
|
||||
}
|
||||
|
||||
static void unused_803163D4() {
|
||||
@@ -366,8 +366,8 @@ void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_803168CC(void) {
|
||||
D_802211B0.unk4 -= D_802211B0.unk4 / 4;
|
||||
void decrease_reverb_gain(void) {
|
||||
gSynthesisReverb.reverbGain -= gSynthesisReverb.reverbGain / 4;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,10 +381,10 @@ void wait_for_audio_frames(s32 frames) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_80316928(struct Struct80332190 *arg0) {
|
||||
void audio_reset_session(struct AudioSessionSettings *preset) {
|
||||
s8 updatesPerFrame;
|
||||
s16 *mem;
|
||||
s32 sp2C;
|
||||
s32 reverbWindowSize;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 k;
|
||||
@@ -396,7 +396,7 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
s32 remainingDmas;
|
||||
|
||||
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
|
||||
func_803168CC();
|
||||
decrease_reverb_gain();
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
if (gNotes[i].enabled && gNotes[i].adsr.state != ADSR_STATE_DISABLED) {
|
||||
gNotes[i].adsr.fadeOutVel = 0x8000 / gAudioUpdatesPerFrame;
|
||||
@@ -425,7 +425,7 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
func_803168CC();
|
||||
decrease_reverb_gain();
|
||||
wait_for_audio_frames(3);
|
||||
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
||||
wait_for_audio_frames(3);
|
||||
@@ -447,34 +447,34 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
}
|
||||
|
||||
gSampleDmaNumListItems = 0;
|
||||
sp2C = arg0->unk6;
|
||||
gAiFrequency = osAiSetFrequency(arg0->frequency);
|
||||
gMaxSimultaneousNotes = arg0->maxSimultaneousNotes;
|
||||
reverbWindowSize = preset->reverbWindowSize;
|
||||
gAiFrequency = osAiSetFrequency(preset->frequency);
|
||||
gMaxSimultaneousNotes = preset->maxSimultaneousNotes;
|
||||
D_80226D74 = ALIGN16(gAiFrequency / 60);
|
||||
D_802212A2 = arg0->unk5;
|
||||
gReverbDownsampleRate = preset->reverbDownsampleRate;
|
||||
|
||||
switch (D_802212A2) {
|
||||
switch (gReverbDownsampleRate) {
|
||||
case 1:
|
||||
D_802212A3 = 0;
|
||||
sReverbDownsampleRateLog = 0;
|
||||
break;
|
||||
case 2:
|
||||
D_802212A3 = 1;
|
||||
sReverbDownsampleRateLog = 1;
|
||||
break;
|
||||
case 4:
|
||||
D_802212A3 = 2;
|
||||
sReverbDownsampleRateLog = 2;
|
||||
break;
|
||||
case 8:
|
||||
D_802212A3 = 3;
|
||||
sReverbDownsampleRateLog = 3;
|
||||
break;
|
||||
case 16:
|
||||
D_802212A3 = 4;
|
||||
sReverbDownsampleRateLog = 4;
|
||||
break;
|
||||
default:
|
||||
D_802212A3 = 0;
|
||||
sReverbDownsampleRateLog = 0;
|
||||
}
|
||||
|
||||
D_802212A2 = arg0->unk5;
|
||||
D_802212A0 = arg0->volume;
|
||||
gReverbDownsampleRate = preset->reverbDownsampleRate;
|
||||
gVolume = preset->volume;
|
||||
gMinAiBufferLength = D_80226D74 - 0x10;
|
||||
updatesPerFrame = D_80226D74 / 160 + 1;
|
||||
gAudioUpdatesPerFrame = D_80226D74 / 160 + 1;
|
||||
@@ -489,60 +489,60 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
#endif
|
||||
|
||||
D_80226D6C = gMaxSimultaneousNotes * 20 * updatesPerFrame + 320;
|
||||
persistentMem = arg0->persistentBankMem + arg0->persistentSeqMem;
|
||||
temporaryMem = arg0->temporaryBankMem + arg0->temporarySeqMem;
|
||||
persistentMem = DOUBLE_SIZE_ON_64_BIT(preset->persistentBankMem + preset->persistentSeqMem);
|
||||
temporaryMem = DOUBLE_SIZE_ON_64_BIT(preset->temporaryBankMem + preset->temporarySeqMem);
|
||||
totalMem = persistentMem + temporaryMem;
|
||||
wantMisc = D_802212A8.size - totalMem - 0x100;
|
||||
D_80221898.wantSeq = wantMisc;
|
||||
D_80221898.wantCustom = totalMem;
|
||||
func_80316164(&D_80221898);
|
||||
D_802218A8.wantPersistent = persistentMem;
|
||||
D_802218A8.wantTemporary = temporaryMem;
|
||||
func_803161E0(&D_802218A8);
|
||||
D_802218B0.wantSeq = arg0->persistentSeqMem;
|
||||
D_802218B0.wantBank = arg0->persistentBankMem;
|
||||
D_802218B0.wantUnused = 0;
|
||||
func_8031625C(&D_802218B0);
|
||||
D_802218C0.wantSeq = arg0->temporarySeqMem;
|
||||
D_802218C0.wantBank = arg0->temporaryBankMem;
|
||||
D_802218C0.wantUnused = 0;
|
||||
func_80316318(&D_802218C0);
|
||||
wantMisc = gAudioSessionPool.size - totalMem - 0x100;
|
||||
sSessionPoolSplit.wantSeq = wantMisc;
|
||||
sSessionPoolSplit.wantCustom = totalMem;
|
||||
session_pools_init(&sSessionPoolSplit);
|
||||
sSeqAndBankPoolSplit.wantPersistent = persistentMem;
|
||||
sSeqAndBankPoolSplit.wantTemporary = temporaryMem;
|
||||
seq_and_bank_pool_init(&sSeqAndBankPoolSplit);
|
||||
sPersistentCommonPoolSplit.wantSeq = DOUBLE_SIZE_ON_64_BIT(preset->persistentSeqMem);
|
||||
sPersistentCommonPoolSplit.wantBank = DOUBLE_SIZE_ON_64_BIT(preset->persistentBankMem);
|
||||
sPersistentCommonPoolSplit.wantUnused = 0;
|
||||
persistent_pools_init(&sPersistentCommonPoolSplit);
|
||||
sTemporaryCommonPoolSplit.wantSeq = DOUBLE_SIZE_ON_64_BIT(preset->temporarySeqMem);
|
||||
sTemporaryCommonPoolSplit.wantBank = DOUBLE_SIZE_ON_64_BIT(preset->temporaryBankMem);
|
||||
sTemporaryCommonPoolSplit.wantUnused = 0;
|
||||
temporary_pools_init(&sTemporaryCommonPoolSplit);
|
||||
reset_bank_and_seq_load_status();
|
||||
|
||||
for (j = 0; j < 2; j++) {
|
||||
gAudioCmdBuffers[j] = soundAlloc(&D_802212C8, D_80226D6C * 8);
|
||||
gAudioCmdBuffers[j] = soundAlloc(&gNotesAndBuffersPool, D_80226D6C * 8);
|
||||
}
|
||||
|
||||
gNotes = soundAlloc(&D_802212C8, gMaxSimultaneousNotes * sizeof(struct Note));
|
||||
gNotes = soundAlloc(&gNotesAndBuffersPool, gMaxSimultaneousNotes * sizeof(struct Note));
|
||||
note_init_all();
|
||||
init_note_free_list();
|
||||
|
||||
if (sp2C == 0) {
|
||||
D_802211B0.unk1 = 0;
|
||||
if (reverbWindowSize == 0) {
|
||||
gSynthesisReverb.useReverb = 0;
|
||||
} else {
|
||||
D_802211B0.unk1 = 8;
|
||||
D_802211B0.unk14.unk00 = soundAlloc(&D_802212C8, sp2C * 2);
|
||||
D_802211B0.unk14.unk04 = soundAlloc(&D_802212C8, sp2C * 2);
|
||||
D_802211B0.unk8 = 0;
|
||||
D_802211B0.unkC = 0;
|
||||
D_802211B0.unk3 = 0;
|
||||
D_802211B0.unk10 = sp2C;
|
||||
D_802211B0.unk4 = arg0->unk8;
|
||||
D_802211B0.unk2 = 2;
|
||||
if (D_802212A2 != 1) {
|
||||
D_802211B0.unk0 = 1;
|
||||
D_802211B0.unk6 = 0x8000 / D_802212A2;
|
||||
D_802211B0.unk1C = soundAlloc(&D_802212C8, 32);
|
||||
D_802211B0.unk20 = soundAlloc(&D_802212C8, 32);
|
||||
D_802211B0.unk24 = soundAlloc(&D_802212C8, 32);
|
||||
D_802211B0.unk28 = soundAlloc(&D_802212C8, 32);
|
||||
gSynthesisReverb.useReverb = 8;
|
||||
gSynthesisReverb.ringBuffer.left = soundAlloc(&gNotesAndBuffersPool, reverbWindowSize * 2);
|
||||
gSynthesisReverb.ringBuffer.right = soundAlloc(&gNotesAndBuffersPool, reverbWindowSize * 2);
|
||||
gSynthesisReverb.nextRingBufferPos = 0;
|
||||
gSynthesisReverb.unkC = 0;
|
||||
gSynthesisReverb.curFrame = 0;
|
||||
gSynthesisReverb.bufSizePerChannel = reverbWindowSize;
|
||||
gSynthesisReverb.reverbGain = preset->reverbGain;
|
||||
gSynthesisReverb.framesLeftToIgnore = 2;
|
||||
if (gReverbDownsampleRate != 1) {
|
||||
gSynthesisReverb.resampleFlags = A_INIT;
|
||||
gSynthesisReverb.resampleRate = 0x8000 / gReverbDownsampleRate;
|
||||
gSynthesisReverb.resampleStateLeft = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
gSynthesisReverb.resampleStateRight = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
gSynthesisReverb.unk24 = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
gSynthesisReverb.unk28 = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
for (i = 0; i < gAudioUpdatesPerFrame; i++) {
|
||||
mem = soundAlloc(&D_802212C8, 0x280);
|
||||
D_802211B0.unk2C[0][i].unk4 = mem;
|
||||
D_802211B0.unk2C[0][i].unk8 = mem + 0xA0;
|
||||
mem = soundAlloc(&D_802212C8, 0x280);
|
||||
D_802211B0.unk2C[1][i].unk4 = mem;
|
||||
D_802211B0.unk2C[1][i].unk8 = mem + 0xA0;
|
||||
mem = soundAlloc(&gNotesAndBuffersPool, 0x280);
|
||||
gSynthesisReverb.items[0][i].toDownsampleLeft = mem;
|
||||
gSynthesisReverb.items[0][i].toDownsampleRight = mem + 0xA0;
|
||||
mem = soundAlloc(&gNotesAndBuffersPool, 0x280);
|
||||
gSynthesisReverb.items[1][i].toDownsampleLeft = mem;
|
||||
gSynthesisReverb.items[1][i].toDownsampleRight = mem + 0xA0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,20 +47,20 @@ struct SoundMultiPool
|
||||
}; // size = 0x1D0
|
||||
|
||||
extern u8 gAudioHeap[];
|
||||
extern s16 D_802212A0;
|
||||
extern s8 D_802212A2;
|
||||
extern u8 D_802212A3;
|
||||
extern struct SoundAllocPool gSoundPool;
|
||||
extern struct SoundAllocPool D_802212C8;
|
||||
extern s16 gVolume;
|
||||
extern s8 gReverbDownsampleRate;
|
||||
extern u8 sReverbDownsampleRateLog;
|
||||
extern struct SoundAllocPool gAudioInitPool;
|
||||
extern struct SoundAllocPool gNotesAndBuffersPool;
|
||||
extern struct SoundMultiPool gSeqLoadedPool;
|
||||
extern struct SoundMultiPool gBankLoadedPool;
|
||||
extern u8 gBankLoadStatus[64];
|
||||
extern u8 gSeqLoadStatus[256];
|
||||
|
||||
void *soundAlloc(struct SoundAllocPool *pool, u32 size);
|
||||
void func_80316108(s32 arg0);
|
||||
void sound_init_main_pools(s32 sizeForAudioInitPool);
|
||||
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id);
|
||||
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 arg2);
|
||||
void func_80316928(struct Struct80332190 *arg0);
|
||||
void audio_reset_session(struct AudioSessionSettings *preset);
|
||||
|
||||
#endif /* _AUDIO_MEMORY_H */
|
||||
|
||||
@@ -53,8 +53,8 @@ void func_80318908(void) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
note = &gNotes[i];
|
||||
if (note->priority != NOTE_PRIORITY_DISABLED) {
|
||||
if (note->priority == NOTE_PRIORITY_STOPPING || note->unk0b10) {
|
||||
if (note->adsrVolScale == 0 || note->unk0b10) {
|
||||
if (note->priority == NOTE_PRIORITY_STOPPING || note->finished) {
|
||||
if (note->adsrVolScale == 0 || note->finished) {
|
||||
if (note->wantedParentLayer != NO_LAYER) {
|
||||
note_disable2(note);
|
||||
if (note->wantedParentLayer->seqChannel != NULL) {
|
||||
@@ -219,7 +219,7 @@ void func_80318F04(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
note->instOrWave = (u8) seqLayer->seqChannel->instOrWave;
|
||||
for (i = -1, pos = 0; pos < 0x40; pos += stepSize) {
|
||||
i++;
|
||||
note->unk34->samples[i] = gWaveSamples[seqLayer->seqChannel->instOrWave - 0x80][pos];
|
||||
note->synthesisBuffers->samples[i] = gWaveSamples[seqLayer->seqChannel->instOrWave - 0x80][pos];
|
||||
}
|
||||
|
||||
// Repeat sample
|
||||
@@ -227,25 +227,25 @@ void func_80318F04(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
lim = note->sampleCount;
|
||||
if (offset < 0 || offset > 0) {
|
||||
for (j = 0; j < lim; j++) {
|
||||
note->unk34->samples[offset + j] = note->unk34->samples[j];
|
||||
note->synthesisBuffers->samples[offset + j] = note->synthesisBuffers->samples[j];
|
||||
}
|
||||
} else {
|
||||
for (j = 0; j < lim; j++) {
|
||||
note->unk34->samples[offset + j] = note->unk34->samples[j];
|
||||
note->synthesisBuffers->samples[offset + j] = note->synthesisBuffers->samples[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
osWritebackDCache(note->unk34->samples, sizeof(note->unk34->samples));
|
||||
osWritebackDCache(note->synthesisBuffers->samples, sizeof(note->synthesisBuffers->samples));
|
||||
}
|
||||
|
||||
void func_80319164(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
s32 sampleCount = note->sampleCount;
|
||||
func_80318F04(note, seqLayer);
|
||||
if (sampleCount != 0) {
|
||||
note->unk14 *= note->sampleCount / sampleCount;
|
||||
note->samplePosInt *= note->sampleCount / sampleCount;
|
||||
} else {
|
||||
note->unk14 = 0;
|
||||
note->samplePosInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ void note_init_all(void) {
|
||||
note->wantedParentLayer = NO_LAYER;
|
||||
note->prevParentLayer = NO_LAYER;
|
||||
note->reverb = 0;
|
||||
note->usesStereo = FALSE;
|
||||
note->usesHeadsetPanEffects = FALSE;
|
||||
note->sampleCount = 0;
|
||||
note->instOrWave = 0;
|
||||
note->targetVolLeft = 0;
|
||||
@@ -605,6 +605,6 @@ void note_init_all(void) {
|
||||
note->vibratoState.active = FALSE;
|
||||
note->portamento.cur = 0.0f;
|
||||
note->portamento.speed = 0.0f;
|
||||
note->unk34 = soundAlloc(&D_802212C8, 0x190);
|
||||
note->synthesisBuffers = soundAlloc(&gNotesAndBuffersPool, sizeof(struct NoteSynthesisBuffers));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,41 +5,41 @@
|
||||
|
||||
#define MAX_UPDATES_PER_FRAME 4
|
||||
|
||||
struct struct_3920_sp1c
|
||||
struct ReverbRingBufferItem
|
||||
{
|
||||
s16 unk00;
|
||||
s16 numSamplesAfterDownsampling;
|
||||
s16 chunkLen; // never read
|
||||
s16 *unk4;
|
||||
s16 *unk8;
|
||||
s32 unkC;
|
||||
s16 unk10[2];
|
||||
s16 *toDownsampleLeft;
|
||||
s16 *toDownsampleRight; // data pointed to by left and right are adjacent in memory
|
||||
s32 startPos; // start pos in ring buffer
|
||||
s16 lengths[2]; // first length in ring buffer (max until end) and second length in ring buffer (from pos 0)
|
||||
}; // size = 0x14
|
||||
|
||||
struct Struct802211B0
|
||||
struct SynthesisReverb
|
||||
{
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
s32 unk8;
|
||||
s32 unkC;
|
||||
s32 unk10;
|
||||
u8 resampleFlags;
|
||||
u8 useReverb;
|
||||
u8 framesLeftToIgnore;
|
||||
u8 curFrame;
|
||||
u16 reverbGain;
|
||||
u16 resampleRate;
|
||||
s32 nextRingBufferPos;
|
||||
s32 unkC; // never read
|
||||
s32 bufSizePerChannel;
|
||||
struct
|
||||
{
|
||||
s16 *unk00;
|
||||
s16 *unk04;
|
||||
} unk14;
|
||||
void *unk1C;
|
||||
void *unk20;
|
||||
void *unk24; // never read
|
||||
void *unk28;
|
||||
struct struct_3920_sp1c unk2C[2][MAX_UPDATES_PER_FRAME];
|
||||
s16 *left;
|
||||
s16 *right;
|
||||
} ringBuffer;
|
||||
s16 *resampleStateLeft;
|
||||
s16 *resampleStateRight;
|
||||
s16 *unk24; // never read
|
||||
s16 *unk28; // never read
|
||||
struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
|
||||
}; // 0xCC <= size <= 0x100
|
||||
extern struct Struct802211B0 D_802211B0;
|
||||
extern struct SynthesisReverb gSynthesisReverb;
|
||||
|
||||
u64 *func_80313CD4(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen);
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen);
|
||||
void note_init_volume(struct Note *note);
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb);
|
||||
void note_set_frequency(struct Note *note, f32 frequency);
|
||||
|
||||
@@ -2,35 +2,35 @@
|
||||
|
||||
#include "buffers.h"
|
||||
|
||||
u8 gDecompressionHeap[0xD000];
|
||||
ALIGNED8 u8 gDecompressionHeap[0xD000];
|
||||
|
||||
u8 gAudioHeap[0x31200];
|
||||
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200)];
|
||||
|
||||
// Yield buffer for audio, 0x400 bytes. Stubbed out post-JP since the audio
|
||||
// task never yields.
|
||||
#ifdef VERSION_JP
|
||||
u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
|
||||
ALIGNED8 u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
|
||||
#endif
|
||||
|
||||
// Probably Thread 2 stack space. Unreferenced, and stubbed out with f3dex to
|
||||
// avoid an overflowing .buffers segment.
|
||||
#ifndef F3DEX_GBI_SHARED
|
||||
u8 gUnusedThread2Stack[0x1400];
|
||||
ALIGNED8 u8 gUnusedThread2Stack[0x1400];
|
||||
#endif
|
||||
|
||||
u8 gIdleThreadStack[0x800];
|
||||
u8 gThread3Stack[0x2000];
|
||||
u8 gThread4Stack[0x2000];
|
||||
u8 gThread5Stack[0x2000];
|
||||
ALIGNED8 u8 gIdleThreadStack[0x800];
|
||||
ALIGNED8 u8 gThread3Stack[0x2000];
|
||||
ALIGNED8 u8 gThread4Stack[0x2000];
|
||||
ALIGNED8 u8 gThread5Stack[0x2000];
|
||||
|
||||
// 0xc00 bytes for f3dex, 0x900 otherwise
|
||||
u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
ALIGNED8 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
|
||||
// 0x200 bytes
|
||||
struct SaveBuffer gSaveBuffer;
|
||||
ALIGNED8 struct SaveBuffer gSaveBuffer;
|
||||
|
||||
// 0x400 bytes
|
||||
u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
|
||||
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
|
||||
|
||||
// 0x190a0 bytes
|
||||
struct GfxPool gGfxPools[2];
|
||||
|
||||
12
src/buffers/framebuffers.c
Normal file
12
src/buffers/framebuffers.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "sm64.h"
|
||||
|
||||
// 0x70800 bytes
|
||||
#if BUGFIXES_CRITICAL
|
||||
u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#else
|
||||
u16 gFrameBuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFrameBuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFrameBuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
18
src/buffers/framebuffers.h
Normal file
18
src/buffers/framebuffers.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef FRAMEBUFFERS_H
|
||||
#define FRAMEBUFFERS_H
|
||||
|
||||
// level_script.c assumes that the frame buffers are adjacent, while game.c's
|
||||
// -g codegen implies that they are separate variables. This is impossible to
|
||||
// reconcile without undefined behavior. Avoid that on non-IDO.
|
||||
#if BUGFIXES_CRITICAL
|
||||
extern u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#define gFrameBuffer0 gFrameBuffers[0]
|
||||
#define gFrameBuffer1 gFrameBuffers[1]
|
||||
#define gFrameBuffer2 gFrameBuffers[2]
|
||||
#else
|
||||
extern u16 gFrameBuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFrameBuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFrameBuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
5
src/buffers/gfx_output_buffer.c
Normal file
5
src/buffers/gfx_output_buffer.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
// 0x1f000 bytes, aligned to a 0x1000-byte boundary through sm64.ld. (This results
|
||||
// in a bunch of unused space: ~0x100 in JP, ~0x300 in US.)
|
||||
u64 gGfxSPTaskOutputBuffer[0x3e00];
|
||||
6
src/buffers/gfx_output_buffer.h
Normal file
6
src/buffers/gfx_output_buffer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef GFX_OUTPUT_BUFFER_H
|
||||
#define GFX_OUTPUT_BUFFER_H
|
||||
|
||||
extern u64 gGfxSPTaskOutputBuffer[0x3e00];
|
||||
|
||||
#endif
|
||||
@@ -118,9 +118,9 @@ static s32 beh_cmd_graph_node(void) {
|
||||
|
||||
static s32 beh_cmd_obj_load_chill(void) {
|
||||
u32 model = (u32) gBehCommand[1];
|
||||
void *arg1 = (void *) gBehCommand[2];
|
||||
const BehaviorScript *behavior = (const BehaviorScript *) gBehCommand[2];
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, arg1);
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(object, gCurrentObject);
|
||||
|
||||
@@ -130,9 +130,9 @@ static s32 beh_cmd_obj_load_chill(void) {
|
||||
|
||||
static s32 beh_cmd_obj_spawn(void) {
|
||||
u32 model = (u32) gBehCommand[1];
|
||||
void *arg1 = (void *) gBehCommand[2];
|
||||
const BehaviorScript *behavior = (const BehaviorScript *) gBehCommand[2];
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, arg1);
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(object, gCurrentObject);
|
||||
|
||||
@@ -145,9 +145,9 @@ static s32 beh_cmd_obj_spawn(void) {
|
||||
static s32 beh_cmd_obj_load_chill_param(void) {
|
||||
u32 behParam = (s16)(gBehCommand[0] & 0xFFFF);
|
||||
u32 model = (u32) gBehCommand[1];
|
||||
void *arg2 = (void *) gBehCommand[2];
|
||||
const BehaviorScript *behavior = (const BehaviorScript *) gBehCommand[2];
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, arg2);
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(object, gCurrentObject);
|
||||
|
||||
@@ -172,18 +172,18 @@ static s32 beh_cmd_break2(void) {
|
||||
}
|
||||
|
||||
static s32 beh_cmd_call(void) {
|
||||
uintptr_t *jumpAddress;
|
||||
const BehaviorScript *jumpAddress;
|
||||
|
||||
gBehCommand++;
|
||||
cur_object_stack_push((uintptr_t)(gBehCommand + 1));
|
||||
jumpAddress = segmented_to_virtual((void *) gBehCommand[0]);
|
||||
jumpAddress = segmented_to_virtual((const BehaviorScript *) gBehCommand[0]);
|
||||
gBehCommand = jumpAddress;
|
||||
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
static s32 beh_cmd_return(void) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ static s32 beh_cmd_delay_var(void) {
|
||||
|
||||
static s32 beh_cmd_goto(void) {
|
||||
gBehCommand++;
|
||||
gBehCommand = segmented_to_virtual((void *) gBehCommand[0]);
|
||||
gBehCommand = segmented_to_virtual((const BehaviorScript *) gBehCommand[0]);
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ static s32 beh_cmd_end_repeat(void) {
|
||||
|
||||
count--;
|
||||
if (count != 0) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
cur_object_stack_push((uintptr_t) gBehCommand);
|
||||
cur_object_stack_push(count);
|
||||
} else {
|
||||
@@ -264,7 +264,7 @@ static s32 beh_cmd_end_repeat_nobreak(void) {
|
||||
|
||||
count--;
|
||||
if (count != 0) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
cur_object_stack_push((uintptr_t) gBehCommand);
|
||||
cur_object_stack_push(count);
|
||||
} else {
|
||||
@@ -283,7 +283,7 @@ static s32 beh_cmd_begin_loop(void) {
|
||||
}
|
||||
|
||||
static s32 beh_cmd_end_loop(void) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
cur_object_stack_push((uintptr_t) gBehCommand);
|
||||
|
||||
return BEH_BREAK;
|
||||
@@ -432,10 +432,10 @@ static s32 beh_cmd_obj_bit_clear_int(void) {
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
static s32 beh_cmd_obj_set_int32(void) {
|
||||
static s32 beh_cmd_obj_set_anims(void) {
|
||||
u8 objectOffset = (u8)((gBehCommand[0] >> 16) & 0xFF);
|
||||
|
||||
cur_object_set_int(objectOffset, gBehCommand[1]);
|
||||
cur_object_set_vptr(objectOffset, gBehCommand[1]);
|
||||
|
||||
gBehCommand += 2;
|
||||
return BEH_CONTINUE;
|
||||
@@ -722,7 +722,7 @@ static BehCommandProc BehaviorJumpTable[] = {
|
||||
Behavior24,
|
||||
beh_cmd_delay_var,
|
||||
Behavior26,
|
||||
beh_cmd_obj_set_int32,
|
||||
beh_cmd_obj_set_anims,
|
||||
beh_cmd_obj_animate,
|
||||
beh_cmd_obj_load_chill_param,
|
||||
beh_cmd_collision_data,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define cur_object_set_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) = (s32)(value)
|
||||
#define cur_object_or_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) |= (s32)(value)
|
||||
#define cur_object_and_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
#define cur_object_set_vptr(offset, value) gCurrentObject->OBJECT_FIELD_VPTR(offset) = (void *)(value)
|
||||
|
||||
#define object_and_int(object, offset, value) object->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ u32 unused_8038B894[3] = { 0 };
|
||||
cmd+0x04: void *branchTarget
|
||||
*/
|
||||
void geo_layout_cmd_branch_and_link(void) {
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + 4 + sizeof(void *));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (gCurGraphNodeIndex << 16) + gGeoLayoutReturnIndex;
|
||||
gGeoLayoutReturnIndex = gGeoLayoutStackIndex;
|
||||
gGeoLayoutCommand = segmented_to_virtual(cur_geo_cmd_ptr(0x04));
|
||||
@@ -127,7 +127,7 @@ void geo_layout_cmd_end(void) {
|
||||
*/
|
||||
void geo_layout_cmd_branch(void) {
|
||||
if (cur_geo_cmd_u8(0x01) == 1) {
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + 4 + sizeof(void *));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
}
|
||||
|
||||
gGeoLayoutCommand = segmented_to_virtual(cur_geo_cmd_ptr(0x04));
|
||||
@@ -142,13 +142,13 @@ void geo_layout_cmd_return(void) {
|
||||
void geo_layout_cmd_open_node(void) {
|
||||
gCurGraphNodeList[gCurGraphNodeIndex + 1] = gCurGraphNodeList[gCurGraphNodeIndex];
|
||||
gCurGraphNodeIndex++;
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x05: Close node
|
||||
void geo_layout_cmd_close_node(void) {
|
||||
gCurGraphNodeIndex--;
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -164,7 +164,7 @@ void geo_layout_cmd_assign_as_view(void) {
|
||||
gGeoViews[index] = gCurGraphNodeList[gCurGraphNodeIndex];
|
||||
}
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -188,7 +188,7 @@ void geo_layout_cmd_update_node_flags(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -227,7 +227,7 @@ void geo_layout_cmd_node_root(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x0C;
|
||||
gGeoLayoutCommand += 0x0C << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -242,7 +242,7 @@ void geo_layout_cmd_node_ortho_projection(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -263,14 +263,14 @@ void geo_layout_cmd_node_perspective(void) {
|
||||
if (cur_geo_cmd_u8(0x01) != 0) {
|
||||
// optional asm function
|
||||
frustumFunc = (GraphNodeFunc) cur_geo_cmd_ptr(0x08);
|
||||
gGeoLayoutCommand += sizeof(void *);
|
||||
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32) fov, near, far, frustumFunc, 0);
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -284,12 +284,12 @@ void geo_layout_cmd_node_start(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x1F: No operation
|
||||
void geo_layout_cmd_nop3(void) {
|
||||
gGeoLayoutCommand += 0x10;
|
||||
gGeoLayoutCommand += 0x10 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -303,7 +303,7 @@ void geo_layout_cmd_node_master_list(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -321,7 +321,7 @@ void geo_layout_cmd_node_level_of_detail(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -344,7 +344,7 @@ void geo_layout_cmd_node_switch_case(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -374,7 +374,7 @@ void geo_layout_cmd_node_camera(void) {
|
||||
|
||||
gGeoViews[0] = &graphNode->fnNode.node;
|
||||
|
||||
gGeoLayoutCommand += 0x10 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x14 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -438,14 +438,14 @@ void geo_layout_cmd_node_translation_rotation(void) {
|
||||
case 3:
|
||||
vec3s_copy(translation, gVec3sZero);
|
||||
vec3s_set(rotation, 0, (cmdPos[1] << 15) / 180, 0);
|
||||
cmdPos += 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_translation_rotation(gGraphNodePool, NULL, drawingLayer, displayList,
|
||||
@@ -480,7 +480,7 @@ void geo_layout_cmd_node_translation(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode =
|
||||
@@ -516,7 +516,7 @@ void geo_layout_cmd_node_rotation(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_rotation(gGraphNodePool, NULL, drawingLayer, displayList, sp2c);
|
||||
@@ -545,19 +545,19 @@ void geo_layout_cmd_node_scale(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = cur_geo_cmd_ptr(0x08);
|
||||
drawingLayer = params & 0x0F;
|
||||
gGeoLayoutCommand += sizeof(void *);
|
||||
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_scale(gGraphNodePool, NULL, drawingLayer, displayList, scale);
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x1E: No operation
|
||||
void geo_layout_cmd_nop2(void) {
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -582,7 +582,7 @@ void geo_layout_cmd_node_animated_part(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x0C << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -608,7 +608,7 @@ void geo_layout_cmd_node_billboard(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_billboard(gGraphNodePool, NULL, drawingLayer, displayList, translation);
|
||||
@@ -632,7 +632,7 @@ void geo_layout_cmd_node_display_list(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -651,7 +651,7 @@ void geo_layout_cmd_node_shadow(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x17: Create scene graph node that manages the group of all object nodes
|
||||
@@ -662,7 +662,7 @@ void geo_layout_cmd_node_object_parent(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -679,7 +679,7 @@ void geo_layout_cmd_node_generated(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -698,12 +698,12 @@ void geo_layout_cmd_node_background(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x1A: No operation
|
||||
void geo_layout_cmd_nop(void) {
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -730,7 +730,7 @@ void geo_layout_cmd_copy_view(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -752,7 +752,7 @@ void geo_layout_cmd_node_held_obj(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x08 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x0C << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -764,7 +764,7 @@ void geo_layout_cmd_node_culling_radius(void) {
|
||||
struct GraphNodeCullingRadius *graphNode;
|
||||
graphNode = init_graph_node_culling_radius(gGraphNodePool, NULL, cur_geo_cmd_s16(0x02));
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
|
||||
|
||||
@@ -7,20 +7,23 @@
|
||||
#define GEO_CMD_FLAGS_SET 1
|
||||
#define GEO_CMD_FLAGS_CLEAR 2
|
||||
|
||||
#define CMD_SIZE_SHIFT (sizeof(void *) >> 3)
|
||||
#define CMD_PROCESS_OFFSET(offset) ((offset & 3) | ((offset & ~3) << CMD_SIZE_SHIFT))
|
||||
|
||||
#define cur_geo_cmd_u8(offset) \
|
||||
(gGeoLayoutCommand[offset])
|
||||
(gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_s16(offset) \
|
||||
(*(s16 *) &gGeoLayoutCommand[offset])
|
||||
(*(s16 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_s32(offset) \
|
||||
(*(s32 *) &gGeoLayoutCommand[offset])
|
||||
(*(s32 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_u32(offset) \
|
||||
(*(u32 *) &gGeoLayoutCommand[offset])
|
||||
(*(u32 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_ptr(offset) \
|
||||
(*(void **) &gGeoLayoutCommand[offset])
|
||||
(*(void **) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
extern struct AllocOnlyPool *gGraphNodePool;
|
||||
extern struct GraphNode *gCurRootGraphNode;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user