[NES] core work for player2 pad

This commit is contained in:
zeromus 2011-06-18 21:47:20 +00:00
parent c6a5c7e9b6
commit d1212176a0
2 changed files with 21 additions and 20 deletions

View File

@ -46,8 +46,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
ram = new byte[0x800];
CIRAM = new byte[0x800];
ports = new IPortDevice[2];
ports[0] = new JoypadPortDevice(this);
ports[1] = new NullPortDevice();
ports[0] = new JoypadPortDevice(this,0);
ports[1] = new JoypadPortDevice(this,1);
//fceux uses this technique, which presumably tricks some games into thinking the memory is randomized
for (int i = 0; i < 0x800; i++)
@ -136,8 +136,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
case 0x4014: /*OAM DMA*/ break;
case 0x4015: return apu.ReadReg(addr); break;
case 0x4016:
case 0x4017:
return read_joyport(addr);
case 0x4017: return apu.ReadReg(addr); break;
default:
//Console.WriteLine("read register: {0:x4}", addr);
break;
@ -179,14 +179,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
//read joystick port
//many todos here
if (addr == 0x4016)
{
lagged = false;
byte ret = ports[0].Read();
byte ret;
if(addr == 0x4016)
ret = ports[0].Read();
else ret = ports[1].Read();
return ret;
}
else return 0;
}
void Exec_OAMDma(byte val)
{

View File

@ -194,9 +194,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
int state;
NES nes;
public JoypadPortDevice(NES nes)
int player;
public JoypadPortDevice(NES nes, int player)
{
this.nes = nes;
this.player = player;
}
void Strobe()
{