Skip to content

Commit 5cd5e4b

Browse files
authored
Preview 1.82.16 Hotfix Release (#679)
# What's changed? - 1.82.16 - **[Fix]** Errors when updating game that uses HDiff, by @neon-nyan - **[Imp]** Update dependencies, by @neon-nyan - **[Imp]** Reduce CPU overhead by swapping ``SoftwareBitmap`` to ``CanvasDevice`` and ``CanvasBitmap`` to draw video frames while "Acrylic Effect" mode enabled. - This reduces CPU overhead by removing routines to copy the video frames from software-based ``SoftwareBitmap``, and instead use Direct3D-based ``CanvasBitmap`` as the frame source. - However, this improvement still runs single-threaded due to the copy routine still being done on the same thread as the UI thread. - **[Imp]** Execute metadata config download and loading in parallel. - Instead of running the metadata download/update/load routine sequentially, the process will now be running in parallel at the same time. Making the metadata loading runs faster. - **[Imp]** Reduce UI hangs while switching between regions. ### Templates <details> <summary>Changelog Prefixes</summary> ``` **[New]** **[Imp]** **[Fix]** **[Loc]** **[Doc]** ``` </details>
2 parents b63b8d3 + 65bb262 commit 5cd5e4b

File tree

159 files changed

+2684
-2148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+2684
-2148
lines changed

.github/workflows/vt-scan-releases.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ jobs:
88
virustotal:
99
runs-on: ubuntu-latest
1010
steps:
11-
-
12-
name: VirusTotal Scan
11+
- name: VirusTotal Scan Executables
1312
uses: crazy-max/ghaction-virustotal@v4
1413
with:
1514
vt_api_key: ${{ secrets.VT_API_KEY }}
1615
update_release_body: true
1716
github_token: ${{ secrets.GITHUB_TOKEN }}
1817
files: |
1918
*.exe
20-
*.7z
19+
20+
- name: VirusTotal Scan Archive
21+
uses: crazy-max/ghaction-virustotal@v4
22+
with:
23+
vt_api_key: ${{ secrets.VT_API_KEY }}
24+
update_release_body: true
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
files: |
27+
*.7z

CollapseLauncher/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs args)
9191
WindowUtility.CurrentAppWindow!.TitleBar!.ButtonForegroundColor = color;
9292
WindowUtility.CurrentAppWindow!.TitleBar!.ButtonInactiveBackgroundColor = color;
9393

94-
if (WindowUtility.CurrentWindow!.Content is not null and FrameworkElement frameworkElement)
94+
if (WindowUtility.CurrentWindow!.Content is FrameworkElement frameworkElement)
9595
frameworkElement.RequestedTheme = isThemeLight ? ElementTheme.Light : ElementTheme.Dark;
9696
};
9797

CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private async ValueTask CheckAsset(CacheAsset asset, List<CacheAsset> returnAsse
161161
}
162162
}
163163

164-
private void AddGenericCheckAsset(CacheAsset asset, CacheAssetStatus assetStatus, List<CacheAsset> returnAsset, byte[] localCRC, byte[] remoteCRC)
164+
private void AddGenericCheckAsset(CacheAsset asset, CacheAssetStatus assetStatus, List<CacheAsset> returnAsset, byte[] localCrc, byte[] remoteCrc)
165165
{
166166
// Increment the count and total size
167167
lock (this)
@@ -187,8 +187,8 @@ private void AddGenericCheckAsset(CacheAsset asset, CacheAssetStatus assetStatus
187187
asset.DataType,
188188
Path.GetDirectoryName(asset.N),
189189
asset.CS,
190-
localCRC,
191-
remoteCRC
190+
localCrc,
191+
remoteCrc
192192
))
193193
);
194194
}

CollapseLauncher/Classes/CachesManagement/Honkai/HonkaiCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private async Task<bool> CheckRoutine()
5959
// Step 2: Start assets checking
6060
UpdateAssetIndex = await Check(AssetIndex, Token!.Token);
6161

