diff --git a/input.c b/input.c index 8ede72c..833fae4 100644 --- a/input.c +++ b/input.c @@ -1784,6 +1784,32 @@ static void input_cb(struct input_event *ev, int dev) // keyboard else { + if (!input[dev].has_kbdmap) + { + if (!FileLoadConfig(get_kbdmap_name(dev), &input[dev].kbdmap, sizeof(input[dev].kbdmap))) + { + memset(input[dev].kbdmap, 0, sizeof(input[dev].kbdmap)); + } + input[dev].has_kbdmap = 1; + } + + // replace MENU key by RGUI to allow using Right Amiga on reduced keyboards + // (it also disables the use of Menu for OSD) + uint16_t code = ev->code; + if (mist_cfg.key_menu_as_rgui && code == 139) code = 126; + + //Keyrah v2: USB\VID_18D8&PID_0002\A600/A1200_MULTIMEDIA_EXTENSION_VERSION + int keyrah = (mist_cfg.keyrah_mode && (((((uint32_t)input[dev].vid) << 16) | input[dev].pid) == mist_cfg.keyrah_mode)); + if (keyrah) code = keyrah_trans(code, ev->value); + + uint32_t ps2code = get_ps2_code(code); + if (ev->value) modifier |= ps2code; + else modifier &= ~ps2code; + + uint16_t reset_m = (modifier & MODMASK) >> 8; + if (code == 111) reset_m |= 0x100; + user_io_check_reset(reset_m, (keyrah && !mist_cfg.reset_combo) ? 1 : mist_cfg.reset_combo); + if(!user_io_osd_is_visible() && ((user_io_get_kbdemu() == EMU_JOY0) || (user_io_get_kbdemu() == EMU_JOY1))) { if (!kbd_toggle) @@ -1865,34 +1891,6 @@ static void input_cb(struct input_event *ev, int dev) } } - if (!input[dev].has_kbdmap) - { - if (!FileLoadConfig(get_kbdmap_name(dev), &input[dev].kbdmap, sizeof(input[dev].kbdmap))) - { - memset(input[dev].kbdmap, 0, sizeof(input[dev].kbdmap)); - } - input[dev].has_kbdmap = 1; - } - - static uint16_t mod = 0; - - // replace MENU key by RGUI to allow using Right Amiga on reduced keyboards - // (it also disables the use of Menu for OSD) - uint16_t code = ev->code; - if (mist_cfg.key_menu_as_rgui && code == 139) code = 126; - - //Keyrah v2: USB\VID_18D8&PID_0002\A600/A1200_MULTIMEDIA_EXTENSION_VERSION - int keyrah = (mist_cfg.keyrah_mode && (((((uint32_t)input[dev].vid) << 16) | input[dev].pid) == mist_cfg.keyrah_mode)); - if (keyrah) code = keyrah_trans(code, ev->value); - - uint32_t ps2code = get_ps2_code(code); - if (ev->value) modifier |= ps2code; - else modifier &= ~ps2code; - - uint16_t reset_m = (modifier & MODMASK) >> 8; - if (code == 111) reset_m |= 0x100; - user_io_check_reset(reset_m, (keyrah && !mist_cfg.reset_combo) ? 1 : mist_cfg.reset_combo); - user_io_kbd(code, ev->value); return; }