From 2e1949ed5dd46d9ed04aeb9bcb6089515ccea183 Mon Sep 17 00:00:00 2001 From: William JCM Date: Wed, 22 Sep 2021 19:16:33 +0200 Subject: [PATCH] BytePropertySerialiser: add support for demo props. --- .../Serialisers/BytePropertySerialiser.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp index 4cc597f..7bfec24 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp @@ -29,19 +29,23 @@ auto BytePropertySerialiser::deserialise(const std::string& name, const std::str { auto prop = Containers::pointer(); - if(!reader.readUEString(prop->enumType)) { - return nullptr; - } + if(value_length != UnsignedLong(-1)) { + if(!reader.readUEString(prop->enumType)) { + return nullptr; + } - char terminator; - if(!reader.readChar(terminator) || terminator != '\0') { - return nullptr; + char terminator; + if(!reader.readChar(terminator) || terminator != '\0') { + return nullptr; + } } if(!reader.readUEString(prop->enumValue)) { return nullptr; } + prop->valueLength = value_length; + //UnsignedInt count = 0; //if(!reader.readUnsignedInt(count)) { // return nullptr; @@ -67,8 +71,11 @@ auto BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLo //bytes_written += writer.writeValueToArray(byte_prop->value.size()); //bytes_written += writer.writeDataToArray(byte_prop->value); - writer.writeUEStringToArray(byte_prop->enumType); - writer.writeValueToArray('\0'); + if(byte_prop->valueLength != UnsignedLong(-1)) { + writer.writeUEStringToArray(byte_prop->enumType); + writer.writeValueToArray('\0'); + } + bytes_written += writer.writeUEStringToArray(byte_prop->enumValue); return true;