enable backup identification of PSX discs through ISO filesystem

This commit is contained in:
zeromus 2015-07-20 17:59:34 -05:00
parent 69d8e68411
commit d0fee54834
2 changed files with 23 additions and 8 deletions

View File

@ -87,15 +87,22 @@ namespace BizHawk.Emulation.DiscSystem
//an emulator frontend will likely just guess TurboCD if the disc is UnknownFormat
//(we can also have a gameDB!)
var discView = EDiscStreamView.DiscStreamView_Mode1_2048;
if (disc.TOC.Session1Format == SessionFormat.Type20_CDXA)
discView = EDiscStreamView.DiscStreamView_Mode2_Form1_2048;
var iso = new ISOFile();
bool isIso = iso.Parse(new DiscStream(disc, EDiscStreamView.DiscStreamView_Mode1_2048, 0));
bool isIso = iso.Parse(new DiscStream(disc, discView, 0));
if (isIso)
{
var appId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].ApplicationIdentifier).TrimEnd('\0', ' ');
//NOTE: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
//if (appId == "PLAYSTATION")
// return DiscType.SonyPSX;
//for example: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
//but, some PSX games (junky rips) don't have the 'licensed by string' so we'll hope they get caught here
if (appId == "PLAYSTATION")
return DiscType.SonyPSX;
if(appId == "PSP GAME")
return DiscType.SonyPSP;

View File

@ -65,16 +65,24 @@ namespace BizHawk.Emulation.DiscSystem
public DiscStream(Disc disc, EDiscStreamView view, int from_lba)
{
if (view != EDiscStreamView.DiscStreamView_Mode1_2048)
throw new NotSupportedException("disc streams of not mode 1 are currently unsupported");
SectorSize = 2048;
Disc = disc;
NumSectors = disc.Session1.LeadoutLBA;
dsr = new DiscSectorReader(disc);
//following the provided view
dsr.Policy.UserData2048Mode = DiscSectorReaderPolicy.EUserData2048Mode.AssumeMode1;
switch (view)
{
case EDiscStreamView.DiscStreamView_Mode1_2048:
dsr.Policy.UserData2048Mode = DiscSectorReaderPolicy.EUserData2048Mode.AssumeMode1;
break;
case EDiscStreamView.DiscStreamView_Mode2_Form1_2048:
dsr.Policy.UserData2048Mode = DiscSectorReaderPolicy.EUserData2048Mode.AssumeMode2_Form1;
break;
default:
throw new NotSupportedException("Unsupported EDiscStreamView");
}
currPosition = from_lba * SectorSize;
cachedSector = -1;