Skip to content

Commit 4825662

Browse files
committed
Exclude voice-pack matching fields
We now check standard language codes in addition to to `mini-xx-xx` formats introduced recently by HoYoVerse in 2.8.0 preload.
1 parent 41479dc commit 4825662

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

CollapseLauncher/Classes/InstallManagement/Base/InstallManagerBase.Sophon.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ private async Task ConfirmAdditionalInstallDataPackageFiles(
541541

542542
List<SophonManifestBuildIdentity> otherManifestIdentity = installManifestFirst.OtherSophonBuildData!.ManifestIdentityList
543543
.Where(x => !commonPackageMatchingFields.Contains(x.MatchingField, StringComparer.OrdinalIgnoreCase))
544+
.Where(x => x.MatchingField == null || !IsVoicePackMatchingField(x.MatchingField))
544545
.ToList();
545546

546547
if (otherManifestIdentity.Count == 0)
@@ -1086,6 +1087,7 @@ private async Task TryGetAdditionalPackageForSophonDiff(HttpClient
10861087
manifestPair.OtherSophonBuildData!.ManifestIdentityList
10871088
.Where(x => !string.IsNullOrEmpty(x.MatchingField) && !CommonSophonPackageMatchingFields.Contains(x.MatchingField, StringComparer.OrdinalIgnoreCase))
10881089
.Select(x => x.MatchingField!)
1090+
.Where(x => !IsVoicePackMatchingField(x))
10891091
.WhereMatchPattern(x => x, true, excludeMatchingFieldsPattern)
10901092
.ToList();
10911093

@@ -1266,6 +1268,23 @@ protected virtual int SophonGetHttpHandler()
12661268
return Math.Clamp(n, 4, 128);
12671269
}
12681270

1271+
private bool IsVoicePackMatchingField(string matchingField)
1272+
{
1273+
// Check regular locale code: zh-cn, en-us, etc.
1274+
if (IsValidLocaleCode(matchingField))
1275+
return true;
1276+
1277+
// Also check for "mini-xx-xx" format (e.g., mini-zh-cn, mini-en-us)
1278+
const string miniPrefix = "mini-";
1279+
if (matchingField.Length > miniPrefix.Length &&
1280+
matchingField.StartsWith(miniPrefix, StringComparison.OrdinalIgnoreCase))
1281+
{
1282+
return IsValidLocaleCode(matchingField.AsSpan(miniPrefix.Length));
1283+
}
1284+
1285+
return false;
1286+
}
1287+
12691288
#endregion
12701289

12711290
#region Sophon Audio/Voice-Packs Locale Methods

CollapseLauncher/Classes/InstallManagement/Base/InstallManagerBase.SophonPatch.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ protected virtual async Task ConfirmAdditionalPatchDataPackageFiles(SophonChunkM
160160

161161
List<SophonManifestPatchIdentity> otherManifestIdentity = patchManifest.OtherSophonPatchData!.ManifestIdentityList
162162
.Where(x => !CommonSophonPackageMatchingFields.Contains(x.MatchingField, StringComparer.OrdinalIgnoreCase))
163+
.Where(x => x.MatchingField == null || !IsVoicePackMatchingField(x.MatchingField))
163164
.ToList();
164165

165166
if (otherManifestIdentity.Count == 0)

0 commit comments

Comments
 (0)