HotPatcher: A open source UE resource hot patching tool

UE资源热更打包工具HotPatcher

Important Notice: The author does not have any platform or channel to record paid courses and does not endorse any commercial activities by third parties. Please stay vigilant and be cautious of scams.
The open source license of this software: Allows free use of features in commercial projects, but does not allow any third party to charge any form of secondary fees based on this plugin, including but not limited to recording paid courses, secondary distribution of the plugin and code, etc.

HotPatcher is a tool used for managing hot updates and resource packaging, aimed at tracking changes in original resources of project versions to generate patches. It supports one-click cooking for multiple platforms, one-click packaging for multiple platform patches, and editor support for Windows and MacOS. Writing a process to download patches from a server creates a complete hot update solution for games. HotPatcher has been used in many UE projects and will continue to update to support new engine versions. Issues are welcome.

HotPatcher differs from the Patch mechanism in UnrealFrontEnd; there are some issues with UE’s Patch management for projects: based on the original project version, it is difficult to generate identical patches on different computers, it is not possible to generate a new patch based on the version of a patch, and the content included in a patch cannot be previewed intuitively. Additionally, it is not convenient to package external files into pak (such as lua files, db, and other non-assets, which often reside outside the Content directory), nor to manage project and patch versions easily.

This plugin is designed to solve such issues by using the project’s original resources as the version basis, only needing to manage the project itself without paying attention to other files generated by UE. It allows easy operations such as cooking, generating pak, extracting resource information from basic packages, diff between versions, and patch splitting. It has very rich configuration options and Commandlet support, making it convenient to achieve an automated hot update packaging process.

The currently supported engine versions are UE4.21-UE5, and support for the IoStore mechanism is provided! Many friends have contacted me privately to inquire about plugin-related issues, so I created a group to discuss UE hot updates and the HotPatcher plugin (QQ group 958363331). You are welcome to join and exchange technical knowledge related to UE.

To conveniently collect and manage common questions and solutions regarding hot updates and the HotPatcher, I have created a new article to document and organize: UE4 Hot Update: Questions & Answers. If you encounter problems, you can check this FAQ page first. Regarding the issue that many people have reported about the inconsistency between the configuration parameters in the plugin and the previous recorded video, it is because the plugin has undergone many updates. You can check the Change Log for detailed changes for each version.

Showcase

Taras World Dream of Origin QQ Apex Legends

Mobile

Hero Seeking OL Ni no Kuni

Crossed Worlds

Let’s Create!

Our Planet

Carabikyu
God’s Party WitiSports Spirit Realm MOSSAI Beyond City Sipher Odyssey

Coop Roguelite

Nebula Rangers Rush Minutes

Online Shooter

Final Fantasy XIV

Crystal World

The statistics method for the application project list: 1. Analysis of the game’s code, including the code of HotPatcher; 2. Feedback from project personnel. Please contact me for removal if there are false reports.

Resource Management Framework Based on HotPatcher

HotPatcher is not just a tool for hot update packaging, but a comprehensive resource management framework that includes hot updates, build enhancements, package optimization, and resource auditing.

Forward

Note: This plugin can only pack resources containing UE and added external files as hot update content (lua support), modified C++ code cannot be hot updated and needs to be carefully architected. If it is a pure blueprint project, this tool can be entirely used for hot updates.

The HotPatcher plugin supports packaging only specified resources based on selection (filters for inclusion and exclusion can be specified, as well as single resources), supports recursive dependency analysis for resources (e.g., only packing a specific map and all its dependent resources), allows excluding unreferenced resources from the packed path, and will analyze invalid assets in the project while ignoring redirected resources. It achieves version tracking based on project assets without managing additional content (like DDC) and only requires cooking once prior to patching to ensure the cooked content is based on the latest project version (cooking all resources to be included automatically when generating patches is also supported). Furthermore, it supports chunks, bMonolithic mode and uses a configurable approach to allow arbitrary combinations, supports exporting resource dependencies, and supports executing cooking and patching as well as exporting release information via Commandlet, enabling CI/CD implementation of custom packaging workflows.

In addition to UE resource files, additional support includes:

  • Adding platform-specific files for specific platforms (e.g., Wwise bnk files for each platform)
  • Including non-resource files produced by the project’s Cook, such as AssetRegistry.bin/GlobalShaderCache*.bin/ShaderBytecode*.ushaderbytecode;
  • Including ini files for the engine, project, and plugin;
  • Including external folders and files (like lua files, video files, etc.), with customizable mount points for runtime access;
  • Allowing pak to exclude any UE resource files (as long as no resources are added in HotPatcher), convenient for updating only lua code or configuration files like ini;
  • Analyzing differences between basic packages on different platforms to generate a unified basic package description file for subsequent hot update version comparisons.

Other functionalities of the plugin include:

  • Supporting cooking for single resources;
  • Supporting importing basic package information for multiple platforms from PakList*.txt;
  • Supporting generation of a new patch version based on the previous patch version;
  • Supporting detection of uncooked resources;
  • Supporting diff between versions to see additions, modifications, and deletions (however, deleted resources cannot be removed from previous version paks, they are only displayed for diff purposes) of resource information;
  • Supporting detection of duplicated file inclusions;
  • Supporting exporting all intermediate generation information and configurations of this plugin;
  • Supporting custom UnrealPak parameters (can specify encryption parameters to unify with the project);
  • Supporting the generation of patches for multiple platforms simultaneously;
  • Supporting patch chunks, specifying that resources are packed into multiple paks in one patch version;
  • Supporting detection of chunk file inclusions for error handling;
  • Supporting the packaging of each resource in the patch as a pak, supporting any resource (including but not limited to UE assets/external files/various cooked bin data, ini) as long as they can be added in HotPatcher;
  • Supporting multi-threaded packing of pak without launching UrealPak.exe, enhancing execution efficiency;
  • Supporting exporting the dependency relations of the selected resources;
  • Editor support for cooking, adding to patch settings, etc., facilitating operations under the editor;
  • Supporting collecting shader and other metadata information simultaneously during cooking;
  • Supporting IoStore;
  • Supporting incremental updates for shaders and AssetRegistry;
  • Supporting shader patching.

Additionally, I have created a batch cooking tool for one-click cooking of specified multiple platforms (of course, it can also be done using command line), aimed at completing tasks with the fewest steps.

I recorded a video tutorial for using the plugin:

If you cannot access via VPN, you can watch the Bilibili link: UE4 Hot Update: HotPatcher Plugin Tutorial

Plugin Usage Process

To facilitate version management, projects must use some form of version control tool, Git is recommended.

  1. Open HotPatcher, select ByRelease, and export *_Release.json, which documents the information of each specified resource;
  2. Use UE to 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, select the platform you want to patch in the Cook item and execute Cook (check bCookPatcherAssets);
  5. Open HotPatcher, select ByPatch, using the above-generated *_Release.json as the base version, choose the content you want to pack into Pak as needed;
  6. Click GeneratedPatch, which will generate Pak files and various information (including the current version of *_Release.json, allowing the patch for incremental updates);
  7. The generated Pak will contain all the differences from the previously created package.

Cooking Parameter Explanation

Important: HotPatcher implements a separate cooking process, and there is no need to execute the default UE cooking process (the Cooker section in the plugin); just enable bCookPatchAssets in the patch configuration.

The cooking portion in HotPatcher is designed for easily cooking multiple platforms when generating patches, and conveniently specifying maps (the plugin will scan all maps in the project and list them), so you don’t need to use command line every time for cooking.

