Fix count for SwSh 1.3.2. + DLC

This commit is contained in:
nvbeusekom 2024-08-23 11:39:12 +02:00
parent 5b5a196bdb
commit eb9f8aef2f
4 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using pkNX.Structures;
@ -84,6 +85,7 @@ private static GameVersion GetGameFromPath(string romfs, string? exefs)
private const int FILECOUNT_SWSH_110 = 41951; // Ver. 1.1.0 (Galarian Slowpoke)
private const int FILECOUNT_SWSH_120 = 46867; // Ver. 1.2.0 (Isle of Armor)
private const int FILECOUNT_SWSH_130 = 50494; // Ver. 1.3.0 (Crown Tundra)
private const int FILECOUNT_SWSH_132 = 50517; // Ver. 1.3.0 (Crown Tundra)
private const int FILECOUNT_LA = 18_370;
private const int FILECOUNT_LA_101 = 18_371; // Ver. 1.0.1 (Day 1 Patch)
private const int FILECOUNT_LA_110 = 19_095; // Ver. 1.1.0 (Daybreak)
@ -97,7 +99,7 @@ private static GameVersion GetGameFromPath(string romfs, string? exefs)
private static GameVersion GetGameFromCount(int fileCount, string romfs, string? exefs)
{
string GetTitleID() => BitConverter.ToUInt64(File.ReadAllBytes(Path.Combine(exefs, "main.npdm")), 0x290).ToString("X16");
switch (fileCount)
{
case FILECOUNT_XY: return GameVersion.XY;
@ -132,6 +134,7 @@ private static GameVersion GetGameFromCount(int fileCount, string romfs, string?
case FILECOUNT_SWSH_110:
case FILECOUNT_SWSH_120:
case FILECOUNT_SWSH_130:
case FILECOUNT_SWSH_132:
{
if (exefs == null)
return GameVersion.SWSH;

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
namespace pkNX.Structures;
@ -59,7 +60,7 @@ public static T[] GetArray<T>(this ReadOnlySpan<byte> entries, FromBytesConstruc
if (entries.Length < size)
return [];
Debug.Assert(entries.Length % size == 0, "This data can't be split into equally sized entries with the provided slice size");
Debug.Assert(entries.Length % size == 0, "This data of size "+entries.Length+" can't be split into equally sized entries with the provided slice size " + size);
var array = new T[entries.Length / size];
for (int i = 0; i < entries.Length; i += size)

View File

@ -23,4 +23,11 @@
<ProjectReference Include="..\pkNX.Containers\pkNX.Containers.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FlatSharp.Compiler" Version="7.7.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>

View File

@ -45,6 +45,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FlatSharp.Compiler" Version="7.6.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FlatSharp.Runtime" Version="7.6.0" />
<PackageReference Include="FontAwesome.Sharp" Version="6.3.0" />
<PackageReference Include="PKHeX.Core" Version="24.5.5" />
</ItemGroup>