Compensate for nuts bsnes superscope/justifier handling

Conflicts:

	src/core/bsnes-legacy.cpp
This commit is contained in:
Ilari Liusvaara 2012-10-27 02:08:22 +03:00
parent 57dce713e3
commit e02786c65d

View file

@ -430,7 +430,31 @@ namespace
int16_t inputPoll(bool port, SNES::Input::Device device, unsigned index, unsigned id)
{
return ecore_callbacks->get_input(port ? 2 : 1, index, id);
int16_t offset = 0;
//The superscope/justifier handling is nuts.
if(port && SNES::input.port2) {
SNES::SuperScope* ss = dynamic_cast<SNES::SuperScope*>(SNES::input.port2);
SNES::Justifier* js = dynamic_cast<SNES::Justifier*>(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 ? 2 : 1, index, id) - offset;
}
};