HotPatcher: A open source UE resource hot patching tool

UE资源热更打包工具HotPatcher

Important Notice: The author does not have any platforms or channels for recording paid courses and does not endorse any third-party commercial activities. Please keep your eyes open and beware of scams.
The open-source agreement for this software: Allows the free use of features in commercial projects, but does not permit any third party to charge for this plugin in any form, including but not limited to recording paid courses, or redistributing the plugin and code.

HotPatcher is a tool for managing hot update versions and resource packaging, used to track changes in the original resources of project versions to generate patches. It supports one-click cooking and packaging multi-platform patches, with editors available for Windows and MacOS. Writing a process to download patches from a server forms a complete game hot update solution. HotPatcher has been used in many UE projects and will continue to update to support new engine versions; feel free to submit issues.

The patch mechanism of HotPatcher is different from that in UnrealFrontEnd: There are some issues with UE’s patch management processes; based on the original project version, it is difficult to generate identical patches on different computers, and it is impossible to create a patch based on the version of another patch. Additionally, the content included in the patch cannot be previewed intuitively. Furthermore, it is not easy to bundle external files into pak (such as lua files, db files, and other non-assets, which are often not in the Content directory), nor can you manage project and patch versions easily.

This plugin is designed to resolve these issues, using the project’s original resources as the version basis, allowing easy management of the project itself without needing to focus on other files generated by UE. It conveniently supports actions like cook/generate pak/extract resource information from the base package/version diff/patch splitting, etc. It offers a rich array of configuration options and commandlet support, making it easy to achieve an automated hot update packaging process.

Currently supported engine versions are UE4.21-UE5, with support for the IoStore mechanism! Many friends have sent private messages asking about plugin-related issues, so I created a group to discuss UE hot updates and HotPatcher plugin issues (QQ group 958363331). Everyone is welcome to join and share UE-related technologies.

To conveniently collect and manage common issues and solutions related to hot updates and HotPatcher, I have created a new article to document and organize: UE4 Hot Update: Questions & Answers. If you encounter problems, please check this FAQ page first. Regarding the feedback from many users that the configuration parameters in the plugin do not match previous recorded videos, it is because the plugin has undergone many updates and iterations. For detailed changes in each version, please refer to the Update Log.

Showcase

Tower of Taris Dream of Yuan QQ ApexLegends

Mobile

Seeking General OL Ni no Kuni

Cross World

Create!

Our Planet

Carabig Hill
Gods’ Party WitiSports Spirit Realm Star Movement MOSSAI City Beyond

The statistics for application project lists are derived from: 1. Code analysis of the game, including HotPatcher’s code; 2. Feedback from project personnel. If there are false reports, please contact me to remove them.

Resource Management Framework Based on HotPatcher

HotPatcher is no longer just a hot update packaging tool, but a comprehensive resource management framework that covers hot updating, build enhancement, package optimization, resource auditing, and more.

Forward

Note: This plugin can only produce patches containing UE resources and added external files as hot update content (lua is supported). Modified C++ code cannot be hot updated; you need to design your architecture appropriately. If it is a pure Blueprint project, you can use this tool for hot updates without any problems.

The HotPatcher plugin supports packing only specified resources based on selection (you can specify Include Filters and Ignore Filters, as well as Specify Individual Resources). It supports Recursive Dependency Analysis for resources (e.g., packing a specific map and all its dependent resources), and you can choose to exclude unreferenced resources in the packed paths. It will not include unmodified resources, analyze invalid assets in the project, and ignore redirected resources, achieving Asset-Based Version Tracking without having to manage extraneous content (like DDC). You only need to cook once before creating a patch to ensure the cooked content is based on the latest project version (it also supports automatically cooking all resources to include when generating a patch). Moreover, it also supports Chunk, adopts a bMonolithic mode, and the configurable approach allows for arbitrary combinations. It supports exporting resource dependency relationships and supports the execution of Cook and Patch as well as exporting release information via Commandlet, allowing for integration with CI/CD to create your own packaging process.

In addition to containing UE resource files, extra support includes:

  • Supports adding platform-specific files for given platforms (such as Wwise bnk files for each platform).
  • Supports including non-resource files generated by project cook. Such as AssetRegistry.bin/GlobalShaderCache*.bin/ShaderBytecode*.ushaderbytecode;
  • Supports including ini files of engine, project, and plugins;
  • Supports including external folders and files (like lua files, videos, etc.), and allows for custom mount points for runtime access;
  • The generated pak can exclude any UE resource files (as long as no resources are added in HotPatcher), making it easy to just update lua code or configuration files like ini;
  • Supports analyzing differences in the base package across different platforms and generating unified base package description files for subsequent version comparisons in hot updates.

Other functions of the plugin:

  • Supports cooking single resources;
  • Supports importing multi-platform base package information from PakList*.txt;
  • Supports creating a new patch version based on the previous patch version;
  • Supports detecting resources not cooked;
  • Supports version diffs, allowing you to see additions, modifications, deletions (however, deleted resources cannot be removed in previous versions’ paks; they are only displayed in diffs);
  • Supports detecting duplicate file inclusions;
  • Supports exporting all intermediate generation information and configurations of the plugin;
  • Supports customizing UnrealPak parameters (can specify encryption parameters unified with the project);
  • Supports generating patches for multiple platforms simultaneously;
  • Supports chunking patches, designating resource packaging into multiple Paks within a single patch version;
  • Supports error handling when checking file inclusions in chunks;
  • Supports individually packaging each resource in a patch into pak, supporting any resource (including but not limited to UE assets/external files/various cooked bin data, ini) that can be added in HotPatcher to be packaged individually.
  • Supports multi-threaded pak packaging without launching UnrealPak.exe, improving execution efficiency.
  • Supports exporting the dependency relationships of selected resources.
  • Editor supports functionalities like Cook/AddToPatchSettings, facilitating operations in the editor.
  • Supports collecting Shader and other metadata during cooking.
  • Supports IoStore.
  • Supports incrementally updating Shader and AssetRegistry.
  • Supports Shader Patch.

Additionally, I have created a batch cooking tool for one-click cooking specified multiple platforms (of course, command line use is also possible), aiming to complete tasks with the fewest steps.

I recorded a video tutorial for the plugin:

If you cannot bypass the wall, you can refer to the Bilibili link: UE4 Hot Update: HotPatcher Plugin Tutorial

Plugin Usage Process

To facilitate version management, the project must use a version control tool, Git is recommended.

  1. Open HotPatcher, select ByRelease, and export *_Release.json, which records the information of each specified resource;
  2. Use UE to directly package the project for any platform (such as windows/android/ios).
  3. Modify/add/delete resources in the project, change engine/project/plugin settings, etc.;
  4. Open HotPatch and choose the platform you want to patch in the Cook item and execute Cook (check bCookPatcherAssets);
  5. Open HotPatcher, select ByPatch, and use the previously exported *_Release.json as the base version. Choose the content to pack as needed;
  6. Click GeneratedPatch, which will generate the Pak file and various information (including the current version’s *_Release.json, allowing for incremental updates).
  7. The generated Pak contains all the differences with the previously generated package.

Cooking Parameter Explanation

Important: HotPatcher has implemented a separate cooking process, so there is no need to execute the default UE cooking process (the Cooker part in the plugin). Just enable bCookPatchAssets in the Patch configuration.

The cooking portion of HotPatcher is designed to facilitate the cooking of multiple platforms when generating patches, as well as easily specifying maps (the plugin scans all maps in the entire project and lists them), avoiding the need to use command lines every time you cook.

Cooking options are divided into Platforms/Map(s)/Settings:

  • Platforms: Select the platforms for cooking; multiple selections are allowed;
  • Map(s): Choose the maps to cook; this option lists all maps in the current project and allows multiple selections (I have also provided options in the code to list maps in the engine and plugin directories, which can be enabled in HotPatcherEditor.build.cs by controlling ENABLE_COOK_ENGINE_MAP and ENABLE_COOK_PLUGIN_MAP values);
  • Filter(s): You can select to cook only specified directories and add multiple;
  • Settings: Choose cooking settings; default options include Iterator/UnVersioned/CookAll/Compressed, and I also provide OtherOptions to specify the parameters to be cooked.

Note: Either a map in Map(s) or CookAll in Settings must be selected, or a specified directory must exist in Filters for cooking to take place. If only CookMap is selected, only resources referenced by that map will be cooked, and unreferenced resources will not be cooked, which is essential to note.

Clicking CookContent will output the cooking log to UE’s OutputLog.

ByRelease Parameter Explanation

The ByRelease operation exports a json file, recording the hash values of each selected asset resource during export. Based on this hash value, we can determine whether that resource has been modified in subsequent patches.

Release Settings

  • VersionId: Specifies the version of the exported resource information.
  • ByPakList: Generates release configuration from PakList.
  • PlatformsPakListFiles: The PakList*.txt files generated during building the base package can specify multiple platforms simultaneously for analyzing file differences across platforms and documenting these differences to generate the Release.json file shared across those platforms for unified base package information.

