openMSX
KeyboardSettings.cc
Go to the documentation of this file.
1 #include "KeyboardSettings.hh"
2 #include "memory.hh"
3 
4 namespace openmsx {
5 
6 static EnumSetting<Keys::KeyCode>::Map getAllowedKeysMap()
7 {
8  return {
9  {"RALT", Keys::K_RALT},
10  {"MENU", Keys::K_MENU},
11  {"RCTRL", Keys::K_RCTRL},
12  {"HENKAN_MODE", Keys::K_HENKAN_MODE},
13  {"RSHIFT", Keys::K_RSHIFT},
14  {"RMETA", Keys::K_RMETA},
15  {"LMETA", Keys::K_LMETA},
16  {"LSUPER", Keys::K_LSUPER},
17  {"RSUPER", Keys::K_RSUPER},
18  {"HELP", Keys::K_HELP},
19  {"UNDO", Keys::K_UNDO},
20  {"END", Keys::K_END},
21  {"PAGEUP", Keys::K_PAGEUP},
22  {"PAGEDOWN", Keys::K_PAGEDOWN}
23  };
24 }
25 
27  : codeKanaHostKey(commandController,
28  "kbd_code_kana_host_key",
29  "Host key that maps to the MSX CODE/KANA key. Please note that the HENKAN_MODE key only exists on Japanese host keyboards)",
30  Keys::K_RALT, getAllowedKeysMap())
31  , kpEnterMode(commandController,
32  "kbd_numkeypad_enter_key",
33  "MSX key that the enter key on the host numeric keypad must map to",
34  MSX_KP_COMMA, EnumSetting<KpEnterMode>::Map{
35  {"KEYPAD_COMMA", MSX_KP_COMMA},
36  {"ENTER", MSX_ENTER}})
37  , mappingMode(commandController,
38  "kbd_mapping_mode",
39  "Keyboard mapping mode",
40  CHARACTER_MAPPING, EnumSetting<MappingMode>::Map{
41  {"KEY", KEY_MAPPING},
42  {"CHARACTER", CHARACTER_MAPPING}})
43  , alwaysEnableKeypad(commandController,
44  "kbd_numkeypad_always_enabled",
45  "Numeric keypad is always enabled, even on an MSX that does not have one",
46  false)
47  , traceKeyPresses(commandController,
48  "kbd_trace_key_presses",
49  "Trace key presses (show SDL key code, SDL modifiers and Unicode code-point value)",
50  false, Setting::DONT_SAVE)
51  , autoToggleCodeKanaLock(commandController,
52  "kbd_auto_toggle_code_kana_lock",
53  "Automatically toggle the CODE/KANA lock, based on the characters entered on the host keyboard",
54  true)
55 {
56  deadkeyHostKey[0] = make_unique<EnumSetting<Keys::KeyCode>>(
57  commandController, "kbd_deadkey1_host_key",
58  "Host key that maps to deadkey 1. Not applicable to Japanese and Korean MSX models",
59  Keys::K_RCTRL, getAllowedKeysMap());
60 
61  deadkeyHostKey[1] = make_unique<EnumSetting<Keys::KeyCode>>(
62  commandController, "kbd_deadkey2_host_key",
63  "Host key that maps to deadkey 2. Only applicable to Brazilian MSX models (Sharp Hotbit and Gradiente)",
64  Keys::K_PAGEUP, getAllowedKeysMap());
65 
66  deadkeyHostKey[2] = make_unique<EnumSetting<Keys::KeyCode>>(
67  commandController, "kbd_deadkey3_host_key",
68  "Host key that maps to deadkey 3. Only applicable to Brazilian Sharp Hotbit MSX models",
69  Keys::K_PAGEDOWN, getAllowedKeysMap());
70 }
71 
72 } // namespace openmsx
KeyboardSettings(CommandController &commandController)
std::vector< std::pair< std::string, Keys::KeyCode >> Map
Definition: EnumSetting.hh:35
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5