summaryrefslogtreecommitdiff
path: root/src/factories/DisplayListFactory.cpp
diff options
context:
space:
mode:
authorLywx <kiritodev01@gmail.com>2025-03-23 22:10:43 -0600
committerGitHub <noreply@github.com>2025-03-23 22:10:43 -0600
commit580350a2c2a0987811b31e562133106c4979bf05 (patch)
treeac434aad2c1b44680be3546bdad234b67f703eef /src/factories/DisplayListFactory.cpp
parent228a17c68282092b6c3937c46b943229388931fe (diff)
Implemented count for broken dlists
Diffstat (limited to 'src/factories/DisplayListFactory.cpp')
-rw-r--r--src/factories/DisplayListFactory.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp
index 86f311e..20eea5b 100644
--- a/src/factories/DisplayListFactory.cpp
+++ b/src/factories/DisplayListFactory.cpp
@@ -503,12 +503,14 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint8_t>& raw_buffer, YAML::Node& node) {
const auto gbi = Companion::Instance->GetGBIVersion();
+ auto count = GetSafeNode<int32_t>(node, "count", -1);
auto [_, segment] = Decompressor::AutoDecode(node, raw_buffer);
LUS::BinaryReader reader(segment.data, segment.size);
reader.SetEndianness(Torch::Endianness::Big);
std::vector<uint32_t> gfxs;
auto processing = true;
+ size_t length = 0;
while (processing){
auto w0 = reader.ReadUInt32();
@@ -631,6 +633,10 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint
}
}
+ if(count != -1 && length++ >= count){
+ break;
+ }
+
gfxs.push_back(w0);
gfxs.push_back(w1);
}