When exporting Release without specifying PakList*.txt, the exported release.json only contains resources referenced in the project; it does not include unreferenced resources. However, the engine’s default packaging may pack some unreferenced resources as well, which can lead to resources that actually already exist in the base package not being recorded in the release.json. If these resources are utilized, it may result in duplicate inclusions (though there are no issues using them, these resources will have two instances in the pak). Using PakList*.txt ensures this problem does not arise.

  • IncludeFilter: The resources scanned for the current release.
  • IgnoreFilter: The resources ignored for the current release.
  • bAnalysisFilterDependencies: Perform dependency analysis on the resources selected by the filters.
  • AssetRegistryDependencyTypes: Include resource types to consider when analyzing dependencies within the selected filters, depending on whether bAnalysisFilterDependencies is enabled.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace EAssetRegistryDependencyType
{
enum Type
{
// Dependencies that don't need to be loaded for the object to be used (i.e., soft object paths)
Soft = 0x01,

// Dependencies required for correct usage of the source asset and must be loaded at the same time
Hard = 0x02,

// References to specific SearchableNames inside a package
SearchableName = 0x04,

// Indirect management references, these are set through recursion for Primary Assets that manage packages or other primary assets
SoftManage = 0x08,

// Direct management references indicating one object directly manages another, set when Primary Assets manage things explicitly
HardManage = 0x10,

// Also update FAssetRegistryDependencyOptions when adding more flags
};

static const Type None = (Type)(0);
static const Type All = (Type)(Soft | Hard | SearchableName | SoftManage | HardManage);
static const Type Packages = (Type)(Soft | Hard);
static const Type Manage = (Type)(SoftManage | HardManage);
}

Soft represents resource references with FSoftObjectReference, while Hard denotes direct resource references. To include both Soft and Hard dependencies, you can select Package; this option defaults to Package unless you handle resource reference relations manually.

  • IncludeHasRefAssetsOnly: Conducts dependency analysis on the selected filters’ resource files (as deep as maps). Resources that are unreferenced will not be packed into the patch.
  • IncludeSpecifyAssets: An array of structures where you can specify individual resources in the current release; the first parameter must specify the resource, and the second parameter controls whether to analyze and include the dependencies of the specified resource in the pak.
  • Add Extern Assets to Platform: Used to specify different files to include on different platforms.
    • Target Platform: The platform to include these files (AllPlatform means include on every platform).
    • AddExternFileToPak: Records non-resource files included in the release.
    • AddExternDirectoryToPak: Records external files included in the release.

AddExternFileToPak and AddExternDirectoryToPak correspond to settings like Additional Non-Asset Directories To Package in Project Settings - Packing, which mark non-resource files included in the local package.

SaveTo

  • SaveAssetDependency: Whether to save the dependencies of selected resources in the current release.
  • SaveReleaseConfig: Whether to store all option information for the current release.
  • bBackupMetadatas: Whether to backup the metadata directory for the current version.
  • BackupMetdataPlatforms: Choose the platforms for metadata backup, depending on bBackupMetadatas=true.
  • SavePath: The storage location for this release’s information. A folder named VersionId will be created in the current directory, containing all the files in this folder, supporting relative paths like [PROJECTDIR].

Note: To ensure the resources included in the export contract align with UE’s direct packaging settings, as this exported Release tracks resources contained in packages produced directly by UE.

ByPatch Parameter Explanation

ByPatch is the tool that truly executes packaging into Pak, based on previous export version data (via ByRelease exported json files) while also including external files/folders, configuration files (ini), and non-resource files generated during cooking (like AssetRegistry.bin, etc.). It supports multiple platforms, allows input of UnrealPak parameters, and exports various information about the current patch.

Supports specifying resource filters:

The options for patching in HotPatcher explained:

BaseVersion

  • bByBaseVersion: Denotes whether the patch is based on a certain base version. If false, it only packs selected filter files (the dependency will still be analyzed) and added external files. If true, a base version must be specified, or the patch cannot be executed. This property will also control whether Diff information will be generated; if false, no diff will be generated (a base version without diff is meaningless).
  • BaseVersion: This option should specify the version file that the patch is based on, which can be either ByRelease or the last patch generated, defaulting to *_Release.json.

PatchSettings

  • VersionId: The ID for the current patch version.
  • IncludeFilter: Resources that the current patch scans for changes.
  • IgnoreFilter: Resources that the current patch ignores (before performing dependency analysis).
  • bForceSkipContent: Whether to forcefully ignore certain resources (filtering the final results of the patch).
  • Force Skip Content Rules: Rules for forcefully ignoring specific resources under certain directories (filtering patch outputs), useful for ignoring Editor content, like /Engine/Editor and /Engine/VREditor.
  • Force Skip Assets: Ignore specific resources in the final patch output.
  • bAnalysisFilterDependencies: Analyzes the dependencies of the resources selected by the filters.
  • Recursive Widget Tree: For UserWidget resources that changed in the current patch, recursively analyze parent widget resources that contain them, and include them in the patch. This solves issues where changes to child controls do not trigger the parent control’s effects.
  • AssetRegistryDependencyTypes: The meaning of this is consistent with that described in Release.
  • IncludeHasRefAssetsOnly: Conducts dependency analysis on the selected filters’ resource files (recursively down to maps); unreferenced resources will not be packed into the patch.
  • IncludeSpecifyAssets: An array of structures where you can specify individual resources that need to be included in the pak; the array’s first parameter requires specifying the resource, and the second determines whether to analyze and incorporate its dependencies into the pak alongside it. The third parameter AssetRegistryDependencyTypes has the same meaning as described in Release.
  • IncludeAssetRegistry: Include AssetRegistry.bin files in the pak generated for the current patch. (deprecated)
  • IncludeGlobalShaderCache: Include GlobalShaderCache-*.bin files in the pak generated for the current patch. (deprecated)
  • IncludeShaderBytecode: Include PROJECT_NAME\Content\ShaderArchive*.ushaderbytecode files in the pak generated for the current patch. (deprecated)
  • IncludeEngineIni: Include ini files from the engine directory in the current generated patch, which also includes platform-specific ini.
  • IncludePluginIni: Include all ini files from enabled plugins in the current patch (both engine directory and project directory plugins).
  • IncludeProjectIni: Include the project’s ini files in the current pak generated for the patch (not including DefaultEditor*.ini).
  • bEnableExternFilesDiff: Whether to conduct diff comparisons on added external files, allowing for packaging only modified or newly added external files.
  • Add Extern Assets to Platform: Used to specify different files to include on different platforms.
    • Target Platform: The platform to include these files (AllPlatform means include on every platform).
    • AddExternFileToPak: Record non-resource files included in the release, like txt and videos.
    • AddExternDirectoryToPak: Record external directories included in the release.

AddExternFileToPak elements require:

  1. FilePath must specify the path of the selected file.
  2. MountPath is the mount path under which the file will be packaged into the Pak, defaulting to ../../../PROJECT_NAME/.

During the game’s runtime, you can access this via FPaths::ProjectDir. For example, if the MountPath of AAAA.json is ../../../HotPatcherExample/AAAAA.json, you can load it during runtime with:

1
FPaths::Combine(FPaths::ProjectDir(),TEXT("AAAAAA.json"));

All files in the pak can be accessed via IPlatformFile.

  • AddExternDirectoryToPak: An array of structures that add external directories to the Pak; the first parameter (DirectoryPath) specifies the system folder path, and the second parameter (Mount Point) defines its mount path in the Pak. All files under this specified folder will be included recursively, with relative paths to the specified MountPoint.

  • IncludePakVersionFile: Whether to store version information in the current patch generated.

  • PakVersionFileMountPoint: Controlled by IncludePakVersionFile, used to specify the mount point of the *_PakVersion.json file in the pak, which defaults to ../../../PROJECT_NAME/Extention/Versions.

ChunkOptions

I have added chunk functionality to HotPatch, supporting packaging resources from a patch into different Paks. For instance, packaging all Packages from a patch into one pak (or specifying a map to package into a certain pak), and packaging all lua files into another pak.

The parameters for chunk are as follows:

  • bEnableChunk: Whether to execute chunking for the current patch.
  • bCreateDefaultChunk: Whether to create a default chunk for storing files not present in manually specified chunks.
  • ChunkInfos: A list of chunk information used to specify which resources a chunk should include.

ChunkInfos is an array of structures of FChunkInfo, containing the following members:

  • ChunkName: The name of the current chunk.
  • bStorageUnrealPakList: Whether to store the current chunk’s PakCommand.txt.
  • bStorageIoStorePakList: Whether to store the IoStore pak list files for the current chunk.
  • AssetIncludeFilters: Specifies the resource filters included in the chunk (note: the selected filters will not perform dependency analysis on their resources).
  • AssetIgnoreFilters: Specifies the ignore filters for the chunk.
  • bAnalysisFilterDependencies: Analyzes dependencies on the resources selected by the filters.
  • AssetRegistryDependencyTypes: The same meaning as described in Release.
  • IncludeSpecifyAssets: Specifies which individual resources to include in the chunk, supporting dependency analysis.
  • AddExternFileToPak: Adds external files to the chunk.
  • AddExternDirectoryToPak: Adds external directories to the chunk, supporting recursive analysis.
  • InternalFiles: Specifies whether to include files like AssetRegistry.bin and INI in the chunk.

Essentially, the parameters for chunk are consistent with those selected for patching, allowing for configuration based on demand.

