[NES] core work for player2 pad
This commit is contained in:
parent
c6a5c7e9b6
commit
d1212176a0
|
@ -46,8 +46,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
ram = new byte[0x800];
|
ram = new byte[0x800];
|
||||||
CIRAM = new byte[0x800];
|
CIRAM = new byte[0x800];
|
||||||
ports = new IPortDevice[2];
|
ports = new IPortDevice[2];
|
||||||
ports[0] = new JoypadPortDevice(this);
|
ports[0] = new JoypadPortDevice(this,0);
|
||||||
ports[1] = new NullPortDevice();
|
ports[1] = new JoypadPortDevice(this,1);
|
||||||
|
|
||||||
//fceux uses this technique, which presumably tricks some games into thinking the memory is randomized
|
//fceux uses this technique, which presumably tricks some games into thinking the memory is randomized
|
||||||
for (int i = 0; i < 0x800; i++)
|
for (int i = 0; i < 0x800; i++)
|
||||||
|
@ -66,8 +66,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
bool resetSignal;
|
bool resetSignal;
|
||||||
public void FrameAdvance(bool render)
|
public void FrameAdvance(bool render)
|
||||||
{
|
{
|
||||||
lagged = true;
|
lagged = true;
|
||||||
if (resetSignal)
|
if (resetSignal)
|
||||||
{
|
{
|
||||||
cpu.PC = cpu.ReadWord(MOS6502.ResetVector);
|
cpu.PC = cpu.ReadWord(MOS6502.ResetVector);
|
||||||
apu.WriteReg(0x4015, 0);
|
apu.WriteReg(0x4015, 0);
|
||||||
|
@ -79,13 +79,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
//Controller.UnpressButton("Reset"); TODO fix this
|
//Controller.UnpressButton("Reset"); TODO fix this
|
||||||
resetSignal = Controller["Reset"];
|
resetSignal = Controller["Reset"];
|
||||||
ppu.FrameAdvance();
|
ppu.FrameAdvance();
|
||||||
if (lagged)
|
if (lagged)
|
||||||
{
|
{
|
||||||
_lagcount++;
|
_lagcount++;
|
||||||
islag = true;
|
islag = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
islag = false;
|
islag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void RunCpu(int ppu_cycles)
|
protected void RunCpu(int ppu_cycles)
|
||||||
|
@ -136,8 +136,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
case 0x4014: /*OAM DMA*/ break;
|
case 0x4014: /*OAM DMA*/ break;
|
||||||
case 0x4015: return apu.ReadReg(addr); break;
|
case 0x4015: return apu.ReadReg(addr); break;
|
||||||
case 0x4016:
|
case 0x4016:
|
||||||
|
case 0x4017:
|
||||||
return read_joyport(addr);
|
return read_joyport(addr);
|
||||||
case 0x4017: return apu.ReadReg(addr); break;
|
|
||||||
default:
|
default:
|
||||||
//Console.WriteLine("read register: {0:x4}", addr);
|
//Console.WriteLine("read register: {0:x4}", addr);
|
||||||
break;
|
break;
|
||||||
|
@ -179,13 +179,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
//read joystick port
|
//read joystick port
|
||||||
//many todos here
|
//many todos here
|
||||||
if (addr == 0x4016)
|
lagged = false;
|
||||||
{
|
byte ret;
|
||||||
lagged = false;
|
if(addr == 0x4016)
|
||||||
byte ret = ports[0].Read();
|
ret = ports[0].Read();
|
||||||
return ret;
|
else ret = ports[1].Read();
|
||||||
}
|
return ret;
|
||||||
else return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exec_OAMDma(byte val)
|
void Exec_OAMDma(byte val)
|
||||||
|
|
|
@ -194,9 +194,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
NES nes;
|
NES nes;
|
||||||
public JoypadPortDevice(NES nes)
|
int player;
|
||||||
|
public JoypadPortDevice(NES nes, int player)
|
||||||
{
|
{
|
||||||
this.nes = nes;
|
this.nes = nes;
|
||||||
|
this.player = player;
|
||||||
}
|
}
|
||||||
void Strobe()
|
void Strobe()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue