diff --git a/input/apple_input.c b/input/apple_input.c index d7d43ae1d9..7d67acf2ac 100644 --- a/input/apple_input.c +++ b/input/apple_input.c @@ -131,37 +131,6 @@ void apple_input_enable_small_keyboard(bool on) apple->small_keyboard_enabled = on; } -static void handle_icade_event(unsigned keycode) -{ - static const struct - { - bool up; - int button; - } icade_map[0x20] = - { - { false, -1 }, { false, -1 }, { false, -1 }, { false, -1 }, // 0 - { false, 2 }, { false, -1 }, { true , 3 }, { false, 3 }, // 4 - { true , 0 }, { true, 5 }, { true , 7 }, { false, 8 }, // 8 - { false, 6 }, { false, 9 }, { false, 10 }, { false, 11 }, // C - { true , 6 }, { true , 9 }, { false, 7 }, { true, 10 }, // 0 - { true , 2 }, { true , 8 }, { false, -1 }, { true , 4 }, // 4 - { false, 5 }, { true , 11 }, { false, 0 }, { false, 1 }, // 8 - { false, 4 }, { true , 1 }, { false, -1 }, { false, -1 } // C - }; - apple_input_data_t *apple = (apple_input_data_t*)driver.input_data; - - if (apple->icade_enabled && (keycode < 0x20) - && (icade_map[keycode].button >= 0)) - { - const int button = icade_map[keycode].button; - - if (icade_map[keycode].up) - BIT32_CLEAR(apple->icade_buttons, button); - else - BIT32_SET(apple->icade_buttons, button); - } -} - void apple_input_enable_icade(bool on) { apple_input_data_t *apple = (apple_input_data_t*)driver.input_data; diff --git a/input/keyboard_event_apple.c b/input/keyboard_event_apple.c index af874419da..5af114eec2 100644 --- a/input/keyboard_event_apple.c +++ b/input/keyboard_event_apple.c @@ -100,6 +100,37 @@ static bool handle_small_keyboard(unsigned* code, bool down) return false; } +static void handle_icade_event(unsigned keycode) +{ + static const struct + { + bool up; + int button; + } icade_map[0x20] = + { + { false, -1 }, { false, -1 }, { false, -1 }, { false, -1 }, // 0 + { false, 2 }, { false, -1 }, { true , 3 }, { false, 3 }, // 4 + { true , 0 }, { true, 5 }, { true , 7 }, { false, 8 }, // 8 + { false, 6 }, { false, 9 }, { false, 10 }, { false, 11 }, // C + { true , 6 }, { true , 9 }, { false, 7 }, { true, 10 }, // 0 + { true , 2 }, { true , 8 }, { false, -1 }, { true , 4 }, // 4 + { false, 5 }, { true , 11 }, { false, 0 }, { false, 1 }, // 8 + { false, 4 }, { true , 1 }, { false, -1 }, { false, -1 } // C + }; + apple_input_data_t *apple = (apple_input_data_t*)driver.input_data; + + if (apple->icade_enabled && (keycode < 0x20) + && (icade_map[keycode].button >= 0)) + { + const int button = icade_map[keycode].button; + + if (icade_map[keycode].up) + BIT32_CLEAR(apple->icade_buttons, button); + else + BIT32_SET(apple->icade_buttons, button); + } +} + void apple_input_keyboard_event(bool down, unsigned code, uint32_t character, uint32_t mod) {