Note: The principle of chunking is that you must select resources in the patch settings; this will trigger an analysis of all resources in the patch. The result of this analysis will be used for chunk configurations, meaning the resources contained in the chunk must exist in this patch. Note that AssetIncludeFilters will not perform dependency analysis, meaning if resources in your patch reference other modules, like the engine or plugins, you also need to include the corresponding directories in the filters for the chunk.

Each resource specified in the chunk can be repeated; one resource can be included in both ChunkA and ChunkB.

I also provided error messages for chunks. If chunk mode is enabled but not all resources within the patch are specified in the chunk, prompts will appear in the Information section at the bottom of HotPatcher to indicate which resources are missing, facilitating error handling.

PakOptions

  • bCookPatchAssets: Indicates whether to cook uasset in patches. If enabled, all uasset resources in the current patch will be cooked during packaging (this increases the build time, requiring waiting for cook completion).

  • Io Store Settings:

  • bIoStore: Whether to enable Io Store.

  • bAllowBulkDataInIoStore: Whether to allow bulk data to be stored in Io Store.

  • IoStorePakListOptions: Parameters passed to IoStorePaklist, such as -compress.

  • IoStoreCommandletOptions: Parameters passed to the IoStoreCommandlet.

  • PlatformContainers: Must specify each platform’s global.utoc and the IoStore Patch path.

  • bStoragePakList: Store the IoStore paklist file.

  • bStorageBulkDataInfo: Store StorageBulkDataInfo. When CookPatchAssets is enabled, this will save cook information in BulkDataInfo.ubulkmanifest, but can be disabled (currently, CookPatchAssets does not support IoStore).

  • Unreal Pak Settings

  • UnrealPakListOptions: Parameters passed to the paklist file, such as -compress.

  • UnrealCommandletOptions: Additional parameters passed to UnrealPak.

  • Encrypt Settings

  • bEncrypt: Enable encryption.

  • bEncrypt: Encrypt Index.

  • bUseDefaultCrypt.ini: Use configuration from config/DefaultCrypt.ini in the project.

  • bSign: Enable Sign.

  • CryptoKeys: Specify the Crypto.json file when bUseDefaultCrypt.ini is not checked.

  • DefaultPakListOptions: This array can specify each resource’s parameters during pak or IoStore packaging, such as -compress.

  • DefaultCommandletOptions: This data can append extra parameters during pak/IoStore execution commands.

  • ReplacePakCommandTexts: Used to replace text in PakCommand.txt.

  • PakTargetPlatforms: This array selects the platforms for the patch, allowing multiple selections while ensuring the selected platform has been cooked.

PakOptions Advanced:

  • bCustomPakNameRegular: Whether to overwrite the pak naming rules, controlling if PakNameRegular can be modified.
  • PakNameRegular: The naming strategy for the generated pak, can use preset variable values for control; present values include: {VERSION}/{BASEVERSION}/{CHUNKNAME}/{PLATFORM}, which will be replaced with the specific values when generating. The default naming strategy is {VERSION}_{CHUNKNAME}_{PLATFORM}_001_P. If chunking isn’t enabled, {CHUNKNAME} will be empty and will process out double underscores __.

SaveTo

  • bIgnoreDelatedAssetsInfo: Clean delete asset/file information from the patch, enabling this means deleted files won’t be recorded.
  • bStorageDeletedAssetsToNewReleaseJson: Controls whether resources deleted in ContentBrowser are stored in the new release json; please refer to 2020.11.07 Update for specific details.
  • bStoragePakList: Whether to store UnrealPak.exe‘s -Create argument file.
  • bStorageDiffAnalysisResults: Whether to store the differences between the current patch version and the base version.
  • bStorageAssetDependencies: Whether to store the dependencies of selected resources in the current patch version.
  • bStoragePatchConfig: Whether to store all option information for the current patch.
  • bBackupMetadatas: Whether to backup the metadata directory of the current version.
  • SavePath: The storage location for this patch’s information. A folder named VersionId will be created in the current directory, containing all files in that folder.

Advanced

  • bStandaloneMode: Whether to run in standalone mode; checking will launch a separate UE process to execute patch tasks without blocking the current editor. This is recommended when working with large resource sizes.
  • bScanCacheOptimize: Enables artifact scanning cache optimization to speed up dependency analysis.

ByShaderPatch Parameter Explanation

ShaderPatch allows comparison and patching by specifying new/old versions of the metadata directory to read .ushaderbytecode files in the ShaderLibrarySource directory.

Version

  • VersionID: The current version number of the ShaderPatch.

Config

  • ShaderPatchConfigs: The configuration for ShaderPatch, structured as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
USTRUCT(BlueprintType)
struct FShaderPatchConf
{
GENERATED_USTRUCT_BODY()

UPROPERTY(EditAnywhere, BlueprintReadWrite)
ETargetPlatform Platform;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FDirectoryPath> OldMetadataDir;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FDirectoryPath NewMetadataDir;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bNativeFormat;
// since UE 4.26 (has no effect below 4.26)
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bDeterministicShaderCodeOrder = true;
};

Save

  • bStorageConfig: Whether to store the current configuration file.
  • SavePath: The generation path for the patch and configuration file.

Advanced

  • bStandaloneMode: Launch a separate process to perform tasks, avoiding blocking the editor.

Commandlet

I have provided four Commandlets for the plugin, namely HotCooker, HotPatcher, HotRelease, and HotShaderPatch, which are used for cooking, generating patches, exporting release information, and ShaderPatch, respectively.

All four Commandlets can specify the -wait parameter to wait for input after execution (to prevent the window from closing automatically).

The properties in the specified -config file for the Commandlet can be replaced by using -PropertyName= (currently, specifying arrays isn’t supported). If nested properties in structures like SavePath.Path are used, you can specify them via a dot: -savepath.path=.

For Commandlet enhancements for HotPatcher, see the update log: 2021.01.14 Update

HotCooker

Important: This functionality has been deprecated. Simply check bCookPatchAssets instead.

Usage of Cooker:

1
UE4Editor.exe PROJECT.uproject -run=HotCooker -config="cook-config.json"

When exporting a cooking configuration in the editor, selecting all maps will set bCookAllMap to true in the exported config file. When executing in the cooking commandlet, it will cook all maps; if bCookAllMap is true, it will cook all maps regardless of the number in CookMaps.

HotPatcher

Usage of Patcher:

1
UE4Editor.exe PROJECT.uproject -run=HotPatcher -config="patch-config.json"

HotRelease

Release usage:

1
UE4Editor.exe PROJECT.uproject -run=HotRelease -config="export-release-config.json"

HotShaderPatch

ShaderPatch usage:

1
UE4Editor.exe PROJECT.uproject -run=HotShaderPatch -config="export-shaderpatch-config.json"

The files received by their -config parameter can all be exported from the editor using the plugin.

Editor Support (UE4.23+)

HotPatcher adds right-click menu extensions for resource selection in the ContentBrowser, enabling one-click Cook and the ability to add selected resources to Patch Setting.

Cook

AddToPatchSettings

Project Settings

The plugin supports right-clicking selected resources in the editor for Cook and packaging. For convenience in configuration, a configuration item for HotPatcher has been created in Project Settings:

This can specify parameters for UnrealPak, encryption configuration, the storage directory for packaging, etc.

Update Log

2024.04.07 Update v82.0

Update address: v82.0. Compared to the previous version, significant optimizations and bug fixes have been done.

No matter which engine version you are using HotPatcher in, it is strongly recommended that you update to the latest version for easier troubleshooting in case of issues.

Update content includes:

  1. Fixed a bug where *.m.ubulk files were not packaged in certain cases.
  2. Optimized the packaging time of PAK, caching and multithreading optimizations for scanning large numbers of files, significantly improving packaging speed.
  3. Supported Accompany’s COOK mode.
  4. Added more performance markers.
  5. Optimized log levels.
  6. Supported cache-ddc-only Cook mode.
  7. Automatically loaded all ShaderLibrary in ../../../PROJECT_NAME/ShaderLibs directory upon module startup.
  8. Supported Nanite and WP COOK.
  9. Supported differential updates for WP (due to WP’s One File Per Actor mechanism, modifying WP scenes does not result in changes in level resources themselves; we’ve expanded a detection mechanism to enable WP differential detection).
  10. Optimized access to FExternFiles.
  11. Optimized the release record’s external files from absolute paths to marked paths.
  12. Fixed the issue of phantom files during COOK in UE5.
  13. Fixed the issue with paths containing // when exporting release.
  14. Fixed the problem of inaccurate PackageTracker obtained by PatcherProxy.
  15. Optimized the implementation of PackageTracker to exclude already tracked resources.
  16. Optimized PackageTracker for recursive tracking analysis.
  17. Unified the lock for ParallelFor in CollectPakCommand to avoid competition issues.
  18. Supported the -AddAssetsByFile= parameter to pass a list of LongPackageNames for packing.
  19. Fixed the issue of ShaderLib not being included in pak.
  20. Allowed adding Pre and Post tasks in the Cmdlet for Cook.
  21. Optimized the plugin’s Slate implementation, supporting secondary menus in the Toolbar to directly select and open corresponding pages.
  22. Supported listening for process crashes, and will store crash files in Saved/HotPatcher/Crashs.
  23. Compatible with both GameFeaturePacker and ShaderPatcher mods (both need to be updated to the latest).

