summaryrefslogtreecommitdiff
path: root/ZAPDTR
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-14 01:29:52 -0400
commit9e313dd18bbde5243bfc6962972fa3ff2b2c6e3c (patch)
tree196bc4ac1a94662772e250466664e2928fc8d08d /ZAPDTR
parentbff206e30b36e4790b871393cd179414cf5c3c40 (diff)
Added XML attributes and fixed odd crash
Diffstat (limited to 'ZAPDTR')
-rw-r--r--ZAPDTR/ZAPD/ZAudio.cpp46
1 files changed, 21 insertions, 25 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);