Detect Xbox Series X discs (#683)

* Detect Xbox Series X discs via catalog.js deserialization

* Update changelog
This commit is contained in:
Deterous
2024-04-03 11:02:05 +09:00
committed by GitHub
parent a8b1a8342d
commit 47561baee8
2 changed files with 36 additions and 8 deletions

View File

@@ -11,6 +11,7 @@
- Fix information pulling for redumper (fuzz6001)
- Update packages
- Update BinaryObjectScanner to 3.1.4
- Detect Xbox Series X discs (Deterous)
### 3.1.4 (2024-03-16)

View File

@@ -369,17 +369,44 @@ namespace MPF.Core.Data
}
catch { }
// Microsoft Xbox One
// Microsoft Xbox One and Series X
try
{
if (Directory.Exists(Path.Combine(this.Name, "MSXC"))
#if NET20 || NET35
&& Directory.GetFiles(Path.Combine(this.Name, "MSXC")).Any())
#else
&& Directory.EnumerateFiles(Path.Combine(this.Name, "MSXC")).Any())
#endif
if (Directory.Exists(Path.Combine(this.Name, "MSXC")))
{
return RedumpSystem.MicrosoftXboxOne;
try
{
#if NET20 || NET35
string catalogjs = Path.Combine(this.Name, Path.Combine("MSXC", Path.Combine("Metadata", "catalog.js")));
#else
string catalogjs = Path.Combine(this.Name, "MSXC", "Metadata", "catalog.js");
#endif
if (!File.Exists(catalogjs))
return RedumpSystem.MicrosoftXboxOne;
var deserializer = new SabreTools.Serialization.Files.Catalog();
SabreTools.Models.Xbox.Catalog? catalog = deserializer.Deserialize(catalogjs);
if (catalog != null && catalog.Version != null && catalog.Packages != null)
{
if (!double.TryParse(catalog.Version, out double version))
return RedumpSystem.MicrosoftXboxOne;
if (version < 4)
return RedumpSystem.MicrosoftXboxOne;
foreach (var package in catalog.Packages)
{
if (package.Generation != "9")
return RedumpSystem.MicrosoftXboxOne;
}
return RedumpSystem.MicrosoftXboxSeriesXS;
}
}
catch
{
return RedumpSystem.MicrosoftXboxOne;
}
}
}
catch { }