Currently, v82.0 has been officially released and can be pulled and updated from hxhb/HotPatcher. Old versions of the plugin will also prompt for updates to the new version when opening the Patch page.

2023.06.05 Update v81.0

Update address: Release v81.0

  1. Fixed logging output issues with CmdlHandler and DDC Backend configuration not being cleaned.
  2. Cmdlet supports TargetPlatformsOverride to replace TargetPlatform in configuration files.
  3. When executing Patch, resources scanning can be prohibited via NoSearchAllAssets.
  4. Optimized GC timing.
  5. Fixed the issue where PackageTracker tracked resources that remained unchanged in the base version.
  6. Optimized Notification output format.
  7. Unified the saving path rules for config/release/diff during patching.
  8. Supported cooking only Shader-type resources.
  9. Supported CookAdvancedOptions options.
  10. Supported output of PakResults.json recording all packaged resources and obtaining interfaces.
  11. Optimized Log output, not logging Error level logs unless necessary.
  12. Avoided checking cooked file loading for resource loading.
  13. Supported ChunkAliasName as an alias for the Chunk, supporting Chinese characters.
  14. Optimized LoadShaderbytecode-related code.
  15. Fixed the invalid AESKey issue when importing from encrypted pak.
  16. Fixed the logical operator ambiguity during resource analysis on the Linux platform.
  17. Added more ProfilingTag.
  18. Updated MOD version.
  19. Fixed compilation errors for UE5.1 on Linux.
  20. Fixed the issue where each Chunk included all changes.
  21. Fixed the extraneous %s in GetProjectNotAssetDirConfig.
  22. Fixed the problem of TargetPlatform registration occurring later than CDO.

Note: This version does not support UE5.2, and this should also be the last version supporting UE5.1. Due to changes in implementation within the UE5.2 engine, future updates will only support the latest version of UE5.

2023.02.28 Update v80.1

Update address: Release v80.1

  • Fixed ErrorLog caused by invalid paths in PackageTrackerAsCluster.
  • Adjusted the output path for Metadata.
  • Supported obtaining the resource list involved in packaging.
  • Optimized the tracing implementation of PackageTracker.
  • Fixed the bug with Directory/Asset filtering in ForceSkip.
  • Fixed competition issues while processing PakCommand with multithreading.
  • Fixed the problem of TargetPlatform registration timing being later than CDO.
  • Fixed the issue of resources not being packed in PackageTracker (resources from PackageTracker undergo ForceSkip detection).
  • Set bSupportWorldComposition to default false.

2023.01.08 Update v80.0 HotPatcher Modular

Update address: Release v80.0, Modular transformation and development plan of HotPatcher

  1. Fixed the issue where Category related to Regular did not display.
  2. Optimized CmdHandler implementation, supporting Config Override for Editor and Runtime.
  3. Modular transformation of HotPatcher, see HotPatcher’s modular transformation and development plan.
  4. Created ByShaderPatch and ByGameFeature as independent Mods.
  5. Optimized the plugin’s startup process and priority, supporting module expansion.
  6. Supported previewing currently installed modules and checking for updates for individual modules.

2022.12.30 Update v79.0

Update address: Release v79.0

  1. Optimized basic implementation, turned off unnecessary Log output.
  2. Optimized additional Shader compilation for loading dependent materials, supporting NoPostLoadCacheDDC parameter control (requires modifying the engine for this optimization in UE4).
  3. Optimized the allocation strategy for CookCluster.
  4. Optimized Pak file list collection.
  5. Optimized resource analysis performance.
  6. Optimized module scalability.
  7. Fixed compatibility issues across engine versions.
  8. Fixed Shipping’s C4172 ERROR.
  9. Fixed base package packaging errors due to unsupported WP (Found more than one registered Cook Package Splitter).
  10. Supported PakSaveDirRegular, custom output path for Pak.
  11. Supported PakPreset/CookAndPak executed in a unified manner.
  12. Supported global AllowCookPlatforms.

The NoPostLoadCacheDDC parameter for the source version of the engine requires modifying the engine to insert the following code wrapped in [lipengzha]:

The Launcher engine does not support this optimization by default; Cook times will be somewhat slower, but functionally unaffected.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Engine/Source/Runtime/Engine/Private/Materials/MaterialInstance.cpp
void UMaterialInstance::PostLoad()
{
// ...
//++[lipengzha] cmdlet option for disable cook in PostLoad
bool bNoPostLoadCacheDDC = FParse::Param(FCommandLine::Get(), TEXT("NoPostLoadCacheDDC"));
if (!bNoPostLoadCacheDDC && TPM && (TPM->RestrictFormatsToRuntimeOnly() == false))
//--[lipengzha]
{
TArray<ITargetPlatform*> Platforms = TPM->GetActiveTargetPlatforms();
// Cache for all the shader formats that the cooking target requires
for (int32 FormatIndex = 0; FormatIndex < Platforms.Num(); FormatIndex++)
{
BeginCacheForCookedPlatformData(Platforms[FormatIndex]);
}
}
// ...
}
// Engine\Source\Runtime\Engine\Private\StaticMesh.cpp
void UStaticMesh::PostLoad()
{
// ...
//++[lipengzha] cmdlet option for disable cook in PostLoad
bool bNoPostLoadCacheDDC = FParse::Param(FCommandLine::Get(), TEXT("NoPostLoadCacheDDC"));
if(!bNoPostLoadCacheDDC)
{
CacheDerivedData();
}
//--[lipengzha]
// ...
}

2022.11.29 Update v78.0

Update address: Release v78.0

Note: Since UE5 is still in its early stages, Epic’s updates result in significant changes to the engine. Therefore, HotPatcher’s support for UE5 is only compatible with the latest engine version, and compatibility with other versions of UE5 (such as UE5 EA/EA2/5.0.3, etc.) is not considered. Please upgrade to the latest version of UE5 or continue using v77.0. UE4.x can update to the latest version of the plugin.
Special Note: Currently, support for UE5 World Partition has not been adapted, do not use for packaging this type of map.

  • Supported UE5.1.0 (previous versions of UE5 are no longer supported).
  • Fixed the problem with opening Patch and PreCachePlatformData.
  • Fixed crash during Cook in Editor due to GC.
  • Fixed the issue of commandlet flow execution getting stuck.
  • Optimized cross-version compatibility.
  • LICENSE updated, see README.

2022.10.26 Update v77.0

Update address: Release v77.0

  • Refactored the Cook mechanism in UE5.
  • Fixed the issue where ForceSkip became ineffective when PackageTracker was enabled.
  • Addressed directory scanning issues in UE5 (/All/Game).
  • Fixed directory resource dependency analysis problems.
  • Optimized resource scanning, supporting forced ignoring of certain resources.
  • Supported custom saving for Cooked directories.
  • Cook Cluster counting.
  • Optimized Log output.
  • Fixed compatibility issues across engine versions.
  • Changed the error to a warning when a Chunk does not contain files.
  • Fixed some HashCalculator not transmitting issues.
  • Detailed fixes and scalability enhancements.

2022.09.19 Update v76.3

Update address: Release v76.2

  • Supported UE5.0.3 engine.
  • Optimized analysis of changing materials for MaterialInstance packaging (bAnalysisMaterialInstance).
  • Fixed the persistent GenerateGlobalAssetRegistry issue.
  • Supported reading bSkipEditorContent from /Script/UnrealEd.ProjectPackagingSettings to control whether to ignore resources under /Engine/Editor* and /Engine/VREditor/.

2022.09.01 Update v76.2

Update address: Release v76.2

  • Fixed the issue where HASH was not calculated during diff comparison for Not-uasset files.
  • Fixed the issue where HASH for not-uasset files was not calculated during export Release.
  • Fixed the issue where HASH for files was not calculated in FReleasePakParser.
  • Fixed the CryptoKeys file not executing ReplaceMark.
  • Supported adding wildcard to not-uasset directories to only add matching files.

  • Fixed the issue where bAnalysisFilterDependencies became ineffective.
  • When bImportProjectSettings is enabled, if there is only one platform, all files will be added to that platform; if there are multiple platforms, they will be added to AllPlatforms.
  • Optimization for scanning PaperSprite when the PaperSprite configures AtlasGroups, ignoring SourceTexture for packaging.


  • Fixed the issue of the Toolbar being hidden. If you want to globally disable it, you can add the macro DISABLE_PLUGIN_TOOLBAR_MENU in ProjectDefinitions.

2022.07.28 Update v76.1

Update address: Release v76.1

  1. Supported Class filtering for UMultiCookScheduler_MatCluster.
  2. Avoided obtaining enumeration values through reflection in CookPackage (ParallelFor Crash).
  3. Fixed the IsActiveAction issue in FHotPatcherActionManager.
  4. Optimized GetAssetPackageGUID.
  5. Supported ImportProjectSettings/HotPatcherAssetManager.
  6. Supported ForceSkip in chunk.
  7. Disabled RTTI implementation for 4.21.
  8. Added CmdHandler module.
  9. Fixed compatibility issues across versions of the engine.
  10. Fixed some crash issues.
  11. Stopped supporting ByOriginal Cook mode (enable bCookPatchAssets instead).
  12. New Mod support.
  13. Supported third-party Mod development.
  14. Optimized code organization.

