hookup PSF support

This commit is contained in:
zeromus 2015-07-20 23:11:00 -05:00
parent 77d14892fb
commit 6e1cde2793
5 changed files with 31 additions and 12 deletions

View File

@ -238,7 +238,7 @@ namespace BizHawk.Client.Common
try
{
var ext = file.Extension.ToLower();
var ext = file.Extension.ToLowerInvariant();
if (ext == ".m3u")
{
//HACK ZONE - currently only psx supports m3u
@ -398,7 +398,7 @@ namespace BizHawk.Client.Common
break;
}
}
else if (file.Extension.ToLower() == ".xml")
else if (file.Extension.ToLowerInvariant() == ".xml")
{
try
{
@ -463,22 +463,39 @@ namespace BizHawk.Client.Common
}
}
}
else if (file.Extension.ToLowerInvariant() == ".psf" || file.Extension.ToLowerInvariant() == ".minipsf")
{
Func<Stream, int, byte[]> cbDeflater = (Stream instream, int size) =>
{
var inflater = new ICSharpCode.SharpZipLib.Zip.Compression.Inflater(false);
var iis = new ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream(instream, inflater);
MemoryStream ret = new MemoryStream();
iis.CopyTo(ret);
return ret.ToArray();
};
PSF psf = new PSF();
psf.Load(path, cbDeflater);
nextEmulator = new Octoshock(nextComm, psf, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
nextEmulator.CoreComm.RomStatusDetails = "It's a PSF, what do you want.";
//total garbage, this
rom = new RomGame(file);
game = rom.GameInfo;
}
else // most extensions
{
rom = new RomGame(file);
//hacky for now
if (file.Extension.ToLower() == ".exe")
{
if (file.Extension.ToLowerInvariant() == ".exe")
rom.GameInfo.System = "PSX";
}
if (string.IsNullOrEmpty(rom.GameInfo.System))
{
// Has the user picked a preference for this extension?
if (PreferredPlatformIsDefined(rom.Extension.ToLower()))
if (PreferredPlatformIsDefined(rom.Extension.ToLowerInvariant()))
{
rom.GameInfo.System = Global.Config.PreferredPlatformsForExtensions[rom.Extension.ToLower()];
rom.GameInfo.System = Global.Config.PreferredPlatformsForExtensions[rom.Extension.ToLowerInvariant()];
}
else if (ChoosePlatform != null)
{
@ -499,7 +516,7 @@ namespace BizHawk.Client.Common
var isXml = false;
// other xml has already been handled
if (file.Extension.ToLower() == ".xml")
if (file.Extension.ToLowerInvariant() == ".xml")
{
game.System = "SNES";
isXml = true;

View File

@ -1864,7 +1864,7 @@ namespace BizHawk.Client.EmuHawk
{
return FormatFilter(
"Rom Files", "*.nes;*.fds;*.sms;*.gg;*.sg;*.pce;*.sgx;*.bin;*.smd;*.rom;*.a26;*.a78;*.lnx;*.m3u;*.cue;*.ccd;*.exe;*.gb;*.gbc;*.gba;*.gen;*.md;*.col;.int;*.smc;*.sfc;*.prg;*.d64;*.g64;*.crt;*.sgb;*.xml;*.z64;*.v64;*.n64;*.ws;*.wsc;*.dsk;*.do;*.po;%ARCH%",
"Music Files", "*.psf;*.sid;*.nsf",
"Music Files", "*.psf;*.minipsf;*.sid;*.nsf",
"Disc Images", "*.cue;*.ccd;*.m3u",
"NES", "*.nes;*.fds;*.nsf;%ARCH%",
"Super NES", "*.smc;*.sfc;*.xml;%ARCH%",
@ -1882,7 +1882,7 @@ namespace BizHawk.Client.EmuHawk
"Colecovision", "*.col;%ARCH%",
"Intellivision (very experimental)", "*.int;*.bin;*.rom;%ARCH%",
"PSX Executables (experimental)", "*.exe",
"PSF Playstation Sound File (not supported)", "*.psf",
"PSF Playstation Sound File", "*.psf;*.minipsf",
"Commodore 64 (experimental)", "*.prg; *.d64, *.g64; *.crt;%ARCH%",
"SID Commodore 64 Music File", "*.sid;%ARCH%",
"Nintendo 64", "*.z64;*.v64;*.n64",

View File

@ -217,7 +217,7 @@ namespace BizHawk.Client.MultiHawk
"Colecovision", "*.col;%ARCH%",
"Intellivision (very experimental)", "*.int;*.bin;*.rom;%ARCH%",
"PSX Executables (experimental)", "*.exe",
"PSF Playstation Sound File (not supported)", "*.psf",
"PSF Playstation Sound File", "*.psf;*.minipsf",
"Commodore 64 (experimental)", "*.prg; *.d64, *.g64; *.crt;%ARCH%",
"SID Commodore 64 Music File", "*.sid;%ARCH%",
"Nintendo 64", "*.z64;*.v64;*.n64",

View File

@ -284,6 +284,7 @@ namespace BizHawk.Emulation.Common
break;
case ".PSF":
case ".MINIPSF":
game.System = "PSX";
break;

View File

@ -280,6 +280,7 @@ namespace BizHawk.Emulation.Cores
public static SimpleMagicRecord PSX = new SimpleMagicRecord { Offset = 0x24E0, Key = " Licensed by Sony Computer Entertainment" }; //there might be other ideas for checking in mednafen sources, if we need them
public static SimpleMagicRecord PSX_EXE = new SimpleMagicRecord { Key = "PS-X EXE\0" };
public static SimpleMagicRecord PSP = new SimpleMagicRecord { Offset = 0x8000, Key = "\x01CD001\x01\0x00PSP GAME" };
public static SimpleMagicRecord PSF = new SimpleMagicRecord { Offset = 0, Key = "PSF\x1" };
//https://sites.google.com/site/atari7800wiki/a78-header
public static SimpleMagicRecord A78 = new SimpleMagicRecord { Offset = 0, Key = "\x01ATARI7800" };
@ -348,7 +349,7 @@ namespace BizHawk.Emulation.Cores
{ "GEN", new ExtensionInfo(FileIDType.SMD, null ) },
//nothing yet...
{ "PSF", new ExtensionInfo(FileIDType.PSF, null) },
{ "PSF", new ExtensionInfo(FileIDType.PSF, (j)=>Test_Simple(j,FileIDType.PSF,SimpleMagics.PSF) ) },
{ "INT", new ExtensionInfo(FileIDType.INT, null) },
{ "SFC", new ExtensionInfo(FileIDType.SFC, null) },
{ "SMC", new ExtensionInfo(FileIDType.SFC, null) },