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,26 +256,24 @@ void apple_input_reset_icade_buttons(void)
icade_buttons = 0;
}
/* This is copied here as it isn't
* defined in any standard iOS header.
*/
enum
{
NSAlphaShiftKeyMask = 1 << 16,
NSShiftKeyMask = 1 << 17,
NSControlKeyMask = 1 << 18,
NSAlternateKeyMask = 1 << 19,
NSCommandKeyMask = 1 << 20,
NSNumericPadKeyMask = 1 << 21,
NSHelpKeyMask = 1 << 22,
NSFunctionKeyMask = 1 << 23,
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;
/* This is copied here as it isn't
* defined in any standard iOS header */
enum
{
NSAlphaShiftKeyMask = 1 << 16,
NSShiftKeyMask = 1 << 17,
NSControlKeyMask = 1 << 18,
NSAlternateKeyMask = 1 << 19,
NSCommandKeyMask = 1 << 20,
NSNumericPadKeyMask = 1 << 21,
NSHelpKeyMask = 1 << 22,
NSFunctionKeyMask = 1 << 23,
NSDeviceIndependentModifierFlagsMask = 0xffff0000U
};
code = HIDKEY(code);
@ -378,15 +376,13 @@ static bool apple_key_pressed(apple_input_data_t *apple,
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)
{
if (id < RARCH_BIND_LIST_END)
{
const struct retro_keybind *bind = &binds[id];
if (bind->valid)
return apple_key_pressed(apple, bind->key) ||
input_joypad_pressed(apple->joypad, port, bind, id);
return bind->valid && apple_key_pressed(apple, bind->key);
}
return 0;
}
@ -424,13 +420,14 @@ static void apple_input_poll(void *data)
#endif
for (i = 0; i < apple->touch_count; i++)
input_translate_coord_viewport(
apple->touches[i].screen_x,
apple->touches[i].screen_y,
&apple->touches[i].fixed_x,
&apple->touches[i].fixed_y,
&apple->touches[i].full_x,
&apple->touches[i].full_y);
{
input_translate_coord_viewport(apple->touches[i].screen_x,
apple->touches[i].screen_y,
&apple->touches[i].fixed_x,
&apple->touches[i].fixed_y,
&apple->touches[i].full_x,
&apple->touches[i].full_y);
}
if (apple->joypad)
apple->joypad->poll();
@ -494,7 +491,8 @@ static int16_t apple_input_state(void *data,
switch (device)
{
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:
return input_joypad_analog(apple->joypad, 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];
apple_input_data_t *apple = (apple_input_data_t*)data;
if (apple && binds)
return apple_is_pressed(apple, 0, binds, key);
return false;
return apple_is_pressed(apple, 0, binds, key) ||
input_joypad_pressed(apple->joypad, 0, binds, key);
}
static void apple_input_free_input(void *data)
@ -527,7 +524,7 @@ static void apple_input_free_input(void *data)
if (!apple)
return;
if (apple->joypad)
if (apple && apple->joypad)
apple->joypad->destroy();
free(apple);