Cooking can be optionally divided into Platforms/Map(s)/Settings:

  • Platforms: Choose the cooking platform, multiple selection is allowed;
  • Map(s): Select the maps to cook, this option will list all the maps in the current project, multiple selections are allowed (I also provide the option to list maps under engine and plugin directories in code; you can enable it in HotPatcherEditor.build.cs by controlling the values of ENABLE_COOK_ENGINE_MAP and ENABLE_COOK_PLUGIN_MAP);
  • Filter(s): Can choose to cook specific directories, multiple can be added;
  • Settings: Choose the cooking settings, the defaults provided are Iterator/UnVersioned/CookAll/Compressed, and I provide OtherOptions for custom cooking parameters.

Note: At least one of the maps in Map(s) or CookAll in Settings must be selected, or Filters must have specified directories for cooking to execute; if only CookMap is selected, only resources referenced by that map will be cooked, those not referenced will not be cooked, which needs to be noted.

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

ByRelease Parameter Explanation

The ByRelease operation exports a JSON file that documents the HASH values of each asset resource chosen during export. Based on this HASH value, we can determine in subsequent patches whether the resource has been modified.

Release Settings

  • VersionId: Specify the version of the exported resource information.
  • ByPakList: Import from PakList to generate the release configuration.
  • PlatformsPakListFiles: The PakList*.txt files generated for packaging the basic package, can specify multiple platforms simultaneously for analyzing file differences between each platform and documenting these differences to generate the project’s Release.json files for unified description of basic package information across multiple platforms.

If not exporting Release by specifying PakList*.txt, the exported release.json will only include resources that have been referenced in the project; those not referenced will not be included. However, the default engine packaging will often include some unreferenced resources, which can lead to situations where resources do exist in the basic package, but are not documented in the release.json. If those resources are used, it may result in duplicate inclusion (there is no issue during use, but in the pak there will be two copies of these resources). Using PakList*.txt avoids this issue.

  • IncludeFilter: Resources under the specified directories that are scanned in the current release.
  • IgnoreFilter: Resources under the specified directories that are ignored in the current release.
  • bAnalysisFilterDependencies: Perform dependency analysis on the resources of the selected filters.
  • AssetRegistryDependencyTypes: Types of referenced resources to include in the dependency analysis of the resources in 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 which don't need to be loaded for the object to be used (i.e. soft object paths)
Soft = 0x01,

// Dependencies which are 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,

// Reference that says one object directly manages another object, set when Primary Assets manage things explicitly
HardManage = 0x10,

// Note: 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 refers to resource references with FSoftObjectReference, and Hard refers to direct resource references. To include both Soft and Hard references, you can choose Package, this option should be Package by default unless you handle resource reference relationships yourself.

  • IncludeHasRefAssetsOnly: Perform dependency analysis on resources in the selected filter (recursive analysis to maps); if a resource is not referenced, it will not be packaged into the patch.
  • IncludeSpecifyAssets: A structured array that can specify a single resource in the current release; the first parameter should specify the resource, and the second parameter controls whether to analyze and include the dependencies of the currently specified resource into pak.
  • Add Extern Assets to Platform: Used to specify different files to be included in different platforms.
    • Target Platform: The platform where these files will be included (AllPlatform means included in every platform).
    • AddExternFileToPak: Record non-resource files included in the release.
    • AddExternDirectoryToPak: Record non-resource files included in the release.

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

SaveTo

  • SaveAssetDependency: Whether to store the dependencies of the selected resources in the current release version.
  • SaveReleaseConfig: Whether to store all option information for the current release.
  • bBackupMetadatas: Whether to back up the metadata directory for the current version.
  • BackupMetdataPlatforms: Choose the platforms for backing up the metadata, this option depends on bBackupMetadatas=true.
  • SavePath: The storage location for this release information. It will create a folder named VersionId in the current directory, and all files will be in this folder, supporting relative paths like [PROJECTDIR].

Note: When exporting Release, resource inclusion must be consistent with the settings used for UE direct packaging, because the exported Release records the resources included in the package generated directly by UE.

ByPatch Parameter Explanation

ByPatch is the real tool for packaging into Pak, capable of generating based on previously exported versions (JSON files from ByRelease) and can include external files/folders, configuration files (ini), non-resource files output from cooking (like AssetRegistry.bin, etc.), supporting multiple platforms, accepting UnrealPak parameters, and capable of exporting various information about the current patch.

Supports specifying resource filters:

Options for HotPatcher patching are explained as follows:

BaseVersion

  • bByBaseVersion: Is the patch based on a certain base version? If set to false, it will only package the selected filter files (dependency analysis will still be performed) and added external files; if set to true, a base version must be specified, otherwise patch execution is not possible. This attribute will also control whether to generate Diff information; if false, no diff will be generated (no meaningful diff without a base version).
  • BaseVersion: This option selects the version file on which the patch is based, it can be ByRelease or from the last patch generation, and defaults to *_Release.json.

PatchSettings

  • VersionId: The ID of the current patch version.
  • IncludeFilter: Directories where resources will be scanned for changes in the current patch.
  • IgnoreFilter: Directories where resource changes will be ignored in the current patch (before analyzing resource dependencies).
  • bForceSkipContent: Whether to forcefully ignore certain resources (filtering the final result of the patch).
  • Force Skip Content Rules: Forcefully ignore certain resources under specified directories (filtering the final result of the patch); this can be used to ignore Content within the Editor, such as /Engine/Editor and /Engine/VREditor, etc.
  • Force Skip Assets: Ignore specific resources in the final result of the patch.
  • bAnalysisFilterDependencies: Perform dependency analysis on the resources of the selected filters.
  • Recursive Widget Tree: For UserWidget resources that have changed in the current patch, recursively analyze the parent Widget resources containing them and include them in the patch to resolve issues where modifications to child controls do not take effect on parent controls.
  • AssetRegistryDependencyTypes: Same meaning as described in Release.
  • IncludeHasRefAssetsOnly: Perform dependency analysis on resources in the selected filter (recursive analysis to maps); if a resource is not referenced, it will not be packaged into the patch.
  • IncludeSpecifyAssets: A structured array that can specify a single resource to be packed into Pak; the first parameter needs to specify the resource, the second controls whether to analyze and include the dependencies of the currently specified resource into pak, and the third parameter AssetRegistryDependencyTypes is the same as described in Release.
  • IncludeAssetRegistry: Include AssetRegistry.bin file in the Pak generated in the current patch. (deprecated)
  • IncludeGlobalShaderCache: Include GlobalShaderCache-*.bin file in the Pak generated in the current patch. (deprecated)
  • IncludeShaderBytecode: Include PROJECT_NAME\Content\ShaderArchive*.ushaderbytecode file in the Pak generated in the current patch. (deprecated)
  • IncludeEngineIni: Include ini files from the engine directory in the Pak generated in the current patch; platform-specific inis will also be included.
  • IncludePluginIni: Include ini files from all enabled plugins in the Pak generated in the current patch (both engine and project directory plugins will be included).
  • IncludeProjectIni: Include project ini files in the Pak generated in the current patch (will not include DefaultEditor*.ini).
  • bEnableExternFilesDiff: Whether to perform Diff comparison on added external files to only package modified or newly added external files.
  • Add Extern Assets to Platform: Used to specify different files to be included in different platforms.
    • Target Platform: The platform where these files will be included (AllPlatform will be included in every platform).
    • AddExternFileToPak: Add external non-resource files to Pak, such as txt, videos.
    • AddExternDirectoryToPak: Record non-resource files included in the release.

