Implemented count for broken dlists

This commit is contained in:
Lywx
2025-03-23 22:10:43 -06:00
committed by GitHub
parent 228a17c682
commit 580350a2c2
+6
View File
@@ -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);
}