add the crudest possible psx disc detector. now other people can watch somewhat garbled psx game intros
This commit is contained in:
parent
b4c7c372de
commit
9ff8b450f4
|
@ -22,6 +22,21 @@ namespace BizHawk.Emulation.Consoles.PSX
|
||||||
public bool StartAsyncSound() { return true; }
|
public bool StartAsyncSound() { return true; }
|
||||||
public void EndAsyncSound() { }
|
public void EndAsyncSound() { }
|
||||||
|
|
||||||
|
public static bool CheckIsPSX(DiscSystem.Disc disc)
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
byte[] buf = new byte[59];
|
||||||
|
disc.ReadLBA_2352_Flat(0x24D8, buf, 0, 59);
|
||||||
|
string sig = System.Text.ASCIIEncoding.ASCII.GetString(buf);
|
||||||
|
|
||||||
|
//this string is considered highly unlikely to exist anywhere besides a psx disc
|
||||||
|
if (sig == " Licensed by Sony Computer Entertainment")
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
//we can only have one active core at a time, due to the lib being so static.
|
//we can only have one active core at a time, due to the lib being so static.
|
||||||
//so we'll track the current one here and detach the previous one whenever a new one is booted up.
|
//so we'll track the current one here and detach the previous one whenever a new one is booted up.
|
||||||
static Octoshock CurrOctoshockCore;
|
static Octoshock CurrOctoshockCore;
|
||||||
|
|
|
@ -92,6 +92,30 @@ namespace BizHawk.DiscSystem
|
||||||
Array.Copy(temp, 16, buffer, offset, 2048);
|
Array.Copy(temp, 16, buffer, offset, 2048);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// reads logical data from a flat disc address space
|
||||||
|
/// useful for plucking data from a known location on the disc
|
||||||
|
/// </summary>
|
||||||
|
public void ReadLBA_2352_Flat(long disc_offset, byte[] buffer, int offset, int length)
|
||||||
|
{
|
||||||
|
int secsize = 2352;
|
||||||
|
byte[] lba_buf = new byte[secsize];
|
||||||
|
while(length > 0)
|
||||||
|
{
|
||||||
|
int lba = (int)(disc_offset / secsize);
|
||||||
|
int lba_within = (int)(disc_offset % secsize);
|
||||||
|
int todo = length;
|
||||||
|
int remains_in_lba = secsize - lba_within;
|
||||||
|
if (remains_in_lba < todo)
|
||||||
|
todo = remains_in_lba;
|
||||||
|
ReadLBA_2352(lba, lba_buf, 0);
|
||||||
|
Array.Copy(lba_buf, lba_within, buffer, offset, todo);
|
||||||
|
offset += todo;
|
||||||
|
length -= todo;
|
||||||
|
lba_within = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a SectorEntry from which you can retrieve various interesting pieces of information about the sector.
|
/// Returns a SectorEntry from which you can retrieve various interesting pieces of information about the sector.
|
||||||
|
|
|
@ -1435,12 +1435,13 @@ namespace BizHawk.MultiClient
|
||||||
// In the future we need to do something smarter, possibly including simply asking the user
|
// In the future we need to do something smarter, possibly including simply asking the user
|
||||||
// what system the game is for.
|
// what system the game is for.
|
||||||
|
|
||||||
if (System.Windows.Forms.SystemInformation.ComputerName == "ZERO-XP")
|
if (BizHawk.Emulation.Consoles.PSX.Octoshock.CheckIsPSX(disc))
|
||||||
{
|
{
|
||||||
game = new GameInfo();
|
game = new GameInfo();
|
||||||
game.System = "PSX";
|
game.System = "PSX";
|
||||||
game.Name = Path.GetFileNameWithoutExtension(file.Name);
|
game.Name = Path.GetFileNameWithoutExtension(file.Name);
|
||||||
game.Hash = hash;
|
game.Hash = hash;
|
||||||
|
disc.Dispose();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue