mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-08 18:06:41 +00:00
Editorconfig and some manual cleanup
This commit is contained in:
@@ -21,9 +21,11 @@ namespace SabreTools.Data.Models.XDVDFS
|
||||
/// <summary>
|
||||
/// Volume Descriptor magic bytes at start of sector 32
|
||||
/// </summary>
|
||||
public static readonly byte[] VolumeDescriptorMagic = [0x4D, 0x49, 0x43, 0x52, 0x4F, 0x53, 0x4F, 0x46,
|
||||
0x54, 0x2A, 0x58, 0x42, 0x4F, 0x58, 0x2A, 0x4D,
|
||||
0x45, 0x44, 0x49, 0x41];
|
||||
public static readonly byte[] VolumeDescriptorMagic = [
|
||||
0x4D, 0x49, 0x43, 0x52, 0x4F, 0x53, 0x4F, 0x46,
|
||||
0x54, 0x2A, 0x58, 0x42, 0x4F, 0x58, 0x2A, 0x4D,
|
||||
0x45, 0x44, 0x49, 0x41
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Volume Descriptor signature at start of sector 32
|
||||
|
||||
@@ -11,8 +11,10 @@ namespace SabreTools.Data.Models.XboxISO
|
||||
/// 6/7 = XGD3
|
||||
/// </summary>
|
||||
/// <see href="https://github.dev/Deterous/XboxKit/"/>
|
||||
public static readonly long[] RedumpIsoLengths = [0x1D26A8000, 0x1D3301800, 0x1D2FEF800, 0x1D3082000,
|
||||
0x1D3390000, 0x1D31A0000, 0x208E05800, 0x208E03800];
|
||||
public static readonly long[] RedumpIsoLengths = [
|
||||
0x1D26A8000, 0x1D3301800, 0x1D2FEF800, 0x1D3082000,
|
||||
0x1D3390000, 0x1D31A0000, 0x208E05800, 0x208E03800
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Known XISO offsets into redump ISOs
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SabreTools.Data.Models.XboxISO
|
||||
/// <summary>
|
||||
/// ISO9660 Video parititon, split across start and end of Disc Image
|
||||
/// </summary>
|
||||
public SabreTools.Data.Models.ISO9660.Volume VideoPartition { get; set; } = new();
|
||||
public ISO9660.Volume VideoPartition { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// XGD type present in game partition
|
||||
@@ -24,6 +24,6 @@ namespace SabreTools.Data.Models.XboxISO
|
||||
/// <summary>
|
||||
/// XDVDFS Game partition, present in middle of Disc Image
|
||||
/// </summary>
|
||||
public SabreTools.Data.Models.XDVDFS.Volume GamePartition { get; set; } = new();
|
||||
public XDVDFS.Volume GamePartition { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace SabreTools.Serialization.Readers
|
||||
|
||||
data.SeekIfPossible(initialOffset + (((long)offset) * Constants.SectorSize), SeekOrigin.Begin);
|
||||
long curPosition;
|
||||
while (size > data.Position - (initialOffset + ((long)offset) * Constants.SectorSize))
|
||||
while (size > data.Position - (initialOffset + (((long)offset) * Constants.SectorSize)))
|
||||
{
|
||||
curPosition = data.Position;
|
||||
var dr = ParseDirectoryRecord(data);
|
||||
|
||||
@@ -89,7 +89,6 @@ namespace SabreTools.Wrappers
|
||||
/// </summary>
|
||||
/// <param name="stream">Stream data to parse</param>
|
||||
/// <returns>IWrapper representing the disc image, null on error</returns>
|
||||
/// TODO: Hook this up in place of ISO in CreateWrapper
|
||||
public static IWrapper? CreateDiscImageWrapper(Stream? stream)
|
||||
{
|
||||
// If we have no stream
|
||||
@@ -101,7 +100,7 @@ namespace SabreTools.Wrappers
|
||||
|
||||
// Try to get an Xbox ISO wrapper first
|
||||
var xboxWrapper = XboxISO.Create(stream);
|
||||
if (xboxWrapper is not null && xboxWrapper is XboxISO xboxISO)
|
||||
if (xboxWrapper is not null)
|
||||
return xboxWrapper;
|
||||
|
||||
// Reset position in stream
|
||||
@@ -109,7 +108,7 @@ namespace SabreTools.Wrappers
|
||||
|
||||
// Fallback to standard ISO9660 wrapper
|
||||
var isoWrapper = ISO9660.Create(stream);
|
||||
if (isoWrapper is null || isoWrapper is not ISO9660 iso)
|
||||
if (isoWrapper is null)
|
||||
return null;
|
||||
|
||||
return isoWrapper;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Models.XboxISO;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
@@ -14,11 +10,11 @@ namespace SabreTools.Wrappers
|
||||
long initialOffset = _dataSource.Position;
|
||||
|
||||
// Extract all files from the video partition
|
||||
var videoWrapper = new SabreTools.Wrappers.ISO9660(VideoPartition, _dataSource, initialOffset, _dataSource.Length);
|
||||
var videoWrapper = new ISO9660(VideoPartition, _dataSource, initialOffset, _dataSource.Length);
|
||||
bool success = videoWrapper?.Extract(outputDirectory, includeDebug) ?? false;
|
||||
|
||||
// Extract all files from the game partition
|
||||
var gameWrapper = new SabreTools.Wrappers.XDVDFS(GamePartition, _dataSource, initialOffset + Constants.XisoOffsets[XGDType], Constants.XisoLengths[XGDType]);
|
||||
var gameWrapper = new XDVDFS(GamePartition, _dataSource, initialOffset + Constants.XisoOffsets[XGDType], Constants.XisoLengths[XGDType]);
|
||||
success |= gameWrapper?.Extract(outputDirectory, includeDebug) ?? false;
|
||||
|
||||
return success;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Models.XboxISO;
|
||||
using SabreTools.Text.Extensions;
|
||||
@@ -36,12 +35,12 @@ namespace SabreTools.Wrappers
|
||||
long initialOffset = _dataSource.Position;
|
||||
|
||||
// Print all information of video partition model
|
||||
var videoWrapper = new SabreTools.Wrappers.ISO9660(VideoPartition, _dataSource, initialOffset, _dataSource.Length);
|
||||
var videoWrapper = new ISO9660(VideoPartition, _dataSource, initialOffset, _dataSource.Length);
|
||||
if (videoWrapper is not null)
|
||||
videoWrapper.PrintInformation(builder);
|
||||
|
||||
// Print all information of game partition model
|
||||
var gameWrapper = new SabreTools.Wrappers.XDVDFS(GamePartition, _dataSource, initialOffset + Constants.XisoOffsets[XGDType], Constants.XisoLengths[XGDType]);
|
||||
var gameWrapper = new XDVDFS(GamePartition, _dataSource, initialOffset + Constants.XisoOffsets[XGDType], Constants.XisoLengths[XGDType]);
|
||||
if (gameWrapper is not null)
|
||||
gameWrapper.PrintInformation(builder);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SabreTools.Data.Models.XboxISO;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Numerics.Extensions;
|
||||
@@ -21,13 +19,13 @@ namespace SabreTools.Wrappers
|
||||
#region Extension Properties
|
||||
|
||||
/// <inheritdoc cref="DiscImage.VideoPartition"/>
|
||||
public SabreTools.Data.Models.ISO9660.Volume VideoPartition => Model.VideoPartition;
|
||||
public Data.Models.ISO9660.Volume VideoPartition => Model.VideoPartition;
|
||||
|
||||
/// <inheritdoc cref="DiscImage.XGDType"/>
|
||||
public int XGDType => Model.XGDType;
|
||||
|
||||
/// <inheritdoc cref="DiscImage.GamePartition"/>
|
||||
public SabreTools.Data.Models.XDVDFS.Volume GamePartition => Model.GamePartition;
|
||||
public Data.Models.XDVDFS.Volume GamePartition => Model.GamePartition;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -94,12 +92,12 @@ namespace SabreTools.Wrappers
|
||||
|
||||
// Create new model to fill in
|
||||
var model = new DiscImage();
|
||||
|
||||
|
||||
// Try to detect XDVDFS partition
|
||||
int redumpType = Array.IndexOf(Constants.RedumpIsoLengths, data.Length);
|
||||
if (redumpType < 0)
|
||||
return null;
|
||||
|
||||
|
||||
// Determine location/size of game partition based on total ISO size
|
||||
model.XGDType = redumpType switch
|
||||
{
|
||||
@@ -115,7 +113,7 @@ namespace SabreTools.Wrappers
|
||||
return null;
|
||||
|
||||
// Verify that XDVDFS game parition exists
|
||||
long magicOffset = Constants.XisoOffsets[model.XGDType] + Data.Models.XDVDFS.Constants.SectorSize * Data.Models.XDVDFS.Constants.ReservedSectors;
|
||||
long magicOffset = Constants.XisoOffsets[model.XGDType] + (Data.Models.XDVDFS.Constants.SectorSize * Data.Models.XDVDFS.Constants.ReservedSectors);
|
||||
data.SeekIfPossible(currentOffset + magicOffset, SeekOrigin.Begin);
|
||||
var magic = data.ReadBytes(20);
|
||||
if (magic is null)
|
||||
|
||||
Reference in New Issue
Block a user