Skip to content

Commit cd74667

Browse files
authored
Stable 1.83.17 Hotfix (#874)
![UpdateIsAvailable-Campaign](https://github.com/user-attachments/assets/5c5df62c-8570-4018-b6e7-66d5decf8278) # What's changed? - 1.83.17 - **[HSR][Fix]** Crash due to Missing URLs on Audio and Video files while performing Game Repair, by @neon-nyan - **[Plugin][Fix]** File URL formatting and ensure successful HTTP response in plugin, by @Cryotechnic - **[Sophon][Fix]** Excessive File Package Size on Preload, by @Cryotechnic - **[Sophon][Fix]** Incorrect state display based on preload status, by @Cryotechnic - **[Imp]** Update WindowsAppSDK from v1.8 to v2.0 build **Full Changelog**: CL-v1.83.16...CL-v1.83.17 # Code Signing Policy > Free code signing provided by [SignPath.io], certificate by [SignPath Foundation] - This program will not transfer any information to other networked systems. - Read our full [**Privacy Policy**](https://github.com/CollapseLauncher/Collapse/blob/main/PRIVACY.md) - Also read our [**Third Party Notices**](https://github.com/CollapseLauncher/Collapse/blob/main/THIRD_PARTY_NOTICES.md) for license used by third party libraries that we use. [SignPath Foundation]:https://signpath.org [SignPath.io]:https://signpath.io
2 parents 727914e + 2640d80 commit cd74667

36 files changed

Lines changed: 581 additions & 413 deletions

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

Lines changed: 24 additions & 4 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)
@@ -653,8 +654,9 @@ protected virtual async Task StartPackageUpdateSophon(GameInstallStateEnum gameS
653654
ResetStatusAndProgress();
654655

655656
// Set the progress bar to indetermined
656-
IsSophonInUpdateMode = !isPreloadMode;
657-
Status.IsIncludePerFileIndicator = !isPreloadMode;
657+
IsSophonInUpdateMode = !isPreloadMode;
658+
IsSophonInPreloadVerifyMode = isPreloadMode && _isSophonPreloadCompleted;
659+
Status.IsIncludePerFileIndicator = !isPreloadMode;
658660
Status.IsProgressPerFileIndetermined = true;
659661
Status.IsProgressAllIndetermined = true;
660662
UpdateStatus();
@@ -867,8 +869,8 @@ await x.GetDownloadedPreloadSize(
867869
Status.IsProgressPerFileIndetermined = false;
868870
Status.IsProgressAllIndetermined = false;
869871
Status.ActivityStatus = $"{(IsSophonInUpdateMode && !isPreloadMode
870-
? Locale.Lang._Misc.UpdatingAndApplying
871-
: Locale.Lang._Misc.Downloading)}: {string.Format(Locale.Lang._Misc.PerFromTo, ProgressAllCountCurrent,
872+
? Locale.Lang?._Misc?.UpdatingAndApplying
873+
: isSophonPreloadCompleted ? Locale.Lang?._Misc?.Verifying : Locale.Lang?._Misc?.Downloading)}: {string.Format(Locale.Lang?._Misc?.PerFromTo ?? "", ProgressAllCountCurrent,
872874
ProgressAllCountTotal)}";
873875
UpdateStatus();
874876

@@ -1086,6 +1088,7 @@ private async Task TryGetAdditionalPackageForSophonDiff(HttpClient httpClient,
10861088
manifestPair.OtherSophonBuildData!.ManifestIdentityList
10871089
.Where(x => !string.IsNullOrEmpty(x.MatchingField) && !CommonSophonPackageMatchingFields.Contains(x.MatchingField, StringComparer.OrdinalIgnoreCase))
10881090
.Select(x => x.MatchingField!)
1091+
.Where(x => !IsVoicePackMatchingField(x))
10891092
.WhereMatchPattern(x => x, true, excludeMatchingFieldsPattern)
10901093
.ToList();
10911094

@@ -1266,6 +1269,23 @@ protected virtual int SophonGetHttpHandler()
12661269
return Math.Clamp(n, 4, 128);
12671270
}
12681271

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

12711291
#region Sophon Audio/Voice-Packs Locale Methods

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected virtual async Task ConfirmAdditionalPatchDataPackageFiles(SophonChunkM
159159

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

164165
if (otherManifestIdentity.Count == 0)
@@ -671,7 +672,7 @@ void UpdateCurrentDownloadStatus()
671672
string perFromToLocale = string.Format(Locale.Lang._Misc.PerFromTo,
672673
ProgressAllCountCurrent,
673674
ProgressAllCountTotal);
674-
Status.ActivityStatus = $"{Locale.Lang._Misc.Downloading}: {perFromToLocale}";
675+
Status.ActivityStatus = $"{(IsSophonInPreloadVerifyMode ? Locale.Lang?._Misc?.Verifying : Locale.Lang?._Misc?.Downloading)}: {perFromToLocale}";
675676
UpdateStatus();
676677
}
677678

CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public ObservableCollection<IAssetProperty> AssetEntry
169169
private const int RefreshInterval = 100;
170170

171171
public bool IsSophonInUpdateMode { get; protected set; }
172+
public bool IsSophonInPreloadVerifyMode { get; protected set; }
172173
protected bool IsAllowExtractCorruptZip { get; set; }
173174

174175

@@ -581,10 +582,9 @@ protected void UpdateSophonDownloadStatus(SophonAsset _)
581582
{
582583
Interlocked.Add(ref ProgressAllCountCurrent, 1);
583584
Status.ActivityStatus = $"{(IsSophonInUpdateMode
584-
? Locale.Lang._Misc.Updating
585-
: Locale.Lang._Misc.Downloading)}: {string.Format(Locale.Lang._Misc.PerFromTo, ProgressAllCountCurrent,
586-
ProgressAllCountTotal)}";
587-
585+
? Locale.Lang?._Misc?.Updating
586+
: IsSophonInPreloadVerifyMode ? Locale.Lang?._Misc?.Verifying : Locale.Lang?._Misc?.Downloading)}: {string.Format(Locale.Lang?._Misc?.PerFromTo ?? "", ProgressAllCountCurrent,
587+
ProgressAllCountTotal)}";
588588
UpdateStatus();
589589
}
590590

