diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-02-01 17:37:13 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2024-02-01 17:37:13 -0600 |
| commit | b964a4db9225203ad61b49a5d9286b373a5c3abb (patch) | |
| tree | c1a015715b07fc0f12bfc53312932e1175426e2e /src/Companion.cpp | |
| parent | dadf7414ee87ff64d9da433b67a3a7c555f9c76c (diff) | |
Removed last table data from audio
Diffstat (limited to 'src/Companion.cpp')
| -rw-r--r-- | src/Companion.cpp | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp index ae568ef..e7f259f 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -253,6 +253,7 @@ void Companion::Process() { SPDLOG_INFO("Hash: {}", this->gCartridge->GetHash()); SPDLOG_INFO("Assets: {}", path); + AudioManager::Instance = new AudioManager(); auto wrapper = this->gConfig.exporterType == ExportType::Binary ? new SWrapper(this->gConfig.outputPath) : nullptr; auto vWriter = LUS::BinaryWriter(); @@ -277,15 +278,52 @@ void Companion::Process() { for(auto asset = root.begin(); asset != root.end(); ++asset){ auto node = asset->second; + auto entryName = asset->first.as<std::string>(); - if(!asset->second["offset"]) { - continue; - } + // Parse horizontal assets + if(node["files"]){ + auto segment = node["segment"] ? node["segment"].as<uint8_t>() : -1; + const auto files = node["files"]; + for (const auto& file : files) { + auto assetNode = file.as<YAML::Node>(); + auto childName = assetNode["name"].as<std::string>(); + auto output = (this->gCurrentDirectory / entryName / childName).string(); + std::replace(output.begin(), output.end(), '\\', '/'); - auto output = (this->gCurrentDirectory / asset->first.as<std::string>()).string(); - std::replace(output.begin(), output.end(), '\\', '/'); + if(assetNode["type"]){ + const auto type = GetSafeNode<std::string>(assetNode, "type"); + if(type == "SAMPLE"){ + AudioManager::Instance->bind_sample(assetNode, output); + } + } + + if(!assetNode["offset"]) { + continue; + } - this->gAddrMap[this->gCurrentFile][node["offset"].as<uint32_t>()] = std::make_tuple(output, node); + if(segment != -1) { + assetNode["offset"] = (segment << 24) | assetNode["offset"].as<uint32_t>(); + } + + this->gAddrMap[this->gCurrentFile][assetNode["offset"].as<uint32_t>()] = std::make_tuple(output, assetNode); + } + } else { + auto output = (this->gCurrentDirectory / entryName).string(); + std::replace(output.begin(), output.end(), '\\', '/'); + + if(node["type"]){ + const auto type = GetSafeNode<std::string>(node, "type"); + if(type == "SAMPLE"){ + AudioManager::Instance->bind_sample(node, output); + } + } + + if(!node["offset"]) { + continue; + } + + this->gAddrMap[this->gCurrentFile][node["offset"].as<uint32_t>()] = std::make_tuple(output, node); + } } // Stupid hack because the iteration broke the assets |
