diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index 8f72b0356e..b41c4e7ed3 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -269,6 +269,8 @@
+
+
diff --git a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs
index 432c660eec..0edfdebc72 100644
--- a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs
+++ b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs
@@ -209,14 +209,12 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
// it in the least intrusive and most honest way we can.
if (game["HBlankPeriod"])
- VDC1.HBlankCycles = int.Parse(game.OptionValue("HBlankPeriod"));
+ VDC1.HBlankCycles = game.GetIntValue("HBlankPeriod");
// This is also a hack. Proper multi-res/TV emulation will be a native-code core feature.
if (game["MultiResHack"])
- {
- VDC1.MultiResHack = int.Parse(game.OptionValue("MultiResHack"));
- }
+ VDC1.MultiResHack = game.GetIntValue("MultiResHack");
Cpu.ResetPC();
SetupMemoryDomains();
diff --git a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs
index 45643b9fdb..400edb7538 100644
--- a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs
+++ b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs
@@ -130,6 +130,13 @@ namespace BizHawk.Emulation.Consoles.Sega
MainCPU.Reset();
VDP.GetPC = () => MainCPU.PC;
#endif
+ InitializeCartHardware(game);
+ }
+
+ void InitializeCartHardware(GameInfo game)
+ {
+ LogCartInfo();
+ InitializeSaveRam(game);
}
public void FrameAdvance(bool render)
@@ -260,22 +267,7 @@ namespace BizHawk.Emulation.Consoles.Sega
public bool DeterministicEmulation { get; set; }
public string SystemId { get { return "GEN"; } }
- public byte[] ReadSaveRam
- {
- get { throw new NotImplementedException(); }
- }
-
- public bool SaveRamModified
- {
- get
- {
- return false; // TODO implement
- }
- set
- {
- throw new NotImplementedException();
- }
- }
+
public void SaveStateText(TextWriter writer)
{
diff --git a/BizHawk.Emulation/Consoles/Sega/Genesis/MemoryMap.68000.cs b/BizHawk.Emulation/Consoles/Sega/Genesis/MemoryMap.68000.cs
index ce8d4f6c35..0350820e11 100644
--- a/BizHawk.Emulation/Consoles/Sega/Genesis/MemoryMap.68000.cs
+++ b/BizHawk.Emulation/Consoles/Sega/Genesis/MemoryMap.68000.cs
@@ -8,9 +8,16 @@ namespace BizHawk.Emulation.Consoles.Sega
{
address &= 0x00FFFFFF;
- if (address < 0x400000)
+ if (address < 0x200000)
return (sbyte) RomData[address];
+ if (address < 0x400000)
+ {
+ if (SaveRamEnabled && address >= SaveRamStartOffset && address < SaveRamEndOffset)
+ return (sbyte) SaveRAM[address - SaveRamStartOffset];
+ return (sbyte)RomData[address];
+ }
+
if (address >= 0xE00000)
return (sbyte) Ram[address & 0xFFFF];
@@ -144,6 +151,13 @@ namespace BizHawk.Emulation.Consoles.Sega
return;
}
+ if (SaveRamEnabled && address >= SaveRamStartOffset && address < SaveRamEndOffset)
+ {
+ SaveRAM[address - SaveRamStartOffset] = (byte) value;
+ SaveRamModified = true;
+ return;
+ }
+
Console.WriteLine("UNHANDLED WRITEB {0:X6}:{1:X2}", address, value);
}
diff --git a/BizHawk.Emulation/Database/GameInfo.cs b/BizHawk.Emulation/Database/GameInfo.cs
index 1074e31555..97a38e5ba6 100644
--- a/BizHawk.Emulation/Database/GameInfo.cs
+++ b/BizHawk.Emulation/Database/GameInfo.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using System.Globalization;
namespace BizHawk
{
@@ -87,6 +88,16 @@ namespace BizHawk
return null;
}
+ public int GetIntValue(string option)
+ {
+ return int.Parse(Options[option]);
+ }
+
+ public int GetHexValue(string option)
+ {
+ return int.Parse(Options[option], NumberStyles.HexNumber);
+ }
+
public ICollection GetOptions()
{
return Options.Keys;