PCE - Implement PCECD system id in core and in game info. Also set cancel property of LogWindow winform

This commit is contained in:
andres.delikat 2011-09-24 17:05:34 +00:00
parent 871ba80a76
commit 6bbab41b0c
5 changed files with 511 additions and 482 deletions

View File

@ -47,6 +47,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public byte[] SuperRam; // Super System Card 192K of additional RAM public byte[] SuperRam; // Super System Card 192K of additional RAM
public byte[] ArcadeRam; // Arcade Card 2048K of additional RAM public byte[] ArcadeRam; // Arcade Card 2048K of additional RAM
private string systemid = "PCE";
// 21,477,270 Machine clocks / sec // 21,477,270 Machine clocks / sec
// 7,159,090 Cpu cycles / sec // 7,159,090 Cpu cycles / sec
@ -56,14 +58,21 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
switch (game.System) switch (game.System)
{ {
case "PCE": Type = NecSystemType.TurboGrafx; break; case "PCE":
case "SGX": Type = NecSystemType.SuperGrafx; break; systemid = "PCE";
Type = NecSystemType.TurboGrafx;
break;
case "SGX":
systemid = "SGX";
Type = NecSystemType.SuperGrafx;
break;
} }
Init(game, rom); Init(game, rom);
} }
public PCEngine(GameInfo game, Disc disc, byte[] rom) public PCEngine(GameInfo game, Disc disc, byte[] rom)
{ {
systemid = "PCECD";
CoreOutputComm = new CoreOutputComm(); CoreOutputComm = new CoreOutputComm();
Type = NecSystemType.TurboCD; Type = NecSystemType.TurboCD;
this.disc = disc; this.disc = disc;
@ -124,18 +133,22 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
// In memory, 384k roms look like [1st 256k][Then full 384k] // In memory, 384k roms look like [1st 256k][Then full 384k]
RomData = new byte[0xA0000]; RomData = new byte[0xA0000];
var origRom = rom; var origRom = rom;
for (int i=0; i<0x40000; i++) for (int i = 0; i < 0x40000; i++)
RomData[i] = origRom[i]; RomData[i] = origRom[i];
for (int i = 0; i < 0x60000; i++) for (int i = 0; i < 0x60000; i++)
RomData[i+0x40000] = origRom[i]; RomData[i + 0x40000] = origRom[i];
RomLength = RomData.Length; RomLength = RomData.Length;
} else if (rom.Length > 1024 * 1024) { }
else if (rom.Length > 1024 * 1024)
{
// If the rom is bigger than 1 megabyte, switch to Street Fighter 2 mapper // If the rom is bigger than 1 megabyte, switch to Street Fighter 2 mapper
Cpu.ReadMemory21 = ReadMemorySF2; Cpu.ReadMemory21 = ReadMemorySF2;
Cpu.WriteMemory21 = WriteMemorySF2; Cpu.WriteMemory21 = WriteMemorySF2;
RomData = rom; RomData = rom;
RomLength = RomData.Length; RomLength = RomData.Length;
} else { }
else
{
// normal rom. // normal rom.
RomData = rom; RomData = rom;
RomLength = RomData.Length; RomLength = RomData.Length;
@ -159,7 +172,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
ArcadeRam = new byte[0x200000]; ArcadeRam = new byte[0x200000];
ArcadeCard = true; ArcadeCard = true;
ArcadeCardRewindHack = game["ArcadeRewindHack"]; ArcadeCardRewindHack = game["ArcadeRewindHack"];
for (int i=0; i<4; i++) for (int i = 0; i < 4; i++)
ArcadePage[i] = new ArcadeCardPage(); ArcadePage[i] = new ArcadeCardPage();
} }
@ -252,7 +265,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public IVideoProvider VideoProvider public IVideoProvider VideoProvider
{ {
get { return (IVideoProvider) VPC ?? VDC1; } get { return (IVideoProvider)VPC ?? VDC1; }
} }
ISoundProvider soundProvider; ISoundProvider soundProvider;
@ -261,7 +274,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
get { return soundProvider; } get { return soundProvider; }
} }
public string SystemId { get { return "PCE"; } } public string SystemId { get { return systemid; } }
public string Region { get; set; } public string Region { get; set; }
public bool DeterministicEmulation { get; set; } public bool DeterministicEmulation { get; set; }
@ -404,7 +417,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
VCE.SaveStateBinary(writer); VCE.SaveStateBinary(writer);
VDC1.SaveStateBinary(writer); VDC1.SaveStateBinary(writer);
PSG.SaveStateBinary(writer); PSG.SaveStateBinary(writer);
} else { }
else
{
writer.Write(Ram); writer.Write(Ram);
writer.Write(Frame); writer.Write(Frame);
writer.Write(_lagcount); writer.Write(_lagcount);
@ -447,7 +462,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
VCE.LoadStateBinary(reader); VCE.LoadStateBinary(reader);
VDC1.LoadStateBinary(reader); VDC1.LoadStateBinary(reader);
PSG.LoadStateBinary(reader); PSG.LoadStateBinary(reader);
} else { }
else
{
Ram = reader.ReadBytes(0x8000); Ram = reader.ReadBytes(0x8000);
Frame = reader.ReadInt32(); Frame = reader.ReadInt32();
_lagcount = reader.ReadInt32(); _lagcount = reader.ReadInt32();

View File

@ -37,6 +37,7 @@
// //
// btnClose // btnClose
// //
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Location = new System.Drawing.Point(453, 3); this.btnClose.Location = new System.Drawing.Point(453, 3);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 23); this.btnClose.Size = new System.Drawing.Size(75, 23);
@ -90,6 +91,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnClose;
this.ClientSize = new System.Drawing.Size(531, 302); this.ClientSize = new System.Drawing.Size(531, 302);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);

