Skip to content

Commit

Permalink
Merge pull request #84 from hxhb/dev
Browse files Browse the repository at this point in the history
v81.0
  • Loading branch information
hxhb authored Jun 4, 2023
2 parents 6071309 + cafe6e4 commit 1897f7d
Show file tree
Hide file tree
Showing 24 changed files with 327 additions and 182 deletions.
4 changes: 2 additions & 2 deletions HotPatcher/Source/CmdHandler/Private/CmdHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool AddMultiCookerBackendToConfig(const FString& DDCAddr)
{
Section->Remove(*Key);
}
UE_LOG(LogCmdHandler, Display, TEXT("Override Section MultiCookerDDC key: %s to %d."),*Key,*Value);
UE_LOG(LogCmdHandler, Display, TEXT("Override Section MultiCookerDDC key: %s to %s."),*Key,*Value);
Section->Add(*Key,FConfigValue(*Value));
};

Expand All @@ -57,7 +57,7 @@ bool AddMultiCookerBackendToConfig(const FString& DDCAddr)
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=false, UnusedFileAge=10, FoldersToClean=10, MaxFileChecksPerSec=1, Path=%s, EnvPathOverride=UE-SharedDataCachePath, EditorOverrideSetting=SharedDerivedDataCache)"),
TEXT("(Type=FileSystem, ReadOnly=false, Clean=false, Flush=false, DeleteUnused=false, UnusedFileAge=10, FoldersToClean=10, MaxFileChecksPerSec=1, Path=%s, EnvPathOverride=UE-SharedDataCachePath, EditorOverrideSetting=SharedDerivedDataCache)"),
*DDCAddr
);
UpdateKeyLambda(MultiCookerDDCBackendSection,TEXT("Shared"),DDC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,17 @@ TArray<FString> CommandletHelper::GetCookCommandletTargetPlatformName()

return result;
}


void CommandletHelper::ModifyTargetPlatforms(const FString& InParams,const FString& InToken,TArray<ETargetPlatform>& OutTargetPlatforms,bool Replace)
{
TArray<ETargetPlatform> TargetPlatforms = CommandletHelper::ParserPlatforms(InParams,InToken);
if(TargetPlatforms.Num())
{
if(Replace){
OutTargetPlatforms = TargetPlatforms;
}else{
for(ETargetPlatform Platform:TargetPlatforms){ OutTargetPlatforms.AddUnique(Platform); }
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ int32 UHotSingleCookerCommandlet::Main(const FString& Params)
TMap<FString, FString> KeyValues = THotPatcherTemplateHelper::GetCommandLineParamsMap(Params);
THotPatcherTemplateHelper::ReplaceProperty(*ExportSingleCookerSetting, KeyValues);

CommandletHelper::ModifyTargetPlatforms(Params,TARGET_PLATFORMS_OVERRIDE,ExportSingleCookerSetting->CookTargetPlatforms,true);
if(ExportSingleCookerSetting->bDisplayConfig)
{
FString FinalConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ int32 UHotPatcherCommandlet::Main(const FString& Params)
bool bExportStatus = false;
if (FFileHelper::LoadFileToString(JsonContent, *config_path))
{

if(IsRunningCommandlet())
if(IsRunningCommandlet() && !FParse::Param(FCommandLine::Get(), TEXT("NoSearchAllAssets")))
{
SCOPED_NAMED_EVENT_TEXT("SearchAllAssets",FColor::Red);
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
AssetRegistryModule.Get().SearchAllAssets(true);
}
Expand All @@ -63,6 +63,7 @@ int32 UHotPatcherCommandlet::Main(const FString& Params)
ExportPatchSetting->PakTargetPlatforms.AddUnique(Platform);
}
}
CommandletHelper::ModifyTargetPlatforms(Params,TARGET_PLATFORMS_OVERRIDE,ExportPatchSetting->PakTargetPlatforms,true);
ExportPatchSetting->GetAssetScanConfigRef().AssetIncludeFilters.Append(CommandletHelper::ParserPatchFilters(Params,TEXT("AssetIncludeFilters")));
ExportPatchSetting->GetAssetScanConfigRef().AssetIgnoreFilters.Append(CommandletHelper::ParserPatchFilters(Params,TEXT("AssetIgnoreFilters")));

Expand Down
7 changes: 4 additions & 3 deletions HotPatcher/Source/HotPatcherCore/HotPatcherCore.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public HotPatcherCore(ReadOnlyTargetRules Target) : base(Target)
"InputCore",
"CoreUObject",
"Engine",
"Sockets"
"Sockets",
"DerivedDataCache"
// ... add private dependencies that you statically link with here ...
}
);
Expand Down Expand Up @@ -189,8 +190,8 @@ public HotPatcherCore(ReadOnlyTargetRules Target) : base(Target)
PublicDefinitions.AddRange(new string[]
{
"TOOL_NAME=\"HotPatcher\"",
"CURRENT_VERSION_ID=80",
"CURRENT_PATCH_ID=1",
"CURRENT_VERSION_ID=81",
"CURRENT_PATCH_ID=0",
"REMOTE_VERSION_FILE=\"https://imzlp.com/opensource/version.json\""
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ void USingleCookerProxy::ExecCookCluster(const FCookCluster& CookCluster)
{
SCOPED_NAMED_EVENT_TEXT("ExecCookCluster",FColor::Red);

// for GC
{
UE_LOG(LogHotPatcher,Display,TEXT("ExecuteCookCluster Try GC..."));
GEngine->ForceGarbageCollection(false);
CollectGarbage(RF_NoFlags, false);
}

CookedClusterCount++;
UE_LOG(LogHotPatcher,Display,TEXT("ExecuteCookCluster %d with %d assets, total cluster %d"),CookedClusterCount,CookCluster.AssetDetails.Num(),ClusterCount);

Expand Down Expand Up @@ -372,11 +379,7 @@ void USingleCookerProxy::ExecCookCluster(const FCookCluster& CookCluster)
// CleanClusterCachedPlatformData(CookCluster);
UFlibShaderCodeLibraryHelper::WaitShaderCompilingComplete();
UFlibHotPatcherCoreHelper::WaitForAsyncFileWrites();
// for GC
{
GEngine->ForceGarbageCollection(true);
CollectGarbage(RF_NoFlags, true);
}
UFlibHotPatcherCoreHelper::WaitDDCComplete();
}

void USingleCookerProxy::Tick(float DeltaTime)
Expand Down
Loading

0 comments on commit 1897f7d

Please sign in to comment.