2022.03.31 Update v76.0

  • Supported World Composition.
  • Fixed compatibility issues across engine versions.
  • Default enabled bCookPatcherAssets.
  • Optimized code, fixed compilation issues in 4.27.
  • Supported non-intrusive development of HotPatcher modules.

In HotPatcher/Mods, new packaging and resource management modes can be developed based on HotPatcher, making full use of HotPatcher’s framework functions to expand more features:

  • Resource analysis
  • Packaging
  • Resource scanning, management, auditing
  • Multi-process Cook
  • Different forms of hot update methods

And so on, to achieve genuine customization based on actual business needs.

Module Expansion Example

Add HotPatcher plugin dependencies in uplugin:

1
2
3
4
5
6
"Plugins": [
{
"Name": "HotPatcher",
"Enabled": true
}
]

Add module dependencies in build.cs:

1
2
3
4
5
PublicDependencyModuleNames.AddRange(new string[]{
"HotPatcherRuntime",
"HotPatcherCore",
"HotPatcherEditor"
});

You can register to HotPatcher in the module’s StartupModule:

1
2
3
4
5
6
7
8
9
10
11
THotPatcherTemplateHelper::AppendEnumeraters<EHotPatcherCookActionMode>(TArray<FString>{TEXT("ByMultiProcess")});
FHotPatcherAction MultiCookerAction
(
TEXT("Cooker"),
LOCTEXT("ByMultiProcess", "ByMultiProcess"),
LOCTEXT("MultiCookerActionHint", "Use multi-process Cook Content"),
FSlateIcon(),
nullptr,
CREATE_ACTION_WIDGET_LAMBDA(SMultiCookerPage,TEXT("ByMultiProcess"))
);
FHotPatcherActionManager::Get().RegisteHotPatcherAction(TEXT("Cooker"),TEXT("ByMultiProcess"),MultiCookerAction);

Effect:

Based on HotPatcher’s core functionality, you can customize the interface and expand new features based on demand.

2022.02.15 Update v75.2

Release HotPacther v75.2

  1. Fixed GIsRequestingExit warning.
  2. Commandlet supports engine Tick.
  3. Supported Cook/Ignore for specific resource types.
  4. Supported GCookLog control for more Cook logs.
  5. Supported exporting all resources loaded during the cooking process.
  6. Fixed compilation error when enabling CUSTOM_ASSET_GUID.
  7. Fixed derived class list issue.
  8. Supported CookClassesMode.
  9. Fixed the path matching issue in Filter, causing resources to enter different Paks.
  10. Fixed the path issue of Trace file.
  11. Compatible with UE4.21.

2022.01.09 Update v75.1

Release HotPatcher v75.1!

  • Fix memory leak when serializing asset registry.
  • Fix Info.IndexHash.Hash Compiler error in 4.23.

2022.01.26 Update v75.0

This update contains a lot of content, fixing some issues and refactoring parts of the function, enhancing compatibility across engine versions.

  • Refactored the Cook process and supported several different Cook modes to speed up the Cook process.
  • Unified Cook process used by the editor’s Cook, Patch processes, and MultiCooker.
  • Removed support for CookManager.
  • Supported shader packaging for resource compilation in chunks, previously it was packaging a single ShaderLib for the entire Patch, and now it supports customizing ShaderLib paths and naming for each Chunk.
  • Supported excluding resource types.
  • Fixed the Crash issue with IsSkipAsset during ParallelFor Cooking.
  • Cleaned up old Cooked files before Cook.
  • Added numerous Profiling Tags for performance analysis.
  • In the modified engine mode, you can control the number of ShaderCompileWorker processes launched by each Cooker to avoid frequent process switching overhead from the operating system.
  • Supported Patch version numbers.
  • Created a HotPatcherCore module, separating it from the HotPatcherEditor module; Editor only contains editor-specific logic.
  • Fixed serialization Crash issues of AssetRegistry.
  • Fixed issues with Sandbox path conversions.
  • Fixed problems with UE4Editor-cmd in non-Development and 32-bit modes.
  • Cleaned up redundant code, interfaces, and optimized processes.
  • Enhanced engine compatibility, with a minimum compatibility down to 4.22 (no ContentBrowser menu-related functionalities).

2022.01.03 Update v74

  • Refactored the dependency analysis module, with performance improvements by an order of magnitude (70 times improvement for 20,000 resources).
  • Refactored the module that imports Release information from Paklist/Pak files.
  • Optimized implementations, cleaned up numerous redundant interfaces, organized code.
  • Removed AssetManagerEx module, moving UFLibAssetManagerHelper library into HotPatcherRuntime.
  • Fixed issues in versions 4.25 and later due to changes in engine interfaces causing failure of RecursiveWidgetTree.
  • Fixed the case where bRecursiveWidgetTree analysis did not account for certain parent UMG controls when the basic version comparison was enabled.
  • Patch supports PackageTracker to track resources not in the dependency relationship but in ImportTable, such as animation sequence BoneCompressionSettings; refer to Dependencies Loading During Cooking (Note: In the editor, this only takes effect when resources are loaded for the first time or executed in standalone mode).

The rules for bRecursiveWidgetTree are:

  1. If no base version is specified, it recursively analyzes all parent UMG controls that reference UMG resources in the Patch.
  2. If a base version is specified, only the parent UMG controls that exist in the base package will be analyzed to avoid including unnecessary resources.

Data for resource dependency analysis optimization:

The export of Release has also greatly improved, for 20,000 resources:

  • Old version total export time: 568.635s
  • New version total export time: 57.28s

2021.12.27 Update v73

  • Supported CUSTOM ASSET HASH calculation.
  • Replaced some APIs that will be deprecated in UE4.27/UE5.
  • Release added bBackupProjectConfig for backing up the Config directory of the base package.
  • Supported NoCompileShader during Release export to avoid shader compilation caused by loading resources, speeding up exports.
  • Optimized code, replaced some FString with FName, optimized resource dependency scanning.
  • Fixed potential crash issues with PackageTracker.
  • Right-click CookAndPakAction supports selecting whether to analyze resource dependencies.

Note: In the current version, the HASH value for uasset is obtained by getting the engine’s PackageGUID. However, this property is going to be deprecated in UE4.27 and UE5. Therefore, I added support for custom resource HASH calculation, which will calculate the MD5 value of the original uasset file to replace the soon-to-be-deprecated PackageGUID (currently not enabled in the plugin; it will be replaced when UE officially deprecates it). This does not affect the functionality of the plugin, but the PackageGUID and the MD5 calculated Release*.json cannot be compatible, otherwise, all resources will have differences.

If you want to enable it now, you can set bCustomAssetGUID=true in HotPatcherRuntime.build.cs.

2021.12.14 Update v72

Github Release record: v72

  • Fixed Crash issue with SVersionUpdater on Mac.
  • Fixed the exception when enabling share shader code during Cook on Mac.
  • Fixed compilation errors on Mac.
  • Optimized Shader collection process to ensure Shader collection is closed only after Cooking is complete.
  • Deprecated options bIncludeAssetRegistry / bIncludeGlobalShaderCache / bIncludeShaderBytecode, with better alternative implementations. See UE Hot Update: Shader Update Strategy.

Recently working on a big update, later HotPatcher can be used to replace UE’s Cook and packaging mechanisms, achieving multi-process and even multi-machine Cook task distribution, enabling management with HotPatcher during the base package process and speeding up UE’s packaging process.

Mac on Cook IOS, left is the default CookCommandlet from UE, right is HotPatcher’s Cook, both enabled ShareShaderCode:

2021.11.21 Update v71

  • Supported ZenLoader serialization mechanism from the ue5-main branch.
  • Default enabled WITH_PACKAGE_CONTEXT during Cook starting from 4.24.
  • Moved PackageContexts related code into HotPatcherEditor module.
  • Right-click menu’s Cook and Pak Action supports PackageContext.
  • Fixed the issue of right-click menu execution failing in UE5.
  • The plugin configuration provides a complete PatchSettings template.
  • Supported Binaries Patch using keys from project settings for unpacking.
  • Optimized code.

Currently, there are significant differences between ue5-main and the UE5 EA version, especially with serialization-related implementation details; a lot of changes have occurred. Currently, some trick methods are used to achieve compatibility with 4/5, and once the official version of UE5 is released, if simultaneous compatibility is required, significant differences will require considering a separate development branch for UE5.

2021.11.19 Update v70

  • Supported packaging GameFeature/plugins, default enabled in UE4.27/UE5, see the article: UE5: Game Feature Preliminary Research.
  • Refactored the Pak encryption module to support importing encryption settings from project settings and align with the encryption methods of the base package.
  • Supported generating Crypto.json from Project Settings-Crypto configuration.
  • Fixed initialization warnings for value types.
  • Optimized code.

Note: UnrealPak specifies the use of project ini configuration via -encryptionini, which has a bug that causes a crash. My implementation completely discards ini and uniformly uses Crypto.json.

