static int16_t apple_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id) { apple_input_data_t *apple = (apple_input_data_t*)data; if (!apple || !apple->joypad) return 0; switch (device) { case RETRO_DEVICE_JOYPAD: return apple_input_is_pressed(apple, port, binds[port], id) || input_joypad_pressed(apple->joypad, port, binds[port], id); case RETRO_DEVICE_ANALOG: return input_joypad_analog(apple->joypad, port, idx, id, binds[port]); case RETRO_DEVICE_KEYBOARD: return apple_keyboard_state(apple, id); case RETRO_DEVICE_MOUSE: return apple_mouse_state(apple, id); case RETRO_DEVICE_POINTER: case RARCH_DEVICE_POINTER_SCREEN: return apple_pointer_state(apple, device, idx, id); } return 0; }
static int16_t apple_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id) { apple_input_data_t *apple = (apple_input_data_t*)data; if (!apple || !apple->joypad) return 0; switch (device) { case RETRO_DEVICE_JOYPAD: return apple_input_is_pressed(apple, port, binds[port], id) || input_joypad_pressed(apple->joypad, port, binds[port], id); case RETRO_DEVICE_ANALOG: return input_joypad_analog(apple->joypad, port, index, id, binds[port]); case RETRO_DEVICE_KEYBOARD: { unsigned bit = input_translate_rk_to_keysym((enum retro_key)id); return (id < RETROK_LAST) && apple->key_state[bit]; } case RETRO_DEVICE_MOUSE: return apple_mouse_state(apple, id); case RETRO_DEVICE_POINTER: case RARCH_DEVICE_POINTER_SCREEN: return apple_pointer_state(apple, device, index, id); } return 0; }