@@ -1341,8 +1341,8 @@ protected virtual async Task RunDownloadTask(long assetSize,
13411341
if (isUseSelfSpeedLimiter)
13421342
{
13431343
// Create the speed limiter instance and register the listener
1344-
downloadSpeedLimiter = DownloadSpeedLimiter.CreateInstance(LauncherConfig.DownloadSpeedLimitCached);
1345-
LauncherConfig.DownloadSpeedLimitChanged += downloadSpeedLimiter.GetListener();
1344+
// downloadSpeedLimiter = DownloadSpeedLimiter.CreateInstance(LauncherConfig.DownloadSpeedLimitCached);
1345+
// LauncherConfig.DownloadSpeedLimitChanged += downloadSpeedLimiter.GetListener();
13461346
}
13471347

13481348
try
@@ -1375,7 +1375,7 @@ await downloadClient.DownloadAsync(assetURL,
13751375
// If the self speed listener is used, then unregister the listener
13761376
if (isUseSelfSpeedLimiter && downloadSpeedLimiter != null)
13771377
{
1378-
LauncherConfig.DownloadSpeedLimitChanged -= downloadSpeedLimiter.GetListener();
1378+
// LauncherConfig.DownloadSpeedLimitChanged -= downloadSpeedLimiter.GetListener();
13791379
}
13801380
}
13811381
}

