Rough in some stuff for better oninputpoll in snes. Not hooked up in looah yet. The idea is that oninputpoll will get called with a core-specific int that signifies what happened.
For snes, we're looking at: 0 = latch goes low 1 = latch goes high 2 = left port strobed 3 = right port strobed
This commit is contained in:
parent
d8554ee536
commit
eb2ec58b1b
|
@ -284,7 +284,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem();
|
||||
|
||||
// TODO: optimize managed to unmanaged using the ActiveChanged event
|
||||
public IInputCallbackSystem InputCallbacks { [FeatureNotImplemented]get { return _inputCallbacks; } }
|
||||
public IInputCallbackSystem InputCallbacks { get { return _inputCallbacks; } }
|
||||
|
||||
public ITraceable Tracer { get; private set; }
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get; private set; }
|
||||
|
@ -501,7 +501,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
{
|
||||
// as this is implemented right now, only P1 and P2 normal controllers work
|
||||
|
||||
InputCallbacks.Call();
|
||||
// port = 0, oninputpoll = 2: left port was strobed
|
||||
// port = 1, oninputpoll = 3: right port was strobed
|
||||
Console.WriteLine("ONINPUTPOLL: {0}", port + 2);
|
||||
|
||||
// InputCallbacks.Call();
|
||||
//Console.WriteLine("{0} {1} {2} {3}", port, device, index, id);
|
||||
|
||||
string key = "P" + (1 + port) + " ";
|
||||
|
@ -539,7 +543,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
|
||||
void snes_input_notify(int index)
|
||||
{
|
||||
IsLagFrame = false;
|
||||
// gets called with the following numbers:
|
||||
// 4xxx : lag frame related
|
||||
// 0: signifies latch bit going to 0. should be reported as oninputpoll
|
||||
// 1: signifies latch bit going to 1. should be reported as oninputpoll
|
||||
if (index >= 0x4000)
|
||||
IsLagFrame = false;
|
||||
else
|
||||
Console.WriteLine("ONINPUTPOLL: {0}", index);
|
||||
}
|
||||
|
||||
void snes_video_refresh(int* data, int width, int height)
|
||||
|
|
|
@ -132,6 +132,7 @@ void CPU::mmio_write(unsigned addr, uint8 data) {
|
|||
case 0x4016: {
|
||||
input.port1->latch(data & 1);
|
||||
input.port2->latch(data & 1);
|
||||
interface()->inputNotify(data & 1); // latch notify
|
||||
if (!status.auto_joypad_poll_enabled) { interface()->inputNotify(0x4016); }
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -87,10 +87,14 @@ void CPU::scanline() {
|
|||
}
|
||||
|
||||
void CPU::run_auto_joypad_poll() {
|
||||
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
input.port1->latch(0);
|
||||
input.port2->latch(0);
|
||||
interface()->inputNotify(1);
|
||||
interface()->inputNotify(0);
|
||||
|
||||
|
||||
uint16 joy1 = 0, joy2 = 0, joy3 = 0, joy4 = 0;
|
||||
for(unsigned i = 0; i < 16; i++) {
|
||||
|
|
|
@ -35,6 +35,7 @@ void CPU::mmio_w2183(uint8 data) {
|
|||
void CPU::mmio_w4016(uint8 data) {
|
||||
input.port1->latch(data & 1);
|
||||
input.port2->latch(data & 1);
|
||||
interface()->inputNotify(data & 1);
|
||||
}
|
||||
|
||||
//JOYSER0
|
||||
|
|
|
@ -13,6 +13,8 @@ void CPU::step_auto_joypad_poll() {
|
|||
input.port2->latch(1);
|
||||
input.port1->latch(0);
|
||||
input.port2->latch(0);
|
||||
interface()->inputNotify(1);
|
||||
interface()->inputNotify(0);
|
||||
}
|
||||
|
||||
uint2 port0 = input.port1->data();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue