mirror of https://github.com/stella-emu/stella.git
try to map correctly for MacOS.
make remaining ALT hotkeys configurable
This commit is contained in:
parent
d9ba5bedd7
commit
24dcb64c70
|
@ -88,20 +88,28 @@ bool KeyMap::check(const int mode, const int key, const int mod) const
|
||||||
string KeyMap::getDesc(const Mapping& mapping) const
|
string KeyMap::getDesc(const Mapping& mapping) const
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
#ifndef BSPF_MACOS
|
#ifdef BSPF_MACOS
|
||||||
string modifier = "Ctrl";
|
string control = "Cmd";
|
||||||
|
string alt = "Ctrl";
|
||||||
|
int ALT = KBDM_GUI;
|
||||||
|
int LALT = KBDM_LGUI;
|
||||||
|
int RALT = KBDM_RGUI;
|
||||||
#else
|
#else
|
||||||
string modifier = "Cmd";
|
string control = "Ctrl";
|
||||||
|
string alt = "Alt";
|
||||||
|
int ALT = KBDM_ALT;
|
||||||
|
int LALT = KBDM_LALT;
|
||||||
|
int RALT = KBDM_RALT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((mapping.mod & KBDM_CTRL) == KBDM_CTRL) buf << modifier;
|
if ((mapping.mod & KBDM_CTRL) == KBDM_CTRL) buf << control;
|
||||||
else if (mapping.mod & KBDM_LCTRL) buf << "Left " << modifier;
|
else if (mapping.mod & KBDM_LCTRL) buf << "Left " << control;
|
||||||
else if (mapping.mod & KBDM_RCTRL) buf << "Right " << modifier;
|
else if (mapping.mod & KBDM_RCTRL) buf << "Right " << control;
|
||||||
|
|
||||||
if ((mapping.mod & (KBDM_ALT)) && buf.tellp()) buf << "+";
|
if ((mapping.mod & (ALT)) && buf.tellp()) buf << "+";
|
||||||
if ((mapping.mod & KBDM_ALT) == KBDM_ALT) buf << "Alt";
|
if ((mapping.mod & ALT) == ALT) buf << alt;
|
||||||
else if (mapping.mod & KBDM_LALT) buf << "Left Alt";
|
else if (mapping.mod & LALT) buf << alt;
|
||||||
else if (mapping.mod & KBDM_RALT) buf << "Right Alt";
|
else if (mapping.mod & RALT) buf << alt;
|
||||||
|
|
||||||
if ((mapping.mod & (KBDM_SHIFT)) && buf.tellp()) buf << "+";
|
if ((mapping.mod & (KBDM_SHIFT)) && buf.tellp()) buf << "+";
|
||||||
if ((mapping.mod & KBDM_SHIFT) == KBDM_SHIFT) buf << "Shift";
|
if ((mapping.mod & KBDM_SHIFT) == KBDM_SHIFT) buf << "Shift";
|
||||||
|
@ -127,7 +135,7 @@ string KeyMap::getEventMappingDesc(const Event::Type event, const int mode) cons
|
||||||
#ifndef BSPF_MACOS
|
#ifndef BSPF_MACOS
|
||||||
string modifier = "Ctrl";
|
string modifier = "Ctrl";
|
||||||
#else
|
#else
|
||||||
string modifier = "Cmd";
|
string control = "Cmd";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (auto item : myMap)
|
for (auto item : myMap)
|
||||||
|
@ -221,7 +229,11 @@ KeyMap::Mapping KeyMap::convertMod(const Mapping& mapping) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// limit to modifiers we want to support
|
// limit to modifiers we want to support
|
||||||
m.mod = StellaMod(m.mod & (KBDM_SHIFT | KBDM_ALT | KBDM_CTRL));
|
#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
|
||||||
}
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
|
|
@ -50,8 +50,12 @@ class KeyMap
|
||||||
return (key == other.key
|
return (key == other.key
|
||||||
&& mode == other.mode
|
&& mode == other.mode
|
||||||
&& (((mod | other.mod) & KBDM_SHIFT) ? (mod & other.mod & KBDM_SHIFT) : true)
|
&& (((mod | other.mod) & KBDM_SHIFT) ? (mod & other.mod & KBDM_SHIFT) : true)
|
||||||
&& (((mod | other.mod) & KBDM_ALT ) ? (mod & other.mod & KBDM_ALT ) : true)
|
|
||||||
&& (((mod | other.mod) & KBDM_CTRL ) ? (mod & other.mod & KBDM_CTRL ) : 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
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -208,6 +208,13 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
||||||
setDefaultKey(Event::ToggleCollisions , KBDK_PERIOD, KBDM_SHIFT | KBDM_ALT);
|
setDefaultKey(Event::ToggleCollisions , KBDK_PERIOD, KBDM_SHIFT | KBDM_ALT);
|
||||||
setDefaultKey(Event::ToggleBits , KBDK_PERIOD, KBDM_ALT);
|
setDefaultKey(Event::ToggleBits , KBDK_PERIOD, KBDM_ALT);
|
||||||
|
|
||||||
|
setDefaultKey(Event::Rewind1Menu , KBDK_LEFT, KBDM_ALT);
|
||||||
|
setDefaultKey(Event::Rewind10Menu , KBDK_LEFT, KBDM_SHIFT | KBDM_ALT);
|
||||||
|
setDefaultKey(Event::RewindAllMenu , KBDK_DOWN, KBDM_ALT);
|
||||||
|
setDefaultKey(Event::Unwind1Menu , KBDK_RIGHT, KBDM_ALT);
|
||||||
|
setDefaultKey(Event::Unwind10Menu , KBDK_RIGHT, KBDM_SHIFT | KBDM_ALT);
|
||||||
|
setDefaultKey(Event::UnwindAllMenu , KBDK_UP, KBDM_ALT);
|
||||||
|
|
||||||
#if defined(RETRON77)
|
#if defined(RETRON77)
|
||||||
setDefaultKey(Event::ConsoleColorToggle , KBDK_F4); // back ("COLOR","B/W")
|
setDefaultKey(Event::ConsoleColorToggle , KBDK_F4); // back ("COLOR","B/W")
|
||||||
setDefaultKey(Event::ConsoleLeftDiffToggle , KBDK_F6); // front ("SKILL P1")
|
setDefaultKey(Event::ConsoleLeftDiffToggle , KBDK_F6); // front ("SKILL P1")
|
||||||
|
@ -366,22 +373,6 @@ bool PhysicalKeyboardHandler::handleAltEvent(StellaKey key, StellaMod mod, bool
|
||||||
{
|
{
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_LEFT: // Alt-left(-shift) rewinds 1(10) states
|
|
||||||
myHandler.enterTimeMachineMenuMode((StellaModTest::isShift(mod) && pressed) ? 10 : 1, false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_RIGHT: // Alt-right(-shift) unwinds 1(10) states
|
|
||||||
myHandler.enterTimeMachineMenuMode((StellaModTest::isShift(mod) && pressed) ? 10 : 1, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_DOWN: // Alt-down rewinds to start of list
|
|
||||||
myHandler.enterTimeMachineMenuMode(1000, false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_UP: // Alt-up rewinds to end of list
|
|
||||||
myHandler.enterTimeMachineMenuMode(1000, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_PAGEUP: // Alt-PageUp increases YStart
|
case KBDK_PAGEUP: // Alt-PageUp increases YStart
|
||||||
myOSystem.console().changeYStart(+1);
|
myOSystem.console().changeYStart(+1);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -100,6 +100,9 @@ class Event
|
||||||
HandleMouseControl, ToggleGrabMouse, ToggleSAPortOrder,
|
HandleMouseControl, ToggleGrabMouse, ToggleSAPortOrder,
|
||||||
DecreaseFormat, IncreaseFormat, ReloadConsole,
|
DecreaseFormat, IncreaseFormat, ReloadConsole,
|
||||||
|
|
||||||
|
Rewind1Menu, Rewind10Menu, RewindAllMenu,
|
||||||
|
Unwind1Menu, Unwind10Menu, UnwindAllMenu,
|
||||||
|
|
||||||
LastType
|
LastType
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -628,6 +628,30 @@ void EventHandler::handleEvent(Event::Type event, bool pressed)
|
||||||
if (pressed) myOSystem.state().unwindStates();
|
if (pressed) myOSystem.state().unwindStates();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case Event::Rewind1Menu:
|
||||||
|
if (pressed) enterTimeMachineMenuMode(1, false);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Event::Rewind10Menu:
|
||||||
|
if (pressed) enterTimeMachineMenuMode(10, false);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Event::RewindAllMenu:
|
||||||
|
if (pressed) enterTimeMachineMenuMode(1000, false);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Event::Unwind1Menu:
|
||||||
|
if (pressed) enterTimeMachineMenuMode(1, true);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Event::Unwind10Menu:
|
||||||
|
if (pressed) enterTimeMachineMenuMode(10, true);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Event::UnwindAllMenu:
|
||||||
|
if (pressed) enterTimeMachineMenuMode(1000, true);
|
||||||
|
return;
|
||||||
|
|
||||||
case Event::TakeSnapshot:
|
case Event::TakeSnapshot:
|
||||||
if(pressed) myOSystem.frameBuffer().tiaSurface().saveSnapShot();
|
if(pressed) myOSystem.frameBuffer().tiaSurface().saveSnapShot();
|
||||||
return;
|
return;
|
||||||
|
@ -1554,9 +1578,17 @@ EventHandler::ActionList EventHandler::ourEmulActionList[EMUL_ACTIONLIST_SIZE] =
|
||||||
{ Event::PauseMode, "Pause", "", false },
|
{ Event::PauseMode, "Pause", "", false },
|
||||||
{ Event::OptionsMenuMode, "Enter options menu UI", "", false },
|
{ Event::OptionsMenuMode, "Enter options menu UI", "", false },
|
||||||
{ Event::CmdMenuMode, "Toggle command menu UI", "", false },
|
{ Event::CmdMenuMode, "Toggle command menu UI", "", false },
|
||||||
{ Event::TimeMachineMode, "Toggle time machine UI", "", false },
|
|
||||||
{ Event::Rewind, "Rewind game", "", false },
|
{ Event::TimeMachineMode, "Toggle Time Machine UI", "", false },
|
||||||
{ Event::Unwind, "Unwind game", "", false },
|
{ Event::Rewind, "Rewind game one state", "", false },
|
||||||
|
{ Event::Unwind, "Unwind game one state", "", false },
|
||||||
|
{ Event::Rewind1Menu, "Rewind one state & enter TM UI", "", false },
|
||||||
|
{ Event::Rewind10Menu, "Rewind 10 states & enter TM UI", "", false },
|
||||||
|
{ Event::RewindAllMenu, "Rewind all states & enter TM UI", "", false },
|
||||||
|
{ Event::Unwind1Menu, "Unwind one state & enter TM UI", "", false },
|
||||||
|
{ Event::Unwind10Menu, "Unwind 10 states & enter TM UI", "", false },
|
||||||
|
{ Event::UnwindAllMenu, "Unwind all states & enter TM UI", "", false },
|
||||||
|
|
||||||
{ Event::DebuggerMode, "Toggle debugger mode", "", false },
|
{ Event::DebuggerMode, "Toggle debugger mode", "", false },
|
||||||
{ Event::ReloadConsole, "Reload current ROM/load next game", "", false },
|
{ Event::ReloadConsole, "Reload current ROM/load next game", "", false },
|
||||||
{ Event::ExitMode, "Exit current Stella mode", "", false },
|
{ Event::ExitMode, "Exit current Stella mode", "", false },
|
||||||
|
|
|
@ -368,9 +368,9 @@ class EventHandler
|
||||||
COMBO_SIZE = 16,
|
COMBO_SIZE = 16,
|
||||||
EVENTS_PER_COMBO = 8,
|
EVENTS_PER_COMBO = 8,
|
||||||
#ifdef PNG_SUPPORT
|
#ifdef PNG_SUPPORT
|
||||||
EMUL_ACTIONLIST_SIZE = 129 + COMBO_SIZE,
|
EMUL_ACTIONLIST_SIZE = 135 + COMBO_SIZE,
|
||||||
#else
|
#else
|
||||||
EMUL_ACTIONLIST_SIZE = 129 - 2 + COMBO_SIZE,
|
EMUL_ACTIONLIST_SIZE = 135 - 2 + COMBO_SIZE,
|
||||||
#endif
|
#endif
|
||||||
MENU_ACTIONLIST_SIZE = 18
|
MENU_ACTIONLIST_SIZE = 18
|
||||||
;
|
;
|
||||||
|
|
|
@ -273,7 +273,11 @@ bool EventMappingWidget::handleKeyUp(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Remap keys in remap mode
|
// Remap keys in remap mode
|
||||||
if (myRemapStatus && myActionSelected >= 0
|
if (myRemapStatus && myActionSelected >= 0
|
||||||
&& (mod & (KBDM_ALT | KBDM_CTRL | KBDM_SHIFT)) == 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
|
||||||
{
|
{
|
||||||
Event::Type event =
|
Event::Type event =
|
||||||
instance().eventHandler().eventAtIndex(myActionSelected, myEventMode);
|
instance().eventHandler().eventAtIndex(myActionSelected, myEventMode);
|
||||||
|
|
Loading…
Reference in New Issue