diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.Debug.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.Debug.cs
index a59293fc3f..b047be02a0 100644
--- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.Debug.cs
+++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.Debug.cs
@@ -194,7 +194,15 @@ namespace BizHawk.Client.EmuHawk
return;
}
- _dsr = new(_disc) { Policy = { ThrowExceptions2048 = false } };
+ _dsr = new(_disc)
+ {
+ Policy =
+ {
+ UserData2048Mode = DiscSectorReaderPolicy.EUserData2048Mode.InspectSector_AssumeForm1,
+ ThrowExceptions2048 = false
+ }
+ };
+
_buf2352 = new byte[2352];
}
diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs
index fe28fb9da9..6590b5fea6 100644
--- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs
+++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs
@@ -29,7 +29,11 @@ namespace BizHawk.Client.EmuHawk
using var disc = DiscExtensions.CreateAnyType(path, e => throw new(e));
var dsr = new DiscSectorReader(disc)
{
- Policy = { DeterministicClearBuffer = false } // let's make this a little faster
+ Policy =
+ {
+ UserData2048Mode = DiscSectorReaderPolicy.EUserData2048Mode.InspectSector_AssumeForm1,
+ DeterministicClearBuffer = false // let's make this a little faster
+ }
};
var buf2048 = new byte[2048];
diff --git a/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs b/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs
index e0735dd289..6c06d21bba 100644
--- a/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs
+++ b/src/BizHawk.Emulation.DiscSystem/DiscSectorReader.cs
@@ -21,6 +21,12 @@ namespace BizHawk.Emulation.DiscSystem
/// Read it as mode 2 (form 1)
///
AssumeMode2_Form1,
+
+ ///
+ /// The contents of the sector should be inspected (mode) and 2048 bytes returned accordingly
+ /// Mode 2 form is assumed to be 1
+ ///
+ InspectSector_AssumeForm1,
}
///
@@ -223,19 +229,22 @@ namespace BizHawk.Emulation.DiscSystem
}
else if (mode == 2)
{
- //greenbook pg II-22
- //we're going to do a sanity check here.. we're not sure what happens if we try to read 2048 bytes from a form-2 2324 byte sector
- //we could handle it by policy but for now the policy is exception
- byte submodeByte = buf2448[18];
- int form = ((submodeByte >> 5) & 1) + 1;
- if (form == 2)
+ // greenbook pg II-22
+ // we're going to do a sanity check here.. we're not sure what happens if we try to read 2048 bytes from a form-2 2324 byte sector
+ // default policy is exception, although some cases might prefer assuming form 1
+ if (Policy.UserData2048Mode != DiscSectorReaderPolicy.EUserData2048Mode.InspectSector_AssumeForm1)
{
- if (Policy.ThrowExceptions2048)
- throw new InvalidOperationException("Unsupported scenario: reading 2048 bytes from a Mode2 Form 2 sector");
- else return 0;
+ byte submodeByte = buf2448[18];
+ int form = ((submodeByte >> 5) & 1) + 1;
+ if (form == 2)
+ {
+ if (Policy.ThrowExceptions2048)
+ throw new InvalidOperationException("Unsupported scenario: reading 2048 bytes from a Mode2 Form 2 sector");
+ else return 0;
+ }
}
- //otherwise it's OK
+ // otherwise it's OK
Buffer.BlockCopy(buf2448, 24, buffer, offset, 2048);
return 2048;
}