summaryrefslogtreecommitdiff
path: root/src/factories/DisplayListFactory.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2024-03-08 13:24:58 -0700
committerGitHub <noreply@github.com>2024-03-08 14:24:58 -0600
commitf06ed7388df76f09d8fbda765acea5d2923553d4 (patch)
treedfb2d060b88a3d6fd62178a669307c2aa9973b10 /src/factories/DisplayListFactory.cpp
parentcfd2ec35ce03a36c10b005b952f765f035c8b836 (diff)
Detect Compression Type and Improve Yaml Structure (#21)
* Auto detect mio0 * Altered decompressor * Fix bug * Bug fix * fix * debugging * fix debug * Remove logging * Fix spacing * node change * Cleanup * Track compression offset using global var * Implementation * Renames * Simplification * Fixes * Fix debugging output * yaml config segments uses array style * Fix to_hex zero fill * Bug fixes --------- Co-authored-by: = <=>
Diffstat (limited to 'src/factories/DisplayListFactory.cpp')
-rw-r--r--src/factories/DisplayListFactory.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp
index bf13826..d5197cc 100644
--- a/src/factories/DisplayListFactory.cpp
+++ b/src/factories/DisplayListFactory.cpp
@@ -77,7 +77,7 @@ void DListHeaderExporter::Export(std::ostream &write, std::shared_ptr<IParsedDat
void DListCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
const auto cmds = std::static_pointer_cast<DListData>(raw)->mGfxs;
const auto symbol = GetSafeNode(node, "symbol", entryName);
- const auto offset = GetSafeNode<uint32_t>(node, "offset");
+ auto offset = GetSafeNode<uint32_t>(node, "offset");
char out[0xFFFF] = {0};
@@ -113,6 +113,9 @@ void DListCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData>
GFXDSetGBIVersion();
if (Companion::Instance->IsDebug()) {
+ if (IS_SEGMENTED(offset)) {
+ offset = SEGMENT_OFFSET(offset);
+ }
write << "// 0x" << std::hex << std::uppercase << offset << "\n";
}
@@ -267,8 +270,6 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
auto [_, segment] = Decompressor::AutoDecode(node, raw_buffer);
LUS::BinaryReader reader(segment.data, segment.size);
reader.SetEndianness(LUS::Endianness::Big);
- // Validate this
- // reader.Seek(offset, LUS::SeekOffsetType::Start);
std::vector<uint32_t> gfxs;
auto processing = true;
@@ -305,7 +306,6 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
output = Companion::Instance->NormalizeAsset("dl_" + Torch::to_hex(ptr, false));
}
- Decompressor::CopyCompression(node, dl);
dl["type"] = "GFX";
dl["offset"] = ptr;
dl["symbol"] = output;
@@ -363,7 +363,6 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
output = Companion::Instance->NormalizeAsset("lights1_" + Torch::to_hex(w1, false));
}
- Decompressor::CopyCompression(node, light);
light["type"] = "lights";
light["offset"] = ptr;
light["symbol"] = output;
@@ -411,7 +410,6 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
output = Companion::Instance->NormalizeAsset("vtx_" + Torch::to_hex(w1, false));
}
- Decompressor::CopyCompression(node, vtx);
vtx["type"] = "VTX";
vtx["offset"] = ptr;
vtx["count"] = nvtx;