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; }
static bool cocoa_input_key_pressed(void *data, int key) { cocoa_input_data_t *apple = (cocoa_input_data_t*)data; settings_t *settings = config_get_ptr(); int port = 0; if (apple_input_is_pressed(0, settings->input.binds[0], key)) return true; if (settings->input.all_users_control_menu) { for (port = 0; port < MAX_USERS; port++) { if (input_joypad_pressed(apple->joypad, port, settings->input.binds[0], key)) return true; #ifdef HAVE_MFI if (input_joypad_pressed(apple->sec_joypad, port, settings->input.binds[0], key)) return true; #endif } } else if (input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key)) return true; #ifdef HAVE_MFI if (input_joypad_pressed(apple->sec_joypad, 0, settings->input.binds[0], key)) return true; #endif return false; }
static bool apple_input_bind_button_pressed(void *data, int key) { apple_input_data_t *apple = (apple_input_data_t*)data; if (apple && apple->joypad) return apple_input_is_pressed(apple, 0, g_settings.input.binds[0], key) || input_joypad_pressed(apple->joypad, 0, g_settings.input.binds[0], key); return false; }
static bool apple_input_bind_button_pressed(void *data, int key) { apple_input_data_t *apple = (apple_input_data_t*)data; settings_t *settings = config_get_ptr(); if (apple && apple->joypad) return apple_input_is_pressed(apple, 0, settings->input.binds[0], key) || input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key); return false; }
static int16_t cocoa_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id) { int16_t ret = 0; cocoa_input_data_t *apple = (cocoa_input_data_t*)data; if (!apple || !apple->joypad) return 0; switch (device) { case RETRO_DEVICE_JOYPAD: if (binds[port] && binds[port][id].valid) { return apple_input_is_pressed(port, binds[port], id) || input_joypad_pressed(apple->joypad, port, binds[port], id) #ifdef HAVE_MFI || input_joypad_pressed(apple->sec_joypad, port, binds[port], id) #endif ; } break; case RETRO_DEVICE_ANALOG: #ifdef HAVE_MFI if (binds[port]) ret = input_joypad_analog(apple->sec_joypad, port, idx, id, binds[port]); #endif if (!ret && binds[port]) ret = input_joypad_analog(apple->joypad, port, idx, id, binds[port]); return ret; case RETRO_DEVICE_KEYBOARD: return apple_keyboard_state(id); case RETRO_DEVICE_MOUSE: return cocoa_mouse_state(apple, id); case RARCH_DEVICE_MOUSE_SCREEN: return cocoa_mouse_state_screen(apple, id); case RETRO_DEVICE_POINTER: case RARCH_DEVICE_POINTER_SCREEN: return cocoa_pointer_state(apple, device, idx, id); } return 0; }