Fixed assets that doesnt have offset

This commit is contained in:
KiritoDv
2024-03-22 11:30:11 -06:00
parent 12b45a304d
commit 4c961039cd
3 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -681,8 +681,8 @@ void Companion::Process() {
this->ExtractNode(node, output, wrapper);
}
} else {
const auto offset = assetNode["offset"].as<uint32_t>();
if(gCurrentFileOffset) {
if(gCurrentFileOffset && assetNode["offsets"]) {
const auto offset = assetNode["offset"].as<uint32_t>();
if (!IS_SEGMENTED(offset)) {
assetNode["offset"] = (gCurrentSegmentNumber << 24) | offset;
}
+4
View File
@@ -1,5 +1,7 @@
#include "DictionaryFactory.h"
#include "spdlog/spdlog.h"
ExportResult SM64::DictionaryBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
auto writer = LUS::BinaryWriter();
const auto data = std::static_pointer_cast<DictionaryData>(raw);
@@ -33,6 +35,8 @@ std::optional<std::shared_ptr<IParsedData>> SM64::DictionaryFactory::parse(std::
text.push_back(0xFF);
dictionary[key] = text;
SPDLOG_INFO("Found key: {} at offset {}", key, offset);
}
return std::make_shared<DictionaryData>(dictionary);
+1 -1
View File
@@ -18,7 +18,7 @@ class DictionaryBinaryExporter : public BaseExporter {
class DictionaryFactory : public BaseFactory {
public:
std::optional<std::shared_ptr<IParsedData>> parse(std::vector<uint8_t>& buffer, YAML::Node& data) override;
inline std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override {
std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override {
return { REGISTER(Binary, DictionaryBinaryExporter) };
}
};