Make downloading of chunks parallel + fixes for icons

This commit is contained in:
GhostScissors 2024-12-02 12:41:07 +05:30
parent 062d54e366
commit 8a41247acb
4 changed files with 20 additions and 8 deletions

View File

@ -58,6 +58,9 @@ public class BaseCommunity : BaseIcon
if (Object.TryGetValue(out FGameplayTagContainer gameplayTags, "GameplayTags"))
CheckGameplayTags(gameplayTags);
else if (Object.TryGetValue(out FInstancedStruct[] dataList, "DataList"))
CheckGameplayTags(dataList);
if (Object.TryGetValue(out FPackageIndex cosmeticItem, "cosmetic_item"))
CosmeticSource = cosmeticItem.Name.ToUpper();
@ -91,6 +94,14 @@ public class BaseCommunity : BaseIcon
return new[] { ret };
}
private void CheckGameplayTags(FInstancedStruct[] dataList)
{
if (dataList.FirstOrDefault(d => d.NonConstStruct?.TryGetValue(out FGameplayTagContainer _, "Tags") ?? false) is { NonConstStruct: not null } tags)
{
CheckGameplayTags(tags.NonConstStruct.Get<FGameplayTagContainer>("Tags"));
}
}
private void CheckGameplayTags(FGameplayTagContainer gameplayTags)
{
if (_design == null) return;

View File

@ -229,6 +229,7 @@ public class BaseIcon : UCreator
2 => 8,
3 => 4,
4 => 5,
5 => 5,
_ => 10
};

View File

@ -253,22 +253,22 @@ public class CUE4ParseViewModel : ViewModel
).GetAwaiter().GetResult();
var parseTime = Stopwatch.GetElapsedTime(startTs);
foreach (var fileManifest in manifest.Files)
Parallel.ForEach(manifest.Files, fileManifest =>
{
if (fileManifest.FileName.Equals("Cloud/IoStoreOnDemand.ini", StringComparison.OrdinalIgnoreCase))
{
IoStoreOnDemand.Read(new StreamReader(fileManifest.GetStream()));
continue;
return;
}
if (!_fnLive.IsMatch(fileManifest.FileName))
{
continue;
return;
}
p.RegisterVfs(fileManifest.FileName, [fileManifest.GetStream()]
, it => new FRandomAccessStreamArchive(it, manifest.Files.First(x => x.FileName.Equals(it)).GetStream(), p.Versions));
}
});
FLogger.Append(ELog.Information, () =>
FLogger.Text($"Fortnite [LIVE] has been loaded successfully in {parseTime.TotalMilliseconds}ms", Constants.WHITE, true));
@ -282,10 +282,10 @@ public class CUE4ParseViewModel : ViewModel
throw new Exception("Could not load latest Valorant manifest, you may have to switch to your local installation.");
}
for (var i = 0; i < manifestInfo.Paks.Length; i++)
Parallel.For(0, manifestInfo.Paks.Length, i =>
{
p.RegisterVfs(manifestInfo.Paks[i].GetFullName(), [manifestInfo.GetPakStream(i)]);
}
});
FLogger.Append(ELog.Information, () =>
FLogger.Text($"Valorant '{manifestInfo.Header.GameVersion}' has been loaded successfully", Constants.WHITE, true));

View File

@ -87,8 +87,8 @@ public class GameSelectorViewModel : ViewModel
.OrderBy(value => (int)value == ((int)value & ~0xF));
private IEnumerable<DirectorySettings> EnumerateDetectedGames()
{
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_5);
yield return DirectorySettings.Default("Fortnite [LIVE]", Constants._FN_LIVE_TRIGGER, ue: EGame.GAME_UE5_5);
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_6);
yield return DirectorySettings.Default("Fortnite [LIVE]", Constants._FN_LIVE_TRIGGER, ue: EGame.GAME_UE5_6);
yield return GetUnrealEngineGame("Pewee", "\\RogueCompany\\Content\\Paks", EGame.GAME_RogueCompany);
yield return GetUnrealEngineGame("Rosemallow", "\\Indiana\\Content\\Paks", EGame.GAME_UE4_21);
yield return GetUnrealEngineGame("Catnip", "\\OakGame\\Content\\Paks", EGame.GAME_Borderlands3);