Added XML attributes and fixed odd crash

This commit is contained in:
Nicholas Estelami 2022-06-14 01:29:52 -04:00
parent 416173fa79
commit aa98408e00
2 changed files with 22 additions and 26 deletions

View File

@ -11,9 +11,10 @@ REGISTER_ZFILENODE(Audio, ZAudio);
ZAudio::ZAudio(ZFile* nParent) : ZResource(nParent)
{
//RegisterRequiredAttribute("CodeOffset");
//RegisterOptionalAttribute("LangOffset", "0");
RegisterRequiredAttribute("SoundFontTableOffset");
RegisterRequiredAttribute("SequenceTableOffset");
RegisterRequiredAttribute("SampleBankTableOffset");
RegisterRequiredAttribute("SequenceFontTableOffset");
}
void ZAudio::ParseXML(tinyxml2::XMLElement* reader)
@ -156,11 +157,6 @@ SampleEntry* ZAudio::ParseSampleEntry(std::vector<uint8_t> audioBank,
sample->loop.end = BitConverter::ToInt32BE(audioBank, loopOffset + 4);
sample->loop.count = BitConverter::ToInt32BE(audioBank, loopOffset + 8);
if (sample->loop.start == 0x3ADB)
{
int bp = 0;
}
if (sample->loop.count != 0)
{
for (int i = 0; i < 16; i++)
@ -341,30 +337,30 @@ void ZAudio::ParseRawData()
audioSeqData = Globals::Instance->GetBaseromFile(Globals::Instance->baseRomPath.string() +
"Audioseq");
//codeData = File::ReadAllBytes("baserom/code_ntsc");
//audioTableData = File::ReadAllBytes("baserom/Audiotable_ntsc");
//audioSeqData = File::ReadAllBytes("baserom/Audioseq_ntsc");
//audioBankData = File::ReadAllBytes("baserom/Audiobank_ntsc");
// TABLE PARSING
// GC PAL
//int gSoundFontTableOffset = 0x138270; // OTRTODO: Make this an XML Param
//int gSequenceTableOffset = 0x1386A0; // OTRTODO: Make this an XML Param
//int gSampleBankTableOffset = 0x138D90; // OTRTODO: Make this an XML Param
//int gSequenceFontTableOffset = 0x1384E0; // OTRTODO: Make this an XML Param
//int gSoundFontTableOffset = 0x138270;
//int gSequenceTableOffset = 0x1386A0;
//int gSampleBankTableOffset = 0x138D90;
//int gSequenceFontTableOffset = 0x1384E0;
// NMQ DBG ROM
int gSoundFontTableOffset = 0x138290; // OTRTODO: Make this an XML Param
int gSequenceTableOffset = 0x1386C0; // OTRTODO: Make this an XML Param
int gSampleBankTableOffset = 0x138DB0; // OTRTODO: Make this an XML Param
int gSequenceFontTableOffset = 0x138500; // OTRTODO: Make this an XML Param
//int gSoundFontTableOffset = 0x138290;
//int gSequenceTableOffset = 0x1386C0;
//int gSampleBankTableOffset = 0x138DB0;
//int gSequenceFontTableOffset = 0x138500;
// NTSC 1.0
//int gSoundFontTableOffset = 0x1026A0; // OTRTODO: Make this an XML Param
//int gSequenceTableOffset = 0x102AD0; // OTRTODO: Make this an XML Param
//int gSampleBankTableOffset = 0x1031C0; // OTRTODO: Make this an XML Param
//int gSequenceFontTableOffset = 0x102910; // OTRTODO: Make this an XML Param
//int gSoundFontTableOffset = 0x1026A0;
//int gSequenceTableOffset = 0x102AD0;
//int gSampleBankTableOffset = 0x1031C0;
//int gSequenceFontTableOffset = 0x102910;
int gSoundFontTableOffset = StringHelper::StrToL(registeredAttributes.at("SoundFontTableOffset").value, 16);
int gSequenceTableOffset = StringHelper::StrToL(registeredAttributes.at("SequenceTableOffset").value, 16);
int gSampleBankTableOffset = StringHelper::StrToL(registeredAttributes.at("SampleBankTableOffset").value, 16);
int gSequenceFontTableOffset = StringHelper::StrToL(registeredAttributes.at("SequenceFontTableOffset").value, 16);
soundFontTable = ParseAudioTable(codeData, gSoundFontTableOffset);
sequenceTable = ParseAudioTable(codeData, gSequenceTableOffset);

View File

@ -1,6 +1,6 @@
<Root>
<File Name="code" OutName="audio" RangeStart="0x0" RangeEnd="0x12CBB0">
<Audio Name="audio" Offset="0x00">
<Audio Name="audio" Offset="0x00" SoundFontTableOffset="0x138290" SequenceTableOffset="0x1386C0" SampleBankTableOffset="0x138DB0" SequenceFontTableOffset="0x138500">
<Sequences>
<Sequence Name="000_Sound_Effects"/>
<Sequence Name="001_Ambient_Effects"/>