62-
// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be update.
62+
// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be updated.
6363
// either way, returns false.
6464
return SummarizeStatusAndProgress(
6565
UpdateAssetIndex,

CollapseLauncher/Classes/CachesManagement/StarRail/StarRailCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private async Task<bool> CheckRoutine()
4646
// Step 2: Start assets checking
4747
UpdateAssetIndex = await Check(AssetIndex, Token.Token);
4848

49-
// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be update.
49+
// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be updated.
5050
// either way, returns false.
5151
return SummarizeStatusAndProgress(
5252
UpdateAssetIndex,

CollapseLauncher/Classes/EventsManagement/EventsHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// ReSharper disable SwitchStatementHandlesSomeKnownEnumValuesWithDefault
1818
// ReSharper disable IdentifierTypo
1919
// ReSharper disable PartialTypeWithSinglePart
20+
// ReSharper disable UnusedMember.Global
2021

2122
namespace CollapseLauncher
2223
{
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
using System.Threading;
4+
using System.Threading.Tasks;
5+
// ReSharper disable UnusedMember.Global
6+
7+
#nullable enable
8+
namespace CollapseLauncher.Extension
9+
{
10+
public delegate ConfiguredTaskAwaitable<TResult?> ActionTimeoutTaskAwaitableCallback<TResult>(CancellationToken token);
11+
12+
internal static partial class TaskExtensions
13+
{
14+
internal static Task<TResult?>
15+
WaitForRetryAsync<TResult>(this ActionTimeoutTaskAwaitableCallback<TResult?> funcCallback,
16+
int? timeout = null,
17+
int? timeoutStep = null,
18+
int? retryAttempt = null,
19+
ActionOnTimeOutRetry? actionOnRetry = null,
20+
CancellationToken fromToken = default)
21+
=> WaitForRetryAsync(() => funcCallback, timeout, timeoutStep, retryAttempt, actionOnRetry, fromToken);
22+
23+
internal static async Task<TResult?>
24+
WaitForRetryAsync<TResult>(Func<ActionTimeoutTaskAwaitableCallback<TResult?>> funcCallback,
25+
int? timeout = null,
26+
int? timeoutStep = null,
27+
int? retryAttempt = null,
28+
ActionOnTimeOutRetry? actionOnRetry = null,
29+
CancellationToken fromToken = default)
30+
=> await WaitForRetryAsync(funcCallback.AsTaskCallback,
31+
timeout,
32+
timeoutStep,
33+
retryAttempt,
34+
actionOnRetry,
35+
fromToken);
36+
37+
private static ActionTimeoutTaskCallback<TResult?> AsTaskCallback<TResult>(this Func<ActionTimeoutTaskAwaitableCallback<TResult?>> func) =>
38+
async ctx =>
39+
{
40+
ActionTimeoutTaskAwaitableCallback<TResult?> callback = func.Invoke();
41+
ConfiguredTaskAwaitable<TResult?> callbackAwaitable = callback.Invoke(ctx);
42+
return await callbackAwaitable;
43+
};
44+
}
45+
}

CollapseLauncher/Classes/Extension/TaskExtensions.cs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,38 @@
22
using System;
33
using System.Threading;
44
using System.Threading.Tasks;
5+
// ReSharper disable UnusedMember.Global
56

67
#nullable enable
78
namespace CollapseLauncher.Extension
89
{
9-
public delegate Task<TResult?> ActionTimeoutValueTaskCallback<TResult>(CancellationToken token);
10+
public delegate Task<TResult?> ActionTimeoutTaskCallback<TResult>(CancellationToken token);
1011
public delegate void ActionOnTimeOutRetry(int retryAttemptCount, int retryAttemptTotal, int timeOutSecond, int timeOutStep);
11-
internal static class TaskExtensions
12+
13+
internal static partial class TaskExtensions
1214
{
1315
internal const int DefaultTimeoutSec = 10;
1416
internal const int DefaultRetryAttempt = 5;
1517

16-
internal static async Task AsTaskAndDoAction<TResult>(this Task<TResult?> taskResult, Action<TResult?> doAction)
17-
{
18-
TResult? result = await taskResult;
19-
doAction(result);
20-
}
21-
22-
internal static async Task<TResult?> WaitForRetryAsync<TResult>(this ActionTimeoutValueTaskCallback<TResult?> funcCallback, int? timeout = null,
23-
int? timeoutStep = null, int? retryAttempt = null, ActionOnTimeOutRetry? actionOnRetry = null, CancellationToken fromToken = default)
18+
internal static async Task<TResult?>
19+
WaitForRetryAsync<TResult>(this ActionTimeoutTaskCallback<TResult?> funcCallback,
20+
int? timeout = null,
21+
int? timeoutStep = null,
22+
int? retryAttempt = null,
23+
ActionOnTimeOutRetry? actionOnRetry = null,
24+
CancellationToken fromToken = default)
2425
=> await WaitForRetryAsync(() => funcCallback, timeout, timeoutStep, retryAttempt, actionOnRetry, fromToken);
2526

26-
internal static async Task<TResult?> WaitForRetryAsync<TResult>(Func<ActionTimeoutValueTaskCallback<TResult?>> funcCallback, int? timeout = null,
27-
int? timeoutStep = null, int? retryAttempt = null, ActionOnTimeOutRetry? actionOnRetry = null, CancellationToken fromToken = default)
27+
internal static async Task<TResult?>
28+
WaitForRetryAsync<TResult>(Func<ActionTimeoutTaskCallback<TResult?>> funcCallback,
29+
int? timeout = null,
30+
int? timeoutStep = null,
31+
int? retryAttempt = null,
32+
ActionOnTimeOutRetry? actionOnRetry = null,
33+
CancellationToken fromToken = default)
2834
{
29-
timeout ??= DefaultTimeoutSec;
30-
timeoutStep ??= 0;
31-
35+
timeout ??= DefaultTimeoutSec;
36+
timeoutStep ??= 0;
3237
retryAttempt ??= DefaultRetryAttempt;
3338

3439
int retryAttemptCurrent = 1;
@@ -44,7 +49,7 @@ internal static async Task AsTaskAndDoAction<TResult>(this Task<TResult?> taskRe
4449
innerCancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(timeout ?? DefaultTimeoutSec));
4550
consolidatedToken = CancellationTokenSource.CreateLinkedTokenSource(innerCancellationToken.Token, fromToken);
4651

47-
ActionTimeoutValueTaskCallback<TResult?> delegateCallback = funcCallback();
52+
ActionTimeoutTaskCallback<TResult?> delegateCallback = funcCallback();
4853
return await delegateCallback(consolidatedToken.Token);
4954
}
5055
catch (OperationCanceledException) when (fromToken.IsCancellationRequested) { throw; }

CollapseLauncher/Classes/Extension/UIElementExtensions.UnsafeAccessorExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ internal static partial class UIElementExtensions
2020
/// </summary>
2121
/// <param name="element">The <seealso cref="UIElement"/> member of an element</param>
2222
/// <param name="inputCursor">The cursor you want to set. Use <see cref="InputSystemCursor.Create"/> to choose the cursor you want to set.</param>
23-
internal static ref T WithCursor<T>(this T element, InputCursor inputCursor) where T : UIElement
23+
internal static T WithCursor<T>(this T element, InputCursor inputCursor) where T : UIElement
2424
{
2525
element.SetCursor(inputCursor);
26-
return ref Unsafe.AsRef(ref element);
26+
return element;
2727
}
2828
}
2929
}

0 commit comments

Comments
 (0)