From 38e7a0587325644b25ae80009e2782be79dca189 Mon Sep 17 00:00:00 2001 From: Lin Kmeanz <1908920+stlnkm@users.noreply.github.com> Date: Fri, 28 Jan 2022 09:57:05 +0800 Subject: [PATCH 1/4] Fix memory leak when serializing asset registry --- .../Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp b/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp index e3b9ccd6..4e404c66 100644 --- a/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp +++ b/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp @@ -1400,7 +1400,9 @@ bool UFlibHotPatcherCoreHelper::SerializeAssetRegistry(const FString& PlatformNa if(UFlibAssetManageHelper::GetSingleAssetsData(AssetPackagePath,*AssetData)) { State.AddAssetData(AssetData); + continue; } + delete AssetData; } // Create runtime registry data FArrayWriter SerializedAssetRegistry; From 9bcc6f2330294897f908cbfbaff362d84140ad0c Mon Sep 17 00:00:00 2001 From: Lin Kmeanz <1908920+stlnkm@users.noreply.github.com> Date: Fri, 28 Jan 2022 10:01:40 +0800 Subject: [PATCH 2/4] Fix issue #26: assertion failed at serializing asset registry when including redirectors --- .../Private/FlibHotPatcherCoreHelper.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp b/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp index 4e404c66..78507e30 100644 --- a/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp +++ b/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp @@ -1391,14 +1391,20 @@ bool UFlibHotPatcherCoreHelper::SerializeAssetRegistry(const FString& PlatformNa AssetRegistry.InitializeTemporaryAssetRegistryState(State, SaveOptions, true); for(const auto& AssetPackagePath:PackagePaths) { - if(State.GetAssetByObjectPath(FName(*AssetPackagePath))) + if (State.GetAssetByObjectPath(FName(*AssetPackagePath))) { - UE_LOG(LogHotPatcherCoreHelper,Warning,TEXT("%s Alway add to AssetRegistryState!"),*AssetPackagePath); + UE_LOG(LogHotPatcherCoreHelper, Warning, TEXT("%s already add to AssetRegistryState!"), *AssetPackagePath); continue; } FAssetData* AssetData = new FAssetData(); - if(UFlibAssetManageHelper::GetSingleAssetsData(AssetPackagePath,*AssetData)) + if (UFlibAssetManageHelper::GetSingleAssetsData(AssetPackagePath, *AssetData)) { + if (AssetPackagePath != AssetData->ObjectPath.ToString()) + { + UE_LOG(LogHotPatcherCoreHelper, Warning, TEXT("%s is a redirector of %s, skip!"), *AssetPackagePath, *AssetData->ObjectPath.ToString()); + delete AssetData; + continue; + } State.AddAssetData(AssetData); continue; } From 88d41a27d8f4166b7040ba92435863e605df1af9 Mon Sep 17 00:00:00 2001 From: hxhb Date: Wed, 9 Feb 2022 02:32:07 +0000 Subject: [PATCH 3/4] fix Info.IndexHash.Hash error in 4.23 --- HotPatcher/Source/HotPatcherRuntime/Private/FlibPakHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/FlibPakHelper.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/FlibPakHelper.cpp index 561ade72..8e881ca7 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/FlibPakHelper.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/FlibPakHelper.cpp @@ -404,7 +404,7 @@ bool PreLoadPak(const FString& InPakPath,const FString& AesKey) FSHAHash Hash; FMemory::Memcpy(Hash.Hash, -#if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 23 +#if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 23 Info.IndexHash.Hash, #else Info.IndexHash, From 950855786e399e8e5a4734c177a8854daf96ebbe Mon Sep 17 00:00:00 2001 From: hxhb Date: Wed, 9 Feb 2022 02:34:21 +0000 Subject: [PATCH 4/4] update patch version to 75.1 --- HotPatcher/Source/HotPatcherEditor/HotPatcherEditor.Build.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HotPatcher/Source/HotPatcherEditor/HotPatcherEditor.Build.cs b/HotPatcher/Source/HotPatcherEditor/HotPatcherEditor.Build.cs index 94ff4767..f501a536 100644 --- a/HotPatcher/Source/HotPatcherEditor/HotPatcherEditor.Build.cs +++ b/HotPatcher/Source/HotPatcherEditor/HotPatcherEditor.Build.cs @@ -97,7 +97,7 @@ public HotPatcherEditor(ReadOnlyTargetRules Target) : base(Target) "ENABLE_MULTI_COOKER=0", "TOOL_NAME=\"HotPatcher\"", "CURRENT_VERSION_ID=75", - "CURRENT_PATCH_ID=0", + "CURRENT_PATCH_ID=1", "REMOTE_VERSION_FILE=\"https://imzlp.com/opensource/version.json\"" });