mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-01-23 21:45:00 +03:00
Added some fun cracking
This commit is contained in:
parent
5f1a34d9c9
commit
94bc6486eb
@ -814,9 +814,18 @@ typedef struct {
|
|||||||
void* data;
|
void* data;
|
||||||
f32 asFloat;
|
f32 asFloat;
|
||||||
s32 asInt;
|
s32 asInt;
|
||||||
|
struct {
|
||||||
|
u8 pad2[2];
|
||||||
u16 asUShort;
|
u16 asUShort;
|
||||||
|
};
|
||||||
|
struct {
|
||||||
|
u8 pad1[3];
|
||||||
s8 asSbyte;
|
s8 asSbyte;
|
||||||
|
};
|
||||||
|
struct {
|
||||||
|
u8 pad0[3];
|
||||||
u8 asUbyte;
|
u8 asUbyte;
|
||||||
|
};
|
||||||
u32 asUInt;
|
u32 asUInt;
|
||||||
};
|
};
|
||||||
} AudioCmd; // size = 0x8
|
} AudioCmd; // size = 0x8
|
||||||
|
@ -134,7 +134,7 @@ extern OSMesg sSerialEventBuff[1];
|
|||||||
extern OSMesgQueue gMainThreadMesgQueue;
|
extern OSMesgQueue gMainThreadMesgQueue;
|
||||||
extern OSMesg sMainThreadMsgBuff[32];
|
extern OSMesg sMainThreadMsgBuff[32];
|
||||||
extern OSMesgQueue gTaskMesgQueue;
|
extern OSMesgQueue gTaskMesgQueue;
|
||||||
extern OSMesg sTaskMsgBuff[16];
|
extern OSMesg sTaskMsgBuff[128];
|
||||||
extern OSMesgQueue gAudioVImesgQueue;
|
extern OSMesgQueue gAudioVImesgQueue;
|
||||||
extern OSMesg sAudioVImsgBuff[1];
|
extern OSMesg sAudioVImsgBuff[1];
|
||||||
extern OSMesgQueue gAudioTaskMesgQueue;
|
extern OSMesgQueue gAudioTaskMesgQueue;
|
||||||
|
@ -144,91 +144,91 @@ ReverbSettings D_800C76A8[] = {
|
|||||||
{ 1, 0x30, 0x4FFF, 0, 0 },
|
{ 1, 0x30, 0x4FFF, 0, 0 },
|
||||||
};
|
};
|
||||||
AudioSpec gAudioSpecs[] = {
|
AudioSpec gAudioSpecs[] = {
|
||||||
/* 0 */ { 32000, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
/* 0 */ { 44100, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 1 */
|
/* 1 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C74E0), D_800C74E0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C74E0), D_800C74E0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 2 */
|
/* 2 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C74F0), D_800C74F0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C74F0), D_800C74F0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 3 */
|
/* 3 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7500), D_800C7500, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7500), D_800C7500, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 4 */
|
/* 4 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7510), D_800C7510, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7510), D_800C7510, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 5 */
|
/* 5 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7520), D_800C7520, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7520), D_800C7520, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 6 */
|
/* 6 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7530), D_800C7530, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7530), D_800C7530, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 7 */
|
/* 7 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7540), D_800C7540, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7540), D_800C7540, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 8 */
|
/* 8 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7550), D_800C7550, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7550), D_800C7550, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 9 */
|
/* 9 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7560), D_800C7560, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7560), D_800C7560, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 10 */
|
/* 10 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7570), D_800C7570, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7570), D_800C7570, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 11 */
|
/* 11 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7580), D_800C7580, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7580), D_800C7580, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 12 */
|
/* 12 */
|
||||||
{ 32000, 1, 22, ARRAY_COUNT(D_800C7590), D_800C7590, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x2B000,
|
{ 44100, 1, 22, ARRAY_COUNT(D_800C7590), D_800C7590, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x2B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 13 */
|
/* 13 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75A0), D_800C75A0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C75A0), D_800C75A0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 14 */
|
/* 14 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75B0), D_800C75B0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C75B0), D_800C75B0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 15 */
|
/* 15 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75C0), D_800C75C0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C75C0), D_800C75C0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x34000 },
|
0x34000 },
|
||||||
/* 16 */
|
/* 16 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75D8), D_800C75D8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C75D8), D_800C75D8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 17 */
|
/* 17 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75E8), D_800C75E8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C75E8), D_800C75E8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 18 */
|
/* 18 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75F8), D_800C75F8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C75F8), D_800C75F8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 19 */
|
/* 19 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7608), D_800C7608, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7608), D_800C7608, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 20 */
|
/* 20 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7618), D_800C7618, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7618), D_800C7618, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
/* 21 */
|
/* 21 */
|
||||||
{ 32000, 2, 32, ARRAY_COUNT(D_800C7628), D_800C7628, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 32, ARRAY_COUNT(D_800C7628), D_800C7628, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x00000 },
|
0x00000 },
|
||||||
/* 22 */
|
/* 22 */
|
||||||
{ 32000, 1, 32, ARRAY_COUNT(D_800C7638), D_800C7638, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 1, 32, ARRAY_COUNT(D_800C7638), D_800C7638, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x00000 },
|
0x00000 },
|
||||||
/* 23 */
|
/* 23 */
|
||||||
{ 32000, 1, 32, ARRAY_COUNT(D_800C7648), D_800C7648, 0x7FFF, 0x1200, 0xA000, 0, 0x5B00, 0x1D00, 0, 0x00000,
|
{ 44100, 1, 32, ARRAY_COUNT(D_800C7648), D_800C7648, 0x7FFF, 0x1200, 0xA000, 0, 0x5B00, 0x1D00, 0, 0x00000,
|
||||||
0x00000 },
|
0x00000 },
|
||||||
/* 24 */
|
/* 24 */
|
||||||
{ 32000, 1, 22, ARRAY_COUNT(D_800C7658), D_800C7658, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x00000,
|
{ 44100, 1, 22, ARRAY_COUNT(D_800C7658), D_800C7658, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x00000,
|
||||||
0x60000 },
|
0x60000 },
|
||||||
/* 25 */
|
/* 25 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7668), D_800C7668, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7668), D_800C7668, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x00000 },
|
0x00000 },
|
||||||
/* 26 */
|
/* 26 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7678), D_800C7678, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C7678), D_800C7678, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x00000 },
|
0x00000 },
|
||||||
/* 27 */
|
/* 27 */
|
||||||
{ 32000, 2, 32, ARRAY_COUNT(D_800C7688), D_800C7688, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 32, ARRAY_COUNT(D_800C7688), D_800C7688, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x00000 },
|
0x00000 },
|
||||||
/* 28 */
|
/* 28 */
|
||||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
{ 44100, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||||
0x35000 },
|
0x35000 },
|
||||||
};
|
};
|
||||||
s32 D_800C7C28 = 0x20000000; // unused?
|
s32 D_800C7C28 = 0x20000000; // unused?
|
||||||
|
@ -654,7 +654,7 @@ void AudioHeap_Init(void) {
|
|||||||
gAudioBufferParams.minAiBufferLength = gAudioBufferParams.samplesPerFrameTarget - 0x10;
|
gAudioBufferParams.minAiBufferLength = gAudioBufferParams.samplesPerFrameTarget - 0x10;
|
||||||
gAudioBufferParams.maxAiBufferLength = gAudioBufferParams.samplesPerFrameTarget + 0x10;
|
gAudioBufferParams.maxAiBufferLength = gAudioBufferParams.samplesPerFrameTarget + 0x10;
|
||||||
|
|
||||||
gAudioBufferParams.ticksPerUpdate = ((gAudioBufferParams.samplesPerFrameTarget + 0x10) / 192) + 1;
|
gAudioBufferParams.ticksPerUpdate = ((gAudioBufferParams.samplesPerFrameTarget + 0x10) / 0xD0) + 1;
|
||||||
gAudioBufferParams.samplesPerTick =
|
gAudioBufferParams.samplesPerTick =
|
||||||
(gAudioBufferParams.samplesPerFrameTarget / gAudioBufferParams.ticksPerUpdate) & ~7;
|
(gAudioBufferParams.samplesPerFrameTarget / gAudioBufferParams.ticksPerUpdate) & ~7;
|
||||||
gAudioBufferParams.samplesPerTickMax = gAudioBufferParams.samplesPerTick + 8;
|
gAudioBufferParams.samplesPerTickMax = gAudioBufferParams.samplesPerTick + 8;
|
||||||
@ -670,9 +670,9 @@ void AudioHeap_Init(void) {
|
|||||||
gAudioBufferParams.maxAiBufferLength *= gAudioBufferParams.count;
|
gAudioBufferParams.maxAiBufferLength *= gAudioBufferParams.count;
|
||||||
gAudioBufferParams.minAiBufferLength *= gAudioBufferParams.count;
|
gAudioBufferParams.minAiBufferLength *= gAudioBufferParams.count;
|
||||||
gAudioBufferParams.ticksPerUpdate *= gAudioBufferParams.count;
|
gAudioBufferParams.ticksPerUpdate *= gAudioBufferParams.count;
|
||||||
if (gAudioBufferParams.count >= 2) {
|
// if (gAudioBufferParams.count >= 2) {
|
||||||
gAudioBufferParams.maxAiBufferLength -= 0x10;
|
// gAudioBufferParams.maxAiBufferLength -= 0x10;
|
||||||
}
|
// }
|
||||||
gMaxAudioCmds = (gNumNotes * 20 * gAudioBufferParams.ticksPerUpdate) + (spec->numReverbs * 32) + 480;
|
gMaxAudioCmds = (gNumNotes * 20 * gAudioBufferParams.ticksPerUpdate) + (spec->numReverbs * 32) + 480;
|
||||||
persistentSize = spec->persistentSeqCacheSize + spec->persistentFontCacheSize +
|
persistentSize = spec->persistentSeqCacheSize + spec->persistentFontCacheSize +
|
||||||
spec->persistentSampleBankCacheSize + spec->persistentSampleCacheSize + 0x10;
|
spec->persistentSampleBankCacheSize + spec->persistentSampleCacheSize + 0x10;
|
||||||
|
@ -393,7 +393,7 @@ void AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||||||
|
|
||||||
func_800144E4(&gSeqPlayers[playerIdx]);
|
func_800144E4(&gSeqPlayers[playerIdx]);
|
||||||
|
|
||||||
index = BSWAP16(*((u16*) gSeqFontTable + seqId));
|
index = *((u16*) gSeqFontTable + seqId);
|
||||||
numFonts = gSeqFontTable[index++];
|
numFonts = gSeqFontTable[index++];
|
||||||
fontId = 0xFF;
|
fontId = 0xFF;
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ void* AudioLoad_SyncLoadSeq(s32 seqId) {
|
|||||||
AudioTable* table = AudioLoad_GetLoadTable(SEQUENCE_TABLE);
|
AudioTable* table = AudioLoad_GetLoadTable(SEQUENCE_TABLE);
|
||||||
s32 seqIdx = AudioLoad_GetLoadTableIndex(SEQUENCE_TABLE, seqId);
|
s32 seqIdx = AudioLoad_GetLoadTableIndex(SEQUENCE_TABLE, seqId);
|
||||||
|
|
||||||
return Audio_LoadBlob(gAudioTable, table->entries[seqIdx].romAddr);
|
return Audio_LoadBlob(gAudioSeq, table->entries[seqIdx].romAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* AudioLoad_SyncLoadSampleBank(u32 sampleBankId, s32* outMedium) {
|
void* AudioLoad_SyncLoadSampleBank(u32 sampleBankId, s32* outMedium) {
|
||||||
@ -513,82 +513,21 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||||||
table = AudioLoad_GetLoadTable(tableType);
|
table = AudioLoad_GetLoadTable(tableType);
|
||||||
size = table->entries[id].size;
|
size = table->entries[id].size;
|
||||||
size = ALIGN16(size);
|
size = ALIGN16(size);
|
||||||
medium = table->entries[id].medium;
|
|
||||||
cachePolicy = table->entries[id].cachePolicy;
|
|
||||||
|
|
||||||
switch (tableType) {
|
switch (tableType) {
|
||||||
case SEQUENCE_TABLE:
|
case SEQUENCE_TABLE:
|
||||||
romAddr = Audio_LoadBlob(gAudioTable, table->entries[id].romAddr);
|
gSeqLoadStatus[id] = LOAD_STATUS_COMPLETE;
|
||||||
break;
|
return Audio_LoadBlob(gAudioSeq, table->entries[id].romAddr);
|
||||||
case FONT_TABLE:
|
case FONT_TABLE:
|
||||||
romAddr = Audio_LoadFont(table->entries[id]);
|
gFontLoadStatus[id] = LOAD_STATUS_COMPLETE;
|
||||||
break;
|
return Audio_LoadFont(table->entries[id]);
|
||||||
case SAMPLE_TABLE:
|
case SAMPLE_TABLE:
|
||||||
loadStatus = 0;
|
loadStatus = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch (cachePolicy) {
|
return NULL;
|
||||||
// case CACHEPOLICY_0:
|
|
||||||
// ramAddr = AudioHeap_AllocPermanent(tableType, id, size);
|
|
||||||
// if (ramAddr == NULL) {
|
|
||||||
// return ramAddr;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case CACHEPOLICY_1:
|
|
||||||
// ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_PERSISTENT, id);
|
|
||||||
// if (ramAddr == NULL) {
|
|
||||||
// return ramAddr;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case CACHEPOLICY_2:
|
|
||||||
// ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_TEMPORARY, id);
|
|
||||||
// if (ramAddr == NULL) {
|
|
||||||
// return ramAddr;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case CACHEPOLICY_3:
|
|
||||||
// case CACHEPOLICY_4:
|
|
||||||
// ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_EITHER, id);
|
|
||||||
// if (ramAddr == NULL) {
|
|
||||||
// return ramAddr;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
*didAllocate = true;
|
|
||||||
|
|
||||||
// if (medium == MEDIUM_UNK) {
|
|
||||||
// AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, table->base.unkMediumParam);
|
|
||||||
// } else {
|
|
||||||
// AudioLoad_SyncDma(romAddr, ramAddr, size, medium);
|
|
||||||
// }
|
|
||||||
loadStatus = (cachePolicy == CACHEPOLICY_0) ? 5 : 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tableType) {
|
|
||||||
case SEQUENCE_TABLE:
|
|
||||||
if (gSeqLoadStatus[id] != 5) {
|
|
||||||
gSeqLoadStatus[id] = loadStatus;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FONT_TABLE:
|
|
||||||
if (gFontLoadStatus[id] != 5) {
|
|
||||||
gFontLoadStatus[id] = loadStatus;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAMPLE_TABLE:
|
|
||||||
if (gSampleFontLoadStatus[id] != 5) {
|
|
||||||
gSampleFontLoadStatus[id] = loadStatus;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return romAddr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AudioLoad_GetLoadTableIndex(s32 tableType, u32 entryId) {
|
s32 AudioLoad_GetLoadTableIndex(s32 tableType, u32 entryId) {
|
||||||
@ -755,39 +694,33 @@ void AudioLoad_SyncLoadSimple(u32 tableType, u32 id) {
|
|||||||
|
|
||||||
void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
|
void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
|
||||||
u32 size;
|
u32 size;
|
||||||
AudioTable* table;
|
AudioTable* table = AudioLoad_GetLoadTable(tableType);
|
||||||
u8* ramAddr;
|
u8* ramAddr;
|
||||||
s32 medium;
|
s32 medium;
|
||||||
s32 cachePolicy;
|
s32 cachePolicy;
|
||||||
u32 romAddr;
|
u32 romAddr;
|
||||||
s32 loadStatus;
|
s32 loadStatus = LOAD_STATUS_COMPLETE;
|
||||||
|
|
||||||
switch (tableType) {
|
switch (tableType) {
|
||||||
case SEQUENCE_TABLE:
|
case SEQUENCE_TABLE:
|
||||||
if (gSeqLoadStatus[id] == LOAD_STATUS_IN_PROGRESS) {
|
gFontLoadStatus[id] = LOAD_STATUS_COMPLETE;
|
||||||
return NULL;
|
return Audio_LoadBlob(gAudioSeq, table->entries[id].romAddr);
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FONT_TABLE:
|
case FONT_TABLE:
|
||||||
if (gFontLoadStatus[id] == LOAD_STATUS_IN_PROGRESS) {
|
gFontLoadStatus[id] = LOAD_STATUS_COMPLETE;
|
||||||
return NULL;
|
return Audio_LoadFont(table->entries[id]);
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAMPLE_TABLE:
|
case SAMPLE_TABLE:
|
||||||
if (gSampleFontLoadStatus[id] == LOAD_STATUS_IN_PROGRESS) {
|
gSampleFontLoadStatus[id] = LOAD_STATUS_COMPLETE;
|
||||||
|
// LTODO: Validate this
|
||||||
|
// return Audio_LoadSample(table->entries[id].romAddr, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ramAddr = AudioLoad_SearchCaches(tableType, id);
|
ramAddr = AudioLoad_SearchCaches(tableType, id);
|
||||||
if (ramAddr != NULL) {
|
if (ramAddr != NULL) {
|
||||||
loadStatus = LOAD_STATUS_COMPLETE;
|
loadStatus = LOAD_STATUS_COMPLETE;
|
||||||
osSendMesg(retQueue, OS_MESG_32(retData << 0x18), OS_MESG_NOBLOCK);
|
osSendMesg(retQueue, OS_MESG_32(retData << 0x18), OS_MESG_NOBLOCK);
|
||||||
} else {
|
} else {
|
||||||
table = AudioLoad_GetLoadTable(tableType);
|
|
||||||
size = table->entries[id].size;
|
size = table->entries[id].size;
|
||||||
size = ALIGN16(size);
|
size = ALIGN16(size);
|
||||||
medium = table->entries[id].medium;
|
medium = table->entries[id].medium;
|
||||||
@ -795,40 +728,40 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
|||||||
romAddr = table->entries[id].romAddr;
|
romAddr = table->entries[id].romAddr;
|
||||||
loadStatus = LOAD_STATUS_COMPLETE;
|
loadStatus = LOAD_STATUS_COMPLETE;
|
||||||
|
|
||||||
switch (cachePolicy) {
|
// switch (cachePolicy) {
|
||||||
case CACHEPOLICY_0:
|
// case CACHEPOLICY_0:
|
||||||
ramAddr = AudioHeap_AllocPermanent(tableType, id, size);
|
// ramAddr = AudioHeap_AllocPermanent(tableType, id, size);
|
||||||
if (ramAddr == NULL) {
|
// if (ramAddr == NULL) {
|
||||||
return ramAddr;
|
// return ramAddr;
|
||||||
}
|
// }
|
||||||
loadStatus = LOAD_STATUS_PERMANENTLY_LOADED;
|
// loadStatus = LOAD_STATUS_PERMANENTLY_LOADED;
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
|
// case CACHEPOLICY_1:
|
||||||
|
// ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_PERSISTENT, id);
|
||||||
|
// if (ramAddr == NULL) {
|
||||||
|
// return ramAddr;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case CACHEPOLICY_2:
|
||||||
|
// ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_TEMPORARY, id);
|
||||||
|
// if (ramAddr == NULL) {
|
||||||
|
// return ramAddr;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case CACHEPOLICY_3:
|
||||||
|
// case CACHEPOLICY_4:
|
||||||
|
// ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_EITHER, id);
|
||||||
|
// if (ramAddr == NULL) {
|
||||||
|
// return ramAddr;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// AudioLoad_StartAsyncLoad(romAddr, ramAddr, size, medium, nChunks, retQueue,
|
||||||
|
// (retData << 0x18) | (tableType << 0x10) | (id << 8) | loadStatus);
|
||||||
|
|
||||||
case CACHEPOLICY_1:
|
|
||||||
ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_PERSISTENT, id);
|
|
||||||
if (ramAddr == NULL) {
|
|
||||||
return ramAddr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CACHEPOLICY_2:
|
|
||||||
ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_TEMPORARY, id);
|
|
||||||
if (ramAddr == NULL) {
|
|
||||||
return ramAddr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CACHEPOLICY_3:
|
|
||||||
case CACHEPOLICY_4:
|
|
||||||
ramAddr = AudioHeap_AllocCached(tableType, size, CACHE_EITHER, id);
|
|
||||||
if (ramAddr == NULL) {
|
|
||||||
return ramAddr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
AudioLoad_StartAsyncLoad(romAddr, ramAddr, size, medium, nChunks, retQueue,
|
|
||||||
(retData << 0x18) | (tableType << 0x10) | (id << 8) | loadStatus);
|
|
||||||
loadStatus = LOAD_STATUS_IN_PROGRESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tableType) {
|
switch (tableType) {
|
||||||
@ -851,7 +784,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ramAddr;
|
return table->entries[id].romAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLoad_ProcessLoads(s32 resetStatus) {
|
void AudioLoad_ProcessLoads(s32 resetStatus) {
|
||||||
@ -1326,6 +1259,7 @@ s32 AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, uintptr_t fontDataAddr,
|
|||||||
s32 inProgress;
|
s32 inProgress;
|
||||||
isAsync = 0;
|
isAsync = 0;
|
||||||
|
|
||||||
|
printf("Relocating font %d\n", fontId);
|
||||||
inProgress = false;
|
inProgress = false;
|
||||||
if (gPreloadSampleStackTop != 0) {
|
if (gPreloadSampleStackTop != 0) {
|
||||||
inProgress = true;
|
inProgress = true;
|
||||||
@ -1335,55 +1269,58 @@ s32 AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, uintptr_t fontDataAddr,
|
|||||||
|
|
||||||
gNumUsedSamples = 0;
|
gNumUsedSamples = 0;
|
||||||
AudioLoad_RelocateFont(fontId, fontDataAddr, relocData);
|
AudioLoad_RelocateFont(fontId, fontDataAddr, relocData);
|
||||||
|
return;
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
for (i = 0; i < gNumUsedSamples; i++) {
|
// for (i = 0; i < gNumUsedSamples; i++) {
|
||||||
size += ALIGN16(gUsedSamples[i]->size);
|
// size += ALIGN16(gUsedSamples[i]->size);
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (i = 0; i < gNumUsedSamples; i++) {
|
for (i = 0; i < gNumUsedSamples; i++) {
|
||||||
if (gPreloadSampleStackTop == 120) {
|
if (gPreloadSampleStackTop == 120) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sample = gUsedSamples[i];
|
sample = gUsedSamples[i];
|
||||||
|
continue;
|
||||||
#ifdef AVOID_UB
|
#ifdef AVOID_UB
|
||||||
sampleRamAddr = NULL;
|
sampleRamAddr = NULL;
|
||||||
#endif
|
#endif
|
||||||
//! @bug Those are assignments, not equality checks.
|
//! @bug Those are assignments, not equality checks.
|
||||||
// switch (isAsync) {
|
switch (isAsync) {
|
||||||
// case AUDIOLOAD_SYNC:
|
case AUDIOLOAD_SYNC:
|
||||||
// if (sample->medium = relocData->medium1) {
|
if (sample->medium = relocData->medium1) {
|
||||||
// sampleRamAddr = AudioHeap_AllocPersistentSampleCache(sample->size, relocData->sampleBankId1,
|
sampleRamAddr = AudioHeap_AllocPersistentSampleCache(sample->size, relocData->sampleBankId1,
|
||||||
// sample->sampleAddr, sample->medium);
|
sample->sampleAddr, sample->medium);
|
||||||
// } else if (sample->medium = relocData->medium2) {
|
} else if (sample->medium = relocData->medium2) {
|
||||||
// sampleRamAddr = AudioHeap_AllocPersistentSampleCache(sample->size, relocData->sampleBankId2,
|
sampleRamAddr = AudioHeap_AllocPersistentSampleCache(sample->size, relocData->sampleBankId2,
|
||||||
// sample->sampleAddr, sample->medium);
|
sample->sampleAddr, sample->medium);
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
//
|
|
||||||
// case AUDIOLOAD_ASYNC:
|
|
||||||
// if (sample->medium = relocData->medium1) {
|
|
||||||
// sampleRamAddr = AudioHeap_AllocTemporarySampleCache(sample->size, relocData->sampleBankId1,
|
|
||||||
// sample->sampleAddr, sample->medium);
|
|
||||||
// } else if (sample->medium = relocData->medium2) {
|
|
||||||
// sampleRamAddr = AudioHeap_AllocTemporarySampleCache(sample->size, relocData->sampleBankId2,
|
|
||||||
// sample->sampleAddr, sample->medium);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (sampleRamAddr == NULL) {
|
case AUDIOLOAD_ASYNC:
|
||||||
// continue;
|
if (sample->medium = relocData->medium1) {
|
||||||
// }
|
sampleRamAddr = AudioHeap_AllocTemporarySampleCache(sample->size, relocData->sampleBankId1,
|
||||||
|
sample->sampleAddr, sample->medium);
|
||||||
|
} else if (sample->medium = relocData->medium2) {
|
||||||
|
sampleRamAddr = AudioHeap_AllocTemporarySampleCache(sample->size, relocData->sampleBankId2,
|
||||||
|
sample->sampleAddr, sample->medium);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sampleRamAddr == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (isAsync) {
|
switch (isAsync) {
|
||||||
case AUDIOLOAD_SYNC:
|
case AUDIOLOAD_SYNC:
|
||||||
if (sample->medium == MEDIUM_UNK) {
|
if (sample->medium == MEDIUM_UNK) {
|
||||||
// AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleRamAddr, sample->size, gSampleBankTable->base.unkMediumParam);
|
AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleRamAddr, sample->size, gSampleBankTable->base.unkMediumParam);
|
||||||
sample->sampleAddr = sampleRamAddr;
|
sample->sampleAddr = sampleRamAddr;
|
||||||
sample->medium = MEDIUM_RAM;
|
sample->medium = MEDIUM_RAM;
|
||||||
} else {
|
} else {
|
||||||
// AudioLoad_SyncDma(sample->sampleAddr, sampleRamAddr, sample->size, sample->medium);
|
AudioLoad_SyncDma(sample->sampleAddr, sampleRamAddr, sample->size, sample->medium);
|
||||||
sample->sampleAddr = sampleRamAddr;
|
sample->sampleAddr = sampleRamAddr;
|
||||||
sample->medium = MEDIUM_RAM;
|
sample->medium = MEDIUM_RAM;
|
||||||
}
|
}
|
||||||
|
@ -1111,6 +1111,7 @@ void func_80015FD4(SequencePlayer* seqPlayer) {
|
|||||||
s8 pad;
|
s8 pad;
|
||||||
u8* pad2;
|
u8* pad2;
|
||||||
s32 pad3;
|
s32 pad3;
|
||||||
|
gSeqLoadStatus[seqPlayer->seqId] = 2;
|
||||||
|
|
||||||
if (!seqPlayer->enabled) {
|
if (!seqPlayer->enabled) {
|
||||||
return;
|
return;
|
||||||
|
@ -649,7 +649,7 @@ Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen) {
|
|||||||
chunkLen = aiBufLen;
|
chunkLen = aiBufLen;
|
||||||
} else if ((aiBufLen / i) >= gAudioBufferParams.samplesPerTickMax) {
|
} else if ((aiBufLen / i) >= gAudioBufferParams.samplesPerTickMax) {
|
||||||
chunkLen = gAudioBufferParams.samplesPerTickMax;
|
chunkLen = gAudioBufferParams.samplesPerTickMax;
|
||||||
} else if (gAudioBufferParams.samplesPerTickMin >= (aiBufLen / i)) {
|
} else if ((aiBufLen / i) <= gAudioBufferParams.samplesPerTickMin) {
|
||||||
chunkLen = gAudioBufferParams.samplesPerTickMin;
|
chunkLen = gAudioBufferParams.samplesPerTickMin;
|
||||||
} else {
|
} else {
|
||||||
chunkLen = gAudioBufferParams.samplesPerTick;
|
chunkLen = gAudioBufferParams.samplesPerTick;
|
||||||
@ -1005,8 +1005,10 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
|
|||||||
if (nFramesToDecode != 0) {
|
if (nFramesToDecode != 0) {
|
||||||
frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16;
|
frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16;
|
||||||
sampleDataOffset = frameIndex * frameSize;
|
sampleDataOffset = frameIndex * frameSize;
|
||||||
|
// LTODO: Validate this
|
||||||
|
bookSample->medium = 0;
|
||||||
if (bookSample->medium == 0) {
|
if (bookSample->medium == 0) {
|
||||||
sampleData = sampleDmaStart + sampleDataOffset + sampleAddr;
|
sampleData = sampleAddr + sampleDataOffset; //sampleDmaStart + sampleAddr;
|
||||||
} else {
|
} else {
|
||||||
sampleData = AudioLoad_DmaSampleData(sampleDmaStart + sampleDataOffset + sampleAddr, aligned,
|
sampleData = AudioLoad_DmaSampleData(sampleDmaStart + sampleDataOffset + sampleAddr, aligned,
|
||||||
flags, &synthState->sampleDmaIndex, bookSample->medium);
|
flags, &synthState->sampleDmaIndex, bookSample->medium);
|
||||||
|
@ -94,7 +94,7 @@ AudioTable gSoundFontTableInit = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AS_BYTES(x) (((x) >> 8) & 0xFF), ((x) &0xFF)
|
#define AS_BYTES(x) ((x) &0xFF), (((x) >> 8) & 0xFF)
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@ OSMesgQueue sAudioTaskStartQueue;
|
|||||||
OSMesgQueue sThreadCmdProcQueue;
|
OSMesgQueue sThreadCmdProcQueue;
|
||||||
OSMesgQueue sAudioSpecQueue;
|
OSMesgQueue sAudioSpecQueue;
|
||||||
OSMesgQueue sAudioResetQueue;
|
OSMesgQueue sAudioResetQueue;
|
||||||
AudioCmd gThreadCmdBuffer[256];
|
AudioCmd gThreadCmdBuffer[1024];
|
||||||
OSMesg sAudioTaskStartMsg[1];
|
OSMesg sAudioTaskStartMsg[200];
|
||||||
OSMesg sThreadCmdProcMsg[4];
|
OSMesg sThreadCmdProcMsg[200];
|
||||||
OSMesg sAudioSpecMsg[1];
|
OSMesg sAudioSpecMsg[200];
|
||||||
OSMesg sAudioResetMsg[1];
|
OSMesg sAudioResetMsg[200];
|
||||||
|
|
||||||
u8 gThreadCmdWritePos = 0;
|
u8 gThreadCmdWritePos = 0;
|
||||||
u8 gThreadCmdReadPos = 0;
|
u8 gThreadCmdReadPos = 0;
|
||||||
@ -46,16 +46,9 @@ void AudioThread_CreateNextAudioBuffer(s16 *samples, u32 num_samples) {
|
|||||||
u32 specId;
|
u32 specId;
|
||||||
OSMesg msg;
|
OSMesg msg;
|
||||||
|
|
||||||
gAudioTaskCountQ++;
|
|
||||||
if ((gAudioTaskCountQ % gAudioBufferParams.count) != 0) {
|
|
||||||
return gWaitingAudioTask;
|
|
||||||
}
|
|
||||||
osSendMesg(gAudioTaskStartQueue, OS_MESG_32(gAudioTaskCountQ), OS_MESG_NOBLOCK);
|
|
||||||
gAudioTaskIndexQ ^= 1;
|
|
||||||
|
|
||||||
gCurAudioFrameDmaCount = 0;
|
gCurAudioFrameDmaCount = 0;
|
||||||
AudioLoad_DecreaseSampleDmaTtls();
|
// AudioLoad_DecreaseSampleDmaTtls();
|
||||||
AudioLoad_ProcessLoads(gAudioResetStep);
|
// AudioLoad_ProcessLoads(gAudioResetStep);
|
||||||
|
|
||||||
if (MQ_GET_MESG(gAudioSpecQueue, &specId)) {
|
if (MQ_GET_MESG(gAudioSpecQueue, &specId)) {
|
||||||
if (gAudioResetStep == 0) {
|
if (gAudioResetStep == 0) {
|
||||||
@ -311,11 +304,10 @@ void AudioThread_InitQueues(void) {
|
|||||||
osCreateMesgQueue(gAudioResetQueue, sAudioResetMsg, 1);
|
osCreateMesgQueue(gAudioResetQueue, sAudioResetMsg, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread_QueueCmd(u32 opArgs, void** data) {
|
void AudioThread_QueueCmd(AudioCmd cmd) {
|
||||||
AudioCmd* audioCmd = &gThreadCmdBuffer[gThreadCmdWritePos & 0xFF];
|
AudioCmd* audioCmd = &gThreadCmdBuffer[gThreadCmdWritePos & 0xFF];
|
||||||
|
|
||||||
audioCmd->opArgs = opArgs;
|
*audioCmd = cmd;
|
||||||
audioCmd->data = *data;
|
|
||||||
|
|
||||||
gThreadCmdWritePos++;
|
gThreadCmdWritePos++;
|
||||||
if (gThreadCmdWritePos == gThreadCmdReadPos) {
|
if (gThreadCmdWritePos == gThreadCmdReadPos) {
|
||||||
@ -324,17 +316,27 @@ void AudioThread_QueueCmd(u32 opArgs, void** data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread_QueueCmdF32(u32 opArgs, f32 val) {
|
void AudioThread_QueueCmdF32(u32 opArgs, f32 val) {
|
||||||
AudioThread_QueueCmd(opArgs, (void**) &val);
|
AudioCmd cmd = {
|
||||||
|
.opArgs = opArgs,
|
||||||
|
.asFloat = val
|
||||||
|
};
|
||||||
|
AudioThread_QueueCmd(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread_QueueCmdS32(u32 opArgs, u32 val) {
|
void AudioThread_QueueCmdS32(u32 opArgs, u32 val) {
|
||||||
AudioThread_QueueCmd(opArgs, (void**) &val);
|
AudioCmd cmd = {
|
||||||
|
.opArgs = opArgs,
|
||||||
|
.asInt = val
|
||||||
|
};
|
||||||
|
AudioThread_QueueCmd(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread_QueueCmdS8(u32 opArgs, s8 val) {
|
void AudioThread_QueueCmdS8(u32 opArgs, s8 val) {
|
||||||
s32 data = val << 0x18;
|
AudioCmd cmd = {
|
||||||
|
.opArgs = opArgs,
|
||||||
AudioThread_QueueCmd(opArgs, (void**) &data);
|
.asSbyte = val
|
||||||
|
};
|
||||||
|
AudioThread_QueueCmd(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread_ScheduleProcessCmds(void) {
|
void AudioThread_ScheduleProcessCmds(void) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
s32 osViClock2 = 0x02E6D354;
|
s32 osViClock2 = 0x02E6D354;
|
||||||
|
|
||||||
s32 osAiSetFrequency(u32 freq) {
|
s32 osAiSetFrequency(u32 freq) {
|
||||||
return 32000;
|
return 1;
|
||||||
register u32 a1;
|
register u32 a1;
|
||||||
register s32 a2;
|
register s32 a2;
|
||||||
register float ftmp;
|
register float ftmp;
|
||||||
|
@ -66,7 +66,7 @@ GameEngine::GameEngine() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 32000, 1024, 2480 });
|
this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 44100, 1024, 2480 });
|
||||||
|
|
||||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SF64::ResourceType::AnimData), 0);
|
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SF64::ResourceType::AnimData), 0);
|
||||||
@ -139,9 +139,9 @@ void GameEngine::HandleAudioThread(){
|
|||||||
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
||||||
s16 audio_buffer[SAMPLES_PER_FRAME];
|
s16 audio_buffer[SAMPLES_PER_FRAME];
|
||||||
for (int i = 0; i < NUM_AUDIO_CHANNELS; i++) {
|
for (int i = 0; i < NUM_AUDIO_CHANNELS; i++) {
|
||||||
AudioThread_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples * 2);
|
AudioThread_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples);
|
||||||
}
|
}
|
||||||
AudioPlayerPlayFrame((u8 *) audio_buffer, 2 * num_audio_samples * 4);
|
AudioPlayerPlayFrame((u8 *) audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
|
||||||
audio.processing = false;
|
audio.processing = false;
|
||||||
audio.cv_from_thread.notify_one();
|
audio.cv_from_thread.notify_one();
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ struct GamePool {
|
|||||||
#include <Fast3D/gfx_pc.h>
|
#include <Fast3D/gfx_pc.h>
|
||||||
#include "libultraship/src/Context.h"
|
#include "libultraship/src/Context.h"
|
||||||
|
|
||||||
#define SAMPLES_HIGH 544
|
#define SAMPLES_HIGH 752
|
||||||
#define SAMPLES_LOW 528
|
#define SAMPLES_LOW 720
|
||||||
#define AUDIO_FRAMES_PER_UPDATE 2
|
#define AUDIO_FRAMES_PER_UPDATE 2
|
||||||
#define NUM_AUDIO_CHANNELS 2
|
#define NUM_AUDIO_CHANNELS 2
|
||||||
#define SAMPLES_PER_FRAME (SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3)
|
#define SAMPLES_PER_FRAME (SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3)
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
#include "BitConverter.h"
|
#include "BitConverter.h"
|
||||||
#include "port/Engine.h"
|
#include "port/Engine.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
Ship::BinaryReader Audio_MakeReader(const char* resource, u32 offset = 0){
|
Ship::BinaryReader Audio_MakeReader(const char* resource, u32 offset = 0){
|
||||||
auto data = (char*)ResourceGetDataByName(resource);
|
auto data = (char*)ResourceGetDataByName(resource);
|
||||||
@ -27,12 +31,12 @@ EnvelopePoint* Audio_LoadEnvelope(uint32_t addr) {
|
|||||||
|
|
||||||
std::vector<EnvelopePoint> temp;
|
std::vector<EnvelopePoint> temp;
|
||||||
while(true) {
|
while(true) {
|
||||||
int16_t delay = reader.ReadInt16();
|
int16_t delay = BSWAP16(reader.ReadInt16());
|
||||||
int16_t arg = reader.ReadInt16();
|
int16_t arg = BSWAP16(reader.ReadInt16());
|
||||||
|
|
||||||
temp.push_back({delay, arg});
|
temp.push_back({delay, arg});
|
||||||
|
|
||||||
if (delay < 0){
|
if (1 <= (-delay) % (1 << 16) && (-delay) % (1 << 16) <= 3){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +129,12 @@ Sample* Audio_LoadSample(uint32_t sampleAddr, uint32_t baseAddr = 0, uint32_t sa
|
|||||||
sample->book = Audio_LoadBook(baseAddr + reader.ReadUInt32());
|
sample->book = Audio_LoadBook(baseAddr + reader.ReadUInt32());
|
||||||
|
|
||||||
sample->isRelocated = 1;
|
sample->isRelocated = 1;
|
||||||
sample->sampleAddr = (uint8_t*) Audio_LoadBlob(gAudioTable, gSeqTableInit.entries[sampleBankID].romAddr) + addr;
|
sample->sampleAddr = (uint8_t*) Audio_LoadBlob(gAudioTable, gSampleBankTable->entries[sampleBankID].romAddr + addr);
|
||||||
|
|
||||||
|
std::filesystem::path path{ "dumps/" + std::to_string(sampleAddr) + ".raw" };
|
||||||
|
std::ofstream ofs(path);
|
||||||
|
ofs.write(reinterpret_cast<const char*>(sample->sampleAddr), sample->size);
|
||||||
|
ofs.close();
|
||||||
|
|
||||||
gUsedSamples[gNumUsedSamples++] = sample;
|
gUsedSamples[gNumUsedSamples++] = sample;
|
||||||
return sample;
|
return sample;
|
||||||
|
@ -22,7 +22,7 @@ OSMesg sSerialEventBuff[1];
|
|||||||
OSMesgQueue gMainThreadMesgQueue;
|
OSMesgQueue gMainThreadMesgQueue;
|
||||||
OSMesg sMainThreadMsgBuff[32];
|
OSMesg sMainThreadMsgBuff[32];
|
||||||
OSMesgQueue gTaskMesgQueue;
|
OSMesgQueue gTaskMesgQueue;
|
||||||
OSMesg sTaskMsgBuff[16];
|
OSMesg sTaskMsgBuff[128];
|
||||||
OSMesgQueue gAudioVImesgQueue;
|
OSMesgQueue gAudioVImesgQueue;
|
||||||
OSMesg sAudioVImsgBuff[1];
|
OSMesg sAudioVImsgBuff[1];
|
||||||
OSMesgQueue gAudioTaskMesgQueue;
|
OSMesgQueue gAudioTaskMesgQueue;
|
||||||
|
Loading…
Reference in New Issue
Block a user