discsystem - load 2352-byte aligned iso as mode2/2352 bins instead. will cause 1 in ~2000 cases of isos to fail in case they are honestly multiples of 2352 sectors. if anyone ever reports that I can possibly try it both ways and see if one can detect as a known disc type and use whichever one succeeds?

should "fix" #2478
This commit is contained in:
zeromus 2020-11-13 03:13:04 -05:00
parent ebf0f6685e
commit 6873b1c291
1 changed files with 19 additions and 6 deletions

View File

@ -178,12 +178,25 @@ namespace BizHawk.Emulation.DiscSystem
LoadCue(Path.GetDirectoryName(IN_FromPath), File.ReadAllText(IN_FromPath));
break;
case ".iso":
// make a fake .cue file to represent this .iso and mount that
LoadCue(Path.GetDirectoryName(IN_FromPath), $@"
FILE ""{Path.GetFileName(IN_FromPath)}"" BINARY
TRACK 01 MODE1/2048
INDEX 01 00:00:00");
break;
{
// make a fake .cue file to represent this .iso and mount that
//however... to save many users from a stupid mistake, check if the size is NOT a multiple of 2048 (but IS a multiple of 2352) and in that case consider it a mode2 disc
//TODO - try it both ways and check the disc type to use whichever one succeeds in identifying a disc type
var len = new FileInfo(IN_FromPath).Length;
string mode1cue = $@"
FILE ""{Path.GetFileName(IN_FromPath)}"" BINARY
TRACK 01 MODE1/2048
INDEX 01 00:00:00";
string mode2cue = $@"
FILE ""{Path.GetFileName(IN_FromPath)}"" BINARY
TRACK 01 MODE2/2352
INDEX 01 00:00:00";
if (len % 2048 != 0 && len % 2352 == 0)
LoadCue(Path.GetDirectoryName(IN_FromPath), mode2cue);
else
LoadCue(Path.GetDirectoryName(IN_FromPath), mode1cue);
break;
}
case ".mds":
OUT_Disc = new MDS_Format().LoadMDSToDisc(IN_FromPath, IN_DiscMountPolicy);
break;