Audio support nearly complete.

This commit is contained in:
Nicholas Estelami 2022-06-10 13:37:50 -04:00
parent b83cd172b2
commit 61760401bc
25 changed files with 1953 additions and 209 deletions

View file

@ -3,6 +3,9 @@
#include "ultra64.h"
#include "global.h"
extern bool gUseLegacySD;
extern char* sequenceMap[256];
#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80)
#define PORTAMENTO_MODE(x) ((x).mode & ~0x80)
#define PORTAMENTO_MODE_1 1
@ -1060,9 +1063,15 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
command = (u8)parameters[0];
if (seqPlayer->defaultFont != 0xFF) {
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[offset];
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
if (gUseLegacySD) {
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[offset];
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
}
else {
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
command = sDat.fonts[sDat.numFonts - result - 1];
}
}
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, command)) {
@ -1170,10 +1179,17 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
result = (u8)parameters[0];
command = (u8)parameters[0];
if (seqPlayer->defaultFont != 0xFF) {
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[offset];
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
if (seqPlayer->defaultFont != 0xFF)
{
if (gUseLegacySD) {
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[offset];
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
}
else {
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
command = sDat.fonts[sDat.numFonts - result - 1];
}
}
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, command)) {
@ -1330,14 +1346,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
break;
case 0xB2:
offset = (u16)parameters[0];
// OTRTODO: Byteswap added for quick audio
channel->unk_22 = BOMSWAP16(*(u16*)(seqPlayer->seqData + (uintptr_t)(offset + scriptState->value * 2)));
break;
case 0xB4:
channel->dynTable = (void*)&seqPlayer->seqData[channel->unk_22];
break;
case 0xB5:
// OTRTODO: Byteswap added for quick audio
channel->unk_22 = BOMSWAP16(((u16*)(channel->dynTable))[scriptState->value]);
break;
case 0xB6: