Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f6bb961
Huge CodeQA
neon-nyan Jan 18, 2025
bf43788
Huge CodeQA (pt. 2)
neon-nyan Jan 18, 2025
5444f36
Fix compilation error
neon-nyan Jan 18, 2025
cf8e639
Huge CodeQA (pt. 3)
neon-nyan Jan 19, 2025
d449d81
Use per-class JSONContext
neon-nyan Jan 19, 2025
778c70c
Rename JSONContext -> JsonContext
neon-nyan Jan 19, 2025
144fea7
Update H.NotifyIcon to support latest CsWinRT
neon-nyan Jan 19, 2025
dd36d94
Make Api*HttpClient always be non-nullable
neon-nyan Jan 19, 2025
455c1ad
Update Static Libs
neon-nyan Jan 19, 2025
ec7b39b
Update Hi3Helper.Sophon
neon-nyan Jan 20, 2025
10d66fd
Update Microsoft.Web.WebView2
neon-nyan Jan 20, 2025
88490ec
Update WindowsAppSDK and Xaml.Behaviors.WinUI.Managed
neon-nyan Jan 20, 2025
5c6d361
Use ILCompiler 9.0.1 for trim-sensitive submodules
neon-nyan Jan 20, 2025
18d9027
Update Hi3Helper.Sophon
neon-nyan Jan 20, 2025
5362e33
Revert "Use ILCompiler 9.0.1 for trim-sensitive submodules"
neon-nyan Jan 20, 2025
f2b1688
Revert ILCompiler 9.0.1 changes
neon-nyan Jan 20, 2025
4f39b9e
[.NET Bug] Explicitly use JsonSerializerHelper due to extension bug
neon-nyan Jan 21, 2025
d1c8377
[QD] Update submodules before scan
bagusnl Jan 21, 2025
da94ade
[QD] Qodana-actions bug
bagusnl Jan 21, 2025
574669c
[QD] Try using same sm fetch command as github's
bagusnl Jan 21, 2025
8156a2c
Update Static Libs for AOT
neon-nyan Jan 21, 2025
7d9e69d
Review changes
neon-nyan Jan 22, 2025
a364f57
Fix throw on initial load for shared hash
neon-nyan Jan 22, 2025
1e53521
Update and Fix AOT Static Library Errors
neon-nyan Jan 23, 2025
956cd2f
Update Hi3Helper.Win32
neon-nyan Jan 23, 2025
42bee49
Split GameVersionBase into several files
neon-nyan Jan 25, 2025
db67178
Allow the use of == operator override on IniValue
neon-nyan Jan 25, 2025
6590853
Fix null pointer on STORAGE_PROPERTY_QUERY buffer
neon-nyan Jan 25, 2025
4a73c65
Set AOT specific settings only on non-debug
neon-nyan Jan 25, 2025
6219845
Move GetGameState from GameApi to GameState
neon-nyan Jan 25, 2025
df0930c
Always ignore caching on GameVersionBase stateful properties
neon-nyan Jan 25, 2025
7289586
Simplified IsDiskPartitionExist check
neon-nyan Jan 25, 2025
42071a5
Allows ZZZ to use fallback region is server is not found
neon-nyan Jan 25, 2025
622a264
Always use ArrayPool on AssociateGameAndLauncherId
neon-nyan Jan 25, 2025
92344dd
Small CodeQA on PresetConfig
neon-nyan Jan 25, 2025
a1b64bd
CodeQA
neon-nyan Jan 25, 2025
33984df
Fix compile error on InnoSetupLogUpdate
neon-nyan Jan 25, 2025
5e95b7f
More CodeQA
neon-nyan Jan 25, 2025
5401d79
Revert Update packages.lock.json on InnoSetupHelper
neon-nyan Jan 25, 2025
9e599ec
Fix recursion on IniValue's Equals()
neon-nyan Jan 25, 2025
d671527
Use HttpClient max conn as per multip. of 1.5
neon-nyan Jan 26, 2025
29c46c3
[Hi3] Use SearchValues to ignore assets
neon-nyan Jan 26, 2025
7de3d15
CodeQA
neon-nyan Jan 26, 2025
ca49da5
Specify .NET SDK version
bagusnl Jan 26, 2025
b2de43e
Refresh package.lock.json
bagusnl Jan 26, 2025
1343fce
CodeQA
bagusnl Jan 26, 2025
a0af4fe
NuGet changes
bagusnl Jan 26, 2025
c1a666e
CodeQA (again)
neon-nyan Jan 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions CollapseLauncher/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:conv="using:CollapseLauncher.Pages"
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
Expand Down Expand Up @@ -2190,13 +2189,13 @@
<!-- Force ShouldConstrainToRootBounds to True -->
<!-- Fix https://github.com/microsoft/microsoft-ui-xaml/issues/8657 -->
<interactivity:Interaction.Behaviors>
<interactions:DataTriggerBehavior Binding="{Binding ShouldConstrainToRootBounds, ElementName=Popup}"
<interactivity:DataTriggerBehavior Binding="{Binding ShouldConstrainToRootBounds, ElementName=Popup}"
ComparisonCondition="Equal"
Value="False">
<interactions:ChangePropertyAction PropertyName="ShouldConstrainToRootBounds"
<interactivity:ChangePropertyAction PropertyName="ShouldConstrainToRootBounds"
TargetObject="{Binding ElementName=Popup}"
Value="True" />
</interactions:DataTriggerBehavior>
</interactivity:DataTriggerBehavior>
</interactivity:Interaction.Behaviors>
<Border x:Name="PopupBorder"
Margin="0,-0.5,0,-1"
Expand Down Expand Up @@ -2627,13 +2626,13 @@
<!-- Force ShouldConstrainToRootBounds to True -->
<!-- Fix https://github.com/microsoft/microsoft-ui-xaml/issues/8657 -->
<interactivity:Interaction.Behaviors>
<interactions:DataTriggerBehavior Binding="{Binding ShouldConstrainToRootBounds, ElementName=Popup}"
<interactivity:DataTriggerBehavior Binding="{Binding ShouldConstrainToRootBounds, ElementName=Popup}"
ComparisonCondition="Equal"
Value="False">
<interactions:ChangePropertyAction PropertyName="ShouldConstrainToRootBounds"
<interactivity:ChangePropertyAction PropertyName="ShouldConstrainToRootBounds"
TargetObject="{Binding ElementName=Popup}"
Value="True" />
</interactions:DataTriggerBehavior>
</interactivity:DataTriggerBehavior>
</interactivity:Interaction.Behaviors>
<Border x:Name="PopupBorder"
Margin="0,-0.5,0,-1"
Expand Down
11 changes: 7 additions & 4 deletions CollapseLauncher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@
using Windows.UI;
using static CollapseLauncher.InnerLauncherConfig;
using static Hi3Helper.Logger;
// ReSharper disable SwitchStatementMissingSomeEnumCasesNoDefault
// ReSharper disable CommentTypo
// ReSharper disable StringLiteralTypo