Files included in the packaged plugin:

  • All resources in the plugin.
  • The plugin’s uplugin.
  • The AssetRegistry generated from plugin resources.
  • The Shader Library generated during the Cook of the plugin resources.
  • The plugin’s Config/ directory.

And wrapped the runtime library:

1
2
3
IPluginManager::Get().AddToPluginsList(TEXT("../../../BlankExample/Plugins/GameFeatures/GF_Feature/GF_Feature.uplugin"));
UFlibPakHelper::LoadAssetRegistry(TEXT("GF_Feature"),TEXT("../../../BlankExample/Plugins/GameFeatures/GF_Feature/"));
bool UFlibPakHelper::LoadShaderbytecode(TEXT("GF_Feature"),TEXT("../../../BlankExample/Plugins/GameFeatures/GF_Feature/"));

2021.11.15 Update v69

  • Supported generating AssetRegistry for resources in the Patch (will read configuration from project setup: Control the Serialization of AssetRegistry).
  • Fixed compilation errors in UE5.
  • Fixed Slate, un-initialization vars warnings.
  • Changed Cook resources from Patch All to Cook Chunk.
  • Fixed errors in UE4.26+ due to default enabling of shader deterministic without specified GameOpenOrder.
  • Supported version number detection for update prompts.

The AssetRegistry in the Patch supports two modes: PATCH/PER_CHUNK, the distinction being:

  • PATCH: Only one AssetRegistry.bin will be generated in this Patch, packaged into Chunk 0, and it will not exist in other Chunks.
  • PER_CHUNK: If the Patch is split into chunks, CHUNK_NAME_AssetRegistry.bin can be created based on resources in each CHUNK and only packed into that Chunk’s Pak.

You can customize the mount point of AssetRegistry.bin and the naming rules for AssetRegistry, the default being [CHUNK_NAME]_AssetRegistry.bin:

Plugin version number detection:

2021.10.29 Update

  • Supported Shared Shader bytecode in the Patch.

During Cook, collect all Shaders in the Patch and generate ShaderBytecode separately, enabling incremental updates to the Shader. For details, see the article: UE Hot Update: Shader Update Strategy # A Better Way.

2021.08.06 Update

  • Supported BinariesPatch mode matching.
  • Able to match/ignore file sizes and suffixes.
  • Fixed issues with extracting files from Pak.
  • Optimized code.

2021.08.05 Update

  • Automatically add -AlignForMemoryMapping parameter for each platform during packaging to solve Crash issues for IOS.

2021.07.30 Update

  • Supported importing the list of base package files from Pak files, and the ResponseFile for packaged Pak can be mutually replaced.

2021.07.21 Update

  • Based on binary patch, the first version has been roughly implemented.
  • Reserved implementation interfaces for BinariesPatch scheme in HotPatcher (the diff/patch implementation requires modifying the engine; it’s not open-sourced yet. If interested, you can update the dev branch code, (merged to trunk), you only need to inherit the interface of IBinariesPatchFeature to implement a binary Diff/Patch Feature to use the plugin for packaging resource binaries).

2021.07.16 Update

  • Supported CookAndPak for resources managed by PrimaryAssetLabel.

2021.07.14 Update

  • Supported importing Patch or Chunk configurations from Primary AssetLabel.

2021.07.08 Update

  • Fixed crash issues.

2021.07.02 Update

  • Ignored checks for EditorOnly resources.
  • Added failure prompts and logs for Cook of EditorOnly.

2021.06.28 Update

Prject Settings-Plugins-HotPatcher can view the plugin’s editor configuration parameters.

  • Unified the processes of CookAndPak and configuration page packaging.
  • CookAndPak supports selecting both directory and individual resources simultaneously.
  • CookAndPak supports running in StandaloneMode.
  • Optionally save CookAndPak’s PatchConfig configuration.
  • Optimized the Patch process to ensure all resources are cooked before packing.
  • Optimized plugin configuration items.
  • Added protection for the detection of invalid resources to prevent crashes.
  • Provided Preset functionality to add parameters configured in HotPatcher to preset configuration (AddToPreset).
  • Right-click menu in the ContentBrowser supports executing Preset tasks.

AddToPreset
Configuration Preset
CookAndPak

2021.06.24 Update

  • Fixed errors in CookAndPak, ensuring that all resources have been cooked during packaging.
  • Supported PakExternalAction option.

Supported packaging external files from the editor’s right-click menu:

Needs to be pre-configured in Project Settings-Plugins-Hot Patcher:

2021.06.15 Update

  • Optimized code, removed unnecessary processes.
  • Supported enabling encryption for the right-click menu CookAndPak.

Settings can be adjusted in Project Settings-Plugins-Hot Patcher:

Note: There is a bug in the current (2021.06.15) UE5 EA engine where this feature cannot be enabled, otherwise it will crash.

2021.06.09 Update

  • Supported UE4.27.

2021.06.06 Update

  • Fixed the issue where release.josn did not include Add/Modify file information during export.

2021.06.04 Update

  • Supported bCreateDefaultChunk, creating a default Chunk to store files that do not exist in manually configured Chunks when splitting chunks.

2021.06.03 Update

  • Supported generating patches for Io Store from UE4.26-UE5.
  • Fixed bugs in the Paklist analyzer.
  • Optimized part of the code.

Note: Support for Io Store patch generation is limited to UE4.26-UE5. Currently, UE’s support for Io Store still has bugs, and there are certain points to pay attention to during Patch creation:

  • Only use the HotCooker integrated Cook, and do not enable bCookPatchAssets within the Patch.
  • Must specify the base package global.utoc.
  • UE5 by default has bAsyncLoadingThreadEnabled enabled, which may cause shader loading issues, resulting in material loss; disabling this will restore it (this appears to be a bug from IoStore’s early version).
  • Specify other utoc in the base package (GenerateDiffPatch/PatchSource) (optional).
  • When a patch contains multiple chunks, multiple processes must be enabled to execute Io Store generation; generating multiple chunks in a single process will cause a crash (UE’s bug).

If bCookPatchAssets is enabled, the following error will be generated when loading the Patch:

Upon enabling IoStore, the cooking mechanisms of the engine and the provided plugin differ significantly; there will be more analysis time to determine if bCookPatchAssets can be supported.

2021.05.27 Update

  • Fixed the missing BaseVersion/VersionId/Date information in the Release.json generated during the Patch.
  • Supported UE5 EA version.

However, it should be noted that UE5 has enabled IO Store by default, currently, the plugin does not support IO Store packaging, so temporarily disable UE5’s IO Store; otherwise, pak cannot mount, and support will be added when there’s time. It appears that the pressure on resource IO for UE5 is indeed significant, and the introduction of Oodle to IO Store is likely paving the way for supporting the surge in UE5 resources.

2021.05.20 Update

  • Supported direct Cook and package of resources created in the current editor, no need to restart the editor for packaging new resources.
  • Streamlined Patch/Release, split process steps, with the next step implementing a multithreaded version.

2021.05.18 Update

  • Streamlined common code for Release/Patch/ShaderPatch.
  • Optimized configuration logic, ensuring that configuration flags such as [PROJECTDIR] remain unchanged during generation and are replaced during task execution.
  • Unified common options between modes.
  • Added bScanCacheOptimize under Advanced, enabling caching optimization for resource dependency scanning.
  • Added task summary output for Release/Patch.

Summary of the Release:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
2021-05-19 07:38:31:642 : ---------------------HotPatcher Release Summary---------------------
2021-05-19 07:38:31:642 : New Release Asset Number: 7591
2021-05-19 07:38:31:642 : ======== IOS Non-Assets =========
2021-05-19 07:38:31:643 : External Files: 82
2021-05-19 07:38:31:643 : =================================
2021-05-19 07:38:31:643 : ======== WindowsNoEditor Non-Assets =========
2021-05-19 07:38:31:643 : External Files: 81
2021-05-19 07:38:31:643 : =============================================
2021-05-19 07:38:31:643 : ======== Android_ASTC Non-Assets =========
2021-05-19 07:38:31:643 : External Files: 85
2021-05-19 07:38:31:643 : ==========================================
2021-05-19 07:38:31:643 : ======== AllPlatforms Non-Assets =========
2021-05-19 07:38:31:643 : External Files: 1673
2021-05-19 07:38:31:643 : ==========================================

Summary of the Patch:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
LogMissionNotificationProxy: -----------------HotPatcher Patch Summary-----------------
LogMissionNotificationProxy: =================
LogMissionNotificationProxy: Add Asset Number: 6719
LogMissionNotificationProxy: Modify Asset Number: 49
LogMissionNotificationProxy: Delete Asset Number: 0
LogMissionNotificationProxy: ======== AllPlatforms Non-Assets =========
LogMissionNotificationProxy: Add Non-Asset Number: 975
LogMissionNotificationProxy: Modify Non-Asset Number: 0
LogMissionNotificationProxy: Delete Non-Asset Number: 0
LogMissionNotificationProxy: ==========================================
LogMissionNotificationProxy: ----------------HotPatcher Release Summary----------------
LogMissionNotificationProxy: New Release Asset Number: 6719
LogMissionNotificationProxy: ======== AllPlatforms Non-Assets =========
LogMissionNotificationProxy: External Files: 975
LogMissionNotificationProxy: ==========================================

