Revert "(Apple) apple_input.c - cleanups"

This reverts commit 24f091491e84337d17ba1f5336804dd310184d49.
This commit is contained in:
Twinaphex 2014-10-04 14:44:21 +02:00
parent 24f091491e
commit 7950de0460

View File

@ -256,9 +256,12 @@ void apple_input_reset_icade_buttons(void)
icade_buttons = 0; icade_buttons = 0;
} }
void apple_input_keyboard_event(bool down,
unsigned code, uint32_t character, uint32_t mod)
{
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
/* This is copied here as it isn't /* This is copied here as it isn't
* defined in any standard iOS header. * defined in any standard iOS header */
*/
enum enum
{ {
NSAlphaShiftKeyMask = 1 << 16, NSAlphaShiftKeyMask = 1 << 16,
@ -272,11 +275,6 @@ enum
NSDeviceIndependentModifierFlagsMask = 0xffff0000U NSDeviceIndependentModifierFlagsMask = 0xffff0000U
}; };
void apple_input_keyboard_event(bool down,
unsigned code, uint32_t character, uint32_t mod)
{
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
code = HIDKEY(code); code = HIDKEY(code);
if (icade_enabled) if (icade_enabled)
@ -378,15 +376,13 @@ static bool apple_key_pressed(apple_input_data_t *apple,
return false; return false;
} }
static int16_t apple_is_pressed(apple_input_data_t *apple, unsigned port, static int16_t apple_is_pressed(apple_input_data_t *apple, unsigned port_num,
const struct retro_keybind *binds, unsigned id) const struct retro_keybind *binds, unsigned id)
{ {
if (id < RARCH_BIND_LIST_END) if (id < RARCH_BIND_LIST_END)
{ {
const struct retro_keybind *bind = &binds[id]; const struct retro_keybind *bind = &binds[id];
if (bind->valid) return bind->valid && apple_key_pressed(apple, bind->key);
return apple_key_pressed(apple, bind->key) ||
input_joypad_pressed(apple->joypad, port, bind, id);
} }
return 0; return 0;
} }
@ -424,13 +420,14 @@ static void apple_input_poll(void *data)
#endif #endif
for (i = 0; i < apple->touch_count; i++) for (i = 0; i < apple->touch_count; i++)
input_translate_coord_viewport( {
apple->touches[i].screen_x, input_translate_coord_viewport(apple->touches[i].screen_x,
apple->touches[i].screen_y, apple->touches[i].screen_y,
&apple->touches[i].fixed_x, &apple->touches[i].fixed_x,
&apple->touches[i].fixed_y, &apple->touches[i].fixed_y,
&apple->touches[i].full_x, &apple->touches[i].full_x,
&apple->touches[i].full_y); &apple->touches[i].full_y);
}
if (apple->joypad) if (apple->joypad)
apple->joypad->poll(); apple->joypad->poll();
@ -494,7 +491,8 @@ static int16_t apple_input_state(void *data,
switch (device) switch (device)
{ {
case RETRO_DEVICE_JOYPAD: case RETRO_DEVICE_JOYPAD:
return apple_is_pressed(apple, port, binds[port], id); return apple_is_pressed(apple, port, binds[port], id) ||
input_joypad_pressed(apple->joypad, port, binds[port], id);
case RETRO_DEVICE_ANALOG: case RETRO_DEVICE_ANALOG:
return input_joypad_analog(apple->joypad, port, return input_joypad_analog(apple->joypad, port,
index, id, binds[port]); index, id, binds[port]);
@ -515,9 +513,8 @@ static bool apple_bind_button_pressed(void *data, int key)
const struct retro_keybind *binds = g_settings.input.binds[0]; const struct retro_keybind *binds = g_settings.input.binds[0];
apple_input_data_t *apple = (apple_input_data_t*)data; apple_input_data_t *apple = (apple_input_data_t*)data;
if (apple && binds) return apple_is_pressed(apple, 0, binds, key) ||
return apple_is_pressed(apple, 0, binds, key); input_joypad_pressed(apple->joypad, 0, binds, key);
return false;
} }
static void apple_input_free_input(void *data) static void apple_input_free_input(void *data)
@ -527,7 +524,7 @@ static void apple_input_free_input(void *data)
if (!apple) if (!apple)
return; return;
if (apple->joypad) if (apple && apple->joypad)
apple->joypad->destroy(); apple->joypad->destroy();
free(apple); free(apple);