mirror of https://github.com/snes9xgit/snes9x.git
Gtk: Get Superscope working.
This commit is contained in:
parent
8028d3b6ca
commit
b19e31c83f
|
@ -721,9 +721,15 @@ void Snes9xConfig::rebind_keys()
|
|||
cmd = S9xGetPortCommandT("{Mouse1 L,Superscope Fire,Justifier1 Trigger}");
|
||||
S9xMapButton(BINDING_MOUSE_BUTTON0, cmd, false);
|
||||
|
||||
cmd = S9xGetPortCommandT("{Justifier1 AimOffscreen Trigger,Superscope AimOffscreen}");
|
||||
cmd = S9xGetPortCommandT("Superscope ToggleTurbo");
|
||||
S9xMapButton(BINDING_MOUSE_BUTTON1, cmd, false);
|
||||
|
||||
cmd = S9xGetPortCommandT("{Mouse1 R,Superscope Cursor,Justifier1 Start}");
|
||||
cmd = S9xGetPortCommandT("{Mouse1 R,Superscope Pause,Justifier1 Start}");
|
||||
S9xMapButton(BINDING_MOUSE_BUTTON2, cmd, false);
|
||||
|
||||
cmd = S9xGetPortCommandT("Superscope Cursor");
|
||||
S9xMapButton(BINDING_MOUSE_BUTTON0 + 7, cmd, false);
|
||||
|
||||
cmd = S9xGetPortCommandT("{Superscope AimOffscreen,Justifier1 AimOffscreen}");
|
||||
S9xMapButton(BINDING_MOUSE_BUTTON0 + 8, cmd, false);
|
||||
}
|
||||
|
|
|
@ -139,8 +139,28 @@ bool S9xPollAxis(uint32 id, int16 *value)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool using_superscope()
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
enum controllers ctl;
|
||||
int8_t id1, id2, id3, id4;
|
||||
S9xGetController(i, &ctl, &id1, &id2, &id3, &id4);
|
||||
if (ctl == CTL_SUPERSCOPE)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool S9xPollPointer(uint32 id, int16 *x, int16 *y)
|
||||
{
|
||||
if (using_superscope())
|
||||
{
|
||||
top_level->snes_mouse_x = std::clamp(top_level->snes_mouse_x, 0.0, 256.0);
|
||||
top_level->snes_mouse_y = std::clamp(top_level->snes_mouse_y, 0.0, 239.0);
|
||||
}
|
||||
|
||||
*x = top_level->snes_mouse_x;
|
||||
*y = top_level->snes_mouse_y;
|
||||
|
||||
|
|
Loading…
Reference in New Issue