AddExternFileToPak elements require:

  1. FilePath must specify the path of the selected file.
  2. MountPath is the path where the file is packaged in Pak, defaulting to under ../../../PROJECT_NAME/, with all files accessible at this path during game runtime.
    For example, the MountPath of AAAA.json would be ../../../HotPatcherExample/AAAAA.json, and it can be accessed at runtime using:
1
FPaths::Combine(FPaths::ProjectDir(),TEXT("AAAAAA.json"));

All files in the Pak can be accessed via IPlatformFile.

  • AddExternDirectoryToPak: A structured array to add external folders to the Pak; the first parameter (DirectoryPath) specifies the path to the folder on the system, and the second parameter (Mount Point) specifies the path in the Pak; all files in the specified folder will be recursively included, and their mount paths will be relative to the specified MountPoint.

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

  • PakVersionFileMountPoint: Controlled by IncludePakVersionFile, specifies where the *_PakVersion.json file will be mounted in the Pak file; defaults to ../../../PROJECT_NAME/Extention/Versions.

ChunkOptions

I added chunk functionality to HotPatch, supporting the packing of resources in a Patch into different Paks, such as packing all Packages in a Patch into one pak (or packing specified maps from the current Patch into a designated pak) with all lua files packed into another pak.

Chunk-supported parameters 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 the manually specified chunks.
  • ChunkInfos: A list of chunk information to specify which resources should be included in the chunk.

ChunkInfos is a structure array of type FChunkInfo with members including:

  • ChunkName: The name of the current chunk.
  • bStorageUnrealPakList: Whether to store the PakCommand.txt for the current chunk.
  • bStorageIoStorePakList: Whether to store the IoStore paklist file for the current chunk.
  • AssetIncludeFilters: Resource filters specified for the chunk.
  • AssetIgnoreFilters: Ignore filters for the chunk.
  • bAnalysisFilterDependencies: Perform dependency analysis on the selected filters of the resources.
  • AssetRegistryDependencyTypes: Same meaning as described in Release.
  • IncludeSpecifyAssets: Specify which single resources should be included in the chunk, supporting dependency analysis.
  • AddExternFileToPak: Add external files to the chunk.
  • AddExternDirectoryToPak: Add external directories to the chunk with recursive analysis support.
  • InternalFiles: For specifying whether to include AssetRegistry.bin and ini files in the chunk.

The parameters for chunks are generally consistent with those for patches and can be configured based on requirements.

Note: The principle of chunking is that it first selects resources in the patch settings and executes a comprehensive resource analysis for the patch; this analysis result is used for filtering the chunk configuration. This means that resources included in the chunk must be contained within the current patch, and it’s critical to note that AssetIncludeFilters will not perform dependency analysis. If resources referenced in the patch’s filters reference other modules, such as the engine or plugins, similar directories must also be specified in the chunk filters.

Resources specified in each chunk can be duplicated, meaning one resource can be included in both ChunkA and ChunkB.

Moreover, I added error prompts to chunking; if chunk mode is enabled but not all resources in the patch are specified in the chunk, it will inform you in the Information section at the bottom of HotPatcher regarding which resources have not been included, facilitating error handling.

PakOptions

  • bCookPatchAssets: Whether to enable cooking for uasset in the patch. If enabled, it will cook all uasset resources in the current patch at packaging time (increasing the generation time of the patch and requiring waiting for cooking to finish).

  • Io Store Settings

  • bIoStore: Whether to enable Io Store.

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

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

  • IoStoreCommandletOptions: Parameters passed to IoStoreCommandlet.

  • PlatformContainers: Specify the global.utoc and IoStore Patch paths for each platform.

  • bStoragePakList: Store the IoStore paklist file.

  • bStorageBulkDataInfo: Store StorageBulkDataInfo; when cooking patch assets, it stores the cooking information in BulkDataInfo.ubulkmanifest, which can be left off (currently does not support cooking patch assets with IoStore).

  • Unreal Pak Settings

  • UnrealPakListOptions: Parameters passed to the paklist file, e.g., -compress.

  • UnrealCommandletOptions: 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 signing.

  • CryptoKeys: Specify a Crypto.json file, which can be indicated when not using bUseDefaultCrypt.ini.

  • DefaultPakListOptions: This array can specify parameters for each resource in the pak or IoStore such as -compress.

  • DefaultCommandletOptions: This array can specify additional parameters executed for the pak/IoStore commands.

  • ReplacePakCommandTexts: Used to replace texts in the PakCommand.txt file.

  • PakTargetPlatforms: This array specifies the platforms for which the patch will be generated; multiple selections are allowed. It’s crucial to ensure that selected platforms have been cooked.

PakOptions Advanced:

  • bCustomPakNameRegular: Whether to rewrite pak naming rules, controlling whether PakNameRegular can be modified.
  • PakNameRegular: Naming rules for generated paks, which can utilize preset variable values for control. Currently, preset values include: {VERSION}/{BASEVERSION}/{CHUNKNAME}/{PLATFORM}; during generation, these will be replaced with the actual values based on the current configuration. The default naming rule is {VERSION}_{CHUNKNAME}_{PLATFORM}_001_P; if Chunk is not enabled, the {CHUNKNAME} value will be blank, and any adjacent __ will be processed.

SaveTo

  • bIgnoreDelatedAssetsInfo: Clean up deleted asset/file information in patch data; enabling this means deleted files will not be logged.
  • bStorageDeletedAssetsToNewReleaseJson: Controls whether resources deleted in the ContentBrowser are stored in the new ReleaseJson; for details, see 2020.11.07 Update.
  • bStoragePakList: Whether to store UnrealPak.exe‘s -Create parameter file.
  • bStorageDiffAnalysisResults: Whether to store difference information between the current patch version and the base version.
  • bStorageAssetDependencies: Whether to store the dependency relationships of the selected resources in the current patch version.
  • bStoragePatchConfig: Whether to store all option information for the current patch.
  • bBackupMetadatas: Whether to back up the metadata directory for the current version.
  • SavePath: The storage location of the patch information. It will create a folder named VersionId in the current directory, where all files will be kept.

Advanced

  • bStandaloneMode: Whether to run in standalone mode, which will trigger a separate UE process for executing patch tasks and will not block the current editor. This is recommended if dealing with large resource scales.
  • bScanCacheOptimize: Enable scanning cache optimization to speed up dependency analysis.

ByShaderPatch Parameter Explanation

ShaderPatch compares and patches by specifying new/old versions of the metadata directory, reading the .ushaderbytecode files from the ShaderLibrarySource directory therein.

