load m3u files. still no disc switching

This commit is contained in:
zeromus 2014-12-14 10:36:03 +00:00
parent ede9620446
commit 2d56514fde
6 changed files with 56 additions and 11 deletions

View File

@ -205,7 +205,38 @@ namespace BizHawk.Client.Common
try
{
var ext = file.Extension.ToLower();
if (ext == ".iso" || ext == ".cue" || ext == ".ccd")
if (ext == ".m3u")
{
//HACK ZONE - currently only psx supports m3u
M3U_File m3u;
using(var sr = new StreamReader(path))
m3u = M3U_File.Read(sr);
if(m3u.Entries.Count == 0)
throw new InvalidOperationException("Can't load an empty M3U");
//load discs for all the m3u
m3u.Rebase(Path.GetDirectoryName(path));
List<Disc> discs = new List<Disc>();
foreach (var e in m3u.Entries)
{
Disc disc = null;
string discPath = e.Path;
string discExt = Path.GetExtension(discPath).ToLower();
if (discExt == ".iso")
disc = Disc.FromIsoPath(discPath);
if (discExt == ".cue")
disc = Disc.FromCuePath(discPath, new CueBinPrefs());
if (discExt == ".ccd")
disc = Disc.FromCCDPath(discPath);
if(disc == null)
throw new InvalidOperationException("Can't load one of the files specified in the M3U");
discs.Add(disc);
}
nextEmulator = new Octoshock(nextComm, discs, null, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
game = new GameInfo { Name = Path.GetFileNameWithoutExtension(file.Name) };
game.System = "PSX";
}
else if (ext == ".iso" || ext == ".cue" || ext == ".ccd")
{
Disc disc = null;
if(ext == ".iso")
@ -261,7 +292,7 @@ namespace BizHawk.Client.Common
nextEmulator = new PSP(nextComm, file.Name);
break;
case "PSX":
nextEmulator = new Octoshock(nextComm, disc, null, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
nextEmulator = new Octoshock(nextComm, new List<Disc>(new[]{disc}), null, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
break;
case "PCE":

View File

@ -1921,9 +1921,9 @@ namespace BizHawk.Client.EmuHawk
if (VersionInfo.DeveloperBuild)
{
ofd.Filter = FormatFilter(
"Rom Files", "*.nes;*.fds;*.sms;*.gg;*.sg;*.pce;*.sgx;*.bin;*.smd;*.rom;*.a26;*.a78;*.lnx;*.cue;*.ccd;*.exe;*.gb;*.gbc;*.gba;*.gen;*.md;*.col;.int;*.smc;*.sfc;*.prg;*.d64;*.g64;*.crt;*.sgb;*.xml;*.z64;*.v64;*.n64;*.ws;*.wsc;%ARCH%",
"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;%ARCH%",
"Music Files", "*.psf;*.sid",
"Disc Images", "*.cue;*.ccd",
"Disc Images", "*.cue;*.ccd;*.m3u",
"NES", "*.nes;*.fds;%ARCH%",
"Super NES", "*.smc;*.sfc;*.xml;%ARCH%",
"Master System", "*.sms;*.gg;*.sg;%ARCH%",
@ -1939,8 +1939,8 @@ namespace BizHawk.Client.EmuHawk
"Gameboy Advance", "*.gba;%ARCH%",
"Colecovision", "*.col;%ARCH%",
"Intellivision (very experimental)", "*.int;*.bin;*.rom;%ARCH%",
"PSX Executables (very experimental)", "*.exe",
"PSF Playstation Sound File (very experimental)", "*.psf",
"PSX Executables (experimental)", "*.exe",
"PSF Playstation Sound File (not supported)", "*.psf",
"Commodore 64 (experimental)", "*.prg; *.d64, *.g64; *.crt;%ARCH%",
"SID Commodore 64 Music File", "*.sid;%ARCH%",
"Nintendo 64", "*.z64;*.v64;*.n64",
@ -1951,7 +1951,7 @@ namespace BizHawk.Client.EmuHawk
{
ofd.Filter = FormatFilter(
"Rom Files", "*.nes;*.fds;*.sms;*.gg;*.sg;*.gb;*.gbc;*.gba;*.pce;*.sgx;*.bin;*.smd;*.gen;*.md;*.smc;*.sfc;*.a26;*.a78;*.lnx;*.col;*.rom;*.cue;*.ccd;*.sgb;*.z64;*.v64;*.n64;*.ws;*.wsc;*.xml;%ARCH%",
"Disc Images", "*.cue;*.ccd",
"Disc Images", "*.cue;*.ccd;*.m3u",
"NES", "*.nes;*.fds;%ARCH%",
"Super NES", "*.smc;*.sfc;*.xml;%ARCH%",
"Nintendo 64", "*.z64;*.v64;*.n64",

View File

@ -171,8 +171,14 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
//note: its annoying that we have to have a disc before constructing this.
//might want to change that later. HOWEVER - we need to definitely have a region, at least
public Octoshock(CoreComm comm, DiscSystem.Disc disc, byte[] exe, object settings, object syncSettings)
public Octoshock(CoreComm comm, List<DiscSystem.Disc> discs, byte[] exe, object settings, object syncSettings)
{
//analyze our first disc from the list by default, because i dont know
DiscSystem.Disc disc = null;
if (discs != null)
disc = discs[0];
ServiceProvider = new BasicServiceProvider(this);
CoreComm = comm;
@ -339,7 +345,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
int w = fb.width;
int h = fb.height;
BufferWidth = w;
BufferWidth = w;
BufferHeight = h;
switch (_Settings.ResolutionMode)

View File

@ -27,7 +27,7 @@ namespace BizHawk.Emulation.Cores
Multiple, //dont think this makes sense. shouldnt the multiple options be returned?
Disc, //an unknown disc
PSX, PSX_EXE,
PSX, PSX_EXE, PSF,
PSP,
Saturn, MegaCD,
@ -45,7 +45,8 @@ namespace BizHawk.Emulation.Cores
INT,
A26, A52, A78, LNX,
PSF,
JAD, SBI,
M3U
}
public class FileIDResult
@ -274,6 +275,9 @@ namespace BizHawk.Emulation.Cores
//could be at various offsets?
public static SimpleMagicRecord TMR_SEGA = new SimpleMagicRecord { Offset = 0x7FF0, Key = "TMR SEGA" };
public static SimpleMagicRecord SBI = new SimpleMagicRecord { Key = "SBI\0" };
public static SimpleMagicRecord M3U = new SimpleMagicRecord { Key = "#EXTM3U" }; //note: M3U may not have this. EXTM3U only has it. We'll still catch it by extension though.
}
class ExtensionInfo
@ -310,9 +314,11 @@ namespace BizHawk.Emulation.Cores
{ "BIN", new ExtensionInfo(FileIDType.Multiple, Test_BIN_ISO ) },
{ "ISO", new ExtensionInfo(FileIDType.Multiple, Test_BIN_ISO ) },
{ "M3U", new ExtensionInfo(FileIDType.M3U, (j)=>Test_Simple(j,FileIDType.M3U,SimpleMagics.M3U) ) },
{ "JAD", new ExtensionInfo(FileIDType.Multiple, Test_JAD_JAC ) },
{ "JAC", new ExtensionInfo(FileIDType.Multiple, Test_JAD_JAC ) },
{ "SBI", new ExtensionInfo(FileIDType.SBI, (j)=>Test_Simple(j,FileIDType.SBI,SimpleMagics.SBI) ) },
{ "EXE", new ExtensionInfo(FileIDType.PSX_EXE, (j)=>Test_Simple(j,FileIDType.PSX_EXE,SimpleMagics.PSX_EXE) ) },

View File

@ -72,6 +72,7 @@
<Compile Include="DiscUtils.cs" />
<Compile Include="ECM.cs" />
<Compile Include="GPL_ECM.cs" />
<Compile Include="M3U_file.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SectorInterfaces.cs" />
<Compile Include="Subcode.cs" />

View File

@ -254,6 +254,7 @@ FILE ""xarp.barp.marp.farp"" BINARY
/// <summary>
/// Creates the subcode (really, just subchannel Q) for this disc from its current TOC.
/// Depends on the TOCPoints existing in the structure
/// TODO - do we need a fully 0xFF P-subchannel for PSX?
/// </summary>
void Synthesize_SubcodeFromStructure()
{