diff --git a/.gitmodules b/.gitmodules index 2cbeb46c..0e2698f9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "Mods/ShaderPatcherUE"] path = Mods/ShaderPatcherUE url = git@github.com:hxhb/ShaderPatcherUE.git +[submodule "Mods/PakAnalyzerUE"] + path = Mods/PakAnalyzerUE + url = git@github.com:hxhb/PakAnalyzerUE.git diff --git a/HotPatcher/Source/HotPatcherCore/Classes/Commandlets/CommandletHelper.cpp b/HotPatcher/Source/HotPatcherCore/Classes/Commandlets/CommandletHelper.cpp index e2140761..880a4a6b 100644 --- a/HotPatcher/Source/HotPatcherCore/Classes/Commandlets/CommandletHelper.cpp +++ b/HotPatcher/Source/HotPatcherCore/Classes/Commandlets/CommandletHelper.cpp @@ -181,4 +181,4 @@ TArray CommandletHelper::GetCookCommandletTargetPlatformName() } return result; -} \ No newline at end of file +} diff --git a/HotPatcher/Source/HotPatcherCore/HotPatcherCore.Build.cs b/HotPatcher/Source/HotPatcherCore/HotPatcherCore.Build.cs index 2e86b4c7..2a7ef94e 100644 --- a/HotPatcher/Source/HotPatcherCore/HotPatcherCore.Build.cs +++ b/HotPatcher/Source/HotPatcherCore/HotPatcherCore.Build.cs @@ -190,7 +190,7 @@ public HotPatcherCore(ReadOnlyTargetRules Target) : base(Target) { "TOOL_NAME=\"HotPatcher\"", "CURRENT_VERSION_ID=80", - "CURRENT_PATCH_ID=0", + "CURRENT_PATCH_ID=1", "REMOTE_VERSION_FILE=\"https://imzlp.com/opensource/version.json\"" }); } diff --git a/HotPatcher/Source/HotPatcherCore/Private/Cooker/MultiCooker/SingleCookerProxy.cpp b/HotPatcher/Source/HotPatcherCore/Private/Cooker/MultiCooker/SingleCookerProxy.cpp index f1343434..b6f0bb7a 100644 --- a/HotPatcher/Source/HotPatcherCore/Private/Cooker/MultiCooker/SingleCookerProxy.cpp +++ b/HotPatcher/Source/HotPatcherCore/Private/Cooker/MultiCooker/SingleCookerProxy.cpp @@ -603,10 +603,15 @@ FCookCluster USingleCookerProxy::GetPackageTrackerAsCluster() PackageTrackerCluster.AssetDetails.Empty(); for(FName LongPackageName:PackageTracker->GetPendingPackageSet()) { + if(!FPackageName::DoesPackageExist(LongPackageName.ToString())) + { + continue; + } + // make asset data to asset registry - FSoftObjectPath ObjectPath( - UFlibAssetManageHelper::LongPackageNameToPackagePath(LongPackageName.ToString()) - ); + FString PackagePath = UFlibAssetManageHelper::LongPackageNameToPackagePath(LongPackageName.ToString()); + + FSoftObjectPath ObjectPath(PackagePath); UFlibAssetManageHelper::UpdateAssetRegistryData(ObjectPath.GetLongPackageName()); FAssetData AssetData; diff --git a/HotPatcher/Source/HotPatcherCore/Private/CreatePatch/PatcherProxy.cpp b/HotPatcher/Source/HotPatcherCore/Private/CreatePatch/PatcherProxy.cpp index f69fdcc3..63928de6 100644 --- a/HotPatcher/Source/HotPatcherCore/Private/CreatePatch/PatcherProxy.cpp +++ b/HotPatcher/Source/HotPatcherCore/Private/CreatePatch/PatcherProxy.cpp @@ -504,7 +504,7 @@ namespace PatchWorker { for(auto& Chunk:Context.PakChunks) { - FString SavePath = FPaths::Combine(Context.GetSettingObject()->GetSaveAbsPath(),Context.CurrentVersion.VersionId,TEXT("Metadatas"),Chunk.ChunkName,PlatformName); + FString SavePath = FPaths::Combine(Context.GetSettingObject()->GetSaveAbsPath(),Context.CurrentVersion.VersionId,PlatformName,TEXT("Metadatas"),PlatformName,TEXT("Metadata/ShaderLibrarySource")); TArray FoundShaderLibs = UFlibShaderCodeLibraryHelper::FindCookedShaderLibByPlatform(PlatformName,SavePath); if(Context.PakChunks.Num()) @@ -563,7 +563,8 @@ namespace PatchWorker ); const TArray& ChunkAssets = ChunkAssetsDescrible.Assets.GetAssetDetails(); - + Context.PatchProxy->GetPatcherResult().PatcherAssetDetails.Append(ChunkAssets); + if(Context.GetSettingObject()->IsCookPatchAssets()) { FTrackPackageAction TrackChunkPackageAction(Context,Chunk,TArray{Platform}); @@ -605,6 +606,22 @@ namespace PatchWorker SingleCookerProxy->AddToRoot(); SingleCookerProxy->Init(&EmptySetting); bool bExportStatus = SingleCookerProxy->DoExport(); + const FCookCluster& AdditionalCluster = SingleCookerProxy->GetPackageTrackerAsCluster(); + for(const auto& AssetDetail:AdditionalCluster.AssetDetails) + { + FSoftObjectPath ObjectPath{AssetDetail.PackagePath}; + FString ReceiveReason; + if(!Context.GetSettingObject()->GetAssetScanConfig().IsMatchForceSkip(ObjectPath,ReceiveReason)) + { + Context.PatchProxy->GetPatcherResult().PatcherAssetDetails.Add(AssetDetail); + Context.VersionDiff.AssetDiffInfo.AddAssetDependInfo.AddAssetsDetail(AssetDetail); + } + else + { + UE_LOG(LogHotPatcher,Display,TEXT("[PackageTracker] %s Match ForceSkipRule,Reason %s"),*ObjectPath.GetLongPackageName(),*ReceiveReason); + } + } + SingleCookerProxy->Shutdown(); SingleCookerProxy->RemoveFromRoot(); } diff --git a/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp b/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp index 440d86a7..b03b4ad5 100644 --- a/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp +++ b/HotPatcher/Source/HotPatcherCore/Private/FlibHotPatcherCoreHelper.cpp @@ -27,6 +27,7 @@ #include "Serialization/ArrayWriter.h" #include "Settings/ProjectPackagingSettings.h" #include "ShaderCompiler.h" +#include "Async/ParallelFor.h" #include "CreatePatch/PatcherProxy.h" #include "Materials/MaterialInstance.h" #include "Materials/MaterialInstanceConstant.h" @@ -1199,10 +1200,10 @@ FPatchVersionDiff UFlibHotPatcherCoreHelper::DiffPatchVersionWithPatchSetting(co if(PatchSetting.IsForceSkipContent()) { - TArray AllSkipContents; - AllSkipContents.Append(UFlibAssetManageHelper::DirectoriesToStrings(PatchSetting.GetForceSkipContentRules())); - AllSkipContents.Append(UFlibAssetManageHelper::SoftObjectPathsToStrings(PatchSetting.GetForceSkipAssets())); - UFlibPatchParserHelper::ExcludeContentForVersionDiff(VersionDiffInfo,AllSkipContents); + TArray AllSkipDirContents = UFlibAssetManageHelper::DirectoriesToStrings(PatchSetting.GetForceSkipContentRules()); + UFlibPatchParserHelper::ExcludeContentForVersionDiff(VersionDiffInfo,AllSkipDirContents,EHotPatcherMatchModEx::StartWith); + TArray AllSkipAssets = UFlibAssetManageHelper::SoftObjectPathsToStrings(PatchSetting.GetForceSkipAssets()); + UFlibPatchParserHelper::ExcludeContentForVersionDiff(VersionDiffInfo,AllSkipAssets,EHotPatcherMatchModEx::Equal); } // clean deleted asset info in patch if(PatchSetting.IsIgnoreDeletedAssetsInfo()) @@ -1620,8 +1621,9 @@ void UFlibHotPatcherCoreHelper::AppendPakCommandOptions(TArray& OriginC const TArray& Options, bool bAppendAllMatch, const TArray& AppendFileExtersions, const TArray& IgnoreFormats, const TArray& InIgnoreOptions) { - for(auto& Command:OriginCommands) + ParallelFor(OriginCommands.Num(),[&](int32 index) { + FString& Command = OriginCommands[index]; FString PakOptionsStr; for (const auto& Param : Options) { @@ -1640,7 +1642,7 @@ void UFlibHotPatcherCoreHelper::AppendPakCommandOptions(TArray& OriginC PakOptionsStr += AppendOptionStr; } Command = FString::Printf(TEXT("%s%s"),*Command,*PakOptionsStr); - } + }); } FProjectPackageAssetCollection UFlibHotPatcherCoreHelper::ImportProjectSettingsPackages() diff --git a/HotPatcher/Source/HotPatcherCore/Public/CommandletBase/CommandletHelper.h b/HotPatcher/Source/HotPatcherCore/Public/CommandletBase/CommandletHelper.h index 64849b37..3672ef35 100644 --- a/HotPatcher/Source/HotPatcherCore/Public/CommandletBase/CommandletHelper.h +++ b/HotPatcher/Source/HotPatcherCore/Public/CommandletBase/CommandletHelper.h @@ -26,5 +26,4 @@ namespace CommandletHelper HOTPATCHERCORE_API bool IsCookCommandlet(); HOTPATCHERCORE_API TArray GetCookCommandletTargetPlatforms(); HOTPATCHERCORE_API TArray GetCookCommandletTargetPlatformName(); - } diff --git a/HotPatcher/Source/HotPatcherCore/Public/CreatePatch/PatcherProxy.h b/HotPatcher/Source/HotPatcherCore/Public/CreatePatch/PatcherProxy.h index 46e8f03e..47068003 100644 --- a/HotPatcher/Source/HotPatcherCore/Public/CreatePatch/PatcherProxy.h +++ b/HotPatcher/Source/HotPatcherCore/Public/CreatePatch/PatcherProxy.h @@ -23,6 +23,15 @@ using FPatchWorkers = TMap; DECLARE_MULTICAST_DELEGATE_FourParams(FOnPakListGenerated,FHotPatcherPatchContext&,FChunkInfo&,ETargetPlatform,TArray&); DECLARE_MULTICAST_DELEGATE_FourParams(FAddPatchWorkerEvent,FHotPatcherPatchContext&,FChunkInfo&,ETargetPlatform,TArray&); + +USTRUCT() +struct HOTPATCHERCORE_API FPatherResult +{ + GENERATED_BODY() + UPROPERTY() + TArray PatcherAssetDetails; +}; + UCLASS() class HOTPATCHERCORE_API UPatcherProxy:public UHotPatcherProxyBase { @@ -40,11 +49,14 @@ class HOTPATCHERCORE_API UPatcherProxy:public UHotPatcherProxyBase PatchWorkers.Add(WorkerName,Worker); } FORCEINLINE const FPatchWorkers& GetPatchWorkers()const{ return PatchWorkers; } + FORCEINLINE FPatherResult& GetPatcherResult(){ return PatcherResult; } + public: FOnPakListGenerated OnPakListGenerated; - + protected: FPatchWorkers PatchWorkers; private: TSharedPtr PatchContext; + FPatherResult PatcherResult; }; diff --git a/HotPatcher/Source/HotPatcherEditor/Private/HotPatcherEditor.cpp b/HotPatcher/Source/HotPatcherEditor/Private/HotPatcherEditor.cpp index ad5ee77c..7478900d 100644 --- a/HotPatcher/Source/HotPatcherEditor/Private/HotPatcherEditor.cpp +++ b/HotPatcher/Source/HotPatcherEditor/Private/HotPatcherEditor.cpp @@ -166,11 +166,11 @@ void FHotPatcherEditorModule::OpenDockTab() void FHotPatcherEditorModule::PluginButtonClicked() { - if(!DockTab.IsValid()) + if (!DockTab.IsValid()) { FGlobalTabmanager::Get()->RegisterNomadTabSpawner(HotPatcherTabName, FOnSpawnTab::CreateRaw(this, &FHotPatcherEditorModule::OnSpawnPluginTab)) - .SetDisplayName(LOCTEXT("FHotPatcherTabTitle", "HotPatcher")) - .SetMenuType(ETabSpawnerMenuType::Hidden); + .SetDisplayName(LOCTEXT("FHotPatcherTabTitle", "HotPatcher")) + .SetMenuType(ETabSpawnerMenuType::Hidden); } FGlobalTabmanager::Get()->InvokeTab(HotPatcherTabName); } diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/AssetManager/FAssetDependenciesInfo.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/AssetManager/FAssetDependenciesInfo.cpp index 5837e0ee..84b992a0 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/AssetManager/FAssetDependenciesInfo.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/AssetManager/FAssetDependenciesInfo.cpp @@ -42,9 +42,8 @@ bool FAssetDependenciesInfo::HasAsset(const FString& InAssetPackageName)const TArray FAssetDependenciesInfo::GetAssetDetails()const { SCOPED_NAMED_EVENT_TEXT("FAssetDependenciesInfo::GetAssetDetails",FColor::Red); - TArray OutAssetDetails; - OutAssetDetails.Empty(); + TArray AssetDetails; TArray Keys; AssetsDependenciesMap.GetKeys(Keys); @@ -59,11 +58,11 @@ TArray FAssetDependenciesInfo::GetAssetDetails()const for (const auto& ModuleAssetKey : ModuleAssetKeys) { FScopeLock Lock(&SynchronizationObject); - OutAssetDetails.Add(*ModuleAssetDetails.Find(ModuleAssetKey)); + AssetDetails.Add(*ModuleAssetDetails.Find(ModuleAssetKey)); } },GForceSingleThread); - return OutAssetDetails; + return AssetDetails; } bool FAssetDependenciesInfo::GetAssetDetailByPackageName(const FString& InAssetPackageName,FAssetDetail& OutDetail) const @@ -92,3 +91,28 @@ TArray FAssetDependenciesInfo::GetAssetLongPackageNames()const } return OutAssetLongPackageName; } + +void FAssetDependenciesInfo::RemoveAssetDetail(const FAssetDetail& AssetDetail) +{ + SCOPED_NAMED_EVENT_TEXT("FAssetDependenciesInfo::RemoveAssetDetail",FColor::Red); + FString LongPackageName = UFlibAssetManageHelper::PackagePathToLongPackageName(AssetDetail.PackagePath.ToString()); + RemoveAssetDetail(LongPackageName); +} + +void FAssetDependenciesInfo::RemoveAssetDetail(const FString& LongPackageName) +{ + FString BelongModuleName = UFlibAssetManageHelper::GetAssetBelongModuleName(LongPackageName); + if (AssetsDependenciesMap.Contains(BelongModuleName)) + { + TMap& AssetDependencyDetails = AssetsDependenciesMap.Find(BelongModuleName)->AssetDependencyDetails; + bool bHas = AssetDependencyDetails.Contains(LongPackageName); + if(bHas) + { + AssetDependencyDetails.Remove(LongPackageName); + if(!AssetDependencyDetails.Num()) + { + AssetsDependenciesMap.Remove(BelongModuleName); + } + } + } +} diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FAssetScanConfig.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FAssetScanConfig.cpp index af91e095..de953052 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FAssetScanConfig.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FAssetScanConfig.cpp @@ -1 +1,38 @@ #include "BaseTypes/FAssetScanConfig.h" + +bool FAssetScanConfig::IsMatchForceSkip(const FSoftObjectPath& ObjectPath,FString& OutReason) +{ + SCOPED_NAMED_EVENT_TEXT("IsMatchForceSkip",FColor::Red); + bool bSkip = false; + if(bForceSkipContent) + { + bool bSkipAsset = ForceSkipAssets.Contains(ObjectPath); + if(bSkipAsset) + { + OutReason = FString::Printf(TEXT("IsForceSkipAsset")); + } + bool bSkipDir = false; + for(const auto& ForceSkipDir:ForceSkipContentRules) + { + if(ObjectPath.GetLongPackageName().StartsWith(ForceSkipDir.Path)) + { + bSkipDir = true; + OutReason = FString::Printf(TEXT("ForceSkipDir %s"),*ForceSkipDir.Path); + break; + } + } + bool bSkipClasses = false; + FName AssetClassesName = UFlibAssetManageHelper::GetAssetType(ObjectPath); + for(const auto& Classes:ForceSkipClasses) + { + if(Classes->GetFName().IsEqual(AssetClassesName)) + { + OutReason = FString::Printf(TEXT("ForceSkipClasses %s"),*Classes->GetName()); + bSkipClasses = true; + break; + } + } + bSkip = bSkipAsset || bSkipDir || bSkipClasses; + } + return bSkip; +} diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FChunkInfo.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FChunkInfo.cpp index ddb91085..a5193555 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FChunkInfo.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/BaseTypes/FChunkInfo.cpp @@ -31,7 +31,7 @@ FString FChunkInfo::GetShaderLibraryName() const TArray FChunkInfo::GetManagedAssets() const { - SCOPED_NAMED_EVENT_TEXT("FChunkInfo::GetManagedAssets",FColor::Red); + FScopedNamedEventStatic GetManagedAssetsTag(FColor::Red,*FString::Printf(TEXT("GetManagedAssets_%s"),*ChunkName)); TArray NewPaths; UAssetManager& Manager = UAssetManager::Get(); diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/DependenciesParser/FDefaultAssetDependenciesParser.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/DependenciesParser/FDefaultAssetDependenciesParser.cpp index cb898cce..0a31386d 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/DependenciesParser/FDefaultAssetDependenciesParser.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/DependenciesParser/FDefaultAssetDependenciesParser.cpp @@ -207,6 +207,8 @@ TSet FAssetDependenciesParser::GatherAssetDependicesInfoRecursively( const TSet& IgnoreAssetTypes, FScanedCachesType& InScanedCaches) { + static bool bVerboseLog = FParse::Param(FCommandLine::Get(), TEXT("VerboseLog")); + TSet AssetDependencies; SCOPED_NAMED_EVENT_TEXT("GatherAssetDependicesInfoRecursively",FColor::Red); TArray TempForceSkipPackageNames = ForceSkipPackageNames; @@ -284,18 +286,28 @@ TSet FAssetDependenciesParser::GatherAssetDependicesInfoRecursively( // check is ignore directories or ingore types { SCOPED_NAMED_EVENT_TEXT("check ignore directories",FColor::Red); - if(!IsForceSkipAsset(LongPackageNameStr,IgnoreAssetTypes,IgnoreDirectories,ForceSkipDirectories,TempForceSkipPackageNames,false)) + if(!IsForceSkipAsset(LongPackageNameStr,IgnoreAssetTypes,IgnoreDirectories,ForceSkipDirectories,TempForceSkipPackageNames,true)) { FScopeLock Lock(&SynchronizationObject); AssetDependencies.Add(LongPackageName); } } - },GForceSingleThread); + },true); } if(bRecursively) { TSet Dependencies; +#if ASSET_DEPENDENCIES_DEBUG_LOG + if(bVerboseLog) + { + UE_LOG(LogHotPatcher,Display,TEXT("AssetParser %s Dependencies: (%d)"),*InLongPackageName.ToString(),AssetDependencies.Num()); + for(const auto& AssetPackageName:AssetDependencies) + { + UE_LOG(LogHotPatcher,Display,TEXT("\t%s"),*AssetPackageName.ToString()); + } + } +#endif for(const auto& AssetPackageName:AssetDependencies) { if(AssetPackageName.IsNone()) diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/FlibAssetManageHelper.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/FlibAssetManageHelper.cpp index 034c297c..26126f08 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/FlibAssetManageHelper.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/FlibAssetManageHelper.cpp @@ -863,7 +863,7 @@ bool UFlibAssetManageHelper::MakePakCommandFromAssetDependencies( OutCookCommand.Append(FinalCookedCommand); } } - },GForceSingleThread); + },true); return true; } @@ -1151,14 +1151,14 @@ FString UFlibAssetManageHelper::PackagePathToLongPackageName(const FString& Pack return ObjectPath.GetLongPackageName(); } -void UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(FAssetDependenciesInfo& AssetDependencies,const TArray& ExcludeRules) +void UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(FAssetDependenciesInfo& AssetDependencies,const TArray& ExcludeRules,EHotPatcherMatchModEx matchMod) { SCOPED_NAMED_EVENT_TEXT("ExcludeContentForAssetDependenciesDetail",FColor::Red); - auto ExcludeEditorContent = [&ExcludeRules](TMap& AssetCategorys) + auto ExcludeEditorContent = [&ExcludeRules,matchMod](TMap& AssetCategorys) { TArray Keys; AssetCategorys.GetKeys(Keys); - + for(const auto& Key:Keys) { FAssetDependenciesDetail& ModuleAssetList = *AssetCategorys.Find(Key); @@ -1175,7 +1175,9 @@ void UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(FAssetDepe FString MatchRule; for(const auto& Rule:ExcludeRules) { - if(AssetKeys[index].StartsWith(Rule)) + if(matchMod == EHotPatcherMatchModEx::StartWith && AssetKeys[index].StartsWith(Rule)|| + matchMod == EHotPatcherMatchModEx::Equal && AssetKeys[index].Equals(Rule) + ) { MatchRule = Rule; customStartWith = true; @@ -1410,8 +1412,9 @@ bool UFlibAssetManageHelper::MatchIgnoreFilters(const FString& LongPackageName, { for(const auto& IgnoreFilter:IgnoreDirs) { - if(LongPackageName.StartsWith(IgnoreFilter) || - IgnoreFilter.Contains(TEXT("*")) ? LongPackageName.MatchesWildcard(IgnoreFilter,ESearchCase::CaseSensitive):false) + bool bWithInSkipDir = LongPackageName.StartsWith(IgnoreFilter); + bool bMatchSkipWildcard = IgnoreFilter.Contains(TEXT("*")) ? LongPackageName.MatchesWildcard(IgnoreFilter,ESearchCase::CaseSensitive) : false; + if( bWithInSkipDir || bMatchSkipWildcard) { MatchDir = IgnoreFilter; return true; @@ -1612,4 +1615,19 @@ void UFlibAssetManageHelper::UpdateAssetRegistryData(const FString& PackageName) AssetRegistry.ScanModifiedAssetFiles(TArray{PackageFilename}); } } +TArray UFlibAssetManageHelper::GetPackgeFiles(const FString& LongPackageName,const FString& Extension) +{ + SCOPED_NAMED_EVENT_TEXT("GetPackgeFiles",FColor::Red); + TArray Files; + + FString FilePath = FPackageName::LongPackageNameToFilename(LongPackageName) + Extension; + + if(FPaths::FileExists(FilePath)) + { + FPaths::MakeStandardFilename(FilePath); + Files.Add(FilePath); + } + return Files; +}; + // PRAGMA_ENABLE_DEPRECATION_WARNINGS diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/FlibPatchParserHelper.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/FlibPatchParserHelper.cpp index f1e3b598..e433339c 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/FlibPatchParserHelper.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/FlibPatchParserHelper.cpp @@ -1287,13 +1287,13 @@ FHotPatcherVersion UFlibPatchParserHelper::ExportReleaseVersionInfoByChunk( ScanConfig.AssetIncludeFilters = InChunkInfo.AssetIncludeFilters; ScanConfig.AssetIgnoreFilters = InChunkInfo.AssetIgnoreFilters; ScanConfig.bAnalysisFilterDependencies = bInAnalysisFilterDependencies; - ScanConfig.bForceSkipContent = InChunkInfo.bForceSkipContent; ScanConfig.bRecursiveWidgetTree = false; + ScanConfig.IncludeSpecifyAssets = InChunkInfo.IncludeSpecifyAssets; + ScanConfig.bForceSkipContent = InChunkInfo.bForceSkipContent; ScanConfig.ForceSkipAssets = InChunkInfo.ForceSkipAssets; ScanConfig.ForceSkipClasses = InChunkInfo.ForceSkipClasses; - ScanConfig.IncludeSpecifyAssets = InChunkInfo.IncludeSpecifyAssets; - ScanConfig.AssetRegistryDependencyTypes = InChunkInfo.AssetRegistryDependencyTypes; ScanConfig.ForceSkipContentRules = InChunkInfo.ForceSkipContentRules; + ScanConfig.AssetRegistryDependencyTypes = InChunkInfo.AssetRegistryDependencyTypes; ScanConfig.bIncludeHasRefAssetsOnly = InIncludeHasRefAssetsOnly; RunAssetScanner(ScanConfig,ExportVersion); @@ -1566,11 +1566,11 @@ bool UFlibPatchParserHelper::GetCookProcCommandParams(const FCookerConfig& InCon return true; } -void UFlibPatchParserHelper::ExcludeContentForVersionDiff(FPatchVersionDiff& VersionDiff,const TArray& ExcludeRules) +void UFlibPatchParserHelper::ExcludeContentForVersionDiff(FPatchVersionDiff& VersionDiff,const TArray& ExcludeRules,EHotPatcherMatchModEx matchMod) { - UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(VersionDiff.AssetDiffInfo.AddAssetDependInfo,ExcludeRules); - UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(VersionDiff.AssetDiffInfo.ModifyAssetDependInfo,ExcludeRules); - UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(VersionDiff.AssetDiffInfo.DeleteAssetDependInfo,ExcludeRules); + UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(VersionDiff.AssetDiffInfo.AddAssetDependInfo,ExcludeRules,matchMod); + UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(VersionDiff.AssetDiffInfo.ModifyAssetDependInfo,ExcludeRules,matchMod); + UFlibAssetManageHelper::ExcludeContentForAssetDependenciesDetail(VersionDiff.AssetDiffInfo.DeleteAssetDependInfo,ExcludeRules,matchMod); } FString UFlibPatchParserHelper::MountPathToRelativePath(const FString& InMountPath) @@ -2208,4 +2208,23 @@ FString UFlibPatchParserHelper::GetPlatformsStr(TArray Platform } result.RemoveFromEnd(TEXT(",")); return result; +} + + +bool UFlibPatchParserHelper::GetCmdletBoolValue(const FString& Token, bool& OutValue) +{ + FString bTokenValue; + bool bHasToken = FParse::Value(FCommandLine::Get(), *Token.ToLower(), bTokenValue); + if(bHasToken) + { + if(bTokenValue.Equals(TEXT("true"),ESearchCase::IgnoreCase)) + { + OutValue = true; + } + if(bTokenValue.Equals(TEXT("false"),ESearchCase::IgnoreCase)) + { + OutValue = false; + } + } + return bHasToken; } \ No newline at end of file diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/HotPatcher.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/HotPatcher.cpp index 9a0876f8..7beb8ba4 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Private/HotPatcher.cpp +++ b/HotPatcher/Source/HotPatcherRuntime/Private/HotPatcher.cpp @@ -5,10 +5,6 @@ #include "ETargetPlatform.h" #include "Misc/EnumRange.h" -#if WITH_EDITOR -#include "Interfaces/ITargetPlatform.h" -#include "Interfaces/ITargetPlatformManagerModule.h" -#endif #define LOCTEXT_NAMESPACE "FHotPatcherRuntimeModule" @@ -16,24 +12,7 @@ bool GForceSingleThread = (bool)FORCE_SINGLE_THREAD; void FHotPatcherRuntimeModule::StartupModule() { - TArray AppendPlatformEnums; - -#if WITH_EDITOR - TArray RealPlatformEnums; - ITargetPlatformManagerModule& TPM = GetTargetPlatformManagerRef(); - const TArray& TargetPlatforms = TPM.GetTargetPlatforms(); - for (ITargetPlatform *TargetPlatformIns : TargetPlatforms) - { - FString PlatformName = TargetPlatformIns->PlatformName(); - if(!PlatformName.IsEmpty()) - { - RealPlatformEnums.AddUnique(PlatformName); - } - } - AppendPlatformEnums = RealPlatformEnums; -#endif - - TArray> EnumNames = THotPatcherTemplateHelper::AppendEnumeraters(AppendPlatformEnums); + } void FHotPatcherRuntimeModule::ShutdownModule() diff --git a/HotPatcher/Source/HotPatcherRuntime/Private/TargetPlatformRegister.cpp b/HotPatcher/Source/HotPatcherRuntime/Private/TargetPlatformRegister.cpp new file mode 100644 index 00000000..e7cf422a --- /dev/null +++ b/HotPatcher/Source/HotPatcherRuntime/Private/TargetPlatformRegister.cpp @@ -0,0 +1,31 @@ +#include "TargetPlatformRegister.h" + +#include "ETargetPlatform.h" +#include "HotPatcherTemplateHelper.hpp" + +#if WITH_EDITOR +#include "Interfaces/ITargetPlatform.h" +#include "Interfaces/ITargetPlatformManagerModule.h" +#endif + +UTargetPlatformRegister::UTargetPlatformRegister(const FObjectInitializer& Initializer):Super(Initializer) +{ + TArray AppendPlatformEnums; + + #if WITH_EDITOR + TArray RealPlatformEnums; + ITargetPlatformManagerModule& TPM = GetTargetPlatformManagerRef(); + const TArray& TargetPlatforms = TPM.GetTargetPlatforms(); + for (ITargetPlatform *TargetPlatformIns : TargetPlatforms) + { + FString PlatformName = TargetPlatformIns->PlatformName(); + if(!PlatformName.IsEmpty()) + { + RealPlatformEnums.AddUnique(PlatformName); + } + } + AppendPlatformEnums = RealPlatformEnums; + #endif + + TArray> EnumNames = THotPatcherTemplateHelper::AppendEnumeraters(AppendPlatformEnums); +} \ No newline at end of file diff --git a/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FAssetDependenciesInfo.h b/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FAssetDependenciesInfo.h index 3a915b7b..41d7598e 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FAssetDependenciesInfo.h +++ b/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/AssetManager/FAssetDependenciesInfo.h @@ -21,5 +21,7 @@ struct HOTPATCHERRUNTIME_API FAssetDependenciesInfo TArray GetAssetDetails()const; bool GetAssetDetailByPackageName(const FString& InAssetPackageName,FAssetDetail& OutDetail)const; TArray GetAssetLongPackageNames()const; + void RemoveAssetDetail(const FAssetDetail& AssetDetail); + void RemoveAssetDetail(const FString& LongPackageName); }; diff --git a/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FAssetScanConfig.h b/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FAssetScanConfig.h index 5a850677..35ec0418 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FAssetScanConfig.h +++ b/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FAssetScanConfig.h @@ -41,7 +41,7 @@ struct HOTPATCHERRUNTIME_API FAssetScanConfig UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bAnalysisMaterialInstance = true; UPROPERTY(EditAnywhere, BlueprintReadWrite) - bool bSupportWorldComposition = true; + bool bSupportWorldComposition = false; UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bForceSkipContent = true; @@ -53,4 +53,6 @@ struct HOTPATCHERRUNTIME_API FAssetScanConfig UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (EditCondition="bForceSkipContent")) TArray ForceSkipClasses; + bool IsMatchForceSkip(const FSoftObjectPath& ObjectPath,FString& OutReason); + }; \ No newline at end of file diff --git a/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPackageTracker.h b/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPackageTracker.h index 195d94da..e1ce5c3d 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPackageTracker.h +++ b/HotPatcher/Source/HotPatcherRuntime/Public/BaseTypes/FPackageTracker.h @@ -4,6 +4,7 @@ #include "UObject/UObjectArray.h" #include "HAL/PlatformFilemanager.h" #include "HAL/FileManager.h" +#include "HotPatcherLog.h" struct FPackageTrackerBase : public FUObjectArray::FUObjectCreateListener, public FUObjectArray::FUObjectDeleteListener { diff --git a/HotPatcher/Source/HotPatcherRuntime/Public/FlibAssetManageHelper.h b/HotPatcher/Source/HotPatcherRuntime/Public/FlibAssetManageHelper.h index fd1baba1..979da5f6 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Public/FlibAssetManageHelper.h +++ b/HotPatcher/Source/HotPatcherRuntime/Public/FlibAssetManageHelper.h @@ -59,6 +59,12 @@ enum class EAssetRegistryDependencyTypeEx :uint8 All = Soft | Hard | SearchableName | SoftManage | HardManage }; +UENUM(BlueprintType) +enum class EHotPatcherMatchModEx :uint8 +{ + StartWith, + Equal +}; UCLASS() class HOTPATCHERRUNTIME_API UFlibAssetManageHelper : public UBlueprintFunctionLibrary { @@ -210,9 +216,8 @@ class HOTPATCHERRUNTIME_API UFlibAssetManageHelper : public UBlueprintFunctionLi static EAssetRegistryDependencyType::Type ConvAssetRegistryDependencyToInternal(const EAssetRegistryDependencyTypeEx& InType); static void GetAssetDataInPaths(const TArray& Paths, TArray& OutAssetData); - - static void ExcludeContentForAssetDependenciesDetail(FAssetDependenciesInfo& AssetDependencies,const TArray& ExcludeRules = {TEXT("")}); - + + static void ExcludeContentForAssetDependenciesDetail(FAssetDependenciesInfo& AssetDependencies,const TArray& ExcludeRules = {TEXT("")},EHotPatcherMatchModEx MatchMod = EHotPatcherMatchModEx::StartWith); static TArray DirectoriesToStrings(const TArray& DirectoryPaths); static TArray SoftObjectPathsToStrings(const TArray& SoftObjectPaths); @@ -255,6 +260,7 @@ class HOTPATCHERRUNTIME_API UFlibAssetManageHelper : public UBlueprintFunctionLi static bool bIncludeOnlyOnDiskAssets; static void UpdateAssetRegistryData(const FString& PackageName); + static TArray GetPackgeFiles(const FString& LongPackageName,const FString& Extension); }; diff --git a/HotPatcher/Source/HotPatcherRuntime/Public/FlibPatchParserHelper.h b/HotPatcher/Source/HotPatcherRuntime/Public/FlibPatchParserHelper.h index 64ca6b3f..942cd3cf 100644 --- a/HotPatcher/Source/HotPatcherRuntime/Public/FlibPatchParserHelper.h +++ b/HotPatcher/Source/HotPatcherRuntime/Public/FlibPatchParserHelper.h @@ -174,7 +174,7 @@ class HOTPATCHERRUNTIME_API UFlibPatchParserHelper : public UBlueprintFunctionLi static TArray GetPakCommandStrByCommands(const TArray& PakCommands, const TArray& InReplaceTexts = TArray{},bool bIoStore=false); static bool GetCookProcCommandParams(const FCookerConfig& InConfig,FString& OutParams); - static void ExcludeContentForVersionDiff(FPatchVersionDiff& VersionDiff,const TArray& ExcludeRules = {TEXT("")}); + static void ExcludeContentForVersionDiff(FPatchVersionDiff& VersionDiff,const TArray& ExcludeRules = {TEXT("")},EHotPatcherMatchModEx matchMod=EHotPatcherMatchModEx::StartWith); static FString MountPathToRelativePath(const FString& InMountPath); @@ -243,5 +243,7 @@ class HOTPATCHERRUNTIME_API UFlibPatchParserHelper : public UBlueprintFunctionLi static FString GetTargetPlatformsCmdLine(const TArray& Platforms); static FString MergeOptionsAsCmdline(const TArray& InOptions); static FString GetPlatformsStr(TArray Platforms); + + static bool GetCmdletBoolValue(const FString& Token,bool& OutValue); }; diff --git a/HotPatcher/Source/HotPatcherRuntime/Public/TargetPlatformRegister.h b/HotPatcher/Source/HotPatcherRuntime/Public/TargetPlatformRegister.h new file mode 100644 index 00000000..7d393c15 --- /dev/null +++ b/HotPatcher/Source/HotPatcherRuntime/Public/TargetPlatformRegister.h @@ -0,0 +1,9 @@ +#pragma once +#include "CoreMinimal.h" +#include "TargetPlatformRegister.generated.h" + +UCLASS() +class HOTPATCHERRUNTIME_API UTargetPlatformRegister:public UObject +{ + GENERATED_UCLASS_BODY() +}; \ No newline at end of file diff --git a/Mods/GameFeaturePacker b/Mods/GameFeaturePacker index 2ec40b6e..9c6385b8 160000 --- a/Mods/GameFeaturePacker +++ b/Mods/GameFeaturePacker @@ -1 +1 @@ -Subproject commit 2ec40b6e362d94a1319ae2aad0a3e7a272dada2a +Subproject commit 9c6385b8ee46bb943abf64aae2185f40c4b25d07 diff --git a/Mods/HotChunker b/Mods/HotChunker index 503703ea..5a220924 160000 --- a/Mods/HotChunker +++ b/Mods/HotChunker @@ -1 +1 @@ -Subproject commit 503703ea1505b188851ed13efbbdbf960f6a0080 +Subproject commit 5a2209249c5c714f96a1d5cf15d37edb79120fa4 diff --git a/Mods/HotMultiCooker b/Mods/HotMultiCooker index 36c1c5be..e19902cd 160000 --- a/Mods/HotMultiCooker +++ b/Mods/HotMultiCooker @@ -1 +1 @@ -Subproject commit 36c1c5be6f4d4b716c8a5f13d2f8334ff7371f7f +Subproject commit e19902cd1d9e36481e9d9afc748b1cee68df82b7 diff --git a/Mods/PakAnalyzerUE b/Mods/PakAnalyzerUE new file mode 160000 index 00000000..7121f48b --- /dev/null +++ b/Mods/PakAnalyzerUE @@ -0,0 +1 @@ +Subproject commit 7121f48b91317b68776888a2adac82a9bbc3747c