diff --git a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs index c444df9759..e986c74972 100644 --- a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; +using BizHawk.Common; using BizHawk.Client.Common; using BizHawk.Emulation.Common; using BizHawk.Client.EmuHawk.WinFormExtensions; @@ -84,7 +85,7 @@ namespace BizHawk.Client.EmuHawk return new AnalogBindPanel(settings, buttons) { Dock = DockStyle.Fill, AutoScroll = true }; } - private static void LoadToPanel(Control dest, string controllerName, IList controllerButtons, IDictionary> settingsblock, T defaultvalue, PanelCreator createpanel) + private static void LoadToPanel(Control dest, string controllerName, IList controllerButtons, Dictionary categoryLabels, IDictionary> settingsblock, T defaultvalue, PanelCreator createpanel) { Dictionary settings; if (!settingsblock.TryGetValue(controllerName, out settings)) @@ -109,6 +110,7 @@ namespace BizHawk.Client.EmuHawk // split the list of all settings into buckets by player number var buckets = new List[MAXPLAYERS + 1]; + var categoryBuckets = new WorkingDictionary>(); for (var i = 0; i < buckets.Length; i++) { buckets[i] = new List(); @@ -133,7 +135,14 @@ namespace BizHawk.Client.EmuHawk i = 0; } - buckets[i].Add(button); + if (button == "Pointer Pressed") + { + int zzz = 9; + } + + if (categoryLabels.ContainsKey(button)) + categoryBuckets[categoryLabels[button]].Add(button); + else buckets[i].Add(button); } if (buckets[0].Count == controllerButtons.Count) @@ -158,6 +167,13 @@ namespace BizHawk.Client.EmuHawk } } + foreach (var cat in categoryBuckets) + { + string tabname = cat.Key; + tt.TabPages.Add(tabname); + tt.TabPages[pageidx].Controls.Add(createpanel(settings, cat.Value, tt.Size)); + } + if (buckets[0].Count > 0) { string tabname = Global.Emulator.SystemId == "C64" ? "Keyboard" : "Console"; // hack @@ -189,9 +205,9 @@ namespace BizHawk.Client.EmuHawk IDictionary> autofire, IDictionary> analog) { - LoadToPanel(NormalControlsTab, _theDefinition.Name, _theDefinition.BoolButtons, normal, string.Empty, CreateNormalPanel); - LoadToPanel(AutofireControlsTab, _theDefinition.Name, _theDefinition.BoolButtons, autofire, string.Empty, CreateNormalPanel); - LoadToPanel(AnalogControlsTab, _theDefinition.Name, _theDefinition.FloatControls, analog, new Config.AnalogBind(string.Empty, 1.0f, 0.1f), CreateAnalogPanel); + LoadToPanel(NormalControlsTab, _theDefinition.Name, _theDefinition.BoolButtons, _theDefinition.CategoryLabels, normal, string.Empty, CreateNormalPanel); + LoadToPanel(AutofireControlsTab, _theDefinition.Name, _theDefinition.BoolButtons, _theDefinition.CategoryLabels, autofire, string.Empty, CreateNormalPanel); + LoadToPanel(AnalogControlsTab, _theDefinition.Name, _theDefinition.FloatControls, _theDefinition.CategoryLabels, analog, new Config.AnalogBind(string.Empty, 1.0f, 0.1f), CreateAnalogPanel); if (AnalogControlsTab.Controls.Count == 0) { diff --git a/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs b/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs index f20ed1d22f..f4d81bf2bb 100644 --- a/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs +++ b/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs @@ -81,6 +81,7 @@ namespace BizHawk.Emulation.Common public string Name { get; set; } + public Dictionary CategoryLabels = new Dictionary(); public List BoolButtons { get; set; } public List FloatControls { get; private set; } public List FloatRanges { get; private set; } diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 821d875f10..74216b0188 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -867,8 +867,6 @@ - - @@ -877,6 +875,9 @@ + + + diff --git a/BizHawk.Emulation.Cores/LibRetro.cs b/BizHawk.Emulation.Cores/Libretro/LibRetro.cs similarity index 100% rename from BizHawk.Emulation.Cores/LibRetro.cs rename to BizHawk.Emulation.Cores/Libretro/LibRetro.cs diff --git a/BizHawk.Emulation.Cores/Libretro/LibRetroEmulator.InputCallbacks.cs b/BizHawk.Emulation.Cores/Libretro/LibRetroEmulator.InputCallbacks.cs new file mode 100644 index 0000000000..3a867d4b24 --- /dev/null +++ b/BizHawk.Emulation.Cores/Libretro/LibRetroEmulator.InputCallbacks.cs @@ -0,0 +1,219 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; +using Newtonsoft.Json; + +using BizHawk.Common; +using BizHawk.Emulation.Common; +using BizHawk.Common.BufferExtensions; + +namespace BizHawk.Emulation.Cores +{ + partial class LibRetroEmulator + { + //meanings (they are kind of hazy, but once we're done implementing this it will be completely defined by example) + //port = console physical port? + //device = logical device type + //index = sub device index? (multitap?) + //id = button id (or key id) + short retro_input_state(uint port, uint device, uint index, uint id) + { + //helpful debugging + //Console.WriteLine("{0} {1} {2} {3}", port, device, index, id); + + switch ((LibRetro.RETRO_DEVICE)device) + { + case LibRetro.RETRO_DEVICE.POINTER: + { + switch ((LibRetro.RETRO_DEVICE_ID_POINTER)id) + { + case LibRetro.RETRO_DEVICE_ID_POINTER.X: return (short)Controller.GetFloat("Pointer X"); + case LibRetro.RETRO_DEVICE_ID_POINTER.Y: return (short)Controller.GetFloat("Pointer Y"); + case LibRetro.RETRO_DEVICE_ID_POINTER.PRESSED: return (short)(Controller["Pointer Pressed"] ? 1 : 0); + } + return 0; + } + + case LibRetro.RETRO_DEVICE.KEYBOARD: + { + string button = ""; + switch ((LibRetro.RETRO_KEY)id) + { + case LibRetro.RETRO_KEY.BACKSPACE: button = "Backspace"; break; + case LibRetro.RETRO_KEY.TAB: button = "Tab"; break; + case LibRetro.RETRO_KEY.CLEAR: button = "Clear"; break; + case LibRetro.RETRO_KEY.RETURN: button = "Return"; break; + case LibRetro.RETRO_KEY.PAUSE: button = "Pause"; break; + case LibRetro.RETRO_KEY.ESCAPE: button = "Escape"; break; + case LibRetro.RETRO_KEY.SPACE: button = "Space"; break; + case LibRetro.RETRO_KEY.EXCLAIM: button = "Exclaim"; break; + case LibRetro.RETRO_KEY.QUOTEDBL: button = "QuoteDbl"; break; + case LibRetro.RETRO_KEY.HASH: button = "Hash"; break; + case LibRetro.RETRO_KEY.DOLLAR: button = "Dollar"; break; + case LibRetro.RETRO_KEY.AMPERSAND: button = "Ampersand"; break; + case LibRetro.RETRO_KEY.QUOTE: button = "Quote"; break; + case LibRetro.RETRO_KEY.LEFTPAREN: button = "LeftParen"; break; + case LibRetro.RETRO_KEY.RIGHTPAREN: button = "RightParen"; break; + case LibRetro.RETRO_KEY.ASTERISK: button = "Asterisk"; break; + case LibRetro.RETRO_KEY.PLUS: button = "Plus"; break; + case LibRetro.RETRO_KEY.COMMA: button = "Comma"; break; + case LibRetro.RETRO_KEY.MINUS: button = "Minus"; break; + case LibRetro.RETRO_KEY.PERIOD: button = "Period"; break; + case LibRetro.RETRO_KEY.SLASH: button = "Slash"; break; + case LibRetro.RETRO_KEY._0: button = "0"; break; + case LibRetro.RETRO_KEY._1: button = "1"; break; + case LibRetro.RETRO_KEY._2: button = "2"; break; + case LibRetro.RETRO_KEY._3: button = "3"; break; + case LibRetro.RETRO_KEY._4: button = "4"; break; + case LibRetro.RETRO_KEY._5: button = "5"; break; + case LibRetro.RETRO_KEY._6: button = "6"; break; + case LibRetro.RETRO_KEY._7: button = "7"; break; + case LibRetro.RETRO_KEY._8: button = "8"; break; + case LibRetro.RETRO_KEY._9: button = "9"; break; + case LibRetro.RETRO_KEY.COLON: button = "Colon"; break; + case LibRetro.RETRO_KEY.SEMICOLON: button = "Semicolon"; break; + case LibRetro.RETRO_KEY.LESS: button = "Less"; break; + case LibRetro.RETRO_KEY.EQUALS: button = "Equals"; break; + case LibRetro.RETRO_KEY.GREATER: button = "Greater"; break; + case LibRetro.RETRO_KEY.QUESTION: button = "Question"; break; + case LibRetro.RETRO_KEY.AT: button = "At"; break; + case LibRetro.RETRO_KEY.LEFTBRACKET: button = "LeftBracket"; break; + case LibRetro.RETRO_KEY.BACKSLASH: button = "Backslash"; break; + case LibRetro.RETRO_KEY.RIGHTBRACKET: button = "RightBracket"; break; + case LibRetro.RETRO_KEY.CARET: button = "Caret"; break; + case LibRetro.RETRO_KEY.UNDERSCORE: button = "Underscore"; break; + case LibRetro.RETRO_KEY.BACKQUOTE: button = "Backquote"; break; + case LibRetro.RETRO_KEY.a: button = "A"; break; + case LibRetro.RETRO_KEY.b: button = "B"; break; + case LibRetro.RETRO_KEY.c: button = "C"; break; + case LibRetro.RETRO_KEY.d: button = "D"; break; + case LibRetro.RETRO_KEY.e: button = "E"; break; + case LibRetro.RETRO_KEY.f: button = "F"; break; + case LibRetro.RETRO_KEY.g: button = "G"; break; + case LibRetro.RETRO_KEY.h: button = "H"; break; + case LibRetro.RETRO_KEY.i: button = "I"; break; + case LibRetro.RETRO_KEY.j: button = "J"; break; + case LibRetro.RETRO_KEY.k: button = "K"; break; + case LibRetro.RETRO_KEY.l: button = "L"; break; + case LibRetro.RETRO_KEY.m: button = "M"; break; + case LibRetro.RETRO_KEY.n: button = "N"; break; + case LibRetro.RETRO_KEY.o: button = "O"; break; + case LibRetro.RETRO_KEY.p: button = "P"; break; + case LibRetro.RETRO_KEY.q: button = "Q"; break; + case LibRetro.RETRO_KEY.r: button = "R"; break; + case LibRetro.RETRO_KEY.s: button = "S"; break; + case LibRetro.RETRO_KEY.t: button = "T"; break; + case LibRetro.RETRO_KEY.u: button = "U"; break; + case LibRetro.RETRO_KEY.v: button = "V"; break; + case LibRetro.RETRO_KEY.w: button = "W"; break; + case LibRetro.RETRO_KEY.x: button = "X"; break; + case LibRetro.RETRO_KEY.y: button = "Y"; break; + case LibRetro.RETRO_KEY.z: button = "Z"; break; + case LibRetro.RETRO_KEY.DELETE: button = "Delete"; break; + + case LibRetro.RETRO_KEY.KP0: button = "KP0"; break; + case LibRetro.RETRO_KEY.KP1: button = "KP1"; break; + case LibRetro.RETRO_KEY.KP2: button = "KP2"; break; + case LibRetro.RETRO_KEY.KP3: button = "KP3"; break; + case LibRetro.RETRO_KEY.KP4: button = "KP4"; break; + case LibRetro.RETRO_KEY.KP5: button = "KP5"; break; + case LibRetro.RETRO_KEY.KP6: button = "KP6"; break; + case LibRetro.RETRO_KEY.KP7: button = "KP7"; break; + case LibRetro.RETRO_KEY.KP8: button = "KP8"; break; + case LibRetro.RETRO_KEY.KP9: button = "KP9"; break; + case LibRetro.RETRO_KEY.KP_PERIOD: button = "KP_Period"; break; + case LibRetro.RETRO_KEY.KP_DIVIDE: button = "KP_Divide"; break; + case LibRetro.RETRO_KEY.KP_MULTIPLY: button = "KP_Multiply"; break; + case LibRetro.RETRO_KEY.KP_MINUS: button = "KP_Minus"; break; + case LibRetro.RETRO_KEY.KP_PLUS: button = "KP_Plus"; break; + case LibRetro.RETRO_KEY.KP_ENTER: button = "KP_Enter"; break; + case LibRetro.RETRO_KEY.KP_EQUALS: button = "KP_Equals"; break; + + case LibRetro.RETRO_KEY.UP: button = "Up"; break; + case LibRetro.RETRO_KEY.DOWN: button = "Down"; break; + case LibRetro.RETRO_KEY.RIGHT: button = "Right"; break; + case LibRetro.RETRO_KEY.LEFT: button = "Left"; break; + case LibRetro.RETRO_KEY.INSERT: button = "Insert"; break; + case LibRetro.RETRO_KEY.HOME: button = "Home"; break; + case LibRetro.RETRO_KEY.END: button = "End"; break; + case LibRetro.RETRO_KEY.PAGEUP: button = "PageUp"; break; + case LibRetro.RETRO_KEY.PAGEDOWN: button = "PageDown"; break; + + case LibRetro.RETRO_KEY.F1: button = "F1"; break; + case LibRetro.RETRO_KEY.F2: button = "F2"; break; + case LibRetro.RETRO_KEY.F3: button = "F3"; break; + case LibRetro.RETRO_KEY.F4: button = "F4"; break; + case LibRetro.RETRO_KEY.F5: button = "F5"; break; + case LibRetro.RETRO_KEY.F6: button = "F6"; break; + case LibRetro.RETRO_KEY.F7: button = "F7"; break; + case LibRetro.RETRO_KEY.F8: button = "F8"; break; + case LibRetro.RETRO_KEY.F9: button = "F9"; break; + case LibRetro.RETRO_KEY.F10: button = "F10"; break; + case LibRetro.RETRO_KEY.F11: button = "F11"; break; + case LibRetro.RETRO_KEY.F12: button = "F12"; break; + case LibRetro.RETRO_KEY.F13: button = "F13"; break; + case LibRetro.RETRO_KEY.F14: button = "F14"; break; + case LibRetro.RETRO_KEY.F15: button = "F15"; break; + + case LibRetro.RETRO_KEY.NUMLOCK: button = "NumLock"; break; + case LibRetro.RETRO_KEY.CAPSLOCK: button = "CapsLock"; break; + case LibRetro.RETRO_KEY.SCROLLOCK: button = "ScrollLock"; break; + case LibRetro.RETRO_KEY.RSHIFT: button = "RShift"; break; + case LibRetro.RETRO_KEY.LSHIFT: button = "LShift"; break; + case LibRetro.RETRO_KEY.RCTRL: button = "RCtrl"; break; + case LibRetro.RETRO_KEY.LCTRL: button = "LCtrl"; break; + case LibRetro.RETRO_KEY.RALT: button = "RAlt"; break; + case LibRetro.RETRO_KEY.LALT: button = "LAlt"; break; + case LibRetro.RETRO_KEY.RMETA: button = "RMeta"; break; + case LibRetro.RETRO_KEY.LMETA: button = "LMeta"; break; + case LibRetro.RETRO_KEY.LSUPER: button = "LSuper"; break; + case LibRetro.RETRO_KEY.RSUPER: button = "RSuper"; break; + case LibRetro.RETRO_KEY.MODE: button = "Mode"; break; + case LibRetro.RETRO_KEY.COMPOSE: button = "Compose"; break; + + case LibRetro.RETRO_KEY.HELP: button = "Help"; break; + case LibRetro.RETRO_KEY.PRINT: button = "Print"; break; + case LibRetro.RETRO_KEY.SYSREQ: button = "SysReq"; break; + case LibRetro.RETRO_KEY.BREAK: button = "Break"; break; + case LibRetro.RETRO_KEY.MENU: button = "Menu"; break; + case LibRetro.RETRO_KEY.POWER: button = "Power"; break; + case LibRetro.RETRO_KEY.EURO: button = "Euro"; break; + case LibRetro.RETRO_KEY.UNDO: button = "Undo"; break; + } + + return (short)(Controller["Key " + button] ? 1 : 0); + } + + case LibRetro.RETRO_DEVICE.JOYPAD: + { + //The JOYPAD is sometimes called RetroPad (and we'll call it that in user-facing stuff cos retroarch does) + //It is essentially a Super Nintendo controller, but with additional L2/R2/L3/R3 buttons, similar to a PS1 DualShock. + + string button = ""; + switch ((LibRetro.RETRO_DEVICE_ID_JOYPAD)id) + { + case LibRetro.RETRO_DEVICE_ID_JOYPAD.A: button = "A"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.B: button = "B"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.X: button = "X"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.Y: button = "Y"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.UP: button = "Up"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.DOWN: button = "Down"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.LEFT: button = "Left"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.RIGHT: button = "Right"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.L: button = "L"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.R: button = "R"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.SELECT: button = "Select"; break; + case LibRetro.RETRO_DEVICE_ID_JOYPAD.START: button = "Start"; break; + } + + return (short)(GetButton(port+1, "RetroPad", button) ? 1 : 0); + } + default: + return 0; + } + } + } +} diff --git a/BizHawk.Emulation.Cores/LibRetroEmulator.cs b/BizHawk.Emulation.Cores/Libretro/LibRetroEmulator.cs similarity index 88% rename from BizHawk.Emulation.Cores/LibRetroEmulator.cs rename to BizHawk.Emulation.Cores/Libretro/LibRetroEmulator.cs index d78fe16427..8b663a924c 100644 --- a/BizHawk.Emulation.Cores/LibRetroEmulator.cs +++ b/BizHawk.Emulation.Cores/Libretro/LibRetroEmulator.cs @@ -13,7 +13,7 @@ using BizHawk.Common.BufferExtensions; namespace BizHawk.Emulation.Cores { [CoreAttributes("Libretro", "natt&zeromus")] - public unsafe class LibRetroEmulator : IEmulator, ISettable, + public unsafe partial class LibRetroEmulator : IEmulator, ISettable, ISaveRam, IStatable, IVideoProvider, IInputPollable { #region Settings @@ -255,58 +255,6 @@ namespace BizHawk.Emulation.Cores else return false; } - //meanings (they are kind of hazy, but once we're done implementing this it will be completely defined by example) - //port = console physical port? - //device = logical device type - //index = sub device index? (multitap?) - //id = button id - short retro_input_state(uint port, uint device, uint index, uint id) - { - //helpful debugging - //Console.WriteLine("{0} {1} {2} {3}", port, device, index, id); - - switch ((LibRetro.RETRO_DEVICE)device) - { - case LibRetro.RETRO_DEVICE.POINTER: - { - switch ((LibRetro.RETRO_DEVICE_ID_POINTER)id) - { - case LibRetro.RETRO_DEVICE_ID_POINTER.X: return (short)Controller.GetFloat("Pointer X"); - case LibRetro.RETRO_DEVICE_ID_POINTER.Y: return (short)Controller.GetFloat("Pointer Y"); - case LibRetro.RETRO_DEVICE_ID_POINTER.PRESSED: return (short)(Controller["Pointer Pressed"] ? 1 : 0); - } - return 0; - } - - case LibRetro.RETRO_DEVICE.JOYPAD: - { - //The JOYPAD is sometimes called RetroPad (and we'll call it that in user-facing stuff cos retroarch does) - //It is essentially a Super Nintendo controller, but with additional L2/R2/L3/R3 buttons, similar to a PS1 DualShock. - - string button = ""; - switch ((LibRetro.RETRO_DEVICE_ID_JOYPAD)id) - { - case LibRetro.RETRO_DEVICE_ID_JOYPAD.A: button = "A"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.B: button = "B"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.X: button = "X"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.Y: button = "Y"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.UP: button = "Up"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.DOWN: button = "Down"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.LEFT: button = "Left"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.RIGHT: button = "Right"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.L: button = "L"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.R: button = "R"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.SELECT: button = "Select"; break; - case LibRetro.RETRO_DEVICE_ID_JOYPAD.START: button = "Start"; break; - } - - return (short)(GetButton(port+1, "RetroPad", button) ? 1 : 0); - } - default: - return 0; - } - } - LibRetro.retro_environment_t retro_environment_cb; LibRetro.retro_video_refresh_t retro_video_refresh_cb; LibRetro.retro_audio_sample_t retro_audio_sample_cb; @@ -428,6 +376,12 @@ namespace BizHawk.Emulation.Cores LibRetro.retro_system_info system_info = new LibRetro.retro_system_info(); retro.retro_get_system_info(ref system_info); + //the dosbox core calls GET_SYSTEM_DIRECTORY and GET_SAVE_DIRECTORY from retro_set_environment. + //so, lets set some temporary values (which we'll replace) + SystemDirectory = Path.GetDirectoryName(modulename); + SystemDirectoryAtom = unmanagedResources.StringToHGlobalAnsi(SystemDirectory); + SaveDirectory = Path.GetDirectoryName(modulename); + SaveDirectoryAtom = unmanagedResources.StringToHGlobalAnsi(SaveDirectory); retro.retro_set_environment(retro_environment_cb); retro.retro_set_video_refresh(retro_video_refresh_cb); @@ -503,6 +457,8 @@ namespace BizHawk.Emulation.Cores //defer this until loading because it triggers the core to read save and system paths //if any cores did that from set_environment then i'm assured we can call set_environment again here before retro_init and it should work //--alcaro says any cores that can't handle that should be considered a bug + //UPDATE: dosbox does that, so lets try it + retro.retro_set_environment(retro_environment_cb); retro.retro_init(); if (!retro.retro_load_game(ref gi)) @@ -545,12 +501,31 @@ namespace BizHawk.Emulation.Cores }) definition.BoolButtons.Add(string.Format(item,"RetroPad")); - definition.BoolButtons.Add("Pointer Pressed"); + definition.BoolButtons.Add("Pointer Pressed"); //TODO: this isnt showing up in the binding panel. I dont want to find out why. definition.FloatControls.Add("Pointer X"); definition.FloatControls.Add("Pointer Y"); definition.FloatRanges.Add(new ControllerDefinition.FloatRange(-32767, 0, 32767)); definition.FloatRanges.Add(new ControllerDefinition.FloatRange(-32767, 0, 32767)); + foreach (var key in new[]{ + "Key Backspace", "Key Tab", "Key Clear", "Key Return", "Key Pause", "Key Escape", + "Key Space", "Key Exclaim", "Key QuoteDbl", "Key Hash", "Key Dollar", "Key Ampersand", "Key Quote", "Key LeftParen", "Key RightParen", "Key Asterisk", "Key Plus", "Key Comma", "Key Minus", "Key Period", "Key Slash", + "Key 0", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", + "Key Colon", "Key Semicolon", "Key Less", "Key Equals", "Key Greater", "Key Question", "Key At", "Key LeftBracket", "Key Backslash", "Key RightBracket", "Key Caret", "Key Underscore", "Key Backquote", + "Key A", "Key B", "Key C", "Key D", "Key E", "Key F", "Key G", "Key H", "Key I", "Key J", "Key K", "Key L", "Key M", "Key N", "Key O", "Key P", "Key Q", "Key R", "Key S", "Key T", "Key U", "Key V", "Key W", "Key X", "Key Y", "Key Z", + "Key Delete", + "Key KP0", "Key KP1", "Key KP2", "Key KP3", "Key KP4", "Key KP5", "Key KP6", "Key KP7", "Key KP8", "Key KP9", + "Key KP_Period", "Key KP_Divide", "Key KP_Multiply", "Key KP_Minus", "Key KP_Plus", "Key KP_Enter", "Key KP_Equals", + "Key Up", "Key Down", "Key Right", "Key Left", "Key Insert", "Key Home", "Key End", "Key PageUp", "Key PageDown", + "Key F1", "Key F2", "Key F3", "Key F4", "Key F5", "Key F6", "Key F7", "Key F8", "Key F9", "Key F10", "Key F11", "Key F12", "Key F13", "Key F14", "Key F15", + "Key NumLock", "Key CapsLock", "Key ScrollLock", "Key RShift", "Key LShift", "Key RCtrl", "Key LCtrl", "Key RAlt", "Key LAlt", "Key RMeta", "Key LMeta", "Key LSuper", "Key RSuper", "Key Mode", "Key Compose", + "Key Help", "Key Print", "Key SysReq", "Key Break", "Key Menu", "Key Power", "Key Euro", "Key Undo" + }) + { + definition.BoolButtons.Add(key); + definition.CategoryLabels[key] = "RetroKeyboard"; + } + return definition; } diff --git a/output/defctrl.json b/output/defctrl.json index f52ba215ab..9177d35e7f 100644 --- a/output/defctrl.json +++ b/output/defctrl.json @@ -26,6 +26,141 @@ "P2 RetroPad L": "", "P2 RetroPad R": "", "Pointer Pressed": "WMouse L", + "Key Backspace": "Backspace", + "Key Tab": "Tab", + "Key Clear": "", + "Key Return": "Return", + "Key Pause": "", + "Key Escape": "Escape", + "Key Space": "Space", + "Key Exclaim": "", + "Key QuoteDbl": "", + "Key Hash": "", + "Key Dollar": "", + "Key Ampersand": "", + "Key Quote": "", + "Key LeftParen": "", + "Key RightParen": "", + "Key Asterisk": "", + "Key Plus": "", + "Key Comma": "Comma", + "Key Minus": "Minus", + "Key Period": "Period", + "Key Slash": "Slash", + "Key 0": "D0", + "Key 1": "D1", + "Key 2": "D2", + "Key 3": "D3", + "Key 4": "D4", + "Key 5": "D5", + "Key 6": "D6", + "Key 7": "D7", + "Key 8": "D8", + "Key 9": "D9", + "Key Colon": "", + "Key Semicolon": "Semicolon", + "Key Less": "", + "Key Equals": "Equals", + "Key Greater": "", + "Key Question": "", + "Key At": "", + "Key LeftBracket": "LeftBracket", + "Key Backslash": "Backslash", + "Key RightBracket": "RightBracket", + "Key Caret": "", + "Key Underscore": "", + "Key Backquote": "Grave", + "Key A": "A", + "Key B": "B", + "Key C": "C", + "Key D": "D", + "Key E": "E", + "Key F": "F", + "Key G": "G", + "Key H": "H", + "Key I": "I", + "Key J": "J", + "Key K": "K", + "Key L": "L", + "Key M": "M", + "Key N": "N", + "Key O": "O", + "Key P": "P", + "Key Q": "Q", + "Key R": "R", + "Key S": "S", + "Key T": "T", + "Key U": "U", + "Key V": "V", + "Key W": "W", + "Key X": "X", + "Key Y": "Y", + "Key Z": "Z", + "Key Delete": "Delete", + "Key KP0": "NumberPad0", + "Key KP1": "NumberPad1", + "Key KP2": "NumberPad2", + "Key KP3": "NumberPad3", + "Key KP4": "NumberPad4", + "Key KP5": "NumberPad5", + "Key KP6": "NumberPad6", + "Key KP7": "NumberPad7", + "Key KP8": "NumberPad8", + "Key KP9": "NumberPad9", + "Key KP_Period": "NumberPadPeriod", + "Key KP_Divide": "NumberPadSlash", + "Key KP_Multiply": "NumberPadStar", + "Key KP_Minus": "NumberPadMinus", + "Key KP_Plus": "NumberPadPlus", + "Key KP_Enter": "NumberPadEnter", + "Key KP_Equals": "", + "Key Up": "UpArrow", + "Key Down": "DownArrow", + "Key Left": "LeftArrow", + "Key Insert": "LeftControl", + "Key Home": "Home", + "Key End": "End", + "Key PageUp": "PageUp", + "Key PageDown": "PageDown", + "Key F1": "F1", + "Key F2": "F2", + "Key F3": "F3", + "Key F4": "F4", + "Key F5": "F5", + "Key F6": "F6", + "Key F7": "F7", + "Key F8": "F8", + "Key F9": "F9", + "Key F10": "F10", + "Key F11": "F11", + "Key F12": "F12", + "Key F13": "", + "Key F14": "", + "Key F15": "", + "Key NumLock": "NumberLock", + "Key CapsLock": "CapsLock", + "Key ScrollLock": "ScrollLock", + "Key RShift": "RightShift", + "Key LShift": "LeftShift", + "Key RCtrl": "RightControl", + "Key LCtrl": "LeftControl", + "Key RAlt": "RightAlt", + "Key LAlt": "LeftAlt", + "Key RMeta": "", + "Key LMeta": "", + "Key LSuper": "", + "Key RSuper": "", + "Key Mode": "", + "Key Compose": "", + "Key Help": "", + "Key Print": "", + "Key SysReq": "", + "Key Break": "", + "Key Menu": "Applications", + "Key Power": "", + "Key Euro": "", + "Key Undo": "", + "Key Right": "RightArrow" }, "NES Controller": { "P1 Up": "UpArrow, J1 POV1U, X1 DpadUp, X1 LStickUp",