nes-fix bug in base board class wram functionality (forgot to add masking to wram size configured in the Cart struct by the derived board Configure method)
This commit is contained in:
parent
2553ac50bb
commit
c5a2d0f8f0
|
@ -14,8 +14,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
public interface INESBoard : IDisposable
|
public interface INESBoard : IDisposable
|
||||||
{
|
{
|
||||||
|
//base class pre-configuration
|
||||||
void Create(NES nes);
|
void Create(NES nes);
|
||||||
|
//one-time inherited classes configuration
|
||||||
bool Configure(NES.EDetectionOrigin origin);
|
bool Configure(NES.EDetectionOrigin origin);
|
||||||
|
//one-time base class configuration (which can take advantage of any information setup by the more-informed Configure() method)
|
||||||
|
void PostConfigure();
|
||||||
|
|
||||||
//gets called once per PPU clock, for boards with complex behaviour which must be monitoring clock (i.e. mmc3 irq counter)
|
//gets called once per PPU clock, for boards with complex behaviour which must be monitoring clock (i.e. mmc3 irq counter)
|
||||||
void ClockPPU();
|
void ClockPPU();
|
||||||
|
@ -132,9 +136,16 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
if(wram != null)
|
if(wram != null)
|
||||||
wram[addr] = value;
|
wram[addr] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int wram_mask;
|
||||||
|
public virtual void PostConfigure()
|
||||||
|
{
|
||||||
|
wram_mask = (Cart.wram_size * 1024) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual byte ReadWRAM(int addr) {
|
public virtual byte ReadWRAM(int addr) {
|
||||||
if (wram != null)
|
if (wram != null)
|
||||||
return wram[addr];
|
return wram[addr & wram_mask];
|
||||||
else return 0xFF;
|
else return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -530,6 +530,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
cart = choice;
|
cart = choice;
|
||||||
board.Create(this);
|
board.Create(this);
|
||||||
board.Configure(origin);
|
board.Configure(origin);
|
||||||
|
board.PostConfigure();
|
||||||
|
|
||||||
if (origin == EDetectionOrigin.BootGodDB)
|
if (origin == EDetectionOrigin.BootGodDB)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue