diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Deserialize/Handlers/MsgPack/DcMsgPackTransientDeserializers.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/Deserialize/Handlers/MsgPack/DcMsgPackTransientDeserializers.cpp index 944644e7..43910b4a 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Deserialize/Handlers/MsgPack/DcMsgPackTransientDeserializers.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Deserialize/Handlers/MsgPack/DcMsgPackTransientDeserializers.cpp @@ -147,6 +147,10 @@ FDcResult HandlerTransientTextDeserialize(FDcDeserializeContext& Ctx) { using namespace DcSerDeCommon; + FText Text; + FTextAccess& TextAccess = (FTextAccess&)Text; + +#if UE_VERSION_OLDER_THAN(5, 4, 0) void* ObjectPtr; void* SharedRefPtr; uint32 Flags; @@ -157,9 +161,6 @@ FDcResult HandlerTransientTextDeserialize(FDcDeserializeContext& Ctx) DC_TRY(Ctx.Reader->ReadUInt32(&Flags)); DC_TRY(Ctx.Reader->ReadArrayEnd()); - FText Text; - FTextAccess& TextAccess = (FTextAccess&)Text; - #if ENGINE_MAJOR_VERSION == 5 { using RefControllerType = SharedPointerInternals::TReferenceControllerBase; @@ -184,6 +185,24 @@ FDcResult HandlerTransientTextDeserialize(FDcDeserializeContext& Ctx) } #endif +#else + void* ObjectPtr; + uint32 Flags; + + DC_TRY(Ctx.Reader->ReadArrayRoot()); + DC_TRY(DcMsgPackHandlersDetails::ReadPointerRaw(Ctx.Reader, ObjectPtr)); + DC_TRY(Ctx.Reader->ReadUInt32(&Flags)); + DC_TRY(Ctx.Reader->ReadArrayEnd()); + + { + using RefCountPtr = TRefCountPtr; + RefCountPtr TextPtr((ITextData*)ObjectPtr, true); + + TextAccess.TextData = MoveTemp(TextPtr); + } +#endif // !UE_VERSION_OLDER_THAN(5, 4, 0) + + TextAccess.Flags = Flags; DC_TRY(Ctx.Writer->WriteText(Text)); diff --git a/DataConfig/Source/DataConfigCore/Private/DataConfig/Serialize/Handlers/MsgPack/DcMsgPackTransientSerializers.cpp b/DataConfig/Source/DataConfigCore/Private/DataConfig/Serialize/Handlers/MsgPack/DcMsgPackTransientSerializers.cpp index 59e19570..90511d45 100644 --- a/DataConfig/Source/DataConfigCore/Private/DataConfig/Serialize/Handlers/MsgPack/DcMsgPackTransientSerializers.cpp +++ b/DataConfig/Source/DataConfigCore/Private/DataConfig/Serialize/Handlers/MsgPack/DcMsgPackTransientSerializers.cpp @@ -84,10 +84,16 @@ FDcResult HandlerTransientTextSerialize(FDcSerializeContext& Ctx) DC_TRY(Ctx.Reader->ReadText(&Value)); FTextAccess& ValueAccess = (FTextAccess&)(Value); - FSharedRefAccess& SharedRefAccess = (FSharedRefAccess&)ValueAccess.TextData; DC_TRY(Ctx.Writer->WriteArrayRoot()); + +#if UE_VERSION_OLDER_THAN(5, 4, 0) + FSharedRefAccess& SharedRefAccess = (FSharedRefAccess&)ValueAccess.TextData; DC_TRY(DcMsgPackHandlersDetails::WritePointer(Ctx.Writer, SharedRefAccess.Object)); DC_TRY(DcMsgPackHandlersDetails::WritePointer(Ctx.Writer, SharedRefAccess.SharedReferenceCount)); +#else + DC_TRY(DcMsgPackHandlersDetails::WritePointer(Ctx.Writer, ValueAccess.TextData.GetReference())); +#endif // !UE_VERSION_OLDER_THAN(5, 4, 0) + DC_TRY(Ctx.Writer->WriteUInt32(ValueAccess.Flags)); DC_TRY(Ctx.Writer->WriteArrayEnd()); diff --git a/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h b/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h index 0beeb32b..48651e30 100644 --- a/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h +++ b/DataConfig/Source/DataConfigCore/Public/DataConfig/DcVersion.h @@ -1,4 +1,4 @@ #pragma once -#define DATA_CONFIG_CORE_VERSION "1.6.0" -#define DATA_CONFIG_CORE_VERSION_NUMBER 10600 +#define DATA_CONFIG_CORE_VERSION "1.6.1" +#define DATA_CONFIG_CORE_VERSION_NUMBER 10601 diff --git a/DataConfig/Source/DataConfigCore/Public/DataConfig/SerDe/DcSerDeCommon.h b/DataConfig/Source/DataConfigCore/Public/DataConfig/SerDe/DcSerDeCommon.h index ec816ac3..9cfeba23 100644 --- a/DataConfig/Source/DataConfigCore/Public/DataConfig/SerDe/DcSerDeCommon.h +++ b/DataConfig/Source/DataConfigCore/Public/DataConfig/SerDe/DcSerDeCommon.h @@ -2,6 +2,9 @@ #include "CoreMinimal.h" +#if !UE_VERSION_OLDER_THAN(5, 4, 0) +#include "Internationalization/ITextData.h" +#endif // !UE_VERSION_OLDER_THAN(5, 4, 0) namespace DcSerDeCommon { @@ -37,7 +40,11 @@ struct FMulticastScriptDelegateAccess : public FMulticastScriptDelegate struct FTextAccess { +#if UE_VERSION_OLDER_THAN(5, 4, 0) TSharedRef TextData; +#else + TRefCountPtr TextData; +#endif // !UE_VERSION_OLDER_THAN(5, 4, 0) uint32 Flags; }; diff --git a/Misc/Docs/Source/Advanced/UEUpgrades.md b/Misc/Docs/Source/Advanced/UEUpgrades.md index ad2e4295..8a9abd86 100644 --- a/Misc/Docs/Source/Advanced/UEUpgrades.md +++ b/Misc/Docs/Source/Advanced/UEUpgrades.md @@ -6,6 +6,7 @@ DataConfig is committed to support multiple UE versions with no deprecations and - New property `Optional` and `VValue` are added. We fully support `Optional` starting by adding `EDcDataEntry::OptionalRoot/OptionalEnd` and then evantually it works with all DataConfig APIs including JSON/MsgPack serialization and property builder. - `FObjectPtrProperty/FClassPtrProperty` are deprecated. It's introduced in 5.0 now removed and alias to `FObjectProperty/FClassProperty` respectively. - Defaults to MSVC `\W4` flag now which checks for unreachable code. It reports confusing locations and you can set `bUseUnity = false` in your `*.Build.cs` module rules to locate whereabout. +- `FText` internal pointer changed from `TSharedRef` to `TRefCountPtr`. # UE5.3 diff --git a/Misc/Docs/Source/Changes.md b/Misc/Docs/Source/Changes.md index f54dfa61..52ef6d7d 100644 --- a/Misc/Docs/Source/Changes.md +++ b/Misc/Docs/Source/Changes.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## 1.6.1 - 2024-4-28 + +- Fix compilation for UE 5.4. + ## 1.6.0 - 2024-3-31 - **BREAKING** Removed `PredicateIsUStruct`. Use struct handlers instead. @@ -29,7 +33,7 @@ All notable changes to this project will be documented in this file. - UE 5.4 support. - See [UE version upgrade 5.4](Advanced/UEUpgrades.md#ue54) - **NEW** Optional support. - - See [Optional](Extra/Optional.md) + - See [Optional](Advanced/Optional.md) ## 1.4.3 - 2023-8-27 diff --git a/Misc/Docs/book.toml b/Misc/Docs/book.toml index 0a80d80f..5354c914 100644 --- a/Misc/Docs/book.toml +++ b/Misc/Docs/book.toml @@ -21,5 +21,5 @@ RepoRoot = "https://github.com/slowburn-dev/DataConfig/tree/release/" # renamed fields [output.html.redirect] -"/Formats/PipeProperty.html" = "/Formats/Property.html" -"/Extra/Optional.html" = "/Advanced/Optional.html" +"/Formats/PipeProperty.html" = "./Formats/Property.html" +"/Extra/Optional.html" = "../Advanced/Optional.html"