Skip to content

Commit

Permalink
v80.0 HotPatcher Modular (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
hxhb authored Jan 8, 2023
1 parent 32cb38b commit 78203c7
Show file tree
Hide file tree
Showing 57 changed files with 1,077 additions and 1,701 deletions.
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@
[submodule "Mods/HotChunker"]
path = Mods/HotChunker
url = [email protected]:hxhb/HotChunker.git
[submodule "Mods/HDiffPatchUE"]
path = Mods/HDiffPatchUE
url = [email protected]:hxhb/HDiffPatchUE.git
[submodule "Mods/GameFeaturePacker"]
path = Mods/GameFeaturePacker
url = [email protected]:hxhb/GameFeaturePacker.git
[submodule "Mods/ShaderPatcherUE"]
path = Mods/ShaderPatcherUE
url = [email protected]:hxhb/ShaderPatcherUE.git
2 changes: 1 addition & 1 deletion HotPatcher/HotPatcher.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
"Name": "HotPatcherCore",
"Type": "Editor",
"LoadingPhase": "Default"
"LoadingPhase": "PreDefault"
},
{
"Name": "HotPatcherRuntime",
Expand Down
Binary file added HotPatcher/Resources/Payments/alipay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HotPatcher/Resources/Payments/wechatpay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion HotPatcher/Source/CmdHandler/CmdHandler.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public CmdHandler(ReadOnlyTargetRules Target) : base(Target)
"Json",
"SandboxFile",
"JsonUtilities",
"Settings",
// ... add other public dependencies that you statically link with here ...
}
);
Expand Down
69 changes: 54 additions & 15 deletions HotPatcher/Source/CmdHandler/Private/CmdHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,50 @@ bool OverrideConfigValue(const FString& FileName,const FString& Section,const FS
if(GConfig->GetInt( *Section, *Key, DefaultValue, FileName ))
{
GConfig->SetInt( *Section, *Key, NewValue, FileName );
UE_LOG(LogCmdHandler, Display, TEXT("Override section: %s key: %s from %d to %d."), *Section,*Key,DefaultValue,NewValue);
UE_LOG(LogCmdHandler, Display, TEXT("Override Section: %s key: %s from %d to %d."), *Section,*Key,DefaultValue,NewValue);
bRet = true;
}
else
{
UE_LOG(LogCmdHandler, Warning, TEXT("section: %s key: %s is not found!"), *Section,*Key);
UE_LOG(LogCmdHandler, Warning, TEXT("Override Section: %s key: %s is not found!"), *Section,*Key);
}
return bRet;
}

#if WITH_EDITOR
static bool bDDCUrl = false;
static FString MultiCookerDDCBackendName = TEXT("MultiCookerDDC");
void AddMultiCookerBackendToConfig(const FString& DDCAddr)
bool AddMultiCookerBackendToConfig(const FString& DDCAddr)
{
if(DDCAddr.IsEmpty())
bool bStatus = false;
UE_LOG(LogCmdHandler,Display,TEXT("-ddcurl: %s"),*DDCAddr);
if(DDCAddr.IsEmpty() || DDCAddr.StartsWith(TEXT(" ")))
{
UE_LOG(LogCmdHandler, Warning, TEXT("not use MultiCookerDDC"));
return;
return bStatus;
}
auto EngineIniIns = GConfig->FindConfigFile(GEngineIni);
auto MultiCookerDDCBackendSection = EngineIniIns->FindOrAddSection(MultiCookerDDCBackendName);

MultiCookerDDCBackendSection->Empty();

auto UpdateKeyLambda = [](FConfigSection* Section,const FString& Key,const FString& Value)
{
if(Section->Find(*Key))
{
Section->Remove(*Key);
}
UE_LOG(LogCmdHandler, Display, TEXT("Override Section MultiCookerDDC key: %s to %d."),*Key,*Value);
Section->Add(*Key,FConfigValue(*Value));
};

UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("MinimumDaysToKeepFile"),TEXT("7"));
UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("Root"),TEXT("(Type=KeyLength, Length=120, Inner=AsyncPut)"));
UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("AsyncPut"),TEXT("(Type=AsyncPut, Inner=Hierarchy)"));
UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("Hierarchy"),TEXT("(Type=Hierarchical, Inner=Boot, Inner=PakWrite, Inner=PakRead, Inner=Local, Inner=Shared)"));
UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("Hierarchy"),TEXT("(Type=Hierarchical, Inner=Boot, Inner=Pak, Inner=EnginePak, Inner=Local, Inner=Shared)"));
UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("Boot"),TEXT("(Type=Boot, Filename=\"%GAMEDIR%DerivedDataCache/Boot.ddc\", MaxCacheSize=512)"));

