MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / inputdevice_getjoyportdevice

Function inputdevice_getjoyportdevice

src/inputdevice.cpp:10562–10592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10560}
10561
10562int inputdevice_getjoyportdevice (int port, int val)
10563{
10564 int idx;
10565 if (val < 0) {
10566 idx = -1;
10567 } else if (val >= JSEM_MICE) {
10568 idx = val - JSEM_MICE;
10569 if (idx >= inputdevice_get_device_total (IDTYPE_MOUSE))
10570 idx = 0;
10571 else
10572 idx += inputdevice_get_device_total (IDTYPE_JOYSTICK);
10573 idx += JSEM_LASTKBD;
10574 } else if (val >= JSEM_JOYS) {
10575 idx = val - JSEM_JOYS;
10576 if (idx >= inputdevice_get_device_total (IDTYPE_JOYSTICK))
10577 idx = 0;
10578 idx += JSEM_LASTKBD;
10579 } else if (val >= JSEM_CUSTOM) {
10580 idx = val - JSEM_CUSTOM;
10581 if (idx >= MAX_JPORTS_CUSTOM)
10582 idx = 0;
10583 if (port >= 2) {
10584 idx += JSEM_LASTKBD + inputdevice_get_device_total(IDTYPE_JOYSTICK);
10585 } else {
10586 idx += JSEM_LASTKBD + inputdevice_get_device_total(IDTYPE_MOUSE) + inputdevice_get_device_total(IDTYPE_JOYSTICK);
10587 }
10588 } else {
10589 idx = val - JSEM_KBDLAYOUT;
10590 }
10591 return idx;
10592}
10593
10594static struct jport jport_config_store[MAX_JPORTS];
10595

Callers 1

inputdevice_devicechangeFunction · 0.85

Calls 1

Tested by

no test coverage detected