View File

@ -796,12 +796,12 @@ namespace BizHawk.MultiClient
private string DisplayNameForSystem(string system) private string DisplayNameForSystem(string system)
{ {
string str = ""; string str = "";
if (INTERIM) str += "(interim) ";
switch (system) switch (system)
{ {
case "SG": str += "SG-1000"; break; case "SG": str += "SG-1000"; break;
case "SMS": str += "Sega Master System"; break; case "SMS": str += "Sega Master System"; break;
case "GG": str += "Game Gear"; break; case "GG": str += "Game Gear"; break;
case "PCECD": str += "TurboGrafx-16 (CD)"; break;
case "PCE": str += "TurboGrafx-16"; break; case "PCE": str += "TurboGrafx-16"; break;
case "SGX": str += "SuperGrafx"; break; case "SGX": str += "SuperGrafx"; break;
case "GEN": str += "Genesis"; break; case "GEN": str += "Genesis"; break;
@ -809,6 +809,7 @@ namespace BizHawk.MultiClient
case "NES": str += "NES"; break; case "NES": str += "NES"; break;
case "GB": str += "Game Boy"; break; case "GB": str += "Game Boy"; break;
} }
if (INTERIM) str += " (interim)";
return str; return str;
} }
@ -858,6 +859,7 @@ namespace BizHawk.MultiClient
Global.AutoFireController = Global.AutofireSMSControls; Global.AutoFireController = Global.AutofireSMSControls;
break; break;
case "PCE": case "PCE":
case "PCECD":
Global.ActiveController = Global.PCEControls; Global.ActiveController = Global.PCEControls;
Global.AutoFireController = Global.AutofirePCEControls; Global.AutoFireController = Global.AutofirePCEControls;
break; break;
@ -975,7 +977,7 @@ namespace BizHawk.MultiClient
// what system the game is for. // what system the game is for.
game = new GameInfo(); game = new GameInfo();
game.System = "PCE"; game.System = "PCECD";
game.Name = Path.GetFileNameWithoutExtension(file.Name); game.Name = Path.GetFileNameWithoutExtension(file.Name);
game.Hash = hash; game.Hash = hash;
} }
@ -983,6 +985,7 @@ namespace BizHawk.MultiClient
switch (game.System) switch (game.System)
{ {
case "PCE": case "PCE":
case "PCECD":
if (File.Exists(Global.Config.PathPCEBios) == false) if (File.Exists(Global.Config.PathPCEBios) == false)
{ {
MessageBox.Show("PCE-CD System Card not found. Please check the BIOS path in Config->Paths->PC Engine."); MessageBox.Show("PCE-CD System Card not found. Please check the BIOS path in Config->Paths->PC Engine.");
@ -1034,6 +1037,7 @@ namespace BizHawk.MultiClient
nextEmulator = new SMS(game, rom.RomData); nextEmulator = new SMS(game, rom.RomData);
break; break;
case "PCE": case "PCE":
case "PCECD":
case "SGX": case "SGX":
if (Global.Config.PceSpriteLimit) game.AddOption("ForceSpriteLimit"); if (Global.Config.PceSpriteLimit) game.AddOption("ForceSpriteLimit");
nextEmulator = new PCEngine(game, rom.RomData); nextEmulator = new PCEngine(game, rom.RomData);

View File

@ -80,6 +80,7 @@ namespace BizHawk.MultiClient
return Global.Config.BaseSMS; return Global.Config.BaseSMS;
case "SGX": case "SGX":
case "PCE": case "PCE":
case "PCECD":
return Global.Config.BasePCE; return Global.Config.BasePCE;
case "TI83": case "TI83":
return Global.Config.BaseTI83; return Global.Config.BaseTI83;
@ -245,6 +246,7 @@ namespace BizHawk.MultiClient
break; break;
case "SFX": case "SFX":
case "PCE": case "PCE":
case "PCECD":
path = PathManager.MakeAbsolutePath(Global.Config.PathPCEROMs, "PCE"); path = PathManager.MakeAbsolutePath(Global.Config.PathPCEROMs, "PCE");
break; break;
case "GB": case "GB":
@ -292,6 +294,7 @@ namespace BizHawk.MultiClient
case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), name + ".SaveRAM"); case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSaveRAM, "SG"), name + ".SaveRAM");
case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM"); case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM");
case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM"); case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM");
case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESaveRAM, "PCE"), name + ".SaveRAM");
case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), name + ".SaveRAM"); case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSaveRAM, "GB"), name + ".SaveRAM");
case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), name + ".SaveRAM"); case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), name + ".SaveRAM");
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), name + ".SaveRAM"); case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), name + ".SaveRAM");
@ -312,6 +315,7 @@ namespace BizHawk.MultiClient
case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), name); case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGSavestates, "SG"), name);
case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name); case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name);
case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name); case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name);
case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCESavestates, "PCE"), name);
case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"), name); case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBSavestates, "GB"), name);
case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), name); case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSavestates, "GEN"), name);
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name); case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSavestates, "NES"), name);
@ -330,6 +334,7 @@ namespace BizHawk.MultiClient
case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG"), name); case "SG": return Path.Combine(MakeAbsolutePath(Global.Config.PathSGScreenshots, "SG"), name);
case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name); case "SGX": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name);
case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name); case "PCE": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name);
case "PCECD": return Path.Combine(MakeAbsolutePath(Global.Config.PathPCEScreenshots, "PCE"), name);
case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB"), name); case "GB": return Path.Combine(MakeAbsolutePath(Global.Config.PathGBScreenshots, "GB"), name);
case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN"), name); case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisScreenshots, "GEN"), name);
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name); case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES"), name);

View File

@ -521,6 +521,7 @@ namespace BizHawk.MultiClient
else else
return frames / NES_NTSC; return frames / NES_NTSC;
case "PCE": case "PCE":
case "PCECD":
return frames / PCE; return frames / PCE;
//One Day! //One Day!