diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs index aea76a51b7..d58ed11904 100644 --- a/BizHawk.Client.Common/RomLoader.cs +++ b/BizHawk.Client.Common/RomLoader.cs @@ -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 discs = new List(); + 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(), GetCoreSyncSettings()); + 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(), GetCoreSyncSettings()); + nextEmulator = new Octoshock(nextComm, new List(new[]{disc}), null, GetCoreSettings(), GetCoreSyncSettings()); nextEmulator.CoreComm.RomStatusDetails = "PSX etc."; break; case "PCE": diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 2462017742..ed5c76d516 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -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", diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index bc6c1ade56..bcbe576a1d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -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 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) diff --git a/BizHawk.Emulation.Cores/FileID.cs b/BizHawk.Emulation.Cores/FileID.cs index fa913d5da6..eb26e994b5 100644 --- a/BizHawk.Emulation.Cores/FileID.cs +++ b/BizHawk.Emulation.Cores/FileID.cs @@ -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) ) }, diff --git a/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj b/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj index 09e18da3b0..6017f778f6 100644 --- a/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj +++ b/BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj @@ -72,6 +72,7 @@ + diff --git a/BizHawk.Emulation.DiscSystem/Disc.cs b/BizHawk.Emulation.DiscSystem/Disc.cs index 690e7907aa..3a00aeae87 100644 --- a/BizHawk.Emulation.DiscSystem/Disc.cs +++ b/BizHawk.Emulation.DiscSystem/Disc.cs @@ -254,6 +254,7 @@ FILE ""xarp.barp.marp.farp"" BINARY /// /// 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? /// void Synthesize_SubcodeFromStructure() {