Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UE4.26, HotPatcher版本75.0, 执行打Patch操作,配置多chunk打包 有些差分出的资源不会进任何pak #37

Open
waxnssg opened this issue Apr 2, 2022 · 0 comments

Comments

@waxnssg
Copy link

waxnssg commented Apr 2, 2022

复现条件:

  1. 配置多chunk 打patch

  2. 勾选Create Default Chunk后

  3. 执行Patch操作,
    结果: 有些差分出来的资源,没进任何pak, DefaultPak里面也没有.但是Diff.json里面是有的
    原因:
    没进入的资源是因为 这些资源不符合任何Chunk的IncludeFileFilters, 但却被其他资源引用到了.
    假设符合上面条件的资源为:B.asset
    在执行PatcherProxy.ParserChunkWorker 里面的
    FChunkAssetDescribe ChunkDiffInfo = UFlibHotPatcherCoreHelper::DiffChunkWithPatchSetting(
    Context.GetSettingObject(),
    Context.NewVersionChunk,
    TotalChunk
    );
    方法里 会将B.asset 排除掉,导致后面的逻辑都不在有B.asset的处理了。
    解决方法:
    修改:
    UFlibHotPatcherCoreHelper::DiffChunkWithPatchSetting方法为:
    FChunkAssetDescribe UFlibHotPatcherCoreHelper::DiffChunkWithPatchSetting(
    const FExportPatchSettings& PatchSetting,
    const FChunkInfo& CurrentVersionChunk,
    const FChunkInfo& TotalChunk
    //,TMap<FString, FAssetDependenciesInfo>& ScanedCaches
    )
    {
    FHotPatcherVersion TotalChunkVersion = UFlibPatchParserHelper::ExportReleaseVersionInfoByChunk(
    TEXT(""),
    TEXT(""),
    TEXT(""),
    TotalChunk,
    //ScanedCaches,
    PatchSetting.IsIncludeHasRefAssetsOnly(),
    TotalChunk.bAnalysisFilterDependencies
    );
    //排除掉 TotalChunkVersion 里面不属于任何ChunkInfo的资源
    /by ssg start
    */
    auto IsRemove = [&TotalChunkVersion](FString &assetName)->bool
    {
    for(auto filter:TotalChunkVersion.IncludeFilter)
    {
    filter = UFlibAssetManageHelper::NormalizeContentDir(filter);
    if(assetName.Find(filter) >= 0)
    {
    return false;
    }
    }
    for(auto specifyAsset:TotalChunkVersion.IncludeSpecifyAssets)
    {
    FString p = specifyAsset.Asset.GetLongPackageName();
    if(p == assetName)
    {
    return false;
    }
    }
    return true;
    };
    TMap<FString,FAssetDetail>& assets = TotalChunkVersion.AssetInfo.AssetsDependenciesMap["Game"].AssetDependencyDetails;
    TArray keys;
    assets.GetKeys(keys);
    for(auto item:keys)
    {
    if(IsRemove(item))
    {
    assets.Remove(item);
    }
    }
    /by ssg end**/

    return UFlibHotPatcherCoreHelper::DiffChunkByBaseVersionWithPatchSetting(PatchSetting, CurrentVersionChunk ,TotalChunk, TotalChunkVersion/,ScanedCaches/);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant