mirror of https://github.com/stella-emu/stella.git
made EventMode an enum class
This commit is contained in:
parent
b21a821ccc
commit
55d3c9106f
|
@ -29,7 +29,7 @@ void KeyMap::add(const Event::Type event, const Mapping& mapping)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void KeyMap::add(const Event::Type event, const int mode, const int key, const int mod)
|
void KeyMap::add(const Event::Type event, const EventMode mode, const int key, const int mod)
|
||||||
{
|
{
|
||||||
add(event, Mapping(mode, key, mod));
|
add(event, Mapping(mode, key, mod));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ void KeyMap::erase(const Mapping& mapping)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void KeyMap::erase(const int mode, const int key, const int mod)
|
void KeyMap::erase(const EventMode mode, const int key, const int mod)
|
||||||
{
|
{
|
||||||
erase(Mapping(mode, key, mod));
|
erase(Mapping(mode, key, mod));
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ Event::Type KeyMap::get(const Mapping& mapping) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Event::Type KeyMap::get(const int mode, const int key, const int mod) const
|
Event::Type KeyMap::get(const EventMode mode, const int key, const int mod) const
|
||||||
{
|
{
|
||||||
return get(Mapping(mode, key, mod));
|
return get(Mapping(mode, key, mod));
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ bool KeyMap::check(const Mapping& mapping) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool KeyMap::check(const int mode, const int key, const int mod) const
|
bool KeyMap::check(const EventMode mode, const int key, const int mod) const
|
||||||
{
|
{
|
||||||
return check(Mapping(mode, key, mod));
|
return check(Mapping(mode, key, mod));
|
||||||
}
|
}
|
||||||
|
@ -138,13 +138,13 @@ string KeyMap::getDesc(const Mapping& mapping) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string KeyMap::getDesc(const int mode, const int key, const int mod) const
|
string KeyMap::getDesc(const EventMode mode, const int key, const int mod) const
|
||||||
{
|
{
|
||||||
return getDesc(Mapping(mode, key, mod));
|
return getDesc(Mapping(mode, key, mod));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string KeyMap::getEventMappingDesc(const Event::Type event, const int mode) const
|
string KeyMap::getEventMappingDesc(const Event::Type event, const EventMode mode) const
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ string KeyMap::getEventMappingDesc(const Event::Type event, const int mode) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event, const int mode) const
|
KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event, const EventMode mode) const
|
||||||
{
|
{
|
||||||
MappingArray map;
|
MappingArray map;
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event, const int
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string KeyMap::saveMapping(const int mode) const
|
string KeyMap::saveMapping(const EventMode mode) const
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ string KeyMap::saveMapping(const int mode) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int KeyMap::loadMapping(string& list, const int mode)
|
int KeyMap::loadMapping(string& list, const EventMode mode)
|
||||||
{
|
{
|
||||||
// Since istringstream swallows whitespace, we have to make the
|
// Since istringstream swallows whitespace, we have to make the
|
||||||
// delimiters be spaces
|
// delimiters be spaces
|
||||||
|
@ -207,7 +207,7 @@ int KeyMap::loadMapping(string& list, const int mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void KeyMap::eraseMode(const int mode)
|
void KeyMap::eraseMode(const EventMode mode)
|
||||||
{
|
{
|
||||||
for (auto item = myMap.begin(); item != myMap.end();)
|
for (auto item = myMap.begin(); item != myMap.end();)
|
||||||
if (item->first.mode == mode) {
|
if (item->first.mode == mode) {
|
||||||
|
@ -218,7 +218,7 @@ void KeyMap::eraseMode(const int mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void KeyMap::eraseEvent(const Event::Type event, const int mode)
|
void KeyMap::eraseEvent(const Event::Type event, const EventMode mode)
|
||||||
{
|
{
|
||||||
for (auto item = myMap.begin(); item != myMap.end();)
|
for (auto item = myMap.begin(); item != myMap.end();)
|
||||||
if (item->second == event && item->first.mode == mode) {
|
if (item->second == event && item->first.mode == mode) {
|
||||||
|
|
|
@ -41,8 +41,8 @@ class KeyMap
|
||||||
Mapping(const Mapping& m) : mode(m.mode), key(m.key), mod(m.mod) { }
|
Mapping(const Mapping& m) : mode(m.mode), key(m.key), mod(m.mod) { }
|
||||||
explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod)
|
explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod)
|
||||||
: mode(c_mode), key(c_key), mod(c_mod) { }
|
: mode(c_mode), key(c_key), mod(c_mod) { }
|
||||||
explicit Mapping(int c_mode, int c_key, int c_mod)
|
explicit Mapping(EventMode c_mode, int c_key, int c_mod)
|
||||||
: mode(EventMode(c_mode)), key(StellaKey(c_key)), mod(StellaMod(c_mod)) { }
|
: mode(c_mode), key(StellaKey(c_key)), mod(StellaMod(c_mod)) { }
|
||||||
|
|
||||||
bool operator==(const Mapping& other) const
|
bool operator==(const Mapping& other) const
|
||||||
{
|
{
|
||||||
|
@ -62,36 +62,36 @@ class KeyMap
|
||||||
|
|
||||||
/** Add new mapping for given event */
|
/** Add new mapping for given event */
|
||||||
void add(const Event::Type event, const Mapping& mapping);
|
void add(const Event::Type event, const Mapping& mapping);
|
||||||
void add(const Event::Type event, const int mode, const int key, const int mod);
|
void add(const Event::Type event, const EventMode mode, const int key, const int mod);
|
||||||
|
|
||||||
/** Erase mapping */
|
/** Erase mapping */
|
||||||
void erase(const Mapping& mapping);
|
void erase(const Mapping& mapping);
|
||||||
void erase(const int mode, const int key, const int mod);
|
void erase(const EventMode mode, const int key, const int mod);
|
||||||
|
|
||||||
/** Get event for mapping */
|
/** Get event for mapping */
|
||||||
Event::Type get(const Mapping& mapping) const;
|
Event::Type get(const Mapping& mapping) const;
|
||||||
Event::Type get(const int mode, const int key, const int mod) const;
|
Event::Type get(const EventMode mode, const int key, const int mod) const;
|
||||||
|
|
||||||
/** Check if a mapping exists */
|
/** Check if a mapping exists */
|
||||||
bool check(const Mapping& mapping) const;
|
bool check(const Mapping& mapping) const;
|
||||||
bool check(const int mode, const int key, const int mod) const;
|
bool check(const EventMode mode, const int key, const int mod) const;
|
||||||
|
|
||||||
/** Get mapping description */
|
/** Get mapping description */
|
||||||
string getDesc(const Mapping& mapping) const;
|
string getDesc(const Mapping& mapping) const;
|
||||||
string getDesc(const int mode, const int key, const int mod) const;
|
string getDesc(const EventMode mode, const int key, const int mod) const;
|
||||||
|
|
||||||
/** Get the mapping description(s) for given event and mode */
|
/** Get the mapping description(s) for given event and mode */
|
||||||
string getEventMappingDesc(const Event::Type event, const int mode) const;
|
string getEventMappingDesc(const Event::Type event, const EventMode mode) const;
|
||||||
|
|
||||||
MappingArray getEventMapping(const Event::Type event, const int mode) const;
|
MappingArray getEventMapping(const Event::Type event, const EventMode mode) const;
|
||||||
|
|
||||||
string saveMapping(const int mode) const;
|
string saveMapping(const EventMode mode) const;
|
||||||
int loadMapping(string& list, const int mode);
|
int loadMapping(string& list, const EventMode mode);
|
||||||
|
|
||||||
/** Erase all mappings for given mode */
|
/** Erase all mappings for given mode */
|
||||||
void eraseMode(const int mode);
|
void eraseMode(const EventMode mode);
|
||||||
/** Erase given event's mapping for given mode */
|
/** Erase given event's mapping for given mode */
|
||||||
void eraseEvent(const Event::Type event, const int mode);
|
void eraseEvent(const Event::Type event, const EventMode mode);
|
||||||
/** clear all mappings for a modes */
|
/** clear all mappings for a modes */
|
||||||
// void clear() { myMap.clear(); }
|
// void clear() { myMap.clear(); }
|
||||||
size_t size() { return myMap.size(); }
|
size_t size() { return myMap.size(); }
|
||||||
|
|
|
@ -123,8 +123,8 @@ int PhysicalJoystickHandler::add(PhysicalJoystickPtr stick)
|
||||||
{
|
{
|
||||||
StickInfo info("", stick);
|
StickInfo info("", stick);
|
||||||
myDatabase.emplace(stick->name, info);
|
myDatabase.emplace(stick->name, info);
|
||||||
setStickDefaultMapping(stick->ID, Event::NoType, kEmulationMode, true);
|
setStickDefaultMapping(stick->ID, Event::NoType, EventMode::kEmulationMode, true);
|
||||||
setStickDefaultMapping(stick->ID, Event::NoType, kMenuMode, true);
|
setStickDefaultMapping(stick->ID, Event::NoType, EventMode::kMenuMode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return stick->ID;
|
return stick->ID;
|
||||||
|
@ -275,36 +275,36 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case kEmulationMode:
|
case EventMode::kEmulationMode:
|
||||||
if ((stick % 2) == 0) // even sticks
|
if ((stick % 2) == 0) // even sticks
|
||||||
{
|
{
|
||||||
// put all controller events into their own mode's mappings
|
// put all controller events into their own mode's mappings
|
||||||
for (const auto& item : DefaultLeftJoystickMapping)
|
for (const auto& item : DefaultLeftJoystickMapping)
|
||||||
setDefaultAction(j, item, event, kJoystickMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kJoystickMode, updateDefaults);
|
||||||
for (const auto& item : DefaultLeftPaddlesMapping)
|
for (const auto& item : DefaultLeftPaddlesMapping)
|
||||||
setDefaultAction(j, item, event, kPaddlesMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kPaddlesMode, updateDefaults);
|
||||||
for (const auto& item : DefaultLeftKeypadMapping)
|
for (const auto& item : DefaultLeftKeypadMapping)
|
||||||
setDefaultAction(j, item, event, kKeypadMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kKeypadMode, updateDefaults);
|
||||||
}
|
}
|
||||||
else // odd sticks
|
else // odd sticks
|
||||||
{
|
{
|
||||||
// put all controller events into their own mode's mappings
|
// put all controller events into their own mode's mappings
|
||||||
for (const auto& item : DefaultRightJoystickMapping)
|
for (const auto& item : DefaultRightJoystickMapping)
|
||||||
setDefaultAction(j, item, event, kJoystickMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kJoystickMode, updateDefaults);
|
||||||
for (const auto& item : DefaultRightPaddlesMapping)
|
for (const auto& item : DefaultRightPaddlesMapping)
|
||||||
setDefaultAction(j, item, event, kPaddlesMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kPaddlesMode, updateDefaults);
|
||||||
for (const auto& item : DefaultRightKeypadMapping)
|
for (const auto& item : DefaultRightKeypadMapping)
|
||||||
setDefaultAction(j, item, event, kKeypadMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kKeypadMode, updateDefaults);
|
||||||
}
|
}
|
||||||
for(const auto& item : DefaultCommonMapping)
|
for(const auto& item : DefaultCommonMapping)
|
||||||
setDefaultAction(j, item, event, kCommonMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kCommonMode, updateDefaults);
|
||||||
// update running emulation mapping too
|
// update running emulation mapping too
|
||||||
enableEmulationMappings();
|
enableEmulationMappings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMenuMode:
|
case EventMode::kMenuMode:
|
||||||
for (const auto& item : DefaultMenuMapping)
|
for (const auto& item : DefaultMenuMapping)
|
||||||
setDefaultAction(j, item, event, kMenuMode, updateDefaults);
|
setDefaultAction(j, item, event, EventMode::kMenuMode, updateDefaults);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -328,27 +328,27 @@ void PhysicalJoystickHandler::defineControllerMappings(const string& controllerN
|
||||||
if ((controllerName == "KEYBOARD") || (controllerName == "KEYPAD"))
|
if ((controllerName == "KEYBOARD") || (controllerName == "KEYPAD"))
|
||||||
{
|
{
|
||||||
if (port == Controller::Jack::Left)
|
if (port == Controller::Jack::Left)
|
||||||
myLeftMode = kKeypadMode;
|
myLeftMode = EventMode::kKeypadMode;
|
||||||
else
|
else
|
||||||
myRightMode = kKeypadMode;
|
myRightMode = EventMode::kKeypadMode;
|
||||||
}
|
}
|
||||||
else if (BSPF::startsWithIgnoreCase(controllerName, "PADDLES"))
|
else if (BSPF::startsWithIgnoreCase(controllerName, "PADDLES"))
|
||||||
{
|
{
|
||||||
if (port == Controller::Jack::Left)
|
if (port == Controller::Jack::Left)
|
||||||
myLeftMode = kPaddlesMode;
|
myLeftMode = EventMode::kPaddlesMode;
|
||||||
else
|
else
|
||||||
myRightMode = kPaddlesMode;
|
myRightMode = EventMode::kPaddlesMode;
|
||||||
}
|
}
|
||||||
else if (controllerName == "CM")
|
else if (controllerName == "CM")
|
||||||
{
|
{
|
||||||
myLeftMode = myRightMode = kCompuMateMode;
|
myLeftMode = myRightMode = EventMode::kCompuMateMode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (port == Controller::Jack::Left)
|
if (port == Controller::Jack::Left)
|
||||||
myLeftMode = kJoystickMode;
|
myLeftMode = EventMode::kJoystickMode;
|
||||||
else
|
else
|
||||||
myRightMode = kJoystickMode;
|
myRightMode = EventMode::kJoystickMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ void PhysicalJoystickHandler::enableEmulationMappings()
|
||||||
const PhysicalJoystickPtr j = stick.second;
|
const PhysicalJoystickPtr j = stick.second;
|
||||||
|
|
||||||
// start from scratch and enable common mappings
|
// start from scratch and enable common mappings
|
||||||
j->joyMap.eraseMode(kEmulationMode);
|
j->joyMap.eraseMode(EventMode::kEmulationMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
enableCommonMappings();
|
enableCommonMappings();
|
||||||
|
@ -368,31 +368,31 @@ void PhysicalJoystickHandler::enableEmulationMappings()
|
||||||
// enable right mode first, so that in case of mapping clashes the left controller has preference
|
// enable right mode first, so that in case of mapping clashes the left controller has preference
|
||||||
switch (myRightMode)
|
switch (myRightMode)
|
||||||
{
|
{
|
||||||
case kPaddlesMode:
|
case EventMode::kPaddlesMode:
|
||||||
enableMappings(RightPaddlesEvents, kPaddlesMode);
|
enableMappings(RightPaddlesEvents, EventMode::kPaddlesMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeypadMode:
|
case EventMode::kKeypadMode:
|
||||||
enableMappings(RightKeypadEvents, kKeypadMode);
|
enableMappings(RightKeypadEvents, EventMode::kKeypadMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
enableMappings(RightJoystickEvents, kJoystickMode);
|
enableMappings(RightJoystickEvents, EventMode::kJoystickMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (myLeftMode)
|
switch (myLeftMode)
|
||||||
{
|
{
|
||||||
case kPaddlesMode:
|
case EventMode::kPaddlesMode:
|
||||||
enableMappings(LeftPaddlesEvents, kPaddlesMode);
|
enableMappings(LeftPaddlesEvents, EventMode::kPaddlesMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeypadMode:
|
case EventMode::kKeypadMode:
|
||||||
enableMappings(LeftKeypadEvents, kKeypadMode);
|
enableMappings(LeftKeypadEvents, EventMode::kKeypadMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
enableMappings(LeftJoystickEvents, kJoystickMode);
|
enableMappings(LeftJoystickEvents, EventMode::kJoystickMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ void PhysicalJoystickHandler::enableCommonMappings()
|
||||||
Event::Type event = static_cast<Event::Type>(i);
|
Event::Type event = static_cast<Event::Type>(i);
|
||||||
|
|
||||||
if (isCommonEvent(event))
|
if (isCommonEvent(event))
|
||||||
enableMapping(event, kCommonMode);
|
enableMapping(event, EventMode::kCommonMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,26 +427,26 @@ void PhysicalJoystickHandler::enableMapping(const Event::Type event, EventMode m
|
||||||
JoyMap::JoyMappingArray joyMappings = j->joyMap.getEventMapping(event, mode);
|
JoyMap::JoyMappingArray joyMappings = j->joyMap.getEventMapping(event, mode);
|
||||||
|
|
||||||
for (const auto& mapping : joyMappings)
|
for (const auto& mapping : joyMappings)
|
||||||
j->joyMap.add(event, kEmulationMode, mapping.button, mapping.axis, mapping.adir);
|
j->joyMap.add(event, EventMode::kEmulationMode, mapping.button, mapping.axis, mapping.adir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event, const EventMode mode) const
|
EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event, const EventMode mode) const
|
||||||
{
|
{
|
||||||
if (mode == kEmulationMode)
|
if (mode == EventMode::kEmulationMode)
|
||||||
{
|
{
|
||||||
if (isJoystickEvent(event))
|
if (isJoystickEvent(event))
|
||||||
return kJoystickMode;
|
return EventMode::kJoystickMode;
|
||||||
|
|
||||||
if (isPaddleEvent(event))
|
if (isPaddleEvent(event))
|
||||||
return kPaddlesMode;
|
return EventMode::kPaddlesMode;
|
||||||
|
|
||||||
if (isKeypadEvent(event))
|
if (isKeypadEvent(event))
|
||||||
return kKeypadMode;
|
return EventMode::kKeypadMode;
|
||||||
|
|
||||||
if (isCommonEvent(event))
|
if (isCommonEvent(event))
|
||||||
return kCommonMode;
|
return EventMode::kCommonMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
|
@ -489,12 +489,12 @@ void PhysicalJoystickHandler::eraseMapping(Event::Type event, EventMode mode)
|
||||||
for (auto& stick : mySticks)
|
for (auto& stick : mySticks)
|
||||||
{
|
{
|
||||||
stick.second->eraseMap(mode); // erase all events
|
stick.second->eraseMap(mode); // erase all events
|
||||||
if (mode == kEmulationMode)
|
if (mode == EventMode::kEmulationMode)
|
||||||
{
|
{
|
||||||
stick.second->eraseMap(kCommonMode);
|
stick.second->eraseMap(EventMode::kCommonMode);
|
||||||
stick.second->eraseMap(kJoystickMode);
|
stick.second->eraseMap(EventMode::kJoystickMode);
|
||||||
stick.second->eraseMap(kPaddlesMode);
|
stick.second->eraseMap(EventMode::kPaddlesMode);
|
||||||
stick.second->eraseMap(kKeypadMode);
|
stick.second->eraseMap(EventMode::kKeypadMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i
|
||||||
{
|
{
|
||||||
j->joyMap.add(event, evMode, button, axis, JoyDir::ANALOG);
|
j->joyMap.add(event, evMode, button, axis, JoyDir::ANALOG);
|
||||||
// update running emulation mapping too
|
// update running emulation mapping too
|
||||||
j->joyMap.add(event, kEmulationMode, button, axis, JoyDir::ANALOG);
|
j->joyMap.add(event, EventMode::kEmulationMode, button, axis, JoyDir::ANALOG);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -576,9 +576,9 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i
|
||||||
j->joyMap.erase(evMode, button, axis, JoyDir::ANALOG);
|
j->joyMap.erase(evMode, button, axis, JoyDir::ANALOG);
|
||||||
j->joyMap.add(event, evMode, button, axis, convertAxisValue(value));
|
j->joyMap.add(event, evMode, button, axis, convertAxisValue(value));
|
||||||
// update running emulation mapping too
|
// update running emulation mapping too
|
||||||
if(Event::isAnalog(j->joyMap.get(kEmulationMode, button, axis, JoyDir::ANALOG)))
|
if(Event::isAnalog(j->joyMap.get(EventMode::kEmulationMode, button, axis, JoyDir::ANALOG)))
|
||||||
j->joyMap.erase(kEmulationMode, button, axis, JoyDir::ANALOG);
|
j->joyMap.erase(EventMode::kEmulationMode, button, axis, JoyDir::ANALOG);
|
||||||
j->joyMap.add(event, kEmulationMode, button, axis, convertAxisValue(value));
|
j->joyMap.add(event, EventMode::kEmulationMode, button, axis, convertAxisValue(value));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ bool PhysicalJoystickHandler::addJoyHatMapping(Event::Type event, EventMode mode
|
||||||
{
|
{
|
||||||
j->joyMap.add(event, getEventMode(event, mode), button, hat, dir);
|
j->joyMap.add(event, getEventMode(event, mode), button, hat, dir);
|
||||||
// update running emulation mapping too
|
// update running emulation mapping too
|
||||||
j->joyMap.add(event, kEmulationMode, button, hat, dir);
|
j->joyMap.add(event, EventMode::kEmulationMode, button, hat, dir);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -614,7 +614,7 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
||||||
|
|
||||||
if (myHandler.state() == EventHandlerState::EMULATION)
|
if (myHandler.state() == EventHandlerState::EMULATION)
|
||||||
{
|
{
|
||||||
Event::Type eventAxisAnalog = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG);
|
Event::Type eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG);
|
||||||
|
|
||||||
// Check for analog events, which are handled differently
|
// Check for analog events, which are handled differently
|
||||||
if (Event::isAnalog(eventAxisAnalog))
|
if (Event::isAnalog(eventAxisAnalog))
|
||||||
|
@ -625,8 +625,8 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
||||||
{
|
{
|
||||||
// Otherwise, we know the event is digital
|
// Otherwise, we know the event is digital
|
||||||
// Every axis event has two associated values, negative and positive
|
// Every axis event has two associated values, negative and positive
|
||||||
Event::Type eventAxisNeg = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::NEG);
|
Event::Type eventAxisNeg = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::NEG);
|
||||||
Event::Type eventAxisPos = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::POS);
|
Event::Type eventAxisPos = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::POS);
|
||||||
|
|
||||||
if (value > Joystick::deadzone())
|
if (value > Joystick::deadzone())
|
||||||
myHandler.handleEvent(eventAxisPos);
|
myHandler.handleEvent(eventAxisPos);
|
||||||
|
@ -684,12 +684,12 @@ void PhysicalJoystickHandler::handleBtnEvent(int stick, int button, bool pressed
|
||||||
j->buttonLast[stick] = pressed ? button : JOY_CTRL_NONE;
|
j->buttonLast[stick] = pressed ? button : JOY_CTRL_NONE;
|
||||||
|
|
||||||
// Handle buttons which switch eventhandler state
|
// Handle buttons which switch eventhandler state
|
||||||
if (pressed && myHandler.changeStateByEvent(j->joyMap.get(kEmulationMode, button)))
|
if (pressed && myHandler.changeStateByEvent(j->joyMap.get(EventMode::kEmulationMode, button)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Determine which mode we're in, then send the event to the appropriate place
|
// Determine which mode we're in, then send the event to the appropriate place
|
||||||
if (myHandler.state() == EventHandlerState::EMULATION)
|
if (myHandler.state() == EventHandlerState::EMULATION)
|
||||||
myHandler.handleEvent(j->joyMap.get(kEmulationMode, button), pressed);
|
myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button), pressed);
|
||||||
#ifdef GUI_SUPPORT
|
#ifdef GUI_SUPPORT
|
||||||
else if (myHandler.hasOverlay())
|
else if (myHandler.hasOverlay())
|
||||||
myHandler.overlay().handleJoyBtnEvent(stick, button, pressed);
|
myHandler.overlay().handleJoyBtnEvent(stick, button, pressed);
|
||||||
|
@ -712,13 +712,13 @@ void PhysicalJoystickHandler::handleHatEvent(int stick, int hat, int value)
|
||||||
|
|
||||||
if (myHandler.state() == EventHandlerState::EMULATION)
|
if (myHandler.state() == EventHandlerState::EMULATION)
|
||||||
{
|
{
|
||||||
myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::UP),
|
myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::UP),
|
||||||
value & EVENT_HATUP_M);
|
value & EVENT_HATUP_M);
|
||||||
myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::RIGHT),
|
myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::RIGHT),
|
||||||
value & EVENT_HATRIGHT_M);
|
value & EVENT_HATRIGHT_M);
|
||||||
myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::DOWN),
|
myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::DOWN),
|
||||||
value & EVENT_HATDOWN_M);
|
value & EVENT_HATDOWN_M);
|
||||||
myHandler.handleEvent(j->joyMap.get(kEmulationMode, button, hat, JoyHat::LEFT),
|
myHandler.handleEvent(j->joyMap.get(EventMode::kEmulationMode, button, hat, JoyHat::LEFT),
|
||||||
value & EVENT_HATLEFT_M);
|
value & EVENT_HATLEFT_M);
|
||||||
}
|
}
|
||||||
#ifdef GUI_SUPPORT
|
#ifdef GUI_SUPPORT
|
||||||
|
|
|
@ -150,7 +150,7 @@ class PhysicalJoystickHandler
|
||||||
|
|
||||||
void setDefaultAction(const PhysicalJoystickPtr& j,
|
void setDefaultAction(const PhysicalJoystickPtr& j,
|
||||||
EventMapping map, Event::Type event = Event::NoType,
|
EventMapping map, Event::Type event = Event::NoType,
|
||||||
EventMode mode = kEmulationMode, bool updateDefaults = false);
|
EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false);
|
||||||
|
|
||||||
/** returns the event's controller mode */
|
/** returns the event's controller mode */
|
||||||
EventMode getEventMode(const Event::Type event, const EventMode mode) const;
|
EventMode getEventMode(const Event::Type event, const EventMode mode) const;
|
||||||
|
|
|
@ -53,20 +53,20 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler&
|
||||||
if (version == Event::VERSION)
|
if (version == Event::VERSION)
|
||||||
{
|
{
|
||||||
string list = myOSystem.settings().getString("keymap_emu");
|
string list = myOSystem.settings().getString("keymap_emu");
|
||||||
myKeyMap.loadMapping(list, kCommonMode);
|
myKeyMap.loadMapping(list, EventMode::kCommonMode);
|
||||||
list = myOSystem.settings().getString("keymap_joy");
|
list = myOSystem.settings().getString("keymap_joy");
|
||||||
myKeyMap.loadMapping(list, kJoystickMode);
|
myKeyMap.loadMapping(list, EventMode::kJoystickMode);
|
||||||
list = myOSystem.settings().getString("keymap_pad");
|
list = myOSystem.settings().getString("keymap_pad");
|
||||||
myKeyMap.loadMapping(list, kPaddlesMode);
|
myKeyMap.loadMapping(list, EventMode::kPaddlesMode);
|
||||||
list = myOSystem.settings().getString("keymap_key");
|
list = myOSystem.settings().getString("keymap_key");
|
||||||
myKeyMap.loadMapping(list, kKeypadMode);
|
myKeyMap.loadMapping(list, EventMode::kKeypadMode);
|
||||||
list = myOSystem.settings().getString("keymap_ui");
|
list = myOSystem.settings().getString("keymap_ui");
|
||||||
myKeyMap.loadMapping(list, kMenuMode);
|
myKeyMap.loadMapping(list, EventMode::kMenuMode);
|
||||||
}
|
}
|
||||||
myKeyMap.enableMod() = myOSystem.settings().getBool("modcombo");
|
myKeyMap.enableMod() = myOSystem.settings().getBool("modcombo");
|
||||||
|
|
||||||
setDefaultMapping(Event::NoType, kEmulationMode, true);
|
setDefaultMapping(Event::NoType, EventMode::kEmulationMode, true);
|
||||||
setDefaultMapping(Event::NoType, kMenuMode, true);
|
setDefaultMapping(Event::NoType, EventMode::kMenuMode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -114,23 +114,23 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
||||||
|
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case kEmulationMode:
|
case EventMode::kEmulationMode:
|
||||||
for (const auto& item: DefaultCommonMapping)
|
for (const auto& item: DefaultCommonMapping)
|
||||||
setDefaultKey(item, event, kCommonMode, updateDefaults);
|
setDefaultKey(item, event, EventMode::kCommonMode, updateDefaults);
|
||||||
// put all controller events into their own mode's mappings
|
// put all controller events into their own mode's mappings
|
||||||
for (const auto& item: DefaultJoystickMapping)
|
for (const auto& item: DefaultJoystickMapping)
|
||||||
setDefaultKey(item, event, kJoystickMode, updateDefaults);
|
setDefaultKey(item, event, EventMode::kJoystickMode, updateDefaults);
|
||||||
for (const auto& item: DefaultPaddleMapping)
|
for (const auto& item: DefaultPaddleMapping)
|
||||||
setDefaultKey(item, event, kPaddlesMode, updateDefaults);
|
setDefaultKey(item, event, EventMode::kPaddlesMode, updateDefaults);
|
||||||
for (const auto& item: DefaultKeypadMapping)
|
for (const auto& item: DefaultKeypadMapping)
|
||||||
setDefaultKey(item, event, kKeypadMode, updateDefaults);
|
setDefaultKey(item, event, EventMode::kKeypadMode, updateDefaults);
|
||||||
for (const auto& item : CompuMateMapping)
|
for (const auto& item : CompuMateMapping)
|
||||||
setDefaultKey(item, event, kCompuMateMode, updateDefaults);
|
setDefaultKey(item, event, EventMode::kCompuMateMode, updateDefaults);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMenuMode:
|
case EventMode::kMenuMode:
|
||||||
for (const auto& item: DefaultMenuMapping)
|
for (const auto& item: DefaultMenuMapping)
|
||||||
setDefaultKey(item, event, kMenuMode, updateDefaults);
|
setDefaultKey(item, event, EventMode::kMenuMode, updateDefaults);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -145,27 +145,27 @@ void PhysicalKeyboardHandler::defineControllerMappings(const string& controllerN
|
||||||
if ((controllerName == "KEYBOARD") || (controllerName == "KEYPAD"))
|
if ((controllerName == "KEYBOARD") || (controllerName == "KEYPAD"))
|
||||||
{
|
{
|
||||||
if (port == Controller::Jack::Left)
|
if (port == Controller::Jack::Left)
|
||||||
myLeftMode = kKeypadMode;
|
myLeftMode = EventMode::kKeypadMode;
|
||||||
else
|
else
|
||||||
myRightMode = kKeypadMode;
|
myRightMode = EventMode::kKeypadMode;
|
||||||
}
|
}
|
||||||
else if (BSPF::startsWithIgnoreCase(controllerName, "PADDLES"))
|
else if (BSPF::startsWithIgnoreCase(controllerName, "PADDLES"))
|
||||||
{
|
{
|
||||||
if (port == Controller::Jack::Left)
|
if (port == Controller::Jack::Left)
|
||||||
myLeftMode = kPaddlesMode;
|
myLeftMode = EventMode::kPaddlesMode;
|
||||||
else
|
else
|
||||||
myRightMode = kPaddlesMode;
|
myRightMode = EventMode::kPaddlesMode;
|
||||||
}
|
}
|
||||||
else if (controllerName == "CM")
|
else if (controllerName == "CM")
|
||||||
{
|
{
|
||||||
myLeftMode = myRightMode = kCompuMateMode;
|
myLeftMode = myRightMode = EventMode::kCompuMateMode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (port == Controller::Jack::Left)
|
if (port == Controller::Jack::Left)
|
||||||
myLeftMode = kJoystickMode;
|
myLeftMode = EventMode::kJoystickMode;
|
||||||
else
|
else
|
||||||
myRightMode = kJoystickMode;
|
myRightMode = EventMode::kJoystickMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,46 +173,46 @@ void PhysicalKeyboardHandler::defineControllerMappings(const string& controllerN
|
||||||
void PhysicalKeyboardHandler::enableEmulationMappings()
|
void PhysicalKeyboardHandler::enableEmulationMappings()
|
||||||
{
|
{
|
||||||
// start from scratch and enable common mappings
|
// start from scratch and enable common mappings
|
||||||
myKeyMap.eraseMode(kEmulationMode);
|
myKeyMap.eraseMode(EventMode::kEmulationMode);
|
||||||
enableCommonMappings();
|
enableCommonMappings();
|
||||||
|
|
||||||
// enable right mode first, so that in case of mapping clashes the left controller has preference
|
// enable right mode first, so that in case of mapping clashes the left controller has preference
|
||||||
switch (myRightMode)
|
switch (myRightMode)
|
||||||
{
|
{
|
||||||
case kPaddlesMode:
|
case EventMode::kPaddlesMode:
|
||||||
enableMappings(RightPaddlesEvents, kPaddlesMode);
|
enableMappings(RightPaddlesEvents, EventMode::kPaddlesMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeypadMode:
|
case EventMode::kKeypadMode:
|
||||||
enableMappings(RightKeypadEvents, kKeypadMode);
|
enableMappings(RightKeypadEvents, EventMode::kKeypadMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCompuMateMode:
|
case EventMode::kCompuMateMode:
|
||||||
// see below
|
// see below
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
enableMappings(RightJoystickEvents, kJoystickMode);
|
enableMappings(RightJoystickEvents, EventMode::kJoystickMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (myLeftMode)
|
switch (myLeftMode)
|
||||||
{
|
{
|
||||||
case kPaddlesMode:
|
case EventMode::kPaddlesMode:
|
||||||
enableMappings(LeftPaddlesEvents, kPaddlesMode);
|
enableMappings(LeftPaddlesEvents, EventMode::kPaddlesMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeypadMode:
|
case EventMode::kKeypadMode:
|
||||||
enableMappings(LeftKeypadEvents, kKeypadMode);
|
enableMappings(LeftKeypadEvents, EventMode::kKeypadMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCompuMateMode:
|
case EventMode::kCompuMateMode:
|
||||||
for (const auto& item : CompuMateMapping)
|
for (const auto& item : CompuMateMapping)
|
||||||
enableMapping(item.event, kCompuMateMode);
|
enableMapping(item.event, EventMode::kCompuMateMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
enableMappings(LeftJoystickEvents, kJoystickMode);
|
enableMappings(LeftJoystickEvents, EventMode::kJoystickMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ void PhysicalKeyboardHandler::enableCommonMappings()
|
||||||
Event::Type event = static_cast<Event::Type>(i);
|
Event::Type event = static_cast<Event::Type>(i);
|
||||||
|
|
||||||
if (isCommonEvent(event))
|
if (isCommonEvent(event))
|
||||||
enableMapping(event, kCommonMode);
|
enableMapping(event, EventMode::kCommonMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,25 +243,25 @@ void PhysicalKeyboardHandler::enableMapping(const Event::Type event, EventMode m
|
||||||
KeyMap::MappingArray mappings = myKeyMap.getEventMapping(event, mode);
|
KeyMap::MappingArray mappings = myKeyMap.getEventMapping(event, mode);
|
||||||
|
|
||||||
for (const auto& mapping : mappings)
|
for (const auto& mapping : mappings)
|
||||||
myKeyMap.add(event, kEmulationMode, mapping.key, mapping.mod);
|
myKeyMap.add(event, EventMode::kEmulationMode, mapping.key, mapping.mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event, const EventMode mode) const
|
EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event, const EventMode mode) const
|
||||||
{
|
{
|
||||||
if (mode == kEmulationMode)
|
if (mode == EventMode::kEmulationMode)
|
||||||
{
|
{
|
||||||
if (isJoystickEvent(event))
|
if (isJoystickEvent(event))
|
||||||
return kJoystickMode;
|
return EventMode::kJoystickMode;
|
||||||
|
|
||||||
if (isPaddleEvent(event))
|
if (isPaddleEvent(event))
|
||||||
return kPaddlesMode;
|
return EventMode::kPaddlesMode;
|
||||||
|
|
||||||
if (isKeypadEvent(event))
|
if (isKeypadEvent(event))
|
||||||
return kKeypadMode;
|
return EventMode::kKeypadMode;
|
||||||
|
|
||||||
if (isCommonEvent(event))
|
if (isCommonEvent(event))
|
||||||
return kCommonMode;
|
return EventMode::kCommonMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
|
@ -305,11 +305,11 @@ void PhysicalKeyboardHandler::eraseMapping(Event::Type event, EventMode mode)
|
||||||
void PhysicalKeyboardHandler::saveMapping()
|
void PhysicalKeyboardHandler::saveMapping()
|
||||||
{
|
{
|
||||||
myOSystem.settings().setValue("event_ver", Event::VERSION);
|
myOSystem.settings().setValue("event_ver", Event::VERSION);
|
||||||
myOSystem.settings().setValue("keymap_emu", myKeyMap.saveMapping(kCommonMode));
|
myOSystem.settings().setValue("keymap_emu", myKeyMap.saveMapping(EventMode::kCommonMode));
|
||||||
myOSystem.settings().setValue("keymap_joy", myKeyMap.saveMapping(kJoystickMode));
|
myOSystem.settings().setValue("keymap_joy", myKeyMap.saveMapping(EventMode::kJoystickMode));
|
||||||
myOSystem.settings().setValue("keymap_pad", myKeyMap.saveMapping(kPaddlesMode));
|
myOSystem.settings().setValue("keymap_pad", myKeyMap.saveMapping(EventMode::kPaddlesMode));
|
||||||
myOSystem.settings().setValue("keymap_key", myKeyMap.saveMapping(kKeypadMode));
|
myOSystem.settings().setValue("keymap_key", myKeyMap.saveMapping(EventMode::kKeypadMode));
|
||||||
myOSystem.settings().setValue("keymap_ui", myKeyMap.saveMapping(kMenuMode));
|
myOSystem.settings().setValue("keymap_ui", myKeyMap.saveMapping(EventMode::kMenuMode));
|
||||||
enableEmulationMappings();
|
enableEmulationMappings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,10 +357,10 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
|
||||||
if ((estate == EventHandlerState::EMULATION || estate == EventHandlerState::PAUSE) &&
|
if ((estate == EventHandlerState::EMULATION || estate == EventHandlerState::PAUSE) &&
|
||||||
myOSystem.console().leftController().type() == Controller::Type::CompuMate)
|
myOSystem.console().leftController().type() == Controller::Type::CompuMate)
|
||||||
{
|
{
|
||||||
Event::Type event = myKeyMap.get(kCompuMateMode, key, mod);
|
Event::Type event = myKeyMap.get(EventMode::kCompuMateMode, key, mod);
|
||||||
|
|
||||||
// (potential) CompuMate events are handled directly.
|
// (potential) CompuMate events are handled directly.
|
||||||
if (myKeyMap.get(kEmulationMode, key, mod) != Event::ExitMode &&
|
if (myKeyMap.get(EventMode::kEmulationMode, key, mod) != Event::ExitMode &&
|
||||||
!StellaModTest::isAlt(mod) && event != Event::NoType)
|
!StellaModTest::isAlt(mod) && event != Event::NoType)
|
||||||
{
|
{
|
||||||
myHandler.handleEvent(event, pressed, repeated);
|
myHandler.handleEvent(event, pressed, repeated);
|
||||||
|
@ -370,7 +370,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
|
||||||
|
|
||||||
// Arrange the logic to take advantage of short-circuit evaluation
|
// Arrange the logic to take advantage of short-circuit evaluation
|
||||||
// Handle keys which switch eventhandler state
|
// Handle keys which switch eventhandler state
|
||||||
if (!pressed && myHandler.changeStateByEvent(myKeyMap.get(kEmulationMode, key, mod)))
|
if (!pressed && myHandler.changeStateByEvent(myKeyMap.get(EventMode::kEmulationMode, key, mod)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Otherwise, let the event handler deal with it
|
// Otherwise, let the event handler deal with it
|
||||||
|
@ -378,7 +378,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
|
||||||
{
|
{
|
||||||
case EventHandlerState::EMULATION:
|
case EventHandlerState::EMULATION:
|
||||||
case EventHandlerState::PAUSE:
|
case EventHandlerState::PAUSE:
|
||||||
myHandler.handleEvent(myKeyMap.get(kEmulationMode, key, mod), pressed, repeated);
|
myHandler.handleEvent(myKeyMap.get(EventMode::kEmulationMode, key, mod), pressed, repeated);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -386,7 +386,7 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre
|
||||||
if (myHandler.hasOverlay())
|
if (myHandler.hasOverlay())
|
||||||
myHandler.overlay().handleKeyEvent(key, mod, pressed, repeated);
|
myHandler.overlay().handleKeyEvent(key, mod, pressed, repeated);
|
||||||
#endif
|
#endif
|
||||||
myHandler.handleEvent(myKeyMap.get(kMenuMode, key, mod), pressed, repeated);
|
myHandler.handleEvent(myKeyMap.get(EventMode::kMenuMode, key, mod), pressed, repeated);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ class PhysicalKeyboardHandler
|
||||||
using EventMappingArray = std::vector<EventMapping>;
|
using EventMappingArray = std::vector<EventMapping>;
|
||||||
|
|
||||||
void setDefaultKey(EventMapping map, Event::Type event = Event::NoType,
|
void setDefaultKey(EventMapping map, Event::Type event = Event::NoType,
|
||||||
EventMode mode = kEmulationMode, bool updateDefaults = false);
|
EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false);
|
||||||
|
|
||||||
/** returns the event's controller mode */
|
/** returns the event's controller mode */
|
||||||
EventMode getEventMode(const Event::Type event, const EventMode mode) const;
|
EventMode getEventMode(const Event::Type event, const EventMode mode) const;
|
||||||
|
|
|
@ -67,11 +67,11 @@ void PhysicalJoystick::initialize(int index, const string& desc,
|
||||||
axisLastValue[a] = 0;
|
axisLastValue[a] = 0;
|
||||||
|
|
||||||
// Erase the mappings
|
// Erase the mappings
|
||||||
eraseMap(kMenuMode);
|
eraseMap(EventMode::kMenuMode);
|
||||||
eraseMap(kJoystickMode);
|
eraseMap(EventMode::kJoystickMode);
|
||||||
eraseMap(kPaddlesMode);
|
eraseMap(EventMode::kPaddlesMode);
|
||||||
eraseMap(kKeypadMode);
|
eraseMap(EventMode::kKeypadMode);
|
||||||
eraseMap(kCommonMode);
|
eraseMap(EventMode::kCommonMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -83,11 +83,11 @@ string PhysicalJoystick::getMap() const
|
||||||
ostringstream joybuf;
|
ostringstream joybuf;
|
||||||
|
|
||||||
joybuf << name;
|
joybuf << name;
|
||||||
joybuf << MODE_DELIM << int(kMenuMode) << "|" << joyMap.saveMapping(kMenuMode);
|
joybuf << MODE_DELIM << int(EventMode::kMenuMode) << "|" << joyMap.saveMapping(EventMode::kMenuMode);
|
||||||
joybuf << MODE_DELIM << int(kJoystickMode) << "|" << joyMap.saveMapping(kJoystickMode);
|
joybuf << MODE_DELIM << int(EventMode::kJoystickMode) << "|" << joyMap.saveMapping(EventMode::kJoystickMode);
|
||||||
joybuf << MODE_DELIM << int(kPaddlesMode) << "|" << joyMap.saveMapping(kPaddlesMode);
|
joybuf << MODE_DELIM << int(EventMode::kPaddlesMode) << "|" << joyMap.saveMapping(EventMode::kPaddlesMode);
|
||||||
joybuf << MODE_DELIM << int(kKeypadMode) << "|" << joyMap.saveMapping(kKeypadMode);
|
joybuf << MODE_DELIM << int(EventMode::kKeypadMode) << "|" << joyMap.saveMapping(EventMode::kKeypadMode);
|
||||||
joybuf << MODE_DELIM << int(kCommonMode) << "|" << joyMap.saveMapping(kCommonMode);
|
joybuf << MODE_DELIM << int(EventMode::kCommonMode) << "|" << joyMap.saveMapping(EventMode::kCommonMode);
|
||||||
|
|
||||||
return joybuf.str();
|
return joybuf.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle emulation keys second (can be remapped)
|
// handle emulation keys second (can be remapped)
|
||||||
Event::Type event = instance().eventHandler().eventForKey(kEmulationMode, key, mod);
|
Event::Type event = instance().eventHandler().eventForKey(EventMode::kEmulationMode, key, mod);
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
// events which can be handled 1:1
|
// events which can be handled 1:1
|
||||||
|
|
|
@ -92,8 +92,8 @@ void EventHandler::initialize()
|
||||||
// Make sure the event/action mappings are correctly set,
|
// Make sure the event/action mappings are correctly set,
|
||||||
// and fill the ActionList structure with valid values
|
// and fill the ActionList structure with valid values
|
||||||
setComboMap();
|
setComboMap();
|
||||||
setActionMappings(kEmulationMode);
|
setActionMappings(EventMode::kEmulationMode);
|
||||||
setActionMappings(kMenuMode);
|
setActionMappings(EventMode::kMenuMode);
|
||||||
|
|
||||||
Joystick::setDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
Joystick::setDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
||||||
Paddles::setDejitterBase(myOSystem.settings().getInt("dejitter.base"));
|
Paddles::setDejitterBase(myOSystem.settings().getInt("dejitter.base"));
|
||||||
|
@ -154,8 +154,8 @@ void EventHandler::addPhysicalJoystick(PhysicalJoystickPtr joy)
|
||||||
if(ID < 0)
|
if(ID < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setActionMappings(kEmulationMode);
|
setActionMappings(EventMode::kEmulationMode);
|
||||||
setActionMappings(kMenuMode);
|
setActionMappings(EventMode::kMenuMode);
|
||||||
|
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << "Added joystick " << ID << ":" << endl
|
buf << "Added joystick " << ID << ":" << endl
|
||||||
|
@ -1026,11 +1026,11 @@ void EventHandler::setActionMappings(EventMode mode)
|
||||||
|
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case kEmulationMode:
|
case EventMode::kEmulationMode:
|
||||||
listsize = EMUL_ACTIONLIST_SIZE;
|
listsize = EMUL_ACTIONLIST_SIZE;
|
||||||
list = ourEmulActionList;
|
list = ourEmulActionList;
|
||||||
break;
|
break;
|
||||||
case kMenuMode:
|
case EventMode::kMenuMode:
|
||||||
listsize = MENU_ACTIONLIST_SIZE;
|
listsize = MENU_ACTIONLIST_SIZE;
|
||||||
list = ourMenuActionList;
|
list = ourMenuActionList;
|
||||||
break;
|
break;
|
||||||
|
@ -1236,11 +1236,11 @@ StringList EventHandler::getActionList(EventMode mode) const
|
||||||
StringList l;
|
StringList l;
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case kEmulationMode:
|
case EventMode::kEmulationMode:
|
||||||
for(uInt32 i = 0; i < EMUL_ACTIONLIST_SIZE; ++i)
|
for(uInt32 i = 0; i < EMUL_ACTIONLIST_SIZE; ++i)
|
||||||
l.push_back(EventHandler::ourEmulActionList[i].action);
|
l.push_back(EventHandler::ourEmulActionList[i].action);
|
||||||
break;
|
break;
|
||||||
case kMenuMode:
|
case EventMode::kMenuMode:
|
||||||
for(uInt32 i = 0; i < MENU_ACTIONLIST_SIZE; ++i)
|
for(uInt32 i = 0; i < MENU_ACTIONLIST_SIZE; ++i)
|
||||||
l.push_back(EventHandler::ourMenuActionList[i].action);
|
l.push_back(EventHandler::ourMenuActionList[i].action);
|
||||||
break;
|
break;
|
||||||
|
@ -1324,12 +1324,12 @@ Event::Type EventHandler::eventAtIndex(int idx, EventMode mode) const
|
||||||
{
|
{
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case kEmulationMode:
|
case EventMode::kEmulationMode:
|
||||||
if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE)
|
if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE)
|
||||||
return Event::NoType;
|
return Event::NoType;
|
||||||
else
|
else
|
||||||
return ourEmulActionList[idx].event;
|
return ourEmulActionList[idx].event;
|
||||||
case kMenuMode:
|
case EventMode::kMenuMode:
|
||||||
if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE)
|
if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE)
|
||||||
return Event::NoType;
|
return Event::NoType;
|
||||||
else
|
else
|
||||||
|
@ -1344,12 +1344,12 @@ string EventHandler::actionAtIndex(int idx, EventMode mode) const
|
||||||
{
|
{
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case kEmulationMode:
|
case EventMode::kEmulationMode:
|
||||||
if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE)
|
if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE)
|
||||||
return EmptyString;
|
return EmptyString;
|
||||||
else
|
else
|
||||||
return ourEmulActionList[idx].action;
|
return ourEmulActionList[idx].action;
|
||||||
case kMenuMode:
|
case EventMode::kMenuMode:
|
||||||
if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE)
|
if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE)
|
||||||
return EmptyString;
|
return EmptyString;
|
||||||
else
|
else
|
||||||
|
@ -1364,12 +1364,12 @@ string EventHandler::keyAtIndex(int idx, EventMode mode) const
|
||||||
{
|
{
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case kEmulationMode:
|
case EventMode::kEmulationMode:
|
||||||
if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE)
|
if(idx < 0 || idx >= EMUL_ACTIONLIST_SIZE)
|
||||||
return EmptyString;
|
return EmptyString;
|
||||||
else
|
else
|
||||||
return ourEmulActionList[idx].key;
|
return ourEmulActionList[idx].key;
|
||||||
case kMenuMode:
|
case EventMode::kMenuMode:
|
||||||
if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE)
|
if(idx < 0 || idx >= MENU_ACTIONLIST_SIZE)
|
||||||
return EmptyString;
|
return EmptyString;
|
||||||
else
|
else
|
||||||
|
|
|
@ -72,12 +72,8 @@ enum JoyHatMask {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int NUM_PORTS = 2;
|
static const int NUM_PORTS = 2;
|
||||||
static const int NUM_JOY_AXIS = 2;
|
|
||||||
static const int NUM_JOY_DIRS = 2;
|
|
||||||
static const int NUM_JOY_HAT_DIRS = 4;
|
|
||||||
|
|
||||||
// TODO - make this 'enum class' somehow
|
enum class EventMode {
|
||||||
enum EventMode {
|
|
||||||
kEmulationMode, // active mapping used for emulation
|
kEmulationMode, // active mapping used for emulation
|
||||||
kMenuMode, // mapping used for dialogs
|
kMenuMode, // mapping used for dialogs
|
||||||
kJoystickMode, // 4 extra modes for mapping controller keys separately for emulation mode
|
kJoystickMode, // 4 extra modes for mapping controller keys separately for emulation mode
|
||||||
|
|
|
@ -282,26 +282,26 @@ void ContextMenu::handleMouseWheel(int x, int y, int direction)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
{
|
{
|
||||||
handleEvent(instance().eventHandler().eventForKey(kMenuMode, key, mod));
|
handleEvent(instance().eventHandler().eventForKey(EventMode::kMenuMode, key, mod));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ContextMenu::handleJoyDown(int stick, int button, bool longPress)
|
void ContextMenu::handleJoyDown(int stick, int button, bool longPress)
|
||||||
{
|
{
|
||||||
handleEvent(instance().eventHandler().eventForJoyButton(kMenuMode, stick, button));
|
handleEvent(instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ContextMenu::handleJoyAxis(int stick, int axis, int value, int button)
|
void ContextMenu::handleJoyAxis(int stick, int axis, int value, int button)
|
||||||
{
|
{
|
||||||
if(value != 0) // we don't care about 'axis up' events
|
if(value != 0) // we don't care about 'axis up' events
|
||||||
handleEvent(instance().eventHandler().eventForJoyAxis(kMenuMode, stick, axis, value, button));
|
handleEvent(instance().eventHandler().eventForJoyAxis(EventMode::kMenuMode, stick, axis, value, button));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool ContextMenu::handleJoyHat(int stick, int hat, JoyHat value, int button)
|
bool ContextMenu::handleJoyHat(int stick, int hat, JoyHat value, int button)
|
||||||
{
|
{
|
||||||
handleEvent(instance().eventHandler().eventForJoyHat(kMenuMode, stick, hat, value, button));
|
handleEvent(instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, value, button));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -459,7 +459,7 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
// Check the keytable now, since we might get one of the above events,
|
// Check the keytable now, since we might get one of the above events,
|
||||||
// which must always be processed before any widget sees it.
|
// which must always be processed before any widget sees it.
|
||||||
if(e == Event::NoType)
|
if(e == Event::NoType)
|
||||||
e = instance().eventHandler().eventForKey(kMenuMode, key, mod);
|
e = instance().eventHandler().eventForKey(EventMode::kMenuMode, key, mod);
|
||||||
|
|
||||||
// Unless a widget has claimed all responsibility for data, we assume
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
// that if an event exists for the given data, it should have priority.
|
// that if an event exists for the given data, it should have priority.
|
||||||
|
@ -591,7 +591,7 @@ bool Dialog::handleMouseClicks(int x, int y, MouseButton b)
|
||||||
void Dialog::handleJoyDown(int stick, int button, bool longPress)
|
void Dialog::handleJoyDown(int stick, int button, bool longPress)
|
||||||
{
|
{
|
||||||
Event::Type e =
|
Event::Type e =
|
||||||
instance().eventHandler().eventForJoyButton(kMenuMode, stick, button);
|
instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button);
|
||||||
|
|
||||||
// Unless a widget has claimed all responsibility for data, we assume
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
// that if an event exists for the given data, it should have priority.
|
// that if an event exists for the given data, it should have priority.
|
||||||
|
@ -615,7 +615,7 @@ void Dialog::handleJoyUp(int stick, int button)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Event::Type Dialog::getJoyAxisEvent(int stick, int axis, int value, int button)
|
Event::Type Dialog::getJoyAxisEvent(int stick, int axis, int value, int button)
|
||||||
{
|
{
|
||||||
return instance().eventHandler().eventForJoyAxis(kMenuMode, stick, axis, value, button);
|
return instance().eventHandler().eventForJoyAxis(EventMode::kMenuMode, stick, axis, value, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -638,7 +638,7 @@ void Dialog::handleJoyAxis(int stick, int axis, int value, int button)
|
||||||
bool Dialog::handleJoyHat(int stick, int hat, JoyHat value, int button)
|
bool Dialog::handleJoyHat(int stick, int hat, JoyHat value, int button)
|
||||||
{
|
{
|
||||||
Event::Type e =
|
Event::Type e =
|
||||||
instance().eventHandler().eventForJoyHat(kMenuMode, stick, hat, value, button);
|
instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, value, button);
|
||||||
|
|
||||||
// Unless a widget has claimed all responsibility for data, we assume
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
// that if an event exists for the given data, it should have priority.
|
// that if an event exists for the given data, it should have priority.
|
||||||
|
|
|
@ -96,7 +96,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
myResetButton->setTarget(this);
|
myResetButton->setTarget(this);
|
||||||
addFocusWidget(myResetButton);
|
addFocusWidget(myResetButton);
|
||||||
|
|
||||||
if(mode == kEmulationMode)
|
if(mode == EventMode::kEmulationMode)
|
||||||
{
|
{
|
||||||
ypos += lineHeight + 20;
|
ypos += lineHeight + 20;
|
||||||
myComboButton = new ButtonWidget(boss, font, xpos, ypos,
|
myComboButton = new ButtonWidget(boss, font, xpos, ypos,
|
||||||
|
|
|
@ -93,7 +93,7 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
|
||||||
};
|
};
|
||||||
auto ADD_EVENT = [&](const Event::Type e, const string & d)
|
auto ADD_EVENT = [&](const Event::Type e, const string & d)
|
||||||
{
|
{
|
||||||
string desc = instance().eventHandler().getMappingDesc(e, kEmulationMode);
|
string desc = instance().eventHandler().getMappingDesc(e, EventMode::kEmulationMode);
|
||||||
ADD_BIND(desc.length() ? desc : "None", d);
|
ADD_BIND(desc.length() ? desc : "None", d);
|
||||||
};
|
};
|
||||||
auto ADD_TEXT = [&](const string& d) { ADD_BIND("", d); };
|
auto ADD_TEXT = [&](const string& d) { ADD_BIND("", d); };
|
||||||
|
|
|
@ -60,21 +60,21 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
|
|
||||||
// 1) Event mapper for emulation actions
|
// 1) Event mapper for emulation actions
|
||||||
tabID = myTab->addTab(" Emulation Events ", TabWidget::AUTO_WIDTH);
|
tabID = myTab->addTab(" Emulation Events ", TabWidget::AUTO_WIDTH);
|
||||||
actions = instance().eventHandler().getActionList(kEmulationMode);
|
actions = instance().eventHandler().getActionList(EventMode::kEmulationMode);
|
||||||
myEmulEventMapper = new EventMappingWidget(myTab, font, 2, 2,
|
myEmulEventMapper = new EventMappingWidget(myTab, font, 2, 2,
|
||||||
myTab->getWidth(),
|
myTab->getWidth(),
|
||||||
myTab->getHeight() - 4,
|
myTab->getHeight() - 4,
|
||||||
actions, kEmulationMode);
|
actions, EventMode::kEmulationMode);
|
||||||
myTab->setParentWidget(tabID, myEmulEventMapper);
|
myTab->setParentWidget(tabID, myEmulEventMapper);
|
||||||
addToFocusList(myEmulEventMapper->getFocusList(), myTab, tabID);
|
addToFocusList(myEmulEventMapper->getFocusList(), myTab, tabID);
|
||||||
|
|
||||||
// 2) Event mapper for UI actions
|
// 2) Event mapper for UI actions
|
||||||
tabID = myTab->addTab(" UI Events ", TabWidget::AUTO_WIDTH);
|
tabID = myTab->addTab(" UI Events ", TabWidget::AUTO_WIDTH);
|
||||||
actions = instance().eventHandler().getActionList(kMenuMode);
|
actions = instance().eventHandler().getActionList(EventMode::kMenuMode);
|
||||||
myMenuEventMapper = new EventMappingWidget(myTab, font, 2, 2,
|
myMenuEventMapper = new EventMappingWidget(myTab, font, 2, 2,
|
||||||
myTab->getWidth(),
|
myTab->getWidth(),
|
||||||
myTab->getHeight() - 4,
|
myTab->getHeight() - 4,
|
||||||
actions, kMenuMode);
|
actions, EventMode::kMenuMode);
|
||||||
myTab->setParentWidget(tabID, myMenuEventMapper);
|
myTab->setParentWidget(tabID, myMenuEventMapper);
|
||||||
addToFocusList(myMenuEventMapper->getFocusList(), myTab, tabID);
|
addToFocusList(myMenuEventMapper->getFocusList(), myTab, tabID);
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
void LauncherDialog::handleJoyDown(int stick, int button, bool longPress)
|
void LauncherDialog::handleJoyDown(int stick, int button, bool longPress)
|
||||||
{
|
{
|
||||||
// open power-up options and settings for 2nd and 4th button if not mapped otherwise
|
// open power-up options and settings for 2nd and 4th button if not mapped otherwise
|
||||||
Event::Type e = instance().eventHandler().eventForJoyButton(kMenuMode, stick, button);
|
Event::Type e = instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button);
|
||||||
|
|
||||||
if (button == 1 && (e == Event::UIOK || e == Event::NoType))
|
if (button == 1 && (e == Event::UIOK || e == Event::NoType))
|
||||||
myGlobalProps->open();
|
myGlobalProps->open();
|
||||||
|
@ -495,7 +495,7 @@ void LauncherDialog::handleJoyUp(int stick, int button)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Event::Type LauncherDialog::getJoyAxisEvent(int stick, int axis, int value, int button)
|
Event::Type LauncherDialog::getJoyAxisEvent(int stick, int axis, int value, int button)
|
||||||
{
|
{
|
||||||
Event::Type e = instance().eventHandler().eventForJoyAxis(kMenuMode, stick, axis, value, button);
|
Event::Type e = instance().eventHandler().eventForJoyAxis(EventMode::kMenuMode, stick, axis, value, button);
|
||||||
|
|
||||||
if(myUseMinimalUI)
|
if(myUseMinimalUI)
|
||||||
{
|
{
|
||||||
|
|
|
@ -330,7 +330,7 @@ void ListWidget::handleJoyDown(int stick, int button, bool longPress)
|
||||||
if (longPress)
|
if (longPress)
|
||||||
sendCommand(ListWidget::kLongButtonPressCmd, _selectedItem, _id);
|
sendCommand(ListWidget::kLongButtonPressCmd, _selectedItem, _id);
|
||||||
|
|
||||||
Event::Type e = _boss->instance().eventHandler().eventForJoyButton(kMenuMode, stick, button);
|
Event::Type e = _boss->instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button);
|
||||||
|
|
||||||
// handle UISelect event on button up
|
// handle UISelect event on button up
|
||||||
if(e != Event::UISelect)
|
if(e != Event::UISelect)
|
||||||
|
@ -340,7 +340,7 @@ void ListWidget::handleJoyDown(int stick, int button, bool longPress)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ListWidget::handleJoyUp(int stick, int button)
|
void ListWidget::handleJoyUp(int stick, int button)
|
||||||
{
|
{
|
||||||
Event::Type e = _boss->instance().eventHandler().eventForJoyButton(kMenuMode, stick, button);
|
Event::Type e = _boss->instance().eventHandler().eventForJoyButton(EventMode::kMenuMode, stick, button);
|
||||||
|
|
||||||
// handle UISelect event on button up
|
// handle UISelect event on button up
|
||||||
if(e == Event::UISelect)
|
if(e == Event::UISelect)
|
||||||
|
|
Loading…
Reference in New Issue