Skip to content

Commit

Permalink
Senadina Repair/Delta/Cache Compatibility Fix by @neon-nyan (#408)
Browse files Browse the repository at this point in the history
* Add ``CastAs<T>()`` extension to ``IGameVersionCheck``

* Adding initial adjustment

* Implement Identifier getter

* Add temporary fix for Delta-patch

* Adjust changes based on Senadina changes

+ We are now using our backend service to provide information needed for repair process.

* Remove test codes

* Fix unexpected size and wrong file selected on CG

* ISTG, SHAAAPPHHH

+ Fix corresponding path for the language based CG

* Use new OOBE UI widely and fix some issue

* Ignore ``FBData`` on cache check

* (Qodana) Ignore "ThisAssembly.Constants" license check

Why does it suddenly lost its license file? i dunno

* (CodeQA) Fix problems in ProgressBase and HonkaiRepair::Fetch

---------

Co-authored-by: Kemal Setya Adhi <[email protected]>
  • Loading branch information
bagusnl and neon-nyan authored Mar 1, 2024
1 parent fddd54f commit a3228c4
Show file tree
Hide file tree
Showing 12 changed files with 516 additions and 275 deletions.
3 changes: 2 additions & 1 deletion CollapseLauncher/Classes/CachesManagement/Honkai/Check.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ private void CheckUnusedAssets(List<CacheAsset> assetIndex, List<CacheAsset> ret
{
if (!filePath.Contains("output_log") && !filePath.Contains("Crashes")
&& !filePath.Contains("Verify.txt") && !filePath.Contains("APM")
&& !filePath.Contains("asb.dat") && !assetIndex!.Exists(x => x!.ConcatPath == filePath))
&& !filePath.Contains("FBData") && !filePath.Contains("asb.dat")
&& !assetIndex!.Exists(x => x!.ConcatPath == filePath))
{
// Increment the total found count
_progressTotalCountFound++;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
using CollapseLauncher.Interfaces;
using Hi3Helper.EncTool.Parser.AssetMetadata;
using Hi3Helper.Preset;
using Microsoft.UI.Xaml;
using System.IO;
using System;

namespace CollapseLauncher.GameVersioning
{
internal class GameTypeHonkaiVersion : GameVersionBase, IGameVersionCheck
{
#region Statics
private static Version senadinaVersion = new Version(7, 3, 0);
#endregion

#region Public properties
public bool IsCurrentSenadinaVersion { get => GameVersionAPI.ToVersion() >= senadinaVersion; }
public bool IsPreloadSenadinaVersion { get => GameVersionAPIPreload.HasValue ? GameVersionAPIPreload.Value.ToVersion() >= senadinaVersion : false; }
#endregion

public GameTypeHonkaiVersion(UIElement parentUIElement, RegionResourceProp gameRegionProp, PresetConfigV2 gamePreset)
: base(parentUIElement, gameRegionProp, gamePreset)
{
Expand Down
361 changes: 229 additions & 132 deletions CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions CollapseLauncher/Classes/Interfaces/IGameVersionCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@

namespace CollapseLauncher.Interfaces
{
internal static class IGameVersionCheckExtension
{
/// <summary>
/// Casting the IGameVersionCheck as its origin or another version class.
/// </summary>
/// <typeparam name="TCast">The type of version class to cast</typeparam>
/// <returns>The version class to get casted</returns>
internal static TCast CastAs<TCast>(this IGameVersionCheck versionCheck)
where TCast : GameVersionBase, IGameVersionCheck => (TCast)versionCheck;
}

internal interface IGameVersionCheck
{
/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion CollapseLauncher/Classes/RepairManagement/Honkai/Check.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ private void GetUnusedAssetIndexList(List<string> catalog, List<FilePropertiesRe
bool isIncluded = catalog.Any(x => x.Equals(asset, StringComparison.OrdinalIgnoreCase));
bool isScreenshot = asset.Contains("ScreenShot", StringComparison.OrdinalIgnoreCase);
bool isLog = asset.EndsWith(".log", StringComparison.OrdinalIgnoreCase);
bool isDriver = asset.EndsWith(".sys", StringComparison.OrdinalIgnoreCase);

// Configuration related
bool isWebcaches = asset.Contains("webCaches", StringComparison.OrdinalIgnoreCase);
Expand Down Expand Up @@ -580,7 +581,7 @@ private void GetUnusedAssetIndexList(List<string> catalog, List<FilePropertiesRe
bool isDirectX = (filename.StartsWith("d3d", StringComparison.OrdinalIgnoreCase) && asset.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
|| filename.StartsWith("dxgi.dll", StringComparison.OrdinalIgnoreCase);

if (!isIncluded && !isIni && !isXMFBlocks && !isXMFBlocksVer && !isXMFMeta
if (!isIncluded && !isIni && !isDriver && !isXMFBlocks && !isXMFBlocksVer && !isXMFMeta
&& !isVersion && !isScreenshot && !isWebcaches && !isSDKcaches && !isLog
&& !isUSM && !isWwiseHeader && !isAudioManifest && !isBlockPatch
&& !isDeltaPatch && !isFlags && !isZip && !isDirectX)
Expand Down
371 changes: 241 additions & 130 deletions CollapseLauncher/Classes/RepairManagement/Honkai/Fetch.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions CollapseLauncher/CollapseLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
- MHYPLUGINSUPPORT : Enable miHoYo's patching system through launcher (EXPERIMENTAL)
-->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>DISABLE_XAML_GENERATED_MAIN;ENABLEHTTPREPAIR;DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION;PREVIEW;DUMPGIJSON;SIMULATEGIHDR;GSPBYPASSGAMERUNNING;MHYPLUGINSUPPORT;PROTOTYPEUI</DefineConstants>
<DefineConstants>DISABLE_XAML_GENERATED_MAIN;ENABLEHTTPREPAIR;DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION;PREVIEW;DUMPGIJSON;SIMULATEGIHDR;GSPBYPASSGAMERUNNING;MHYPLUGINSUPPORT</DefineConstants>
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>DISABLE_XAML_GENERATED_MAIN;ENABLEHTTPREPAIR;DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION;PREVIEW;MHYPLUGINSUPPORT;PROTOTYPEUI</DefineConstants>
<DefineConstants>DISABLE_XAML_GENERATED_MAIN;ENABLEHTTPREPAIR;DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION;PREVIEW;MHYPLUGINSUPPORT</DefineConstants>
<Optimize>True</Optimize>
<GitSkipCache>true</GitSkipCache>
<DebugType>portable</DebugType>
Expand Down
4 changes: 0 additions & 4 deletions CollapseLauncher/XAMLs/MainApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ public void InitializeWindowProperties(bool startOOBE = false)
SetLegacyTitleBarColor();
m_presenter.IsResizable = false;
m_presenter.IsMaximizable = false;
#if PROTOTYPEUI
rootFrame.Navigate(typeof(Pages.OOBE.OOBEStartUpMenu), null, new DrillInNavigationTransitionInfo());
#else
rootFrame.Navigate(typeof(StartupLanguageSelect), null, new DrillInNavigationTransitionInfo());
#endif
}
else
StartMainPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Click="NextPageButton_Click"
IsEnabled="False"
Opacity="0"
Style="{ThemeResource TransparentDefaultButtonStyle}">
<Button.OpacityTransition>
Expand Down
2 changes: 1 addition & 1 deletion Hi3Helper.EncTool
15 changes: 14 additions & 1 deletion Hi3Helper.EncTool.Test/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
using Hi3Helper.EncTool.Parser.AssetMetadata;
using Hi3Helper.Data;
using Hi3Helper.EncTool.Parser.AssetMetadata;
using Hi3Helper.EncTool.Parser.Senadina;
using Hi3Helper.Http;
using System.Buffers;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;

namespace Hi3Helper.EncTool.Test
{
internal class Program
{


static async Task Main(string[] args)
{
#region unused

using (SRMetadata srm = new SRMetadata("https://globaldp-prod-os01.starrails.com/query_dispatch", "3a57430d8d",
"?version={0}{1}&t={2}&language_type=3&platform_type=3&channel_id=1&sub_channel_id=1&is_new_format=1",
"?version={0}{1}&t={2}&uid=0&language_type=3&platform_type=3&dispatch_seed={3}&channel_id=1&sub_channel_id=1&is_need_url=1",
Expand Down Expand Up @@ -83,6 +95,7 @@ static async Task Main(string[] args)
}
}
*/
#endregion
}
}
}
4 changes: 3 additions & 1 deletion qodana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ dependencyIgnores:
- name: "ColorCode.WinUI"
# Microsoft...
- name: "System.CommandLine"
- name: "System.CommandLine.NamingConventionBinder"
- name: "System.CommandLine.NamingConventionBinder"
# huh?
- name: "ThisAssembly.Constants"

0 comments on commit a3228c4

Please sign in to comment.