mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-01-23 05:25:01 +03:00
Doing some more fixes
This commit is contained in:
parent
40ffb3d0b4
commit
4acc13fb36
@ -1139,9 +1139,9 @@ extern AudioCommonPoolSplit gPersistentCommonPoolSplit;
|
||||
// 0x4
|
||||
extern AudioCommonPoolSplit gTemporaryCommonPoolSplit;
|
||||
// 0x4
|
||||
extern u8 gSampleFontLoadStatus[64];
|
||||
extern u8 gFontLoadStatus[64];
|
||||
extern u8 gSeqLoadStatus[256];
|
||||
extern u8 gSampleFontLoadStatus[2048];
|
||||
extern u8 gFontLoadStatus[2048];
|
||||
extern u8 gSeqLoadStatus[2048];
|
||||
extern volatile u8 gAudioResetStep;
|
||||
extern u8 gAudioSpecId;
|
||||
extern s32 gResetFadeoutFramesLeft;
|
||||
|
@ -31,9 +31,9 @@ AudioCommonPoolSplit gPersistentCommonPoolSplit;
|
||||
// 0x4
|
||||
AudioCommonPoolSplit gTemporaryCommonPoolSplit;
|
||||
// 0x4
|
||||
u8 gSampleFontLoadStatus[64];
|
||||
u8 gFontLoadStatus[64];
|
||||
u8 gSeqLoadStatus[256];
|
||||
u8 gSampleFontLoadStatus[2048];
|
||||
u8 gFontLoadStatus[2048];
|
||||
u8 gSeqLoadStatus[2048];
|
||||
volatile u8 gAudioResetStep;
|
||||
u8 gAudioSpecId;
|
||||
s32 gResetFadeoutFramesLeft;
|
||||
|
@ -791,8 +791,8 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
||||
|
||||
void AudioLoad_ProcessLoads(s32 resetStatus) {
|
||||
AudioLoad_ProcessSlowLoads(resetStatus);
|
||||
AudioLoad_ProcessSamplePreloads(resetStatus);
|
||||
AudioLoad_ProcessAsyncLoads(resetStatus);
|
||||
// AudioLoad_ProcessSamplePreloads(resetStatus);
|
||||
// AudioLoad_ProcessAsyncLoads(resetStatus);
|
||||
}
|
||||
|
||||
static const char devstr27[] = "Clear Workarea %x -%x size %x \n";
|
||||
|
@ -690,7 +690,7 @@ Acmd* func_80009D78(Acmd* aList, s32 aiBufLen, s16 reverbIndex, s16 updateIndex)
|
||||
if (sp64->lengthB != 0) {
|
||||
aList = func_800098DC(aList, sp64->lengthA + 0xC90, 0, sp64->lengthB, reverbIndex);
|
||||
}
|
||||
aAddMixer(aList++, 0x300, 0xC90, 0x990, 0x7FFF);
|
||||
aAddMixer(aList++, 0x300, 0xC90, 0x990);
|
||||
aMix(aList++, 0x30, gSynthReverbs[reverbIndex].decayRatio + 0x8000, 0xC90, 0xC90);
|
||||
} else {
|
||||
sp62 = (sp64->startPos & 7) * 2;
|
||||
@ -705,7 +705,7 @@ Acmd* func_80009D78(Acmd* aList, s32 aiBufLen, s16 reverbIndex, s16 updateIndex)
|
||||
aSetBuffer(aList++, 0, sp62 + 0x5F0, 0xE10, aiBufLen * 2);
|
||||
aResample(aList++, gSynthReverbs[reverbIndex].resampleFlags, gSynthReverbs[reverbIndex].unk_0A,
|
||||
OS_K0_TO_PHYSICAL(gSynthReverbs[reverbIndex].unk_34));
|
||||
aAddMixer(aList++, 0x300, 0xC90, 0x990, 0x7FFF);
|
||||
aAddMixer(aList++, 0x300, 0xC90, 0x990);
|
||||
aMix(aList++, 0x30, gSynthReverbs[reverbIndex].decayRatio + 0x8000, 0xC90, 0xC90);
|
||||
}
|
||||
|
||||
@ -837,7 +837,7 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
|
||||
s32 padC8;
|
||||
s32 samplesLenAdjusted; // spC4
|
||||
s32 nAdpcmSamplesProcessed; // spC0
|
||||
u32 endPos; // spBC
|
||||
uintptr_t endPos; // spBC
|
||||
s32 nSamplesToProcess; // spB8
|
||||
s32 padB4;
|
||||
s32 padB0;
|
||||
@ -856,12 +856,12 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
|
||||
s32 nParts; // sp7C
|
||||
s32 curPart; // sp78
|
||||
s32 nSamplesInThisIteration;
|
||||
s32 sampleDataStartPad;
|
||||
uintptr_t sampleDataStartPad;
|
||||
s32 resampledTempLen; // sp6C
|
||||
u16 noteSamplesDmemAddrBeforeResampling; // sp6A
|
||||
s32 samplesRemaining;
|
||||
s32 frameIndex;
|
||||
s32 sampleDataOffset;
|
||||
uintptr_t sampleDataOffset;
|
||||
Note* note; // sp58
|
||||
u16 sp56; // sp56
|
||||
|
||||
@ -878,7 +878,7 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
|
||||
u32 nEntries;
|
||||
s32 aligned;
|
||||
s32 align2;
|
||||
u16 addr;
|
||||
uintptr_t addr;
|
||||
|
||||
currentBook = NULL;
|
||||
note = &gNotes[noteIndex];
|
||||
@ -1000,19 +1000,18 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
|
||||
skipBytes = 0;
|
||||
goto skip;
|
||||
}
|
||||
aligned = ALIGN16(nFramesToDecode * frameSize + 0x10);
|
||||
aligned = ALIGN16(nFramesToDecode * frameSize + SAMPLES_PER_FRAME);
|
||||
addr = 0x990 - aligned;
|
||||
if (nFramesToDecode != 0) {
|
||||
// LTODO: Validate this
|
||||
// bookSample->medium = 0;
|
||||
|
||||
frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16;
|
||||
frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / SAMPLES_PER_FRAME;
|
||||
sampleDataOffset = frameIndex * frameSize;
|
||||
if (bookSample->medium == 0) {
|
||||
sampleData = sampleDmaStart + sampleDataOffset + sampleAddr;
|
||||
sampleData = sampleDataOffset + sampleAddr;
|
||||
} else {
|
||||
sampleData = AudioLoad_DmaSampleData(sampleDmaStart + sampleDataOffset + sampleAddr, aligned,
|
||||
flags, &synthState->sampleDmaIndex, bookSample->medium);
|
||||
sampleData = sampleDataOffset + sampleAddr;
|
||||
}
|
||||
// if (1){}
|
||||
sampleDataStartPad = (uintptr_t) sampleData & 0xF;
|
||||
@ -1318,7 +1317,7 @@ Acmd* func_8000B98C(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthSt
|
||||
ALIGN16(var_a1));
|
||||
}
|
||||
|
||||
aAddMixer(aList++, ALIGN64(size), 0x650, var_t0, 0x7FFF);
|
||||
aAddMixer(aList++, ALIGN64(size), 0x650, var_t0);
|
||||
|
||||
return aList;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void AudioThread_CreateNextAudioBuffer(s16 *samples, u32 num_samples) {
|
||||
|
||||
gCurAudioFrameDmaCount = 0;
|
||||
AudioLoad_DecreaseSampleDmaTtls();
|
||||
AudioLoad_ProcessLoads(gAudioResetStep);
|
||||
// AudioLoad_ProcessLoads(gAudioResetStep);
|
||||
|
||||
if (MQ_GET_MESG(gAudioSpecQueue, &specId)) {
|
||||
if (gAudioResetStep == 0) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mixer.h"
|
||||
|
||||
@ -14,9 +15,10 @@
|
||||
#define ROUND_UP_8(v) (((v) + 7) & ~7)
|
||||
#define ROUND_DOWN_16(v) ((v) & ~0xf)
|
||||
|
||||
#define DMEM_BUF_SIZE (0x1000 - 0x3C0 - 0x40)
|
||||
#define BUF_U8(a) (rspa.buf.as_u8 + ((a) - 0x3C0))
|
||||
#define BUF_S16(a) (rspa.buf.as_s16 + ((a) - 0x3C0) / sizeof(int16_t))
|
||||
//#define DMEM_BUF_SIZE (0x1000 - 0x0330 - 0x10 - 0x40)
|
||||
#define DMEM_BUF_SIZE 0xC80
|
||||
#define BUF_U8(a) (rspa.buf.as_u8 + ((a)-0x0330))
|
||||
#define BUF_S16(a) (rspa.buf.as_s16 + ((a)-0x0330) / sizeof(int16_t))
|
||||
|
||||
static struct {
|
||||
uint16_t in;
|
||||
@ -100,7 +102,13 @@ void aClearBufferImpl(uint16_t addr, int nbytes) {
|
||||
}
|
||||
|
||||
void aLoadBufferImpl(const void *source_addr, uint16_t dest_addr, uint16_t nbytes) {
|
||||
#if __SANITIZE_ADDRESS__
|
||||
for (size_t i = 0; i < ROUND_DOWN_16(nbytes); i++) {
|
||||
BUF_U8(dest_addr)[i] = ((const unsigned char*)source_addr)[i];
|
||||
}
|
||||
#else
|
||||
memcpy(BUF_U8(dest_addr), source_addr, ROUND_DOWN_16(nbytes));
|
||||
#endif
|
||||
}
|
||||
|
||||
void aSaveBufferImpl(uint16_t source_addr, int16_t *dest_addr, uint16_t nbytes) {
|
||||
|
@ -77,7 +77,7 @@ void aUnkCmd19Impl(uint8_t f, uint16_t count, uint16_t out_addr, uint16_t in_add
|
||||
aEnvMixerImpl(inBuf, nSamples, swapReverb, negLeft, negRight, dryLeft, dryRight, wetLeft, wetRight)
|
||||
#define aMix(pkt, c, g, i, o) aMixImpl(c, g, i, o)
|
||||
#define aS8Dec(pkt, f, s) aS8DecImpl(f, s)
|
||||
#define aAddMixer(pkt, s, d, c, x) aAddMixerImpl(s, d, c)
|
||||
#define aAddMixer(pkt, s, d, c) aAddMixerImpl(s, d, c)
|
||||
#define aDuplicate(pkt, s, d, c) aDuplicateImpl(s, d, c)
|
||||
#define aDMEMMove2(pkt, t, i, o, c) aDMEMMove2Impl(t, i, o, c)
|
||||
#define aResampleZoh(pkt, pitch, startFract) aResampleZohImpl(pitch, startFract)
|
||||
|
Loading…
Reference in New Issue
Block a user