(iOS) Fix icade button mapping

This commit is contained in:
meancoot 2013-08-12 19:02:34 -04:00
parent dc16abe728
commit 68e8fbc45f
3 changed files with 12 additions and 4 deletions

View File

@ -86,6 +86,11 @@ void apple_input_enable_icade(bool on)
icade_buttons = 0;
}
uint32_t apple_input_get_icade_buttons()
{
return icade_enabled ? icade_buttons : 0;
}
void apple_input_handle_key_event(unsigned keycode, bool down)
{
keycode = HIDKEY(keycode);
@ -131,7 +136,7 @@ static void apple_input_poll(void *data)
}
input_joypad_poll(g_joydriver);
g_polled_input_data.pad_buttons[0] |= icade_buttons;
g_polled_input_data.pad_buttons[0] |= apple_input_get_icade_buttons();
g_current_input_data.mouse_delta[0] = 0;
g_current_input_data.mouse_delta[1] = 0;

View File

@ -47,6 +47,7 @@ extern apple_input_data_t g_polled_input_data; //< Game thread data
// Main thread only
void apple_input_enable_icade(bool on);
uint32_t apple_input_get_icade_buttons();
void apple_input_handle_key_event(unsigned keycode, bool down);
#endif

View File

@ -755,7 +755,6 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
{ "nul", 0x00},
};
for (int i = 0; ios_key_name_map[i].hid_id; i++)
{
if (g_current_input_data.keys[ios_key_name_map[i].hid_id])
@ -767,9 +766,12 @@ static NSArray* build_input_port_group(config_file_t* config, uint32_t player)
}
// Pad Buttons
for (int i = 0; g_current_input_data.pad_buttons[_value.player] && i < sizeof(g_current_input_data.pad_buttons[_value.player]) * 8; i++)
uint32_t buttons = g_current_input_data.pad_buttons[_value.player] |
((_value.player == 0) ? apple_input_get_icade_buttons() : 0);
for (int i = 0; buttons && i < sizeof(buttons) * 8; i++)
{
if (g_current_input_data.pad_buttons[_value.player] & (1 << i))
if (buttons & (1 << i))
{
_value.msubValues[1] = [NSString stringWithFormat:@"%d", i];
[self finish];