enable backup identification of PSX discs through ISO filesystem
This commit is contained in:
parent
69d8e68411
commit
d0fee54834
|
@ -87,15 +87,22 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
//an emulator frontend will likely just guess TurboCD if the disc is UnknownFormat
|
//an emulator frontend will likely just guess TurboCD if the disc is UnknownFormat
|
||||||
//(we can also have a gameDB!)
|
//(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();
|
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)
|
if (isIso)
|
||||||
{
|
{
|
||||||
var appId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].ApplicationIdentifier).TrimEnd('\0', ' ');
|
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")
|
//for example: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
|
||||||
// return DiscType.SonyPSX;
|
//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")
|
if(appId == "PSP GAME")
|
||||||
return DiscType.SonyPSP;
|
return DiscType.SonyPSP;
|
||||||
|
|
||||||
|
|
|
@ -65,16 +65,24 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
|
|
||||||
public DiscStream(Disc disc, EDiscStreamView view, int from_lba)
|
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;
|
SectorSize = 2048;
|
||||||
Disc = disc;
|
Disc = disc;
|
||||||
NumSectors = disc.Session1.LeadoutLBA;
|
NumSectors = disc.Session1.LeadoutLBA;
|
||||||
dsr = new DiscSectorReader(disc);
|
dsr = new DiscSectorReader(disc);
|
||||||
|
|
||||||
//following the provided view
|
//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;
|
currPosition = from_lba * SectorSize;
|
||||||
cachedSector = -1;
|
cachedSector = -1;
|
||||||
|
|
Loading…
Reference in New Issue