static int16_t ps3_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { (void)data; unsigned player = port; uint64_t button = binds[player][id].joykey; int16_t retval = 0; if (player < pads_connected) { switch (device) { case RETRO_DEVICE_JOYPAD: retval = (state[player] & button) ? 1 : 0; break; #ifdef HAVE_MOUSE case RETRO_DEVICE_MOUSE: retval = ps3_mouse_device_state(data, player, id); break; #endif } } return retval; }
static int16_t ps3_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { ps3_input_t *ps3 = (ps3_input_t*)data; int16_t retval = 0; if (!ps3) return 0; if (port < ps3->pads_connected) { switch (device) { case RETRO_DEVICE_JOYPAD: if (binds[port][id].joykey >= CONSOLE_MENU_FIRST && binds[port][id].joykey <= CONSOLE_MENU_LAST) return ps3_menu_input_state(binds[port][id].joykey, ps3->pad_state[port]) ? 1 : 0; else return input_joypad_pressed(&ps3_joypad, port, binds[port], id); case RETRO_DEVICE_ANALOG: return input_joypad_analog(&ps3_joypad, port, index, id, binds[port]); #if 0 case RETRO_DEVICE_SENSOR_ACCELEROMETER: switch (id) { // fixed range of 0x000 - 0x3ff case RETRO_DEVICE_ID_SENSOR_ACCELEROMETER_X: retval = ps3->accelerometer_state[port].x; break; case RETRO_DEVICE_ID_SENSOR_ACCELEROMETER_Y: retval = ps3->accelerometer_state[port].y; break; case RETRO_DEVICE_ID_SENSOR_ACCELEROMETER_Z: retval = ps3->accelerometer_state[port].z; break; default: retval = 0; } break; #endif #ifdef HAVE_MOUSE case RETRO_DEVICE_MOUSE: retval = ps3_mouse_device_state(data, port, id); break; #endif default: return 0; } } return retval; }
static int16_t ps3_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { ps3_input_t *ps3 = (ps3_input_t*)data; if (!ps3) return 0; switch (device) { case RETRO_DEVICE_JOYPAD: return input_joypad_pressed(ps3->joypad, port, binds[port], id); case RETRO_DEVICE_ANALOG: return input_joypad_analog(ps3->joypad, port, index, id, binds[port]); #if 0 case RETRO_DEVICE_SENSOR_ACCELEROMETER: switch (id) { // fixed range of 0x000 - 0x3ff case RETRO_DEVICE_ID_SENSOR_ACCELEROMETER_X: retval = ps3->accelerometer_state[port].x; break; case RETRO_DEVICE_ID_SENSOR_ACCELEROMETER_Y: retval = ps3->accelerometer_state[port].y; break; case RETRO_DEVICE_ID_SENSOR_ACCELEROMETER_Z: retval = ps3->accelerometer_state[port].z; break; default: retval = 0; } break; #endif #ifdef HAVE_MOUSE case RETRO_DEVICE_MOUSE: return ps3_mouse_device_state(data, port, id); #endif } return 0; }