Skip to content

Commit

Permalink
Move API debug routines to its own method + Bump version
Browse files Browse the repository at this point in the history
FUCKIN HELL I FORGOR TO BUMP A<:"D>S :"T#EP{}LR <L:W<
  • Loading branch information
neon-nyan committed Jun 25, 2024
1 parent 8e56418 commit 66953e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected override async Task LoadLauncherGameResource(ActionOnTimeOutRetry? onT
ConvertPackageResources(sophonResourceData, hypResourceResponse?.Data?.LauncherPackages);

base.LauncherGameResource = sophonResourcePropRoot;

PerformDebugRoutines();
}

#region Convert Sdk Resources
Expand Down Expand Up @@ -159,31 +161,6 @@ private void ConvertPackageResources(RegionResourceGame sophonPackageResources,
.Where(x => x.GameDetail?.GameBiz?
.Equals(PresetConfig?.LauncherBizName, StringComparison.OrdinalIgnoreCase) ?? false))
{
#if !SIMULATEPRELOAD && SIMULATEAPPLYPRELOAD
// Assign and convert main game package (latest)
// WARNING!: SIMULATING PRELOAD AS MAIN PACKAGE
PackageResourceSections? hypMainPackageSection_Sim = hypRootPackage?.PreDownload?.CurrentVersion;
RegionResourceVersion sophonMainPackageSection_Sim = new RegionResourceVersion();
if (hypMainPackageSection_Sim != null)
ConvertHYPSectionToResourceVersion(ref hypMainPackageSection_Sim, ref sophonMainPackageSection_Sim);
sophonPackageResources.game.latest = sophonMainPackageSection_Sim;

// Assign and convert main game package (diff)
if (hypRootPackage?.PreDownload?.Patches != null)
{
sophonPackageResources.game.diffs = new List<RegionResourceVersion>();
foreach (PackageResourceSections hypMainDiffPackageSection_Sim in hypRootPackage.PreDownload.Patches)
{
if (hypMainDiffPackageSection_Sim != null)
{
PackageResourceSections hypMainDiffPackageSectionRef_Sim = hypMainDiffPackageSection_Sim;
RegionResourceVersion sophonResourceVersion_Sim = new RegionResourceVersion();
ConvertHYPSectionToResourceVersion(ref hypMainDiffPackageSectionRef_Sim, ref sophonResourceVersion_Sim);
sophonPackageResources.game.diffs.Add(sophonResourceVersion_Sim);
}
}
}
#else
// Assign and convert main game package (latest)
PackageResourceSections? hypMainPackageSection = hypRootPackage?.MainPackage?.CurrentVersion;
RegionResourceVersion sophonMainPackageSection = new RegionResourceVersion();
Expand All @@ -206,7 +183,6 @@ private void ConvertPackageResources(RegionResourceGame sophonPackageResources,
}
}
}
#endif
sophonPackageResources.pre_download_game = new RegionResourceLatest();

// Convert if preload entry is not empty or null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,37 +115,42 @@ protected LauncherApiBase(PresetConfig presetConfig, string gameName, string gam
}
}

#if DEBUG
if (LauncherGameResource.data.game.latest.decompressed_path != null)
PerformDebugRoutines();
}

protected virtual void PerformDebugRoutines()
{
#if DEBUG
if (LauncherGameResource?.data.game.latest.decompressed_path != null)
{
Logger.LogWriteLine($"Decompressed Path: {LauncherGameResource.data.game.latest.decompressed_path}",
LogType.Default, true);
}

if (LauncherGameResource.data.game.latest.path != null)
if (LauncherGameResource?.data.game.latest.path != null)
{
Logger.LogWriteLine($"ZIP Path: {LauncherGameResource.data.game.latest.path}", LogType.Default, true);
}

if (LauncherGameResource.data.pre_download_game?.latest?.decompressed_path != null)
if (LauncherGameResource?.data.pre_download_game?.latest?.decompressed_path != null)
{
Logger.LogWriteLine($"Decompressed Path Pre-load: {LauncherGameResource.data.pre_download_game?.latest?.decompressed_path}",
LogType.Default, true);
}

if (LauncherGameResource.data.sdk?.path != null)
if (LauncherGameResource?.data.sdk?.path != null)
{
Logger.LogWriteLine($"SDK found! Path: {LauncherGameResource.data.sdk.path}", LogType.Default, true);
}

if (LauncherGameResource.data.pre_download_game?.latest?.path != null)
if (LauncherGameResource?.data.pre_download_game?.latest?.path != null)
{
Logger.LogWriteLine($"ZIP Path Pre-load: {LauncherGameResource.data.pre_download_game?.latest?.path}",
LogType.Default, true);
}
#endif
#endif

#if SIMULATEPRELOAD && !SIMULATEAPPLYPRELOAD
#if SIMULATEPRELOAD && !SIMULATEAPPLYPRELOAD
if (LauncherGameResource.data.pre_download_game == null)
{
Logger.LogWriteLine("[FetchLauncherDownloadInformation] SIMULATEPRELOAD: Simulating Pre-load!");
Expand All @@ -164,18 +169,18 @@ protected LauncherApiBase(PresetConfig presetConfig, string gameName, string gam
}
LauncherGameResource.data.pre_download_game.diffs = simDataDiff;
}
#endif
#if !SIMULATEPRELOAD && SIMULATEAPPLYPRELOAD
#endif
#if !SIMULATEPRELOAD && SIMULATEAPPLYPRELOAD
if (LauncherGameResource.data.pre_download_game != null)
{
LauncherGameResource.data.game = LauncherGameResource.data.pre_download_game;
}
#endif
#endif

#if DEBUG
#if DEBUG
Logger.LogWriteLine("[LauncherApiBase::LoadLauncherGameResource] Loading game resource has been completed!",
LogType.Debug, true);
#endif
#endif
}

protected void EnsurePresetConfigNotNull()
Expand Down
2 changes: 1 addition & 1 deletion CollapseLauncher/CollapseLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Authors>$(Company). neon-nyan, Cry0, bagusnl, shatyuka, gablm.</Authors>
<Copyright>Copyright 2022-2024 $(Company)</Copyright>
<!-- Versioning -->
<Version>1.80.12</Version>
<Version>1.80.13</Version>
<LangVersion>preview</LangVersion>
<!-- Target Settings -->
<Platforms>x64</Platforms>
Expand Down

0 comments on commit 66953e7

Please sign in to comment.