Note: Some configuration property names have changed in this modification, SavePath and bStorageConfig, for already exported configurations; these two property names need to be modified.

2021.05.17 Update

  • Fixed warnings in 4.26 and compilation errors in 4.22.
  • Added the option for GScanCacheOptimize (enabled by default).
  • Added ToolTips for the Patch/Release/ShaderPatch buttons to indicate which necessary options are not configured.

Patch

Release

Shader Patch

2021.05.13 Update

  • Fixed crash issues.
  • SavePath/BaseVersion and other paths support token replacement.

Optional tokens are:

1
2
3
4
5
6
[ENGINEDIR]
[ENGINE_CONTENT_DIR]
[PROJECTDIR]
[PROJECT_CONTENT_DIR]
[PROJECT_SAVED_DIR]
[PROJECT_CONFIG_DIR]

During execution, these will be replaced with the actual local directories, allowing all paths in the configuration to be specified relative to these tokens, resulting in a fully generic configuration file.

  • Optimized the efficiency of dependency scanning.

For the same patch configuration in the same project:

  1. Using the previous plugin version, dependency analysis took 1m46s; after optimization, it takes 33s.
  2. The complete patch time reduced from 4:24s to 2:40s (including cooking resources).

There are still several areas in the plugin that can be further optimized for execution efficiency; these will be addressed when time permits.

2021.04.28 Update

The -compress parameter is ignored for the ExtensionsToNotUsePluginCompression type specified in [Pak] within BaseEngine.ini.

BaseEngine.ini
1
2
3
4
5
6
7
[Pak]
+ExtensionsToNotUsePluginCompression=uplugin
+ExtensionsToNotUsePluginCompression=upluginmanifest
+ExtensionsToNotUsePluginCompression=uproject
+ExtensionsToNotUsePluginCompression=ini
+ExtensionsToNotUsePluginCompression=icu
+ExtensionsToNotUsePluginCompression=res

The purpose is that if these types of files are packaged using automatic mounting, the corresponding compression algorithm module may not be activated yet, causing loading failures for these file types. UE performs checks when creating the base package and corresponding support is also added in the plugin.

2021.04.18 Update

  • Supports configuring whitelists for Cook platforms via right-click in the editor.
  • Allows direct right-click packing of resources selected in the editor to create Pak files.

In Project Settings - Plugins - HotPatcher, there are configuration options:

When the whitelist is enabled, only the configured options will appear for the right-click platform in the editor:

A new Cook And Pak Actions option has been added to the right-click menu, allowing multiple selected resources to be directly cooked and packed into Pak files. The default storage directory is in Saved/HotPatcher/Paks, which can be modified through configuration.

2021.03.25 Update

  • Added bDeterministicShaderCodeOrder for 4.26+.

bDeterministicShaderCodeOrder is declared in UProjectPackagingSettings and added in 4.26 to control the storage order of shaders during packaging.

Editor/UnrealEd/Classes/Settings/ProjectPackagingSettings.h
1
2
3
4
5
6
7
8
/** 
* With this option off, the shader code will be stored in the library essentially in a random order,
* squarely the same in which the assets were loaded by the cooker. Enabling this will sort the shaders
* by their hash, which makes the shader library more similar between the builds which can help patching, but
* can adversely affect loading times.
*/
UPROPERTY(config, EditAnywhere, Category = Packaging, meta = (EditCondition = "bShareMaterialShaderCode"))
bool bDeterministicShaderCodeOrder;

2021.03.23 Update

  • Fixed compilation errors on 4.22.
  • Added HotRelease to automatically back up the Metadata files based on the configured paklist information.

2021.03.15 Update

  • Added options to back up Metadata directories for Release/Patch.

Release Settings

Patch Settings

The current project’s version of the Metadata directory will be copied to the Release/Patch directory (BackupMetadatas), facilitating the management of DevelopmentAssetRegistry.bin and Shader bytecode for asset auditing and Shader Patch.

2021.02.23 Update

  • ShaderPatch file generation prompts.
  • ShaderPatch Commandlet (-run=HotShaderPatch).
  • Fixed Reset Config errors in Shader Patch.
  • Code optimization.

A solution for ShaderPatch crashing when generated in 4.25+: Issues with ShaderPatch in UE4.25

2021.02.01 Update

2021.01.28 Update

  • Fixed the issue where DebugGame Editor could not launch a new process at runtime.
  • Added the bStandaloneMode option for controlling whether to launch a new process for task execution (true will launch a new process).

2021.01.22 Update

  • The HotPatcher Patch Commandlet can specify platforms.

Add it using -AddPatchPlatforms=WindowsNoEditor,Android_ASTC,IOS, multiple platforms are separated by commas.

2021.01.20 Update

  • When the base package is split into chunks, it supports adding multiple paklist files for a specific platform in Release.

2021.01.19 Update

  • Supports a generic external file specification mode, allowing the use of common configurations across different project paths.

When specifying an external file/folder, you can use [PROJECTDIR] which will be replaced with the actual project directory during execution.

Optional paths are:

1
2
3
4
5
6
[ENGINEDIR]
[ENGINE_CONTENT_DIR]
[PROJECTDIR]
[PROJECT_CONTENT_DIR]
[PROJECT_SAVED_DIR]
[PROJECT_CONFIG_DIR]

Note, during production execution, the real paths will replace the current configuration (both Patch and Release automatically generated exported configuration files use absolute paths, but you can manually export configuration files based on relative paths in the editor).

2021.01.18 Update

  • The generation of Release/Patch does not block the Editor.
  • Logs can be viewed directly in the Editor.
  • Unified the method of creating UE notifications.

This update changes the previous blocking method for the Editor to an asynchronous commandlet process, which will not affect the current editor process, similarly to packaging in UE, alleviating the anxiety of the Editor freezing.

2021.01.14 Update

  • Fixed path errors when cooking plugin resources in the Cook Engine directory.
  • byRelease supports command line import of PlatformPakList.

The method for addition is to use -AddPlatformPakList=, followed by platform name plus PakList file (multiple files can be supported, separated by +), and multiple platforms are separated by commas.

1
-run=HotRelease -byPaklist=true -AddPlatformPakList=WindowsNoEditor+D:\PakList_FGame-WindowsNoEditor.txt -savepath.path="D:\\"
  • All three Commandlets support replacing parameters in Config.

  • The HotRelease Commandlet can run without specifying a config file; values can be directly specified (but the paklist file must be imported).

2021.01.13 Update

  • Fixed issues where cooking failed due to plugins being included in the patch.
  • Fixed issues where resources could not be loaded in generated patches by Commandlet.
  • Several other optimizations.

2021.01.11 Update

  • Supports importing configuration from projects into Patch and Release Settings.

Project Settings - Packaging - Additional Asset Directories to Cook will be added to AssetIncludeFilters.
Project Settings - Packaging - Directories to never cook will be added to AssetIgnoreFilters.
Project Settings - Packaging - Additional Non-Asset Directories To Package will be added to AddExternAssetsToPlatform (AllPlatform).

All maps configured under AlwaysCookMaps and AllMaps Section in Config/DefaultEditor.ini will be added to IncludeSpecifyAssets and checked with bAnalysisAssetDependencies.

2021.01.08 Update

  • Supports adding directories to PatchSettings from the ContentBrowser.
  • Fixed the StaticFindObject crash error caused by generating patches via Commandlet when CookAsset is checked.
1
LogWindows:Error: Illegal call to StaticFindObject() while serializing object data!

2020.12.14 Update

  • Added the UFlibPakReader function library for reading files in Pak without mounting.

2020.12.11 Update

  • Supports Shader bytecode patches, configured through byShaderPatch page;

Requirements for Shader bytecode Patch:

  • Backup the Cooked/PLATFORM/PROJECT_NAME/Metadata directory for each packaging;
  • Compare the latest version’s Cooked/PLATFORM/PROJECT_NAME/Metadata with the old version’s Metadata;
  • The generated ushaderbytecode files can be packed through HotPatcher as external files and loaded at runtime;

Note: Currently, this function is normal in engine versions 4.24 and earlier, but will trigger exceptions in 4.25+; detailed analysis of the reasons can be found here: ShaderPatch Issues in UE4.25. To resolve this issue, modifications to the engine code are required based on the reasoning analysis in the notes above.

2020.12.10 Update

  • Fixed issues with HotRelease Commandlet export failures.

2020.12.04 Update

  • HotPatcher supports UE4.26!
  • Fixed issues where modifying resources after cooking in the editor caused failures to load them during the next session.

2020.11.26 Update

  • Fixed path errors during resource cooking in Content Browser.
  • Fixed preview issues in new version code.

2020.11.08 Update

  • Supports checking during individual resource cooking (newly created resources have incomplete UPackage; using them for cooking will crash).
  • ContentBrowser now prompts in case of failed cooking when right-click cooking resource.

Note: If a resource is newly created in the project, directly cooking it will be problematic because the data of the newly created resource’s Package fetched via the engine is incomplete, leading to crashes during cooking. Currently, the plugin’s approach is to check the integrity of the UPackage data before cooking; if it is not correct, the resource will be ignored.

A temporary workaround is to restart the editor after creating resources, before conducting cooking or patch actions on those resources, or to utilize the plugin’s provided Cook directory and specific map functionality, which does not have the aforementioned issues, as it launches a new UE process for the cooking task, thus reloading local resource information.