CollapseLauncher/Classes/Plugins/PluginInfo.Update.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ async ValueTask Impl(PluginManifestAssetInfo asset, CancellationToken innerToken
325325
{
326326
string filePath = Path.Combine(outputDir, asset.FilePath);
327327
string? fileDir = Path.GetDirectoryName(filePath);
328-
string fileUrl = cdnBaseUrl.CombineUrlFromString(asset.FilePath);
328+
string fileUrl = cdnBaseUrl.CombineUrlFromString(asset.FilePath.Replace('\\', '/'));
329329

330330
if (!string.IsNullOrEmpty(fileDir))
331331
{
@@ -350,6 +350,7 @@ async ValueTask Impl(PluginManifestAssetInfo asset, CancellationToken innerToken
350350
// ReSharper disable once AccessToDisposedClosure
351351
// Reason: The httpClient will never get disposed until the method is done being executed.
352352
await httpClient.GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead, innerToken);
353+
response.EnsureSuccessStatusCode();
353354
await using Stream responseStream = await response.Content.ReadAsStreamAsync(innerToken);
354355
await using FileStream fileStream = File.Create(filePath);
355356

CollapseLauncher/Classes/RepairManagement/StarRailV2/StarRailPersistentRefResult.FinalizeFetch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public async Task FinalizeCacheFetchAsync(StarRailRepairV2 instance,
6161
tempStream.Position = 0;
6262

6363
// -- Parse manifest and get the first asset from stock metadata
64-
StarRailAssetSignaturelessMetadata metadataLuaV = new(".bytes");
64+
StarRailAssetBytesSignaturelessMetadata metadataLuaV = new();
6565
await metadataLuaV.ParseAsync(tempStream, true, token);
6666

6767
// -- Get stock dictionary asset

CollapseLauncher/Classes/RepairManagement/StarRailV2/StarRailPersistentRefResult.GetPersistentFiles.cs

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public List<FilePropertiesRemote> GetPersistentFiles(
9797
BaseDirs.StreamingVideo,
9898
BaseDirs.PersistentVideo,
9999
BaseUrls.Video,
100-
BaseUrls.Video,
100+
BaseUrls.VideoPersistent,
101101
true,
102102
fileList,
103103
unusedAssets,
@@ -111,7 +111,7 @@ public List<FilePropertiesRemote> GetPersistentFiles(
111111
BaseDirs.StreamingAudio,
112112
BaseDirs.PersistentAudio,
113113
BaseUrls.Audio,
114-
BaseUrls.Audio,
114+
BaseUrls.AudioPersistent,
115115
true,
116116
fileList,
117117
unusedAssets,
@@ -141,6 +141,34 @@ public List<FilePropertiesRemote> GetPersistentFiles(
141141
Metadata.RawResV.DataList);
142142
}
143143

144+
if (Metadata.DesignV != null)
145+
{
146+
AddAdditionalAssets(gameDirPath,
147+
BaseDirs.StreamingDesignData,
148+
BaseDirs.PersistentDesignData,
149+
BaseUrls.DesignData,
150+
BaseUrls.DesignData,
151+
false,
152+
fileList,
153+
unusedAssets,
154+
oldDic,
155+
Metadata.DesignV.DataList);
156+
}
157+
158+
if (Metadata.NativeDataV != null)
159+
{
160+
AddAdditionalAssets(gameDirPath,
161+
BaseDirs.StreamingNativeData,
162+
BaseDirs.PersistentNativeData,
163+
BaseUrls.NativeData,
164+
BaseUrls.NativeData,
165+
false,
166+
fileList,
167+
unusedAssets,
168+
oldDic,
169+
Metadata.NativeDataV.DataList);
170+
}
171+
144172
if (Metadata.CacheLua != null)
145173
{
146174
AddAdditionalAssets(gameDirPath,
@@ -294,12 +322,13 @@ private static void AddAdditionalAssets<T>(
294322

295323
FilePropertiesRemote file = new()
296324
{
297-
RN = url,
298-
N = relPathInPersistent,
299-
S = asset.FileSize,
300-
CRCArray = asset.MD5Checksum,
301-
FT = StarRailRepairV2.DetermineFileTypeFromExtension(asset.Filename ?? ""),
302-
IsHasHashMark = isHashMarked
325+
RN = url,
326+
N = relPathInPersistent,
327+
S = asset.FileSize,
328+
CRCArray = asset.MD5Checksum,
329+
FT = StarRailRepairV2.DetermineFileTypeFromExtension(asset.Filename ?? ""),
330+
IsHasHashMark = isHashMarked,
331+
AssociatedObject = asset,
303332
};
304333
fileDic.TryAdd(relPathInPersistent, file);
305334
fileList.Add(file);

0 commit comments

Comments
 (0)