mirror of https://github.com/stella-emu/stella.git
implement separate keyboard mappings for joystick, paddles and keyboard controllers
update doc accordingly
This commit is contained in:
parent
2cfffd48fe
commit
a14d1c275d
355
docs/index.html
355
docs/index.html
|
@ -383,8 +383,7 @@
|
|||
platform where the SDL library exists. It is 32/64-bit and endian clean in Linux/Unix, macOS
|
||||
and Windows. The Stella Team is interested in hearing about any problems you may
|
||||
encounter with diverse operating systems and CPU types.</p>
|
||||
</blockquote>
|
||||
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Installation">Installation</a></b></h2>
|
||||
|
||||
|
@ -459,7 +458,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Games">Locating Game Images (aka ROMs)</a></b></h2>
|
||||
|
||||
|
@ -547,7 +546,7 @@
|
|||
work across all applications. <u>Again, to be clear, this is only necessary when
|
||||
you want to override the default bankswitching scheme for a ROM.</u> <b>This will
|
||||
not normally be necessary.</b></p>
|
||||
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Playing">Playing a Game</a></b></h2>
|
||||
|
||||
|
@ -606,9 +605,10 @@
|
|||
as the function keys and display the current state. You may find this useful if
|
||||
you cannot remember all the function key events, or you wish to use Stella
|
||||
without a keyboard (ie, in a standalone gaming system).</p>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Keyboard">Keyboard Layout</a></b></h2>
|
||||
<blockquote>
|
||||
|
||||
<p>The Atari 2600 console controls and controllers are mapped to the computer's
|
||||
keyboard as shown in the following tables. However, most of these events can be
|
||||
|
@ -621,9 +621,10 @@
|
|||
following layout image as reference where to find the US keys on your keyboard.
|
||||
</p>
|
||||
<p><img src="graphics/qwertz.png"></p>
|
||||
<br/>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Hotkeys">Hotkeys</a></b></h2>
|
||||
<blockquote>
|
||||
<p><b>Console Controls (can be remapped)</b></p>
|
||||
|
||||
<table BORDER=2 cellpadding=4>
|
||||
|
@ -794,7 +795,7 @@
|
|||
|
||||
<tr>
|
||||
<td>Fire Button</td>
|
||||
<td>Space</td>
|
||||
<td>Left Control, Space</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -855,154 +856,6 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Paddle Controller digital emulation (can be remapped independently of joystick controller)</b></p>
|
||||
|
||||
<table BORDER=2>
|
||||
<tr>
|
||||
<th>Left Paddles</th>
|
||||
<th>Right Paddles</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 0 decrease</td>
|
||||
<td>Same as 'Joy0 Left'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 0 increase</td>
|
||||
<td>Same as 'Joy0 Right'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 0 Fire</td>
|
||||
<td>Same as 'Joy0 Fire'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 1 decrease</td>
|
||||
<td>Same as 'Joy0 Up'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 1 increase</td>
|
||||
<td>Same as 'Joy0 Down'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 1 Fire</td>
|
||||
<td>Same as 'Joy0 Top Booster Button'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 2 decrease</td>
|
||||
<td>Same as 'Joy1 Left'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 2 increase</td>
|
||||
<td>Same as 'Joy1 Right'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 2 Fire</td>
|
||||
<td>Same as 'Joy1 Fire'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 3 decrease</td>
|
||||
<td>Same as 'Joy1 Up'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 3 increase</td>
|
||||
<td>Same as 'Joy1 Down'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 3 Fire</td>
|
||||
<td>Same as 'Joy1 Top Booster Button'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Driving Controller (cannot be remapped, always associated with joystick controller)</b></p>
|
||||
|
||||
<table BORDER=2>
|
||||
<tr>
|
||||
<th>Left Driving</th>
|
||||
<th>Right Driving</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Left Direction</td>
|
||||
<td>Same as 'Joy0 Left'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Right Direction</td>
|
||||
<td>Same as 'Joy0 Right'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fire Button</td>
|
||||
<td>Same as 'Joy0 Fire'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Left Direction</td>
|
||||
<td>Same as 'Joy1 Left'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Right Direction</td>
|
||||
<td>Same as 'Joy1 Right'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fire Button</td>
|
||||
<td>Same as 'Joy1 Fire'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Sega Genesis Controller (cannot be remapped, always associated with joystick and booster-grip controllers)</b></p>
|
||||
|
||||
<table BORDER=2>
|
||||
|
@ -1092,6 +945,154 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Driving Controller (cannot be remapped, always associated with joystick controller)</b></p>
|
||||
|
||||
<table BORDER=2>
|
||||
<tr>
|
||||
<th>Left Driving</th>
|
||||
<th>Right Driving</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Left Direction</td>
|
||||
<td>Same as 'Joy0 Left'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Right Direction</td>
|
||||
<td>Same as 'Joy0 Right'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fire Button</td>
|
||||
<td>Same as 'Joy0 Fire'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Left Direction</td>
|
||||
<td>Same as 'Joy1 Left'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Right Direction</td>
|
||||
<td>Same as 'Joy1 Right'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fire Button</td>
|
||||
<td>Same as 'Joy1 Fire'</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Paddle Controller digital emulation (can be remapped)</b></p>
|
||||
|
||||
<table BORDER=2>
|
||||
<tr>
|
||||
<th>Left Paddles</th>
|
||||
<th>Right Paddles</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 0 decrease</td>
|
||||
<td>Right arrow</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 0 increase</td>
|
||||
<td>Left arrow</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 0 Fire</td>
|
||||
<td>Left Control, Space</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 1 decrease</td>
|
||||
<td>Down arrow</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 1 increase</td>
|
||||
<td>Up arrow</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 1 Fire</td>
|
||||
<td>4</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table BORDER=1 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Key</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 2 decrease</td>
|
||||
<td>J</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 2 increase</td>
|
||||
<td>G</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 2 Fire</td>
|
||||
<td>F</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 3 decrease</td>
|
||||
<td>H</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 3 increase</td>
|
||||
<td>Y</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Paddle 3 Fire</td>
|
||||
<td>6</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>Keypad Controller (can be remapped)</b></p>
|
||||
|
||||
<table BORDER=2>
|
||||
|
@ -1372,7 +1373,7 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Toggle frame stats (scanline count/FPS/BS type etc.)</td>
|
||||
<td>Toggle frame stats</br>(scanline count/FPS/BS type etc.)</td>
|
||||
<td>Alt + L</td>
|
||||
<td>Cmd + L</td>
|
||||
</tr>
|
||||
|
@ -1558,7 +1559,7 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Switch mouse between controller emulation modes (see <b>Game Properties - <a href="#Controller">Controller</a></b>)</td>
|
||||
<td>Switch mouse between controller emulation modes</br>(see <b>Game Properties - <a href="#Controller">Controller</a></b>)</td>
|
||||
<td>Control + 0</td>
|
||||
<td>Control + 0</td>
|
||||
</tr>
|
||||
|
@ -1601,7 +1602,7 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Save continuous PNG snapshots (per interval defined in <a href="#Snapshots"><b>Snapshot Settings</b></a>)</td>
|
||||
<td>Save continuous PNG snapshots</br>(per interval defined in <a href="#Snapshots"><b>Snapshot Settings</b></a>)</td>
|
||||
<td>Alt + s</td>
|
||||
<td>Cmd + s</td>
|
||||
</tr>
|
||||
|
@ -1675,7 +1676,7 @@
|
|||
<tr><td>Control-c</td><td>Copy entire line to clipboard (not complete)</td></tr>
|
||||
<tr><td>Control-v</td><td>Paste clipboard contents (not complete)</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="ControlMap">Controller Map</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -1788,12 +1789,13 @@
|
|||
<td> N/A</td>
|
||||
</tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
|
||||
<br><br>
|
||||
<p><h2>
|
||||
<a name="TimeMachine">Stella's 'Time Machine'</a></h2>
|
||||
<blockquote>
|
||||
|
||||
<p>A special feature of Stella is the 'Time Machine' mode. In this mode, Stella
|
||||
automatically creates savestates in regular, user-defined intervals. At any time,
|
||||
|
@ -1842,10 +1844,10 @@
|
|||
|
||||
<p>The 'Time Machine' mode can be configured by the user. For details see
|
||||
<a href="#Debugger"><b>Developer Options</b> - Time Machine</a></h2> tab.</p>
|
||||
|
||||
</blockquote></br>
|
||||
|
||||
<!-- ///////////////////////////////////////////////////////////////////////// -->
|
||||
<br><br>
|
||||
<br>
|
||||
<p><h1>
|
||||
<a name="Advanced">Advanced Configuration</a></h1>
|
||||
<hr>
|
||||
|
@ -2633,7 +2635,7 @@
|
|||
<td>Define the horizon of the Time Machine.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Options">Changing Options</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -2854,7 +2856,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Remapping">Event Remapping/Input Devices</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -2882,12 +2884,13 @@
|
|||
use a controller direction or button. Then that key (combination) or controller
|
||||
action will be bound to the selected event. </br>
|
||||
Notes:<ul>
|
||||
<li>If nothing seems to happen, Stella can't see the input device.</li>
|
||||
<li>If nothing seems to happen, either Stella can't see the input device, or the
|
||||
selected event doesn't support being remapped to the input device.</li>
|
||||
<li>Events which are available in both event modes can be remapped individually.</li>
|
||||
<li>Left and right modifiers are mapped separately. To map them as one, press both
|
||||
modifier keys during mapping.</li>
|
||||
</ul></li>
|
||||
<li>Cancel a remap in progress by clicking 'Cancel', erase a mapping by
|
||||
<li>Cancel a remap in progress by clicking 'Cancel', erase the event's mappings by
|
||||
clicking 'Erase', or reset to default mapping by clicking 'Reset'</li>
|
||||
<li>Reset to default <b>all</b> mappings by clicking 'Defaults'.</li>
|
||||
</ol>
|
||||
|
@ -2933,7 +2936,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="ROMInfo">ROM Launcher</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3036,7 +3039,7 @@
|
|||
current listing. It is an alternative to pressing the Control-r
|
||||
key combo.</li>
|
||||
</ol></p>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="ROMAudit">ROM Audit Mode</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3069,7 +3072,7 @@
|
|||
<li>If a valid ROM doesn't have a properties entry, it will be
|
||||
ignored.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Adaptor">Stelladaptor/2600-daptor Support</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3103,7 +3106,7 @@
|
|||
'saport' (see description in <a href="#CommandLine"><b>Using the Command Line</b></a>) and dynamically with the 'Control-1' key
|
||||
combo.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="AtariVox">AtariVox/SaveKey Support</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3165,7 +3168,7 @@
|
|||
files can be manually deleted, which is very useful in testing
|
||||
cases where a ROM is accessing the EEPROM for the first time. You can also
|
||||
reset the EEPROM to a clean state.</p>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Debugger">Developer Options/Integrated Debugger</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3376,7 +3379,7 @@
|
|||
|
||||
<p>Finally, Stella contains an extensive, built-in debugger. Have a look at
|
||||
<a href="debugger.html">this page</a> for integrated debugger documentation.</p>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Settings">Settings File</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3441,7 +3444,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Cheats">Cheatcode Manager</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3541,7 +3544,7 @@ Ms Pac-Man (Stella extended codes):
|
|||
</tr>
|
||||
</table>
|
||||
<p>Stella will require a restart for changes to this file to take effect.</p>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Logs">Viewing the System Log</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3572,7 +3575,7 @@ Ms Pac-Man (Stella extended codes):
|
|||
is also shown on the commandline from which Stella was launched (if it was launched
|
||||
in that fashion). Finally, the current contents of the system log can be saved to your
|
||||
home directory by clicking the "Save log to disk" button.</p>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Properties">Game Properties</a></b></h2>
|
||||
<blockquote>
|
||||
|
@ -3892,7 +3895,7 @@ Ms Pac-Man (Stella extended codes):
|
|||
</tr>
|
||||
</table>
|
||||
<p>Stella will require a restart for changes to this file to take effect.</p>
|
||||
</blockquote>
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="Palette">Palette Support</a></b></h2>
|
||||
<blockquote>
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
#include "DialogContainer.hxx"
|
||||
#endif
|
||||
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
static constexpr int MOD3 = KBDM_GUI;
|
||||
#else
|
||||
static constexpr int MOD3 = KBDM_ALT;
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PhysicalKeyboardHandler::PhysicalKeyboardHandler(
|
||||
OSystem& system, EventHandler& handler, Event& event)
|
||||
|
@ -50,6 +56,12 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(
|
|||
{
|
||||
string list = myOSystem.settings().getString("keymap_emu");
|
||||
myKeyMap.loadMapping(list, kEmulationMode);
|
||||
list = myOSystem.settings().getString("keymap_joy");
|
||||
myKeyMap.loadMapping(list, kJoystickMode);
|
||||
list = myOSystem.settings().getString("keymap_pad");
|
||||
myKeyMap.loadMapping(list, kPaddlesMode);
|
||||
list = myOSystem.settings().getString("keymap_key");
|
||||
myKeyMap.loadMapping(list, kKeypadMode);
|
||||
list = myOSystem.settings().getString("keymap_ui");
|
||||
myKeyMap.loadMapping(list, kMenuMode);
|
||||
}
|
||||
|
@ -60,252 +72,273 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mode, bool updateDefaults)
|
||||
void PhysicalKeyboardHandler::setDefaultKey(EventMapping map, Event::Type event, EventMode mode,
|
||||
bool updateDefaults)
|
||||
// Depending on parmeters, this method does the following:
|
||||
// 1. update all events with default (event == Event::NoType, updateDefault == true)
|
||||
// 2. reset all events to default (event == Event::NoType, updateDefault == false)
|
||||
// 3. reset one event to default (event != Event::NoType)
|
||||
{
|
||||
// If event is 'NoType', erase and reset all mappings
|
||||
// Otherwise, only reset the given event
|
||||
bool eraseAll = !updateDefaults && (event == Event::NoType);
|
||||
if (eraseAll)
|
||||
// Erase all mappings of given mode
|
||||
myKeyMap.eraseMode(mode);
|
||||
else
|
||||
myKeyMap.eraseEvent(event, mode);
|
||||
|
||||
auto setDefaultKey = [&](Event::Type k_event, StellaKey key, int mod = KBDM_NONE)
|
||||
if (updateDefaults)
|
||||
{
|
||||
if (updateDefaults)
|
||||
// if there is no existing mapping for the event or
|
||||
// the default mapping for the event is unused, set default key for event
|
||||
if (myKeyMap.getEventMapping(map.event, mode).size() == 0 ||
|
||||
!myKeyMap.check(mode, map.key, map.mod))
|
||||
{
|
||||
// if there is no existing mapping for the event or
|
||||
// the default mapping for the event is unused, set default key for event
|
||||
if (myKeyMap.getEventMapping(k_event, mode).size() == 0 ||
|
||||
!myKeyMap.check(mode, key, mod))
|
||||
{
|
||||
myKeyMap.add(k_event, mode, key, mod);
|
||||
}
|
||||
myKeyMap.add(map.event, mode, map.key, map.mod);
|
||||
}
|
||||
else if (eraseAll || k_event == event)
|
||||
{
|
||||
myKeyMap.add(k_event, mode, key, mod);
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
static constexpr int MOD3 = KBDM_GUI;
|
||||
#else
|
||||
static constexpr int MOD3 = KBDM_ALT;
|
||||
#endif
|
||||
}
|
||||
else if (eraseAll || map.event == event)
|
||||
{
|
||||
myKeyMap.eraseEvent(map.event, mode);
|
||||
myKeyMap.add(map.event, mode, map.key, map.mod);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mode, bool updateDefaults)
|
||||
// Depending on parmeters, this method does the following:
|
||||
// 1. update all events with default (event == Event::NoType, updateDefault == true)
|
||||
// 2. reset all events to default (event == Event::NoType, updateDefault == false)
|
||||
// 3. reset one event to default (event != Event::NoType)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case kEmulationMode:
|
||||
setDefaultKey(Event::KeyboardZero1 , KBDK_1);
|
||||
setDefaultKey(Event::KeyboardZero2 , KBDK_2);
|
||||
setDefaultKey(Event::KeyboardZero3 , KBDK_3);
|
||||
setDefaultKey(Event::KeyboardZero4 , KBDK_Q);
|
||||
setDefaultKey(Event::KeyboardZero5 , KBDK_W);
|
||||
setDefaultKey(Event::KeyboardZero6 , KBDK_E);
|
||||
setDefaultKey(Event::KeyboardZero7 , KBDK_A);
|
||||
setDefaultKey(Event::KeyboardZero8 , KBDK_S);
|
||||
setDefaultKey(Event::KeyboardZero9 , KBDK_D);
|
||||
setDefaultKey(Event::KeyboardZeroStar , KBDK_Z);
|
||||
setDefaultKey(Event::KeyboardZero0 , KBDK_X);
|
||||
setDefaultKey(Event::KeyboardZeroPound , KBDK_C);
|
||||
|
||||
setDefaultKey(Event::KeyboardOne1 , KBDK_8);
|
||||
setDefaultKey(Event::KeyboardOne2 , KBDK_9);
|
||||
setDefaultKey(Event::KeyboardOne3 , KBDK_0);
|
||||
setDefaultKey(Event::KeyboardOne4 , KBDK_I);
|
||||
setDefaultKey(Event::KeyboardOne5 , KBDK_O);
|
||||
setDefaultKey(Event::KeyboardOne6 , KBDK_P);
|
||||
setDefaultKey(Event::KeyboardOne7 , KBDK_K);
|
||||
setDefaultKey(Event::KeyboardOne8 , KBDK_L);
|
||||
setDefaultKey(Event::KeyboardOne9 , KBDK_SEMICOLON);
|
||||
setDefaultKey(Event::KeyboardOneStar , KBDK_COMMA);
|
||||
setDefaultKey(Event::KeyboardOne0 , KBDK_PERIOD);
|
||||
setDefaultKey(Event::KeyboardOnePound , KBDK_SLASH);
|
||||
|
||||
setDefaultKey(Event::JoystickZeroUp , KBDK_UP);
|
||||
setDefaultKey(Event::JoystickZeroDown , KBDK_DOWN);
|
||||
setDefaultKey(Event::JoystickZeroLeft , KBDK_LEFT);
|
||||
setDefaultKey(Event::JoystickZeroRight , KBDK_RIGHT);
|
||||
setDefaultKey(Event::JoystickZeroFire , KBDK_SPACE);
|
||||
setDefaultKey(Event::JoystickZeroFire , KBDK_LCTRL);
|
||||
setDefaultKey(Event::JoystickZeroFire5 , KBDK_4);
|
||||
setDefaultKey(Event::JoystickZeroFire9 , KBDK_5);
|
||||
|
||||
setDefaultKey(Event::JoystickOneUp , KBDK_Y);
|
||||
setDefaultKey(Event::JoystickOneDown , KBDK_H);
|
||||
setDefaultKey(Event::JoystickOneLeft , KBDK_G);
|
||||
setDefaultKey(Event::JoystickOneRight , KBDK_J);
|
||||
setDefaultKey(Event::JoystickOneFire , KBDK_F);
|
||||
setDefaultKey(Event::JoystickOneFire5 , KBDK_6);
|
||||
setDefaultKey(Event::JoystickOneFire9 , KBDK_7);
|
||||
|
||||
setDefaultKey(Event::ConsoleSelect , KBDK_F1);
|
||||
setDefaultKey(Event::ConsoleReset , KBDK_F2);
|
||||
setDefaultKey(Event::ConsoleColor , KBDK_F3);
|
||||
setDefaultKey(Event::ConsoleBlackWhite , KBDK_F4);
|
||||
setDefaultKey(Event::ConsoleLeftDiffA , KBDK_F5);
|
||||
setDefaultKey(Event::ConsoleLeftDiffB , KBDK_F6);
|
||||
setDefaultKey(Event::ConsoleRightDiffA , KBDK_F7);
|
||||
setDefaultKey(Event::ConsoleRightDiffB , KBDK_F8);
|
||||
setDefaultKey(Event::SaveState , KBDK_F9);
|
||||
setDefaultKey(Event::SaveAllStates , KBDK_F9, MOD3);
|
||||
setDefaultKey(Event::ChangeState , KBDK_F10);
|
||||
setDefaultKey(Event::LoadState , KBDK_F11);
|
||||
setDefaultKey(Event::LoadAllStates , KBDK_F11, MOD3);
|
||||
setDefaultKey(Event::TakeSnapshot , KBDK_F12);
|
||||
setDefaultKey(Event::Fry , KBDK_BACKSPACE);
|
||||
setDefaultKey(Event::TogglePauseMode , KBDK_PAUSE);
|
||||
setDefaultKey(Event::OptionsMenuMode , KBDK_TAB);
|
||||
setDefaultKey(Event::CmdMenuMode , KBDK_BACKSLASH);
|
||||
setDefaultKey(Event::TimeMachineMode , KBDK_T);
|
||||
setDefaultKey(Event::DebuggerMode , KBDK_GRAVE);
|
||||
setDefaultKey(Event::ExitMode , KBDK_ESCAPE);
|
||||
#ifdef BSPF_MACOS
|
||||
setDefaultKey(Event::Quit , KBDK_Q, MOD3);
|
||||
#else
|
||||
setDefaultKey(Event::Quit , KBDK_Q, KBDM_CTRL);
|
||||
#endif
|
||||
setDefaultKey(Event::ReloadConsole , KBDK_R, KBDM_CTRL);
|
||||
|
||||
setDefaultKey(Event::VidmodeDecrease , KBDK_MINUS, MOD3);
|
||||
setDefaultKey(Event::VidmodeIncrease , KBDK_EQUALS, MOD3);
|
||||
setDefaultKey(Event::VolumeDecrease , KBDK_LEFTBRACKET, MOD3);
|
||||
setDefaultKey(Event::VolumeIncrease , KBDK_RIGHTBRACKET, MOD3);
|
||||
setDefaultKey(Event::SoundToggle , KBDK_RIGHTBRACKET, KBDM_CTRL);
|
||||
|
||||
setDefaultKey(Event::ToggleFullScreen , KBDK_RETURN, MOD3);
|
||||
setDefaultKey(Event::DecreaseOverscan , KBDK_PAGEDOWN, MOD3);
|
||||
setDefaultKey(Event::IncreaseOverScan , KBDK_PAGEUP, MOD3);
|
||||
setDefaultKey(Event::VidmodeStd , KBDK_1, MOD3);
|
||||
setDefaultKey(Event::VidmodeRGB , KBDK_2, MOD3);
|
||||
setDefaultKey(Event::VidmodeSVideo , KBDK_3, MOD3);
|
||||
setDefaultKey(Event::VidModeComposite , KBDK_4, MOD3);
|
||||
setDefaultKey(Event::VidModeBad , KBDK_5, MOD3);
|
||||
setDefaultKey(Event::VidModeCustom , KBDK_6, MOD3);
|
||||
setDefaultKey(Event::PreviousAttribute , KBDK_7, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::NextAttribute , KBDK_7, MOD3);
|
||||
setDefaultKey(Event::DecreaseAttribute , KBDK_8, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::IncreaseAttribute , KBDK_8, MOD3);
|
||||
setDefaultKey(Event::DecreasePhosphor , KBDK_9, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::IncreasePhosphor , KBDK_9, MOD3);
|
||||
setDefaultKey(Event::TogglePhosphor , KBDK_P, MOD3);
|
||||
setDefaultKey(Event::ScanlinesDecrease , KBDK_0, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::ScanlinesIncrease , KBDK_0, MOD3);
|
||||
setDefaultKey(Event::ToggleColorLoss , KBDK_L, KBDM_CTRL);
|
||||
setDefaultKey(Event::TogglePalette , KBDK_P, KBDM_CTRL);
|
||||
setDefaultKey(Event::ToggleJitter , KBDK_J, MOD3);
|
||||
setDefaultKey(Event::ToggleFrameStats , KBDK_L, MOD3);
|
||||
setDefaultKey(Event::ToggleTimeMachine , KBDK_T, MOD3);
|
||||
#ifdef PNG_SUPPORT
|
||||
setDefaultKey(Event::ToggleContSnapshots , KBDK_S, MOD3);
|
||||
setDefaultKey(Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3);
|
||||
#endif
|
||||
setDefaultKey(Event::HandleMouseControl , KBDK_0, KBDM_CTRL);
|
||||
setDefaultKey(Event::ToggleGrabMouse , KBDK_G, KBDM_CTRL);
|
||||
setDefaultKey(Event::ToggleSAPortOrder , KBDK_1, KBDM_CTRL);
|
||||
setDefaultKey(Event::DecreaseFormat , KBDK_F, KBDM_SHIFT | KBDM_CTRL);
|
||||
setDefaultKey(Event::IncreaseFormat , KBDK_F, KBDM_CTRL);
|
||||
|
||||
setDefaultKey(Event::ToggleP0Collision , KBDK_Z, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::ToggleP0Bit , KBDK_Z, MOD3);
|
||||
setDefaultKey(Event::ToggleP1Collision , KBDK_X, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::ToggleP1Bit , KBDK_X, MOD3);
|
||||
setDefaultKey(Event::ToggleM0Collision , KBDK_C, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::ToggleM0Bit , KBDK_C, MOD3);
|
||||
setDefaultKey(Event::ToggleM1Collision , KBDK_V, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::ToggleM1Bit , KBDK_V, MOD3);
|
||||
setDefaultKey(Event::ToggleBLCollision , KBDK_B, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::ToggleBLBit , KBDK_B, MOD3);
|
||||
setDefaultKey(Event::TogglePFCollision , KBDK_N, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::TogglePFBit , KBDK_N, MOD3);
|
||||
setDefaultKey(Event::ToggleCollisions , KBDK_COMMA, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::ToggleBits , KBDK_COMMA, MOD3);
|
||||
setDefaultKey(Event::ToggleFixedColors , KBDK_PERIOD, MOD3);
|
||||
|
||||
setDefaultKey(Event::RewindPause , KBDK_LEFT, KBDM_SHIFT);
|
||||
setDefaultKey(Event::Rewind1Menu , KBDK_LEFT, MOD3);
|
||||
setDefaultKey(Event::Rewind10Menu , KBDK_LEFT, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::RewindAllMenu , KBDK_DOWN, MOD3);
|
||||
setDefaultKey(Event::UnwindPause , KBDK_LEFT, KBDM_SHIFT);
|
||||
setDefaultKey(Event::Unwind1Menu , KBDK_RIGHT, MOD3);
|
||||
setDefaultKey(Event::Unwind10Menu , KBDK_RIGHT, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::UnwindAllMenu , KBDK_UP, MOD3);
|
||||
|
||||
#if defined(RETRON77)
|
||||
setDefaultKey(Event::ConsoleColorToggle , KBDK_F4); // back ("COLOR","B/W")
|
||||
setDefaultKey(Event::ConsoleLeftDiffToggle , KBDK_F6); // front ("SKILL P1")
|
||||
setDefaultKey(Event::ConsoleRightDiffToggle , KBDK_F8); // front ("SKILL P2")
|
||||
setDefaultKey(Event::CmdMenuMode , KBDK_F13); // back ("4:3","16:9")
|
||||
setDefaultKey(Event::ExitMode , KBDK_BACKSPACE); // back ("FRY")
|
||||
#endif
|
||||
for each (EventMapping item in DefaultEmuMapping)
|
||||
setDefaultKey(item, event, kEmulationMode, updateDefaults);
|
||||
// put all controller events into their own mode's mappings
|
||||
for each (EventMapping item in DefaultJoystickMapping)
|
||||
setDefaultKey(item, event, kJoystickMode, updateDefaults);
|
||||
for each (EventMapping item in DefaultPaddleMapping)
|
||||
setDefaultKey(item, event, kPaddlesMode, updateDefaults);
|
||||
for each (EventMapping item in DefaultKeypadMapping)
|
||||
setDefaultKey(item, event, kKeypadMode, updateDefaults);
|
||||
break;
|
||||
|
||||
case kMenuMode:
|
||||
setDefaultKey(Event::UIUp , KBDK_UP);
|
||||
setDefaultKey(Event::UIDown , KBDK_DOWN);
|
||||
setDefaultKey(Event::UILeft , KBDK_LEFT);
|
||||
setDefaultKey(Event::UIRight , KBDK_RIGHT);
|
||||
|
||||
setDefaultKey(Event::UIHome , KBDK_HOME);
|
||||
setDefaultKey(Event::UIEnd , KBDK_END);
|
||||
setDefaultKey(Event::UIPgUp , KBDK_PAGEUP);
|
||||
setDefaultKey(Event::UIPgDown , KBDK_PAGEDOWN);
|
||||
|
||||
setDefaultKey(Event::UISelect , KBDK_RETURN);
|
||||
setDefaultKey(Event::UICancel , KBDK_ESCAPE);
|
||||
|
||||
setDefaultKey(Event::UINavPrev , KBDK_TAB, KBDM_SHIFT);
|
||||
setDefaultKey(Event::UINavNext , KBDK_TAB);
|
||||
setDefaultKey(Event::UITabPrev , KBDK_TAB, KBDM_SHIFT|KBDM_CTRL);
|
||||
setDefaultKey(Event::UITabNext , KBDK_TAB, KBDM_CTRL);
|
||||
|
||||
setDefaultKey(Event::UIPrevDir , KBDK_BACKSPACE);
|
||||
setDefaultKey(Event::ToggleFullScreen , KBDK_RETURN, MOD3);
|
||||
|
||||
#ifdef BSPF_MACOS
|
||||
setDefaultKey(Event::Quit , KBDK_Q, MOD3);
|
||||
#else
|
||||
setDefaultKey(Event::Quit , KBDK_Q, KBDM_CTRL);
|
||||
#endif
|
||||
|
||||
#if defined(RETRON77)
|
||||
setDefaultKey(Event::UIUp , KBDK_F9); // front ("SAVE")
|
||||
setDefaultKey(Event::UIDown , KBDK_F2); // front ("RESET")
|
||||
setDefaultKey(Event::UINavPrev , KBDK_F11); // front ("LOAD")
|
||||
setDefaultKey(Event::UINavNext , KBDK_F1); // front ("MODE")
|
||||
setDefaultKey(Event::UISelect , KBDK_F6); // front ("SKILL P1")
|
||||
setDefaultKey(Event::UICancel , KBDK_F8); // front ("SKILL P2")
|
||||
//setDefaultKey(Event::NoType , KBDK_F4); // back ("COLOR","B/W")
|
||||
setDefaultKey(Event::UITabPrev , KBDK_F13); // back ("4:3","16:9")
|
||||
setDefaultKey(Event::UITabNext , KBDK_BACKSPACE); // back (FRY)
|
||||
#endif
|
||||
for each (EventMapping item in DefaultMenuMapping)
|
||||
setDefaultKey(item, event, kMenuMode, updateDefaults);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableControllerEvents(const string& controllerName, Controller::Jack port)
|
||||
{
|
||||
if ((controllerName == "KEYBOARD") || (controllerName == "KEYPAD"))
|
||||
{
|
||||
if (port == Controller::Jack::Left)
|
||||
myLeftMode = kKeypadMode;
|
||||
else
|
||||
myRightMode = kKeypadMode;
|
||||
}
|
||||
else if(BSPF::startsWithIgnoreCase(controllerName, "PADDLES"))
|
||||
{
|
||||
if (port == Controller::Jack::Left)
|
||||
myLeftMode = kPaddlesMode;
|
||||
else
|
||||
myRightMode = kPaddlesMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (port == Controller::Jack::Left)
|
||||
myLeftMode = kJoystickMode;
|
||||
else
|
||||
myRightMode = kJoystickMode;
|
||||
}
|
||||
|
||||
enableControllerEvents();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableControllerEvents()
|
||||
{
|
||||
// enable right mode first, so that in case of mapping clashes the left controller has preference
|
||||
switch (myRightMode)
|
||||
{
|
||||
case kPaddlesMode:
|
||||
enableRightPaddlesMapping();
|
||||
break;
|
||||
|
||||
case kKeypadMode:
|
||||
enableRightKeypadMapping();
|
||||
break;
|
||||
|
||||
default:
|
||||
enableRightJoystickMapping();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (myLeftMode)
|
||||
{
|
||||
case kPaddlesMode:
|
||||
enableLeftPaddlesMapping();
|
||||
break;
|
||||
|
||||
case kKeypadMode:
|
||||
enableLeftKeypadMapping();
|
||||
break;
|
||||
|
||||
default:
|
||||
enableLeftJoystickMapping();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableLeftJoystickMapping(bool enable)
|
||||
{
|
||||
for each (Event::Type event in LeftJoystickEvents)
|
||||
{
|
||||
// copy from controller specific mode into emulation mode
|
||||
std::vector<KeyMap::Mapping> mappings = myKeyMap.getEventMapping(event, kJoystickMode);
|
||||
enableMappings(event, mappings, enable);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableRightJoystickMapping(bool enable)
|
||||
{
|
||||
for each (Event::Type event in RightJoystickEvents)
|
||||
{
|
||||
// copy from controller specific mode into emulation mode
|
||||
std::vector<KeyMap::Mapping> mappings = myKeyMap.getEventMapping(event, kJoystickMode);
|
||||
enableMappings(event, mappings, enable);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableLeftPaddlesMapping(bool enable)
|
||||
{
|
||||
for each (Event::Type event in LeftPaddlesEvents)
|
||||
{
|
||||
// copy from controller mode into emulation mode
|
||||
std::vector<KeyMap::Mapping> mappings = myKeyMap.getEventMapping(event, kPaddlesMode);
|
||||
enableMappings(event, mappings, enable);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableRightPaddlesMapping(bool enable)
|
||||
{
|
||||
for each (Event::Type event in RightPaddlesEvents)
|
||||
{
|
||||
// copy from controller mode into emulation mode
|
||||
std::vector<KeyMap::Mapping> mappings = myKeyMap.getEventMapping(event, kPaddlesMode);
|
||||
enableMappings(event, mappings, enable);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableLeftKeypadMapping(bool enable)
|
||||
{
|
||||
for each (Event::Type event in LeftKeypadEvents)
|
||||
{
|
||||
// copy from controller mode into emulation mode
|
||||
std::vector<KeyMap::Mapping> mappings = myKeyMap.getEventMapping(event, kKeypadMode);
|
||||
enableMappings(event, mappings, enable);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableRightKeypadMapping(bool enable)
|
||||
{
|
||||
for each (Event::Type event in RightKeypadEvents)
|
||||
{
|
||||
// copy from controller mode into emulation mode
|
||||
std::vector<KeyMap::Mapping> mappings = myKeyMap.getEventMapping(event, kKeypadMode);
|
||||
enableMappings(event, mappings, enable);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::enableMappings(Event::Type event, std::vector<KeyMap::Mapping> mappings, bool enable)
|
||||
{
|
||||
for each (KeyMap::Mapping map in mappings)
|
||||
{
|
||||
if (enable)
|
||||
myKeyMap.add(event, kEmulationMode, map.key, map.mod);
|
||||
else
|
||||
myKeyMap.eraseEvent(event, kEmulationMode);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event, const EventMode mode) const
|
||||
{
|
||||
if (isJoystickEvent(event))
|
||||
return kJoystickMode;
|
||||
|
||||
if (isPaddleEvent(event))
|
||||
return kPaddlesMode;
|
||||
|
||||
if (isKeypadEvent(event))
|
||||
return kKeypadMode;
|
||||
|
||||
return kEmulationMode;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool PhysicalKeyboardHandler::isJoystickEvent(const Event::Type event) const
|
||||
{
|
||||
return LeftJoystickEvents.find(event) != LeftJoystickEvents.end()
|
||||
|| RightJoystickEvents.find(event) != RightJoystickEvents.end();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool PhysicalKeyboardHandler::isPaddleEvent(const Event::Type event) const
|
||||
{
|
||||
return LeftPaddlesEvents.find(event) != LeftPaddlesEvents.end()
|
||||
|| RightPaddlesEvents.find(event) != RightPaddlesEvents.end();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool PhysicalKeyboardHandler::isKeypadEvent(const Event::Type event) const
|
||||
{
|
||||
return LeftKeypadEvents.find(event) != LeftKeypadEvents.end()
|
||||
|| RightKeypadEvents.find(event) != RightKeypadEvents.end();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::eraseMapping(Event::Type event, EventMode mode)
|
||||
{
|
||||
myKeyMap.eraseEvent(event, mode);
|
||||
myKeyMap.eraseEvent(event, getEventMode(event, mode));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PhysicalKeyboardHandler::saveMapping()
|
||||
{
|
||||
myOSystem.settings().setValue("event_ver", Event::VERSION);
|
||||
// remove controller specific events in emulation mode mapping
|
||||
enableLeftJoystickMapping(false);
|
||||
enableRightJoystickMapping(false);
|
||||
enableLeftPaddlesMapping(false);
|
||||
enableRightPaddlesMapping(false);
|
||||
enableLeftKeypadMapping(false);
|
||||
enableRightKeypadMapping(false);
|
||||
myOSystem.settings().setValue("keymap_emu", myKeyMap.saveMapping(kEmulationMode));
|
||||
// restore current controller's event mappings
|
||||
enableControllerEvents();
|
||||
myOSystem.settings().setValue("keymap_joy", myKeyMap.saveMapping(kJoystickMode));
|
||||
myOSystem.settings().setValue("keymap_pad", myKeyMap.saveMapping(kPaddlesMode));
|
||||
myOSystem.settings().setValue("keymap_key", myKeyMap.saveMapping(kKeypadMode));
|
||||
myOSystem.settings().setValue("keymap_ui", myKeyMap.saveMapping(kMenuMode));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string PhysicalKeyboardHandler::getMappingDesc(Event::Type event, EventMode mode) const
|
||||
{
|
||||
return myKeyMap.getEventMappingDesc(event, mode);
|
||||
return myKeyMap.getEventMappingDesc(event, getEventMode(event, mode));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -316,7 +349,13 @@ bool PhysicalKeyboardHandler::addMapping(Event::Type event, EventMode mode,
|
|||
if(Event::isAnalog(event))
|
||||
return false;
|
||||
else
|
||||
myKeyMap.add(event, mode, key, mod);
|
||||
{
|
||||
EventMode evMode = getEventMode(event, mode);
|
||||
|
||||
myKeyMap.add(event, evMode, key, mod);
|
||||
if (evMode == myLeftMode || evMode == myRightMode)
|
||||
myKeyMap.add(event, mode, key, mod);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -383,3 +422,250 @@ bool PhysicalKeyboardHandler::handleAltEvent(StellaKey key, StellaMod mod, bool
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventSet PhysicalKeyboardHandler::LeftJoystickEvents = {
|
||||
Event::JoystickZeroUp, Event::JoystickZeroDown, Event::JoystickZeroLeft, Event::JoystickZeroRight,
|
||||
Event::JoystickZeroFire, Event::JoystickZeroFire5, Event::JoystickZeroFire9,
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventSet PhysicalKeyboardHandler::RightJoystickEvents = {
|
||||
Event::JoystickOneUp, Event::JoystickOneDown, Event::JoystickOneLeft, Event::JoystickOneRight,
|
||||
Event::JoystickOneFire, Event::JoystickOneFire5, Event::JoystickOneFire9
|
||||
};
|
||||
|
||||
|
||||
EventSet PhysicalKeyboardHandler::LeftPaddlesEvents = {
|
||||
Event::PaddleZeroDecrease, Event::PaddleZeroIncrease, Event::PaddleZeroAnalog, Event::PaddleZeroFire,
|
||||
Event::PaddleOneDecrease, Event::PaddleOneIncrease, Event::PaddleOneAnalog, Event::PaddleOneFire,
|
||||
};
|
||||
|
||||
EventSet PhysicalKeyboardHandler::RightPaddlesEvents = {
|
||||
Event::PaddleTwoDecrease, Event::PaddleTwoIncrease, Event::PaddleTwoAnalog, Event::PaddleTwoFire,
|
||||
Event::PaddleThreeDecrease, Event::PaddleThreeIncrease, Event::PaddleThreeAnalog, Event::PaddleThreeFire,
|
||||
};
|
||||
|
||||
|
||||
EventSet PhysicalKeyboardHandler::LeftKeypadEvents = {
|
||||
Event::KeyboardZero1, Event::KeyboardZero2, Event::KeyboardZero3,
|
||||
Event::KeyboardZero4, Event::KeyboardZero5, Event::KeyboardZero6,
|
||||
Event::KeyboardZero7, Event::KeyboardZero8, Event::KeyboardZero9,
|
||||
Event::KeyboardZeroStar, Event::KeyboardZero0, Event::KeyboardZeroPound,
|
||||
};
|
||||
|
||||
EventSet PhysicalKeyboardHandler::RightKeypadEvents = {
|
||||
Event::KeyboardOne1, Event::KeyboardOne2, Event::KeyboardOne3,
|
||||
Event::KeyboardOne4, Event::KeyboardOne5, Event::KeyboardOne6,
|
||||
Event::KeyboardOne7, Event::KeyboardOne8, Event::KeyboardOne9,
|
||||
Event::KeyboardOneStar, Event::KeyboardOne0, Event::KeyboardOnePound,
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultEmuMapping = {
|
||||
{Event::ConsoleSelect, KBDK_F1},
|
||||
{Event::ConsoleReset, KBDK_F2},
|
||||
{Event::ConsoleColor, KBDK_F3},
|
||||
{Event::ConsoleBlackWhite, KBDK_F4},
|
||||
{Event::ConsoleLeftDiffA, KBDK_F5},
|
||||
{Event::ConsoleLeftDiffB, KBDK_F6},
|
||||
{Event::ConsoleRightDiffA, KBDK_F7},
|
||||
{Event::ConsoleRightDiffB, KBDK_F8},
|
||||
{Event::SaveState, KBDK_F9},
|
||||
{Event::SaveAllStates, KBDK_F9, MOD3},
|
||||
{Event::ChangeState, KBDK_F10},
|
||||
{Event::LoadState, KBDK_F11},
|
||||
{Event::LoadAllStates, KBDK_F11, MOD3},
|
||||
{Event::TakeSnapshot, KBDK_F12},
|
||||
{Event::Fry, KBDK_BACKSPACE},
|
||||
{Event::TogglePauseMode, KBDK_PAUSE},
|
||||
{Event::OptionsMenuMode, KBDK_TAB},
|
||||
{Event::CmdMenuMode, KBDK_BACKSLASH},
|
||||
{Event::TimeMachineMode, KBDK_T},
|
||||
{Event::DebuggerMode, KBDK_GRAVE},
|
||||
{Event::ExitMode, KBDK_ESCAPE},
|
||||
#ifdef BSPF_MACOS
|
||||
{Event::Quit, KBDK_Q, MOD3},
|
||||
#else
|
||||
{Event::Quit, KBDK_Q, KBDM_CTRL},
|
||||
#endif
|
||||
{Event::ReloadConsole, KBDK_R, KBDM_CTRL},
|
||||
|
||||
{Event::VidmodeDecrease, KBDK_MINUS, MOD3},
|
||||
{Event::VidmodeIncrease, KBDK_EQUALS, MOD3},
|
||||
{Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3},
|
||||
{Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3},
|
||||
{Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL},
|
||||
|
||||
{Event::ToggleFullScreen, KBDK_RETURN, MOD3},
|
||||
{Event::DecreaseOverscan, KBDK_PAGEDOWN, MOD3},
|
||||
{Event::IncreaseOverScan, KBDK_PAGEUP, MOD3},
|
||||
{Event::VidmodeStd, KBDK_1, MOD3},
|
||||
{Event::VidmodeRGB, KBDK_2, MOD3},
|
||||
{Event::VidmodeSVideo, KBDK_3, MOD3},
|
||||
{Event::VidModeComposite, KBDK_4, MOD3},
|
||||
{Event::VidModeBad, KBDK_5, MOD3},
|
||||
{Event::VidModeCustom, KBDK_6, MOD3},
|
||||
{Event::PreviousAttribute, KBDK_7, KBDM_SHIFT | MOD3},
|
||||
{Event::NextAttribute, KBDK_7, MOD3},
|
||||
{Event::DecreaseAttribute, KBDK_8, KBDM_SHIFT | MOD3},
|
||||
{Event::IncreaseAttribute, KBDK_8, MOD3},
|
||||
{Event::DecreasePhosphor, KBDK_9, KBDM_SHIFT | MOD3},
|
||||
{Event::IncreasePhosphor, KBDK_9, MOD3},
|
||||
{Event::TogglePhosphor, KBDK_P, MOD3},
|
||||
{Event::ScanlinesDecrease, KBDK_0, KBDM_SHIFT | MOD3},
|
||||
{Event::ScanlinesIncrease, KBDK_0, MOD3},
|
||||
{Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
|
||||
{Event::TogglePalette, KBDK_P, KBDM_CTRL},
|
||||
{Event::ToggleJitter, KBDK_J, MOD3},
|
||||
{Event::ToggleFrameStats, KBDK_L, MOD3},
|
||||
{Event::ToggleTimeMachine, KBDK_T, MOD3},
|
||||
#ifdef PNG_SUPPORT
|
||||
{Event::ToggleContSnapshots, KBDK_S, MOD3},
|
||||
{Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3},
|
||||
#endif
|
||||
{Event::HandleMouseControl, KBDK_0, KBDM_CTRL},
|
||||
{Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL},
|
||||
{Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL},
|
||||
{Event::DecreaseFormat, KBDK_F, KBDM_SHIFT | KBDM_CTRL},
|
||||
{Event::IncreaseFormat, KBDK_F, KBDM_CTRL},
|
||||
|
||||
{Event::ToggleP0Collision, KBDK_Z, KBDM_SHIFT | MOD3},
|
||||
{Event::ToggleP0Bit, KBDK_Z, MOD3},
|
||||
{Event::ToggleP1Collision, KBDK_X, KBDM_SHIFT | MOD3},
|
||||
{Event::ToggleP1Bit, KBDK_X, MOD3},
|
||||
{Event::ToggleM0Collision, KBDK_C, KBDM_SHIFT | MOD3},
|
||||
{Event::ToggleM0Bit, KBDK_C, MOD3},
|
||||
{Event::ToggleM1Collision, KBDK_V, KBDM_SHIFT | MOD3},
|
||||
{Event::ToggleM1Bit, KBDK_V, MOD3},
|
||||
{Event::ToggleBLCollision, KBDK_B, KBDM_SHIFT | MOD3},
|
||||
{Event::ToggleBLBit, KBDK_B, MOD3},
|
||||
{Event::TogglePFCollision, KBDK_N, KBDM_SHIFT | MOD3},
|
||||
{Event::TogglePFBit, KBDK_N, MOD3},
|
||||
{Event::ToggleCollisions, KBDK_COMMA, KBDM_SHIFT | MOD3},
|
||||
{Event::ToggleBits, KBDK_COMMA, MOD3},
|
||||
{Event::ToggleFixedColors, KBDK_PERIOD, MOD3},
|
||||
|
||||
{Event::RewindPause, KBDK_LEFT, KBDM_SHIFT},
|
||||
{Event::Rewind1Menu, KBDK_LEFT, MOD3},
|
||||
{Event::Rewind10Menu, KBDK_LEFT, KBDM_SHIFT | MOD3},
|
||||
{Event::RewindAllMenu, KBDK_DOWN, MOD3},
|
||||
{Event::UnwindPause, KBDK_LEFT, KBDM_SHIFT},
|
||||
{Event::Unwind1Menu, KBDK_RIGHT, MOD3},
|
||||
{Event::Unwind10Menu, KBDK_RIGHT, KBDM_SHIFT | MOD3},
|
||||
{Event::UnwindAllMenu, KBDK_UP, MOD3},
|
||||
|
||||
#if defined(RETRON77)
|
||||
{Event::ConsoleColorToggle, KBDK_F4}, // back ("COLOR","B/W")
|
||||
{Event::ConsoleLeftDiffToggle, KBDK_F6}, // front ("SKILL P1")
|
||||
{Event::ConsoleRightDiffToggle, KBDK_F8}, // front ("SKILL P2")
|
||||
{Event::CmdMenuMode, KBDK_F13}, // back ("4:3","16:9")
|
||||
{Event::ExitMode, KBDK_BACKSPACE}, // back ("FRY")
|
||||
#endif
|
||||
};
|
||||
|
||||
PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultMenuMapping = {
|
||||
{Event::UIUp, KBDK_UP},
|
||||
{Event::UIDown, KBDK_DOWN},
|
||||
{Event::UILeft, KBDK_LEFT},
|
||||
{Event::UIRight, KBDK_RIGHT},
|
||||
|
||||
{Event::UIHome, KBDK_HOME},
|
||||
{Event::UIEnd, KBDK_END},
|
||||
{Event::UIPgUp, KBDK_PAGEUP},
|
||||
{Event::UIPgDown, KBDK_PAGEDOWN},
|
||||
|
||||
{Event::UISelect, KBDK_RETURN},
|
||||
{Event::UICancel, KBDK_ESCAPE},
|
||||
|
||||
{Event::UINavPrev, KBDK_TAB, KBDM_SHIFT},
|
||||
{Event::UINavNext, KBDK_TAB},
|
||||
{Event::UITabPrev, KBDK_TAB, KBDM_SHIFT | KBDM_CTRL},
|
||||
{Event::UITabNext, KBDK_TAB, KBDM_CTRL},
|
||||
|
||||
{Event::UIPrevDir, KBDK_BACKSPACE},
|
||||
{Event::ToggleFullScreen, KBDK_RETURN, MOD3},
|
||||
|
||||
#ifdef BSPF_MACOS
|
||||
{Event::Quit, KBDK_Q, MOD3},
|
||||
#else
|
||||
{Event::Quit, KBDK_Q, KBDM_CTRL},
|
||||
#endif
|
||||
|
||||
#if defined(RETRON77)
|
||||
{Event::UIUp, KBDK_F9}, // front ("SAVE")
|
||||
{Event::UIDown, KBDK_F2}, // front ("RESET")
|
||||
{Event::UINavPrev, KBDK_F11}, // front ("LOAD")
|
||||
{Event::UINavNext, KBDK_F1}, // front ("MODE")
|
||||
{Event::UISelect, KBDK_F6}, // front ("SKILL P1")
|
||||
{Event::UICancel, KBDK_F8}, // front ("SKILL P2")
|
||||
//{Event::NoType, KBDK_F4}, // back ("COLOR","B/W")
|
||||
{Event::UITabPrev, KBDK_F13}, // back ("4:3","16:9")
|
||||
{Event::UITabNext, KBDK_BACKSPACE}, // back (FRY)
|
||||
#endif
|
||||
};
|
||||
|
||||
PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultJoystickMapping = {
|
||||
{Event::JoystickZeroUp, KBDK_UP},
|
||||
{Event::JoystickZeroDown, KBDK_DOWN},
|
||||
{Event::JoystickZeroLeft, KBDK_LEFT},
|
||||
{Event::JoystickZeroRight, KBDK_RIGHT},
|
||||
{Event::JoystickZeroFire, KBDK_SPACE},
|
||||
{Event::JoystickZeroFire, KBDK_LCTRL},
|
||||
{Event::JoystickZeroFire5, KBDK_4},
|
||||
{Event::JoystickZeroFire9, KBDK_5},
|
||||
|
||||
{Event::JoystickOneUp, KBDK_Y},
|
||||
{Event::JoystickOneDown, KBDK_H},
|
||||
{Event::JoystickOneLeft, KBDK_G},
|
||||
{Event::JoystickOneRight, KBDK_J},
|
||||
{Event::JoystickOneFire, KBDK_F},
|
||||
{Event::JoystickOneFire5, KBDK_6},
|
||||
{Event::JoystickOneFire9, KBDK_7},
|
||||
};
|
||||
|
||||
PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultPaddleMapping = {
|
||||
{Event::PaddleZeroDecrease, KBDK_RIGHT},
|
||||
{Event::PaddleZeroIncrease, KBDK_LEFT},
|
||||
{Event::PaddleZeroFire, KBDK_LCTRL},
|
||||
|
||||
{Event::PaddleOneDecrease, KBDK_DOWN},
|
||||
{Event::PaddleOneIncrease, KBDK_UP},
|
||||
{Event::PaddleOneFire, KBDK_4},
|
||||
|
||||
{Event::PaddleTwoDecrease, KBDK_J},
|
||||
{Event::PaddleTwoIncrease, KBDK_G},
|
||||
{Event::PaddleTwoFire, KBDK_F},
|
||||
|
||||
{Event::PaddleThreeDecrease, KBDK_H},
|
||||
{Event::PaddleThreeIncrease, KBDK_Y},
|
||||
{Event::PaddleThreeFire, KBDK_6},
|
||||
};
|
||||
|
||||
PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultKeypadMapping = {
|
||||
{Event::KeyboardZero1, KBDK_1},
|
||||
{Event::KeyboardZero2, KBDK_2},
|
||||
{Event::KeyboardZero3, KBDK_3},
|
||||
{Event::KeyboardZero4, KBDK_Q},
|
||||
{Event::KeyboardZero5, KBDK_W},
|
||||
{Event::KeyboardZero6, KBDK_E},
|
||||
{Event::KeyboardZero7, KBDK_A},
|
||||
{Event::KeyboardZero8, KBDK_S},
|
||||
{Event::KeyboardZero9, KBDK_D},
|
||||
{Event::KeyboardZeroStar, KBDK_Z},
|
||||
{Event::KeyboardZero0, KBDK_X},
|
||||
{Event::KeyboardZeroPound, KBDK_C},
|
||||
|
||||
{Event::KeyboardOne1, KBDK_8},
|
||||
{Event::KeyboardOne2, KBDK_9},
|
||||
{Event::KeyboardOne3, KBDK_0},
|
||||
{Event::KeyboardOne4, KBDK_I},
|
||||
{Event::KeyboardOne5, KBDK_O},
|
||||
{Event::KeyboardOne6, KBDK_P},
|
||||
{Event::KeyboardOne7, KBDK_K},
|
||||
{Event::KeyboardOne8, KBDK_L},
|
||||
{Event::KeyboardOne9, KBDK_SEMICOLON},
|
||||
{Event::KeyboardOneStar, KBDK_COMMA},
|
||||
{Event::KeyboardOne0, KBDK_PERIOD},
|
||||
{Event::KeyboardOnePound, KBDK_SLASH},
|
||||
};
|
|
@ -19,6 +19,7 @@
|
|||
#define PHYSICAL_KEYBOARD_HANDLER_HXX
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
class OSystem;
|
||||
class EventHandler;
|
||||
|
@ -28,6 +29,8 @@ class Event;
|
|||
#include "EventHandlerConstants.hxx"
|
||||
#include "KeyMap.hxx"
|
||||
|
||||
using EventSet = std::set<Event::Type>;
|
||||
|
||||
/**
|
||||
This class handles all physical keyboard-related operations in Stella.
|
||||
|
||||
|
@ -46,6 +49,10 @@ class PhysicalKeyboardHandler
|
|||
PhysicalKeyboardHandler(OSystem& system, EventHandler& handler, Event& event);
|
||||
|
||||
void setDefaultMapping(Event::Type type, EventMode mode, bool updateDefaults = false);
|
||||
|
||||
/** enable mappings for current controllers */
|
||||
void enableControllerEvents(const string& controllerName, Controller::Jack port);
|
||||
|
||||
void eraseMapping(Event::Type event, EventMode mode);
|
||||
void saveMapping();
|
||||
string getMappingDesc(Event::Type, EventMode mode) const;
|
||||
|
@ -67,8 +74,37 @@ class PhysicalKeyboardHandler
|
|||
bool& useModKeys() { return myKeyMap.enableMod(); }
|
||||
|
||||
private:
|
||||
|
||||
// Structure used for action menu items
|
||||
struct EventMapping {
|
||||
Event::Type event;
|
||||
StellaKey key;
|
||||
int mod = KBDM_NONE;
|
||||
};
|
||||
using EventMappingArray = std::vector<EventMapping>;
|
||||
|
||||
void setDefaultKey(EventMapping map, Event::Type event = Event::NoType,
|
||||
EventMode mode = kEmulationMode, bool updateDefaults = false);
|
||||
|
||||
bool handleAltEvent(StellaKey key, StellaMod mod, bool pressed);
|
||||
|
||||
/** returns the event's controller mode */
|
||||
EventMode getEventMode(const Event::Type event, const EventMode mode) const;
|
||||
/** Checks event type. */
|
||||
bool isJoystickEvent(const Event::Type event) const;
|
||||
bool isPaddleEvent(const Event::Type event) const;
|
||||
bool isKeypadEvent(const Event::Type event) const;
|
||||
|
||||
void enableControllerEvents();
|
||||
|
||||
void enableLeftJoystickMapping(bool enable = true);
|
||||
void enableRightJoystickMapping(bool enable = true);
|
||||
void enableLeftPaddlesMapping(bool enable = true);
|
||||
void enableRightPaddlesMapping(bool enable = true);
|
||||
void enableLeftKeypadMapping(bool enable = true);
|
||||
void enableRightKeypadMapping(bool enable = true);
|
||||
void enableMappings(Event::Type event, std::vector<KeyMap::Mapping> mappings, bool enable);
|
||||
|
||||
OSystem& myOSystem;
|
||||
EventHandler& myHandler;
|
||||
Event& myEvent;
|
||||
|
@ -76,6 +112,9 @@ class PhysicalKeyboardHandler
|
|||
// Hashmap of key events
|
||||
KeyMap myKeyMap;
|
||||
|
||||
EventMode myLeftMode;
|
||||
EventMode myRightMode;
|
||||
|
||||
// Sometimes key combos with the Alt key become 'stuck' after the
|
||||
// window changes state, and we want to ignore that event
|
||||
// For example, press Alt-Tab and then upon re-entering the window,
|
||||
|
@ -88,6 +127,20 @@ class PhysicalKeyboardHandler
|
|||
// TODO - This may be a bug in SDL, and might be removed in the future
|
||||
// It only seems to be an issue in Linux
|
||||
uInt8 myAltKeyCounter;
|
||||
|
||||
// Hold controller related events
|
||||
static EventSet LeftJoystickEvents;
|
||||
static EventSet RightJoystickEvents;
|
||||
static EventSet LeftPaddlesEvents;
|
||||
static EventSet RightPaddlesEvents;
|
||||
static EventSet LeftKeypadEvents;
|
||||
static EventSet RightKeypadEvents;
|
||||
|
||||
static EventMappingArray DefaultEmuMapping;
|
||||
static EventMappingArray DefaultMenuMapping;
|
||||
static EventMappingArray DefaultJoystickMapping;
|
||||
static EventMappingArray DefaultPaddleMapping;
|
||||
static EventMappingArray DefaultKeypadMapping;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -845,6 +845,8 @@ unique_ptr<Controller> Console::getControllerPort(const string& rommd5,
|
|||
{
|
||||
unique_ptr<Controller> controller = std::move(myLeftControl);
|
||||
|
||||
myOSystem.eventHandler().enableKeyControllerEvents(controllerName, port);
|
||||
|
||||
if(controllerName == "JOYSTICK")
|
||||
{
|
||||
// Already created in c'tor
|
||||
|
|
|
@ -110,7 +110,7 @@ class Event
|
|||
};
|
||||
|
||||
// Event list version, update if the id of existing event types changed
|
||||
static constexpr Int32 VERSION = 1;
|
||||
static constexpr Int32 VERSION = 2;
|
||||
|
||||
class KeyTable {
|
||||
public:
|
||||
|
|
|
@ -186,6 +186,13 @@ class EventHandler
|
|||
*/
|
||||
bool addKeyMapping(Event::Type event, EventMode mode, StellaKey key, StellaMod mod);
|
||||
|
||||
/**
|
||||
Enable controller specific keyboard events.
|
||||
*/
|
||||
void enableKeyControllerEvents(const string& controllerName, Controller::Jack port) {
|
||||
myPKeyHandler->enableControllerEvents(controllerName, port);
|
||||
}
|
||||
|
||||
/**
|
||||
Bind a physical joystick axis direction to an event/action and regenerate
|
||||
the mapping array(s).
|
||||
|
|
|
@ -70,9 +70,13 @@ enum JoyHatMask {
|
|||
enum EventMode {
|
||||
kEmulationMode = 0, // make sure these are set correctly,
|
||||
kMenuMode = 1, // since they'll be used as array indices
|
||||
kNumModes = 2
|
||||
kNumModes = 2,
|
||||
kJoystickMode = kNumModes, // 3 extra modes for mapping controller keys separately
|
||||
kPaddlesMode = kNumModes + 1,
|
||||
kKeypadMode = kNumModes + 2
|
||||
};
|
||||
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
#ifdef RETRON77
|
||||
|
|
|
@ -84,6 +84,9 @@ Settings::Settings()
|
|||
// Input event options
|
||||
setPermanent("event_ver", "1");
|
||||
setPermanent("keymap_emu", "");
|
||||
setPermanent("keymap_joy", "");
|
||||
setPermanent("keymap_pad", "");
|
||||
setPermanent("keymap_key", "");
|
||||
setPermanent("keymap_ui", "");
|
||||
setPermanent("joymap", "");
|
||||
setPermanent("combomap", "");
|
||||
|
|
Loading…
Reference in New Issue