From 142f197bfaadc2977bae04f97e75dce2cbca90b1 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Sat, 27 Oct 2012 02:07:19 +0300 Subject: [PATCH] Compensate for nuts bsnes superscope/justifier handling --- src/core/bsnes-legacy.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/core/bsnes-legacy.cpp b/src/core/bsnes-legacy.cpp index 95ed73f1..973a1f7b 100644 --- a/src/core/bsnes-legacy.cpp +++ b/src/core/bsnes-legacy.cpp @@ -414,7 +414,31 @@ namespace int16_t inputPoll(bool port, SNES::Input::Device device, unsigned index, unsigned id) { - return ecore_callbacks->get_input(port ? 1 : 0, index, id); + int16_t offset = 0; + //The superscope/justifier handling is nuts. + if(port && SNES::input.port2) { + SNES::SuperScope* ss = dynamic_cast(SNES::input.port2); + SNES::Justifier* js = dynamic_cast(SNES::input.port2); + if(ss && index == 0) { + if(id == 0) + offset = ss->x; + if(id == 1) + offset = ss->y; + } + if(js && index == 0) { + if(id == 0) + offset = js->player1.x; + if(id == 1) + offset = js->player1.y; + } + if(js && js->chained && index == 1) { + if(id == 0) + offset = js->player2.x; + if(id == 1) + offset = js->player2.y; + } + } + return ecore_callbacks->get_input(port ? 1 : 0, index, id) - offset; } };