mirror of https://github.com/stella-emu/stella.git
add 4th modifier key (windows/option) to allowed mappings
This commit is contained in:
parent
a3350bca07
commit
1c5fa872c0
|
@ -93,27 +93,38 @@ string KeyMap::getDesc(const Mapping& mapping) const
|
|||
{
|
||||
ostringstream buf;
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
string control = "Ctrl";
|
||||
string alt = "Cmd";
|
||||
int ALT = KBDM_GUI;
|
||||
int LALT = KBDM_LGUI;
|
||||
int RALT = KBDM_RGUI;
|
||||
string mod2 = "Option";
|
||||
int MOD2 = KBDM_ALT;
|
||||
int LMOD2 = KBDM_LALT;
|
||||
int RMOD2 = KBDM_RALT;
|
||||
string mod3 = "Cmd";
|
||||
int MOD3 = KBDM_GUI;
|
||||
int LMOD3 = KBDM_LGUI;
|
||||
int RMOD3 = KBDM_RGUI;
|
||||
#else
|
||||
string control = "Ctrl";
|
||||
string alt = "Alt";
|
||||
int ALT = KBDM_ALT;
|
||||
int LALT = KBDM_LALT;
|
||||
int RALT = KBDM_RALT;
|
||||
string mod2 = "Windows";
|
||||
int MOD2 = KBDM_GUI;
|
||||
int LMOD2 = KBDM_LGUI;
|
||||
int RMOD2 = KBDM_RGUI;
|
||||
string mod3 = "Alt";
|
||||
int MOD3 = KBDM_ALT;
|
||||
int LMOD3 = KBDM_LALT;
|
||||
int RMOD3 = KBDM_RALT;
|
||||
#endif
|
||||
|
||||
if ((mapping.mod & KBDM_CTRL) == KBDM_CTRL) buf << control;
|
||||
else if (mapping.mod & KBDM_LCTRL) buf << "Left " << control;
|
||||
else if (mapping.mod & KBDM_RCTRL) buf << "Right " << control;
|
||||
if ((mapping.mod & KBDM_CTRL) == KBDM_CTRL) buf << "Ctrl";
|
||||
else if (mapping.mod & KBDM_LCTRL) buf << "Left Ctrl";
|
||||
else if (mapping.mod & KBDM_RCTRL) buf << "Right Ctrl";
|
||||
|
||||
if ((mapping.mod & (ALT)) && buf.tellp()) buf << "+";
|
||||
if ((mapping.mod & ALT) == ALT) buf << alt;
|
||||
else if (mapping.mod & LALT) buf << alt;
|
||||
else if (mapping.mod & RALT) buf << alt;
|
||||
if ((mapping.mod & (MOD2)) && buf.tellp()) buf << "+";
|
||||
if ((mapping.mod & MOD2) == MOD2) buf << mod2;
|
||||
else if (mapping.mod & LMOD2) buf << "Left " << mod2;
|
||||
else if (mapping.mod & RMOD2) buf << "Right " << mod2;
|
||||
|
||||
if ((mapping.mod & (MOD3)) && buf.tellp()) buf << "+";
|
||||
if ((mapping.mod & MOD3) == MOD3) buf << mod3;
|
||||
else if (mapping.mod & LMOD3) buf << "Left " << mod3;
|
||||
else if (mapping.mod & RMOD3) buf << "Right " << mod3;
|
||||
|
||||
if ((mapping.mod & (KBDM_SHIFT)) && buf.tellp()) buf << "+";
|
||||
if ((mapping.mod & KBDM_SHIFT) == KBDM_SHIFT) buf << "Shift";
|
||||
|
@ -228,11 +239,7 @@ KeyMap::Mapping KeyMap::convertMod(const Mapping& mapping) const
|
|||
else
|
||||
{
|
||||
// limit to modifiers we want to support
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
m.mod = StellaMod(m.mod & (KBDM_SHIFT | KBDM_CTRL | KBDM_GUI));
|
||||
#else
|
||||
m.mod = StellaMod(m.mod & (KBDM_SHIFT | KBDM_CTRL | KBDM_ALT));
|
||||
#endif
|
||||
m.mod = StellaMod(m.mod & (KBDM_SHIFT | KBDM_CTRL | KBDM_ALT | KBDM_GUI));
|
||||
}
|
||||
|
||||
return m;
|
||||
|
|
|
@ -50,11 +50,8 @@ class KeyMap
|
|||
&& mode == other.mode
|
||||
&& (((mod | other.mod) & KBDM_SHIFT) ? (mod & other.mod & KBDM_SHIFT) : true)
|
||||
&& (((mod | other.mod) & KBDM_CTRL ) ? (mod & other.mod & KBDM_CTRL ) : true)
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
&& (((mod | other.mod) & KBDM_GUI ) ? (mod & other.mod & KBDM_GUI ) : true)
|
||||
#else
|
||||
&& (((mod | other.mod) & KBDM_ALT ) ? (mod & other.mod & KBDM_ALT ) : true)
|
||||
#endif
|
||||
&& (((mod | other.mod) & KBDM_GUI ) ? (mod & other.mod & KBDM_GUI ) : true)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -109,12 +106,9 @@ class KeyMap
|
|||
return std::hash<uInt64>()((uInt64(m.mode)) // 1 bit
|
||||
^ ((uInt64(m.key)) << 1) // 8 bits
|
||||
^ ((uInt64((m.mod & KBDM_SHIFT) != 0) << 9)) // 1 bit
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
^ ((uInt64((m.mod & KBDM_GUI ) != 0) << 10)) // 1 bit
|
||||
#else
|
||||
^ ((uInt64((m.mod & KBDM_ALT ) != 0) << 10)) // 1 bit
|
||||
#endif
|
||||
^ ((uInt64((m.mod & KBDM_CTRL ) != 0) << 11))); // 1 bit
|
||||
^ ((uInt64((m.mod & KBDM_GUI ) != 0) << 11)) // 1 bit
|
||||
^ ((uInt64((m.mod & KBDM_CTRL ) != 0) << 12))); // 1 bit
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -90,9 +90,9 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
};
|
||||
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
static constexpr int ALT = KBDM_GUI;
|
||||
static constexpr int MOD3 = KBDM_GUI;
|
||||
#else
|
||||
static constexpr int ALT = KBDM_ALT;
|
||||
static constexpr int MOD3 = KBDM_ALT;
|
||||
#endif
|
||||
|
||||
switch(mode)
|
||||
|
@ -150,10 +150,10 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
setDefaultKey(Event::ConsoleRightDiffA , KBDK_F7);
|
||||
setDefaultKey(Event::ConsoleRightDiffB , KBDK_F8);
|
||||
setDefaultKey(Event::SaveState , KBDK_F9);
|
||||
setDefaultKey(Event::SaveAllStates , KBDK_F9, ALT);
|
||||
setDefaultKey(Event::SaveAllStates , KBDK_F9, MOD3);
|
||||
setDefaultKey(Event::ChangeState , KBDK_F10);
|
||||
setDefaultKey(Event::LoadState , KBDK_F11);
|
||||
setDefaultKey(Event::LoadAllStates , KBDK_F11, ALT);
|
||||
setDefaultKey(Event::LoadAllStates , KBDK_F11, MOD3);
|
||||
setDefaultKey(Event::TakeSnapshot , KBDK_F12);
|
||||
setDefaultKey(Event::Fry , KBDK_BACKSPACE);
|
||||
setDefaultKey(Event::TogglePauseMode , KBDK_PAUSE);
|
||||
|
@ -163,42 +163,42 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
setDefaultKey(Event::DebuggerMode , KBDK_GRAVE);
|
||||
setDefaultKey(Event::ExitMode , KBDK_ESCAPE);
|
||||
#ifdef BSPF_MACOS
|
||||
setDefaultKey(Event::Quit , KBDK_Q, ALT);
|
||||
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, ALT);
|
||||
setDefaultKey(Event::VidmodeIncrease , KBDK_EQUALS, ALT);
|
||||
setDefaultKey(Event::VolumeDecrease , KBDK_LEFTBRACKET, ALT);
|
||||
setDefaultKey(Event::VolumeIncrease , KBDK_RIGHTBRACKET, ALT);
|
||||
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, ALT);
|
||||
setDefaultKey(Event::VidmodeStd , KBDK_1, ALT);
|
||||
setDefaultKey(Event::VidmodeRGB , KBDK_2, ALT);
|
||||
setDefaultKey(Event::VidmodeSVideo , KBDK_3, ALT);
|
||||
setDefaultKey(Event::VidModeComposite , KBDK_4, ALT);
|
||||
setDefaultKey(Event::VidModeBad , KBDK_5, ALT);
|
||||
setDefaultKey(Event::VidModeCustom , KBDK_6, ALT);
|
||||
setDefaultKey(Event::PreviousAttribute , KBDK_7, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::NextAttribute , KBDK_7, ALT);
|
||||
setDefaultKey(Event::DecreaseAttribute , KBDK_8, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::IncreaseAttribute , KBDK_8, ALT);
|
||||
setDefaultKey(Event::DecreasePhosphor , KBDK_9, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::IncreasePhosphor , KBDK_9, ALT);
|
||||
setDefaultKey(Event::TogglePhosphor , KBDK_P, ALT);
|
||||
setDefaultKey(Event::ScanlinesDecrease , KBDK_0, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::ScanlinesIncrease , KBDK_0, ALT);
|
||||
setDefaultKey(Event::ToggleFullScreen , KBDK_RETURN, 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, ALT);
|
||||
setDefaultKey(Event::ToggleFrameStats , KBDK_L, ALT);
|
||||
setDefaultKey(Event::ToggleTimeMachine , KBDK_T, ALT);
|
||||
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, ALT);
|
||||
setDefaultKey(Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | ALT);
|
||||
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);
|
||||
|
@ -206,28 +206,28 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
setDefaultKey(Event::DecreaseFormat , KBDK_F, KBDM_SHIFT | KBDM_CTRL);
|
||||
setDefaultKey(Event::IncreaseFormat , KBDK_F, KBDM_CTRL);
|
||||
|
||||
setDefaultKey(Event::ToggleP0Collision , KBDK_Z, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::ToggleP0Bit , KBDK_Z, ALT);
|
||||
setDefaultKey(Event::ToggleP1Collision , KBDK_X, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::ToggleP1Bit , KBDK_X, ALT);
|
||||
setDefaultKey(Event::ToggleM0Collision , KBDK_C, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::ToggleM0Bit , KBDK_C, ALT);
|
||||
setDefaultKey(Event::ToggleM1Collision , KBDK_V, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::ToggleM1Bit , KBDK_V, ALT);
|
||||
setDefaultKey(Event::ToggleBLCollision , KBDK_B, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::ToggleBLBit , KBDK_B, ALT);
|
||||
setDefaultKey(Event::TogglePFCollision , KBDK_N, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::TogglePFBit , KBDK_N, ALT);
|
||||
setDefaultKey(Event::ToggleCollisions , KBDK_COMMA, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::ToggleBits , KBDK_COMMA, ALT);
|
||||
setDefaultKey(Event::ToggleFixedColors , KBDK_PERIOD, ALT);
|
||||
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::Rewind1Menu , KBDK_LEFT, ALT);
|
||||
setDefaultKey(Event::Rewind10Menu , KBDK_LEFT, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::RewindAllMenu , KBDK_DOWN, ALT);
|
||||
setDefaultKey(Event::Unwind1Menu , KBDK_RIGHT, ALT);
|
||||
setDefaultKey(Event::Unwind10Menu , KBDK_RIGHT, KBDM_SHIFT | ALT);
|
||||
setDefaultKey(Event::UnwindAllMenu , KBDK_UP, ALT);
|
||||
setDefaultKey(Event::Rewind1Menu , KBDK_LEFT, MOD3);
|
||||
setDefaultKey(Event::Rewind10Menu , KBDK_LEFT, KBDM_SHIFT | MOD3);
|
||||
setDefaultKey(Event::RewindAllMenu , KBDK_DOWN, MOD3);
|
||||
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")
|
||||
|
@ -258,9 +258,9 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
setDefaultKey(Event::UITabNext , KBDK_TAB, KBDM_CTRL);
|
||||
|
||||
setDefaultKey(Event::UIPrevDir , KBDK_BACKSPACE);
|
||||
setDefaultKey(Event::ToggleFullScreen , KBDK_RETURN, ALT);
|
||||
setDefaultKey(Event::ToggleFullScreen , KBDK_RETURN, MOD3);
|
||||
#ifdef BSPF_MACOS
|
||||
setDefaultKey(Event::Quit , KBDK_Q, ALT);
|
||||
setDefaultKey(Event::Quit , KBDK_Q, MOD3);
|
||||
#else
|
||||
setDefaultKey(Event::Quit , KBDK_Q, KBDM_CTRL);
|
||||
#endif
|
||||
|
|
|
@ -273,11 +273,7 @@ bool EventMappingWidget::handleKeyUp(StellaKey key, StellaMod mod)
|
|||
{
|
||||
// Remap keys in remap mode
|
||||
if (myRemapStatus && myActionSelected >= 0
|
||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||
&& (mod & (KBDM_CTRL | KBDM_SHIFT | KBDM_GUI)) == 0)
|
||||
#else
|
||||
&& (mod & (KBDM_CTRL | KBDM_SHIFT | KBDM_ALT)) == 0)
|
||||
#endif
|
||||
&& (mod & (KBDM_CTRL | KBDM_SHIFT | KBDM_ALT | KBDM_GUI)) == 0)
|
||||
{
|
||||
Event::Type event =
|
||||
instance().eventHandler().eventAtIndex(myActionSelected, myEventMode);
|
||||
|
|
Loading…
Reference in New Issue