├── .gitignore ├── .gitmodules ├── HotPatcher ├── HotPatcher.uplugin ├── Resources │ ├── ButtonIcon_40x.png │ ├── Icon128.png │ └── Payments │ │ ├── alipay.png │ │ └── wechatpay.png └── Source │ ├── BinariesPatchFeature │ ├── BinariesPatchFeature.Build.cs │ ├── Private │ │ └── BinariesPatchFeature.cpp │ └── Public │ │ └── BinariesPatchFeature.h │ ├── CmdHandler │ ├── CmdHandler.Build.cs │ ├── Private │ │ └── CmdHandler.cpp │ └── Public │ │ └── CmdHandler.h │ ├── HotPatcherCore │ ├── Classes │ │ └── Commandlets │ │ │ ├── CommandletHelper.cpp │ │ │ ├── Cooker │ │ │ ├── HotAssetScannerCommandlet.cpp │ │ │ ├── HotAssetScannerCommandlet.h │ │ │ ├── HotCookerCommandlet.cpp │ │ │ ├── HotCookerCommandlet.h │ │ │ ├── HotGlobalShaderCommandlet.cpp │ │ │ ├── HotGlobalShaderCommandlet.h │ │ │ ├── HotSingleCookerCommandlet.cpp │ │ │ └── HotSingleCookerCommandlet.h │ │ │ ├── HotPatcherCommandlet.cpp │ │ │ ├── HotPatcherCommandlet.h │ │ │ ├── HotPatcherCommandletBase.cpp │ │ │ ├── HotReleaseCommandlet.cpp │ │ │ └── HotReleaseCommandlet.h │ ├── HotPatcherCore.Build.cs │ ├── Private │ │ ├── Cooker │ │ │ ├── MultiCooker │ │ │ │ ├── FSingleCookerSettings.cpp │ │ │ │ ├── FlibHotCookerHelper.cpp │ │ │ │ └── SingleCookerProxy.cpp │ │ │ └── PackageWriter │ │ │ │ ├── HotPatcherPackageWriter.cpp │ │ │ │ └── HotPatcherPackageWriter.h │ │ ├── CreatePatch │ │ │ ├── PatcherProxy.cpp │ │ │ └── ReleaseProxy.cpp │ │ ├── FCountServerlessWrapper.cpp │ │ ├── FlibHotPatcherCoreHelper.cpp │ │ ├── HACK_PRIVATE_MEMBER_UTILS.hpp │ │ ├── HotPatcherCore.cpp │ │ ├── HotPatcherDelegates.cpp │ │ └── ShaderLibUtils │ │ │ ├── FCookShaderCollectionProxy.cpp │ │ │ └── FlibShaderCodeLibraryHelper.cpp │ └── Public │ │ ├── CommandletBase │ │ ├── CommandletHelper.h │ │ └── HotPatcherCommandletBase.h │ │ ├── Cooker │ │ ├── HotPatcherCookerSettingBase.h │ │ └── MultiCooker │ │ │ ├── FCookShaderCollectionProxy.h │ │ │ ├── FSingleCookerSettings.h │ │ │ ├── FlibHotCookerHelper.h │ │ │ └── SingleCookerProxy.h │ │ ├── CreatePatch │ │ ├── HotPatcherProxyBase.h │ │ ├── IPatchableInterface.h │ │ ├── PatcherProxy.h │ │ ├── ReleaseProxy.h │ │ └── ReleaseSettingsDetails.h │ │ ├── FCountServerlessWrapper.h │ │ ├── FlibHotPatcherCoreHelper.h │ │ ├── HotPatcherCore.h │ │ ├── HotPatcherDelegates.h │ │ ├── HotPatcherSettings.h │ │ ├── ShaderLibUtils │ │ └── FlibShaderCodeLibraryHelper.h │ │ └── ThreadUtils │ │ ├── FProcWorkerThread.hpp │ │ └── FThreadUtils.hpp │ ├── HotPatcherEditor │ ├── HotPatcherEditor.Build.cs │ ├── Private │ │ ├── Cooker │ │ │ ├── OriginalCooker │ │ │ │ ├── IOriginalCookerChildWidget.h │ │ │ │ ├── SHotPatcherCookMaps.cpp │ │ │ │ ├── SHotPatcherCookMaps.h │ │ │ │ ├── SHotPatcherCookSetting.cpp │ │ │ │ ├── SHotPatcherCookSetting.h │ │ │ │ ├── SHotPatcherCookSpecifyCookFilter.cpp │ │ │ │ ├── SHotPatcherCookSpecifyCookFilter.h │ │ │ │ ├── SHotPatcherCookedPlatforms.cpp │ │ │ │ ├── SHotPatcherCookedPlatforms.h │ │ │ │ ├── SHotPatcherPlatformListRow.h │ │ │ │ ├── SOriginalCookWidget.cpp │ │ │ │ ├── SOriginalCookWidget.h │ │ │ │ ├── SProjectCookMapListRow.h │ │ │ │ ├── SProjectCookSettingsListRow.h │ │ │ │ └── SpecifyCookFilterSetting.h │ │ │ ├── SCookersPage.cpp │ │ │ └── SCookersPage.h │ │ ├── CreatePatch │ │ │ ├── AssetActions │ │ │ │ ├── AssetTypeActions_PrimaryAssetLabel.cpp │ │ │ │ └── AssetTypeActions_PrimaryAssetLabel.h │ │ │ ├── ReleaseSettingsDetails.cpp │ │ │ ├── SHotPatcherInformations.cpp │ │ │ ├── SHotPatcherPatchWidget.cpp │ │ │ ├── SHotPatcherReleaseWidget.cpp │ │ │ └── SPatchersPage.cpp │ │ ├── FlibHotPatcherEditorHelper.cpp │ │ ├── HotPatcherActionManager.cpp │ │ ├── HotPatcherCommands.cpp │ │ ├── HotPatcherEditor.cpp │ │ ├── HotPatcherModBaseModule.cpp │ │ ├── HotPatcherStyle.cpp │ │ ├── MissionNotificationProxy.cpp │ │ ├── SHotPatcher.cpp │ │ ├── SHotPatcher.h │ │ ├── SHotPatcherPageBase.cpp │ │ ├── SHotPatcherWidgetBase.cpp │ │ └── SVersionUpdater │ │ │ ├── FVersionUpdaterManager.cpp │ │ │ ├── FVersionUpdaterManager.h │ │ │ ├── SVersionUpdaterWidget.cpp │ │ │ ├── SVersionUpdaterWidget.h │ │ │ ├── VersionUpdaterStyle.cpp │ │ │ └── VersionUpdaterStyle.h │ └── Public │ │ ├── Cooker │ │ └── SHotPatcherCookerBase.h │ │ ├── CreatePatch │ │ ├── SHotPatcherInformations.h │ │ ├── SHotPatcherPatchWidget.h │ │ ├── SHotPatcherReleaseWidget.h │ │ └── SPatchersPage.h │ │ ├── FlibHotPatcherEditorHelper.h │ │ ├── HotPatcherActionManager.h │ │ ├── HotPatcherCommands.h │ │ ├── HotPatcherEditor.h │ │ ├── HotPatcherModBaseModule.h │ │ ├── HotPatcherStyle.h │ │ ├── MissionNotificationProxy.h │ │ ├── Model │ │ ├── FCookersModeContext.h │ │ ├── FHotPatcherContextBase.h │ │ ├── FOriginalCookerContext.h │ │ └── FPatchersModeContext.h │ │ ├── SHotPatcherPageBase.h │ │ └── SHotPatcherWidgetBase.h │ └── HotPatcherRuntime │ ├── HotPatcherRuntime.Build.cs │ ├── Private │ ├── BaseTypes │ │ ├── AssetManager │ │ │ └── FAssetDependenciesInfo.cpp │ │ ├── FAssetScanConfig.cpp │ │ ├── FBinariesPatchConfig.cpp │ │ ├── FChunkInfo.cpp │ │ └── FExternFileInfo.cpp │ ├── CreatePatch │ │ ├── FExportPatchSettings.cpp │ │ ├── FExportReleaseSettings.cpp │ │ ├── HotPatcherContext.cpp │ │ └── HotPatcherSettingBase.cpp │ ├── DependenciesParser │ │ └── FDefaultAssetDependenciesParser.cpp │ ├── FlibAssetManageHelper.cpp │ ├── FlibPakHelper.cpp │ ├── FlibPakReader.cpp │ ├── FlibPatchParserHelper.cpp │ ├── FlibReflectionHelper.cpp │ ├── FlibShaderPipelineCacheHelper.cpp │ ├── HACK_PRIVATE_MEMBER_UTILS.hpp │ ├── HotPatcher.cpp │ ├── HotPatcherAssetManager.cpp │ ├── HotPatcherLog.cpp │ ├── MountListener.cpp │ ├── ReleaseParser │ │ ├── FReleasePakParser.cpp │ │ ├── FReleasePakParser.h │ │ ├── FReleasePaklistParser.cpp │ │ ├── FReleasePaklistParser.h │ │ └── IReleaseParser.h │ └── TargetPlatformRegister.cpp │ └── Public │ ├── BaseTypes │ ├── AssetManager │ │ ├── FAssetDependenciesDetail.h │ │ ├── FAssetDependenciesInfo.h │ │ ├── FAssetDetail.h │ │ └── FFileArrayDirectoryVisitor.hpp │ ├── AssetRegistry.h │ ├── BaseTypes.h │ ├── EPatcherPhase.h │ ├── ETargetPlatform.h │ ├── FAssetRegistryOptions.h │ ├── FAssetScanConfig.h │ ├── FBinariesPatchConfig.h │ ├── FChunkInfo.h │ ├── FCookShaderOptions.h │ ├── FCookerConfig.h │ ├── FExternDirectoryInfo.h │ ├── FExternFileInfo.h │ ├── FHotPatcherAssetDependency.h │ ├── FHotPatcherVersion.h │ ├── FIoStoreSettings.h │ ├── FPackageTracker.h │ ├── FPakEncryptionKeys.h │ ├── FPakFileInfo.h │ ├── FPakVersion.h │ ├── FPatchVersionAssetDiff.h │ ├── FPatchVersionDiff.h │ ├── FPatchVersionExternDiff.h │ ├── FPatcherSpecifyAsset.h │ ├── FPlatformBasePak.h │ ├── FPlatformExternAssets.h │ ├── FPlatformExternFiles.h │ ├── FReplaceText.h │ ├── FUnrealPakSettings.h │ ├── FlibPakHelper.h │ ├── FlibPakReader.h │ └── HotPatcherBaseTypes.h │ ├── CreatePatch │ ├── FExportPatchSettings.h │ ├── FExportReleaseSettings.h │ ├── HotPatcherContext.h │ ├── HotPatcherSettingBase.h │ ├── ScopedSlowTaskContext.h │ └── TimeRecorder.h │ ├── DependenciesParser │ ├── FDefaultAssetDependenciesParser.h │ └── IAssetDependenciesParser.h │ ├── FlibAssetManageHelper.h │ ├── FlibPatchParserHelper.h │ ├── FlibReflectionHelper.h │ ├── FlibShaderPipelineCacheHelper.h │ ├── HotPatcherAssetManager.h │ ├── HotPatcherLog.h │ ├── HotPatcherRuntime.h │ ├── MountListener.h │ ├── TargetPlatformRegister.h │ └── Templates │ └── HotPatcherTemplateHelper.hpp ├── LICENSE ├── README.md └── README_EN.md /.gitignore: -------------------------------------------------------------------------------- 1 | Binaries 2 | DerivedDataCache 3 | Intermediate 4 | Saved 5 | Content/Test/ 6 | .vs 7 | .vscode 8 | 9 | *.lnk 10 | *.VC.db 11 | *.opensdf 12 | *.opendb 13 | *.sdf 14 | *.sln 15 | *.suo 16 | *.xcodeproj 17 | *.xcworkspace 18 | UpdateProject.bat -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Mods/HotMultiCooker"] 2 | path = Mods/HotMultiCooker 3 | url = git@github.com:hxhb/HotMultiCooker.git 4 | [submodule "Mods/RemakePak"] 5 | path = Mods/RemakePak 6 | url = git@github.com:hxhb/RemakePak.git 7 | [submodule "Mods/libzstd"] 8 | path = Mods/libzstd 9 | url = git@github.com:hxhb/ue-zstd.git 10 | [submodule "Mods/HotChunker"] 11 | path = Mods/HotChunker 12 | url = git@github.com:hxhb/HotChunker.git 13 | [submodule "Mods/HDiffPatchUE"] 14 | path = Mods/HDiffPatchUE 15 | url = git@github.com:hxhb/HDiffPatchUE.git 16 | [submodule "Mods/GameFeaturePacker"] 17 | path = Mods/GameFeaturePacker 18 | url = git@github.com:hxhb/GameFeaturePacker.git 19 | [submodule "Mods/ShaderPatcherUE"] 20 | path = Mods/ShaderPatcherUE 21 | url = git@github.com:hxhb/ShaderPatcherUE.git 22 | [submodule "Mods/PakAnalyzerUE"] 23 | path = Mods/PakAnalyzerUE 24 | url = git@github.com:hxhb/PakAnalyzerUE.git 25 | [submodule "Mods/PSOPackerUE"] 26 | path = Mods/PSOPackerUE 27 | url = git@github.com:hxhb/PSOPackerUE.git 28 | -------------------------------------------------------------------------------- /HotPatcher/HotPatcher.uplugin: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "Version": 1, 4 | "VersionName": "1.0", 5 | "FriendlyName": "HotPatcher", 6 | "Description": "", 7 | "Category": "HotPatcher", 8 | "CreatedBy": "imzlp", 9 | "CreatedByURL": "https://imzlp.com/", 10 | "DocsURL": "https://imzlp.com/posts/17590/", 11 | "MarketplaceURL": "", 12 | "SupportURL": "", 13 | "CanContainContent": true, 14 | "IsBetaVersion": false, 15 | "IsExperimentalVersion": false, 16 | "Installed": false, 17 | "Modules": [ 18 | { 19 | "Name": "HotPatcherEditor", 20 | "Type": "Editor", 21 | "LoadingPhase": "Default" 22 | }, 23 | { 24 | "Name": "HotPatcherCore", 25 | "Type": "Editor", 26 | "LoadingPhase": "PreDefault" 27 | }, 28 | { 29 | "Name": "HotPatcherRuntime", 30 | "Type": "Runtime", 31 | "LoadingPhase": "PreDefault" 32 | }, 33 | { 34 | "Name": "BinariesPatchFeature", 35 | "Type": "Runtime", 36 | "LoadingPhase": "PreDefault" 37 | }, 38 | { 39 | "Name": "CmdHandler", 40 | "Type": "Developer", 41 | "LoadingPhase": "PostConfigInit" 42 | } 43 | ] 44 | } -------------------------------------------------------------------------------- /HotPatcher/Resources/ButtonIcon_40x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hxhb/HotPatcher/2c06c58efe4c028e8e6e5a8423f93c2ba1024790/HotPatcher/Resources/ButtonIcon_40x.png -------------------------------------------------------------------------------- /HotPatcher/Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hxhb/HotPatcher/2c06c58efe4c028e8e6e5a8423f93c2ba1024790/HotPatcher/Resources/Icon128.png -------------------------------------------------------------------------------- /HotPatcher/Resources/Payments/alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hxhb/HotPatcher/2c06c58efe4c028e8e6e5a8423f93c2ba1024790/HotPatcher/Resources/Payments/alipay.png -------------------------------------------------------------------------------- /HotPatcher/Resources/Payments/wechatpay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hxhb/HotPatcher/2c06c58efe4c028e8e6e5a8423f93c2ba1024790/HotPatcher/Resources/Payments/wechatpay.png -------------------------------------------------------------------------------- /HotPatcher/Source/BinariesPatchFeature/BinariesPatchFeature.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using System; 4 | using System.IO; 5 | using UnrealBuildTool; 6 | 7 | public class BinariesPatchFeature : ModuleRules 8 | { 9 | public BinariesPatchFeature(ReadOnlyTargetRules Target) : base(Target) 10 | { 11 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 12 | 13 | PublicIncludePaths.AddRange( 14 | new string[] { 15 | Path.Combine(EngineDirectory,"Source/Runtime/Launch"), 16 | Path.Combine(ModuleDirectory,"Public"), 17 | Path.Combine(ModuleDirectory,"../HotPatcherRuntime/Public/Templates") 18 | // ... add public include paths required here ... 19 | } 20 | ); 21 | 22 | PublicDependencyModuleNames.AddRange( 23 | new string[] 24 | { 25 | "Core", 26 | "CoreUObject", 27 | "Engine", 28 | "Projects", 29 | "Json", 30 | "JsonUtilities", 31 | // ... add other public dependencies that you statically link with here ... 32 | } 33 | ); 34 | bLegacyPublicIncludePaths = false; 35 | OptimizeCode = CodeOptimization.InShippingBuildsOnly; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /HotPatcher/Source/BinariesPatchFeature/Private/BinariesPatchFeature.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "BinariesPatchFeature.h" 4 | #include "HotPatcherTemplateHelper.hpp" 5 | 6 | #include "Resources/Version.h" 7 | #include "Features/IModularFeatures.h" 8 | #include "Misc/EnumRange.h" 9 | #include "Modules/ModuleManager.h" 10 | #include "UObject/Class.h" 11 | 12 | DECAL_GETCPPTYPENAME_SPECIAL(EBinariesPatchFeature) 13 | 14 | void OnBinariesModularFeatureRegistered(const FName& Type, IModularFeature* ModularFeature) 15 | { 16 | if(!Type.ToString().Equals(BINARIES_DIFF_PATCH_FEATURE_NAME,ESearchCase::IgnoreCase)) 17 | return; 18 | IBinariesDiffPatchFeature* Feature = static_cast(ModularFeature); 19 | THotPatcherTemplateHelper::AppendEnumeraters(TArray{Feature->GetFeatureName()}); 20 | } 21 | void OnBinariesModularFeatureUnRegistered(const FName& Type, IModularFeature* ModularFeature) 22 | { 23 | 24 | } 25 | 26 | void FBinariesPatchFeatureModule::StartupModule() 27 | { 28 | TArray RegistedFeatures = IModularFeatures::Get().GetModularFeatureImplementations(BINARIES_DIFF_PATCH_FEATURE_NAME); 29 | for(const auto& Featue:RegistedFeatures) 30 | { 31 | THotPatcherTemplateHelper::AppendEnumeraters(TArray{Featue->GetFeatureName()}); 32 | } 33 | IModularFeatures::Get().OnModularFeatureRegistered().AddStatic(&OnBinariesModularFeatureRegistered); 34 | IModularFeatures::Get().OnModularFeatureUnregistered().AddStatic(&OnBinariesModularFeatureUnRegistered); 35 | } 36 | 37 | void FBinariesPatchFeatureModule::ShutdownModule() 38 | { 39 | 40 | } 41 | 42 | IMPLEMENT_MODULE( FBinariesPatchFeatureModule, BinariesPatchFeature ); 43 | -------------------------------------------------------------------------------- /HotPatcher/Source/BinariesPatchFeature/Public/BinariesPatchFeature.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Features/IModularFeature.h" 5 | #include "CoreMinimal.h" 6 | #include "Modules/ModuleManager.h" 7 | #include "Misc/EnumRange.h" 8 | #include "BinariesPatchFeature.generated.h" 9 | 10 | #define BINARIES_DIFF_PATCH_FEATURE_NAME TEXT("BinariesDiffPatchFeatures") 11 | 12 | UENUM(BlueprintType) 13 | enum class EBinariesPatchFeature:uint8 14 | { 15 | None, 16 | Count UMETA(Hidden) 17 | }; 18 | ENUM_RANGE_BY_COUNT(EBinariesPatchFeature, EBinariesPatchFeature::Count); 19 | 20 | struct IBinariesDiffPatchFeature: public IModularFeature 21 | { 22 | virtual ~IBinariesDiffPatchFeature(){}; 23 | virtual bool CreateDiff(const TArray& NewData, const TArray& OldData, TArray& OutPatch) = 0; 24 | virtual bool PatchDiff(const TArray& OldData, const TArray& PatchData, TArray& OutNewData) = 0; 25 | virtual FString GetFeatureName()const = 0; 26 | }; 27 | 28 | class FBinariesPatchFeatureModule : public IModuleInterface 29 | { 30 | public: 31 | virtual void StartupModule() override; 32 | virtual void ShutdownModule() override; 33 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/CmdHandler/CmdHandler.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | 8 | public class CmdHandler : ModuleRules 9 | { 10 | public CmdHandler(ReadOnlyTargetRules Target) : base(Target) 11 | { 12 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 13 | bLegacyPublicIncludePaths = false; 14 | OptimizeCode = CodeOptimization.InShippingBuildsOnly; 15 | 16 | PublicIncludePaths.AddRange( 17 | new string[] { 18 | // ... add public include paths required here ... 19 | } 20 | ); 21 | 22 | 23 | PrivateIncludePaths.AddRange( 24 | new string[] { 25 | // ... add other private include paths required here ... 26 | } 27 | ); 28 | 29 | 30 | PublicDependencyModuleNames.AddRange( 31 | new string[] 32 | { 33 | "Core", 34 | "Json", 35 | "SandboxFile", 36 | "JsonUtilities", 37 | // ... add other public dependencies that you statically link with here ... 38 | } 39 | ); 40 | 41 | PrivateDependencyModuleNames.AddRange( 42 | new string[] 43 | { 44 | "InputCore", 45 | "CoreUObject", 46 | "Engine", 47 | // ... add private dependencies that you statically link with here ... 48 | } 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /HotPatcher/Source/CmdHandler/Public/CmdHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | // engine header 6 | #include "CoreMinimal.h" 7 | #include "Modules/ModuleInterface.h" 8 | 9 | DECLARE_LOG_CATEGORY_EXTERN(LogCmdHandler,All,All); 10 | 11 | class FCmdHandlerModule : public IModuleInterface 12 | { 13 | public: 14 | static FCmdHandlerModule& Get(); 15 | /** IModuleInterface implementation */ 16 | virtual void StartupModule() override; 17 | virtual void ShutdownModule() override; 18 | }; 19 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotAssetScannerCommandlet.cpp: -------------------------------------------------------------------------------- 1 | #include "HotAssetScannerCommandlet.h" 2 | #include "CommandletHelper.h" 3 | // engine header 4 | #include "CoreMinimal.h" 5 | #include "FlibPatchParserHelper.h" 6 | #include "Async/ParallelFor.h" 7 | #include "Misc/FileHelper.h" 8 | #include "Misc/CommandLine.h" 9 | #include "Misc/Paths.h" 10 | #include "BaseTypes/FPackageTracker.h" 11 | DEFINE_LOG_CATEGORY(LogHotAssetScannerCommandlet); 12 | 13 | 14 | int32 UHotAssetScannerCommandlet::Main(const FString& Params) 15 | { 16 | SCOPED_NAMED_EVENT_TEXT("UHotAssetScannerCommandlet::Main",FColor::Red); 17 | Super::Main(Params); 18 | 19 | UE_LOG(LogHotAssetScannerCommandlet, Display, TEXT("UHotAssetScannerCommandlet::Main")); 20 | 21 | FString config_path; 22 | bool bStatus = FParse::Value(*Params, *FString(PATCHER_CONFIG_PARAM_NAME).ToLower(), config_path); 23 | if (!bStatus) 24 | { 25 | UE_LOG(LogHotAssetScannerCommandlet, Warning, TEXT("not -config=xxxx.json params.")); 26 | return -1; 27 | } 28 | 29 | if (bStatus && !FPaths::FileExists(config_path)) 30 | { 31 | UE_LOG(LogHotAssetScannerCommandlet, Error, TEXT("cofnig file %s not exists."), *config_path); 32 | return -1; 33 | } 34 | 35 | if(IsRunningCommandlet()) 36 | { 37 | // load asset registry 38 | FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); 39 | AssetRegistryModule.Get().SearchAllAssets(true); 40 | } 41 | 42 | 43 | 44 | TSharedPtr AssetScanConfig = MakeShareable(new FAssetScanConfig); 45 | 46 | FString JsonContent; 47 | if (FPaths::FileExists(config_path) && FFileHelper::LoadFileToString(JsonContent, *config_path)) 48 | { 49 | THotPatcherTemplateHelper::TDeserializeJsonStringAsStruct(JsonContent,*AssetScanConfig); 50 | } 51 | 52 | TMap KeyValues = THotPatcherTemplateHelper::GetCommandLineParamsMap(Params); 53 | THotPatcherTemplateHelper::ReplaceProperty(*AssetScanConfig, KeyValues); 54 | 55 | FString FinalConfig; 56 | THotPatcherTemplateHelper::TSerializeStructAsJsonString(*AssetScanConfig,FinalConfig); 57 | UE_LOG(LogHotAssetScannerCommandlet, Display, TEXT("%s"), *FinalConfig); 58 | 59 | FHotPatcherVersion CurrentVersion; 60 | { 61 | CurrentVersion.VersionId = TEXT("HotAssetScanner"); 62 | CurrentVersion.Date = FDateTime::UtcNow().ToString(); 63 | CurrentVersion.BaseVersionId = TEXT(""); 64 | UFlibPatchParserHelper::RunAssetScanner(*AssetScanConfig,CurrentVersion); 65 | } 66 | 67 | FString SearchResult; 68 | FString SaveSearchResultPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::ProjectSavedDir(),FString::Printf(TEXT("HotPatcher/MultiCooker/%s/SearchCookerAssets.json"),FApp::GetProjectName()))); 69 | if(THotPatcherTemplateHelper::TSerializeStructAsJsonString(CurrentVersion,SearchResult)) 70 | { 71 | FFileHelper::SaveStringToFile(SearchResult,*SaveSearchResultPath); 72 | } 73 | 74 | UE_LOG(LogHotAssetScannerCommandlet,Display,TEXT("HotAssetScanner Misstion is Finished!")); 75 | 76 | if(FParse::Param(FCommandLine::Get(), TEXT("wait"))) 77 | { 78 | system("pause"); 79 | } 80 | 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotAssetScannerCommandlet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HotPatcherCommandletBase.h" 4 | #include "Commandlets/Commandlet.h" 5 | #include "HotAssetScannerCommandlet.generated.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogHotAssetScannerCommandlet, All, All); 8 | 9 | UCLASS() 10 | class UHotAssetScannerCommandlet :public UHotPatcherCommandletBase 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | virtual int32 Main(const FString& Params)override; 16 | virtual FString GetCmdletName()const override{ return TEXT("AssetScannerCmdlet"); } 17 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotCookerCommandlet.cpp: -------------------------------------------------------------------------------- 1 | #include "HotCookerCommandlet.h" 2 | #include "ThreadUtils/FProcWorkerThread.hpp" 3 | #include "FCookerConfig.h" 4 | #include "FlibPatchParserHelper.h" 5 | #include "CommandletBase/CommandletHelper.h" 6 | 7 | // / engine header 8 | #include "CoreMinimal.h" 9 | #include "HotPatcherCore.h" 10 | #include "Misc/FileHelper.h" 11 | #include "Misc/CommandLine.h" 12 | #include "Kismet/KismetSystemLibrary.h" 13 | #include "Misc/Paths.h" 14 | 15 | #define COOKER_CONFIG_PARAM_NAME TEXT("-config=") 16 | 17 | DEFINE_LOG_CATEGORY(LogHotCookerCommandlet); 18 | 19 | TSharedPtr CookerProc; 20 | 21 | int32 UHotCookerCommandlet::Main(const FString& Params) 22 | { 23 | Super::Main(Params); 24 | UE_LOG(LogHotCookerCommandlet, Display, TEXT("UHotCookerCommandlet::Main")); 25 | FString config_path; 26 | bool bStatus = FParse::Value(*Params, *FString(COOKER_CONFIG_PARAM_NAME).ToLower(), config_path); 27 | if (!bStatus) 28 | { 29 | UE_LOG(LogHotCookerCommandlet, Error, TEXT("not -config=xxxx.json params.")); 30 | return -1; 31 | } 32 | 33 | if (!FPaths::FileExists(config_path)) 34 | { 35 | UE_LOG(LogHotCookerCommandlet, Error, TEXT("cofnig file %s not exists."), *config_path); 36 | return -1; 37 | } 38 | 39 | FString JsonContent; 40 | if (FFileHelper::LoadFileToString(JsonContent, *config_path)) 41 | { 42 | UE_LOG(LogHotCookerCommandlet, Display, TEXT("%s"), *JsonContent); 43 | FCookerConfig CookConfig; 44 | THotPatcherTemplateHelper::TDeserializeJsonStringAsStruct(JsonContent,CookConfig); 45 | 46 | TMap KeyValues = THotPatcherTemplateHelper::GetCommandLineParamsMap(Params); 47 | THotPatcherTemplateHelper::ReplaceProperty(CookConfig, KeyValues); 48 | 49 | if (CookConfig.bCookAllMap) 50 | { 51 | CookConfig.CookMaps = UFlibPatchParserHelper::GetAvailableMaps(UKismetSystemLibrary::GetProjectDirectory(), ENABLE_COOK_ENGINE_MAP, ENABLE_COOK_PLUGIN_MAP, true); 52 | } 53 | FString CookCommand; 54 | UFlibPatchParserHelper::GetCookProcCommandParams(CookConfig, CookCommand); 55 | 56 | UE_LOG(LogHotCookerCommandlet, Display, TEXT("CookCommand:%s %s"), *CookConfig.EngineBin,*CookCommand); 57 | 58 | if (FPaths::FileExists(CookConfig.EngineBin) && FPaths::FileExists(CookConfig.ProjectPath)) 59 | { 60 | CookerProc = MakeShareable(new FProcWorkerThread(TEXT("CookThread"), CookConfig.EngineBin, CookCommand)); 61 | CookerProc->ProcOutputMsgDelegate.BindStatic(&::ReceiveOutputMsg); 62 | 63 | CookerProc->Execute(); 64 | CookerProc->Join(); 65 | } 66 | } 67 | if(FParse::Param(FCommandLine::Get(), TEXT("wait"))) 68 | { 69 | system("pause"); 70 | } 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotCookerCommandlet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Commandlets/Commandlet.h" 4 | #include "CommandletBase/HotPatcherCommandletBase.h" 5 | #include "HotCookerCommandlet.generated.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogHotCookerCommandlet, Log, All); 8 | 9 | UCLASS() 10 | class UHotCookerCommandlet :public UHotPatcherCommandletBase 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | 16 | virtual int32 Main(const FString& Params)override; 17 | virtual FString GetCmdletName()const override{ return TEXT("OriginalCookerCmdlet"); } 18 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotGlobalShaderCommandlet.cpp: -------------------------------------------------------------------------------- 1 | #include "HotGlobalShaderCommandlet.h" 2 | #include "CommandletHelper.h" 3 | // engine header 4 | #include "CoreMinimal.h" 5 | #include "FlibHotPatcherCoreHelper.h" 6 | #include "Async/ParallelFor.h" 7 | #include "Cooker/MultiCooker/FlibHotCookerHelper.h" 8 | #include "Kismet/KismetStringLibrary.h" 9 | #include "Misc/FileHelper.h" 10 | #include "Misc/CommandLine.h" 11 | #include "Misc/Paths.h" 12 | #include "ShaderLibUtils/FlibShaderCodeLibraryHelper.h" 13 | 14 | #define PLATFORMS_PARAM_NAME TEXT("-platforms=") 15 | #define SAVETO_PARAM_NAME TEXT("-saveto=") 16 | 17 | DEFINE_LOG_CATEGORY(LogHotGlobalShaderCommandlet); 18 | 19 | int32 UHotGlobalShaderCommandlet::Main(const FString& Params) 20 | { 21 | SCOPED_NAMED_EVENT_TEXT("UHotGlobalShaderCommandlet::Main",FColor::Red); 22 | Super::Main(Params); 23 | 24 | UE_LOG(LogHotGlobalShaderCommandlet, Display, TEXT("UHotGlobalShaderCommandlet::Main")); 25 | 26 | FString PlatformNameStr; 27 | bool bStatus = FParse::Value(*Params, *FString(PLATFORMS_PARAM_NAME).ToLower(), PlatformNameStr); 28 | if (!bStatus) 29 | { 30 | UE_LOG(LogHotGlobalShaderCommandlet, Warning, TEXT("not -platforms=Android_ASTC+IOS params.")); 31 | return -1; 32 | } 33 | 34 | FString SaveShaderToDir; 35 | if (!FParse::Value(*Params, *FString(SAVETO_PARAM_NAME).ToLower(), SaveShaderToDir)) 36 | { 37 | SaveShaderToDir = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::ProjectSavedDir(),TEXT("Cooked"))); 38 | } 39 | 40 | TArray PlatformNames = UKismetStringLibrary::ParseIntoArray(PlatformNameStr,TEXT("+"),false); 41 | TArray Platforms; 42 | for(const auto& PlatformName:PlatformNames) 43 | { 44 | ETargetPlatform Platform; 45 | if(THotPatcherTemplateHelper::GetEnumValueByName(PlatformName,Platform)) 46 | { 47 | Platforms.AddUnique(Platform); 48 | } 49 | } 50 | 51 | UE_LOG(LogHotGlobalShaderCommandlet,Display,TEXT("Compile Global Shader for %s, save to %s"),*PlatformNameStr,*SaveShaderToDir); 52 | 53 | { 54 | SCOPED_NAMED_EVENT_TEXT("Compile Global Shader",FColor::Red); 55 | FString Name = TEXT("Global"); 56 | auto GlobalShaderCollectionProxy = UFlibHotCookerHelper::CreateCookShaderCollectionProxyByPlatform( 57 | Name, 58 | Platforms, 59 | true, 60 | true, 61 | true, 62 | SaveShaderToDir, 63 | true 64 | ); 65 | if(GlobalShaderCollectionProxy.IsValid()) 66 | { 67 | GlobalShaderCollectionProxy->Init(); 68 | } 69 | // compile Global Shader 70 | UFlibHotPatcherCoreHelper::SaveGlobalShaderMapFiles(UFlibHotPatcherCoreHelper::GetTargetPlatformsByNames(Platforms),SaveShaderToDir); 71 | 72 | UFlibShaderCodeLibraryHelper::WaitShaderCompilingComplete(); 73 | UFlibHotPatcherCoreHelper::WaitForAsyncFileWrites(); 74 | if(GlobalShaderCollectionProxy.IsValid()) 75 | { 76 | GlobalShaderCollectionProxy->Shutdown(); 77 | } 78 | } 79 | 80 | UE_LOG(LogHotGlobalShaderCommandlet,Display,TEXT("HotGlobalShader Misstion is Finished!")); 81 | 82 | if(FParse::Param(FCommandLine::Get(), TEXT("wait"))) 83 | { 84 | system("pause"); 85 | } 86 | 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotGlobalShaderCommandlet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HotPatcherCommandletBase.h" 4 | #include "Commandlets/Commandlet.h" 5 | #include "HotGlobalShaderCommandlet.generated.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogHotGlobalShaderCommandlet, All, All); 8 | 9 | UCLASS() 10 | class UHotGlobalShaderCommandlet :public UHotPatcherCommandletBase 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | virtual int32 Main(const FString& Params)override; 16 | virtual FString GetCmdletName()const override{ return TEXT("GlobalShaderCmdlet"); } 17 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotSingleCookerCommandlet.cpp: -------------------------------------------------------------------------------- 1 | #include "HotSingleCookerCommandlet.h" 2 | #include "CommandletBase/CommandletHelper.h" 3 | #include "HotPatcherCore.h" 4 | // engine header 5 | #include "CoreMinimal.h" 6 | #include "Cooker/MultiCooker/FSingleCookerSettings.h" 7 | #include "Cooker/MultiCooker/SingleCookerProxy.h" 8 | #include "HAL/ExceptionHandling.h" 9 | #include "Misc/FileHelper.h" 10 | #include "Misc/CommandLine.h" 11 | #include "Misc/Paths.h" 12 | 13 | DEFINE_LOG_CATEGORY(LogHotSingleCookerCommandlet); 14 | 15 | int32 UHotSingleCookerCommandlet::Main(const FString& Params) 16 | { 17 | Super::Main(Params); 18 | SCOPED_NAMED_EVENT_TEXT("UHotSingleCookerCommandlet::Main",FColor::Red); 19 | 20 | UE_LOG(LogHotSingleCookerCommandlet, Display, TEXT("UHotSingleCookerCommandlet::Main")); 21 | 22 | if(CmdConfigPath.IsEmpty()) 23 | { 24 | return -1; 25 | } 26 | 27 | ExportSingleCookerSetting = MakeShareable(new FSingleCookerSettings); 28 | 29 | FString JsonContent; 30 | if (FPaths::FileExists(CmdConfigPath) && FFileHelper::LoadFileToString(JsonContent, *CmdConfigPath)) 31 | { 32 | THotPatcherTemplateHelper::TDeserializeJsonStringAsStruct(JsonContent,*ExportSingleCookerSetting); 33 | } 34 | 35 | bool bExportStatus = false; 36 | { 37 | FScopedNamedEventStatic ScopedNamedEvent_ForCooker(FColor::Blue,*ExportSingleCookerSetting->MissionName); 38 | TMap KeyValues = THotPatcherTemplateHelper::GetCommandLineParamsMap(Params); 39 | THotPatcherTemplateHelper::ReplaceProperty(*ExportSingleCookerSetting, KeyValues); 40 | 41 | CommandletHelper::ModifyTargetPlatforms(Params,TARGET_PLATFORMS_OVERRIDE,ExportSingleCookerSetting->CookTargetPlatforms,true); 42 | if(ExportSingleCookerSetting->bDisplayConfig) 43 | { 44 | FString FinalConfig; 45 | THotPatcherTemplateHelper::TSerializeStructAsJsonString(*ExportSingleCookerSetting,FinalConfig); 46 | } 47 | 48 | // if(IsRunningCommandlet() && ExportSingleCookerSetting->bPackageTracker && ExportSingleCookerSetting->bCookPackageTrackerAssets) 49 | // { 50 | // SCOPED_NAMED_EVENT_TEXT("SearchAllAssets",FColor::Red); 51 | // // load asset registry 52 | // FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); 53 | // AssetRegistryModule.Get().SearchAllAssets(true); 54 | // } 55 | 56 | UE_LOG(LogHotSingleCookerCommandlet, Display, TEXT("Cooker %s Id %d,Assets Num %d"), *ExportSingleCookerSetting->MissionName,ExportSingleCookerSetting->MissionID,ExportSingleCookerSetting->CookAssets.Num()); 57 | // for pre additional worker 58 | if(ExportSingleCookerSetting->bAllowRegisteAdditionalWorker) 59 | { 60 | FHotPatcherCoreModule::Get().GetSingleCookerAdditionalPreWorkerRegister().Broadcast(ExportSingleCookerSetting); 61 | GEngine->ForceGarbageCollection(false); 62 | CollectGarbage(RF_NoFlags, false); 63 | } 64 | GAlwaysReportCrash = false; 65 | USingleCookerProxy* SingleCookerProxy = NewObject(); 66 | SingleCookerProxy->AddToRoot(); 67 | SingleCookerProxy->Init(ExportSingleCookerSetting.Get()); 68 | bExportStatus = SingleCookerProxy->DoExport(); 69 | 70 | CommandletHelper::MainTick([SingleCookerProxy]()->bool 71 | { 72 | return SingleCookerProxy->IsFinsihed(); 73 | }); 74 | 75 | SingleCookerProxy->Shutdown(); 76 | UE_LOG(LogHotSingleCookerCommandlet,Display,TEXT("Single Cook Mission %s %d is %s!"),*ExportSingleCookerSetting->MissionName,ExportSingleCookerSetting->MissionID,bExportStatus?TEXT("Successed"):TEXT("Failure")); 77 | 78 | // for post additional worker 79 | if(ExportSingleCookerSetting->bAllowRegisteAdditionalWorker) 80 | { 81 | FHotPatcherCoreModule::Get().GetSingleCookerAdditionalPostWorkerRegister().Broadcast(ExportSingleCookerSetting); 82 | GEngine->ForceGarbageCollection(false); 83 | CollectGarbage(RF_NoFlags, false); 84 | } 85 | } 86 | 87 | if(FParse::Param(FCommandLine::Get(), TEXT("wait"))) 88 | { 89 | system("pause"); 90 | } 91 | 92 | return bExportStatus ? 0 : -1; 93 | } -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/Cooker/HotSingleCookerCommandlet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Commandlets/Commandlet.h" 4 | #include "CommandletBase/HotPatcherCommandletBase.h" 5 | #include "Cooker/MultiCooker/FSingleCookerSettings.h" 6 | #include "HotSingleCookerCommandlet.generated.h" 7 | 8 | DECLARE_LOG_CATEGORY_EXTERN(LogHotSingleCookerCommandlet, All, All); 9 | 10 | UCLASS() 11 | class UHotSingleCookerCommandlet :public UHotPatcherCommandletBase 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | 17 | virtual int32 Main(const FString& Params)override; 18 | virtual FString GetCmdletName()const override 19 | { 20 | FString Result = TEXT("SingleCookerCmdlet"); 21 | if(ExportSingleCookerSetting.IsValid()) 22 | { 23 | Result = FString::Printf(TEXT("%s_%s"),*Result,*ExportSingleCookerSetting.Get()->MissionName); 24 | } 25 | return Result; 26 | } 27 | protected: 28 | TSharedPtr ExportSingleCookerSetting; 29 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/HotPatcherCommandlet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HotPatcherCommandletBase.h" 4 | #include "Commandlets/Commandlet.h" 5 | #include "HotPatcherCommandlet.generated.h" 6 | 7 | // DECLARE_LOG_CATEGORY_EXTERN(LogHotPatcherCommandlet, All, All); 8 | 9 | UCLASS() 10 | class UHotPatcherCommandlet :public UHotPatcherCommandletBase 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | 16 | virtual int32 Main(const FString& Params)override; 17 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Classes/Commandlets/HotReleaseCommandlet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "HotPatcherCommandletBase.h" 3 | #include "Commandlets/Commandlet.h" 4 | #include "HotReleaseCommandlet.generated.h" 5 | 6 | DECLARE_LOG_CATEGORY_EXTERN(LogHotReleaseCommandlet, All, All); 7 | 8 | UCLASS() 9 | class UHotReleaseCommandlet :public UHotPatcherCommandletBase 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | 15 | virtual int32 Main(const FString& Params)override; 16 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Private/Cooker/MultiCooker/FSingleCookerSettings.cpp: -------------------------------------------------------------------------------- 1 | #include "Cooker/MultiCooker/FSingleCookerSettings.h" 2 | #include "FlibPatchParserHelper.h" 3 | 4 | FSingleCookerSettings::FSingleCookerSettings() 5 | { 6 | OverrideNumberOfAssetsPerFrame.Add(UWorld::StaticClass(),2); 7 | } 8 | 9 | FString FSingleCookerSettings::GetStorageCookedAbsDir() const 10 | { 11 | return UFlibPatchParserHelper::ReplaceMark(StorageCookedDir); 12 | } 13 | 14 | FString FSingleCookerSettings::GetStorageMetadataAbsDir() const 15 | { 16 | return UFlibPatchParserHelper::ReplaceMark(StorageMetadataDir); 17 | } 18 | 19 | bool FSingleCookerSettings::IsSkipAsset(const FString& PackageName) 20 | { 21 | bool bRet = false; 22 | for(const auto& SkipCookContent:SkipCookContents) 23 | { 24 | if(PackageName.StartsWith(SkipCookContent)) 25 | { 26 | bRet = true; 27 | break; 28 | } 29 | } 30 | return bRet; 31 | } 32 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Private/Cooker/MultiCooker/FlibHotCookerHelper.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | 4 | #include "Cooker/MultiCooker/FlibHotCookerHelper.h" 5 | 6 | #include "FlibHotPatcherCoreHelper.h" 7 | #include "FlibPatchParserHelper.h" 8 | #include "Cooker/MultiCooker/FCookShaderCollectionProxy.h" 9 | #include "Interfaces/IPluginManager.h" 10 | #include "ShaderLibUtils/FlibShaderCodeLibraryHelper.h" 11 | 12 | // FString UFlibHotCookerHelper::GetMultiCookerBaseDir() 13 | // { 14 | // FString SaveConfigTo = FPaths::ConvertRelativePathToFull( 15 | // FPaths::Combine( 16 | // FPaths::ProjectSavedDir(), 17 | // TEXT("HotPatcher/MultiCooker"), 18 | // FApp::GetProjectName() 19 | // )); 20 | // return SaveConfigTo; 21 | // } 22 | 23 | // FString UFlibHotCookerHelper::GetCookerProcConfigPath(const FString& MissionName, int32 MissionID) 24 | // { 25 | // FString SaveConfigTo = FPaths::Combine( 26 | // UFlibHotCookerHelper::GetMultiCookerBaseDir(), 27 | // // FString::Printf(TEXT("%s_Cooker_%d.json"),*MissionName,MissionID) 28 | // FString::Printf(TEXT("%s.json"),*MissionName) 29 | // ); 30 | // return SaveConfigTo; 31 | // } 32 | 33 | FString UFlibHotCookerHelper::GetCookedDir() 34 | { 35 | return FPaths::Combine( 36 | TEXT("[PROJECTDIR]"), 37 | TEXT("Saved"),TEXT("Cooked")); 38 | } 39 | 40 | FString UFlibHotCookerHelper::GetCookerBaseDir() 41 | { 42 | FString SaveConfigTo = FPaths::Combine( 43 | TEXT("[PROJECTDIR]"), 44 | TEXT("Saved"), 45 | TEXT("HotPatcher/MultiCooker"), 46 | FApp::GetProjectName() 47 | ); 48 | return SaveConfigTo; 49 | } 50 | 51 | FString UFlibHotCookerHelper::GetCookerProcFailedResultPath(const FString& BaseDir,const FString& MissionName, int32 MissionID) 52 | { 53 | FString SaveConfigTo = FPaths::Combine( 54 | BaseDir, 55 | FString::Printf(TEXT("%s_FailedAssets.json"),*MissionName) 56 | ); 57 | return SaveConfigTo; 58 | } 59 | 60 | FString UFlibHotCookerHelper::GetProfilingCmd() 61 | { 62 | return FString::Printf(TEXT("-tracehost=127.0.0.1 -trace=cpu,memory,loadtime -statnamedevents implies -llm")); 63 | } 64 | 65 | TSharedPtr UFlibHotCookerHelper::CreateCookShaderCollectionProxyByPlatform( 66 | const FString& ShaderLibraryName, 67 | TArray Platforms, 68 | bool bShareShader, 69 | bool bNativeShader, 70 | bool bMaster, 71 | const FString& InSavePath, 72 | bool bCleanSavePath) 73 | { 74 | SCOPED_NAMED_EVENT_TEXT("UFlibHotCookerHelper::CreateCookShaderCollectionProxyByPlatform",FColor::Red); 75 | TSharedPtr CookShaderCollection; 76 | TArray PlatformNames; 77 | for(const auto& Platform:Platforms) 78 | { 79 | PlatformNames.AddUnique(THotPatcherTemplateHelper::GetEnumNameByValue(Platform)); 80 | } 81 | 82 | FString ActualLibraryName = UFlibShaderCodeLibraryHelper::GenerateShaderCodeLibraryName(FApp::GetProjectName(),false); 83 | if(bCleanSavePath) 84 | { 85 | UFlibHotPatcherCoreHelper::DeleteDirectory(InSavePath); 86 | } 87 | CookShaderCollection = MakeShareable( 88 | new FCookShaderCollectionProxy( 89 | PlatformNames, 90 | ShaderLibraryName, 91 | bShareShader, 92 | bNativeShader, 93 | bMaster, 94 | InSavePath 95 | )); 96 | 97 | return CookShaderCollection; 98 | } 99 | 100 | bool UFlibHotCookerHelper::IsAppleMetalPlatform(ITargetPlatform* TargetPlatform) 101 | { 102 | SCOPED_NAMED_EVENT_TEXT("IsAppleMetalPlatform",FColor::Red); 103 | bool bIsMatched = false; 104 | TArray ApplePlatforms = {TEXT("IOS"),TEXT("Mac"),TEXT("TVOS")}; 105 | for(const auto& Platform:ApplePlatforms) 106 | { 107 | if(TargetPlatform->PlatformName().StartsWith(Platform,ESearchCase::IgnoreCase)) 108 | { 109 | bIsMatched = true; 110 | break; 111 | } 112 | } 113 | return bIsMatched; 114 | } -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Private/HotPatcherCore.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #include "HotPatcherCore.h" 4 | #include "HotPatcherSettings.h" 5 | 6 | // ENGINE HEADER 7 | 8 | #include "AssetToolsModule.h" 9 | #include "CommandletHelper.h" 10 | #include "ContentBrowserModule.h" 11 | #include "IContentBrowserSingleton.h" 12 | #include "Misc/MessageDialog.h" 13 | #include "Framework/MultiBox/MultiBoxBuilder.h" 14 | #include "DesktopPlatformModule.h" 15 | #include "FlibHotPatcherCoreHelper.h" 16 | #include "HotPatcherLog.h" 17 | #include "ISettingsModule.h" 18 | #include "LevelEditor.h" 19 | #include "HAL/FileManager.h" 20 | #include "Interfaces/IPluginManager.h" 21 | #include "Kismet/KismetTextLibrary.h" 22 | #include "PakFileUtilities.h" 23 | 24 | #include "Cooker/MultiCooker/SingleCookerProxy.h" 25 | #include "CreatePatch/PatcherProxy.h" 26 | #include "Settings/ProjectPackagingSettings.h" 27 | #include "ThreadUtils/FProcWorkerThread.hpp" 28 | 29 | 30 | FExportPatchSettings* GPatchSettings = nullptr; 31 | FExportReleaseSettings* GReleaseSettings = nullptr; 32 | bool GCookLog = (bool)ENABLE_COOK_LOG; 33 | FString GToolName = TOOL_NAME; 34 | int32 GToolMainVersion = CURRENT_VERSION_ID; 35 | int32 GToolPatchVersion = CURRENT_PATCH_ID; 36 | FString GRemoteVersionFile = REMOTE_VERSION_FILE; 37 | 38 | static const FName HotPatcherTabName("HotPatcher"); 39 | 40 | #define LOCTEXT_NAMESPACE "FHotPatcherCoreModule" 41 | 42 | void ReceiveOutputMsg(FProcWorkerThread* Worker,const FString& InMsg) 43 | { 44 | FString FindItem(TEXT("Display:")); 45 | int32 Index= InMsg.Len() - InMsg.Find(FindItem)- FindItem.Len(); 46 | if (InMsg.Contains(TEXT("Error:"))) 47 | { 48 | UE_LOG(LogHotPatcher, Error, TEXT("%s"), *InMsg); 49 | } 50 | else if (InMsg.Contains(TEXT("Warning:"))) 51 | { 52 | UE_LOG(LogHotPatcher, Warning, TEXT("%s"), *InMsg); 53 | } 54 | else 55 | { 56 | UE_LOG(LogHotPatcher, Display, TEXT("%s"), *InMsg.Right(Index)); 57 | } 58 | } 59 | 60 | FHotPatcherCoreModule& FHotPatcherCoreModule::Get() 61 | { 62 | FHotPatcherCoreModule& Module = FModuleManager::GetModuleChecked("HotPatcherCore"); 63 | return Module; 64 | } 65 | 66 | 67 | void FHotPatcherCoreModule::StartupModule() 68 | { 69 | FParse::Bool(FCommandLine::Get(),TEXT("-cooklog"),GCookLog); 70 | UE_LOG(LogHotPatcher,Display,TEXT("GCookLog is %s!!!"),GCookLog ? TEXT("TRUE"): TEXT("FALSE")); 71 | } 72 | 73 | void FHotPatcherCoreModule::ShutdownModule() 74 | { 75 | 76 | } 77 | 78 | #undef LOCTEXT_NAMESPACE 79 | 80 | IMPLEMENT_MODULE(FHotPatcherCoreModule, HotPatcherCore) -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Private/HotPatcherDelegates.cpp: -------------------------------------------------------------------------------- 1 | #include "HotPatcherDelegates.h" 2 | 3 | FHotPatcherDelegates& FHotPatcherDelegates::Get() 4 | { 5 | // return the singleton object 6 | static FHotPatcherDelegates Singleton; 7 | return Singleton; 8 | } 9 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/CommandletBase/CommandletHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "ETargetPlatform.h" 5 | 6 | #define PATCHER_CONFIG_PARAM_NAME TEXT("-config=") 7 | #define ADD_PATCH_PLATFORMS TEXT("AddPatchPlatforms") 8 | #define TARGET_PLATFORMS_OVERRIDE TEXT("TargetPlatformsOverride") 9 | 10 | DECLARE_LOG_CATEGORY_EXTERN(LogHotPatcherCommandlet, All, All); 11 | 12 | namespace CommandletHelper 13 | { 14 | HOTPATCHERCORE_API void ReceiveMsg(const FString& InMsgType,const FString& InMsg); 15 | HOTPATCHERCORE_API void ReceiveShowMsg(const FString& InMsg); 16 | 17 | HOTPATCHERCORE_API TArray ParserPatchConfigByCommandline(const FString& Commandline,const FString& Token); 18 | 19 | HOTPATCHERCORE_API TArray ParserPlatforms(const FString& Commandline, const FString& Token); 20 | 21 | HOTPATCHERCORE_API TArray ParserPatchFilters(const FString& Commandline,const FString& FilterName); 22 | 23 | HOTPATCHERCORE_API void MainTick(TFunction IsRequestExit); 24 | 25 | HOTPATCHERCORE_API bool GetCommandletArg(const FString& Token,FString& OutValue); 26 | 27 | HOTPATCHERCORE_API bool IsCookCommandlet(); 28 | HOTPATCHERCORE_API TArray GetCookCommandletTargetPlatforms(); 29 | HOTPATCHERCORE_API TArray GetCookCommandletTargetPlatformName(); 30 | HOTPATCHERCORE_API void ModifyTargetPlatforms(const FString& InParams,const FString& InToken,TArray& OutTargetPlatforms,bool Replace); 31 | } 32 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/CommandletBase/HotPatcherCommandletBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FCountServerlessWrapper.h" 4 | #include "Commandlets/Commandlet.h" 5 | #include "HotPatcherCommandletBase.generated.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogHotPatcherCommandletBase, All, All); 8 | 9 | UCLASS() 10 | class HOTPATCHERCORE_API UHotPatcherCommandletBase :public UCommandlet 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | virtual int32 Main(const FString& Params)override; 16 | virtual bool IsSkipObject(UObject* Object){ return false; } 17 | virtual bool IsSkipPackage(UPackage* Package){ return false; } 18 | virtual FString GetCmdletName()const { return TEXT("HotPatcherCmdletBase"); } 19 | 20 | static FString GetCrashDir(); 21 | static void CleanCrashDir(); 22 | protected: 23 | void OnHandleSystemError(); 24 | protected: 25 | void Update(const FString& Params); 26 | void MaybeMarkPackageAsAlreadyLoaded(UPackage* Package); 27 | TSharedPtr ObjectTrackerTagCleaner; 28 | FString CmdConfigPath; 29 | TSharedPtr Counter; 30 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/Cooker/HotPatcherCookerSettingBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // engine 3 | #include "CoreMinimal.h" 4 | #include "Engine/EngineTypes.h" 5 | #include "HotPatcherCookerSettingBase.generated.h" 6 | 7 | USTRUCT(BlueprintType) 8 | struct HOTPATCHERCORE_API FHotPatcherCookerSettingBase: public FPatcherEntitySettingBase 9 | { 10 | GENERATED_USTRUCT_BODY() 11 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/Cooker/MultiCooker/FCookShaderCollectionProxy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Resources/Version.h" 3 | #include "ShaderCodeLibrary.h" 4 | #include "CoreMinimal.h" 5 | #include "Kismet/BlueprintFunctionLibrary.h" 6 | #include "Misc/AES.h" 7 | 8 | struct FCookShaderCollectionProxy 9 | { 10 | FCookShaderCollectionProxy(const TArray& InPlatformNames,const FString& InLibraryName,bool bShareShader,bool InIsNative,bool bInMaster,const FString& InSaveBaseDir); 11 | virtual ~FCookShaderCollectionProxy(); 12 | virtual void Init(); 13 | virtual void Shutdown(); 14 | virtual bool IsSuccessed()const { return bSuccessed; } 15 | private: 16 | TArray TargetPlatforms; 17 | TArray PlatformNames; 18 | FString LibraryName; 19 | bool bShareShader; 20 | bool bIsNative; 21 | bool bMaster; 22 | FString SaveBaseDir; 23 | bool bSuccessed = false; 24 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/Cooker/MultiCooker/FlibHotCookerHelper.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | #include "Resources/Version.h" 5 | #include "CoreMinimal.h" 6 | #include "ETargetPlatform.h" 7 | #include "Cooker/MultiCooker/FCookShaderCollectionProxy.h" 8 | #include "Kismet/BlueprintFunctionLibrary.h" 9 | #include "FlibHotCookerHelper.generated.h" 10 | 11 | /** 12 | * 13 | */ 14 | UCLASS() 15 | class HOTPATCHERCORE_API UFlibHotCookerHelper : public UBlueprintFunctionLibrary 16 | { 17 | GENERATED_BODY() 18 | public: 19 | static FString GetCookedDir(); 20 | static FString GetCookerBaseDir(); 21 | // static FString GetCookerProcConfigPath(const FString& MissionName,int32 MissionID); 22 | static FString GetCookerProcFailedResultPath(const FString& BaseDir,const FString& MissionName, int32 MissionID); 23 | static FString GetProfilingCmd(); 24 | static TSharedPtr CreateCookShaderCollectionProxyByPlatform( 25 | const FString& ShaderLibraryName, 26 | TArray Platforms, 27 | bool bShareShader, 28 | bool bNativeShader, 29 | bool bMaster, 30 | const FString& InSavePath, 31 | bool bCleanSavePath = true); 32 | static bool IsAppleMetalPlatform(ITargetPlatform* TargetPlatform); 33 | }; 34 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/CreatePatch/HotPatcherProxyBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "CreatePatch/HotPatcherSettingBase.h" 4 | #include "HotPatcherLog.h" 5 | #include "CreatePatch/HotPatcherContext.h" 6 | #include "CreatePatch/TimeRecorder.h" 7 | #include "HotPatcherDelegates.h" 8 | 9 | // engine header 10 | #include "CoreMinimal.h" 11 | #include "HotPatcherProxyBase.generated.h" 12 | 13 | 14 | 15 | UCLASS() 16 | class HOTPATCHERCORE_API UHotPatcherProxyBase : public UObject 17 | { 18 | public: 19 | GENERATED_BODY() 20 | 21 | 22 | virtual void Init(FPatcherEntitySettingBase* InSetting); 23 | virtual void Shutdown(); 24 | FORCEINLINE virtual bool DoExport(){return false;}; 25 | FORCEINLINE virtual FPatcherEntitySettingBase* GetSettingObject(){return Setting;}; 26 | IAssetRegistry* GetAssetRegistry()const { return AssetRegistry; } 27 | protected: 28 | FORCEINLINE virtual void SetProxySettings(FPatcherEntitySettingBase* InSetting) 29 | { 30 | Setting = InSetting; 31 | } 32 | const TMap& GetPlatformNameMapping(){ return PlatformNameMapping; } 33 | public: 34 | #if WITH_PACKAGE_CONTEXT 35 | // virtual void InitPlatformPackageContexts(); 36 | FORCEINLINE TMap> GetPlatformSavePackageContexts()const {return PlatformSavePackageContexts;} 37 | FORCEINLINE TMap GetPlatformSavePackageContextsRaw()const; 38 | TMap> PlatformSavePackageContexts; 39 | #endif 40 | 41 | public: 42 | FExportPakProcess OnPaking; 43 | FExportPakShowMsg OnShowMsg; 44 | protected: 45 | FPatcherEntitySettingBase* Setting; 46 | IAssetRegistry* AssetRegistry = NULL; 47 | TMap PlatformNameMapping; 48 | }; 49 | 50 | inline void UHotPatcherProxyBase::Init(FPatcherEntitySettingBase* InSetting) 51 | { 52 | SetProxySettings(InSetting); 53 | 54 | FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); 55 | AssetRegistry = &AssetRegistryModule.Get(); 56 | 57 | UEnum* UEnumIns = THotPatcherTemplateHelper::GetUEnum(); 58 | for (int64 EnumIndex = 0;EnumIndex < UEnumIns->GetMaxEnumValue();++EnumIndex) 59 | { 60 | if(UEnumIns->IsValidEnumValue(EnumIndex)) 61 | { 62 | FName EnumtorName = UEnumIns->GetNameByValue(EnumIndex); 63 | PlatformNameMapping.Add((ETargetPlatform)EnumIndex,EnumtorName); 64 | } 65 | } 66 | } 67 | 68 | inline void UHotPatcherProxyBase::Shutdown() 69 | { 70 | AssetRegistry = nullptr; 71 | } 72 | 73 | 74 | #if WITH_PACKAGE_CONTEXT 75 | FORCEINLINE TMap UHotPatcherProxyBase::GetPlatformSavePackageContextsRaw() const 76 | { 77 | TMap result; 78 | TArray Keys; 79 | GetPlatformSavePackageContexts().GetKeys(Keys); 80 | for(const auto& Key:Keys) 81 | { 82 | result.Add(Key,GetPlatformSavePackageContexts().Find(Key)->Get()); 83 | } 84 | return result; 85 | } 86 | #endif 87 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/CreatePatch/IPatchableInterface.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | class IPatchableInterface 8 | { 9 | 10 | // Add interface functions to this class. This is the class that will be inherited to implement this interface. 11 | public: 12 | virtual void ImportConfig()=0; 13 | virtual void ImportProjectConfig()=0; 14 | virtual void ExportConfig()const=0; 15 | virtual void ResetConfig() = 0; 16 | virtual void DoGenerate()=0; 17 | virtual FString GetMissionName()=0; 18 | }; 19 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/CreatePatch/PatcherProxy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CreatePatch/FExportPatchSettings.h" 4 | #include "FPatchVersionDiff.h" 5 | #include "HotPatcherProxyBase.h" 6 | #include "ThreadUtils/FThreadUtils.hpp" 7 | 8 | // engine header 9 | #include "Interfaces/ITargetPlatformManagerModule.h" 10 | #include "Interfaces/ITargetPlatform.h" 11 | #include "Interfaces/ITargetPlatform.h" 12 | #include "Templates/SharedPointer.h" 13 | #include "IDetailsView.h" 14 | #include "PropertyEditorModule.h" 15 | #include "Cooker/MultiCooker/FCookShaderCollectionProxy.h" 16 | #include "Widgets/Text/SMultiLineEditableText.h" 17 | 18 | #include "PatcherProxy.generated.h" 19 | 20 | using FPatchWorkerType = TFunction; 21 | using FPatchWorkers = TMap; 22 | 23 | DECLARE_MULTICAST_DELEGATE_FourParams(FOnPakListGenerated,FHotPatcherPatchContext&,FChunkInfo&,ETargetPlatform,TArray&); 24 | DECLARE_MULTICAST_DELEGATE_FourParams(FAddPatchWorkerEvent,FHotPatcherPatchContext&,FChunkInfo&,ETargetPlatform,TArray&); 25 | 26 | 27 | UCLASS() 28 | class HOTPATCHERCORE_API UPatcherProxy:public UHotPatcherProxyBase 29 | { 30 | GENERATED_UCLASS_BODY() 31 | public: 32 | virtual void Init(FPatcherEntitySettingBase* InSetting)override; 33 | virtual void Shutdown() override; 34 | 35 | virtual bool DoExport() override; 36 | virtual FExportPatchSettings* GetSettingObject()override{ return (FExportPatchSettings*)Setting; } 37 | bool CanExportPatch() const; 38 | 39 | FORCEINLINE_DEBUGGABLE void AddPatchWorker(const FString& WorkerName,const FPatchWorkerType& Worker) 40 | { 41 | PatchWorkers.Add(WorkerName,Worker); 42 | } 43 | FORCEINLINE const FPatchWorkers& GetPatchWorkers()const{ return PatchWorkers; } 44 | FORCEINLINE FPatherResult& GetPatcherResult(){ return PatcherResult; } 45 | 46 | public: 47 | FOnPakListGenerated OnPakListGenerated; 48 | 49 | protected: 50 | FPatchWorkers PatchWorkers; 51 | private: 52 | TSharedPtr PatchContext; 53 | FPatherResult PatcherResult; 54 | }; 55 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/CreatePatch/ReleaseProxy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "CreatePatch/FExportReleaseSettings.h" 3 | #include "HotPatcherProxyBase.h" 4 | // ENGINE HEADER 5 | #include "CoreMinimal.h" 6 | #include "CoreGlobals.h" 7 | #include "ReleaseProxy.generated.h" 8 | 9 | 10 | UCLASS() 11 | class HOTPATCHERCORE_API UReleaseProxy:public UHotPatcherProxyBase 12 | { 13 | public: 14 | GENERATED_BODY() 15 | 16 | virtual bool DoExport() override ; 17 | FORCEINLINE bool IsRunningCommandlet()const{return ::IsRunningCommandlet();} 18 | FORCEINLINE virtual FExportReleaseSettings* GetSettingObject()override { return (FExportReleaseSettings*)Setting; } 19 | 20 | private: 21 | FExportReleaseSettings* ExportReleaseSettings; 22 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/CreatePatch/ReleaseSettingsDetails.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "IDetailCustomization.h" 6 | 7 | class FReleaseSettingsDetails : public IDetailCustomization 8 | { 9 | public: 10 | /** Makes a new instance of this detail layout class for a specific detail view requesting it */ 11 | static TSharedRef MakeInstance(); 12 | 13 | /** IDetailCustomization interface */ 14 | virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override; 15 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/FCountServerlessWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "Interfaces/IHttpRequest.h" 5 | #include "Interfaces/IHttpResponse.h" 6 | 7 | struct HOTPATCHERCORE_API FProjectVersionDesc 8 | { 9 | FString ProjectName; 10 | FString EngineVersion; 11 | FString PluginVersion; 12 | FString GameName; 13 | FString UserName; 14 | }; 15 | 16 | struct HOTPATCHERCORE_API FServerRequestInfo 17 | { 18 | FString Host; 19 | FString AppId; 20 | FString Key; 21 | }; 22 | 23 | struct HOTPATCHERCORE_API FCountServerlessWrapper 24 | { 25 | void Init(const FServerRequestInfo& InRequestInfo,const FProjectVersionDesc& InDesc) 26 | { 27 | RequestInfo = InRequestInfo; 28 | Desc = InDesc; 29 | } 30 | ~FCountServerlessWrapper(); 31 | 32 | void Processor(); 33 | 34 | public: 35 | static FProjectVersionDesc MakeCurrentProject(); 36 | static FServerRequestInfo MakeServerRequestInfo(); 37 | protected: 38 | void RequestObjectID(); 39 | void OnObjectIdReceived( FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccess); 40 | 41 | FHttpRequestPtr UpdateToServer(const FProjectVersionDesc& Desc,const FString& ObjectID); 42 | void OnUpdateToServerReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccess); 43 | FHttpRequestPtr CreateToServer(const FProjectVersionDesc& Desc); 44 | void CreateToServerReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccess); 45 | 46 | FString Decode(const FString& Encode); 47 | protected: 48 | FServerRequestInfo RequestInfo; 49 | FProjectVersionDesc Desc; 50 | FHttpRequestPtr ObjectIDRequest; 51 | FHttpRequestPtr ToServerRequest; 52 | }; 53 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/HotPatcherCore.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "HotPatcherSettings.h" 6 | #include "Cooker/MultiCooker/FSingleCookerSettings.h" 7 | // engine header 8 | #include "CoreMinimal.h" 9 | 10 | HOTPATCHERCORE_API extern struct FExportPatchSettings* GPatchSettings; 11 | HOTPATCHERCORE_API extern struct FExportReleaseSettings* GReleaseSettings; 12 | extern HOTPATCHERCORE_API bool GCookLog; 13 | extern HOTPATCHERCORE_API FString GToolName; 14 | extern HOTPATCHERCORE_API FString GRemoteVersionFile; 15 | extern HOTPATCHERCORE_API int32 GToolMainVersion; 16 | extern HOTPATCHERCORE_API int32 GToolPatchVersion; 17 | 18 | HOTPATCHERCORE_API void ReceiveOutputMsg(class FProcWorkerThread* Worker,const FString& InMsg); 19 | 20 | // delegate 21 | DECLARE_MULTICAST_DELEGATE_TwoParams(FNotificationEvent,FText,const FString&) 22 | DECLARE_MULTICAST_DELEGATE_OneParam(FSingleCookerAdditionalWorkerRegister,const TSharedPtr&); 23 | 24 | 25 | class HOTPATCHERCORE_API FHotPatcherCoreModule : public IModuleInterface 26 | { 27 | public: 28 | static FHotPatcherCoreModule& Get(); 29 | /** IModuleInterface implementation */ 30 | virtual void StartupModule() override; 31 | virtual void ShutdownModule() override; 32 | virtual int32 GetMainVersion()const{ return CURRENT_VERSION_ID; } 33 | virtual int32 GetPatchVersion()const { return CURRENT_PATCH_ID; } 34 | 35 | public: 36 | FSingleCookerAdditionalWorkerRegister& GetSingleCookerAdditionalPreWorkerRegister(){ return SingleCookerAdditionalPreWorkerRegister; } 37 | FSingleCookerAdditionalWorkerRegister& GetSingleCookerAdditionalPostWorkerRegister(){ return SingleCookerAdditionalPostWorkerRegister; } 38 | private: 39 | FSingleCookerAdditionalWorkerRegister SingleCookerAdditionalPreWorkerRegister; 40 | FSingleCookerAdditionalWorkerRegister SingleCookerAdditionalPostWorkerRegister; 41 | }; 42 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/HotPatcherDelegates.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "GameDelegates.h" 5 | 6 | DECLARE_MULTICAST_DELEGATE_TwoParams(FNotificationEvent,FText,const FString&) 7 | 8 | class HOTPATCHERCORE_API FHotPatcherDelegates 9 | { 10 | public: 11 | /** Return a single FGameDelegates object */ 12 | static FHotPatcherDelegates& Get(); 13 | 14 | DEFINE_GAME_DELEGATE_TYPED(NotifyFileGenerated,FNotificationEvent); 15 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/HotPatcherSettings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ETargetPlatform.h" 3 | #include "CreatePatch/FExportPatchSettings.h" 4 | #include "FlibPatchParserHelper.h" 5 | #include "CoreMinimal.h" 6 | #include "Kismet/KismetTextLibrary.h" 7 | #include "HotPatcherSettings.generated.h" 8 | #define LOCTEXT_NAMESPACE "UHotPatcherSettings" 9 | 10 | USTRUCT() 11 | struct FPakExternalInfo 12 | { 13 | GENERATED_BODY() 14 | FPakExternalInfo()=default; 15 | FPakExternalInfo(const FPakExternalInfo&)=default; 16 | UPROPERTY(EditAnywhere) 17 | FString PakName; 18 | UPROPERTY(EditAnywhere) 19 | TArray TargetPlatforms; 20 | UPROPERTY(EditAnywhere) 21 | FPlatformExternAssets AddExternAssetsToPlatform; 22 | }; 23 | 24 | UCLASS(config = Game, defaultconfig) 25 | class HOTPATCHERCORE_API UHotPatcherSettings:public UObject 26 | { 27 | GENERATED_UCLASS_BODY() 28 | public: 29 | UPROPERTY(EditAnywhere, config, Category = "Editor") 30 | bool bWhiteListCookInEditor = false; 31 | UPROPERTY(EditAnywhere, config, Category = "Editor") 32 | TArray PlatformWhitelists; 33 | 34 | FString GetTempSavedDir()const; 35 | FString GetHPLSavedDir()const; 36 | 37 | UPROPERTY(EditAnywhere, config, Category = "ConfigTemplate") 38 | FExportPatchSettings TempPatchSetting; 39 | 40 | UPROPERTY(EditAnywhere, config, Category = "Preset") 41 | TArray PresetConfigs; 42 | 43 | UPROPERTY(EditAnywhere, config, Category = "Preview") 44 | bool bPreviewTooltips = true; 45 | UPROPERTY(EditAnywhere, config, Category = "Preview") 46 | bool bExternalFilesCheck = false; 47 | 48 | UPROPERTY(config) 49 | bool bServerlessCounter = true; 50 | UPROPERTY(EditAnywhere, config, Category = "Advanced") 51 | bool bServerlessCounterInCmdlet = false; 52 | }; 53 | 54 | 55 | FORCEINLINE FString UHotPatcherSettings::GetTempSavedDir()const 56 | { 57 | return UFlibPatchParserHelper::ReplaceMark(TempPatchSetting.SavePath.Path); 58 | } 59 | FORCEINLINE UHotPatcherSettings::UHotPatcherSettings(const FObjectInitializer& Initializer):Super(Initializer) 60 | { 61 | auto ResetTempSettings = [](FExportPatchSettings& InTempPatchSetting) 62 | { 63 | InTempPatchSetting = FExportPatchSettings{}; 64 | InTempPatchSetting.bByBaseVersion=false; 65 | // TempPatchSetting.bStorageAssetDependencies = false; 66 | InTempPatchSetting.bStorageDiffAnalysisResults=false; 67 | InTempPatchSetting.bStorageDeletedAssetsToNewReleaseJson = false; 68 | InTempPatchSetting.bStorageConfig = false; 69 | InTempPatchSetting.bStorageNewRelease = false; 70 | InTempPatchSetting.bStoragePakFileInfo = false; 71 | InTempPatchSetting.bCookPatchAssets = true; 72 | InTempPatchSetting.CookShaderOptions.bSharedShaderLibrary = false; 73 | InTempPatchSetting.CookShaderOptions.bNativeShader = false; 74 | InTempPatchSetting.EncryptSettings.bUseDefaultCryptoIni = true; 75 | InTempPatchSetting.SavePath.Path = TEXT("[PROJECTDIR]/Saved/HotPatcher/Paks"); 76 | }; 77 | ResetTempSettings(TempPatchSetting); 78 | } 79 | 80 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/ShaderLibUtils/FlibShaderCodeLibraryHelper.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | #include "Resources/Version.h" 5 | #include "ShaderCodeLibrary.h" 6 | #include "CoreMinimal.h" 7 | #include "Kismet/BlueprintFunctionLibrary.h" 8 | #include "FlibShaderCodeLibraryHelper.generated.h" 9 | 10 | #if ENGINE_MAJOR_VERSION > 4 || ENGINE_MINOR_VERSION > 26 11 | #define SHADER_COOKER_CLASS FShaderLibraryCooker 12 | #else 13 | #define SHADER_COOKER_CLASS FShaderCodeLibrary 14 | #endif 15 | 16 | struct FShaderCodeFormatMap 17 | { 18 | ITargetPlatform* Platform; 19 | bool bIsNative; 20 | FString SaveBaseDir; 21 | struct FShaderFormatNameFiles 22 | { 23 | FString ShaderName; 24 | TArray Files; 25 | }; 26 | // etc GLSL_ES3_1_ANDROID something files 27 | // SF_METAL something files 28 | TMap ShaderCodeTypeFilesMap; 29 | }; 30 | // 31 | // struct FMergeShaderCollectionProxy 32 | // { 33 | // FMergeShaderCollectionProxy(const TArray& InShaderCodeFiles); 34 | // virtual ~FMergeShaderCollectionProxy(); 35 | // void Init(); 36 | // void Shutdown(); 37 | // private: 38 | // TArray ShaderCodeFiles; 39 | // }; 40 | 41 | /** 42 | * 43 | */ 44 | UCLASS() 45 | class HOTPATCHERCORE_API UFlibShaderCodeLibraryHelper : public UBlueprintFunctionLibrary 46 | { 47 | GENERATED_BODY() 48 | public: 49 | #if ENGINE_MAJOR_VERSION > 4 || ENGINE_MINOR_VERSION > 25 50 | static TArray GetShaderFormatsWithStableKeys(const TArray& ShaderFormats,bool bNeedShaderStableKeys = true,bool bNeedsDeterministicOrder = false); 51 | #endif 52 | static TArray GetShaderFormatsByTargetPlatform(ITargetPlatform* TargetPlatform); 53 | static FString GenerateShaderCodeLibraryName(FString const& Name, bool bIsIterateSharedBuild); 54 | static bool SaveShaderLibrary(const ITargetPlatform* TargetPlatform,TArray ShaderFormats, FString const& Name, const FString& ShaderCodeDir,const FString& RootMetaDataPath, bool bMaster); 55 | static bool SaveShaderLibrary(const ITargetPlatform* TargetPlatform, const TArray>* ChunkAssignments, FString const& Name, const FString& 56 | SaveBaseDir, bool bMaster); 57 | static TArray FindCookedShaderLibByPlatform(const FString& PlatfomName,const FString& Directory,bool bRecursive = false); 58 | static TArray FindCookedShaderLibByShaderFrmat(const FString& ShaderFormatName,const FString& Directory); 59 | 60 | static void WaitShaderCompilingComplete(); 61 | static void CancelMaterialShaderCompile(UMaterialInterface* MaterialInterface); 62 | 63 | static void CleanShaderWorkerDir(); 64 | 65 | static FString ShaderExtension; 66 | static FString ShaderAssetInfoExtension; 67 | static FString StableExtension; 68 | 69 | FORCEINLINE static FString GetCodeArchiveFilename(const FString& BaseDir, const FString& LibraryName, FName Platform) 70 | { 71 | return BaseDir / FString::Printf(TEXT("ShaderArchive-%s-"), *LibraryName) + Platform.ToString() + ShaderExtension; 72 | } 73 | FORCEINLINE static FString GetShaderAssetInfoFilename(const FString& BaseDir, const FString& LibraryName, FName Platform) 74 | { 75 | return BaseDir / FString::Printf(TEXT("ShaderAssetInfo-%s-"), *LibraryName) + Platform.ToString() + ShaderAssetInfoExtension; 76 | } 77 | 78 | FORCEINLINE static FString GetStableInfoArchiveFilename(const FString& BaseDir, const FString& LibraryName, FName Platform) 79 | { 80 | return BaseDir / FString::Printf(TEXT("ShaderStableInfo-%s-"), *LibraryName) + Platform.ToString() + StableExtension; 81 | } 82 | static bool RHISupportsNativeShaderLibraries(const FStaticShaderPlatform Platform); 83 | }; 84 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherCore/Public/ThreadUtils/FThreadUtils.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "HAL/Runnable.h" 3 | #include "HAL/RunnableThread.h" 4 | DECLARE_MULTICAST_DELEGATE(FThreadWorkerStatusDelegate); 5 | 6 | namespace EThreadStatus 7 | { 8 | enum Type 9 | { 10 | InActive, 11 | 12 | Busy, 13 | 14 | Canceling, 15 | 16 | Canceled, 17 | 18 | Completed 19 | }; 20 | 21 | } 22 | class FThreadWorker : public FRunnable 23 | { 24 | public: 25 | using FCallback = TFunction; 26 | explicit FThreadWorker(const TCHAR *InThreadName, const FCallback& InRunFunc) 27 | :mThreadName(InThreadName),mRunFunc(InRunFunc),mThreadStatus(EThreadStatus::InActive) 28 | {} 29 | 30 | virtual void Execute() 31 | { 32 | if (GetThreadStatus() == EThreadStatus::InActive) 33 | { 34 | mThread = FRunnableThread::Create(this, *mThreadName); 35 | if (mThread) 36 | { 37 | mThreadStatus = EThreadStatus::Busy; 38 | } 39 | } 40 | } 41 | virtual void Join() 42 | { 43 | mThread->WaitForCompletion(); 44 | } 45 | 46 | virtual uint32 Run()override 47 | { 48 | mRunFunc(); 49 | 50 | return 0; 51 | } 52 | virtual void Stop()override 53 | { 54 | Cancel(); 55 | } 56 | virtual void Cancel() 57 | { 58 | mThreadStatus = EThreadStatus::Canceled; 59 | } 60 | virtual void Exit()override 61 | { 62 | mThreadStatus = EThreadStatus::Completed; 63 | } 64 | 65 | virtual EThreadStatus::Type GetThreadStatus()const 66 | { 67 | return mThreadStatus; 68 | } 69 | public: 70 | FThreadWorkerStatusDelegate CancelDelegate; 71 | FORCEINLINE FString GetThreadName()const {return mThreadName;} 72 | virtual bool IsCompleted()const { return GetThreadStatus() == EThreadStatus::Completed || GetThreadStatus() == EThreadStatus::Canceled;} 73 | protected: 74 | FString mThreadName; 75 | FCallback mRunFunc; 76 | FRunnableThread* mThread; 77 | volatile EThreadStatus::Type mThreadStatus; 78 | 79 | private: 80 | FThreadWorker(const FThreadWorker&) = delete; 81 | FThreadWorker& operator=(const FThreadWorker&) = delete; 82 | 83 | }; 84 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/HotPatcherEditor.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | 8 | public class HotPatcherEditor : ModuleRules 9 | { 10 | public HotPatcherEditor(ReadOnlyTargetRules Target) : base(Target) 11 | { 12 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 13 | bLegacyPublicIncludePaths = false; 14 | OptimizeCode = CodeOptimization.InShippingBuildsOnly; 15 | 16 | PublicIncludePaths.AddRange(new string[] { }); 17 | PrivateIncludePaths.AddRange(new string[] {}); 18 | 19 | PublicDependencyModuleNames.AddRange( 20 | new string[] 21 | { 22 | "UnrealEd", 23 | "UMG", 24 | "UMGEditor", 25 | "Core", 26 | "Json", 27 | "ContentBrowser", 28 | "SandboxFile", 29 | "JsonUtilities", 30 | "TargetPlatform", 31 | "DesktopPlatform", 32 | "Projects", 33 | "Settings", 34 | "EditorStyle", 35 | "HTTP", 36 | "RHI", 37 | "EngineSettings", 38 | "AssetRegistry", 39 | "PakFileUtilities", 40 | "HotPatcherRuntime", 41 | "BinariesPatchFeature", 42 | "HotPatcherCore" 43 | // ... add other public dependencies that you statically link with here ... 44 | } 45 | ); 46 | 47 | PrivateDependencyModuleNames.AddRange( 48 | new string[] 49 | { 50 | "Core", 51 | "UnrealEd", 52 | "Projects", 53 | "DesktopPlatform", 54 | "InputCore", 55 | "LevelEditor", 56 | "CoreUObject", 57 | "Engine", 58 | "Slate", 59 | "SlateCore", 60 | "RenderCore" 61 | // ... add private dependencies that you statically link with here ... 62 | } 63 | ); 64 | 65 | if (Target.Version.MajorVersion > 4 || Target.Version.MinorVersion > 23) 66 | { 67 | PublicDependencyModuleNames.AddRange(new string[]{ 68 | "ToolMenus", 69 | "TraceLog" 70 | }); 71 | } 72 | 73 | System.Func AddPublicDefinitions = (string MacroName,bool bEnable) => 74 | { 75 | PublicDefinitions.Add(string.Format("{0}={1}",MacroName, bEnable ? 1 : 0)); 76 | return true; 77 | }; 78 | 79 | AddPublicDefinitions("ENABLE_COOK_ENGINE_MAP", false); 80 | AddPublicDefinitions("ENABLE_COOK_PLUGIN_MAP", false); 81 | BuildVersion Version; 82 | BuildVersion.TryRead(BuildVersion.GetDefaultFileName(), out Version); 83 | AddPublicDefinitions("WITH_EDITOR_SECTION", Version.MajorVersion > 4 || Version.MinorVersion > 24); 84 | 85 | System.Console.WriteLine("MajorVersion {0} MinorVersion: {1} PatchVersion {2}",Target.Version.MajorVersion,Target.Version.MinorVersion,Target.Version.PatchVersion); 86 | 87 | PublicDefinitions.AddRange(new string[] 88 | { 89 | "ENABLE_ORIGINAL_COOKER=0" 90 | }); 91 | 92 | PublicDefinitions.AddRange(new string[] 93 | { 94 | "ENABLE_UPDATER_CHECK=1" 95 | }); 96 | 97 | bool bEnablePackageContext = true; 98 | AddPublicDefinitions("WITH_PACKAGE_CONTEXT", (Version.MajorVersion > 4 || Version.MinorVersion > 23) && bEnablePackageContext); 99 | if (Version.MajorVersion > 4 || Version.MinorVersion > 26) 100 | { 101 | PublicDependencyModuleNames.AddRange(new string[] 102 | { 103 | "IoStoreUtilities", 104 | "UnrealEd" 105 | }); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/IOriginalCookerChildWidget.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Dom/JsonObject.h" 3 | #include "Templates/SharedPointer.h" 4 | #include "Model/FHotPatcherContextBase.h" 5 | #include "Model/FOriginalCookerContext.h" 6 | 7 | struct IOriginalCookerChildWidget 8 | { 9 | virtual TSharedPtr SerializeAsJson()const {return nullptr;}; 10 | virtual void DeSerializeFromJsonObj(TSharedPtrconst & InJsonObject){}; 11 | virtual FString GetSerializeName()const { return TEXT(""); }; 12 | virtual void Reset() {}; 13 | virtual void SetContext(TSharedPtr InContext) 14 | { 15 | mContext = InContext; 16 | } 17 | TSharedPtr GetContext()const { return mContext; }; 18 | virtual FOriginalCookerContext* GetCookerContextPtr()const 19 | { 20 | FOriginalCookerContext* Ptr = nullptr; 21 | if(GetContext().IsValid()) 22 | { 23 | Ptr = (FOriginalCookerContext*)mContext.Get(); 24 | } 25 | return Ptr; 26 | } 27 | virtual ~IOriginalCookerChildWidget(){} 28 | protected: 29 | TSharedPtr mContext; 30 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SHotPatcherCookMaps.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Model/FOriginalCookerContext.h" 5 | #include "Templates/SharedPointer.h" 6 | #include "FlibPatchParserHelper.h" 7 | #include "Kismet/KismetSystemLibrary.h" 8 | 9 | // project header 10 | #include "IOriginalCookerChildWidget.h" 11 | 12 | /** 13 | * Implements the cooked Maps panel. 14 | */ 15 | class SHotPatcherCookMaps 16 | : public SCompoundWidget,public IOriginalCookerChildWidget 17 | { 18 | public: 19 | 20 | SLATE_BEGIN_ARGS(SHotPatcherCookMaps) { } 21 | SLATE_END_ARGS() 22 | 23 | public: 24 | 25 | /** 26 | * Constructs the widget. 27 | * 28 | * @param InArgs The Slate argument list. 29 | */ 30 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 31 | 32 | public: 33 | virtual TSharedPtr SerializeAsJson()const override; 34 | virtual void DeSerializeFromJsonObj(TSharedPtrconst & InJsonObject)override; 35 | virtual FString GetSerializeName()const override; 36 | virtual void Reset() override; 37 | bool IsCookAllMap()const { return MapList.Num() == GetCookerContextPtr()->GetAllSelectedCookMap().Num(); } 38 | protected: 39 | 40 | 41 | // Callback for clicking the 'Select All Maps' button. 42 | void HandleAllMapHyperlinkNavigate(bool AllMap) 43 | { 44 | if (mContext.IsValid()) 45 | { 46 | if (AllMap) 47 | { 48 | TArray Maps = UFlibPatchParserHelper::GetAvailableMaps(UKismetSystemLibrary::GetProjectDirectory(),false,false,true); 49 | 50 | for (int32 MapIndex = 0; MapIndex < Maps.Num(); ++MapIndex) 51 | { 52 | GetCookerContextPtr()->AddSelectedCookMap(Maps[MapIndex]); 53 | } 54 | } 55 | else { 56 | GetCookerContextPtr()->ClearAllMap(); 57 | } 58 | 59 | } 60 | } 61 | 62 | TSharedRef HandleMapListViewGenerateRow(TSharedPtr InItem, const TSharedRef& OwnerTable); 63 | void RefreshMapList(); 64 | private: 65 | 66 | /** Holds the map list. */ 67 | TArray > MapList; 68 | /** Holds the map list view. */ 69 | TSharedPtr > > MapListView; 70 | 71 | }; 72 | 73 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SHotPatcherCookSetting.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Interfaces/ITargetPlatformManagerModule.h" 5 | #include "Interfaces/ITargetPlatform.h" 6 | #include "Model/FOriginalCookerContext.h" 7 | #include "Templates/SharedPointer.h" 8 | #include "Widgets/Input/SEditableTextBox.h" 9 | // project header 10 | #include "IOriginalCookerChildWidget.h" 11 | 12 | /** 13 | * Implements the cooked platforms panel. 14 | */ 15 | class SHotPatcherCookSetting 16 | : public SCompoundWidget,public IOriginalCookerChildWidget 17 | { 18 | public: 19 | 20 | SLATE_BEGIN_ARGS(SHotPatcherCookSetting) { } 21 | SLATE_END_ARGS() 22 | 23 | public: 24 | 25 | /** 26 | * Constructs the widget. 27 | * 28 | * @param InArgs The Slate argument list. 29 | */ 30 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 31 | public: 32 | virtual TSharedPtr SerializeAsJson()const override; 33 | virtual void DeSerializeFromJsonObj(TSharedPtrconst & InJsonObject)override; 34 | virtual FString GetSerializeName()const override; 35 | virtual void Reset() override; 36 | 37 | protected: 38 | TSharedRef HandleCookSettingListViewGenerateRow(TSharedPtr InItem, const TSharedRef& OwnerTable); 39 | void RefreshSettingsList(); 40 | 41 | void HandleRequestExSettings(TArray& OutExSettings); 42 | // FReply ConfirmExCookSetting(); 43 | 44 | 45 | TArray GetDefaultCookParams() const 46 | { 47 | return TArray{"-NoLogTimes", "-UTF8Output"}; 48 | } 49 | 50 | private: 51 | /** Holds the map list. */ 52 | TArray > SettingList; 53 | 54 | /** Holds the map list view. */ 55 | TSharedPtr > > SettingListView; 56 | 57 | // Extern Cook Setting Param 58 | TSharedPtr ExternSettingTextBox; 59 | }; 60 | 61 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SHotPatcherCookSpecifyCookFilter.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Model/FOriginalCookerContext.h" 5 | #include "Templates/SharedPointer.h" 6 | #include "FlibPatchParserHelper.h" 7 | #include "SpecifyCookFilterSetting.h" 8 | 9 | // engine header 10 | #include "IDetailsView.h" 11 | #include "Templates/SharedPointer.h" 12 | #include "PropertyEditorModule.h" 13 | #include "Kismet/KismetSystemLibrary.h" 14 | 15 | // project header 16 | #include "IOriginalCookerChildWidget.h" 17 | 18 | /** 19 | * Implements the cooked Maps panel. 20 | */ 21 | class SHotPatcherCookSpecifyCookFilter 22 | : public SCompoundWidget,public IOriginalCookerChildWidget 23 | { 24 | public: 25 | 26 | SLATE_BEGIN_ARGS(SHotPatcherCookSpecifyCookFilter) { } 27 | SLATE_END_ARGS() 28 | 29 | public: 30 | 31 | /** 32 | * Constructs the widget. 33 | * 34 | * @param InArgs The Slate argument list. 35 | */ 36 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 37 | public: 38 | virtual TSharedPtr SerializeAsJson()const override; 39 | virtual void DeSerializeFromJsonObj(TSharedPtrconst & InJsonObject)override; 40 | virtual FString GetSerializeName()const override; 41 | virtual void Reset() override; 42 | 43 | public: 44 | USpecifyCookFilterSetting* GetSpecifyCookFilterSetting()const; 45 | TArray GetAlwayCookDirectory()const; 46 | TArray GetAlwayCookAbsDirectory(); 47 | void HandleRequestSpecifyCookFilter(TArray& OutCookDir); 48 | protected: 49 | void CreateFilterListView(); 50 | 51 | private: 52 | /** Settings view ui element ptr */ 53 | TSharedPtr SettingsView; 54 | USpecifyCookFilterSetting* SpecifyCookFilterSetting; 55 | }; 56 | 57 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SHotPatcherCookedPlatforms.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Interfaces/ITargetPlatformManagerModule.h" 5 | #include "Interfaces/ITargetPlatform.h" 6 | #include "Model/FOriginalCookerContext.h" 7 | #include "SHotPatcherWidgetBase.h" 8 | #include "Templates/SharedPointer.h" 9 | #include "Dom/JsonObject.h" 10 | 11 | // project header 12 | #include "IOriginalCookerChildWidget.h" 13 | 14 | /** 15 | * Implements the cooked platforms panel. 16 | */ 17 | class SHotPatcherCookedPlatforms 18 | : public SCompoundWidget,public IOriginalCookerChildWidget 19 | { 20 | public: 21 | 22 | SLATE_BEGIN_ARGS(SHotPatcherCookedPlatforms) { } 23 | SLATE_END_ARGS() 24 | 25 | public: 26 | 27 | /** 28 | * Constructs the widget. 29 | * 30 | * @param InArgs The Slate argument list. 31 | */ 32 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 33 | 34 | public: 35 | virtual TSharedPtr SerializeAsJson()const override; 36 | virtual void DeSerializeFromJsonObj(TSharedPtrconst & InJsonObject)override; 37 | virtual FString GetSerializeName()const override; 38 | virtual void Reset() override; 39 | protected: 40 | 41 | /** 42 | * Builds the platform menu. 43 | * 44 | * @return Platform menu widget. 45 | */ 46 | void MakePlatformMenu( ) 47 | { 48 | TArray Platforms = GetTargetPlatformManager()->GetTargetPlatforms(); 49 | 50 | if (Platforms.Num() > 0) 51 | { 52 | PlatformList.Reset(); 53 | for (int32 PlatformIndex = 0; PlatformIndex < Platforms.Num(); ++PlatformIndex) 54 | { 55 | FString PlatformName = Platforms[PlatformIndex]->PlatformName(); 56 | 57 | PlatformList.Add(MakeShareable(new FString(PlatformName))); 58 | } 59 | } 60 | } 61 | 62 | private: 63 | 64 | // Callback for clicking the 'Select All Platforms' button. 65 | void HandleAllPlatformsHyperlinkNavigate( bool AllPlatforms ) 66 | { 67 | 68 | if (mContext.IsValid()) 69 | { 70 | if (AllPlatforms) 71 | { 72 | TArray Platforms = GetTargetPlatformManager()->GetTargetPlatforms(); 73 | 74 | for (int32 PlatformIndex = 0; PlatformIndex < Platforms.Num(); ++PlatformIndex) 75 | { 76 | GetCookerContextPtr()->AddSelectedCookPlatform(Platforms[PlatformIndex]->PlatformName()); 77 | } 78 | } 79 | else { 80 | GetCookerContextPtr()->ClearAllPlatform(); 81 | } 82 | 83 | } 84 | } 85 | 86 | // Handles generating a row widget in the map list view. 87 | TSharedRef HandlePlatformListViewGenerateRow( TSharedPtr InItem, const TSharedRef& OwnerTable ); 88 | 89 | private: 90 | // Holds the platform list. 91 | TArray > PlatformList; 92 | // Holds the platform list view. 93 | TSharedPtr > > PlatformListView; 94 | 95 | }; 96 | 97 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SHotPatcherPlatformListRow.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Misc/Attribute.h" 7 | #include "Widgets/SNullWidget.h" 8 | #include "Widgets/DeclarativeSyntaxSupport.h" 9 | #include "Widgets/SWidget.h" 10 | #include "Layout/Margin.h" 11 | #include "Styling/SlateTypes.h" 12 | #include "Widgets/Views/STableRow.h" 13 | #include "Widgets/Text/STextBlock.h" 14 | #include "Widgets/Views/SListView.h" 15 | #include "Widgets/Input/SCheckBox.h" 16 | #include "Model/FOriginalCookerContext.h" 17 | #include "Templates/SharedPointer.h" 18 | 19 | #define LOCTEXT_NAMESPACE "SHotPatcherPlatformListRow" 20 | 21 | /** 22 | * Implements a row widget for map list. 23 | */ 24 | class SHotPatcherPlatformListRow 25 | : public SMultiColumnTableRow >,IOriginalCookerChildWidget 26 | { 27 | public: 28 | 29 | SLATE_BEGIN_ARGS(SHotPatcherPlatformListRow) { } 30 | SLATE_ATTRIBUTE(FString, HighlightString) 31 | SLATE_ARGUMENT(TSharedPtr, OwnerTableView) 32 | SLATE_ARGUMENT(TSharedPtr, PlatformName) 33 | SLATE_END_ARGS() 34 | 35 | public: 36 | 37 | /** 38 | * Constructs the widget. 39 | * 40 | * @param InArgs The construction arguments. 41 | * @param InProfileManager The profile manager to use. 42 | */ 43 | void Construct( const FArguments& InArgs, TSharedPtr InContext) 44 | { 45 | HighlightString = InArgs._HighlightString; 46 | PlatformName = InArgs._PlatformName; 47 | 48 | SetContext(InContext); 49 | SMultiColumnTableRow >::Construct(FSuperRowType::FArguments(), InArgs._OwnerTableView.ToSharedRef()); 50 | } 51 | 52 | public: 53 | 54 | /** 55 | * Generates the widget for the specified column. 56 | * 57 | * @param ColumnName The name of the column to generate the widget for. 58 | * @return The widget. 59 | */ 60 | virtual TSharedRef GenerateWidgetForColumn( const FName& ColumnName ) override 61 | { 62 | if (ColumnName == "PlatformName") 63 | { 64 | return SNew(SCheckBox) 65 | .IsChecked(this, &SHotPatcherPlatformListRow::HandleCheckBoxIsChecked) 66 | .OnCheckStateChanged(this, &SHotPatcherPlatformListRow::HandleCheckBoxCheckStateChanged) 67 | .Padding(FMargin(6.0, 2.0)) 68 | [ 69 | SNew(STextBlock) 70 | .Text(FText::FromString(*PlatformName)) 71 | ]; 72 | } 73 | 74 | return SNullWidget::NullWidget; 75 | } 76 | 77 | private: 78 | 79 | // Callback for changing the checked state of the check box. 80 | void HandleCheckBoxCheckStateChanged( ECheckBoxState NewState ) 81 | { 82 | if (NewState == ECheckBoxState::Checked) 83 | { 84 | GetCookerContextPtr()->AddSelectedCookPlatform(*PlatformName); 85 | } 86 | else { 87 | GetCookerContextPtr()->RemoveSelectedCookPlatform(*PlatformName); 88 | } 89 | } 90 | 91 | // Callback for determining the checked state of the check box. 92 | ECheckBoxState HandleCheckBoxIsChecked( ) const 93 | { 94 | if (mContext.IsValid()) 95 | { 96 | if (GetCookerContextPtr()->GetAllSelectedPlatform().Contains(*PlatformName)) 97 | { 98 | return ECheckBoxState::Checked; 99 | } 100 | } 101 | return ECheckBoxState::Unchecked; 102 | } 103 | 104 | private: 105 | 106 | // Holds the highlight string for the log message. 107 | TAttribute HighlightString; 108 | 109 | // Holds the platform's name. 110 | TSharedPtr PlatformName; 111 | }; 112 | 113 | 114 | #undef LOCTEXT_NAMESPACE 115 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SOriginalCookWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Cooker/SHotPatcherCookerBase.h" 5 | 6 | #include "CoreMinimal.h" 7 | #include "Widgets/DeclarativeSyntaxSupport.h" 8 | #include "Widgets/SCompoundWidget.h" 9 | #include "Model/FOriginalCookerContext.h" 10 | #include "ThreadUtils/FProcWorkerThread.hpp" 11 | 12 | #include "IOriginalCookerChildWidget.h" 13 | #include "MissionNotificationProxy.h" 14 | #include "SHotPatcherCookedPlatforms.h" 15 | #include "SHotPatcherCookMaps.h" 16 | #include "SHotPatcherCookSetting.h" 17 | #include "SHotPatcherCookSpecifyCookFilter.h" 18 | 19 | DECLARE_LOG_CATEGORY_EXTERN(LogCookPage, Log, All); 20 | 21 | /** 22 | * Implements the profile page for the session launcher wizard. 23 | */ 24 | class SOriginalCookWidget 25 | : public SHotPatcherCookerBase,public IOriginalCookerChildWidget 26 | { 27 | public: 28 | 29 | SLATE_BEGIN_ARGS(SOriginalCookWidget) { } 30 | SLATE_END_ARGS() 31 | 32 | public: 33 | 34 | /** 35 | * Constructs the widget. 36 | * 37 | * @param InArgs The Slate argument list. 38 | */ 39 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 40 | 41 | public: 42 | virtual TSharedPtr SerializeAsJson()const override; 43 | virtual void DeSerializeFromJsonObj(TSharedPtrconst & InJsonObject)override; 44 | virtual FString GetSerializeName()const override; 45 | virtual void Reset() override; 46 | 47 | virtual void ImportConfig() override; 48 | virtual void ExportConfig()const override; 49 | virtual void ResetConfig() override; 50 | protected: 51 | FReply DoImportConfig(); 52 | FReply DoExportConfig()const; 53 | FReply DoResetConfig(); 54 | 55 | bool CanExecuteCook()const; 56 | void RunCookProc(const FString& InBinPath, const FString& InCommand)const; 57 | FReply RunCook()const; 58 | 59 | protected: 60 | TArray GetDefaultCookParams()const; 61 | void CancelCookMission(); 62 | 63 | TArray GetSerializableItems()const 64 | { 65 | TArray List; 66 | List.Add(Platforms.Get()); 67 | List.Add(CookMaps.Get()); 68 | List.Add(CookFilters.Get()); 69 | List.Add(CookSettings.Get()); 70 | return List; 71 | } 72 | 73 | FString SerializeAsString()const; 74 | 75 | private: 76 | UMissionNotificationProxy* MissionNotifyProay = nullptr; 77 | bool InCooking=false; 78 | /** The pending progress message */ 79 | TWeakPtr PendingProgressPtr; 80 | 81 | mutable TSharedPtr mCookProcWorkingThread; 82 | TSharedPtr Platforms; 83 | TSharedPtr CookMaps; 84 | TSharedPtr CookFilters; 85 | TSharedPtr CookSettings; 86 | TSharedPtr OriginalCookerContext; 87 | }; 88 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SProjectCookMapListRow.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Misc/Attribute.h" 7 | #include "Widgets/SNullWidget.h" 8 | #include "Widgets/DeclarativeSyntaxSupport.h" 9 | #include "Widgets/SWidget.h" 10 | #include "Layout/Margin.h" 11 | #include "Styling/SlateTypes.h" 12 | #include "Widgets/Views/STableRow.h" 13 | #include "Widgets/Text/STextBlock.h" 14 | #include "Widgets/Input/SCheckBox.h" 15 | #include "Widgets/Views/SListView.h" 16 | 17 | #include "Model/FOriginalCookerContext.h" 18 | 19 | #define LOCTEXT_NAMESPACE "SProjectCookMapListRow" 20 | 21 | /** 22 | * Implements a row widget for map list. 23 | */ 24 | class SProjectCookMapListRow 25 | : public SMultiColumnTableRow >,IOriginalCookerChildWidget 26 | { 27 | public: 28 | 29 | SLATE_BEGIN_ARGS(SProjectCookMapListRow) { } 30 | SLATE_ATTRIBUTE(FString, HighlightString) 31 | SLATE_ARGUMENT(TSharedPtr, OwnerTableView) 32 | SLATE_ARGUMENT(TSharedPtr, MapName) 33 | SLATE_END_ARGS() 34 | 35 | public: 36 | 37 | /** 38 | * Constructs the widget. 39 | * 40 | * @param InArgs The construction arguments. 41 | * @param InProfileManager The profile manager to use. 42 | */ 43 | void Construct( const FArguments& InArgs, const TSharedPtr& InModel ) 44 | { 45 | HighlightString = InArgs._HighlightString; 46 | MapName = InArgs._MapName; 47 | SetContext(InModel); 48 | 49 | SMultiColumnTableRow >::Construct(FSuperRowType::FArguments(), InArgs._OwnerTableView.ToSharedRef()); 50 | } 51 | 52 | public: 53 | 54 | /** 55 | * Generates the widget for the specified column. 56 | * 57 | * @param ColumnName The name of the column to generate the widget for. 58 | * @return The widget. 59 | */ 60 | virtual TSharedRef GenerateWidgetForColumn( const FName& ColumnName ) override 61 | { 62 | if (ColumnName == "MapName") 63 | { 64 | return SNew(SCheckBox) 65 | .IsChecked(this, &SProjectCookMapListRow::HandleCheckBoxIsChecked) 66 | .OnCheckStateChanged(this, &SProjectCookMapListRow::HandleCheckBoxCheckStateChanged) 67 | .Padding(FMargin(6.0, 2.0)) 68 | [ 69 | SNew(STextBlock) 70 | .Text(FText::FromString(*MapName)) 71 | ]; 72 | } 73 | 74 | return SNullWidget::NullWidget; 75 | } 76 | 77 | private: 78 | 79 | // Callback for changing the checked state of the check box. 80 | void HandleCheckBoxCheckStateChanged( ECheckBoxState NewState ) 81 | { 82 | 83 | if (mContext.IsValid()) 84 | { 85 | if (NewState == ECheckBoxState::Checked) 86 | { 87 | GetCookerContextPtr()->AddSelectedCookMap(*MapName); 88 | } 89 | else 90 | { 91 | GetCookerContextPtr()->RemoveSelectedCookMap(*MapName); 92 | } 93 | } 94 | } 95 | 96 | // Callback for determining the checked state of the check box. 97 | ECheckBoxState HandleCheckBoxIsChecked( ) const 98 | { 99 | 100 | if (mContext.IsValid() && GetCookerContextPtr()->GetAllSelectedCookMap().Contains(*MapName)) 101 | { 102 | return ECheckBoxState::Checked; 103 | } 104 | 105 | return ECheckBoxState::Unchecked; 106 | } 107 | 108 | private: 109 | 110 | // Holds the highlight string for the log message. 111 | TAttribute HighlightString; 112 | 113 | // Holds the map's name. 114 | TSharedPtr MapName; 115 | 116 | }; 117 | 118 | 119 | #undef LOCTEXT_NAMESPACE 120 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SProjectCookSettingsListRow.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Misc/Attribute.h" 7 | #include "Widgets/SNullWidget.h" 8 | #include "Widgets/DeclarativeSyntaxSupport.h" 9 | #include "Widgets/SWidget.h" 10 | #include "Layout/Margin.h" 11 | #include "Styling/SlateTypes.h" 12 | #include "Widgets/Views/STableRow.h" 13 | #include "Widgets/Text/STextBlock.h" 14 | #include "Widgets/Input/SCheckBox.h" 15 | #include "Widgets/Views/SListView.h" 16 | 17 | #include "Model/FOriginalCookerContext.h" 18 | 19 | #define LOCTEXT_NAMESPACE "SProjectCookSettingsListRow" 20 | 21 | /** 22 | * Implements a row widget for map list. 23 | */ 24 | class SProjectCookSettingsListRow 25 | : public SMultiColumnTableRow >,public IOriginalCookerChildWidget 26 | { 27 | public: 28 | 29 | SLATE_BEGIN_ARGS(SProjectCookSettingsListRow) { } 30 | SLATE_ATTRIBUTE(FString, HighlightString) 31 | SLATE_ARGUMENT(TSharedPtr, OwnerTableView) 32 | SLATE_ARGUMENT(TSharedPtr, SettingName) 33 | SLATE_END_ARGS() 34 | 35 | public: 36 | 37 | /** 38 | * Constructs the widget. 39 | * 40 | * @param InArgs The construction arguments. 41 | * @param InProfileManager The profile manager to use. 42 | */ 43 | void Construct( const FArguments& InArgs, const TSharedPtr& InModel ) 44 | { 45 | HighlightString = InArgs._HighlightString; 46 | SettingName = InArgs._SettingName; 47 | SetContext(InModel); 48 | 49 | SMultiColumnTableRow >::Construct(FSuperRowType::FArguments(), InArgs._OwnerTableView.ToSharedRef()); 50 | } 51 | 52 | public: 53 | 54 | /** 55 | * Generates the widget for the specified column. 56 | * 57 | * @param ColumnName The name of the column to generate the widget for. 58 | * @return The widget. 59 | */ 60 | virtual TSharedRef GenerateWidgetForColumn( const FName& ColumnName ) override 61 | { 62 | if (ColumnName == "SettingName") 63 | { 64 | return SNew(SCheckBox) 65 | .IsChecked(this, &SProjectCookSettingsListRow::HandleCheckBoxIsChecked) 66 | .OnCheckStateChanged(this, &SProjectCookSettingsListRow::HandleCheckBoxCheckStateChanged) 67 | .Padding(FMargin(6.0, 2.0)) 68 | [ 69 | SNew(STextBlock) 70 | .Text(FText::FromString(*SettingName)) 71 | ]; 72 | } 73 | 74 | return SNullWidget::NullWidget; 75 | } 76 | 77 | private: 78 | 79 | // Callback for changing the checked state of the check box. 80 | void HandleCheckBoxCheckStateChanged( ECheckBoxState NewState ) 81 | { 82 | 83 | if (mContext.IsValid()) 84 | { 85 | if (NewState == ECheckBoxState::Checked) 86 | { 87 | GetCookerContextPtr()->AddSelectedSetting(*SettingName); 88 | } 89 | else 90 | { 91 | GetCookerContextPtr()->RemoveSelectedSetting(*SettingName); 92 | } 93 | } 94 | } 95 | 96 | // Callback for determining the checked state of the check box. 97 | ECheckBoxState HandleCheckBoxIsChecked( ) const 98 | { 99 | 100 | if (mContext.IsValid() && GetCookerContextPtr()->GetAllSelectedSettings().Contains(*SettingName)) 101 | { 102 | return ECheckBoxState::Checked; 103 | } 104 | 105 | return ECheckBoxState::Unchecked; 106 | } 107 | 108 | private: 109 | 110 | // Holds the highlight string for the log message. 111 | TAttribute HighlightString; 112 | 113 | // Holds the map's name. 114 | TSharedPtr SettingName; 115 | }; 116 | 117 | 118 | #undef LOCTEXT_NAMESPACE 119 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/OriginalCooker/SpecifyCookFilterSetting.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // engine header 3 | #include "CoreMinimal.h" 4 | #include "UObject/ObjectMacros.h" 5 | #include "UObject/Object.h" 6 | #include "Engine/EngineTypes.h" 7 | #include "Dom/JsonObject.h" 8 | #include "Serialization/JsonWriter.h" 9 | #include "Serialization/JsonSerializer.h" 10 | #include "SpecifyCookFilterSetting.generated.h" 11 | 12 | /** Singleton wrapper to allow for using the setting structure in SSettingsView */ 13 | UCLASS() 14 | class USpecifyCookFilterSetting : public UObject 15 | { 16 | GENERATED_BODY() 17 | public: 18 | 19 | USpecifyCookFilterSetting() {} 20 | 21 | FORCEINLINE static USpecifyCookFilterSetting* Get() 22 | { 23 | static bool bInitialized = false; 24 | // This is a singleton, use default object 25 | USpecifyCookFilterSetting* DefaultSettings = GetMutableDefault(); 26 | 27 | if (!bInitialized) 28 | { 29 | bInitialized = true; 30 | } 31 | 32 | return DefaultSettings; 33 | } 34 | 35 | FORCEINLINE TArray& GetAlwayCookFilters(){return AlwayCookFilters;} 36 | FORCEINLINE TArray& GetCookAssets(){return CookAssets;} 37 | 38 | protected: 39 | UPROPERTY(EditAnywhere, BlueprintReadWrite,Category = "Directory",meta = (RelativeToGameContentDir, LongPackageName)) 40 | TArray AlwayCookFilters; 41 | // UPROPERTY(EditAnywhere, BlueprintReadWrite,Category = "Assets") 42 | TArray CookAssets; 43 | //UPROPERTY(EditAnywhere, BlueprintReadWrite,Category = "CookDirectoryFilter",meta = (RelativeToGameContentDir, LongPackageName)) 44 | // TArray NeverCookFilters; 45 | 46 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/Cooker/SCookersPage.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Widgets/DeclarativeSyntaxSupport.h" 7 | #include "Widgets/SCompoundWidget.h" 8 | #include "Model/FPatchersModeContext.h" 9 | #include "Cooker/SHotPatcherCookerBase.h" 10 | #include "SHotPatcherPageBase.h" 11 | // engine header 12 | #include "Interfaces/ITargetPlatform.h" 13 | #include "Templates/SharedPointer.h" 14 | #include "IDetailsView.h" 15 | #include "PropertyEditorModule.h" 16 | #include "Model/FOriginalCookerContext.h" 17 | 18 | /** 19 | * Implements the profile page for the session launcher wizard. 20 | */ 21 | class SCookersPage 22 | : public SHotPatcherPageBase 23 | { 24 | public: 25 | 26 | SLATE_BEGIN_ARGS(SCookersPage) { } 27 | SLATE_END_ARGS() 28 | 29 | public: 30 | 31 | /** 32 | * Constructs the widget. 33 | * 34 | * @param InArgs The Slate argument list. 35 | */ 36 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 37 | virtual FString GetPageName() const override{ return TEXT("Cooker"); } 38 | 39 | public: 40 | FText HandleCookerModeComboButtonContentText() const; 41 | void HandleHotPatcherMenuEntryClicked(FString InModeName,TFunction ActionCallback); 42 | EVisibility HandleOperatorConfigVisibility()const; 43 | EVisibility HandleImportProjectConfigVisibility()const; 44 | virtual void SelectToAction(const FString& ActionName); 45 | }; 46 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/CreatePatch/AssetActions/AssetTypeActions_PrimaryAssetLabel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if WITH_EDITOR_SECTION 4 | #include "ETargetPlatform.h" 5 | #include "CoreMinimal.h" 6 | #include "Engine/StaticMesh.h" 7 | #include "Toolkits/IToolkitHost.h" 8 | #include "AssetTypeActions_Base.h" 9 | #include "Engine/PrimaryAssetLabel.h" 10 | 11 | struct FToolMenuSection; 12 | class FMenuBuilder; 13 | 14 | class FAssetTypeActions_PrimaryAssetLabel : public FAssetTypeActions_Base 15 | { 16 | public: 17 | // IAssetTypeActions Implementation 18 | virtual FText GetName() const override { return NSLOCTEXT("AssetTypeActions", "AssetTypeActions_PrimaryAssetLabel", "Primary Asset Label"); } 19 | virtual FColor GetTypeColor() const override { return FColor(0, 255, 255); } 20 | virtual UClass* GetSupportedClass() const override { return UPrimaryAssetLabel::StaticClass(); } 21 | virtual bool HasActions( const TArray& InObjects ) const override { return true; } 22 | virtual void GetActions(const TArray& InObjects, FToolMenuSection& Section) override; 23 | // virtual void OpenAssetEditor( const TArray& InObjects, TSharedPtr EditWithinLevelEditor = TSharedPtr() ) override; 24 | virtual uint32 GetCategories() override { return EAssetTypeCategories::Basic; } 25 | // virtual class UThumbnailInfo* GetThumbnailInfo(UObject* Asset) const override; 26 | virtual bool IsImportedAsset() const override { return true; } 27 | // virtual void GetResolvedSourceFilePaths(const TArray& TypeAssets, TArray& OutSourceFilePaths) const override; 28 | // End IAssetTypeActions 29 | 30 | private: 31 | void ExecuteAddToPatchIncludeFilter(TArray> Objects); 32 | void ExecuteAddToChunkConfig(TArray> Objects); 33 | void MakeCookAndPakActionsSubMenu(class UToolMenu* Menu,TArray> Objects); 34 | void OnCookAndPakPlatform(ETargetPlatform Platform,TArray> Objects); 35 | }; 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/CreatePatch/ReleaseSettingsDetails.cpp: -------------------------------------------------------------------------------- 1 | #include "CreatePatch/ReleaseSettingsDetails.h" 2 | #include "CreatePatch/FExportReleaseSettings.h" 3 | 4 | // engine header 5 | #include "DetailLayoutBuilder.h" 6 | #include "DetailCategoryBuilder.h" 7 | #include "DetailWidgetRow.h" 8 | #include "Widgets/Input/SButton.h" 9 | 10 | #define LOCTEXT_NAMESPACE "ReleaseSettingsDetails" 11 | 12 | TSharedRef FReleaseSettingsDetails::MakeInstance() 13 | { 14 | return MakeShareable(new FReleaseSettingsDetails()); 15 | } 16 | 17 | void FReleaseSettingsDetails::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) 18 | { 19 | TArray< TSharedPtr > StructBeingCustomized; 20 | DetailBuilder.GetStructsBeingCustomized(StructBeingCustomized); 21 | check(StructBeingCustomized.Num() == 1); 22 | 23 | FExportReleaseSettings* ReleaseSettingsIns = (FExportReleaseSettings*)StructBeingCustomized[0].Get()->GetStructMemory(); 24 | 25 | IDetailCategoryBuilder& VersionCategory = DetailBuilder.EditCategory("Version",FText::GetEmpty(),ECategoryPriority::Default); 26 | VersionCategory.SetShowAdvanced(true); 27 | 28 | VersionCategory.AddCustomRow(LOCTEXT("ImportPakLists", "Import Pak Lists"),true) 29 | .ValueContent() 30 | [ 31 | SNew(SHorizontalBox) 32 | + SHorizontalBox::Slot() 33 | .Padding(0) 34 | .AutoWidth() 35 | [ 36 | SNew(SButton) 37 | .Text(LOCTEXT("Import", "Import")) 38 | .ToolTipText(LOCTEXT("ImportPakLists_Tooltip", "Import Pak Lists")) 39 | .IsEnabled_Lambda([this,ReleaseSettingsIns]()->bool 40 | { 41 | return ReleaseSettingsIns->IsByPakList(); 42 | }) 43 | .OnClicked_Lambda([this, ReleaseSettingsIns]() 44 | { 45 | if (ReleaseSettingsIns) 46 | { 47 | ReleaseSettingsIns->ImportPakLists(); 48 | } 49 | return(FReply::Handled()); 50 | }) 51 | ] 52 | + SHorizontalBox::Slot() 53 | .Padding(5,0,0,0) 54 | .AutoWidth() 55 | [ 56 | SNew(SButton) 57 | .Text(LOCTEXT("Clear", "Clear")) 58 | .ToolTipText(LOCTEXT("ClearPakLists_Tooltip", "Clear Pak Lists")) 59 | .IsEnabled_Lambda([this,ReleaseSettingsIns]()->bool 60 | { 61 | return ReleaseSettingsIns->IsByPakList(); 62 | }) 63 | .OnClicked_Lambda([this, ReleaseSettingsIns]() 64 | { 65 | if (ReleaseSettingsIns) 66 | { 67 | ReleaseSettingsIns->ClearImportedPakList(); 68 | } 69 | return(FReply::Handled()); 70 | }) 71 | ] 72 | ]; 73 | } 74 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/CreatePatch/SHotPatcherInformations.cpp: -------------------------------------------------------------------------------- 1 | #include "CreatePatch/SHotPatcherInformations.h" 2 | 3 | // engine header 4 | #include "Widgets/Input/SHyperlink.h" 5 | #include "Widgets/Layout/SSeparator.h" 6 | #include "Widgets/SBoxPanel.h" 7 | #include "Widgets/Layout/SScrollBox.h" 8 | #include "Widgets/Layout/SGridPanel.h" 9 | #include "Widgets/Layout/SHeader.h" 10 | #include "Internationalization/Internationalization.h" 11 | #include "Widgets/Layout/SExpandableArea.h" 12 | 13 | void SHotPatcherInformations::Construct(const FArguments& InArgs) 14 | { 15 | ChildSlot 16 | [ 17 | 18 | SAssignNew(DiffAreaWidget, SExpandableArea) 19 | .AreaTitle(FText::FromString(TEXT("Informations"))) 20 | .InitiallyCollapsed(false) 21 | .Padding(8.0) 22 | .BodyContent() 23 | [ 24 | SNew(SOverlay) 25 | + SOverlay::Slot() 26 | .HAlign(HAlign_Fill) 27 | .VAlign(VAlign_Fill) 28 | [ 29 | SNew(SHorizontalBox) 30 | +SHorizontalBox::Slot() 31 | .VAlign(VAlign_Fill) 32 | .FillWidth(1.0) 33 | [ 34 | SNew(SVerticalBox) 35 | + SVerticalBox::Slot() 36 | .HAlign(HAlign_Left) 37 | .Padding(4, 4, 10, 4) 38 | [ 39 | SAssignNew(MulitText, SMultiLineEditableText) 40 | .IsReadOnly(true) 41 | ] 42 | ] 43 | ] 44 | ] 45 | ]; 46 | } 47 | 48 | void SHotPatcherInformations::SetExpanded(bool InExpand) 49 | { 50 | DiffAreaWidget->SetExpanded_Animated(InExpand); 51 | } 52 | 53 | void SHotPatcherInformations::SetContent(const FString& InContent) 54 | { 55 | MulitText->SetText(FText::FromString(InContent)); 56 | } -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/FlibHotPatcherEditorHelper.cpp: -------------------------------------------------------------------------------- 1 | #include "FlibHotPatcherEditorHelper.h" 2 | 3 | #include "DesktopPlatformModule.h" 4 | #include "IDesktopPlatform.h" 5 | #include "Async/Async.h" 6 | 7 | void UFlibHotPatcherEditorHelper::CreateSaveFileNotify(const FText& InMsg, const FString& InSavedFile, 8 | SNotificationItem::ECompletionState NotifyType) 9 | { 10 | AsyncTask(ENamedThreads::GameThread,[InMsg,InSavedFile,NotifyType]() 11 | { 12 | auto Message = InMsg; 13 | FNotificationInfo Info(Message); 14 | Info.bFireAndForget = true; 15 | Info.ExpireDuration = 5.0f; 16 | Info.bUseSuccessFailIcons = false; 17 | Info.bUseLargeFont = false; 18 | 19 | const FString HyperLinkText = InSavedFile; 20 | Info.Hyperlink = FSimpleDelegate::CreateLambda( 21 | [](FString SourceFilePath) 22 | { 23 | FPlatformProcess::ExploreFolder(*SourceFilePath); 24 | }, 25 | HyperLinkText 26 | ); 27 | Info.HyperlinkText = FText::FromString(HyperLinkText); 28 | FSlateNotificationManager::Get().AddNotification(Info)->SetCompletionState(NotifyType); 29 | }); 30 | } 31 | 32 | TArray UFlibHotPatcherEditorHelper::SaveFileDialog(const FString& DialogTitle, const FString& DefaultPath, 33 | const FString& DefaultFile, const FString& FileTypes, uint32 Flags) 34 | { 35 | IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); 36 | 37 | TArray SaveFilenames; 38 | if (DesktopPlatform) 39 | { 40 | const bool bOpened = DesktopPlatform->SaveFileDialog( 41 | nullptr, 42 | DialogTitle, 43 | DefaultPath, 44 | DefaultFile, 45 | FileTypes, 46 | Flags, 47 | SaveFilenames 48 | ); 49 | } 50 | return SaveFilenames; 51 | } 52 | 53 | TArray UFlibHotPatcherEditorHelper::OpenFileDialog(const FString& DialogTitle, const FString& DefaultPath, 54 | const FString& DefaultFile, const FString& FileTypes, uint32 Flags) 55 | { 56 | IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); 57 | TArray SelectedFiles; 58 | 59 | if (DesktopPlatform) 60 | { 61 | const bool bOpened = DesktopPlatform->OpenFileDialog( 62 | nullptr, 63 | DialogTitle, 64 | DefaultPath, 65 | DefaultFile, 66 | FileTypes, 67 | Flags, 68 | SelectedFiles 69 | ); 70 | } 71 | return SelectedFiles; 72 | } 73 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/HotPatcherCommands.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #include "HotPatcherCommands.h" 4 | 5 | #define LOCTEXT_NAMESPACE "FHotPatcherModule" 6 | 7 | void FHotPatcherCommands::RegisterCommands() 8 | { 9 | UI_COMMAND(PluginAction, "HotPatcher", "Hot Patch Manager", EUserInterfaceActionType::Button, FInputChord{}); 10 | UI_COMMAND(CookSelectedAction, "Cook Actions...", "Cook the selected assets", EUserInterfaceActionType::Button, FInputChord{}); 11 | UI_COMMAND(CookAndPakSelectedAction, "Cook And Pak Actions...", "Cook and Pak the selected assets", EUserInterfaceActionType::Button, FInputChord{}); 12 | UI_COMMAND(AddToPakSettingsAction, "Add To Patch Settings...", "Add the selected assets to Patch Settings", EUserInterfaceActionType::Button, FInputChord{}); 13 | } 14 | 15 | #undef LOCTEXT_NAMESPACE 16 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/HotPatcherModBaseModule.cpp: -------------------------------------------------------------------------------- 1 | #include "HotPatcherModBaseModule.h" 2 | 3 | void FHotPatcherModBaseModule::StartupModule() 4 | { 5 | FHotPatcherActionManager::Get().RegisteHotPatcherMod(GetModDesc()); 6 | } 7 | 8 | void FHotPatcherModBaseModule::ShutdownModule() 9 | { 10 | FHotPatcherActionManager::Get().UnRegisteHotPatcherMod(GetModDesc()); 11 | } 12 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/HotPatcherStyle.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #include "HotPatcherStyle.h" 4 | #include "HotPatcherEditor.h" 5 | #include "Framework/Application/SlateApplication.h" 6 | #include "Styling/SlateStyleRegistry.h" 7 | #include "Slate/SlateGameResources.h" 8 | #include "Interfaces/IPluginManager.h" 9 | 10 | TSharedPtr< FSlateStyleSet > FHotPatcherStyle::StyleInstance = NULL; 11 | 12 | void FHotPatcherStyle::Initialize() 13 | { 14 | if (!StyleInstance.IsValid()) 15 | { 16 | StyleInstance = Create(); 17 | FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance); 18 | } 19 | } 20 | 21 | void FHotPatcherStyle::Shutdown() 22 | { 23 | FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance); 24 | ensure(StyleInstance.IsUnique()); 25 | StyleInstance.Reset(); 26 | } 27 | 28 | FName FHotPatcherStyle::GetStyleSetName() 29 | { 30 | static FName StyleSetName(TEXT("HotPatcherStyle")); 31 | return StyleSetName; 32 | } 33 | 34 | #define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) 35 | #define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) 36 | #define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) 37 | #define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ ) 38 | #define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ ) 39 | 40 | const FVector2D Icon16x16(16.0f, 16.0f); 41 | const FVector2D Icon20x20(20.0f, 20.0f); 42 | const FVector2D Icon40x40(40.0f, 40.0f); 43 | 44 | TSharedRef< FSlateStyleSet > FHotPatcherStyle::Create() 45 | { 46 | TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("HotPatcherStyle")); 47 | Style->SetContentRoot(IPluginManager::Get().FindPlugin("HotPatcher")->GetBaseDir() / TEXT("Resources")); 48 | Style->Set("HotPatcher.PluginAction", new IMAGE_BRUSH(TEXT("ButtonIcon_40x"), Icon40x40)); 49 | return Style; 50 | } 51 | 52 | #undef IMAGE_BRUSH 53 | #undef BOX_BRUSH 54 | #undef BORDER_BRUSH 55 | #undef TTF_FONT 56 | #undef OTF_FONT 57 | 58 | void FHotPatcherStyle::ReloadTextures() 59 | { 60 | if (FSlateApplication::IsInitialized()) 61 | { 62 | FSlateApplication::Get().GetRenderer()->ReloadTextureResources(); 63 | } 64 | } 65 | 66 | const ISlateStyle& FHotPatcherStyle::Get() 67 | { 68 | return *StyleInstance; 69 | } 70 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/SHotPatcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HotPatcherEditor.h" 4 | #include "CoreMinimal.h" 5 | #include "Widgets/DeclarativeSyntaxSupport.h" 6 | #include "Widgets/SCompoundWidget.h" 7 | #include "SVersionUpdater/SVersionUpdaterWidget.h" 8 | #include "Widgets/Layout/SGridPanel.h" 9 | 10 | class SHotPatcher : public SCompoundWidget 11 | { 12 | 13 | public: 14 | SLATE_BEGIN_ARGS(SHotPatcher) 15 | {} 16 | SLATE_END_ARGS() 17 | 18 | public: 19 | /** 20 | * Construct the widget 21 | * 22 | * @param InArgs A declaration from which to construct the widget 23 | */ 24 | void Construct(const FArguments& InArgs,const FSHotPatcherContext& Context); 25 | TSharedPtr GetNotificationListPtr()const; 26 | 27 | 28 | private: 29 | /** The list of active system messages */ 30 | TSharedPtr NotificationListPtr; 31 | // TArray CategoryPages; 32 | TSharedPtr VersionUpdaterWidget; 33 | TSharedPtr ActionPageGridPanel; 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/SHotPatcherPageBase.cpp: -------------------------------------------------------------------------------- 1 | #include "SHotPatcherPageBase.h" 2 | 3 | FReply SHotPatcherPageBase::DoImportConfig()const 4 | { 5 | if (GetActiveAction().IsValid()) 6 | { 7 | GetActiveAction()->ImportConfig(); 8 | } 9 | return FReply::Handled(); 10 | } 11 | 12 | FReply SHotPatcherPageBase::DoImportProjectConfig() const 13 | { 14 | if (GetActiveAction().IsValid()) 15 | { 16 | GetActiveAction()->ImportProjectConfig(); 17 | } 18 | return FReply::Handled(); 19 | } 20 | 21 | FReply SHotPatcherPageBase::DoExportConfig()const 22 | { 23 | if (GetActiveAction().IsValid()) 24 | { 25 | GetActiveAction()->ExportConfig(); 26 | } 27 | return FReply::Handled(); 28 | } 29 | FReply SHotPatcherPageBase::DoResetConfig()const 30 | { 31 | if (GetActiveAction().IsValid()) 32 | { 33 | GetActiveAction()->ResetConfig(); 34 | } 35 | return FReply::Handled(); 36 | } 37 | 38 | TSharedPtr SHotPatcherPageBase::GetActiveAction()const 39 | { 40 | TSharedPtr result; 41 | if (GetContext().IsValid()) 42 | { 43 | if(ActionWidgetMap.Contains(GetContext()->GetModeName())) 44 | { 45 | result = *ActionWidgetMap.Find(GetContext()->GetModeName()); 46 | } 47 | } 48 | return result; 49 | } 50 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/SHotPatcherWidgetBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | // #include "HotPatcherPrivatePCH.h" 4 | #include "SHotPatcherWidgetBase.h" 5 | #include "FlibHotPatcherCoreHelper.h" 6 | #include "FlibPatchParserHelper.h" 7 | #include "FHotPatcherVersion.h" 8 | #include "FlibAssetManageHelper.h" 9 | #include "FPakFileInfo.h" 10 | // engine header 11 | #include "IDesktopPlatform.h" 12 | #include "DesktopPlatformModule.h" 13 | #include "FlibHotPatcherEditorHelper.h" 14 | 15 | #include "Misc/FileHelper.h" 16 | #include "Widgets/Input/SHyperlink.h" 17 | #include "Widgets/Layout/SSeparator.h" 18 | #include "Widgets/Text/SMultiLineEditableText.h" 19 | 20 | #include "Kismet/KismetSystemLibrary.h" 21 | #include "Misc/SecureHash.h" 22 | #include "Misc/ScopedSlowTask.h" 23 | #include "HAL/FileManager.h" 24 | #include "Kismet/KismetTextLibrary.h" 25 | 26 | #define LOCTEXT_NAMESPACE "SHotPatcherCreatePatch" 27 | 28 | void SHotPatcherWidgetBase::Construct(const FArguments& InArgs, TSharedPtr InContext) 29 | { 30 | SetContext(InContext); 31 | // InitMissionNotificationProxy(); 32 | } 33 | 34 | void SHotPatcherWidgetBase::ImportProjectConfig() 35 | { 36 | // import uasset 37 | UFlibHotPatcherCoreHelper::ImportProjectSettingsToScannerConfig(GetConfigSettings()->GetAssetScanConfigRef()); 38 | UFlibHotPatcherCoreHelper::ImportProjectNotAssetDir(GetConfigSettings()->GetAddExternAssetsToPlatform(),ETargetPlatform::AllPlatforms); 39 | } 40 | 41 | FText SHotPatcherWidgetInterface::GetGenerateTooltipText() const 42 | { 43 | return UKismetTextLibrary::Conv_StringToText(TEXT("")); 44 | } 45 | 46 | TArray SHotPatcherWidgetInterface::OpenFileDialog()const 47 | { 48 | TArray SelectedFiles; 49 | SelectedFiles = UFlibHotPatcherEditorHelper::OpenFileDialog( 50 | LOCTEXT("OpenHotPatchConfigDialog", "Open .json").ToString(), 51 | FString(TEXT("")), 52 | TEXT(""), 53 | TEXT("HotPatcher json (*.json)|*.json"), 54 | EFileDialogFlags::None 55 | ); 56 | return SelectedFiles; 57 | } 58 | 59 | 60 | TArray SHotPatcherWidgetInterface::SaveFileDialog()const 61 | { 62 | TArray SaveFilenames; 63 | SaveFilenames = UFlibHotPatcherEditorHelper::SaveFileDialog( 64 | LOCTEXT("SvedHotPatcherConfig", "Save .json").ToString(), 65 | FString(TEXT("")), 66 | TEXT(""), 67 | TEXT("HotPatcher json (*.json)|*.json"), 68 | EFileDialogFlags::None 69 | ); 70 | return SaveFilenames; 71 | } 72 | 73 | 74 | #undef LOCTEXT_NAMESPACE 75 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/SVersionUpdater/FVersionUpdaterManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Interfaces/IHttpRequest.h" 3 | #include "CoreMinimal.h" 4 | #include "Misc/RemoteConfigIni.h" 5 | #include "FCountServerlessWrapper.h" 6 | 7 | struct FChildModDesc 8 | { 9 | FString ModName; 10 | float CurrentVersion = 0.f; 11 | float RemoteVersion = 0.f; 12 | float MinToolVersion = 0.f; 13 | FString Description; 14 | FString URL; 15 | FString UpdateURL; 16 | bool bIsBuiltInMod = false; 17 | }; 18 | 19 | struct FRemteVersionDescrible 20 | { 21 | FRemteVersionDescrible()=default; 22 | FRemteVersionDescrible(const FRemteVersionDescrible&)=default; 23 | 24 | int32 Version; 25 | int32 PatchVersion; 26 | FString Author; 27 | FString Website; 28 | FString URL; 29 | bool b3rdMods; 30 | TMap> ActiveActions; 31 | TMap ModsDesc; 32 | }; 33 | 34 | struct FVersionUpdaterManager 35 | { 36 | static FVersionUpdaterManager& Get() 37 | { 38 | static FVersionUpdaterManager Manager; 39 | return Manager; 40 | } 41 | 42 | void Reset(); 43 | void Update(); 44 | void RequestRemoveVersion(const FString& URL); 45 | FRemteVersionDescrible* GetRemoteVersionByName(FName Name){ return Remotes.Find(Name); } 46 | bool IsRequestFinished()const { return bRequestFinished; } 47 | void AddOnFinishedCallback(TFunction callback){ OnRequestFinishedCallback.Add(callback); } 48 | protected: 49 | void OnRequestComplete(FHttpRequestPtr RequestPtr, FHttpResponsePtr ResponsePtr, bool bConnectedSuccessfully); 50 | FHttpRequestPtr HttpHeadRequest; 51 | TMap Remotes; 52 | bool bRequestFinished = false; 53 | TArray> OnRequestFinishedCallback; 54 | TSharedPtr Counter; 55 | public: 56 | // get mod current version. 57 | TFunction ModCurrentVersionGetter = nullptr; 58 | // check is valid activite mod callback; 59 | TFunction ModIsActivteCallback = nullptr; 60 | 61 | TFunction()> RequestLocalRegistedMods = nullptr; 62 | TFunction()> RequestUnsupportLocalMods = nullptr; 63 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Private/SVersionUpdater/VersionUpdaterStyle.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Styling/SlateStyle.h" 7 | 8 | class FVersionUpdaterStyle 9 | { 10 | public: 11 | 12 | static void Initialize(const FString& Name); 13 | 14 | static void Shutdown(); 15 | 16 | /** reloads textures used by slate renderer */ 17 | static void ReloadTextures(); 18 | 19 | /** @return The Slate style set for the Shooter game */ 20 | static const ISlateStyle& Get(); 21 | 22 | static FName GetStyleSetName(); 23 | 24 | static const FSlateBrush* GetBrush( FName PropertyName, const ANSICHAR* Specifier = NULL ); 25 | private: 26 | 27 | static TSharedRef< class FSlateStyleSet > Create(const FString& Name); 28 | 29 | private: 30 | 31 | static TSharedPtr< class FSlateStyleSet > StyleInstance; 32 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/Cooker/SHotPatcherCookerBase.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Interfaces/ITargetPlatformManagerModule.h" 5 | #include "Interfaces/ITargetPlatform.h" 6 | #include "CreatePatch/FExportPatchSettings.h" 7 | #include "CreatePatch/IPatchableInterface.h" 8 | #include "Model/FCookersModeContext.h" 9 | // engine header 10 | #include "Cooker/HotPatcherCookerSettingBase.h" 11 | #include "Interfaces/ITargetPlatform.h" 12 | #include "Templates/SharedPointer.h" 13 | #include "IDetailsView.h" 14 | #include "MissionNotificationProxy.h" 15 | #include "PropertyEditorModule.h" 16 | #include "SHotPatcherWidgetBase.h" 17 | #include "ThreadUtils/FProcWorkerThread.hpp" 18 | #include "Widgets/Text/SMultiLineEditableText.h" 19 | /** 20 | * Implements the cooked platforms panel. 21 | */ 22 | class SHotPatcherCookerBase : public SHotPatcherWidgetInterface 23 | { 24 | public: 25 | 26 | SLATE_BEGIN_ARGS(SHotPatcherCookerBase) { } 27 | SLATE_END_ARGS() 28 | 29 | public: 30 | 31 | /** 32 | * Constructs the widget. 33 | * 34 | * @param InArgs The Slate argument list. 35 | */ 36 | FORCEINLINE void Construct( const FArguments& InArgs,TSharedPtr InCreateModel) 37 | { 38 | mCreatePatchModel = InCreateModel; 39 | } 40 | 41 | 42 | protected: 43 | FCookersModeContext* GetCookerModelPtr()const { return (FCookersModeContext*)mCreatePatchModel.Get(); } 44 | TSharedPtr mCreatePatchModel; 45 | 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/CreatePatch/SHotPatcherInformations.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | 5 | #include "Templates/SharedPointer.h" 6 | #include "IDetailsView.h" 7 | #include "PropertyEditorModule.h" 8 | #include "Widgets/Text/SMultiLineEditableText.h" 9 | 10 | 11 | class SHotPatcherInformations 12 | : public SCompoundWidget 13 | { 14 | public: 15 | 16 | SLATE_BEGIN_ARGS(SHotPatcherInformations) { } 17 | SLATE_END_ARGS() 18 | 19 | public: 20 | 21 | /** 22 | * Constructs the widget. 23 | * 24 | * @param InArgs The Slate argument list. 25 | */ 26 | void Construct( const FArguments& InArgs); 27 | 28 | public: 29 | 30 | void SetExpanded(bool InExpand); 31 | 32 | void SetContent(const FString& InContent); 33 | 34 | private: 35 | 36 | TSharedPtr DiffAreaWidget; 37 | TSharedPtr MulitText; 38 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/CreatePatch/SHotPatcherPatchWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Model/FPatchersModeContext.h" 6 | #include "CreatePatch/FExportPatchSettings.h" 7 | #include "SHotPatcherInformations.h" 8 | #include "SHotPatcherWidgetBase.h" 9 | #include "FPatchVersionDiff.h" 10 | #include "CreatePatch/FExportPatchSettings.h" 11 | 12 | // engine header 13 | #include "Interfaces/ITargetPlatformManagerModule.h" 14 | #include "Interfaces/ITargetPlatform.h" 15 | #include "Templates/SharedPointer.h" 16 | #include "IDetailsView.h" 17 | #include "PropertyEditorModule.h" 18 | #include "Widgets/Text/SMultiLineEditableText.h" 19 | #include "IStructureDetailsView.h" 20 | 21 | /** 22 | * Implements the cooked platforms panel. 23 | */ 24 | class SHotPatcherPatchWidget 25 | : public SHotPatcherWidgetBase 26 | { 27 | public: 28 | 29 | SLATE_BEGIN_ARGS(SHotPatcherPatchWidget) { } 30 | SLATE_END_ARGS() 31 | 32 | public: 33 | 34 | /** 35 | * Constructs the widget. 36 | * 37 | * @param InArgs The Slate argument list. 38 | */ 39 | void Construct( const FArguments& InArgs,TSharedPtr InCreateModel); 40 | 41 | // IPatchableInterface 42 | public: 43 | virtual void ImportConfig(); 44 | virtual void ExportConfig()const; 45 | virtual void ResetConfig(); 46 | virtual void DoGenerate(); 47 | virtual FString GetMissionName() override{return TEXT("Patch");} 48 | protected: 49 | void CreateExportFilterListView(); 50 | bool CanExportPatch()const; 51 | FReply DoExportPatch(); 52 | virtual FText GetGenerateTooltipText() const override; 53 | 54 | bool CanPreviewPatch()const; 55 | FReply DoPreviewPatch(); 56 | 57 | FReply DoAddToPreset()const; 58 | FReply DoDiff()const; 59 | bool CanDiff()const; 60 | FReply DoClearDiff()const; 61 | EVisibility VisibilityDiffButtons()const; 62 | 63 | FReply DoPreviewChunk()const; 64 | bool CanPreviewChunk()const; 65 | EVisibility VisibilityPreviewChunkButtons()const; 66 | 67 | bool InformationContentIsVisibility()const; 68 | void SetInformationContent(const FString& InContent)const; 69 | void SetInfomationContentVisibility(EVisibility InVisibility)const; 70 | 71 | virtual FExportPatchSettings* GetConfigSettings() override{return ExportPatchSetting.Get();}; 72 | 73 | virtual void ImportProjectConfig() override; 74 | protected: 75 | 76 | void ShowMsg(const FString& InMsg)const; 77 | 78 | private: 79 | 80 | // TSharedPtr mCreatePatchModel; 81 | 82 | /** Settings view ui element ptr */ 83 | TSharedPtr SettingsView; 84 | 85 | TSharedPtr ExportPatchSetting; 86 | 87 | TSharedPtr DiffWidget; 88 | }; 89 | 90 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/CreatePatch/SHotPatcherReleaseWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Model/FPatchersModeContext.h" 6 | #include "SHotPatcherWidgetBase.h" 7 | #include "CreatePatch/FExportPatchSettings.h" 8 | #include "CreatePatch/FExportReleaseSettings.h" 9 | 10 | // engine header 11 | #include "Interfaces/ITargetPlatformManagerModule.h" 12 | #include "Interfaces/ITargetPlatform.h" 13 | #include "Templates/SharedPointer.h" 14 | #include "IDetailsView.h" 15 | #include "PropertyEditorModule.h" 16 | #include "IStructureDetailsView.h" 17 | 18 | /** 19 | * Implements the cooked platforms panel. 20 | */ 21 | class SHotPatcherReleaseWidget 22 | : public SHotPatcherWidgetBase 23 | { 24 | public: 25 | 26 | SLATE_BEGIN_ARGS(SHotPatcherReleaseWidget) { } 27 | SLATE_END_ARGS() 28 | 29 | public: 30 | 31 | /** 32 | * Constructs the widget. 33 | * 34 | * @param InArgs The Slate argument list. 35 | */ 36 | void Construct( const FArguments& InArgs,TSharedPtr InCreateModel); 37 | 38 | public: 39 | virtual void ImportConfig(); 40 | virtual void ExportConfig()const; 41 | virtual void ResetConfig(); 42 | virtual void DoGenerate(); 43 | virtual FString GetMissionName() override{return TEXT("Release");} 44 | virtual FExportReleaseSettings* GetConfigSettings()override{return ExportReleaseSettings.Get();}; 45 | protected: 46 | void CreateExportFilterListView(); 47 | bool CanExportRelease()const; 48 | FReply DoExportRelease(); 49 | virtual FText GetGenerateTooltipText() const override; 50 | private: 51 | 52 | // TSharedPtr mCreatePatchModel; 53 | 54 | /** Settings view ui element ptr */ 55 | TSharedPtr SettingsView; 56 | TSharedPtr ExportReleaseSettings; 57 | }; 58 | 59 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/CreatePatch/SPatchersPage.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Widgets/DeclarativeSyntaxSupport.h" 7 | #include "Widgets/SCompoundWidget.h" 8 | #include "Model/FPatchersModeContext.h" 9 | #include "SHotPatcherWidgetBase.h" 10 | #include "SHotPatcherPageBase.h" 11 | // engine header 12 | #include "Interfaces/ITargetPlatform.h" 13 | #include "Templates/SharedPointer.h" 14 | #include "IDetailsView.h" 15 | #include "PropertyEditorModule.h" 16 | 17 | /** 18 | * Implements the profile page for the session launcher wizard. 19 | */ 20 | class SPatchersPage 21 | : public SHotPatcherPageBase 22 | { 23 | public: 24 | 25 | SLATE_BEGIN_ARGS(SPatchersPage) { } 26 | SLATE_END_ARGS() 27 | 28 | public: 29 | 30 | /** 31 | * Constructs the widget. 32 | * 33 | * @param InArgs The Slate argument list. 34 | */ 35 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 36 | 37 | public: 38 | FText HandlePatchModeComboButtonContentText() const; 39 | void HandleHotPatcherMenuEntryClicked(FString InModeName,TFunction ActionCallback); 40 | virtual FString GetPageName()const override { return TEXT("Patcher"); }; 41 | EVisibility HandleOperatorConfigVisibility()const; 42 | EVisibility HandleImportProjectConfigVisibility()const; 43 | virtual void SelectToAction(const FString& ActionName); 44 | 45 | }; 46 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/FlibHotPatcherEditorHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // engine header 4 | #include "Templates/SharedPointer.h" 5 | #include "Dom/JsonObject.h" 6 | #include "IDesktopPlatform.h" 7 | #include "CoreMinimal.h" 8 | #include "Framework/Notifications/NotificationManager.h" 9 | #include "Widgets/Notifications/SNotificationList.h" 10 | #include "FlibHotPatcherEditorHelper.generated.h" 11 | 12 | UCLASS() 13 | class HOTPATCHEREDITOR_API UFlibHotPatcherEditorHelper : public UBlueprintFunctionLibrary 14 | { 15 | GENERATED_BODY() 16 | public: 17 | static void CreateSaveFileNotify(const FText& InMsg,const FString& InSavedFile,SNotificationItem::ECompletionState NotifyType = SNotificationItem::CS_Success); 18 | static TArray SaveFileDialog(const FString& DialogTitle, const FString& DefaultPath, const FString& DefaultFile, const FString& FileTypes, uint32 Flags); 19 | static TArray OpenFileDialog(const FString& DialogTitle, const FString& DefaultPath, const FString& DefaultFile, const FString& FileTypes, uint32 Flags); 20 | }; 21 | 22 | 23 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/HotPatcherCommands.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Framework/Commands/Commands.h" 7 | #include "HotPatcherStyle.h" 8 | 9 | class FHotPatcherCommands : public TCommands 10 | { 11 | public: 12 | 13 | FHotPatcherCommands() 14 | : TCommands(TEXT("HotPatcher"), NSLOCTEXT("Contexts", "HotPatcher", "HotPatcher Plugin"), NAME_None, FHotPatcherStyle::GetStyleSetName()) 15 | { 16 | } 17 | 18 | // TCommands<> interface 19 | virtual void RegisterCommands() override; 20 | 21 | public: 22 | TSharedPtr< FUICommandInfo > PluginAction; 23 | 24 | TSharedPtr CookSelectedAction; 25 | TSharedPtr CookAndPakSelectedAction; 26 | TSharedPtr AddToPakSettingsAction; 27 | }; 28 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/HotPatcherModBaseModule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "HotPatcherActionManager.h" 5 | #include "Modules/ModuleManager.h" 6 | 7 | class HOTPATCHEREDITOR_API FHotPatcherModBaseModule : public IModuleInterface 8 | { 9 | public: 10 | 11 | /** IModuleInterface implementation */ 12 | virtual void StartupModule() override; 13 | virtual void ShutdownModule() override; 14 | virtual FHotPatcherModDesc GetModDesc()const { return ModDesc; }; 15 | private: 16 | FHotPatcherModDesc ModDesc; 17 | }; 18 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/HotPatcherStyle.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Lipeng Zha, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Styling/SlateStyle.h" 7 | 8 | class FHotPatcherStyle 9 | { 10 | public: 11 | 12 | static void Initialize(); 13 | 14 | static void Shutdown(); 15 | 16 | /** reloads textures used by slate renderer */ 17 | static void ReloadTextures(); 18 | 19 | /** @return The Slate style set for the Shooter game */ 20 | static const ISlateStyle& Get(); 21 | 22 | static FName GetStyleSetName(); 23 | 24 | private: 25 | 26 | static TSharedRef< class FSlateStyleSet > Create(); 27 | 28 | private: 29 | 30 | static TSharedPtr< class FSlateStyleSet > StyleInstance; 31 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/MissionNotificationProxy.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "UObject/NoExportTypes.h" 7 | #include "MissionNotificationProxy.generated.h" 8 | 9 | class FProcWorkerThread; 10 | 11 | DECLARE_MULTICAST_DELEGATE(FMissionCanceled); 12 | /** 13 | * 14 | */ 15 | UCLASS() 16 | class HOTPATCHEREDITOR_API UMissionNotificationProxy : public UObject 17 | { 18 | GENERATED_UCLASS_BODY() 19 | public: 20 | 21 | virtual void ReceiveOutputMsg(FProcWorkerThread* Worker,const FString& InMsg); 22 | virtual void SpawnRuningMissionNotification(FProcWorkerThread* ProcWorker); 23 | virtual void SpawnMissionSuccessedNotification(FProcWorkerThread* ProcWorker); 24 | virtual void SpawnMissionFaildNotification(FProcWorkerThread* ProcWorker); 25 | virtual void CancelMission(); 26 | 27 | virtual void SetMissionName(FName NewMissionName); 28 | virtual void SetMissionNotifyText(const FText& RunningText,const FText& CancelText,const FText& SuccessedText,const FText& FaildText); 29 | FMissionCanceled MissionCanceled; 30 | protected: 31 | TWeakPtr PendingProgressPtr; 32 | bool bRunning = false; 33 | FText RunningNotifyText; 34 | FText RunningNofityCancelText; 35 | FText MissionSuccessedNotifyText; 36 | FText MissionFailedNotifyText; 37 | FName MissionName; 38 | }; 39 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/Model/FCookersModeContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "FHotPatcherContextBase.h" 5 | #include "Templates/HotPatcherTemplateHelper.hpp" 6 | #include "FCookersModeContext.generated.h" 7 | 8 | UENUM(BlueprintType) 9 | enum class EHotPatcherCookActionMode:uint8 10 | { 11 | ByOriginal, 12 | Count UMETA(Hidden) 13 | }; 14 | ENUM_RANGE_BY_COUNT(EHotPatcherCookActionMode, EHotPatcherCookActionMode::Count); 15 | 16 | struct HOTPATCHEREDITOR_API FCookersModeContext:public FHotPatcherContextBase 17 | { 18 | public: 19 | virtual FName GetContextName()const override{ return TEXT("Cooker"); } 20 | }; 21 | 22 | #if ENGINE_MAJOR_VERSION <= 4 && ENGINE_MINOR_VERSION <= 21 23 | namespace THotPatcherTemplateHelper 24 | { 25 | template<> 26 | std::string GetCPPTypeName() 27 | { 28 | return std::string("EHotPatcherCookActionMode"); 29 | }; 30 | } 31 | #endif -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/Model/FHotPatcherContextBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "Templates/HotPatcherTemplateHelper.hpp" 5 | 6 | #define CREATE_ACTION_WIDGET_LAMBDA(WIDGET_CLASS,MODENAME) \ 7 | [](TSharedPtr InContext)->TSharedRef{\ 8 | return SNew(WIDGET_CLASS,InContext).Visibility_Lambda([=]()->EVisibility{\ 9 | return InContext->GetModeName().IsEqual(MODENAME) ? EVisibility::Visible : EVisibility::Collapsed;\ 10 | });} 11 | 12 | struct HOTPATCHEREDITOR_API FHotPatcherContextBase 13 | { 14 | public: 15 | FHotPatcherContextBase()=default; 16 | FHotPatcherContextBase(const FHotPatcherContextBase&)=default; 17 | virtual ~FHotPatcherContextBase(){} 18 | virtual FName GetContextName()const{ return TEXT(""); } 19 | FORCEINLINE_DEBUGGABLE virtual void SetModeByName(FName InPatcherModeName) 20 | { 21 | ModeName = InPatcherModeName.ToString(); 22 | } 23 | FORCEINLINE_DEBUGGABLE virtual FName GetModeName(){ return *ModeName; } 24 | protected: 25 | FString ModeName; 26 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/Model/FPatchersModeContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Templates/HotPatcherTemplateHelper.hpp" 3 | #include "CoreMinimal.h" 4 | #include "FHotPatcherContextBase.h" 5 | #include "FPatchersModeContext.generated.h" 6 | 7 | UENUM(BlueprintType) 8 | enum class EHotPatcherActionModes:uint8 9 | { 10 | ByPatch, 11 | ByRelease, 12 | ByShaderPatch, 13 | ByGameFeature, 14 | Count UMETA(Hidden) 15 | }; 16 | ENUM_RANGE_BY_COUNT(EHotPatcherActionModes, EHotPatcherActionModes::Count); 17 | 18 | 19 | struct HOTPATCHEREDITOR_API FPatchersModeContext: public FHotPatcherContextBase 20 | { 21 | public: 22 | virtual ~FPatchersModeContext(){}; 23 | virtual FName GetContextName()const override{ return TEXT("Patch"); } 24 | }; 25 | 26 | #if ENGINE_MAJOR_VERSION <= 4 && ENGINE_MINOR_VERSION <= 21 27 | namespace THotPatcherTemplateHelper 28 | { 29 | template<> 30 | std::string GetCPPTypeName() 31 | { 32 | return std::string("EHotPatcherActionModes"); 33 | }; 34 | } 35 | #endif -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/SHotPatcherPageBase.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Widgets/DeclarativeSyntaxSupport.h" 7 | #include "Widgets/SCompoundWidget.h" 8 | #include "Model/FPatchersModeContext.h" 9 | #include "SHotPatcherWidgetBase.h" 10 | 11 | // engine header 12 | #include "Interfaces/ITargetPlatform.h" 13 | #include "Templates/SharedPointer.h" 14 | #include "IDetailsView.h" 15 | #include "PropertyEditorModule.h" 16 | 17 | /** 18 | * Implements the profile page for the session launcher wizard. 19 | */ 20 | class SHotPatcherPageBase 21 | : public SCompoundWidget 22 | { 23 | public: 24 | 25 | SLATE_BEGIN_ARGS(SHotPatcherPageBase) { } 26 | SLATE_END_ARGS() 27 | 28 | public: 29 | 30 | /** 31 | * Constructs the widget. 32 | * 33 | * @param InArgs The Slate argument list. 34 | */ 35 | void Construct( const FArguments& InArgs,TSharedPtr InContext) 36 | { 37 | SetContext(InContext); 38 | } 39 | virtual void SetContext(TSharedPtr InContext) 40 | { 41 | Context = InContext; 42 | } 43 | 44 | FReply DoExportConfig()const; 45 | FReply DoImportConfig()const; 46 | FReply DoImportProjectConfig()const; 47 | FReply DoResetConfig()const; 48 | 49 | virtual TSharedPtr GetContext()const { return Context; } 50 | virtual TMap> GetActionWidgetMap()const { return ActionWidgetMap; } 51 | virtual FString GetPageName()const { return TEXT(""); }; 52 | virtual TSharedPtr GetActiveAction()const; 53 | virtual void SelectToAction(const FString& ActionName){} 54 | protected: 55 | TSharedPtr Context; 56 | mutable TMap> ActionWidgetMap; 57 | }; 58 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherEditor/Public/SHotPatcherWidgetBase.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | #include "Interfaces/ITargetPlatformManagerModule.h" 5 | #include "Interfaces/ITargetPlatform.h" 6 | #include "Model/FPatchersModeContext.h" 7 | #include "CreatePatch/FExportPatchSettings.h" 8 | #include "CreatePatch/IPatchableInterface.h" 9 | #include "Model/FHotPatcherContextBase.h" 10 | 11 | // engine header 12 | #include "Interfaces/ITargetPlatform.h" 13 | #include "Templates/SharedPointer.h" 14 | #include "IDetailsView.h" 15 | #include "MissionNotificationProxy.h" 16 | #include "PropertyEditorModule.h" 17 | #include "ThreadUtils/FProcWorkerThread.hpp" 18 | #include "Widgets/Text/SMultiLineEditableText.h" 19 | 20 | class HOTPATCHEREDITOR_API SHotPatcherWidgetInterface 21 | : public SCompoundWidget, public IPatchableInterface 22 | { 23 | public: 24 | 25 | SLATE_BEGIN_ARGS(SHotPatcherWidgetInterface) { } 26 | SLATE_END_ARGS() 27 | 28 | virtual void ImportProjectConfig(){}; 29 | FORCEINLINE virtual void ImportConfig() {}; 30 | FORCEINLINE virtual void ExportConfig()const {}; 31 | FORCEINLINE virtual void ResetConfig() {}; 32 | FORCEINLINE virtual void DoGenerate() {}; 33 | virtual FPatcherEntitySettingBase* GetConfigSettings(){return nullptr;}; 34 | virtual FString GetMissionName(){return TEXT("");}; 35 | 36 | virtual FText GetGenerateTooltipText() const; 37 | virtual TArray OpenFileDialog()const; 38 | virtual TArray SaveFileDialog()const; 39 | }; 40 | /** 41 | * Implements the cooked platforms panel. 42 | */ 43 | class HOTPATCHEREDITOR_API SHotPatcherWidgetBase 44 | : public SHotPatcherWidgetInterface 45 | { 46 | public: 47 | 48 | SLATE_BEGIN_ARGS(SHotPatcherWidgetBase) { } 49 | SLATE_END_ARGS() 50 | 51 | public: 52 | 53 | /** 54 | * Constructs the widget. 55 | * 56 | * @param InArgs The Slate argument list. 57 | */ 58 | void Construct( const FArguments& InArgs,TSharedPtr InContext); 59 | 60 | virtual void ImportProjectConfig() override; 61 | 62 | virtual FHotPatcherSettingBase* GetConfigSettings(){return nullptr;}; 63 | virtual TSharedPtr GetContext() { return mContext; } 64 | virtual void SetContext(TSharedPtr InContext) 65 | { 66 | mContext = InContext; 67 | } 68 | protected: 69 | TSharedPtr mContext; 70 | 71 | }; 72 | 73 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/HotPatcherRuntime.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using System; 4 | using System.IO; 5 | using UnrealBuildTool; 6 | 7 | public class HotPatcherRuntime : ModuleRules 8 | { 9 | public HotPatcherRuntime(ReadOnlyTargetRules Target) : base(Target) 10 | { 11 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 12 | 13 | PublicIncludePaths.AddRange( 14 | new string[] { 15 | Path.Combine(EngineDirectory,"Source/Runtime/Launch"), 16 | Path.Combine(ModuleDirectory,"Public"), 17 | Path.Combine(ModuleDirectory,"Public/BaseTypes"), 18 | Path.Combine(ModuleDirectory,"Public/Templates") 19 | // ... add public include paths required here ... 20 | } 21 | ); 22 | 23 | 24 | PrivateIncludePaths.AddRange( 25 | new string[] { 26 | // ... add other private include paths required here ... 27 | } 28 | ); 29 | 30 | if (Target.bBuildEditor) 31 | { 32 | PublicDependencyModuleNames.AddRange(new string[] 33 | { 34 | "TargetPlatform" 35 | }); 36 | } 37 | 38 | PublicDependencyModuleNames.AddRange( 39 | new string[] 40 | { 41 | "CoreUObject", 42 | "RHI", 43 | "Core", 44 | "Projects", 45 | "Json", 46 | "JsonUtilities", 47 | "PakFile", 48 | "AssetRegistry", 49 | "BinariesPatchFeature" 50 | // ... add other public dependencies that you statically link with here ... 51 | } 52 | ); 53 | 54 | PrivateDependencyModuleNames.AddRange( 55 | new string[] 56 | { 57 | "CoreUObject", 58 | "Engine", 59 | "Slate", 60 | "SlateCore", 61 | "HTTP", 62 | "Sockets" 63 | // ... add private dependencies that you statically link with here ... 64 | } 65 | ); 66 | 67 | if (Target.Version.MajorVersion > 4 || Target.Version.MinorVersion > 21) 68 | { 69 | PrivateDependencyModuleNames.Add("RenderCore"); 70 | } 71 | else 72 | { 73 | PrivateDependencyModuleNames.Add("ShaderCore"); 74 | } 75 | 76 | BuildVersion Version; 77 | BuildVersion.TryRead(BuildVersion.GetDefaultFileName(), out Version); 78 | // PackageContext 79 | System.Func AddPublicDefinitions = (string MacroName,bool bEnable) => 80 | { 81 | PublicDefinitions.Add(string.Format("{0}={1}",MacroName, bEnable ? 1 : 0)); 82 | return true; 83 | }; 84 | 85 | AddPublicDefinitions("WITH_EDITOR_SECTION", Version.MajorVersion > 4 || Version.MinorVersion > 24); 86 | bool bForceSingleThread = (Version.MajorVersion == 4 && Version.MinorVersion < 25) || 87 | (Version.MajorVersion == 5 && Version.MinorVersion >= 1); 88 | AddPublicDefinitions("FORCE_SINGLE_THREAD",bForceSingleThread); 89 | 90 | bool bEnableAssetDependenciesDebugLog = true; 91 | AddPublicDefinitions("ASSET_DEPENDENCIES_DEBUG_LOG", bEnableAssetDependenciesDebugLog); 92 | 93 | bool bCustomAssetGUID = false; 94 | 95 | if (Version.MajorVersion > 4) { bCustomAssetGUID = true; } 96 | if(bCustomAssetGUID) 97 | { 98 | PublicDefinitions.Add("CUSTOM_ASSET_GUID"); 99 | } 100 | AddPublicDefinitions("WITH_UE5", Version.MajorVersion > 4); 101 | 102 | AddPublicDefinitions("AUTOLOAD_SHADERLIB_AT_RUNTIME", true); 103 | bLegacyPublicIncludePaths = false; 104 | OptimizeCode = CodeOptimization.InShippingBuildsOnly; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FAssetScanConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "BaseTypes/FAssetScanConfig.h" 2 | 3 | bool FAssetScanConfig::IsMatchForceSkip(const FSoftObjectPath& ObjectPath,FString& OutReason) 4 | { 5 | SCOPED_NAMED_EVENT_TEXT("IsMatchForceSkip",FColor::Red); 6 | bool bSkip = false; 7 | if(bForceSkipContent) 8 | { 9 | bool bSkipAsset = ForceSkipAssets.Contains(ObjectPath); 10 | if(bSkipAsset) 11 | { 12 | OutReason = FString::Printf(TEXT("IsForceSkipAsset")); 13 | } 14 | bool bSkipDir = false; 15 | for(const auto& ForceSkipDir:ForceSkipContentRules) 16 | { 17 | if(ObjectPath.GetLongPackageName().StartsWith(ForceSkipDir.Path)) 18 | { 19 | bSkipDir = true; 20 | OutReason = FString::Printf(TEXT("ForceSkipDir %s"),*ForceSkipDir.Path); 21 | break; 22 | } 23 | } 24 | bool bSkipClasses = false; 25 | FName AssetClassesName = UFlibAssetManageHelper::GetAssetType(ObjectPath); 26 | for(const auto& Classes:ForceSkipClasses) 27 | { 28 | if(Classes->GetFName().IsEqual(AssetClassesName)) 29 | { 30 | OutReason = FString::Printf(TEXT("ForceSkipClasses %s"),*Classes->GetName()); 31 | bSkipClasses = true; 32 | break; 33 | } 34 | } 35 | bSkip = bSkipAsset || bSkipDir || bSkipClasses; 36 | } 37 | return bSkip; 38 | } 39 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FBinariesPatchConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "FBinariesPatchConfig.h" 2 | #include "FlibPatchParserHelper.h" 3 | 4 | FString FBinariesPatchConfig::GetBinariesPatchFeatureName() const 5 | { 6 | return THotPatcherTemplateHelper::GetEnumNameByValue(BinariesPatchType); 7 | } 8 | 9 | FString FBinariesPatchConfig::GetOldCookedDir() const 10 | { 11 | return UFlibPatchParserHelper::ReplaceMarkPath(OldCookedDir.Path); 12 | } 13 | 14 | FString FBinariesPatchConfig::GetBasePakExtractCryptoJson() const 15 | { 16 | FString JsonFile; 17 | if(EncryptSettings.bUseDefaultCryptoIni) 18 | { 19 | JsonFile = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::ProjectSavedDir(),TEXT("HotPatcher/Crypto.json"))); 20 | FPakEncryptionKeys PakEncryptionKeys = UFlibPatchParserHelper::GetCryptoByProjectSettings(); 21 | UFlibPatchParserHelper::SerializePakEncryptionKeyToFile(PakEncryptionKeys,JsonFile); 22 | } 23 | else 24 | { 25 | JsonFile = UFlibPatchParserHelper::ReplaceMarkPath(EncryptSettings.CryptoKeys.FilePath); 26 | } 27 | return JsonFile; 28 | } 29 | 30 | bool FBinariesPatchConfig::IsMatchIgnoreRules(const FPakCommandItem& File) 31 | { 32 | bool bIsIgnore = false; 33 | if(!FPaths::FileExists(File.AssetAbsPath)) 34 | return false; 35 | uint64 FileSize = IFileManager::Get().FileSize(*File.AssetAbsPath); 36 | 37 | auto FormatMatcher = [](const FString& File,const TArray& Formaters)->bool 38 | { 39 | bool bFormatMatch = !Formaters.Num(); 40 | for(const auto& FileFormat:Formaters) 41 | { 42 | if(!FileFormat.IsEmpty() && File.EndsWith(FileFormat,ESearchCase::CaseSensitive)) 43 | { 44 | bFormatMatch = true; 45 | break; 46 | } 47 | } 48 | return bFormatMatch; 49 | }; 50 | 51 | auto SizeMatcher = [](uint64 FileSize,const FMatchRule& MatchRule)->bool 52 | { 53 | bool bMatch = false; 54 | uint64 RuleSize = MatchRule.Size * 1024; // kb to byte 55 | switch (MatchRule.Operator) 56 | { 57 | case EMatchOperator::GREAT_THAN: 58 | { 59 | bMatch = FileSize > RuleSize; 60 | break; 61 | } 62 | case EMatchOperator::LESS_THAN: 63 | { 64 | bMatch = FileSize < RuleSize; 65 | break; 66 | } 67 | case EMatchOperator::EQUAL: 68 | { 69 | bMatch = FileSize == RuleSize; 70 | break; 71 | } 72 | case EMatchOperator::None: 73 | { 74 | bMatch = true; 75 | break; 76 | } 77 | } 78 | return bMatch; 79 | }; 80 | 81 | for(const auto& Rule:GetMatchRules()) 82 | { 83 | bool bSizeMatch = SizeMatcher(FileSize,Rule); 84 | bool bFormatMatch = FormatMatcher(File.AssetAbsPath,Rule.Formaters); 85 | bool bMatched = bSizeMatch && bFormatMatch; 86 | bIsIgnore = Rule.Rule == EMatchRule::MATCH ? !bMatched : bMatched; 87 | } 88 | return bIsIgnore; 89 | } 90 | 91 | 92 | TArray FBinariesPatchConfig::GetBaseVersionPakByPlatform(ETargetPlatform Platform) 93 | { 94 | TArray result; 95 | for(const auto& BaseVersionPak:GetBaseVersionPaks()) 96 | { 97 | if(BaseVersionPak.Platform == Platform) 98 | { 99 | for(const auto& Path:BaseVersionPak.Paks) 100 | { 101 | result.Emplace(UFlibPatchParserHelper::ReplaceMarkPath(Path.FilePath)); 102 | } 103 | } 104 | } 105 | return result; 106 | } -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FExternFileInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "BaseTypes/FExternFileInfo.h" 2 | 3 | #include "FlibPatchParserHelper.h" 4 | 5 | FString FExternFileInfo::GenerateFileHash(EHashCalculator HashCalculator) 6 | { 7 | FileHash = GetFileHash(HashCalculator); 8 | return FileHash; 9 | } 10 | 11 | FString FExternFileInfo::GetFileHash(EHashCalculator HashCalculator)const 12 | { 13 | return UFlibPatchParserHelper::FileHash(GetReplaceMarkdFilePath(),HashCalculator); 14 | } 15 | 16 | FString FExternFileInfo::GetReplaceMarkdFilePath() const 17 | { 18 | return UFlibPatchParserHelper::ReplaceMark(FilePath.FilePath); 19 | } 20 | 21 | 22 | void FExternFileInfo::SetFilePath(const FString& InFilePath) 23 | { 24 | FilePath.FilePath = UFlibPatchParserHelper::MakeMark(InFilePath); 25 | } -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/FlibReflectionHelper.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | 4 | #include "FlibReflectionHelper.h" 5 | 6 | FProperty* UFlibReflectionHelper::GetPropertyByName(UClass* Class, FName PropertyName) 7 | { 8 | FProperty* Property = nullptr; 9 | for(TFieldIterator PropertyIter(Class);PropertyIter;++PropertyIter) 10 | { 11 | FProperty* PropertyIns = *PropertyIter; 12 | if(PropertyIns->GetName().Equals(PropertyName.ToString())) 13 | { 14 | Property = PropertyIns; 15 | } 16 | } 17 | return Property; 18 | } 19 | 20 | FString UFlibReflectionHelper::ExportPropertyToText(UObject* Object, FName PropertyName) 21 | { 22 | FString Value; 23 | FProperty* Property = GetPropertyByName(Object->GetClass(),PropertyName); 24 | if(Property) 25 | { 26 | Property->ExportTextItem(Value,Property->ContainerPtrToValuePtr(Object),nullptr,Object,0); 27 | } 28 | return Value; 29 | } 30 | 31 | bool UFlibReflectionHelper::ImportPropertyValueFromText(UObject* Object, FName PropertyName,const FString& Text) 32 | { 33 | FProperty* Property = GetPropertyByName(Object->GetClass(),PropertyName); 34 | if(Property) 35 | { 36 | Property->ImportText(*Text,Property->ContainerPtrToValuePtr(Object),0,Object); 37 | } 38 | return true; 39 | } 40 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/HotPatcher.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "HotPatcherRuntime.h" 4 | #include "FlibPatchParserHelper.h" 5 | #include "ETargetPlatform.h" 6 | #include "Misc/EnumRange.h" 7 | #include "HotPatcherLog.h" 8 | 9 | #define LOCTEXT_NAMESPACE "FHotPatcherRuntimeModule" 10 | 11 | bool GForceSingleThread = (bool)FORCE_SINGLE_THREAD; 12 | 13 | void FHotPatcherRuntimeModule::StartupModule() 14 | { 15 | UE_LOG(LogHotPatcher,Display,TEXT("HotPatcherRuntime StartupModule")); 16 | #if AUTOLOAD_SHADERLIB_AT_RUNTIME && !WITH_EDITOR 17 | UFlibPakHelper::LoadHotPatcherAllShaderLibrarys(); 18 | #endif 19 | } 20 | 21 | void FHotPatcherRuntimeModule::ShutdownModule() 22 | { 23 | // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, 24 | // we call this function before unloading the module. 25 | } 26 | 27 | #undef LOCTEXT_NAMESPACE 28 | 29 | IMPLEMENT_MODULE(FHotPatcherRuntimeModule, HotPatcherRuntime) -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/HotPatcherAssetManager.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | 4 | #include "HotPatcherAssetManager.h" 5 | 6 | #include "HotPatcherLog.h" 7 | 8 | void UHotPatcherAssetManager::ScanPrimaryAssetTypesFromConfig() 9 | { 10 | SCOPED_NAMED_EVENT_TEXT("ScanPrimaryAssetTypesFromConfig",FColor::Red); 11 | // ++[RSTUDIO][lipengzha] allow disable scan primaryasset at engine init 12 | static const bool bNoScanPrimaryAsset = FParse::Param(FCommandLine::Get(), TEXT("NoScanPrimaryAsset")); 13 | if(bNoScanPrimaryAsset) 14 | { 15 | UE_LOG(LogHotPatcher,Display,TEXT("Skip ScanPrimaryAssetTypesFromConfig")); 16 | return; 17 | } 18 | // --[RSTUDIO] 19 | Super::ScanPrimaryAssetTypesFromConfig(); 20 | } 21 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/HotPatcherLog.cpp: -------------------------------------------------------------------------------- 1 | #include "HotPatcherLog.h" 2 | 3 | DEFINE_LOG_CATEGORY(LogHotPatcher); 4 | 5 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/MountListener.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #include "MountListener.h" 4 | #include "FlibPakHelper.h" 5 | #include "IPlatformFilePak.h" 6 | 7 | DECLARE_LOG_CATEGORY_CLASS(LogMountListener, Log, All); 8 | 9 | UMountListener::UMountListener(const FObjectInitializer& Initializer):Super(Initializer) 10 | { 11 | } 12 | 13 | void UMountListener::Init() 14 | { 15 | if(!HasAnyFlags(RF_ClassDefaultObject)) 16 | { 17 | #if ENGINE_MAJOR_VERSION >4 || ENGINE_MINOR_VERSION >=26 18 | FCoreDelegates::OnPakFileMounted2.AddLambda([this](const IPakFile& PakFile){this->OnMountPak(*PakFile.PakGetPakFilename(),0);}); 19 | #endif 20 | 21 | #if ENGINE_MINOR_VERSION <=25 && ENGINE_MINOR_VERSION > 24 22 | FCoreDelegates::OnPakFileMounted.AddLambda([this](const TCHAR* Pak, const int32 ChunkID){this->OnMountPak(Pak,ChunkID);}); 23 | #endif 24 | 25 | #if ENGINE_MAJOR_VERSION <=4 && ENGINE_MINOR_VERSION <= 24 26 | FCoreDelegates::PakFileMountedCallback.AddLambda([this](const TCHAR* Pak){this->OnMountPak(Pak,0);}); 27 | #endif 28 | FCoreDelegates::OnUnmountPak.BindUObject(this,&UMountListener::OnUnMountPak); 29 | #if !WITH_EDITOR 30 | FPakPlatformFile* PakFileMgr = (FPakPlatformFile*)(FPlatformFileManager::Get().FindPlatformFile(FPakPlatformFile::GetTypeName())); 31 | TArray MountedPaks = UFlibPakHelper::GetAllMountedPaks(); 32 | for(const auto& Pak:MountedPaks) 33 | { 34 | #if ENGINE_MAJOR_VERSION >4 || ENGINE_MINOR_VERSION > 24 35 | OnMountPak(*Pak,UFlibPakHelper::GetPakOrderByPakPath(Pak)); 36 | #else 37 | OnMountPak(*Pak); 38 | #endif 39 | } 40 | #endif 41 | } 42 | } 43 | 44 | void UMountListener::OnMountPak(const TCHAR* PakFileName, int32 ChunkID) 45 | { 46 | UE_LOG(LogMountListener,Log,TEXT("Pak %s is Mounted!"),PakFileName); 47 | FPakMountInfo MountedPak; 48 | MountedPak.Pak = PakFileName; 49 | MountedPak.PakOrder = ChunkID; 50 | MountedPak.PakOrder = UFlibPakHelper::GetPakOrderByPakPath(PakFileName); 51 | PaksMap.Add(MountedPak.Pak,MountedPak); 52 | OnMountPakDelegate.Broadcast(MountedPak); 53 | } 54 | 55 | bool UMountListener::OnUnMountPak(const FString& Pak) 56 | { 57 | PaksMap.Remove(Pak); 58 | OnUnMountPakDelegate.Broadcast(Pak); 59 | return true; 60 | } 61 | 62 | TMap& UMountListener::GetMountedPaks() 63 | { 64 | return PaksMap; 65 | } -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/ReleaseParser/FReleasePakParser.cpp: -------------------------------------------------------------------------------- 1 | #include "FReleasePakParser.h" 2 | #include "HotPatcherLog.h" 3 | #include "FlibPakHelper.h" 4 | #include "FlibPatchParserHelper.h" 5 | #include "Misc/EngineVersionComparison.h" 6 | 7 | void FReleasePakParser::Parser(TSharedPtr ParserConf, EHashCalculator HashCalculator) 8 | { 9 | result.Platform = ParserConf->TargetPlatform; 10 | FReleasePakFilesConf* Conf = (FReleasePakFilesConf*)ParserConf.Get(); 11 | 12 | TArray InnerPakFiles; 13 | for(const auto& pakFile:Conf->PakFiles) 14 | { 15 | InnerPakFiles.Append(UFlibPakHelper::GetPakFileList(pakFile,Conf->AESKey)); 16 | } 17 | 18 | for(const auto& MountFile:InnerPakFiles) 19 | { 20 | FString Extersion = FPaths::GetExtension(MountFile,true); 21 | bool bIsWPFiles = false; 22 | #if UE_VERSION_NEWER_THAN(5,0,0) 23 | bIsWPFiles = MountFile.Contains(TEXT("/_Generated_/")); 24 | #endif 25 | if(!bIsWPFiles && UFlibPatchParserHelper::GetCookedUassetExtensions().Contains(Extersion)) 26 | { 27 | if (!UFlibPatchParserHelper::GetUnCookUassetExtensions().Contains(Extersion)) 28 | continue; 29 | // is uasset or umap 30 | FPatcherSpecifyAsset SpecifyAsset; 31 | FString AbsFile = UFlibPatchParserHelper::AssetMountPathToAbs(MountFile); 32 | FString LongPackageName; 33 | if(FPackageName::TryConvertFilenameToLongPackageName(AbsFile,LongPackageName)) 34 | { 35 | FString PackagePath = UFlibAssetManageHelper::LongPackageNameToPackagePath(LongPackageName); 36 | FPatcherSpecifyAsset currentAsset; 37 | currentAsset.Asset = FSoftObjectPath(PackagePath); 38 | currentAsset.bAnalysisAssetDependencies = false; 39 | if(currentAsset.Asset.IsValid()) 40 | { 41 | result.Assets.Add(currentAsset); 42 | } 43 | } 44 | else 45 | { 46 | UE_LOG(LogHotPatcher,Warning,TEXT("%s conv to abs path failed!"),*MountFile); 47 | } 48 | } 49 | else 50 | { 51 | // not uasset 52 | FExternFileInfo currentFile; 53 | FString RelativePath = MountFile; 54 | FString ModuleName; 55 | FString ModuleAbsPath; 56 | while(RelativePath.RemoveFromStart(TEXT("../"))); 57 | 58 | UFlibAssetManageHelper::GetModuleNameByRelativePath(RelativePath,ModuleName); 59 | UFlibAssetManageHelper::GetEnableModuleAbsDir(ModuleName,ModuleAbsPath); 60 | RelativePath.RemoveFromStart(ModuleName); 61 | FString FinalFilePath = FPaths::Combine(ModuleAbsPath,RelativePath); 62 | FPaths::NormalizeFilename(FinalFilePath); 63 | FinalFilePath = FinalFilePath.Replace(TEXT("//"),TEXT("/")); 64 | if(FPaths::FileExists(FinalFilePath)) 65 | { 66 | currentFile.SetFilePath(FinalFilePath); 67 | currentFile.MountPath = MountFile; 68 | currentFile.GenerateFileHash(HashCalculator); 69 | result.ExternFiles.AddUnique(currentFile); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/ReleaseParser/FReleasePakParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IReleaseParser.h" 4 | 5 | struct FReleasePakParser : public IReleaseParser 6 | { 7 | virtual void Parser(TSharedPtr ParserConf, EHashCalculator HashCalculator) override; 8 | }; 9 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/ReleaseParser/FReleasePaklistParser.cpp: -------------------------------------------------------------------------------- 1 | #include "FReleasePaklistParser.h" 2 | #include "Misc/FileHelper.h" 3 | #include "FlibPatchParserHelper.h" 4 | #include "HotPatcherLog.h" 5 | #include "Kismet/KismetStringLibrary.h" 6 | #include "Misc/EngineVersionComparison.h" 7 | 8 | 9 | FString NormalizePaklistPath(const FString& InStr) 10 | { 11 | FString resultStr = InStr; 12 | if(resultStr.StartsWith(TEXT("\""))) 13 | { 14 | resultStr.RemoveAt(0); 15 | } 16 | if(resultStr.EndsWith(TEXT("\""))) 17 | { 18 | resultStr.RemoveAt(resultStr.Len() - 1); 19 | } 20 | return resultStr; 21 | }; 22 | 23 | struct FPakListAssetItem 24 | { 25 | FString AbsPath; 26 | FString MountPak; 27 | }; 28 | 29 | FPakListAssetItem BreakPakListLine(const FString& PakListLine) 30 | { 31 | FPakListAssetItem result; 32 | TArray AssetPakCmd = UKismetStringLibrary::ParseIntoArray(PakListLine,TEXT("\" ")); 33 | 34 | FString AssetAbsPath = AssetPakCmd[0]; 35 | FString AssetMountPath = AssetPakCmd[1]; 36 | result.AbsPath = NormalizePaklistPath(AssetAbsPath); 37 | result.MountPak = NormalizePaklistPath(AssetMountPath); 38 | return result; 39 | } 40 | 41 | void FReleasePaklistParser::Parser(TSharedPtr ParserConf, EHashCalculator HashCalculator) 42 | { 43 | result.Platform = ParserConf->TargetPlatform; 44 | FReleasePakListConf* Conf = (FReleasePakListConf*)ParserConf.Get(); 45 | 46 | for(const auto& ResponseFile:Conf->PakResponseFiles) 47 | { 48 | if (FPaths::FileExists(ResponseFile)) 49 | { 50 | TArray PakListContent; 51 | if (FFileHelper::LoadFileToStringArray(PakListContent, *ResponseFile)) 52 | { 53 | for(const auto& PakListLine:PakListContent) 54 | { 55 | FPakListAssetItem LineItem = BreakPakListLine(PakListLine); 56 | FString Extersion = FPaths::GetExtension(LineItem.MountPak,true); 57 | bool bIsWPFiles = false; 58 | #if UE_VERSION_NEWER_THAN(5,0,0) 59 | bIsWPFiles = LineItem.MountPak.Contains(TEXT("/_Generated_/")); 60 | #endif 61 | if(!bIsWPFiles && UFlibPatchParserHelper::GetCookedUassetExtensions().Contains(Extersion)) 62 | { 63 | if(UFlibPatchParserHelper::GetUnCookUassetExtensions().Contains(Extersion)) 64 | { 65 | // is uasset 66 | FPatcherSpecifyAsset SpecifyAsset; 67 | FString AbsFile = UFlibPatchParserHelper::AssetMountPathToAbs(LineItem.MountPak); 68 | FString LongPackageName; 69 | if(FPackageName::TryConvertFilenameToLongPackageName(AbsFile,LongPackageName)) 70 | { 71 | FString PackagePath = UFlibAssetManageHelper::LongPackageNameToPackagePath(LongPackageName); 72 | SpecifyAsset.Asset = FSoftObjectPath{PackagePath}; 73 | SpecifyAsset.bAnalysisAssetDependencies = false; 74 | SpecifyAsset.AssetRegistryDependencyTypes = {EAssetRegistryDependencyTypeEx::None}; 75 | if(SpecifyAsset.Asset.IsValid()) 76 | result.Assets.Add(SpecifyAsset); 77 | } 78 | else 79 | { 80 | UE_LOG(LogHotPatcher,Warning,TEXT("%s conv to abs path failed!"),*LineItem.MountPak); 81 | } 82 | } 83 | } 84 | else 85 | { 86 | // is not-uasset 87 | FExternFileInfo ExFile; 88 | ExFile.SetFilePath(LineItem.AbsPath); 89 | ExFile.MountPath = LineItem.MountPak; 90 | ExFile.GenerateFileHash(HashCalculator); 91 | result.ExternFiles.AddUnique(ExFile); 92 | } 93 | } 94 | } 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/ReleaseParser/FReleasePaklistParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IReleaseParser.h" 4 | 5 | struct FReleasePaklistParser : public IReleaseParser 6 | { 7 | virtual void Parser(TSharedPtr ParserConf, EHashCalculator HashCalculator) override; 8 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/ReleaseParser/IReleaseParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "ETargetPlatform.h" 5 | #include "FExternFileInfo.h" 6 | #include "FPatcherSpecifyAsset.h" 7 | 8 | struct FReleaseParserConf 9 | { 10 | ETargetPlatform TargetPlatform = ETargetPlatform::None; 11 | }; 12 | 13 | struct FReleasePakListConf: public FReleaseParserConf 14 | { 15 | TArray PakResponseFiles; 16 | }; 17 | 18 | struct FReleasePakFilesConf : public FReleaseParserConf 19 | { 20 | TArray PakFiles; 21 | FString AESKey; 22 | }; 23 | 24 | struct FReleaseParserResult 25 | { 26 | ETargetPlatform Platform = ETargetPlatform::None; 27 | TArray Assets; 28 | TArray ExternFiles; 29 | }; 30 | 31 | struct IReleaseParser 32 | { 33 | virtual void Parser(TSharedPtr ParserConf, EHashCalculator HashCalculator)=0; 34 | virtual const FReleaseParserResult& GetParserResult()const {return result;}; 35 | virtual ~IReleaseParser(){} 36 | protected: 37 | FReleaseParserResult result; 38 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Private/TargetPlatformRegister.cpp: -------------------------------------------------------------------------------- 1 | #include "TargetPlatformRegister.h" 2 | 3 | #include "ETargetPlatform.h" 4 | #include "HotPatcherTemplateHelper.hpp" 5 | #include "HotPatcherLog.h" 6 | 7 | #if WITH_EDITOR 8 | #include "Interfaces/ITargetPlatform.h" 9 | #include "Interfaces/ITargetPlatformManagerModule.h" 10 | #endif 11 | 12 | UTargetPlatformRegister::UTargetPlatformRegister(const FObjectInitializer& Initializer):Super(Initializer) 13 | { 14 | TArray AppendPlatformEnums; 15 | 16 | #if WITH_EDITOR 17 | TArray RealPlatformEnums; 18 | ITargetPlatformManagerModule& TPM = GetTargetPlatformManagerRef(); 19 | const TArray& TargetPlatforms = TPM.GetTargetPlatforms(); 20 | UE_LOG(LogHotPatcher,Display,TEXT("TargetPlatformRegister:")); 21 | for (ITargetPlatform *TargetPlatformIns : TargetPlatforms) 22 | { 23 | FString PlatformName = TargetPlatformIns->PlatformName(); 24 | if(!PlatformName.IsEmpty()) 25 | { 26 | UE_LOG(LogHotPatcher,Display,TEXT("\t%s"),*PlatformName); 27 | RealPlatformEnums.AddUnique(PlatformName); 28 | } 29 | } 30 | AppendPlatformEnums = RealPlatformEnums; 31 | #endif 32 | 33 | TArray> EnumNames = THotPatcherTemplateHelper::AppendEnumeraters(AppendPlatformEnums); 34 | } -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FAssetDependenciesDetail.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //project header 4 | #include "FAssetDetail.h" 5 | 6 | //engine header 7 | #include "CoreMinimal.h" 8 | #include "FAssetDependenciesDetail.generated.h" 9 | 10 | USTRUCT(BlueprintType) 11 | struct HOTPATCHERRUNTIME_API FAssetDependenciesDetail 12 | { 13 | GENERATED_USTRUCT_BODY() 14 | 15 | FAssetDependenciesDetail() = default; 16 | FAssetDependenciesDetail(const FAssetDependenciesDetail&) = default; 17 | FAssetDependenciesDetail& operator=(const FAssetDependenciesDetail&) = default; 18 | FORCEINLINE FAssetDependenciesDetail(const FString& InModuleCategory, const TMap& InDependAssetDetails) 19 | : ModuleCategory(InModuleCategory), AssetDependencyDetails(InDependAssetDetails) 20 | {} 21 | 22 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 23 | FString ModuleCategory; 24 | //UPROPERTY(EditAnywhere, BlueprintReadWrite) 25 | // TArray mDependAsset; 26 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 27 | TMap AssetDependencyDetails; 28 | }; 29 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FAssetDependenciesInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Containers/Map.h" 4 | #include "AssetManager/FAssetDependenciesDetail.h" 5 | #include "CoreMinimal.h" 6 | #include "FAssetDependenciesInfo.generated.h" 7 | 8 | USTRUCT(BlueprintType) 9 | struct HOTPATCHERRUNTIME_API FAssetDependenciesInfo 10 | { 11 | GENERATED_USTRUCT_BODY() 12 | FAssetDependenciesInfo()=default; 13 | FAssetDependenciesInfo(const FAssetDependenciesInfo&)=default; 14 | //UPROPERTY(EditAnywhere, BlueprintReadWrite) 15 | //FString mAssetRef; 16 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 17 | TMap AssetsDependenciesMap; 18 | 19 | void AddAssetsDetail(const FAssetDetail& AssetDetail); 20 | bool HasAsset(const FString& InAssetPackageName)const; 21 | TArray GetAssetDetails()const; 22 | bool GetAssetDetailByPackageName(const FString& InAssetPackageName,FAssetDetail& OutDetail)const; 23 | TArray GetAssetLongPackageNames()const; 24 | void RemoveAssetDetail(const FAssetDetail& AssetDetail); 25 | void RemoveAssetDetail(const FString& LongPackageName); 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FAssetDetail.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "AssetRegistry.h" 4 | // #include "FlibAssetManageHelper.h" 5 | #include "UObject/NameTypes.h" 6 | #include "CoreMinimal.h" 7 | #include "FAssetDetail.generated.h" 8 | 9 | USTRUCT(BlueprintType) 10 | struct HOTPATCHERRUNTIME_API FAssetDetail 11 | { 12 | GENERATED_USTRUCT_BODY() 13 | 14 | FAssetDetail() = default; 15 | FAssetDetail(const FAssetDetail&) = default; 16 | FAssetDetail& operator=(const FAssetDetail&) = default; 17 | FORCEINLINE FAssetDetail(const FName& InAssetPackagePath, const FName& InAsetType,const FName& InGuid) 18 | : PackagePath(InAssetPackagePath), AssetType(InAsetType), Guid(InGuid){} 19 | FORCEINLINE FAssetDetail(const FString& InAssetPackagePath, const FString& InAsetType,const FString& InGuid) 20 | : FAssetDetail(FName(*InAssetPackagePath),FName(*InAsetType),FName(*InGuid)){} 21 | 22 | bool operator==(const FAssetDetail& InRight)const 23 | { 24 | bool bSamePackageName = PackagePath == InRight.PackagePath; 25 | bool bSameAssetType = AssetType == InRight.AssetType; 26 | bool bSameGUID = Guid == InRight.Guid; 27 | 28 | return bSamePackageName && bSameAssetType && bSameGUID; 29 | } 30 | FORCEINLINE bool IsValid()const 31 | { 32 | return !PackagePath.IsNone() && !AssetType.IsNone() && !Guid.IsNone(); 33 | } 34 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 35 | FName PackagePath; 36 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 37 | FName AssetType; 38 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 39 | FName Guid; 40 | 41 | }; 42 | 43 | 44 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FFileArrayDirectoryVisitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "CoreMinimal.h" 3 | #include "GenericPlatform/GenericPlatformFile.h" 4 | 5 | class HOTPATCHERRUNTIME_API FFileArrayDirectoryVisitor : public IPlatformFile::FDirectoryVisitor 6 | { 7 | public: 8 | virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) override 9 | { 10 | if (bIsDirectory) 11 | { 12 | Directories.Add(FilenameOrDirectory); 13 | } 14 | else 15 | { 16 | Files.Add(FilenameOrDirectory); 17 | } 18 | return true; 19 | } 20 | 21 | TArray Directories; 22 | TArray Files; 23 | }; 24 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetRegistry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if WITH_UE5 4 | #include "AssetRegistry/AssetData.h" 5 | #include "AssetRegistry/AssetRegistryState.h" 6 | #include "AssetRegistry/AssetRegistryModule.h" 7 | #include "AssetRegistry/ARFilter.h" 8 | #include "AssetRegistry/IAssetRegistry.h" 9 | #else 10 | #include "AssetRegistryModule.h" 11 | #include "IAssetRegistry.h" 12 | #include "AssetRegistryState.h" 13 | #include "ARFilter.h" 14 | #include "AssetData.h" 15 | #endif -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/BaseTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | 5 | #define AS_PROJECTDIR_MARK TEXT("[PROJECTDIR]") 6 | #define AS_PLUGINDIR_MARK TEXT("[PLUGINDIR]") 7 | 8 | struct FEncryptSetting 9 | { 10 | // -encryptindex 11 | bool bEncryptIndex = false; 12 | bool bEncryptAllAssetFiles = false; 13 | bool bEncryptUAssetFiles = false; 14 | bool bEncryptIniFiles = false; 15 | // sign pak 16 | bool bSign = false; 17 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/EPatcherPhase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "Misc/EnumRange.h" 5 | // #include "EPatcherPhase.generated.h" 6 | // 7 | // 8 | // UENUM(BlueprintType) 9 | // enum class EPatcherPhase : uint8 10 | // { 11 | // PRE_PATCHER, 12 | // BASE_VERSION, 13 | // NEW_VERSION, 14 | // PRE_DIFF, 15 | // DIFF, 16 | // POST_DIFF, 17 | // PARSE_CHUNKS, 18 | // PRE_COOKING, 19 | // COOKING, 20 | // POST_COOKING, 21 | // GENERATE_METADATA, 22 | // PRE_GENERATE_PAK 23 | // GENERATE_PAK, 24 | // POST_GENERATE_PAK, 25 | // CHECK_ASSETS_COOKED, 26 | // POST_PATCHER, 27 | // Count UMETA(Hidden) 28 | // }; 29 | // 30 | // ENUM_RANGE_BY_COUNT(ETargetPlatform, ETargetPlatform::Count); 31 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/ETargetPlatform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Templates/HotPatcherTemplateHelper.hpp" 4 | 5 | #include "CoreMinimal.h" 6 | #include "Misc/EnumRange.h" 7 | #include "ETargetPlatform.generated.h" 8 | 9 | 10 | UENUM(BlueprintType) 11 | enum class ETargetPlatform : uint8 12 | { 13 | None, 14 | AllPlatforms, 15 | Count UMETA(Hidden) 16 | }; 17 | ENUM_RANGE_BY_COUNT(ETargetPlatform, ETargetPlatform::Count); 18 | 19 | DECAL_GETCPPTYPENAME_SPECIAL(ETargetPlatform) 20 | 21 | // static TArray AppendPlatformEnums = { 22 | // #if ENGINE_MAJOR_VERSION > 4 23 | // TEXT("Android"), 24 | // TEXT("Android_ASTC"), 25 | // TEXT("Android_DXT"), 26 | // TEXT("Android_ETC2"), 27 | // TEXT("AndroidClient"), 28 | // TEXT("Android_ASTCClient"), 29 | // TEXT("Android_DXTClient"), 30 | // TEXT("Android_ETC2Client"), 31 | // TEXT("Android_Multi"), 32 | // TEXT("Android_MultiClient"), 33 | // TEXT("IOS"), 34 | // TEXT("IOSClient"), 35 | // TEXT("Linux"), 36 | // TEXT("LinuxEditor"), 37 | // TEXT("LinuxServer"), 38 | // TEXT("LinuxClient"), 39 | // TEXT("LinuxAArch64"), 40 | // TEXT("LinuxAArch64Server"), 41 | // TEXT("LinuxAArch64Client"), 42 | // TEXT("Lumin"), 43 | // TEXT("LuminClient"), 44 | // TEXT("Mac"), 45 | // TEXT("MacEditor"), 46 | // TEXT("MacServer"), 47 | // TEXT("MacClient"), 48 | // TEXT("TVOS"), 49 | // TEXT("TVOSClient"), 50 | // TEXT("Windows"), 51 | // TEXT("WindowsEditor"), 52 | // TEXT("WindowsServer"), 53 | // TEXT("WindowsClient") 54 | // #else 55 | // // for UE4 56 | // TEXT("AllDesktop"), 57 | // TEXT("MacClient"), 58 | // TEXT("MacNoEditor"), 59 | // TEXT("MacServer"), 60 | // TEXT("Mac"), 61 | // TEXT("WindowsClient"), 62 | // TEXT("WindowsNoEditor"), 63 | // TEXT("WindowsServer"), 64 | // TEXT("Windows"), 65 | // TEXT("Android"), 66 | // TEXT("Android_ASTC"), 67 | // TEXT("Android_ATC"), 68 | // TEXT("Android_DXT"), 69 | // TEXT("Android_ETC1"), 70 | // TEXT("Android_ETC1a"), 71 | // TEXT("Android_ETC2"), 72 | // TEXT("Android_PVRTC"), 73 | // TEXT("AndroidClient"), 74 | // TEXT("Android_ASTCClient"), 75 | // TEXT("Android_ATCClient"), 76 | // TEXT("Android_DXTClient"), 77 | // TEXT("Android_ETC1Client"), 78 | // TEXT("Android_ETC1aClient"), 79 | // TEXT("Android_ETC2Client"), 80 | // TEXT("Android_PVRTCClient"), 81 | // TEXT("Android_Multi"), 82 | // TEXT("Android_MultiClient"), 83 | // TEXT("HTML5"), 84 | // TEXT("IOSClient"), 85 | // TEXT("IOS"), 86 | // TEXT("TVOSClient"), 87 | // TEXT("TVOS"), 88 | // TEXT("LinuxClient"), 89 | // TEXT("LinuxNoEditor"), 90 | // TEXT("LinuxServer"), 91 | // TEXT("Linux"), 92 | // TEXT("Lumin"), 93 | // TEXT("LuminClient") 94 | // #endif 95 | // }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FAssetRegistryOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BaseTypes.h" 3 | 4 | // engine header 5 | #include "CoreMinimal.h" 6 | #include "UObject/ObjectMacros.h" 7 | #include "UObject/Object.h" 8 | #include "Engine/EngineTypes.h" 9 | #include "FAssetRegistryOptions.generated.h" 10 | 11 | UENUM(BlueprintType) 12 | enum class EAssetRegistryRule : uint8 13 | { 14 | PATCH, 15 | PER_CHUNK, 16 | CUSTOM 17 | }; 18 | 19 | 20 | USTRUCT(BlueprintType) 21 | struct HOTPATCHERRUNTIME_API FAssetRegistryOptions 22 | { 23 | GENERATED_BODY() 24 | FAssetRegistryOptions() 25 | { 26 | AssetRegistryMountPointRegular = FString::Printf(TEXT("%s/AssetRegistry"),AS_PROJECTDIR_MARK); 27 | AssetRegistryNameRegular = FString::Printf(TEXT("[CHUNK_NAME]_AssetRegistry.bin")); 28 | } 29 | FString GetAssetRegistryNameRegular(const FString& ChunkName)const 30 | { 31 | return AssetRegistryNameRegular.Replace(TEXT("[CHUNK_NAME]"),*ChunkName); 32 | } 33 | FString GetAssetRegistryMountPointRegular()const { return AssetRegistryMountPointRegular; } 34 | 35 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 36 | bool bSerializeAssetRegistry = false; 37 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 38 | bool bSerializeAssetRegistryManifest = false; 39 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 40 | FString AssetRegistryMountPointRegular; 41 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 42 | EAssetRegistryRule AssetRegistryRule = EAssetRegistryRule::PATCH; 43 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 44 | bool bCustomAssetRegistryName = false; 45 | UPROPERTY(EditAnywhere, BlueprintReadWrite,meta=(EditCondition="bCustomAssetRegistryName")) 46 | FString AssetRegistryNameRegular; 47 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FAssetScanConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "FPatcherSpecifyAsset.h" 4 | #include "FExternFileInfo.h" 5 | #include "ETargetPlatform.h" 6 | #include "FPlatformExternFiles.h" 7 | #include "FPlatformExternAssets.h" 8 | 9 | // engine header 10 | #include "CoreMinimal.h" 11 | #include "UObject/ObjectMacros.h" 12 | 13 | #include "FAssetScanConfig.generated.h" 14 | 15 | USTRUCT(BlueprintType) 16 | struct HOTPATCHERRUNTIME_API FAssetScanConfig 17 | { 18 | GENERATED_USTRUCT_BODY() 19 | 20 | public: 21 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 22 | bool bPackageTracker = true; 23 | 24 | UPROPERTY(EditAnywhere, BlueprintReadWrite,meta = (RelativeToGameContentDir, LongPackageName)) 25 | TArray AssetIncludeFilters; 26 | // Ignore directories in AssetIncludeFilters 27 | UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (RelativeToGameContentDir, LongPackageName)) 28 | TArray AssetIgnoreFilters; 29 | 30 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 31 | bool bIncludeHasRefAssetsOnly = false; 32 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 33 | bool bAnalysisFilterDependencies=true; 34 | 35 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 36 | TArray AssetRegistryDependencyTypes; 37 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 38 | TArray IncludeSpecifyAssets; 39 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 40 | bool bRecursiveWidgetTree = true; 41 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 42 | bool bAnalysisMaterialInstance = true; 43 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 44 | bool bSupportWorldComposition = false; 45 | 46 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 47 | bool bForceSkipContent = true; 48 | // force exclude asset folder e.g. Exclude editor content when cooking in Project Settings 49 | UPROPERTY(EditAnywhere, BlueprintReadWrite,meta = (RelativeToGameContentDir, LongPackageName, EditCondition="bForceSkipContent")) 50 | TArray ForceSkipContentRules; 51 | UPROPERTY(EditAnywhere, BlueprintReadWrite,meta = (EditCondition="bForceSkipContent")) 52 | TArray ForceSkipAssets; 53 | UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (EditCondition="bForceSkipContent")) 54 | TArray ForceSkipClasses; 55 | 56 | bool IsMatchForceSkip(const FSoftObjectPath& ObjectPath,FString& OutReason); 57 | 58 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FBinariesPatchConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ETargetPlatform.h" 3 | #include "FPlatformBasePak.h" 4 | #include "BinariesPatchFeature.h" 5 | #include "FPakEncryptionKeys.h" 6 | 7 | // engine header 8 | #include "CoreMinimal.h" 9 | #include "Engine/EngineTypes.h" 10 | #include "HAL/FileManager.h" 11 | #include "FBinariesPatchConfig.generated.h" 12 | 13 | struct FPakCommandItem 14 | { 15 | FString AssetAbsPath; 16 | FString AssetMountPath; 17 | }; 18 | UENUM(BlueprintType) 19 | enum class EMatchRule:uint8 20 | { 21 | None, 22 | MATCH, 23 | IGNORE 24 | }; 25 | 26 | UENUM(BlueprintType) 27 | enum class EMatchOperator:uint8 28 | { 29 | None, 30 | GREAT_THAN, 31 | LESS_THAN, 32 | EQUAL 33 | }; 34 | 35 | USTRUCT(BlueprintType) 36 | struct FMatchRule 37 | { 38 | GENERATED_BODY() 39 | // match or ignore 40 | UPROPERTY(EditAnywhere) 41 | EMatchRule Rule = EMatchRule::None; 42 | 43 | // grate/less/equal 44 | UPROPERTY(EditAnywhere) 45 | EMatchOperator Operator = EMatchOperator::None; 46 | 47 | // uint kb 48 | UPROPERTY(EditAnywhere,meta=(EditCondition="Operator!=EMatchOperator::None")) 49 | float Size = 100; 50 | // match file Formats. etc .ini/.lua, if it is empty match everything 51 | UPROPERTY(EditAnywhere) 52 | TArray Formaters; 53 | UPROPERTY(EditAnywhere) 54 | TArray AssetTypes; 55 | }; 56 | 57 | USTRUCT(BlueprintType) 58 | struct HOTPATCHERRUNTIME_API FBinariesPatchConfig 59 | { 60 | GENERATED_BODY(); 61 | public: 62 | FORCEINLINE FPakEncryptSettings GetEncryptSettings()const{ return EncryptSettings; } 63 | 64 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BinariesPatch") 65 | EBinariesPatchFeature BinariesPatchType = EBinariesPatchFeature::None; 66 | // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BinariesPatch") 67 | FDirectoryPath OldCookedDir; 68 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BinariesPatch") 69 | FPakEncryptSettings EncryptSettings; 70 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BinariesPatch") 71 | TArray BaseVersionPaks; 72 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BinariesPatch") 73 | TArray MatchRules; 74 | // etc .ini/.lua 75 | // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BinariesPatch") 76 | // TArray IgnoreFileRules; 77 | bool IsMatchIgnoreRules(const FPakCommandItem& File); 78 | 79 | // FORCEINLINE TArray GetBinariesPatchIgnoreFileRules()const {return IgnoreFileRules;} 80 | FORCEINLINE TArray GetMatchRules()const{ return MatchRules; } 81 | FORCEINLINE TArray GetBaseVersionPaks()const {return BaseVersionPaks;}; 82 | FString GetBinariesPatchFeatureName() const; 83 | FString GetOldCookedDir() const; 84 | FString GetBasePakExtractCryptoJson() const; 85 | TArray GetBaseVersionPakByPlatform(ETargetPlatform Platform); 86 | 87 | }; 88 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FCookShaderOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BaseTypes.h" 3 | 4 | #include "CoreMinimal.h" 5 | #include "FCookShaderOptions.generated.h" 6 | 7 | UENUM(BlueprintType) 8 | enum class EShaderLibNameRule : uint8 9 | { 10 | CHUNK_NAME, 11 | PROJECT_NAME, 12 | CUSTOM 13 | }; 14 | 15 | 16 | USTRUCT(BlueprintType) 17 | struct FCookShaderOptions 18 | { 19 | GENERATED_BODY() 20 | FCookShaderOptions() 21 | { 22 | ShaderLibMountPointRegular = FString::Printf(TEXT("%s/ShaderLibs"),AS_PROJECTDIR_MARK); 23 | } 24 | FString GetShaderLibMountPointRegular()const { return ShaderLibMountPointRegular; } 25 | 26 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 27 | bool bSharedShaderLibrary = false; 28 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 29 | bool bNativeShader = true; 30 | // metallib and metalmap to pak? 31 | bool bNativeShaderToPak = false; 32 | // if name is StartContent to ShaderArchive-StarterContent-PCD3D_SM5.ushaderbytecode 33 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 34 | EShaderLibNameRule ShaderNameRule = EShaderLibNameRule::CHUNK_NAME; 35 | UPROPERTY(EditAnywhere, BlueprintReadWrite,meta=(EditCondition="ShaderNameRule==EShaderLibNameRule::CUSTOM")) 36 | FString CustomShaderName; 37 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 38 | FString ShaderLibMountPointRegular; 39 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FCookerConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // engine header 3 | #include "CoreMinimal.h" 4 | #include "Engine/EngineTypes.h" 5 | #include "FCookerConfig.generated.h" 6 | 7 | USTRUCT() 8 | struct FCookerConfig 9 | { 10 | GENERATED_USTRUCT_BODY() 11 | public: 12 | UPROPERTY(EditAnywhere) 13 | FString EngineBin; 14 | UPROPERTY(EditAnywhere) 15 | FString ProjectPath; 16 | UPROPERTY(EditAnywhere) 17 | FString EngineParams; 18 | UPROPERTY(EditAnywhere) 19 | TArray CookPlatforms; 20 | UPROPERTY(EditAnywhere) 21 | bool bCookAllMap = false; 22 | UPROPERTY(EditAnywhere) 23 | TArray CookMaps; 24 | UPROPERTY(EditAnywhere) 25 | TArray CookFilter; 26 | UPROPERTY(EditAnywhere) 27 | TArray CookSettings; 28 | UPROPERTY(EditAnywhere) 29 | FString Options; 30 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FExternDirectoryInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "Engine/EngineTypes.h" 5 | #include "FExternDirectoryInfo.generated.h" 6 | 7 | USTRUCT(BlueprintType) 8 | struct FExternDirectoryInfo 9 | { 10 | GENERATED_USTRUCT_BODY() 11 | 12 | public: 13 | FORCEINLINE FExternDirectoryInfo():MountPoint(FPaths::Combine(TEXT("../../.."),FApp::GetProjectName())){} 14 | FExternDirectoryInfo(const FExternDirectoryInfo&) = default; 15 | FExternDirectoryInfo& operator=(const FExternDirectoryInfo&) = default; 16 | 17 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BaseVersion") 18 | FDirectoryPath DirectoryPath; 19 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 20 | FString MountPoint = TEXT("../../../"); 21 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 22 | bool bWildcard = false; 23 | UPROPERTY(EditAnywhere,BlueprintReadWrite,meta=(EditCondition="bWildcard")) 24 | FString WildcardStr; 25 | 26 | bool operator==(const FExternDirectoryInfo& Right)const 27 | { 28 | bool bIsSamePath = (DirectoryPath.Path == Right.DirectoryPath.Path); 29 | bool bIsSameMountPath = (MountPoint == Right.MountPoint); 30 | return bIsSamePath && bIsSameMountPath; 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FExternFileInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "HotPatcherBaseTypes.h" 3 | // engine header 4 | #include "Misc/App.h" 5 | #include "Misc/Paths.h" 6 | #include "Misc/SecureHash.h" 7 | #include "CoreMinimal.h" 8 | #include "Engine/EngineTypes.h" 9 | #include "FExternFileInfo.generated.h" 10 | 11 | 12 | UENUM() 13 | enum class EHashCalculator 14 | { 15 | NoHash, 16 | MD5, 17 | SHA1 18 | }; 19 | 20 | USTRUCT(BlueprintType) 21 | struct HOTPATCHERRUNTIME_API FExternFileInfo 22 | { 23 | GENERATED_USTRUCT_BODY() 24 | 25 | public: 26 | FORCEINLINE FExternFileInfo():MountPath(FPaths::Combine(TEXT("../../.."),FApp::GetProjectName())){} 27 | FExternFileInfo(const FExternFileInfo&) = default; 28 | FExternFileInfo& operator=(const FExternFileInfo&) = default; 29 | 30 | bool operator==(const FExternFileInfo& Right)const 31 | { 32 | return MountPath == Right.MountPath; 33 | } 34 | 35 | // ignore FilePath abs path (only mount path and filehash) 36 | bool IsSameMount(const FExternFileInfo& Right)const 37 | { 38 | bool IsSameHash = (FileHash == Right.FileHash); 39 | return (*this == Right) && IsSameHash; 40 | } 41 | 42 | bool IsAbsSame(const FExternFileInfo& Right)const 43 | { 44 | bool bIsSamePath = (GetFilePath() == Right.GetFilePath()); 45 | bool IsSameHash = (FileHash == Right.FileHash); 46 | return (*this == Right) && bIsSamePath && IsSameHash; 47 | } 48 | 49 | FString GenerateFileHash(EHashCalculator HashCalculator = EHashCalculator::MD5); 50 | FString GetFileHash(EHashCalculator HashCalculator = EHashCalculator::MD5)const; 51 | FString GetReplaceMarkdFilePath()const; 52 | FString GetFilePath()const{ return FilePath.FilePath; } 53 | void SetFilePath(const FString& InFilePath); 54 | protected: 55 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BaseVersion", meta = (RelativeToGameContentDir)) 56 | FFilePath FilePath; 57 | public: 58 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 59 | FString MountPath = TEXT("../../../"); 60 | UPROPERTY() 61 | FString FileHash; 62 | EPatchAssetType Type = EPatchAssetType::None; 63 | 64 | 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FHotPatcherAssetDependency.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "BaseTypes/AssetManager/FAssetDetail.h" 4 | 5 | // engine header 6 | #include "CoreMinimal.h" 7 | #include "Engine/EngineTypes.h" 8 | #include "FHotPatcherAssetDependency.generated.h" 9 | 10 | USTRUCT(BlueprintType) 11 | struct FHotPatcherAssetDependency 12 | { 13 | GENERATED_USTRUCT_BODY() 14 | public: 15 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 16 | FAssetDetail Asset; 17 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 18 | TArray AssetReference; 19 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 20 | TArray AssetDependency; 21 | }; 22 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FHotPatcherVersion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "AssetManager/FAssetDependenciesInfo.h" 4 | #include "FPatcherSpecifyAsset.h" 5 | #include "FExternFileInfo.h" 6 | #include "ETargetPlatform.h" 7 | #include "FPlatformExternFiles.h" 8 | #include "FPlatformExternAssets.h" 9 | 10 | // engine header 11 | #include "CoreMinimal.h" 12 | #include "UObject/ObjectMacros.h" 13 | 14 | #include "FHotPatcherVersion.generated.h" 15 | 16 | 17 | 18 | USTRUCT(BlueprintType) 19 | struct FHotPatcherVersion 20 | { 21 | GENERATED_USTRUCT_BODY() 22 | 23 | public: 24 | FHotPatcherVersion()=default; 25 | 26 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 27 | FString VersionId; 28 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 29 | FString BaseVersionId; 30 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 31 | FString Date; 32 | // UPROPERTY(EditAnywhere, BlueprintReadWrite) 33 | TArray IncludeFilter; 34 | // UPROPERTY(EditAnywhere, BlueprintReadWrite) 35 | TArray IgnoreFilter; 36 | // UPROPERTY(EditAnywhere, BlueprintReadWrite) 37 | bool bIncludeHasRefAssetsOnly; 38 | // UPROPERTY(EditAnywhere, BlueprintReadWrite) 39 | TArray AssetRegistryDependencyTypes; 40 | // UPROPERTY(EditAnywhere, BlueprintReadWrite) 41 | TArray IncludeSpecifyAssets; 42 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 43 | FAssetDependenciesInfo AssetInfo; 44 | // UPROPERTY(EditAnywhere, BlueprintReadWrite) 45 | // TMap ExternalFiles; 46 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 47 | TMap PlatformAssets; 48 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FIoStoreSettings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project 3 | #include "ETargetPlatform.h" 4 | 5 | // engine header 6 | #include "CoreMinimal.h" 7 | #include "Engine/EngineTypes.h" 8 | #include "FIoStoreSettings.generated.h" 9 | 10 | // -Output=E:\UnrealProjects\StarterContent\Package\DLC2\WindowsNoEditor\StarterContent\Content\Paks\StarterContent-WindowsNoEditor_0_P.utoc 11 | // -ContainerName=StarterContent 12 | // -PatchSource=E:\UnrealProjects\StarterContent\Releases\1.0\WindowsNoEditor\StarterContent-WindowsNoEditor*.utoc 13 | // -GenerateDiffPatch 14 | // -ResponseFile="C:\Users\visionsmile\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UnrealEngine+Launcher+UE_4.26\PakListIoStore_StarterContent.txt" 15 | 16 | USTRUCT(BlueprintType) 17 | struct FIoStorePlatformContainers 18 | { 19 | GENERATED_USTRUCT_BODY() 20 | // Saved/StagedBuilds/Windows 21 | // Saved/StagedBuilds/Android_ASTC 22 | // │ Manifest_NonUFSFiles_Win64.txt 23 | // │ ThirdPerson_UE5.exe 24 | // ├─Engine 25 | // └─ThirdPerson_UE5 26 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 27 | FDirectoryPath BasePackageStagedRootDir; 28 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 29 | bool bGenerateDiffPatch = false; 30 | 31 | // global.utoc file 32 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 33 | FFilePath GlobalContainersOverride; 34 | // -PatchSource=E:\UnrealProjects\StarterContent\Releases\1.0\WindowsNoEditor\StarterContent-WindowsNoEditor*.utoc -GenerateDiffPatch 35 | UPROPERTY(EditAnywhere,BlueprintReadWrite,meta=(EditCondition="bGenerateDiffPatch")) 36 | FFilePath PatchSourceOverride; 37 | }; 38 | 39 | USTRUCT(BlueprintType) 40 | struct FIoStoreSettings 41 | { 42 | GENERATED_USTRUCT_BODY() 43 | public: 44 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 45 | bool bIoStore = false; 46 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 47 | bool bAllowBulkDataInIoStore = false; 48 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 49 | TArray IoStorePakListOptions; 50 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 51 | TArray IoStoreCommandletOptions; 52 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 53 | TMap PlatformContainers; 54 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 55 | bool bStoragePakList = true; 56 | // Metadata/BulkDataInfo.ubulkmanifest 57 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 58 | bool bStorageBulkDataInfo = true; 59 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPakEncryptionKeys.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // engine header 4 | #include "CoreMinimal.h" 5 | #include "Engine/EngineTypes.h" 6 | #include "HAL/FileManager.h" 7 | #include "FPakEncryptionKeys.generated.h" 8 | 9 | USTRUCT(BlueprintType) 10 | struct HOTPATCHERRUNTIME_API FPakEncryptSettings 11 | { 12 | GENERATED_BODY() 13 | // Use DefaultCrypto.ini 14 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 15 | bool bUseDefaultCryptoIni = false; 16 | // crypto.json (option) 17 | UPROPERTY(EditAnywhere,BlueprintReadWrite,meta=(EditCondition="!bUseDefaultCryptoIni")) 18 | FFilePath CryptoKeys; 19 | }; 20 | 21 | 22 | 23 | USTRUCT() 24 | struct FEncryptionKeyEntry 25 | { 26 | GENERATED_BODY() 27 | UPROPERTY() 28 | FString Name; 29 | UPROPERTY() 30 | FString Guid; 31 | UPROPERTY() 32 | FString Key; 33 | }; 34 | 35 | USTRUCT() 36 | struct FSignKeyItem 37 | { 38 | GENERATED_BODY() 39 | UPROPERTY() 40 | FString Exponent; 41 | UPROPERTY() 42 | FString Modulus; 43 | }; 44 | 45 | USTRUCT() 46 | struct FSignKeyEntry 47 | { 48 | GENERATED_BODY() 49 | UPROPERTY() 50 | FSignKeyItem PublicKey; 51 | UPROPERTY() 52 | FSignKeyItem PrivateKey; 53 | }; 54 | 55 | USTRUCT() 56 | struct FPakEncryptionKeys 57 | { 58 | GENERATED_BODY(); 59 | 60 | UPROPERTY() 61 | FEncryptionKeyEntry EncryptionKey; 62 | UPROPERTY() 63 | TArray SecondaryEncryptionKeys; 64 | 65 | UPROPERTY() 66 | bool bEnablePakIndexEncryption = false; 67 | UPROPERTY() 68 | bool bEnablePakIniEncryption = false; 69 | UPROPERTY() 70 | bool bEnablePakUAssetEncryption = false; 71 | UPROPERTY() 72 | bool bEnablePakFullAssetEncryption = false; 73 | UPROPERTY() 74 | bool bDataCryptoRequired = false; 75 | UPROPERTY() 76 | bool PakEncryptionRequired = false; 77 | UPROPERTY() 78 | bool PakSigningRequired = false; 79 | 80 | UPROPERTY() 81 | bool bEnablePakSigning = false; 82 | UPROPERTY() 83 | FSignKeyEntry SigningKey; 84 | }; 85 | 86 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPakFileInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // project header 4 | #include "FPakVersion.h" 5 | // engine header 6 | #include "CoreMinimal.h" 7 | #include "FPakFileInfo.generated.h" 8 | 9 | USTRUCT(BlueprintType) 10 | struct FPakFileInfo 11 | { 12 | GENERATED_USTRUCT_BODY() 13 | public: 14 | 15 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 16 | FString FileName; 17 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 18 | FString Hash; 19 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 20 | int32 FileSize = 0; 21 | //UPROPERTY(EditAnywhere,BlueprintReadWrite) 22 | //FPakVersion PakVersion; 23 | }; 24 | 25 | USTRUCT(BlueprintType) 26 | struct FPakFileArray 27 | { 28 | GENERATED_USTRUCT_BODY() 29 | public: 30 | 31 | UPROPERTY() 32 | TArray PakFileInfos; 33 | }; 34 | 35 | USTRUCT(BlueprintType) 36 | struct FPakFilesMap 37 | { 38 | GENERATED_USTRUCT_BODY() 39 | public: 40 | 41 | UPROPERTY() 42 | TMap PakFilesMap; 43 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPakVersion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "FPakVersion.generated.h" 5 | 6 | USTRUCT(BlueprintType) 7 | struct FPakVersion 8 | { 9 | GENERATED_USTRUCT_BODY() 10 | public: 11 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 12 | FString VersionId; 13 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 14 | FString BaseVersionId; 15 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 16 | FString Date; 17 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 18 | FString CheckCode; 19 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPatchVersionAssetDiff.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "BaseTypes/AssetManager/FAssetDependenciesInfo.h" 4 | #include "FExternFileInfo.h" 5 | 6 | // engine header 7 | #include "CoreMinimal.h" 8 | 9 | #include "FPlatformExternAssets.h" 10 | #include "Engine/EngineTypes.h" 11 | #include "FPatchVersionAssetDiff.generated.h" 12 | 13 | USTRUCT(BlueprintType) 14 | struct FPatchVersionAssetDiff 15 | { 16 | GENERATED_USTRUCT_BODY() 17 | public: 18 | FPatchVersionAssetDiff()=default; 19 | FPatchVersionAssetDiff(const FPatchVersionAssetDiff&)=default; 20 | 21 | UPROPERTY(EditAnywhere) 22 | FAssetDependenciesInfo AddAssetDependInfo; 23 | UPROPERTY(EditAnywhere) 24 | FAssetDependenciesInfo ModifyAssetDependInfo; 25 | UPROPERTY(EditAnywhere) 26 | FAssetDependenciesInfo DeleteAssetDependInfo; 27 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPatchVersionDiff.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "FPatchVersionAssetDiff.h" 4 | #include "FPatchVersionExternDiff.h" 5 | 6 | // engine header 7 | #include "CoreMinimal.h" 8 | 9 | #include "Engine/EngineTypes.h" 10 | #include "FPatchVersionDiff.generated.h" 11 | 12 | USTRUCT(BlueprintType) 13 | struct FPatchVersionDiff 14 | { 15 | GENERATED_USTRUCT_BODY() 16 | FPatchVersionDiff()=default; 17 | FPatchVersionDiff(const FPatchVersionDiff&)=default; 18 | public: 19 | UPROPERTY(EditAnywhere) 20 | FPatchVersionAssetDiff AssetDiffInfo; 21 | 22 | // UPROPERTY(EditAnywhere) 23 | // FPatchVersionExternDiff ExternDiffInfo; 24 | 25 | UPROPERTY(EditAnywhere) 26 | TMap PlatformExternDiffInfo; 27 | 28 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPatchVersionExternDiff.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "BaseTypes/AssetManager/FAssetDependenciesInfo.h" 4 | #include "FExternFileInfo.h" 5 | 6 | // engine header 7 | #include "CoreMinimal.h" 8 | 9 | #include "FPlatformExternAssets.h" 10 | #include "Engine/EngineTypes.h" 11 | #include "FPatchVersionExternDiff.generated.h" 12 | 13 | USTRUCT(BlueprintType) 14 | struct FPatchVersionExternDiff 15 | { 16 | GENERATED_USTRUCT_BODY() 17 | FPatchVersionExternDiff()=default; 18 | public: 19 | UPROPERTY(EditAnywhere) 20 | ETargetPlatform Platform {ETargetPlatform::None}; 21 | UPROPERTY(EditAnywhere) 22 | TArray AddExternalFiles{}; 23 | UPROPERTY(EditAnywhere) 24 | TArray ModifyExternalFiles{}; 25 | UPROPERTY(EditAnywhere) 26 | TArray DeleteExternalFiles{}; 27 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPatcherSpecifyAsset.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FlibAssetManageHelper.h" 4 | #include "CoreMinimal.h" 5 | #include "Engine/EngineTypes.h" 6 | #include "FPatcherSpecifyAsset.generated.h" 7 | 8 | USTRUCT(BlueprintType) 9 | struct FPatcherSpecifyAsset 10 | { 11 | GENERATED_USTRUCT_BODY() 12 | 13 | public: 14 | FPatcherSpecifyAsset() 15 | { 16 | AssetRegistryDependencyTypes.Add(EAssetRegistryDependencyTypeEx::Packages); 17 | } 18 | bool operator==(const FPatcherSpecifyAsset& InAsset)const 19 | { 20 | bool SameAsset = (Asset == InAsset.Asset); 21 | bool SamebAnalysisAssetDependencies = (bAnalysisAssetDependencies == InAsset.bAnalysisAssetDependencies); 22 | bool SameAssetRegistryDependencyTypes = (AssetRegistryDependencyTypes == InAsset.AssetRegistryDependencyTypes); 23 | 24 | return SameAsset && SamebAnalysisAssetDependencies && SameAssetRegistryDependencyTypes; 25 | } 26 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 27 | FSoftObjectPath Asset; 28 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 29 | bool bAnalysisAssetDependencies = false; 30 | UPROPERTY(EditAnywhere, BlueprintReadWrite,meta=(EditCondition="bAnalysisAssetDependencies")) 31 | TArray AssetRegistryDependencyTypes; 32 | }; 33 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPlatformBasePak.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "ETargetPlatform.h" 4 | 5 | // engine header 6 | #include "CoreMinimal.h" 7 | #include "UObject/ObjectMacros.h" 8 | #include "Engine/EngineTypes.h" 9 | #include "FPlatformBasePak.generated.h" 10 | 11 | USTRUCT(BlueprintType) 12 | struct FPlatformBasePak 13 | { 14 | GENERATED_BODY() 15 | FORCEINLINE FPlatformBasePak()=default; 16 | 17 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 18 | ETargetPlatform Platform = ETargetPlatform::None; 19 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 20 | TArray Paks; 21 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPlatformExternAssets.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ETargetPlatform.h" 4 | #include "FExternFileInfo.h" 5 | #include "FExternDirectoryInfo.h" 6 | 7 | // engine heacer 8 | #include "CoreMinimal.h" 9 | #include "Engine/EngineTypes.h" 10 | #include "FPlatformExternAssets.generated.h" 11 | 12 | 13 | USTRUCT(BlueprintType) 14 | struct FPlatformExternAssets 15 | { 16 | GENERATED_USTRUCT_BODY() 17 | 18 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 19 | ETargetPlatform TargetPlatform = ETargetPlatform::None; 20 | 21 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 22 | TArray AddExternFileToPak; 23 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 24 | TArray AddExternDirectoryToPak; 25 | 26 | 27 | bool operator==(const FPlatformExternAssets& R)const 28 | { 29 | return TargetPlatform == R.TargetPlatform; 30 | } 31 | }; 32 | 33 | 34 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPlatformExternFiles.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // project header 3 | #include "AssetManager/FAssetDependenciesInfo.h" 4 | #include "FPatcherSpecifyAsset.h" 5 | #include "FExternFileInfo.h" 6 | #include "ETargetPlatform.h" 7 | 8 | // engine header 9 | #include "CoreMinimal.h" 10 | #include "UObject/ObjectMacros.h" 11 | 12 | #include "FPlatformExternFiles.generated.h" 13 | 14 | USTRUCT(BlueprintType) 15 | struct FPlatformExternFiles 16 | { 17 | GENERATED_BODY() 18 | FORCEINLINE FPlatformExternFiles()=default; 19 | FORCEINLINE FPlatformExternFiles(ETargetPlatform InPlatform,const TArray& InFiles): 20 | Platform(InPlatform),ExternFiles(InFiles){} 21 | 22 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 23 | ETargetPlatform Platform = ETargetPlatform::None; 24 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 25 | TArray ExternFiles; 26 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FReplaceText.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "FReplaceText.generated.h" 5 | 6 | UENUM(BlueprintType) 7 | enum class ESearchCaseMode :uint8 8 | { 9 | CaseSensitive, 10 | IgnoreCase 11 | }; 12 | USTRUCT(BlueprintType) 13 | struct FReplaceText 14 | { 15 | GENERATED_USTRUCT_BODY() 16 | public: 17 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 18 | FString From; 19 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 20 | FString To; 21 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 22 | ESearchCaseMode SearchCase = ESearchCaseMode::CaseSensitive; 23 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FUnrealPakSettings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "FUnrealPakSettings.generated.h" 5 | 6 | USTRUCT(BlueprintType) 7 | struct FUnrealPakSettings 8 | { 9 | GENERATED_USTRUCT_BODY() 10 | public: 11 | 12 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 13 | TArray UnrealPakListOptions; 14 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 15 | TArray UnrealCommandletOptions; 16 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 17 | bool bStoragePakList = true; 18 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FlibPakReader.h: -------------------------------------------------------------------------------- 1 | // // Fill out your copyright notice in the Description page of Project Settings. 2 | // 3 | // #pragma once 4 | // 5 | // #include "IPlatformFilePak.h" 6 | // #include "CoreMinimal.h" 7 | // 8 | // #include "Misc/FileHelper.h" 9 | // #include "Kismet/BlueprintFunctionLibrary.h" 10 | // #include "FlibPakReader.generated.h" 11 | // 12 | // /** 13 | // * 14 | // */ 15 | // UCLASS() 16 | // class HOTPATCHERRUNTIME_API UFlibPakReader : public UBlueprintFunctionLibrary 17 | // { 18 | // GENERATED_BODY() 19 | // public: 20 | // #if PLATFORM_WINDOWS 21 | // static TArray GetPakFileList(const FString& PakFilePath); 22 | // static FPakFile* GetPakFileInsByPath(const FString& PakPath); 23 | // static bool FindFileInPakFile(FPakFile* InPakFile, const FString& InFileName, FPakEntry* OutPakEntry); 24 | // static IFileHandle* CreatePakFileHandle(IPlatformFile* InLowLevel, FPakFile* PakFile, const FPakEntry* FileEntry); 25 | // static bool LoadFileToString(FString& Result, FArchive* InReader, const TCHAR* Filename, FFileHelper::EHashOptions VerifyFlags = FFileHelper::EHashOptions::None); 26 | // 27 | // 28 | // static FArchive* CreatePakReader(FPakFile* InPakFile, IFileHandle& InHandle, const TCHAR* InFilename); 29 | // static FString LoadPakFileToString(const FString& InPakFile,const FString& InFileName); 30 | // #endif 31 | // }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/HotPatcherBaseTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ETargetPlatform.h" 3 | 4 | // engine header 5 | #include "CoreMinimal.h" 6 | #include "Engine/EngineTypes.h" 7 | 8 | enum class EPatchAssetType:uint8 9 | { 10 | None, 11 | NEW, 12 | MODIFY 13 | }; 14 | 15 | using FCookActionEvent = TFunction; 16 | using FCookActionResultEvent = TFunction; 17 | 18 | 19 | struct HOTPATCHERRUNTIME_API FCookActionCallback 20 | { 21 | FCookActionEvent OnCookBegin = nullptr; 22 | FCookActionResultEvent OnAssetCooked = nullptr; 23 | }; 24 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/CreatePatch/FExportReleaseSettings.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | // project header 6 | #include "FPatcherSpecifyAsset.h" 7 | #include "FExternFileInfo.h" 8 | #include "FExternDirectoryInfo.h" 9 | #include "FPlatformExternAssets.h" 10 | #include "HotPatcherLog.h" 11 | #include "CreatePatch/HotPatcherSettingBase.h" 12 | #include "FlibPatchParserHelper.h" 13 | #include "HotPatcherLog.h" 14 | #include "CreatePatch/HotPatcherSettingBase.h" 15 | 16 | // engine header 17 | #include "Misc/FileHelper.h" 18 | #include "CoreMinimal.h" 19 | #include "UObject/ObjectMacros.h" 20 | #include "UObject/Object.h" 21 | #include "Engine/EngineTypes.h" 22 | #include "Kismet/KismetStringLibrary.h" 23 | #include "Serialization/JsonSerializer.h" 24 | #include "Serialization/JsonWriter.h" 25 | #include "FExportReleaseSettings.generated.h" 26 | 27 | 28 | USTRUCT(BlueprintType) 29 | struct HOTPATCHERRUNTIME_API FPlatformPakListFiles 30 | { 31 | GENERATED_USTRUCT_BODY() 32 | 33 | UPROPERTY(EditAnywhere) 34 | ETargetPlatform TargetPlatform = ETargetPlatform::None; 35 | UPROPERTY(EditAnywhere) 36 | TArray PakResponseFiles; 37 | UPROPERTY(EditAnywhere) 38 | TArray PakFiles; 39 | UPROPERTY(EditAnywhere) 40 | FString AESKey; 41 | }; 42 | 43 | /** Singleton wrapper to allow for using the setting structur e in SSettingsView */ 44 | USTRUCT(BlueprintType) 45 | struct HOTPATCHERRUNTIME_API FExportReleaseSettings:public FHotPatcherSettingBase 46 | { 47 | GENERATED_USTRUCT_BODY() 48 | public: 49 | FExportReleaseSettings(); 50 | ~FExportReleaseSettings(); 51 | virtual void Init() override; 52 | virtual void ImportPakLists(); 53 | virtual void ClearImportedPakList(); 54 | void OnFinishedChangingProperties(const FPropertyChangedEvent& PropertyChangedEvent); 55 | virtual void PostEditChangeProperty(const FPropertyChangedEvent& PropertyChangedEvent); 56 | 57 | static FExportReleaseSettings* Get(); 58 | FString GetVersionId()const; 59 | 60 | TArray GetAddExternAssetsToPlatform()const{return AddExternAssetsToPlatform;} 61 | 62 | FORCEINLINE bool IsBackupMetadata()const {return bBackupMetadata;} 63 | FORCEINLINE bool IsBackupProjectConfig()const {return bBackupProjectConfig;} 64 | FORCEINLINE bool IsByPakList()const { return ByPakList; } 65 | FORCEINLINE TArray GetPlatformsPakListFiles()const {return PlatformsPakListFiles;} 66 | FORCEINLINE TArray GetBackupMetadataPlatforms()const{return BackupMetadataPlatforms;} 67 | 68 | virtual TArray& GetAddExternAssetsToPlatform()override{ return AddExternAssetsToPlatform;} 69 | FORCEINLINE bool IsImportProjectSettings()const{return bImportProjectSettings;} 70 | 71 | public: 72 | UPROPERTY(EditAnywhere, BlueprintReadWrite,Category = "Version") 73 | FString VersionId; 74 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Version") 75 | bool ByPakList = false; 76 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Version", meta = (RelativeToGameContentDir, EditCondition = "ByPakList")) 77 | TArray PlatformsPakListFiles; 78 | 79 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Asset Filters") 80 | bool bImportProjectSettings = false; 81 | 82 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "External Files") 83 | TArray AddExternAssetsToPlatform; 84 | 85 | UPROPERTY(EditAnywhere,BlueprintReadWrite, Category = "SaveTo") 86 | bool bBackupMetadata = false; 87 | UPROPERTY(EditAnywhere,BlueprintReadWrite, Category = "SaveTo") 88 | bool bBackupProjectConfig = false; 89 | UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SaveTo",meta=(EditCondition="bBackupMetadata")) 90 | TArray BackupMetadataPlatforms; 91 | UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="Advanced") 92 | bool bNoShaderCompile = true; 93 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/CreatePatch/ScopedSlowTaskContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "HotPatcherLog.h" 3 | // engine header 4 | #include "CoreGlobals.h" 5 | #include "CoreMinimal.h" 6 | #include "Misc/ScopedSlowTask.h" 7 | #include "ScopedSlowTaskContext.generated.h" 8 | 9 | UCLASS() 10 | class HOTPATCHERRUNTIME_API UScopedSlowTaskContext:public UObject 11 | { 12 | public: 13 | GENERATED_BODY() 14 | 15 | FORCEINLINE void init(float AmountOfWorkProgress) 16 | { 17 | if(!ProgressPtr.IsValid() && !IsRunningCommandlet()) 18 | { 19 | ProgressPtr = MakeUnique(AmountOfWorkProgress); 20 | ProgressPtr->MakeDialog(); 21 | } 22 | 23 | } 24 | 25 | FORCEINLINE void EnterProgressFrame(float ExpectedWorkThisFrame, const FText& Text =FText()) 26 | { 27 | if(ProgressPtr.IsValid() && !IsRunningCommandlet()) 28 | { 29 | ProgressPtr->EnterProgressFrame(ExpectedWorkThisFrame,Text); 30 | }else 31 | { 32 | UE_LOG(LogHotPatcher,Display,TEXT("%s"),*Text.ToString()); 33 | } 34 | } 35 | 36 | FORCEINLINE void Final() 37 | { 38 | if(ProgressPtr.IsValid() && !IsRunningCommandlet()) 39 | { 40 | ProgressPtr->Destroy(); 41 | auto Result = ProgressPtr.Release(); 42 | } 43 | } 44 | 45 | private: 46 | TUniquePtr ProgressPtr; 47 | }; -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/CreatePatch/TimeRecorder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "HotPatcherLog.h" 5 | 6 | struct HOTPATCHERRUNTIME_API TimeRecorder 7 | { 8 | TimeRecorder(const FString& InDisplay=TEXT(""),bool InAuto = true):Display(InDisplay),bAuto(InAuto) 9 | { 10 | if(bAuto) 11 | { 12 | Begin(InDisplay); 13 | } 14 | 15 | } 16 | ~TimeRecorder() 17 | { 18 | if(bAuto) 19 | { 20 | End(); 21 | } 22 | } 23 | void Begin(const FString& InDisplay) 24 | { 25 | Display = InDisplay; 26 | BeginTime = FDateTime::Now(); 27 | } 28 | void End() 29 | { 30 | CurrentTime = FDateTime::Now(); 31 | UsedTime = CurrentTime-BeginTime; 32 | UE_LOG(LogHotPatcher,Display,TEXT("----Time Recorder----: %s %s"),*Display,*UsedTime.ToString()); 33 | } 34 | public: 35 | FDateTime BeginTime; 36 | FDateTime CurrentTime; 37 | FTimespan UsedTime; 38 | FString Display; 39 | bool bAuto = false; 40 | }; 41 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/DependenciesParser/FDefaultAssetDependenciesParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IAssetDependenciesParser.h" 4 | 5 | struct HOTPATCHERRUNTIME_API FAssetDependenciesParser : public IAssetDependenciesParser 6 | { 7 | using FScanedCachesType = TMap>; 8 | 9 | virtual void Parse(const FAssetDependencies& InParseConfig) override; 10 | virtual const TSet& GetrParseResults()const { return Results; }; 11 | bool IsIgnoreAsset(const FAssetData& AssetData); 12 | 13 | static bool IsForceSkipAsset( 14 | const FString& LongPackageName, 15 | const TSet& IgnoreTypes, 16 | const TArray& IgnoreFilters, 17 | TArray ForceSkipFilters, 18 | const TSet& ForceSkipPackageNames, bool bDispalyLog 19 | ); 20 | 21 | TSet GatherAssetDependicesInfoRecursively( 22 | FAssetRegistryModule& InAssetRegistryModule, 23 | FName InLongPackageName, 24 | const TArray& InAssetDependencyTypes, 25 | bool bRecursively, 26 | const TArray& IgnoreDirectories, 27 | const TArray& ForceSkipDirectories, 28 | const TSet& IgnorePackageNames, 29 | const TSet& IgnoreAssetTypes, FScanedCachesType& InScanedCaches 30 | ); 31 | protected: 32 | TSet Results; 33 | FScanedCachesType ScanedCaches; 34 | FAssetDependencies ParseConfig; 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/DependenciesParser/IAssetDependenciesParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "FlibAssetManageHelper.h" 5 | #include "FPatcherSpecifyAsset.h" 6 | 7 | struct FAssetDependencies 8 | { 9 | TArray IncludeFilters; 10 | TArray IgnoreFilters; 11 | TArray AssetRegistryDependencyTypes; 12 | TArray InIncludeSpecifyAsset; 13 | // like /Game/EditorOnly /Engine/VREditor 14 | TArray ForceSkipContents; 15 | TSet ForceSkipPackageNames; 16 | TSet IgnoreAseetTypes; 17 | bool bSupportWorldComposition = true; 18 | bool bRedirector = true; 19 | bool AnalysicFilterDependencies = true; 20 | bool IncludeHasRefAssetsOnly = false; 21 | 22 | }; 23 | 24 | struct IAssetDependenciesParser 25 | { 26 | virtual void Parse(const FAssetDependencies& ParseConfig) = 0; 27 | // virtual const TSet& GetrParseResults()const = 0; 28 | virtual ~IAssetDependenciesParser(){} 29 | }; 30 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/FlibReflectionHelper.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Kismet/BlueprintFunctionLibrary.h" 7 | #include "FlibReflectionHelper.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class HOTPATCHERRUNTIME_API UFlibReflectionHelper : public UBlueprintFunctionLibrary 14 | { 15 | GENERATED_BODY() 16 | 17 | static FProperty* GetPropertyByName(UClass* Class, FName PropertyName); 18 | 19 | UFUNCTION(BlueprintCallable) 20 | static FString ExportPropertyToText(UObject* Object,FName PropertyName); 21 | UFUNCTION(BlueprintCallable) 22 | static bool ImportPropertyValueFromText(UObject* Object,FName PropertyName,const FString& Text); 23 | }; 24 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/FlibShaderPipelineCacheHelper.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | #include "RHIDefinitions.h" 5 | #include "CoreMinimal.h" 6 | #include "ShaderPipelineCache.h" 7 | #include "Kismet/BlueprintFunctionLibrary.h" 8 | #include "FlibShaderPipelineCacheHelper.generated.h" 9 | 10 | 11 | UENUM(BlueprintType) 12 | enum class EPSOSaveMode : uint8 13 | { 14 | Incremental = 0, // Fast(er) approach which saves new entries incrementally at the end of the file, replacing the table-of-contents, but leaves everything else alone. 15 | BoundPSOsOnly = 1, // Slower approach which consolidates and saves all PSOs used in this run of the program, removing any entry that wasn't seen, and sorted by the desired sort-mode. 16 | SortedBoundPSOs = 2 // Slow save consolidates all PSOs used on this device that were never part of a cache file delivered in game-content, sorts entries into the desired order and will thus read-back from disk. 17 | }; 18 | 19 | /** 20 | * 21 | */ 22 | UCLASS() 23 | class HOTPATCHERRUNTIME_API UFlibShaderPipelineCacheHelper : public UBlueprintFunctionLibrary 24 | { 25 | GENERATED_BODY() 26 | public: 27 | UFUNCTION(BlueprintCallable) 28 | static bool LoadShaderPipelineCache(const FString& Name); 29 | 30 | UFUNCTION(BlueprintCallable) 31 | static bool EnableShaderPipelineCache(bool bEnable); 32 | 33 | UFUNCTION(BlueprintCallable) 34 | static bool SavePipelineFileCache(EPSOSaveMode Mode); 35 | 36 | // r.ShaderPipelineCache.LogPSO 37 | // 1 Logs new PSO entries into the file cache and allows saving. 38 | UFUNCTION(BlueprintCallable) 39 | static bool EnableLogPSO(bool bEnable); 40 | 41 | UFUNCTION(BlueprintCallable) 42 | static bool EnableSaveBoundPSOLog(bool bEnable); 43 | 44 | UFUNCTION(BlueprintCallable) 45 | static bool IsEnabledUsePSO(); 46 | UFUNCTION(BlueprintCallable) 47 | static bool IsEnabledLogPSO(); 48 | UFUNCTION(BlueprintCallable) 49 | static bool IsEnabledSaveBoundPSOLog(); 50 | 51 | static FString GetGamePathStable(const FString& FileName,EShaderPlatform ShaderPlatform); 52 | static FGuid GetStablePipelineCacheGUID(const FString& FilePath); 53 | 54 | #if PLATFORM_ANDROID 55 | static FString GetOpenGLProgramBinaryName(); 56 | static FString GetOpenGLProgramBinaryFile(); 57 | static FGuid GetOpenGLProgramBinaryGUID(const FString& FilePath); 58 | #endif 59 | #if PLATFORM_IOS 60 | static bool HasValidMetalSystemCache(); 61 | #endif 62 | static void SetPsoBatchMode(FShaderPipelineCache::BatchMode BatchMode,bool bOverrideVar = false,int32 BatchSize = 50,float BatchTime = 0.f); 63 | }; 64 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/HotPatcherAssetManager.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Engine/AssetManager.h" 7 | #include "HotPatcherAssetManager.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class HOTPATCHERRUNTIME_API UHotPatcherAssetManager : public UAssetManager 14 | { 15 | GENERATED_BODY() 16 | public: 17 | virtual void ScanPrimaryAssetTypesFromConfig() override; 18 | }; 19 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/HotPatcherLog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // engine header 3 | #include "CoreMinimal.h" 4 | #include "Logging/LogMacros.h" 5 | 6 | HOTPATCHERRUNTIME_API DECLARE_LOG_CATEGORY_EXTERN(LogHotPatcher, Log, All); 7 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/HotPatcherRuntime.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Modules/ModuleManager.h" 7 | 8 | extern HOTPATCHERRUNTIME_API bool GForceSingleThread; 9 | 10 | class FHotPatcherRuntimeModule : public IModuleInterface 11 | { 12 | public: 13 | 14 | /** IModuleInterface implementation */ 15 | virtual void StartupModule() override; 16 | virtual void ShutdownModule() override; 17 | }; 18 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/MountListener.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "UObject/NoExportTypes.h" 7 | #include "GenericPlatform/GenericPlatformFile.h" 8 | #include "MountListener.generated.h" 9 | 10 | 11 | USTRUCT(Blueprintable,BlueprintType) 12 | struct HOTPATCHERRUNTIME_API FPakMountInfo 13 | { 14 | GENERATED_USTRUCT_BODY() 15 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 16 | FString Pak; 17 | UPROPERTY(EditAnywhere,BlueprintReadWrite) 18 | int32 PakOrder = 0; 19 | }; 20 | 21 | DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnListenerMountPak,FPakMountInfo,PakInfo); 22 | DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnListenerUnMountPak,const FString&,PakName); 23 | /** 24 | * 25 | */ 26 | UCLASS(Blueprintable,BlueprintType) 27 | class HOTPATCHERRUNTIME_API UMountListener : public UObject 28 | { 29 | GENERATED_UCLASS_BODY() 30 | public: 31 | 32 | UFUNCTION(BlueprintCallable) 33 | void Init(); 34 | 35 | void OnMountPak(const TCHAR* PakFileName, int32 ChunkID = 0); 36 | 37 | virtual bool OnUnMountPak(const FString& Pak); 38 | 39 | virtual TMap& GetMountedPaks(); 40 | 41 | UPROPERTY(BlueprintAssignable) 42 | FOnListenerMountPak OnMountPakDelegate; 43 | UPROPERTY(BlueprintAssignable) 44 | FOnListenerUnMountPak OnUnMountPakDelegate; 45 | 46 | private: 47 | TMap PaksMap; 48 | }; 49 | -------------------------------------------------------------------------------- /HotPatcher/Source/HotPatcherRuntime/Public/TargetPlatformRegister.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "CoreMinimal.h" 3 | #include "TargetPlatformRegister.generated.h" 4 | 5 | UCLASS() 6 | class HOTPATCHERRUNTIME_API UTargetPlatformRegister:public UObject 7 | { 8 | GENERATED_UCLASS_BODY() 9 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 lipengzha 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------