Version

  • VersionID: The version number of the current ShaderPatch.

    Config

  • ShaderPatchConfigs: ShaderPatch configuration, which is a structure

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
32
33
34
35
36
37
38
39
40
41
42
43
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 (Below 4.26 this parameter has no effect)
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bDeterministicShaderCodeOrder = true;
};
```#### Save

- **bStorageConfig**: Whether to store the current configuration file
- **SavePath**: The path for generating the patch and configuration files

#### Advanced
- **bStandaloneMode**: Launch a separate process to execute tasks without blocking the editor.

### Commandlet

I provided four Commandlets for the plugin, namely `HotCooker`, `HotPatcher`, `HotRelease`, and `HotShaderPatch`, used for cooking, patch generation, exporting release information, and ShaderPatch.

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

The properties specified in the Commandlet’s `-config` file can be replaced using `-PropertyName=` (currently, array specification is not supported). For nested properties in structures, such as member properties like `SavePath.Path`, you can specify them through `.`: `-savepath.path=`.

The enhanced support for HotPatcher’s Commandlet can be found in the update log: [2021.01.14 Update](#2021.01.14-Update)

#### ~~HotCooker~~

>**Important**: This feature is deprecated; just check `bCookPatchAssets`.

How to use Cooker:

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

If all maps are selected when exporting cook configuration in the editor, the exported configuration file will set bCookAllMap to true. When executing in the Cook Commandlet, all maps will be cooked. As long as bCookAllMap is true, all maps will be cooked regardless of the number of maps in CookMaps.

HotPatcher

How to use Patcher:

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

HotRelease

How to use Release:

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

HotShaderPatch

How to use ShaderPatch:

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

The -config parameter files they receive can be exported from the editor via the plugin.

Editor Support (UE4.23+)

HotPatcher adds an extension to the right-click menu for selected resources in the Content Browser, enabling one-click cooking and adding selected resources to the Patch Settings.

Cook

AddToPatchSettings

Project Settings

The plugin supports right-click cooking and packaging resources in the editor. For convenience in configuration, a configuration option for HotPatcher is created in Project Settings:

This can be used to specify parameters for UnrealPak, encryption configurations, storage directories for packaging, etc.

Update Log

2024.04.07 Update v82.0

Update address: v82.0. Compared to the previous version, it has undergone extensive optimization and bug fixes.

It is strongly recommended to update to the latest version when using HotPatcher in any engine version, as it facilitates troubleshooting in case of issues.

The update contents are as follows:

  1. Fixed a bug where ‘*.m.ubulk’ files were not packaged in certain cases.
  2. Optimized the packing time of PAK, caching and multithreading optimizations for scanning a large number of files, significantly speeding up the packaging process.
  3. Supported Accompany’s COOK mode.
  4. Added more performance markers.
  5. Optimized log level.
  6. Supported cache-ddc-only cook mode.
  7. Automatically load all ShaderLibrary from the ../../../PROJECT_NAME/ShaderLibs directory at module startup.
  8. Supported Nanite and WP cooking.
  9. Supported differential updates for WP (Due to WP’s One File Per Actor mechanism, modifying the WP scene will not cause changes to the level resource itself. I have expanded a detection mechanism to achieve differential detection for WP).
  10. Optimized access to FExternFiles.
  11. Optimized the external files recorded in Release from absolute paths to tagged paths.
  12. Fixed the issue of creating fake files during cooking in UE5.
  13. Fixed the problem of paths containing // during release export.
  14. Fixed the inaccuracy problem of getting PackageTracker through PatcherProxy.
  15. Optimized the implementation of PackageTracker, excluding resources that have already been tracked.
  16. Optimized PackageTracker, enabling recursive tracking analysis.
  17. Unified the lock of ParallelFor in CollectPakCommand, avoiding competition issues.
  18. Supported passing a list of LongPackageName for packing using the -AddAssetsByFile= parameter.
  19. Fixed the issue of ShaderLib not being packaged into pak.
  20. Allowed adding Pre and Post tasks in the Cook Commandlet.
  21. Optimized the plugin’s Slate implementation, supporting secondary menus in the Toolbar to directly open the corresponding page.
  22. Supported listening for crashes of processes and saving crash files to Saved/HotPatcher/Crashs.
  23. Compatible with GameFeaturePacker and ShaderPatcher mods (both need to be updated to the latest).

The current v82.0 is officially released and can be pulled and updated from hxhb/HotPatcher. The old version of the plugin will also have update prompts for the new version when opening the Patch page.

2023.06.05 Update v81.0

Update address: Release v81.0

  1. Fixed the log output issue of CmdlHandler, DDC Backend configuration not being cleaned.
  2. Cmdlet supports TargetPlatformsOverride to replace TargetPlatform in the configuration file.
  3. When executing Patch, resources scanning can be prohibited by NoSearchAllAssets.
  4. Optimized the timing of GC.
  5. Fixed the tracking of resources included in the base version by PackageTracker.
  6. Optimized the output format of Notification.
  7. Unified the saving path rules for config/release/diff during patch.
  8. Supported only cooking Shader type resources.
  9. Supported CookAdvancedOptions options.
  10. Supported outputting PakResults.json to record all packaged resources and acquire interfaces.
  11. Optimized log output, avoiding unnecessary error-level logs.
  12. Prevented checks for cooked files from loading resources.
  13. Supported ChunkAliasName as an alias for Chunk, supporting Chinese.
  14. Optimized LoadShaderbytecode related code.
  15. Fixed the issue of invalid AESKey when importing from encrypted pak.
  16. Fixed the ambiguity of logical operators during resource analysis on Linux platform.
  17. Added more profiling tags.
  18. Updated the MOD version.
  19. Fixed compilation errors on UE5.1 Linux.
  20. Fixed the issue that every Chunk contained all changes.
  21. Fixed the extra %s in GetProjectNotAssetDirConfig.
  22. Fixed the problem of delayed registration timing of TargetPlatform.

Note: This version does not currently support UE5.2, and this should also be the last version supporting UE5.1. Since there are implementation changes in 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 of Metadata.
  • Supported acquiring the list of resources involved in packaging.
  • Optimized the tracking implementation of PackageTracker.
  • Fixed the bug in ForceSkip’s Directory/Asset filtering.
  • Fixed competition when handling PakCommand in multithreading.
  • Fixed the problem of delayed registration timing of TargetPlatform.
  • Fixed the issue where resources tracked by PackageTracker were not included in the package (PackageTracker resources undergo ForceSkip detection).
  • Set bSupportWorldComposition to false by default.

2023.01.08 Update v80.0 HotPatcher Modular

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

  1. Fixed not displaying issue related to Regular categories.
  2. Optimized CmdHandler implementation, supporting Editor and Runtime Config Override.
  3. Modular transformation of HotPatcher, see HotPatcher modular transformation and development plan.
  4. Created ByShaderPatch and ByGameFeature as separate independent mods.
  5. Optimized the startup process and priority of the plugin, 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 the basic implementation, turned off unnecessary log output.
  2. Optimized the additional shader compilation for loading materials with dependencies, supporting the NoPostLoadCacheDDC parameter control (In UE4, engine modifications are needed to use this optimization).
  3. Optimized the allocation strategy of CookCluster.
  4. Optimized the collection of Pak file lists.
  5. Optimized resource analysis performance.
  6. Improved extensibility of modules.
  7. Fixed compatibility issues across engine versions.
  8. Fixed Shipping C4172 ERROR.
  9. Fixed basic package packaging error caused by unsupported WP (Found more than one registered Cook Package Splitter).
  10. Supported PakSaveDirRegular, customizable output path for Pak.
  11. Supported unified execution of PakPreset/CookAndPak.
  12. Supported global AllowCookPlatforms.

To support the NoPostLoadCacheDDC parameter in the source version of the engine, you need to modify the engine and add the following code wrapped in [lipengzha]:

The Launcher engine does not support this optimization by default, and cooking time will be slower, but it does not affect functionality.

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: Because UE5 is still in the early stages, Epic’s updates each time greatly change the engine. Therefore, HotPatcher’s support for UE5 is only compatible with the latest engine version and does not consider compatibility with other versions of UE5 (such as UE5 EA/EA2/5.0.3, etc.). 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 it for packaging this type of map.

  • Supported UE5.1.0 (previous versions of UE5 are no longer supported).
  • Fixed the issue of PreCachePlatformData when the Patch is enabled.
  • Fixed the crash caused by GC during cooking in the Editor.
  • Fixed issues where the Commandlet process gets stuck.
  • Optimized cross-version compatibility.
  • LICENSE updated, see README.

2022.10.26 Update v77.0

Update address: Release v77.0

  • Refactored the cooking mechanism in UE5.
  • Fixed cases where ForceSkip was ineffective while enabling PackageTracker.
  • Fixed issues regarding directory scanning in UE5 (/All/Game).
  • Fixed the analysis issues for resource dependencies in the directory.
  • Optimized resource scanning, supporting forced ignoring of certain resources.
  • Supported custom saving paths for cooked directories.
  • Counted Cook Clusters.
  • Optimized log output.
  • Fixed cross-engine version compatibility issues.
  • Changed the error from Chunk not containing files to Warning.
  • Fixed some issues with HashCaculator not being passed.
  • Minor detail fixes and enhanced extensibility.

2022.09.19 Update v76.3

Update address: Release v76.2

  • Supported UE5.0.3 engine.
  • Optimized analysis of changed materials’ MaterialInstance packaging (bAnalysisMaterialInstance).
  • Fixed the persistent enabling of 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 HASH calculation issue for Not-uasset files during diff.
  • Fixed the issue of not calculating the HASH for not-uasset files during release export.
  • Fixed the issue of not calculating the file HASH in FReleasePakParser.
  • Fixed the CryptoKeys file’s ReplaceMark execution.
  • Supported adding wildcards to not-uasset directories, only adding matching files.

  • Fixed the issue where bAnalysisFilterDependencies was ineffective.
  • When bImprtProjectSettings is enabled, if there is only one platform, all files are added to that platform. If there are multiple platforms, they are added to AllPlatforms.
  • Optimized scanning for PaperSprite; ignore SourceTexture when configuring AtlasGroups.


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

2022.07.28 Update v76.1

Update address: Release v76.1

  1. Supported Class filtering for UMultiCookScheduler_MatCluster.
  2. Avoided reflection to obtain enum values in CookPackage (ParallelFor Crash).
  3. Fixed the IsActiveAction issue in FHotPatcherActionManager.
  4. Optimized GetAssetPackageGUID.
  5. Supported ImportProjectSettings/HotPatcherAssetManager.
  6. Supported ForceSkip in chunks.
  7. Disabled RTTI implementation in 4.21.
  8. Added CmdHandler module.
  9. Fixed cross-version engine compatibility issues.
  10. Fixed some crash issues.
  11. Stopped support for the ByOriginal cook mode (just check bCookPatchAssets).
  12. New Mod support.
  13. Supported third-party Mod development.
  14. Optimized the organization of code.

2022.03.31 Update v76.0

  • Supported World Composition.
  • Fixed cross-engine version compatibility issues.
  • Default to enable bCookPatcherAssets.
  • Optimized the code, fixed compilation issues in 4.27.
  • Supported non-intrusive HotPatcher development modules.

In HotPatcher/Mods, new packaging and resource management modes can be developed based on HotPatcher, fully leveraging the framework functions of HotPatcher for more feature expansion:

  • Resource analysis.
  • Packaging.
  • Resource scanning, management, auditing.
  • Multi-process cooking.
  • Various forms of hot updates.

And so on, achieving true customization based on actual business needs.

Module Expansion Example

Add HotPatcher’s plugin dependency in the 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"
});

Register 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 the core functionality of HotPatcher, the interface can be customized and new features expanded as needed.

2022.02.15 Update v75.2

Release HotPatcher v75.2

  1. Fixed GIsRequestingExit warning.
  2. Commandlet supports engine Tick.
  3. Supported cooking/ignoring specific resource types.
  4. Supported GCookLog controlling more cook logs.
  5. Supported exporting all resources loaded during the cooking process.
  6. Fixed compilation errors when enabling CUSTOM_ASSET_GUID.
  7. Fixed derived class list issue.
  8. Supported CookClassesMode.
  9. Fixed Filter’s path matching issue causing resources to enter different Pak.
  10. Fixed Trace file path issue.
  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 restructuring some functionalities to enhance compatibility across engine versions.

  • Refactored the cooking process, supporting several different cooking modes, speeding up the cooking process.
  • Unified the cooking process used in editor cooking, patching, and MultiCooker.
  • Removed support for CookManager.
  • Supported shader packaging for resources compiled within a chunk, previously packaged single ShaderLib for the whole patch, and supported customizing ShaderLib paths and naming for each chunk.
  • Supported excluding resource types.
  • Fixed IsSkipAsset crashing during ParallelFor cooking.
  • Clean up old cooked files before cooking.
  • Added numerous profiling tags for performance analysis.
  • Under engine modification mode, controlled the number of ShaderCompileWorkers launched for each cooker process to avoid frequent process switching overhead by the operating system.
  • Supported patch versioning.
  • Created the HotPatcherCore module, separating it from the HotPatcherEditor module; Editor only includes editor-related logic.
  • Fixed crash issues when serializing AssetRegistry.
  • Fixed Sandbox path conversion issues.
  • Fixed issues with UE4Editor-cmd in non-Development and 32-bit modes.
  • Cleaned up redundant code, interfaces, and optimized processes.
  • Enhanced engine compatibility, with minimum compatibility down to 4.22 (no ContentBrowser menu-related functionality).

2022.01.03 Update v74

  • Refactored the dependency analysis module, improving performance significantly (testing shows a 70-fold increase for 20,000 resource amounts).
  • Refactored the module for importing Release information from Paklist/Pak files.
  • Optimized implementation, cleaned up redundant interfaces, and organized the code structure.
  • Removed the AssetManagerEx module and moved the UFLibAssetManagerHelper library into HotPatcherRuntime.
  • Fixed issues due to changes in engine interfaces that caused RecursiveWidgetTree to be ineffective since UE4.25 and later.
  • Fixed the scenario where not all parent UMG controls could be analyzed when enabling base version comparison.
  • Patch supports PackageTracker to track resources that are not in the dependency but are in the ImportTable, such as animation sequence’s BoneCompressionSettings, see Dependency Loading During Cooking (Note: In the editor, only the first load of resources or executed in standalone mode will be effective).

The rules for bRecursiveWidgetTree are as follows:

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

The optimization data for resource dependency analysis:

There has also been a huge improvement in the export of Release, 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 are about to be deprecated in UE4.27/UE5.
  • Added bBackupProjectConfig to Release to support backing up the config directory of the base package.
  • Supported NoCompileShader during Release export to avoid shader compilation due to resource loading, speeding up the export.
  • Optimized code, replaced some FString with FName, optimized resource dependency scanning.
  • Fixed potential crash issues in PackageTracker.
  • Right-click CookAndPakAction supports choosing whether to analyze resource dependencies.

Note: In the current version, acquiring the HASH value of a uasset is done by obtaining PackageGUID in the engine, but this property is about to be deprecated in UE4.27 and UE5. Therefore, I have added support for custom resource HASH calculation, which calculates the MD5 of original uasset files to replace the soon-to-be-deprecated PackageGUID (currently, it is not enabled in the plugin; it will be replaced when the UE officially deprecates it). This will not affect the functionality of the plugin, but using PackageGUID and MD5 calculated Release*.json cannot be interchanged; otherwise, all resources will show differences.

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

2021.12.14 Update v72

Github release log: v72

  • Fixed crash issues in Mac’s SVersionUpdater.
  • Fixed abnormal behavior when sharing shader code during cooking on Mac.
  • Fixed compilation errors on Mac.
  • Optimized shader collection process, ensuring that shader collection is closed only after cooking is completed.
  • Deprecated options bIncludeAssetRegistry/bIncludeGlobalShaderCache/bIncludeShaderBytecode, which have better alternative implementations. For more details, refer to UE Hot Update: Shader Update Strategy

Recently, I am making a significant update, and later you can use HotPatcher to replace UE’s cooking and sub-packaging mechanisms, achieving multi-process and even multi-machine distribution of cooking tasks. Management of base package processes can be handled through HotPatcher to speed up UE’s packaging process.

When cooking iOS on Mac, the left side is UE’s default CookCommandlet, while the right side is HotPatcher’s Cook, both enabling ShareShaderCode:

2021.11.21 Update v71

  • Supported the ZenLoader serialization mechanism in the ue5-main branch.
  • Starting from 4.24, WITH_PACKAGE_CONTEXT is now enabled by default when cooking.
  • Code related to PackageContexts has been moved to the HotPatcherEditor module.
  • The Cook and Pak Action in the right-click menu now supports PackageContext.
  • Fixed the issue of executing the right-click menu in UE5 failing.
  • Plugin configurations provide a complete PatchSettings template.
  • Supported unpacking binaries Patch using keys from project settings.
  • Optimized code.

Currently, ue5-main and the UE5 EA version have significant differences, especially many changes in the engine’s internal implementation details, particularly concerning serialization. Currently, some tricks have been used to achieve cross-compatibility for 4/5; once the official version of UE5 becomes available, we will consider launching a separate development branch for UE5 if there are significant discrepancies.

2021.11.19 Update v70

  • Supported packaging GameFeature/plugins, enabled by default in UE4.27/UE5. For details, see the article: UE5: Game Feature Research.
  • Refactored the Pak encryption module, supporting importing encryption configurations from project settings, aligning with the encryption method of the base package.
  • Supported generating Crypto.json from the configuration in Project Settings-Crypto.
  • Fixed uninitialized warning for value types.
  • Optimized code.

Note: UnrealPak’s usage of -encryptionini to specify project Ini configurations has a bug that can lead to crashes. My implementation completely discards Ini and uses Crypto.json uniformly.

The packaged files for GameFeature include:

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

It also packages the runtime libraries:

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 configurations from project settings: Control the Serialization of AssetRegistry).
  • Fixed compilation errors in UE5.
  • Fixed warnings for Slate and un-initialization vars.
  • Changed cooking resources from Patch All to Cook Chunk.
  • Fixed the error caused by default enabled shader deterministic in UE4.26+ without specifying GameOpenOrder.
  • Supported version detection for update prompts.

AssetRegistry in the Patch supports two modes: PATCH/PER_CHUNK, with the difference 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 has split chunks, you can create CHUNK_NAME_AssetRegistry.bin based on the resources in each chunk and package it only into that chunk’s Pak;

You can customize the mount point of AssetRegistry.bin, and you can also customize the naming rules for AssetRegistry, which defaults to [CHUNK_NAME]_AssetRegistry.bin:

Plugin version number detection:

2021.10.29 Update

  • Supported shared Shader bytecode in the Patch.

During cooking, collect all shaders in the Patch and generate ShaderBytecode separately to enable incremental updates for shaders. For more 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 size, suffix.
  • Fixed issues with decompressing files from Pak.
  • Optimized code.

2021.08.05 Update

  • Automatically adds -AlignForMemoryMapping parameter for each platform during packaging, resolving crash issues on iOS.

2021.07.30 Update

  • Supported importing the file list from the base package from the Pak file, which can be used interchangeably with the response file used for packing Pak.

2021.07.21 Update

  • Preliminary implementation of the first version of binary patching.
  • Reserved the implementation interface for BinariesPatch in HotPatcher (the diff/patch implementation is another plugin that requires engine modifications and will not be open-sourced for now. Those interested can update the dev branch code - which has been merged into the trunk; simply inherit the IBinariesPatchFeature interface to implement a binary Diff/Patch Feature for resource binary patching).

2021.07.16 Update

  • Supported cooking and packaging resources managed by PrimaryAssetLabel.

2021.07.14 Update

  • Supported importing the configuration of patch or chunk 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 EditorOnly.

2021.06.28 Update

Project Settings-Plugins-HotPatcher can view the configuration parameters of the plugin in the editor.

  • Unified the process of CookAndPak with that of the configuration page packaging.
  • CookAndPak now supports selecting both directories and single resources simultaneously.
  • CookAndPak supports running in StandaloneMode.
  • Optional saving of the CookAndPak PatchConfig configuration.
  • Optimized the patch process, ensuring that all resources are cooked before packaging.
  • Optimized plugin configuration options.
  • Added protection against detection of invalid resources, preventing crashes.
  • Added Preset functionality, allowing parameters configured in HotPatcher to be added to a preset configuration (AddToPreset).
  • The right-click menu in ContentBrowser supports executing Preset tasks.

AddToPreset
Configuration Preset
CookAndPak

2021.06.24 Update

  • Fixed errors in CookAndPak, ensuring everything is cooked before packaging.
  • Supported the PakExternalAction option.

Allowed packaging external files through the right-click menu in the editor,

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

2021.06.15 Update

  • Optimized code, removing unnecessary processes.
  • Supported enabling encryption through the right-click menu’s CookAndPak.

This can be set in Project Settings-Plugins-Hot Patcher:

Note: As of now (2021.06.15), there is a bug in the UE5 EA engine that prevents this feature from being enabled; doing so will cause crashes.

2021.06.09 Update

  • Supported UE4.27.

2021.06.06 Update

  • Fixed the issue of release.josn during Patch export not containing information on Add/Modify files.

2021.06.04 Update

  • Supported bCreateDefaultChunk; when splitting chunks, if some files do not exist in manually configured chunks, a default chunk will be created to store them.

2021.06.03 Update

  • Supported Io Store’s Patch generation from UE4.26 to UE5.
  • Fixed bugs in the Paklist analyzer.
  • Optimized some code.

Note: Support for generating patches via Io Store only applies to UE4.26-UE5. Currently, UE has bugs in its support for Io Store, and several important points must be noted when generating patches:

  • Only the integrated HotCooker can be used for cooking; bCookPatchAssets within the Patch must not be enabled.
  • The base package’s global.utoc must be specified.
  • UE5 has bAsyncLoadingThreadEnabled enabled by default; when loading shaders, issues may arise that lead to material loss; turning it off will restore normalcy (this appears to be a bug in early versions of Io Store).
  • Other utoc within the base package (like GenerateDiffPatch/PatchSource) can be specified (optional).
  • When a patch contains multiple chunks, multiple processes must be enabled to execute the Io Store generation, as generating multiple chunks in a single process will lead to crashes (a bug in UE).

If bCookPatchAssets is enabled, loading a Patch will result in the following error:

After enabling IoStore, differences may appear in the cooking mechanisms between the engine internal approach and the one offered by the plugin. I will analyze this in detail when I have time, looking for potential support for bCookPatchAssets.

2021.05.27 Update

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

Note that UE5 has enabled IO Store by default at the moment, but the plugin does not support packaging with IO Store yet. It can temporarily disable UE5’s IO Store; otherwise, pak cannot be mounted, and we are preparing to add support for it when we find time. It seems that the resource IO pressure in UE5 is indeed significant, with the introduction of Oodle and IO Store being preparations for accommodating the surge of resources in UE5.

2021.05.20 Update

  • Supported directly cooking and packaging resources created in the current editor; no need to restart the editor for packaging new resources.

  • Tidied up Patch/Release and split process steps; the next step is to implement a multithreaded version.

    2021.05.18 Update

  • Organize general code for Release/Patch/ShaderPatch

  • Optimize configuration logic, ensuring that markers like [PROJECTDIR] in configurations do not change during generation but are replaced during task execution

  • Unify common options across modes

  • In Advanced, add bScanCacheOptimize, which can enable resource dependency scanning cache optimization

  • Add summary output for Release/Patch tasks

Release Summary:

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 : ==========================================

Patch Summary:

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 update, specifically SavePath and bStorageConfig. If you have already exported configurations, you will need to modify these two configuration names.#### 2021.05.17 Update

  • Fixed warnings in 4.26 / compilation errors in 4.22
  • Added option for GScanCacheOptimize (enabled by default)
  • Added ToolTips for Patch/Release/ShaderPatch buttons, displaying which necessary options have not been configured.

Patch

Release

Shader Patch

2021.05.13 Update

  • Fixed crash issues
  • Support for markers in paths like SavePath/BaseVersion

Optional markers 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 relative paths to be specified in all configurations, enabling the export of fully generic configuration files.

  • Optimized dependency scanning efficiency

For the same patch configuration in the same project:

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

There are still several places in the plugin that can be optimized for execution efficiency; we will address them when time permits.

2021.04.28 Update

Ignore the -compress parameter for types specified under [Pak] in 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 with automatic mounting, the corresponding compression algorithm modules may not have been enabled yet, leading to loading failures. UE performs this check when creating the base package, and the plugin has corresponding support.

2021.04.18 Update

  • Support editor right-click Cook platform whitelist configuration
  • Support directly selecting resources in the editor to right-click and package Pak

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

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

The right-click menu has added a Cook And Pak Actions option, allowing multiple selected resources to be cooked and directly packaged into Pak. The default storage directory is Saved/HotPatcher/Paks and can be modified through configuration.

2021.03.25 Update

  • Add bDeterministicShaderCodeOrder for 4.26+

bDeterministicShaderCodeOrder is declared in UProjectPackagingSettings, 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 in 4.22
  • Added HotRelease to automatically back up Metadata files based on the configured paklist information

2021.03.15 Update

  • Added an option to back up the Metadata directory for Release/Patch

Release Settings

Patch Settings

The current version of the project’s Metadata directory will be copied to the Release/Patch directory (BackupMetadatas), making it easier to manage DevelopmentAssetRegistry.bin and Shaderbytecode, which can be used for asset auditing across versions as well as in the Shader Patch.

2021.02.23 Update

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

Solutions to crashes when generating ShaderPatch in 4.25+: ShaderPatch Issues in UE4.25

2021.02.01 Update

2021.01.28 Update

  • Fixed issue with DebugGame Editor not being able to spawn a new process during runtime
  • Added bStandaloneMode option to control whether to spawn a new process to execute tasks (true will spawn a new process)

2021.01.22 Update

  • The HotPatcher Patch Commandlet can specify platforms

Added by using -AddPatchPlatforms=WindowsNoEditor,Android_ASTC,IOS syntax, separate multiple platforms with a ,.

2021.01.20 Update

  • In the case of basic packages being divided into Chunks, support for adding multiple paklist files for a specific platform in Release

2021.01.19 Update

  • Support a general external file specification mode to solve the use of common configurations across different project paths

When specifying external files/folders, 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 the production process, the real paths will be replaced in the current configuration (the Patch and Release configurations generated automatically for export are absolute paths, but you can manually export relative-path-based configuration files within the editor).

2021.01.18 Update

  • Release/Patch generation does not block the Editor
  • Logs can be viewed directly in the Editor
  • Unified UE notification creation method

This update changes the previous blocking editor method to executing a Commandlet process task, which does not affect the current editor process, similar to the packaging process in UE, alleviating the anxiety of blocking the Editor.

2021.01.14 Update

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

Usage adds with -AddPlatformPakList=, followed by platform name + PakList file (supports multiple files, separated by +), multiple platforms can be 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 the Config

  • The HotRelease Commandlet can specify values directly without specifying a config file (import paklist file needs to be specified)

2021.01.13 Update

  • Fixed Cook failure when including plugin resources in Patch
  • Fixed Patch generation failure to load resources in Commandlet
  • Various other optimizations

2021.01.11 Update

  • Support importing configurations 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 AddExternAssetsToPlatfotm (AllPlatform).

The AlwaysCookMaps and all maps configured under the AllMaps section in Config/DefaultEditor.ini will be added to IncludeSpecifyAssets and checked for bAnalysisAssetDependencies.

2021.01.08 Update

  • Support adding directories to PatchSettings in ContentBrowser
  • Fixed StaticFindObject crash when generating Patch through Commandlet with CookAsset checked
1
LogWindows:Error: Illegal call to StaticFindObject() while serializing object data!

2020.12.14 Update

  • Added UFlibPakReader function library to enable reading files in Pak without mounting

2020.12.11 Update

  • Support Shaderbytecode Patch, configured through the byShaderPatch page;

Shaderbytecode Patch requirements:

  • Back up the Metadata directory of each packing for Cooked/PLATFORM/PROJECT_NAME/Metadata;
  • Compare the latest version of the Cooked/PLATFORM/PROJECT_NAME/Metadata with the old version;
  • The generated ushaderbytecode file can be packaged using HotPatcher as an external file and loaded at runtime;

Note: Currently, this feature works correctly in engine versions 4.24 and earlier, but will trigger exceptions in 4.25+. Specific reasons are analyzed here: ShaderPatch Issues in UE4.25. Solving this issue requires modifying engine code; changes can be made based on the analysis in the notes above.

2020.12.10 Update

  • Fixed export failure issues for HotRelease Commandlet

2020.12.04 Update

  • HotPatcher supports UE4.26!
  • Fixed issues where modifying saved assets after cooking in the editor would lead to loading failures the next time

2020.11.26 Update

  • Fixed path errors when cooking resources in the Content Browser
  • Fixed issues where previews are not displayed in the new version of the code

2020.11.08 Update

  • Support detection when cooking individual resources (for newly created resources, the obtained UPackage is incomplete, so using it to cook will crash)
  • ContentBrowser right-click cooking resources supports cooking failure prompts.

Note: If you create resources in the project, directly cooking these resources is problematic because the new resources obtained through the engine will contain incomplete data, which will cause a crash during cooking. Currently, the plugin strategy is to verify whether the UPackage data intended for cooking is correct; if not, the resource will be ignored.

A temporary workaround is to restart the editor after creating resources, then perform cooking or patching operations on them, or use the plugin’s provided cooking directory and specified map functionality, which does not have this issue, as it launches a new UE process to execute the cooking task, allowing local resource information to reload).

2020.11.07 Update

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

This represents two version management modes:

  1. ReleaseJson keeps track of all resources in the current game version (deleted resources still exist in UFS since files in old Pak will not be deleted)
  2. ReleaseJson records all resources that players should experience in the game (not including moved or deleted resources)

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

2020.11.01 Update

  • (UE4.23+) Support directly adding selected resources to Patch Settings from ContentBrowser;
  • Support cooking resources directly during Patch generation (bCookPatchAssets). Note that when there are many resources in the patch, cooking is time-consuming and requires shader compilation, which greatly increases Patch generation time; thus, enabling cooking during Patch generation should be reserved for testing purposes or when executing in CI. In the editor, the SlowTask progress may block the editor;

2020.10.31 Update

  • Support cooking individual resources (shader code included in the resource);
  • (UE4.23+) Support right-click selected assets in Content Browser to cook (supports multiple selection);

2020.10.30 Update

  • PatchSetting supports bForceSkipContent for forcibly ignoring resources in certain directories
  • ForceSkipContentRules specifies resource directories to ignore in the patch; default values are /Engine/Editor and /Engine/VREditor. When you choose Exclude editor content when cooking in project settings, resources in these two directories will not be cooked and thus cannot be packaged.
  • ForceSkipAssets ignores specified resources in the Patch version.
  • Renamed functions like DiffPatchVersion to DiffPatchVersionWithPatchSetting and passed PatchSetting for easier options control during the diff process.

These two new options are added to match Unreal’s default packaging directories that are not cooked and allow users to control which resources should not be packaged.
Note: The difference between ForceSkipContentRules and AssetIgnoreFilters is that AssetIgnoreFilters are used for filtering steps before resource dependency analysis, and can be set as subdirectories in AssetIncludeFilters; while ForceSkipContentRules provides a filtering operation for results after diffing, excluding resources with these prefixes.

2020.10.27 Update

  • Support extracting Release from generated PakList files
  • Support importing multiple platform PakLists and analyzing file differences per platform
  • Change ReleaseSetting and PatchSetting class from UObject to USTRUCT
  • Unified serialization of USTRUCT for Import/Export configuration
  • Support adding special files in Patch for specific platforms (only included for specified platforms)
  • Use CustomDetailView to add an import PakList button to the Detail panel
  • Refactor portions of the code to adapt for adding special files for different platforms.
  • Removed extra configuration data from Release.json
  • Fixed MountListener errors in 4.24

This update involved significant code changes, making previously exported configuration files incompatible with the current version, so it is temporarily published to the Dev branch. After stability testing, it will merge into the master branch. After testing the Release/Patch/Chunk processes, everything works fine.

2020.10.17 Update

  • Support analyzing WidgetTree for Widgets, solving the issue where modifications to sub-controls do not affect the parent control

If a Widget is modified, you can control whether to recursively add all containing Widget resources based on this option, solving the problem where modifications to child controls do not affect patching of parent controls.

2020.08.31 Update

  • Add support for exporting Release with Commandlet
  • Clean up duplicate code and reorganize structure
  • Add options for controlling the naming convention of generated Paks
  • Fix the issue where empty packages would be produced even if Chunks contained no files
  • Fix crashes of UFlibPakHelper::GetMountedPaks in 4.25

2020.06.04 Update

  • Add bCookAllMap attribute for cooking exported configurations. When true, it will cook all maps in the project directory in Commandlet mode.
  • Add ByRelease support to generate configurations using PakList*.txt, allowing for complete matching of all resources in the base package.

2020.06.03 Update

  • Add plugin Cook Commandlet
  • Add plugin Patch Commandlet

2020.04.27 Update

  • Add MonolithicPathMode under Chunk’s bMonolithic mode to specify the storage path rules for pak in monolithic mode.

2020.04.24 Update

  • Add option to analyze dependencies of resources in the filter

2020.04.23 Update

  • Add optional types of referenced resources

2020.04.18 Update

  • By default, add -compressionformats parameter to UnrealOptions.
  • Add options for PreviewChunk, making it easier to see which resources are in which chunk when chunking is enabled.

2020.04.10 Update

  • Add ReplacePakCommandTexts option to customize the text in PakCommand.txt, such as replacing the MountPath of resources packaged into pak

2020.04.09 Update

  • Fix issues with generating Chunk from PatchSetting when filters were not selected / tracking redirection of resources
  • Fix problems when converting Cooked paths
  • Support exporting all pak information, removing pakversion options
  • Support releasing and patching resource dependency relationships
  • Add progress display for ExportRelease with FScopeSlowTask
  • Add options to specify PakCommand parameters

2020.04.08 Update

  • Support multi-threaded packaging of Pak, directly calling ExecuteUnrealPak instead of launching UnrealPak.exe, greatly enhancing efficiency.
  • Fix preview patch discrepancies when selected BaseVersion and Diff information do not match

2020.04.07 Update

  • Support bMonolithic mode, allowing every referenced resource to be individually cooked into a pak.
  • Unified the packaging methods for assets, cooked binaries, external files, ini files, etc.

2020.04.03 Update

  • Complete the Chunk functionality for Patching, unifying the packaging processes for Patch and Chunk
  • Optimize code and streamline processes
  • Remove IncludePakVersionFile and PakVersionFileMountPoint options

2020.04.02 Update

  • Add Chunk functionality for Patch
  • Fix serialization and deserialization issues with FPatcherSpecifyAsset
  • Optimize organizational structure

2020.03.28 Update

  • Fix the issue where exporting *Release.json when patching based on the base version is incomplete.

2020.03.05 Update

  • Fix issues where task states weren’t cleared when cooking processes exited unexpectedly.
  • Added optional maps in the Engine or Plugin during cooking in the code, manageable via controlling the ENABLE_COOK_ENGINE_MAP and ENABLE_COOK_PLUGIN_MAP values in HotPatcherEditor.build.cs.

2020.02.14 Update

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

2019.12.08 Update

  • Added an option to analyze resource dependencies and increase diff preview.

2020.02.19 Update

  • Added support for adding external files and folders when exporting release, corresponding to the non-resource external file directories added during UE packaging. Also supports diffing of external files (optional), only modified or newly added files will be packed into pak.

2020.01.13 Update

  • Added error messaging during generation, detecting uncooked resources and duplicate external files, and allowing specification of certain resources into Pak, with optional dependency analysis for those resources.

2020.01.14 Update

  • Fixed issues where redirectors could indicate resources not cooked, added IncludeSpecifyAssets to ExportRelease, allowing specification of certain resources (e.g., a specific map).

2020.01.19 Update

  • Added the ability to specify directories to be cooked

Update Plan

To make HotPatcher more user-friendly and powerful, I will record some great update suggestions here.

  1. Add support for multithreaded resource dependency analysis (executed by launching a separate process)
  2. Add option to directly specify Pak encryption parameters under UnrealPak (opened parameters can specify encryption parameters as needed)
  3. Specify cooking for individual resources
  4. Change packaged Pak naming from XX_TARGET_PLATFORM_P.pak to XX_TARGET_PLATFORM_0_P or allow specification of the middle number.
  5. Import and export of Patch and Release configuration files, and quick cleaning of configurations.
  6. Add option to include external files for release, syncing with UE’s external file inclusion during packaging.
  7. Add diff for external files, so that not all external files need to be packed into pak every time.
  8. Package multiple pak files in one Patch, allowing selection of which resources go into which Pak.
  9. Add multithreaded support to Chunk‘s bMonolithic mode
  10. Add support for Commandlet
  11. Add support for exporting Release via Commandlet
  12. Add options to control the naming rules of generated Paks
  13. Support adding NoAssets resources for specific platforms during Patch
  14. Track modifications to UMG sub-controls that reference Widget resources
  15. Support analysis of Release.json from multiple platform paklists
  16. Filter the final results of Patch
  17. Set to ignore Editor resource content
  18. Store added external files via relative paths in Release.json (use Mountpath for version comparison)
  19. Support generation of shaderbytecode patches
  20. Non-blocking 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
Word 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!