FString DDC = FString::Printf(
TEXT("(Type=FileSystem, ReadOnly=false, Clean=true, Flush=false, DeleteUnused=true, UnusedFileAge=10, FoldersToClean=10, MaxFileChecksPerSec=1, ConsiderSlowAt=70, PromptIfMissing=false, Path=%s, EnvPathOverride=UE-SharedDataCachePath, EditorOverrideSetting=SharedDerivedDataCache)"),
TEXT("(Type=FileSystem, ReadOnly=false, Clean=true, Flush=false, DeleteUnused=false, UnusedFileAge=10, FoldersToClean=10, MaxFileChecksPerSec=1, Path=%s, EnvPathOverride=UE-SharedDataCachePath, EditorOverrideSetting=SharedDerivedDataCache)"),
*DDCAddr
);
UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("Shared"),DDC);
Expand All @@ -61,13 +67,15 @@ void AddMultiCookerBackendToConfig(const FString& DDCAddr)
{
DDCBackendName = MultiCookerDDCBackendName;
FCommandLine::Append(*FString::Printf(TEXT(" -ddc=%s"),*DDCBackendName));
UE_LOG(LogCmdHandler, Warning, TEXT("Append cmd: %s"),FCommandLine::Get());
UE_LOG(LogCmdHandler, Display, TEXT("Append cmd: %s"),FCommandLine::Get());
bStatus = true;
}
UE_LOG(LogCmdHandler, Warning, TEXT("use MultiCookerDDC: %s"),*DDCBackendName);

UE_LOG(LogCmdHandler, Display, TEXT("Use DDCBackend: %s"),*DDCBackendName);
return bStatus;
}

static bool bDDCUrl = false;
void FCmdHandlerModule::StartupModule()
void OverrideEditorEnv()
{
int32 OverrideNumUnusedShaderCompilingThreads = 3;
if(FParse::Value(FCommandLine::Get(), TEXT("-MaxShaderWorker="), OverrideNumUnusedShaderCompilingThreads))
Expand All @@ -92,19 +100,50 @@ void FCmdHandlerModule::StartupModule()
FString DDCURL;
if(FParse::Value(FCommandLine::Get(),TEXT("-ddcurl="),DDCURL) && !DDCURL.IsEmpty())
{
AddMultiCookerBackendToConfig(DDCURL);
bDDCUrl = true;
bDDCUrl = AddMultiCookerBackendToConfig(DDCURL);
}
}

void FCmdHandlerModule::ShutdownModule()
void UnOverrideEditorEnv()
{
if(bDDCUrl)
{
auto EngineIniIns = GConfig->FindConfigFile(GEngineIni);
EngineIniIns->Remove(MultiCookerDDCBackendName);
}
}

#else

void OverrideRuntimeEnv()
{

}

void UnOverrideRuntimeEnv()
{

}
#endif

void FCmdHandlerModule::StartupModule()
{
#if WITH_EDITOR
OverrideEditorEnv();
#else
OverrideRuntimeEnv();
#endif
}

void FCmdHandlerModule::ShutdownModule()
{
#if WITH_EDITOR
UnOverrideEditorEnv();
#else
UnOverrideRuntimeEnv();
#endif
}

#undef LOCTEXT_NAMESPACE

IMPLEMENT_MODULE(FCmdHandlerModule, CmdHandler)
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#include "HotAssetScannerCommandlet.h"
#include "ShaderPatch/FExportShaderPatchSettings.h"
#include "CommandletHelper.h"
// engine header
#include "CoreMinimal.h"
#include "FlibPatchParserHelper.h"
#include "Async/ParallelFor.h"
#include "Misc/FileHelper.h"
#include "Misc/CommandLine.h"
#include "Misc/Paths.h"
#include "ShaderPatch/FExportShaderPatchSettings.h"
#include "ShaderPatch/ShaderPatchProxy.h"
#include "BaseTypes/FPackageTracker.h"
DEFINE_LOG_CATEGORY(LogHotAssetScannerCommandlet);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include "HotGlobalShaderCommandlet.h"
#include "ShaderPatch/FExportShaderPatchSettings.h"
#include "CommandletHelper.h"
// engine header
#include "CoreMinimal.h"
#include "FlibHotPatcherCoreHelper.h"
#include "Async/ParallelFor.h"
#include "Cooker/MultiCooker/FlibHotCookerHelper.h"
#include "Kismet/KismetStringLibrary.h"
#include "Misc/FileHelper.h"
#include "Misc/CommandLine.h"
#include "Misc/Paths.h"
#include "ShaderPatch/FlibShaderCodeLibraryHelper.h"
#include "ShaderLibUtils/FlibShaderCodeLibraryHelper.h"

#define PLATFORMS_PARAM_NAME TEXT("-platforms=")
#define SAVETO_PARAM_NAME TEXT("-saveto=")
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions HotPatcher/Source/HotPatcherCore/HotPatcherCore.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public HotPatcherCore(ReadOnlyTargetRules Target) : base(Target)
"InputCore",
"CoreUObject",
"Engine",
"RenderCore",
"Sockets"
// ... add private dependencies that you statically link with here ...
}
Expand Down Expand Up @@ -190,7 +189,7 @@ public HotPatcherCore(ReadOnlyTargetRules Target) : base(Target)
PublicDefinitions.AddRange(new string[]
{
"TOOL_NAME=\"HotPatcher\"",
"CURRENT_VERSION_ID=79",
"CURRENT_VERSION_ID=80",
"CURRENT_PATCH_ID=0",
"REMOTE_VERSION_FILE=\"https://imzlp.com/opensource/version.json\""
});
Expand Down
Loading

0 comments on commit 78203c7

Please sign in to comment.