SourMesen / Mesen-S

Mesen-S is a cross-platform (Windows & Linux) SNES emulator built in C++ and C#
GNU General Public License v3.0
415 stars 102 forks source link

Lua EventCallback not working for IRQ and NMI #134

Closed binarycounter closed 4 years ago

binarycounter commented 4 years ago

I'm having trouble getting IRQ and NMI event callbacks to work. startFrame, endFrame, inputPolled and reset seem to be working. Here's a test script to reproduce the issue:

function logIRQ()
  emu.log("IRQ happened!")
end
function logNMI()
  emu.log("NMI happened!")
end
function logFrameStart()
  emu.log("FrameStart happened!")
end
function logFrameEnd()
  emu.log("FrameEnd happened!")
end

emu.addEventCallback(logIRQ,emu.eventType.irq)
emu.addEventCallback(logNMI,emu.eventType.nmi)
emu.addEventCallback(logFrameStart,emu.eventType.startFrame)
emu.addEventCallback(logFrameEnd,emu.eventType.endFrame)

Output:

Loading script...
Script loaded successfully.
FrameStart happened!
FrameEnd happened!
FrameStart happened!
FrameEnd happened!
FrameStart happened!
FrameEnd happened!
...

I'd expect there to be at least one IRQ and NMI message between each startFrame and endFrame. I tested this on SMW, which should use both IRQ and NMI. Mesen-S Version 0.4.0.33 on Windows.

Thank you!

SourMesen commented 4 years ago

Thanks for the report! The NMI/IRQ events apparently never got hooked up properly. Should be working properly now with e4a28625f51a06b949cce766f6f71faa81c3c950