Parse XboxOne/SX Title IDs (#897)

* Parse XboxOne/SX Title IDs

* Bump RedumpLib

* Fix build

* Don't use lists because net20
This commit is contained in:
Deterous
2025-10-13 09:14:50 +09:00
committed by GitHub
parent cd8b484ae3
commit e8d1567d07
12 changed files with 67 additions and 11 deletions

View File

@@ -9,6 +9,7 @@
- Move output file implementations to separate namespace
- Conditionally require state
- Replace "We" comments
- Parse XboxOne/SX Title IDs
### 3.5.0 (2025-10-10)

View File

@@ -44,7 +44,7 @@
<ItemGroup>
<PackageReference Include="SabreTools.CommandLine" Version="[1.3.2]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
</ItemGroup>
</Project>

View File

@@ -44,7 +44,7 @@
<ItemGroup>
<PackageReference Include="SabreTools.CommandLine" Version="[1.3.2]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
</ItemGroup>
</Project>

View File

@@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="17.14.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.analyzers" Version="1.24.0" />

View File

@@ -32,7 +32,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
</ItemGroup>
</Project>

View File

@@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="17.14.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.analyzers" Version="1.24.0" />

View File

@@ -38,7 +38,7 @@
<PackageReference Include="MinThreadingBridge" Version="0.11.4" Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="SabreTools.CommandLine" Version="[1.3.2]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
<PackageReference Include="System.Net.Http" Version="4.3.4" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
</ItemGroup>

View File

@@ -726,11 +726,11 @@ namespace MPF.Frontend.Tools
/// <returns>Filenames if possible, null on error</returns>
public static string? GetXboxFilenames(Drive? drive)
{
// If there's no drive path, we can't get BEE flag
// If there's no drive path, can't do anything
if (string.IsNullOrEmpty(drive?.Name))
return null;
// If the folder no longer exists, we can't get exe name
// If the folder no longer exists, can't do anything
if (!Directory.Exists(drive!.Name))
return null;
@@ -752,6 +752,59 @@ namespace MPF.Frontend.Tools
}
}
/// <summary>
/// Get Title ID(s) for Xbox One and Xbox Series X
/// </summary>
/// <param name="drive">Drive to extract information from</param>
/// <returns>Title ID(s) if possible, null on error</returns>
public static string? GetXboxTitleID(Drive? drive)
{
// If there's no drive path, can't do anything
if (string.IsNullOrEmpty(drive?.Name))
return null;
// If the folder no longer exists, can't do anything
if (!Directory.Exists(drive!.Name))
return null;
// Get the catalog.js path
#if NET20 || NET35
string catalogjs = Path.Combine(drive.Name, Path.Combine("MSXC", Path.Combine("Metadata", "catalog.js")));
#else
string catalogjs = Path.Combine(drive.Name, "MSXC", "Metadata", "catalog.js");
#endif
// Check catalog.js exists
if (!File.Exists(catalogjs))
return null;
// Deserialize catalog.js and extract Title ID(s)
try
{
SabreTools.Data.Models.Xbox.Catalog? catalog = new SabreTools.Serialization.Readers.Catalog().Deserialize(catalogjs);
if (catalog == null)
return null;
if (!string.IsNullOrEmpty(catalog.TitleID))
return catalog.TitleID;
if (catalog.Packages == null)
return null;
string[] titleIDs = new string[catalog.Packages.Length];
int i = 0;
foreach (var package in catalog.Packages)
{
if (package != null && package.TitleID != null)
titleIDs[i] = package.TitleID;
i++;
}
return string.Join(", ", titleIDs);
}
catch
{
// Absorb the exception
return null;
}
}
#endregion
#region Sega

View File

@@ -846,10 +846,12 @@ namespace MPF.Frontend.Tools
case RedumpSystem.MicrosoftXboxOne:
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.Filename] = PhysicalTool.GetXboxFilenames(drive) ?? string.Empty;
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.TitleID] = PhysicalTool.GetXboxTitleID(drive) ?? string.Empty;
break;
case RedumpSystem.MicrosoftXboxSeriesXS:
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.Filename] = PhysicalTool.GetXboxFilenames(drive) ?? string.Empty;
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.TitleID] = PhysicalTool.GetXboxTitleID(drive) ?? string.Empty;
break;
case RedumpSystem.NamcoSegaNintendoTriforce:

View File

@@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="17.14.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.analyzers" Version="1.24.0" />

View File

@@ -36,7 +36,7 @@
<PackageReference Include="GrindCore.SharpCompress" Version="0.40.4-alpha" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="SabreTools.Hashing" Version="[1.5.1]" />
<PackageReference Include="SabreTools.IO" Version="[1.7.6]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
<PackageReference Include="SabreTools.Serialization" Version="[2.0.2]" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.9" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
</ItemGroup>

View File

@@ -70,7 +70,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.4]" />
<PackageReference Include="SabreTools.RedumpLib" Version="[1.7.5]" />
</ItemGroup>
<ItemGroup>