Skip to content

Commit

Permalink
Preview 1.82.16 Hotfix Release (#679)
Browse files Browse the repository at this point in the history
# 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>
  • Loading branch information
neon-nyan authored Feb 3, 2025
2 parents b63b8d3 + 65bb262 commit 5cd5e4b
Show file tree
Hide file tree
Showing 159 changed files with 2,684 additions and 2,148 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/vt-scan-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ jobs:
virustotal:
runs-on: ubuntu-latest
steps:
-
name: VirusTotal Scan
- name: VirusTotal Scan Executables
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
update_release_body: true
github_token: ${{ secrets.GITHUB_TOKEN }}
files: |
*.exe
*.7z
- name: VirusTotal Scan Archive
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
update_release_body: true
github_token: ${{ secrets.GITHUB_TOKEN }}
files: |
*.7z
2 changes: 1 addition & 1 deletion CollapseLauncher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs args)
WindowUtility.CurrentAppWindow!.TitleBar!.ButtonForegroundColor = color;
WindowUtility.CurrentAppWindow!.TitleBar!.ButtonInactiveBackgroundColor = color;

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

Expand Down
6 changes: 3 additions & 3 deletions CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private async ValueTask CheckAsset(CacheAsset asset, List<CacheAsset> returnAsse
}
}

private void AddGenericCheckAsset(CacheAsset asset, CacheAssetStatus assetStatus, List<CacheAsset> returnAsset, byte[] localCRC, byte[] remoteCRC)
private void AddGenericCheckAsset(CacheAsset asset, CacheAssetStatus assetStatus, List<CacheAsset> returnAsset, byte[] localCrc, byte[] remoteCrc)
{
// Increment the count and total size
lock (this)
Expand All @@ -187,8 +187,8 @@ private void AddGenericCheckAsset(CacheAsset asset, CacheAssetStatus assetStatus
asset.DataType,
Path.GetDirectoryName(asset.N),
asset.CS,
localCRC,
remoteCRC
localCrc,
remoteCrc
))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private async Task<bool> CheckRoutine()
// Step 2: Start assets checking
UpdateAssetIndex = await Check(AssetIndex, Token!.Token);

// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be update.
// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be updated.
// either way, returns false.
return SummarizeStatusAndProgress(
UpdateAssetIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private async Task<bool> CheckRoutine()
// Step 2: Start assets checking
UpdateAssetIndex = await Check(AssetIndex, Token.Token);

// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be update.
// Step 3: Summarize and returns true if the assetIndex count != 0 indicates caches needs to be updated.
// either way, returns false.
return SummarizeStatusAndProgress(
UpdateAssetIndex,
Expand Down
1 change: 1 addition & 0 deletions CollapseLauncher/Classes/EventsManagement/EventsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// ReSharper disable SwitchStatementHandlesSomeKnownEnumValuesWithDefault
// ReSharper disable IdentifierTypo
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable UnusedMember.Global

namespace CollapseLauncher
{
Expand Down
45 changes: 45 additions & 0 deletions CollapseLauncher/Classes/Extension/TaskExtensions.TaskAwaitable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
// ReSharper disable UnusedMember.Global

#nullable enable
namespace CollapseLauncher.Extension
{
public delegate ConfiguredTaskAwaitable<TResult?> ActionTimeoutTaskAwaitableCallback<TResult>(CancellationToken token);

internal static partial class TaskExtensions
{
internal static Task<TResult?>
WaitForRetryAsync<TResult>(this ActionTimeoutTaskAwaitableCallback<TResult?> funcCallback,
int? timeout = null,
int? timeoutStep = null,
int? retryAttempt = null,
ActionOnTimeOutRetry? actionOnRetry = null,
CancellationToken fromToken = default)
=> WaitForRetryAsync(() => funcCallback, timeout, timeoutStep, retryAttempt, actionOnRetry, fromToken);

internal static async Task<TResult?>
WaitForRetryAsync<TResult>(Func<ActionTimeoutTaskAwaitableCallback<TResult?>> funcCallback,
int? timeout = null,
int? timeoutStep = null,
int? retryAttempt = null,
ActionOnTimeOutRetry? actionOnRetry = null,
CancellationToken fromToken = default)
=> await WaitForRetryAsync(funcCallback.AsTaskCallback,
timeout,
timeoutStep,
retryAttempt,
actionOnRetry,
fromToken);

private static ActionTimeoutTaskCallback<TResult?> AsTaskCallback<TResult>(this Func<ActionTimeoutTaskAwaitableCallback<TResult?>> func) =>
async ctx =>
{
ActionTimeoutTaskAwaitableCallback<TResult?> callback = func.Invoke();
ConfiguredTaskAwaitable<TResult?> callbackAwaitable = callback.Invoke(ctx);
return await callbackAwaitable;
};
}
}
37 changes: 21 additions & 16 deletions CollapseLauncher/Classes/Extension/TaskExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,38 @@
using System;
using System.Threading;
using System.Threading.Tasks;
// ReSharper disable UnusedMember.Global

#nullable enable
namespace CollapseLauncher.Extension
{
public delegate Task<TResult?> ActionTimeoutValueTaskCallback<TResult>(CancellationToken token);
public delegate Task<TResult?> ActionTimeoutTaskCallback<TResult>(CancellationToken token);
public delegate void ActionOnTimeOutRetry(int retryAttemptCount, int retryAttemptTotal, int timeOutSecond, int timeOutStep);
internal static class TaskExtensions

internal static partial class TaskExtensions
{
internal const int DefaultTimeoutSec = 10;
internal const int DefaultRetryAttempt = 5;

internal static async Task AsTaskAndDoAction<TResult>(this Task<TResult?> taskResult, Action<TResult?> doAction)
{
TResult? result = await taskResult;
doAction(result);
}

internal static async Task<TResult?> WaitForRetryAsync<TResult>(this ActionTimeoutValueTaskCallback<TResult?> funcCallback, int? timeout = null,
int? timeoutStep = null, int? retryAttempt = null, ActionOnTimeOutRetry? actionOnRetry = null, CancellationToken fromToken = default)
internal static async Task<TResult?>
WaitForRetryAsync<TResult>(this ActionTimeoutTaskCallback<TResult?> funcCallback,
int? timeout = null,
int? timeoutStep = null,
int? retryAttempt = null,
ActionOnTimeOutRetry? actionOnRetry = null,
CancellationToken fromToken = default)
=> await WaitForRetryAsync(() => funcCallback, timeout, timeoutStep, retryAttempt, actionOnRetry, fromToken);

internal static async Task<TResult?> WaitForRetryAsync<TResult>(Func<ActionTimeoutValueTaskCallback<TResult?>> funcCallback, int? timeout = null,
int? timeoutStep = null, int? retryAttempt = null, ActionOnTimeOutRetry? actionOnRetry = null, CancellationToken fromToken = default)
internal static async Task<TResult?>
WaitForRetryAsync<TResult>(Func<ActionTimeoutTaskCallback<TResult?>> funcCallback,
int? timeout = null,
int? timeoutStep = null,
int? retryAttempt = null,
ActionOnTimeOutRetry? actionOnRetry = null,
CancellationToken fromToken = default)
{
timeout ??= DefaultTimeoutSec;
timeoutStep ??= 0;

timeout ??= DefaultTimeoutSec;
timeoutStep ??= 0;
retryAttempt ??= DefaultRetryAttempt;

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

ActionTimeoutValueTaskCallback<TResult?> delegateCallback = funcCallback();
ActionTimeoutTaskCallback<TResult?> delegateCallback = funcCallback();
return await delegateCallback(consolidatedToken.Token);
}
catch (OperationCanceledException) when (fromToken.IsCancellationRequested) { throw; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ internal static partial class UIElementExtensions
/// </summary>
/// <param name="element">The <seealso cref="UIElement"/> member of an element</param>
/// <param name="inputCursor">The cursor you want to set. Use <see cref="InputSystemCursor.Create"/> to choose the cursor you want to set.</param>
internal static ref T WithCursor<T>(this T element, InputCursor inputCursor) where T : UIElement
internal static T WithCursor<T>(this T element, InputCursor inputCursor) where T : UIElement
{
element.SetCursor(inputCursor);
return ref Unsafe.AsRef(ref element);
return element;
}
}
}
Loading

0 comments on commit 5cd5e4b

Please sign in to comment.