Skip to content

Commit 0a08078

Browse files
committed
[GenshinRepair] Ignore IFix remote blocks
1 parent f395029 commit 0a08078

File tree

1 file changed

+19
-4
lines changed
  • CollapseLauncher/Classes/RepairManagement/Genshin

1 file changed

+19
-4
lines changed

CollapseLauncher/Classes/RepairManagement/Genshin/Fetch.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Hi3Helper.EncTool.Parser.YSDispatchHelper;
77
using Hi3Helper.Http;
88
using System;
9+
using System.Buffers;
910
using System.Collections.Generic;
1011
using System.IO;
1112
using System.Linq;
@@ -276,13 +277,19 @@ await ParseManifestToAssetIndex(downloadClient, downloadProgress, dataVerURL, ""
276277

277278
// Parse data_versions (silence)
278279
var dataSilURL = queryProperty.ClientDesignDataSilURL;
280+
SearchValues<string> dataSilIgnoreContainsParams = SearchValues.Create([
281+
// Containing InjectFix (aka IFix) files since the game only loads
282+
// it without storing it locally.
283+
"blocks/00/29342328.blk"
284+
// ,"blocks/00/32070509.blk" <- this one is stored locally
285+
], StringComparison.OrdinalIgnoreCase);
279286
#if DEBUG
280287
LogWriteLine($"Downloading silence_data_versions_persist...\r\n\t" +
281288
$"{dataSilURL}", LogType.Debug, true);
282289
#endif
283290
await ParseManifestToAssetIndex(downloadClient, downloadProgress, dataSilURL, "",
284291
CombineURLFromString("AssetBundles", "data_versions"), "silence_data_versions_persist",
285-
basePersistentPath, baseStreamingAssetsPath, assetIndex, hashtableManifest, token, true);
292+
basePersistentPath, baseStreamingAssetsPath, assetIndex, hashtableManifest, token, true, dataSilIgnoreContainsParams);
286293

287294
// Save persistent manifest numbers
288295
SavePersistentRevision(queryProperty);
@@ -299,7 +306,7 @@ private async Task ParseManifestToAssetIndex(DownloadClient downloadClient, Down
299306
string manifestRemoteName, string manifestLocalName,
300307
string persistentPath, string streamingAssetsPath,
301308
List<PkgVersionProperties> assetIndex, Dictionary<string, PkgVersionProperties> hashtable,
302-
CancellationToken token, bool forceOverwrite = false)
309+
CancellationToken token, bool forceOverwrite = false, SearchValues<string> ignoreContainsParams = null)
303310
{
304311
try
305312
{
@@ -325,7 +332,8 @@ private async Task ParseManifestToAssetIndex(DownloadClient downloadClient, Down
325332
secondaryParentURL,
326333
assetIndex,
327334
hashtable,
328-
forceOverwrite);
335+
forceOverwrite,
336+
ignoreContainsParams);
329337
}
330338
catch (TaskCanceledException) { throw; }
331339
catch (OperationCanceledException) { throw; }
@@ -375,7 +383,8 @@ private static void ParsePkgVersionManifest(string
375383
string secondaryParentURL,
376384
List<PkgVersionProperties> assetIndex,
377385
Dictionary<string, PkgVersionProperties> hashtable,
378-
bool forceOverwrite)
386+
bool forceOverwrite,
387+
SearchValues<string> ignoreContainsParams)
379388
{
380389
persistentPath = persistentPath.Replace('\\', '/');
381390
streamingAssetPath = streamingAssetPath.Replace('\\', '/');
@@ -387,6 +396,12 @@ private static void ParsePkgVersionManifest(string
387396
{
388397
PkgVersionProperties manifestEntry = manifestLine.Deserialize(CoreLibraryJsonContext.Default.PkgVersionProperties);
389398

399+
// If the ignoreContainsParams is not null and the remoteName contains any of the params, then skip it.
400+
if (ignoreContainsParams != null && manifestEntry.remoteName.AsSpan().ContainsAny(ignoreContainsParams))
401+
{
402+
continue;
403+
}
404+
390405
// Get relative path based on extension
391406
bool isUseRemoteName = string.IsNullOrEmpty(manifestEntry.localName);
392407
string actualName = isUseRemoteName ? manifestEntry.remoteName : manifestEntry.localName;

0 commit comments

Comments
 (0)