2020.11.07 Update

  • Added bStorageDeletedAssetsToNewReleaseJson: controls whether deleted resources in the ContentBrowser are stored in the new ReleaseJson.

Essentially, this introduces two version management modes:

  1. The ReleaseJson records all resources in the current game version (deleted resources still exist in UFS, as files in old Pak are not removed).
  2. The ReleaseJson records all resources that players should experience in the game (excluding moved directories and deleted resources).

There is no difference in resources in the game; the distinction lies in the version information managed by HotPatcher.

2020.11.01 Update

  • (UE4.23+) Supports adding selected resources directly from ContentBrowser to Patch Settings.
  • Supports directly cooking resources when generating Patch (bCookPatchAssets). Please note that when there are many resources in the Patch, cooking can be very time-consuming and requires compiling shaders, which greatly increases Patch generation time; hence, enabling cooking during Patch generation can be useful for testing some resources or running it in CI.

2020.10.31 Update

  • Supports cooking individual resources (shader code is included in the resource);
  • (UE4.23+) Supports right-click cooking selected assets (multi-select) in Content Browser;

2020.10.30 Update

  • PatchSetting supports bForceSkipContent to forcibly ignore certain resources in specified directories.
  • ForceSkipContentRules specifies directories of resources to be ignored in the Patch, default values are /Engine/Editor and /Engine/VREditor. When the project settings select Exclude editor content when cooking, resources in these two directories will not be cooked and cannot be packed.
  • ForceSkipAssets ignores specified resources in the Patch version.
  • Renamed DiffPatchVersion and other functions to DiffPatchVersionWithPatchSetting, passing PatchSetting, to facilitate option control during Diff.

The addition of these two options is to match the directories that UE does not cook by default, and for self-control over which resources are excluded from packaging.
Note: The distinction between ForceSkipContentRules and AssetIgnoreFilters is that AssetIgnoreFilters is a filtering step before resource dependency analysis, which can be used as subdirectories of AssetIncludeFilters; while ForceSkipContentRules performs filtering on the results after diffing, excluding resources with these prefixes.

2020.10.27 Update

  • Supports analyzing Release from the generated PakList file.
  • Supports importing multiple platform PakLists and analyzing file differences across platforms.
  • ReleaseSetting and PatchSetting classes have been changed from UObject to USTRUCT.
  • Unified the handling of Import/Export configurations using serialized USTRUCT.
  • Supports adding special files to certain platforms in the Patch (only included for specified platforms).
  • Used CustomDetailView to add buttons for importing PakList in the Detail panel.
  • Refactored some code to adapt to adding special files for different platforms.
  • Additional configuration information has been removed from Release.json.
  • Fixed MountListener errors in 4.24.

This update involves significant code changes and the configuration files exported from previous versions are not compatible with the current version. Therefore, it is currently published to the Dev branch, and will be merged into the master branch after testing for stability. Currently, the Release/Patch/Chunk processes have been tested and show no major issues.

2020.10.17 Update

  • Supports analyzing WidgetTrees for Widgets, resolving issues where modifications to child widgets do not affect the parent widget.

If a Widget has been modified, it can control whether to recursively add all widgets containing it, solving the issue where modifying child widgets doesn’t reflect when patching the parent widget.

2020.08.31 Update

  • Added commandlet support for exporting Release.
  • Cleared redundant code and organized the structure.
  • Added control over the naming rules for generated Paks.
  • Fixed issues where empty packages would be generated even if no files were included in a Chunk.
  • Fixed the Crash issue of UFlibPakHelper::GetMountedPaks in 4.25.

2020.06.04 Update

  • Added the bCookAllMap property to export configurations; when set to true, all maps in the project directory will be cooked in Commandlet mode.
  • Added ByRelease support to generate configurations through PakList*.txt to fully match all resources in the base package.

2020.06.03 Update

  • Added the Commandlet for plugin cooking.
  • Added the Commandlet for plugin patching.

2020.04.27 Update

  • Added MonolithicPathMode for the bMonolithic mode in Chunks to specify the storage path rules for the pak in monolithic mode.

2020.04.24 Update

  • Added an option to analyze dependencies for resources in filters.

2020.04.23 Update

  • Added optional reference resource types.

2020.04.18 Update

  • Automatically add -compressionformats parameter to UnrealOptions.
  • Added the option for PreviewChunk, which conveniently indicates which resources are included in each chunk when using chunks.

2020.04.10 Update

  • Added ReplacePakCommandTexts option, allowing customization of the text in PakCommand.txt according to requirements, such as replacing the MountPath of resources being packed into the pak.

2020.04.09 Update

  • Fixed issues with generating Chunks from PatchSetting when no filter was selected/redirection of resource issues.
  • Fixed issues during Cooked path conversion.
  • Supported exporting all pak information, removing pakversion options.
  • Supported exporting resource dependency relationships in Release and Patch.
  • Added FScopeSlowTask progress display in ExportRelease.
  • Added options to specify PakCommand parameters.

2020.04.08 Update

  • Supports multi-threaded pak packing by directly calling ExecuteUnrealPak instead of launching UnrealPak.exe, greatly improving efficiency.
  • Fixed inconsistencies in PreviewPatch selected for BaseVersion with Diff information.

2020.04.07 Update

  • Supports bMonolithic mode, allowing each referenced resource to be packed into a separate pak.
  • Unified the packing method for assets, cooked binaries, external files, ini files, etc.

2020.04.03 Update

  • Completed the Chunk functionality for Patch, unifying the packaging processes for Patch and Chunk.
  • Code optimization and workflow reorganization.
  • Removed options IncludePakVersionFile and PakVersionFileMountPoint.

2020.04.02 Update

  • Added Chunk functionality for Patch.
  • Fixed serialization/deserialization issues with FPatcherSpecifyAsset.
  • Optimized organizational structure.

2020.03.28 Update

  • Fixed issues with incomplete exported *Release.json when generating patch based on a base version.

2020.03.05 Update

  • Fixed issues with task state not clearing when the Cook process exits abnormally.
  • Added optional maps in Engine or Plugin during cooking in code; controlled via values in HotPatcherEditor.build.cs by toggling ENABLE_COOK_ENGINE_MAP and ENABLE_COOK_PLUGIN_MAP.

2020.02.14 Update

  • Added import and export for Patch and Release configurations.
  • Changed default naming for generated Pak to XXX_TARGET_PLATFORM_001_P.pak.
  • Fixed some potential issues; updating is recommended.

2019.12.08 Update

  • New options for resource dependency scanning with diff preview.

2020.02.19 Update

  • For the plugin, added support for including external files and folders while exporting releases, corresponding to directories with non-resource external files added during UE packaging. External file diffing (optional) is also supported; only modified or newly added files for specified external files and directories will be packed into the pak.

2020.01.13 Update

  • New error message prompts during generation for scanning uncooked resources and detecting duplicate external files, added the capability to specify specific resources to Pak, with the option to analyze dependencies.

2020.01.14 Update

  • Fixed the issue with Redirector prompting that resources are uncooked, added IncludeSpecifyAssets to ExportRelease, allowing specification of a certain resource (e.g., only a specific map).

2020.01.19 Update

  • Added the specification of directories to cook.

Update Plans

To make HotPatcher more user-friendly and powerful, I’ll record some good update suggestions here.

  1. Add support for multi-threaded resource dependency analysis (executed by launching separate processes).
  2. Add direct command-line options to specify encryption parameters for Pak in UnrealPak (opened to allow specifying UnrealPak parameters).
  3. Specify individual resource cooking.
  4. Change the naming convention for packaged Paks from XX_TARGET_PLATFORM_P.pak to XX_TARGET_PLATFORM_0_P, or make the middle number customizable.
  5. Import and export configurations for Patch and Release, as well as quickly clean configurations.
  6. Add options for release to include external files, synchronized with UE packaging external files.
  7. Add diffing for external files so that not all external files are packaged into the pak each time.
  8. Allow multiple pak files to be packaged in a single Patch, with options on which resources go into which Pak.
  9. Add multi-threaded support for bMonolithic mode in Chunk.
  10. Add support for Commandlet.
  11. Add commandlet support for exporting Release.
  12. Add options to control the naming rules for generated Paks.
  13. Support adding NoAssets resources for specific platforms during patching.
  14. Track UMG child widgets modified after being referenced by parent widget resources.
  15. Support analyzing base package Release.json from multiple platform paklists.
  16. Filter the final results of the Patch.
  17. Set to ignore Editor’s resource content.
  18. Store added external files in relative paths within the Release.json (using Mountpath for version comparison).
  19. Support generating patches for shader bytecode.
  20. Implement non-blocking editing for the editor during patching, using asynchronous tasks.
本文会持续更新HotPatcher的文档。

Scan the QR code on WeChat and follow me.

Title:HotPatcher: A open source UE resource hot patching tool
Author:LIPENGZHA
Publish Date:2020/01/15 09:41
Update Date:2020/08/31 17:27
World Count:62k Words
Link:https://en.imzlp.com/posts/17590/
License: CC BY-NC-SA 4.0
Reprinting of the full article is prohibited.
Your donation will encourage me to keep creating!