From f55fa4a079d07f8db2b1feb8b4ef37afe30cecda Mon Sep 17 00:00:00 2001 From: wghost Date: Mon, 16 Mar 2015 23:18:27 +0400 Subject: [PATCH] fixed bug with Level object deserialization --- UObject.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/UObject.cpp b/UObject.cpp index 82b796f..75a1c01 100644 --- a/UObject.cpp +++ b/UObject.cpp @@ -859,21 +859,23 @@ std::string UMapProperty::Deserialize(std::istream& stream, UPKInfo& info) std::string ULevel::Deserialize(std::istream& stream, UPKInfo& info) { std::ostringstream ss; + UObjectReference A; + uint32_t NumActors; ss << UObject::Deserialize(stream, info); uint32_t pos = ((unsigned)stream.tellg() - info.GetExportEntry(ThisRef).SerialOffset); - ss << "Stream relative position (debug info): " << FormatHEX(pos) << " (" << pos << ")\n"; ss << "ULevel:\n"; - ss << "Actors:\n"; - for (int i = 0; ; ++i) + stream.read(reinterpret_cast(&A), sizeof(A)); + ss << "\tLevel object: " << FormatHEX((uint32_t)A) << " -> " << info.ObjRefToName(A) << std::endl; + stream.read(reinterpret_cast(&NumActors), sizeof(NumActors)); + ss << "\tNum actors: " << FormatHEX(NumActors) << " = " << NumActors << std::endl; + stream.read(reinterpret_cast(&A), sizeof(A)); + ss << "\tWorldInfo object: " << FormatHEX((uint32_t)A) << " -> " << info.ObjRefToName(A) << std::endl; + ss << "\tActors:\n"; + for (unsigned i = 0; i < NumActors; ++i) { - UObjectReference A; stream.read(reinterpret_cast(&A), sizeof(A)); - if (info.GetExportEntry(A).FullName.find("TheWorld.PersistentLevel") == std::string::npos && A != 0x0) - { - break; - } Actors.push_back(A); - ss << "\t" << FormatHEX((char*)&A, sizeof(A)) << "\t//\t" << FormatHEX((uint32_t)A) << "\t//\t" << info.ObjRefToName(A) << std::endl; + ss << "\t\t" << FormatHEX((char*)&A, sizeof(A)) << "\t//\t" << FormatHEX((uint32_t)A) << " -> " << info.ObjRefToName(A) << std::endl; } pos = ((unsigned)stream.tellg() - info.GetExportEntry(ThisRef).SerialOffset); ss << "Stream relative position (debug info): " << FormatHEX(pos) << " (" << pos << ")\n";