summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Estelami <NEstelami@users.noreply.github.com>2022-06-14 01:29:52 -0400
committerNicholas Estelami <NEstelami@users.noreply.github.com>2022-06-16 20:35:52 -0400
commit3f10195c0e4aaa5ed94fd3bbae147a6570332eda (patch)
treefa62cc0a20a96268ed440d1c6137a337b06a5417
parentc930bd0138a987223a854c4f4d54e6c9b4a48778 (diff)
Added XML attributes and fixed odd crash
-rw-r--r--ZAPDTR/ZAPD/ZAudio.cpp46
-rw-r--r--soh/assets/xml/GC_NMQ_D/audio/Audio.xml2
2 files changed, 22 insertions, 26 deletions
diff --git a/ZAPDTR/ZAPD/ZAudio.cpp b/ZAPDTR/ZAPD/ZAudio.cpp
index a502a0545..a8b0f1fa1 100644
--- a/ZAPDTR/ZAPD/ZAudio.cpp
+++ b/ZAPDTR/ZAPD/ZAudio.cpp
@@ -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);
diff --git a/soh/assets/xml/GC_NMQ_D/audio/Audio.xml b/soh/assets/xml/GC_NMQ_D/audio/Audio.xml
index e021bb0ac..f0ce2eefa 100644
--- a/soh/assets/xml/GC_NMQ_D/audio/Audio.xml
+++ b/soh/assets/xml/GC_NMQ_D/audio/Audio.xml
@@ -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"/>