sega CD games now get as far as loading the bios

This commit is contained in:
goyuken 2013-12-16 19:00:05 +00:00
parent 61f31967b3
commit 85be43dfb8
7 changed files with 64 additions and 15 deletions

View File

@ -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",

View File

@ -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;
}

View File

@ -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

View File

@ -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;

View File

@ -34,7 +34,12 @@ namespace BizHawk.Emulation.DiscSystem
/// <summary>
/// Its not clear whether we can ever have enough info to ID a turboCD disc (we're using hashes)
/// </summary>
TurboCD
TurboCD,
/// <summary>
/// MegaDrive addon
/// </summary>
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.
/// </summary>
bool DetectSegaSaturn()
{
return StringAt("SEGA SEGASATURN", 0);
}
/// <summary>
/// probably wrong
/// </summary>
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);
}
}

View File

@ -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<samples; i++)
@ -335,7 +334,6 @@ void cdd_read_audio(unsigned int samples)
// end of Blip Buffer timeframe //
blip_end_frame(blip[0], samples);
blip_end_frame(blip[1], samples);
*/
}

Binary file not shown.