diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index ff2a30e2f6..09ee284302 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -3057,10 +3057,15 @@ namespace BizHawk.Client.EmuHawk case DiscType.SonyPSX: game.System = "PSX"; break; + case DiscType.MegaCD: + game.System = "GEN"; + break; case DiscType.TurboCD: case DiscType.UnknownCDFS: case DiscType.UnknownFormat: - default: // PCECD was bizhawk's first CD core, so this prevents regressions + default:// PCECD was bizhawk's first CD core, + // and during that time, all CDs were blindly sent to it + // so this prevents regressions game.System = "PCECD"; break; } @@ -3068,6 +3073,13 @@ namespace BizHawk.Client.EmuHawk switch (game.System) { + case "GEN": + { + var genesis = new BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX( + nextComm, null, disc, "GEN", true, Emulation.Cores.Consoles.Sega.gpgx.GPGX.ControlType.Normal); + nextEmulator = genesis; + } + break; case "SAT": { var saturn = new Yabause(nextComm, disc, Global.Config.SaturnUseGL); @@ -3385,7 +3397,7 @@ namespace BizHawk.Client.EmuHawk Text = DisplayNameForSystem(game.System) + " - " + game.Name; ResetRewindBuffer(); - if (Global.Emulator.CoreComm.RomStatusDetails == null) + if (Global.Emulator.CoreComm.RomStatusDetails == null && rom != null) { Global.Emulator.CoreComm.RomStatusDetails = string.Format("{0}\r\nSHA1:{1}\r\nMD5:{2}\r\n", diff --git a/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs b/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs index f31a7f2253..bb1a49fa15 100644 --- a/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs +++ b/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs @@ -41,6 +41,7 @@ namespace BizHawk.Client.EmuHawk { "TI83", "TI-83" }, { "INTV", "Intellivision" }, { "C64", "C64" }, + { "GEN", "Genesis" }, }; public string TargetSystem = null; @@ -126,7 +127,10 @@ namespace BizHawk.Client.EmuHawk //build the groups in the listview as we go: if (!groups.ContainsKey(fr.systemId)) { - lvFirmwares.Groups.Add(fr.systemId, SystemGroupNames[fr.systemId]); + string name; + if (!SystemGroupNames.TryGetValue(fr.systemId, out name)) + name = "FIX ME (FirmwaresConfig.cs)"; + lvFirmwares.Groups.Add(fr.systemId, name); var lvg = lvFirmwares.Groups[lvFirmwares.Groups.Count - 1]; groups[fr.systemId] = lvg; } diff --git a/BizHawk.Emulation.Common/Database/FirmwareDatabase.cs b/BizHawk.Emulation.Common/Database/FirmwareDatabase.cs index 23f617d156..678eb5434e 100644 --- a/BizHawk.Emulation.Common/Database/FirmwareDatabase.cs +++ b/BizHawk.Emulation.Common/Database/FirmwareDatabase.cs @@ -89,6 +89,9 @@ namespace BizHawk.Emulation.Common var us_scd1_9210 = File("f4f315adcef9b8feb0364c21ab7f0eaf5457f3ed", "us_scd1_9210.bin", "Sega CD US (9210)"); var us_scd2_9303 = File("bd3ee0c8ab732468748bf98953603ce772612704", "us_scd2_9303.bin", "Sega CD US (9303)"); + Firmware("GEN", "CD_BIOS_EU", "Mega CD Bios (Europe)"); + Firmware("GEN", "CD_BIOS_JP", "Mega CD Bios (Japan)"); + Firmware("GEN", "CD_BIOS_US", "Sega CD Bios (USA)"); Option("GEN", "CD_BIOS_EU", eu_mcd1_9210); Option("GEN", "CD_BIOS_EU", eu_mcd2_9303); Option("GEN", "CD_BIOS_EU", eu_mcd2_9306); @@ -133,14 +136,16 @@ namespace BizHawk.Emulation.Common //defines a firmware file static FirmwareFile File(string hash, string recommendedName, string descr) { + string hashfix = hash.ToUpperInvariant(); + var ff = new FirmwareFile { - hash = hash, + hash = hashfix, recommendedName = recommendedName, descr = descr }; FirmwareFiles.Add(ff); - FirmwareFilesByHash[hash] = ff; + FirmwareFilesByHash[hashfix] = ff; return ff; } @@ -189,9 +194,17 @@ namespace BizHawk.Emulation.Common (from fr in FirmwareRecords where fr.firmwareId == firmwareId && fr.systemId == sysId - select fr).First(); + select fr); - return found; + try + { + return found.First(); + } + catch (InvalidOperationException) + { + // list is empty; + return null; + } } } //static class FirmwareDatabase diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs index 8848cac8f2..587e824671 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs @@ -56,6 +56,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx LoadCallback = new LibGPGX.load_archive_cb(load_archive); this.romfile = romfile; + this.CD = CD; LibGPGX.INPUT_SYSTEM system_a = LibGPGX.INPUT_SYSTEM.SYSTEM_NONE; LibGPGX.INPUT_SYSTEM system_b = LibGPGX.INPUT_SYSTEM.SYSTEM_NONE; diff --git a/BizHawk.Emulation.DiscSystem/Disc.ID.cs b/BizHawk.Emulation.DiscSystem/Disc.ID.cs index cf438b9d48..ac57f40e20 100644 --- a/BizHawk.Emulation.DiscSystem/Disc.ID.cs +++ b/BizHawk.Emulation.DiscSystem/Disc.ID.cs @@ -34,7 +34,12 @@ namespace BizHawk.Emulation.DiscSystem /// /// Its not clear whether we can ever have enough info to ID a turboCD disc (we're using hashes) /// - TurboCD + TurboCD, + + /// + /// MegaDrive addon + /// + MegaCD } sealed public partial class Disc @@ -48,6 +53,9 @@ namespace BizHawk.Emulation.DiscSystem //sega doesnt put anything identifying in the cdfs volume info. but its consistent about putting its own header here in sector 0 if (DetectSegaSaturn()) return DiscType.SegaSaturn; + // not fully tested yet + if (DetectMegaCD()) return DiscType.MegaCD; + //we dont know how to detect TurboCD. //an emulator frontend will likely just guess TurboCD if the disc is UnknownFormat @@ -72,12 +80,25 @@ namespace BizHawk.Emulation.DiscSystem /// This is reasonable approach to ID saturn. /// bool DetectSegaSaturn() + { + return StringAt("SEGA SEGASATURN", 0); + } + + /// + /// probably wrong + /// + bool DetectMegaCD() + { + return StringAt("SEGADISCSYSTEM", 0) || StringAt("SEGADISCSYSTEM", 16); + } + + private bool StringAt(string s, int n) { byte[] data = new byte[2048]; ReadLBA_2048(0, data, 0); - byte[] cmp = System.Text.Encoding.ASCII.GetBytes("SEGA SEGASATURN"); - byte[] cmp2 = new byte[15]; - Buffer.BlockCopy(data, 0, cmp2, 0, 15); + byte[] cmp = System.Text.Encoding.ASCII.GetBytes(s); + byte[] cmp2 = new byte[cmp.Length]; + Buffer.BlockCopy(data, n, cmp2, 0, cmp.Length); return System.Linq.Enumerable.SequenceEqual(cmp, cmp2); } } diff --git a/genplus-gx/core/cd_hw/cdd.c b/genplus-gx/core/cd_hw/cdd.c index dca3dac759..12c0f9f55e 100644 --- a/genplus-gx/core/cd_hw/cdd.c +++ b/genplus-gx/core/cd_hw/cdd.c @@ -238,7 +238,6 @@ void cdd_read_data(uint8 *dst) void cdd_read_audio(unsigned int samples) { -/* // previous audio outputs // int16 l = cdd.audio[0]; int16 r = cdd.audio[1]; @@ -247,7 +246,7 @@ void cdd_read_audio(unsigned int samples) samples = blip_clocks_needed(blip[0], samples); // audio track playing ? // - if (!scd.regs[0x36>>1].byte.h && cdd.toc.tracks[cdd.index].fd) + if (0) // (!scd.regs[0x36>>1].byte.h && cdd.toc.tracks[cdd.index].fd) { int i, mul, delta; @@ -264,7 +263,7 @@ void cdd_read_audio(unsigned int samples) #else uint8 *ptr = cdc.ram; #endif - fread(cdc.ram, 1, samples * 4, cdd.toc.tracks[cdd.index].fd); + //fread(cdc.ram, 1, samples * 4, cdd.toc.tracks[cdd.index].fd); // process 16-bit (little-endian) stereo samples // for (i=0; i