Genesis ROM header parsing

and other stuff thats only committed because svn isn't decentralized!
This commit is contained in:
beirich 2012-09-13 04:13:49 +00:00
parent 64cac4c1a2
commit adee5befa5
5 changed files with 38 additions and 21 deletions

View File

@ -269,6 +269,8 @@
<Compile Include="Consoles\PC Engine\MemoryMap.Populous.cs" />
<Compile Include="Consoles\PC Engine\ScsiCDBus.cs" />
<Compile Include="Consoles\PC Engine\TurboCD.cs" />
<Compile Include="Consoles\Sega\Genesis\Cart\RomHeader.cs" />
<Compile Include="Consoles\Sega\Genesis\Cart\SaveRAM.cs" />
<Compile Include="Consoles\Sega\Genesis\Input.cs" />
<Compile Include="Consoles\Sega\SMS\MemoryMap.CodeMasters.cs" />
<Compile Include="Consoles\Sega\SMS\MemoryMap.Sega.cs" />

View File

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

View File

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

View File

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

View File

@ -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<string> GetOptions()
{
return Options.Keys;