Use proper base path for redumper output check (#783)

This commit is contained in:
Deterous
2024-12-17 14:05:13 +09:00
committed by GitHub
parent e8f50a84b8
commit 2b4fa33e81
2 changed files with 13 additions and 15 deletions

View File

@@ -77,6 +77,7 @@
- Slight formatting tweaks
- Update BOS to 3.3.2
- Enable handling non-SS Xbox discs
- Use proper base path for redumper output check
### 3.2.4 (2024-11-24)

View File

@@ -395,6 +395,13 @@ namespace MPF.Processors
/// <inheritdoc/>
internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string baseFilename)
{
// Get the base path
string basePath;
if (string.IsNullOrEmpty(baseDirectory))
basePath = baseFilename;
else
basePath = Path.Combine(baseDirectory, baseFilename);
switch (Type)
{
case MediaType.CDROM:
@@ -439,13 +446,6 @@ namespace MPF.Processors
"toc"),
];
// Get the base path for cuesheet reading
string basePath;
if (string.IsNullOrEmpty(baseDirectory))
basePath = baseFilename;
else
basePath = Path.Combine(baseDirectory, baseFilename);
// Include .hash and .skeleton for all files in cuesheet
var cueSheet = SabreTools.Serialization.Deserializers.CueSheet.DeserializeFile($"{basePath}.cue");
if (cueSheet?.Files != null)
@@ -514,7 +514,7 @@ namespace MPF.Processors
new($"{baseFilename}.1.physical", OutputFileFlags.Binary
| OutputFileFlags.Zippable,
"physical_1"),
new($"{baseFilename}.security", System.IsXGD() && !IsManufacturerEmpty($"{baseFilename}.manufacturer")
new($"{baseFilename}.security", System.IsXGD() && !IsManufacturerEmpty($"{basePath}.manufacturer")
? OutputFileFlags.Required | OutputFileFlags.Binary | OutputFileFlags.Zippable
: OutputFileFlags.Binary | OutputFileFlags.Zippable,
"security"),
@@ -651,17 +651,14 @@ namespace MPF.Processors
using var inputStream = new FileStream(inputFilename, FileMode.Open, FileAccess.Read);
// If the manufacturer file is not the correct size, return false
if (2052 != inputStream.Length)
if (inputStream.Length != 2052)
return false;
// Skip the header
inputStream.Seek(4, SeekOrigin.Begin);
byte[] buffer = new byte[2048];
byte[] buffer = new byte[2052];
int bytesRead = inputStream.Read(buffer, 0, buffer.Length);
// Return false if any value is non-zero
for (int i = 0; i < bytesRead; i++)
// Return false if any value is non-zero, skip SCSI header (4 bytes)
for (int i = 4; i < bytesRead; i++)
{
if (buffer[i] != 0x00)
return false;