Update for VS Castlevania

This commit is contained in:
alyosha-tas 2016-10-30 19:31:41 -04:00 committed by GitHub
parent a28e016cbb
commit b6a786d5a2
1 changed files with 45 additions and 3 deletions

View File

@ -26,6 +26,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state //state
int prg; int prg;
//the VS actually does have 2 KB of nametable address space
//let's make the extra space here, instead of in the main NES to avoid confusion
byte[] CIRAM_VS = new byte[0x800];
public override bool Configure(NES.EDetectionOrigin origin) public override bool Configure(NES.EDetectionOrigin origin)
{ {
adjust_prg = (x) => x; adjust_prg = (x) => x;
@ -58,7 +62,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case "JALECO-JF-18": case "JALECO-JF-18":
AssertPrg(256); AssertChr(0); AssertVram(8); AssertWram(0); AssertPrg(256); AssertChr(0); AssertVram(8); AssertWram(0);
break; break;
case "NES-UNROM_VS":
NES._isVS = true;
break;
default: default:
return false; return false;
} }
@ -88,7 +94,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ {
return VRAM[addr & vram_byte_mask]; return VRAM[addr & vram_byte_mask];
} }
else return base.ReadPPU(addr); else
{
if (NES._isVS)
{
addr = addr - 0x2000;
if (addr < 0x800)
{
return NES.CIRAM[addr];
}
else
{
return CIRAM_VS[addr - 0x800];
}
}
else
return base.ReadPPU(addr);
}
} }
public override void WritePPU(int addr, byte value) public override void WritePPU(int addr, byte value)
@ -97,13 +119,33 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ {
VRAM[addr & vram_byte_mask] = value; VRAM[addr & vram_byte_mask] = value;
} }
else base.WritePPU(addr,value); else if (NES._isVS)
{
// The game VS Castlevania apparently scans for more CIRAM then actually exists, so we have to mask out nonsensical values
addr &= 0x2FFF;
addr = addr - 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
}
else
{
CIRAM_VS[addr - 0x800] = value;
}
}
else
base.WritePPU(addr,value);
} }
public override void SyncState(Serializer ser) public override void SyncState(Serializer ser)
{ {
base.SyncState(ser); base.SyncState(ser);
ser.Sync("prg", ref prg); ser.Sync("prg", ref prg);
if (NES.IsVS)
ser.Sync("VS_CIRAM", ref CIRAM_VS, false);
} }
} }
} }