namespace CollapseLauncher
{
public partial class App
{
public static bool IsAppKilled = false;
public static bool IsAppKilled { get; set; } = false;

public App()
{
if (DebugSettings != null)
{
#if ENABLEFRAMECOUNTER
#if ENABLEFRAMECOUNTER
DebugSettings.EnableFrameRateCounter = true;
#endif
#endif
#if DEBUG
DebugSettings.LayoutCycleDebugBreakLevel = LayoutCycleDebugBreakLevel.High;
DebugSettings.LayoutCycleTracingLevel = LayoutCycleTracingLevel.High;
Expand Down Expand Up @@ -68,7 +71,7 @@ public App()
RequestedTheme = IsAppThemeLight ? ApplicationTheme.Light : ApplicationTheme.Dark;
PInvoke.SetPreferredAppMode(PInvoke.ShouldAppsUseDarkMode() ? PreferredAppMode.AllowDark : PreferredAppMode.Default);

this.InitializeComponent();
InitializeComponent();
}

protected override void OnLaunched(LaunchActivatedEventArgs args)
Expand Down
103 changes: 53 additions & 50 deletions CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Threading.Tasks;
using static Hi3Helper.Locale;
using static Hi3Helper.Logger;
// ReSharper disable CommentTypo

namespace CollapseLauncher
{
Expand All @@ -18,20 +19,20 @@ internal partial class HonkaiCache
private async Task<List<CacheAsset>> Check(List<CacheAsset> assetIndex, CancellationToken token)
{
// Initialize asset index for the return
List<CacheAsset> returnAsset = new List<CacheAsset>();
List<CacheAsset> returnAsset = [];

// Set Indetermined status as false
_status.IsProgressAllIndetermined = false;
Status.IsProgressAllIndetermined = false;

// Show the asset entry panel
_status.IsAssetEntryPanelShow = true;
Status.IsAssetEntryPanelShow = true;

try
{
// Create the cache directory if it doesn't exist
if (!Directory.Exists(_gamePath))
if (!Directory.Exists(GamePath))
{
Directory.CreateDirectory(_gamePath!);
Directory.CreateDirectory(GamePath!);
}

// Check for unused files
Expand All @@ -40,7 +41,7 @@ private async Task<List<CacheAsset>> Check(List<CacheAsset> assetIndex, Cancella
// Do check in parallelization.
await Parallel.ForEachAsync(assetIndex!, new ParallelOptions
{
MaxDegreeOfParallelism = _threadCount,
MaxDegreeOfParallelism = ThreadCount,
CancellationToken = token
}, async (asset, localToken) =>
{
Expand All @@ -59,7 +60,7 @@ private async Task<List<CacheAsset>> Check(List<CacheAsset> assetIndex, Cancella
private void CheckUnusedAssets(List<CacheAsset> assetIndex, List<CacheAsset> returnAsset)
{
// Directory info and if the directory doesn't exist, return
DirectoryInfo directoryInfo = new DirectoryInfo(_gamePath);
DirectoryInfo directoryInfo = new DirectoryInfo(GamePath);
if (!directoryInfo.Exists)
{
return;
Expand All @@ -71,52 +72,54 @@ private void CheckUnusedAssets(List<CacheAsset> assetIndex, List<CacheAsset> ret
{
string filePath = fileInfo.FullName;

if (!filePath.Contains("output_log", StringComparison.OrdinalIgnoreCase)
&& !filePath.Contains("Crashes", StringComparison.OrdinalIgnoreCase)
&& !filePath.Contains("Verify.txt", StringComparison.OrdinalIgnoreCase)
&& !filePath.Contains("APM", StringComparison.OrdinalIgnoreCase)
&& !filePath.Contains("FBData", StringComparison.OrdinalIgnoreCase)
&& !filePath.Contains("asb.dat", StringComparison.OrdinalIgnoreCase)
&& !assetIndex.Exists(x => x.ConcatPath == fileInfo.FullName))
if (filePath.Contains("output_log", StringComparison.OrdinalIgnoreCase)
Comment thread
neon-nyan marked this conversation as resolved.
Outdated
|| filePath.Contains("Crashes", StringComparison.OrdinalIgnoreCase)
|| filePath.Contains("Verify.txt", StringComparison.OrdinalIgnoreCase)
|| filePath.Contains("APM", StringComparison.OrdinalIgnoreCase)
|| filePath.Contains("FBData", StringComparison.OrdinalIgnoreCase)
|| filePath.Contains("asb.dat", StringComparison.OrdinalIgnoreCase)
|| assetIndex.Exists(x => x.ConcatPath == fileInfo.FullName))
{
// Increment the total found count
_progressAllCountFound++;

// Add asset to the returnAsset
CacheAsset asset = new CacheAsset()
{
BasePath = Path.GetDirectoryName(filePath),
N = Path.GetFileName(filePath),
DataType = CacheAssetType.Unused,
CS = fileInfo.Length,
CRC = null,
Status = CacheAssetStatus.Unused,
IsUseLocalPath = true
};
returnAsset!.Add(asset);

// Add to asset entry display
Dispatch(() => AssetEntry!.Add(new AssetProperty<CacheAssetType>(
asset.N,
asset.DataType,
asset.BasePath,
asset.CS,
null,
null
))
);

LogWriteLine($"File: {asset.ConcatPath} is unused!", LogType.Warning, true);
continue;
}

// Increment the total found count
ProgressAllCountFound++;

// Add asset to the returnAsset
CacheAsset asset = new CacheAsset
{
BasePath = Path.GetDirectoryName(filePath),
N = Path.GetFileName(filePath),
DataType = CacheAssetType.Unused,
CS = fileInfo.Length,
CRC = null,
Status = CacheAssetStatus.Unused,
IsUseLocalPath = true
};
returnAsset!.Add(asset);

// Add to asset entry display
Dispatch(() => AssetEntry!.Add(new AssetProperty<CacheAssetType>(
asset.N,
asset.DataType,
asset.BasePath,
asset.CS,
null,
null
))
);

LogWriteLine($"File: {asset.ConcatPath} is unused!", LogType.Warning, true);
}
}

private async ValueTask CheckAsset(CacheAsset asset, List<CacheAsset> returnAsset, CancellationToken token)
{
// Increment the count and update the status
Interlocked.Add(ref _progressAllCountCurrent, 1);
_status.ActivityStatus = string.Format(Lang!._CachesPage!.CachesStatusChecking!, asset!.DataType, asset.N);
_status.ActivityAll = string.Format(Lang._CachesPage.CachesTotalStatusChecking!, _progressAllCountCurrent, _progressAllCountTotal);
Interlocked.Add(ref ProgressAllCountCurrent, 1);
Status.ActivityStatus = string.Format(Lang!._CachesPage!.CachesStatusChecking!, asset!.DataType, asset.N);
Status.ActivityAll = string.Format(Lang._CachesPage.CachesTotalStatusChecking!, ProgressAllCountCurrent, ProgressAllCountTotal);

// Assign the file info.
FileInfo fileInfo = new FileInfo(asset.ConcatPath).EnsureNoReadOnly(out bool isExist);
Expand All @@ -136,15 +139,15 @@ private async ValueTask CheckAsset(CacheAsset asset, List<CacheAsset> returnAsse
}

// Skip CRC check if fast method is used
if (_useFastMethod)
if (UseFastMethod)
{
return;
}

// If above passes, then run the CRC check
await using FileStream fs = await NaivelyOpenFileStreamAsync(fileInfo, FileMode.Open, FileAccess.Read, FileShare.Read);
// Calculate the asset CRC (SHA1)
byte[] hashArray = await GetCryptoHashAsync<HMACSHA1>(fs, _gameSalt, true, true, token);
byte[] hashArray = await GetCryptoHashAsync<HMACSHA1>(fs, GameSalt, true, true, token);

// If the asset CRC doesn't match, then add the file to asset index.
if (!IsArrayMatch(asset.CRCArray, hashArray))
Expand All @@ -159,9 +162,9 @@ private void AddGenericCheckAsset(CacheAsset asset, CacheAssetStatus assetStatus
lock (this)
{
// Set Indetermined status as false
_status.IsProgressAllIndetermined = false;
_progressAllCountFound++;
_progressAllSizeFound += asset!.CS;
Status.IsProgressAllIndetermined = false;
ProgressAllCountFound++;
ProgressAllSizeFound += asset!.CS;
}

// Add file into asset index
Expand Down
Loading