Driving mode enhancements (#860)

The driving controller is closer to a paddle controller than a
joystick, but doesn't have hard stops.

This patch adds:
- A dedicated set of event bindings for driving.
- The option to use an analogue steering input from a regular joystick
  axis, and a separate higher resolution counter to assist with this.
This commit is contained in:
eds-collabora 2022-01-19 14:23:14 +00:00 committed by GitHub
parent 4fce2156df
commit db8ae212ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 195 additions and 26 deletions

View File

@ -384,6 +384,8 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even
setDefaultAction(stick, item, event, EventMode::kPaddlesMode, updateDefaults);
for (const auto& item : DefaultLeftKeyboardMapping)
setDefaultAction(stick, item, event, EventMode::kKeyboardMode, updateDefaults);
for (const auto& item : DefaultLeftDrivingMapping)
setDefaultAction(stick, item, event, EventMode::kDrivingMode, updateDefaults);
}
else
{
@ -394,6 +396,8 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even
setDefaultAction(stick, item, event, EventMode::kPaddlesMode, updateDefaults);
for (const auto& item : DefaultRightKeyboardMapping)
setDefaultAction(stick, item, event, EventMode::kKeyboardMode, updateDefaults);
for (const auto& item : DefaultRightDrivingMapping)
setDefaultAction(stick, item, event, EventMode::kDrivingMode, updateDefaults);
}
for(const auto& item : DefaultCommonMapping)
setDefaultAction(stick, item, event, EventMode::kCommonMode, updateDefaults);
@ -448,6 +452,13 @@ void PhysicalJoystickHandler::defineControllerMappings(const Controller::Type ty
myLeftMode = myRightMode = EventMode::kCompuMateMode;
break;
case Controller::Type::Driving:
if(port == Controller::Jack::Left)
myLeftMode = EventMode::kDrivingMode;
else
myRightMode = EventMode::kDrivingMode;
break;
default:
// let's use joystick then
if(port == Controller::Jack::Left)
@ -481,6 +492,10 @@ void PhysicalJoystickHandler::enableEmulationMappings()
enableMappings(RightKeyboardEvents, EventMode::kKeyboardMode);
break;
case EventMode::kDrivingMode:
enableMappings(RightDrivingEvents, EventMode::kDrivingMode);
break;
default:
enableMappings(RightJoystickEvents, EventMode::kJoystickMode);
break;
@ -496,6 +511,10 @@ void PhysicalJoystickHandler::enableEmulationMappings()
enableMappings(LeftKeyboardEvents, EventMode::kKeyboardMode);
break;
case EventMode::kDrivingMode:
enableMappings(LeftDrivingEvents, EventMode::kDrivingMode);
break;
default:
enableMappings(LeftJoystickEvents, EventMode::kJoystickMode);
break;
@ -551,6 +570,9 @@ EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event, const E
if(isKeyboardEvent(event))
return EventMode::kKeyboardMode;
if(isDrivingEvent(event))
return EventMode::kDrivingMode;
if(isCommonEvent(event))
return EventMode::kCommonMode;
}
@ -579,10 +601,17 @@ bool PhysicalJoystickHandler::isKeyboardEvent(const Event::Type event) const
|| RightKeyboardEvents.find(event) != RightKeyboardEvents.end();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::isDrivingEvent(const Event::Type event) const
{
return LeftDrivingEvents.find(event) != LeftDrivingEvents.end()
|| RightDrivingEvents.find(event) != RightDrivingEvents.end();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::isCommonEvent(const Event::Type event) const
{
return !(isJoystickEvent(event) || isPaddleEvent(event) || isKeyboardEvent(event));
return !(isJoystickEvent(event) || isPaddleEvent(event) || isKeyboardEvent(event) || isDrivingEvent(event));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -600,6 +629,7 @@ void PhysicalJoystickHandler::eraseMapping(Event::Type event, EventMode mode)
_joyptr->eraseMap(EventMode::kCommonMode);
_joyptr->eraseMap(EventMode::kJoystickMode);
_joyptr->eraseMap(EventMode::kPaddlesMode);
_joyptr->eraseMap(EventMode::kDrivingMode);
_joyptr->eraseMap(EventMode::kKeyboardMode);
}
}
@ -678,6 +708,7 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i
j->joyMap.erase(EventMode::kPaddlesMode, button, axis, adir);
//j->joyMap.erase(EventMode::kKeyboardMode, button, axis, adir); // no common buttons in keyboard mode!
j->joyMap.erase(EventMode::kCompuMateMode, button, axis, adir);
j->joyMap.erase(EventMode::kDrivingMode, button, axis, adir);
}
else if (evMode != EventMode::kMenuMode)
{
@ -712,6 +743,7 @@ bool PhysicalJoystickHandler::addJoyHatMapping(Event::Type event, EventMode mode
j->joyMap.erase(EventMode::kJoystickMode, button, hat, hdir);
j->joyMap.erase(EventMode::kPaddlesMode, button, hat, hdir);
j->joyMap.erase(EventMode::kKeyboardMode, button, hat, hdir);
j->joyMap.erase(EventMode::kDrivingMode, button, hat, hdir);
j->joyMap.erase(EventMode::kCompuMateMode, button, hat, hdir);
}
else if (evMode != EventMode::kMenuMode)
@ -1233,6 +1265,28 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultRight
{Event::RightKeyboardPound, 11},
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultLeftDrivingMapping = {
// Left joystick (assume buttons zero..two)
{Event::LeftDrivingFire, 0},
// Left joystick left/right directions
{Event::LeftDrivingAnalog, JOY_CTRL_NONE, JoyAxis::X, JoyDir::ANALOG},
// Left joystick left/right directions (assume hat 0)
{Event::LeftDrivingCCW, JOY_CTRL_NONE, JoyAxis::NONE, JoyDir::NONE, 0, JoyHatDir::LEFT},
{Event::LeftDrivingCW, JOY_CTRL_NONE, JoyAxis::NONE, JoyDir::NONE, 0, JoyHatDir::RIGHT},
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultRightDrivingMapping = {
// Right joystick (assume buttons zero..two)
{Event::RightDrivingFire, 0},
// Right joystick left/right directions
{Event::RightDrivingAnalog, JOY_CTRL_NONE, JoyAxis::X, JoyDir::ANALOG},
// Right joystick left/right directions (assume hat 0)
{Event::RightDrivingCCW, JOY_CTRL_NONE, JoyAxis::NONE, JoyDir::NONE, 0, JoyHatDir::LEFT},
{Event::RightDrivingCW, JOY_CTRL_NONE, JoyAxis::NONE, JoyDir::NONE, 0, JoyHatDir::RIGHT},
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystickHandler::EventMappingArray
PhysicalJoystickHandler::DefaultCommonMapping = {

View File

@ -181,6 +181,7 @@ class PhysicalJoystickHandler
bool isJoystickEvent(const Event::Type event) const;
bool isPaddleEvent(const Event::Type event) const;
bool isKeyboardEvent(const Event::Type event) const;
bool isDrivingEvent(const Event::Type event) const;
bool isCommonEvent(const Event::Type event) const;
void enableCommonMappings();
@ -202,6 +203,8 @@ class PhysicalJoystickHandler
static EventMappingArray DefaultRightPaddlesMapping;
static EventMappingArray DefaultLeftKeyboardMapping;
static EventMappingArray DefaultRightKeyboardMapping;
static EventMappingArray DefaultLeftDrivingMapping;
static EventMappingArray DefaultRightDrivingMapping;
static constexpr int NUM_PORTS = 2;
static constexpr int NUM_SA_AXIS = 2;

View File

@ -53,6 +53,7 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler&
loadSerializedMappings(myOSystem.settings().getString("keymap_emu"), EventMode::kCommonMode);
loadSerializedMappings(myOSystem.settings().getString("keymap_joy"), EventMode::kJoystickMode);
loadSerializedMappings(myOSystem.settings().getString("keymap_pad"), EventMode::kPaddlesMode);
loadSerializedMappings(myOSystem.settings().getString("keymap_drv"), EventMode::kDrivingMode);
loadSerializedMappings(myOSystem.settings().getString("keymap_key"), EventMode::kKeyboardMode);
loadSerializedMappings(myOSystem.settings().getString("keymap_ui"), EventMode::kMenuMode);
@ -113,6 +114,7 @@ bool PhysicalKeyboardHandler::isMappingUsed(EventMode mode, const EventMapping&
|| myKeyMap.check(EventMode::kJoystickMode, map.key, map.mod)
|| myKeyMap.check(EventMode::kPaddlesMode, map.key, map.mod)
|| myKeyMap.check(EventMode::kKeyboardMode, map.key, map.mod)
|| myKeyMap.check(EventMode::kDrivingMode, map.key, map.mod)
|| myKeyMap.check(EventMode::kCompuMateMode, map.key, map.mod);
}
@ -182,6 +184,8 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
setDefaultKey(item, event, EventMode::kPaddlesMode, updateDefaults);
for (const auto& item: DefaultKeyboardMapping)
setDefaultKey(item, event, EventMode::kKeyboardMode, updateDefaults);
for (const auto& item: DefaultDrivingMapping )
setDefaultKey(item, event, EventMode::kDrivingMode, updateDefaults);
for (const auto& item : CompuMateMapping)
setDefaultKey(item, event, EventMode::kCompuMateMode, updateDefaults);
break;
@ -274,6 +278,9 @@ EventMode PhysicalKeyboardHandler::getMode(const Controller::Type type)
case Controller::Type::CompuMate:
return EventMode::kCompuMateMode;
case Controller::Type::Driving:
return EventMode::kDrivingMode;
default:
// let's use joystick then
return EventMode::kJoystickMode;
@ -331,6 +338,10 @@ void PhysicalKeyboardHandler::enableEmulationMappings()
// see below
break;
case EventMode::kDrivingMode:
enableMappings(RightDrivingEvents, EventMode::kDrivingMode);
break;
default:
enableMappings(RightJoystickEvents, EventMode::kJoystickMode);
break;
@ -351,6 +362,10 @@ void PhysicalKeyboardHandler::enableEmulationMappings()
enableMapping(item.event, EventMode::kCompuMateMode);
break;
case EventMode::kDrivingMode:
enableMappings(LeftDrivingEvents, EventMode::kDrivingMode);
break;
default:
enableMappings(LeftJoystickEvents, EventMode::kJoystickMode);
break;
@ -403,6 +418,9 @@ EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event,
if (isKeyboardEvent(event))
return EventMode::kKeyboardMode;
if (isDrivingEvent(event))
return EventMode::kDrivingMode;
if (isCommonEvent(event))
return EventMode::kCommonMode;
}
@ -428,6 +446,13 @@ bool PhysicalKeyboardHandler::isPaddleEvent(const Event::Type event) const
|| QTPaddles4Events.find(event) != QTPaddles4Events.end();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::isDrivingEvent(const Event::Type event) const
{
return LeftDrivingEvents.find(event) != LeftDrivingEvents.end()
|| RightDrivingEvents.find(event) != RightDrivingEvents.end();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::isKeyboardEvent(const Event::Type event) const
{
@ -455,6 +480,7 @@ void PhysicalKeyboardHandler::saveMapping()
myOSystem.settings().setValue("keymap_emu", myKeyMap.saveMapping(EventMode::kCommonMode).dump(2));
myOSystem.settings().setValue("keymap_joy", myKeyMap.saveMapping(EventMode::kJoystickMode).dump(2));
myOSystem.settings().setValue("keymap_pad", myKeyMap.saveMapping(EventMode::kPaddlesMode).dump(2));
myOSystem.settings().setValue("keymap_drv", myKeyMap.saveMapping(EventMode::kDrivingMode).dump(2));
myOSystem.settings().setValue("keymap_key", myKeyMap.saveMapping(EventMode::kKeyboardMode).dump(2));
myOSystem.settings().setValue("keymap_ui", myKeyMap.saveMapping(EventMode::kMenuMode).dump(2));
enableEmulationMappings();
@ -1044,6 +1070,21 @@ PhysicalKeyboardHandler::DefaultKeyboardMapping = {
{Event::RightKeyboardPound, KBDK_SLASH},
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultDrivingMapping = {
{Event::LeftDrivingCCW, KBDK_LEFT},
{Event::LeftDrivingCW, KBDK_RIGHT},
{Event::LeftDrivingCCW, KBDK_KP_4},
{Event::LeftDrivingCW, KBDK_KP_6},
{Event::LeftDrivingFire, KBDK_SPACE},
{Event::LeftDrivingFire, KBDK_LCTRL},
{Event::LeftDrivingFire, KBDK_KP_5},
{Event::RightDrivingCCW, KBDK_G},
{Event::RightDrivingCW, KBDK_J},
{Event::RightDrivingFire, KBDK_F},
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalKeyboardHandler::EventMappingArray
PhysicalKeyboardHandler::CompuMateMapping = {

View File

@ -105,6 +105,7 @@ class PhysicalKeyboardHandler
bool isJoystickEvent(const Event::Type event) const;
bool isPaddleEvent(const Event::Type event) const;
bool isKeyboardEvent(const Event::Type event) const;
bool isDrivingEvent(const Event::Type event) const;
bool isCommonEvent(const Event::Type event) const;
void enableCommonMappings();
@ -158,6 +159,7 @@ class PhysicalKeyboardHandler
static EventMappingArray DefaultJoystickMapping;
static EventMappingArray DefaultPaddleMapping;
static EventMappingArray DefaultKeyboardMapping;
static EventMappingArray DefaultDrivingMapping;
static EventMappingArray CompuMateMapping;
};

View File

@ -59,6 +59,7 @@ void PhysicalJoystick::initialize(int index, const string& desc,
eraseMap(EventMode::kJoystickMode);
eraseMap(EventMode::kPaddlesMode);
eraseMap(EventMode::kKeyboardMode);
eraseMap(EventMode::kDrivingMode);
eraseMap(EventMode::kCommonMode);
}
@ -70,7 +71,8 @@ json PhysicalJoystick::getMap() const
mapping["name"] = name;
for (auto& mode: {
EventMode::kMenuMode, EventMode::kJoystickMode, EventMode::kPaddlesMode, EventMode::kKeyboardMode, EventMode::kCommonMode
EventMode::kMenuMode, EventMode::kJoystickMode, EventMode::kPaddlesMode, EventMode::kKeyboardMode,
EventMode::kDrivingMode, EventMode::kCommonMode
})
mapping[jsonName(mode)] = joyMap.saveMapping(mode);
@ -94,7 +96,7 @@ bool PhysicalJoystick::setMap(const json& map)
i++;
}
if(i != 5)
if(i != 6)
{
Logger::error("invalid controller mappings found for " +
((map.contains("name") && map.at("name").is_string()) ? ("stick " + map["name"].get<string>()) : "unknown stick")

View File

@ -56,6 +56,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(EventMode, {
{EventMode::kJoystickMode, "kJoystickMode"},
{EventMode::kPaddlesMode, "kPaddlesMode"},
{EventMode::kKeyboardMode, "kKeyboardMode"},
{EventMode::kDrivingMode, "kDrivingMode"},
{EventMode::kCompuMateMode, "kCompuMateMode"},
{EventMode::kCommonMode, "kCommonMode"},
{EventMode::kNumModes, "kNumModes"},
@ -145,6 +146,14 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::RightKeyboardStar, "RightKeyboardStar"},
{Event::RightKeyboard0, "RightKeyboard0"},
{Event::RightKeyboardPound, "RightKeyboardPound"},
{Event::LeftDrivingCCW, "LeftDrivingCCW"},
{Event::LeftDrivingCW, "LeftDrivingCW"},
{Event::LeftDrivingFire, "LeftDrivingFire"},
{Event::LeftDrivingAnalog, "LeftDrivingAnalog"},
{Event::RightDrivingCCW, "RightDrivingCCW"},
{Event::RightDrivingCW, "RightDrivingCW"},
{Event::RightDrivingFire, "RightDrivingFire"},
{Event::RightDrivingAnalog, "RightDrivingAnalog"},
{Event::CompuMateFunc, "CompuMateFunc"},
{Event::CompuMateShift, "CompuMateShift"},
{Event::CompuMate0, "CompuMate0"},

View File

@ -25,9 +25,10 @@ Driving::Driving(Jack jack, const Event& event, const System& system, bool altma
{
if(!altmap)
{
myCCWEvent = Event::LeftJoystickLeft;
myCWEvent = Event::LeftJoystickRight;
myFireEvent = Event::LeftJoystickFire;
myCCWEvent = Event::LeftDrivingCCW;
myCWEvent = Event::LeftDrivingCW;
myFireEvent = Event::LeftDrivingFire;
myAnalogEvent = Event::LeftDrivingAnalog;
}
else
{
@ -42,9 +43,10 @@ Driving::Driving(Jack jack, const Event& event, const System& system, bool altma
{
if(!altmap)
{
myCCWEvent = Event::RightJoystickLeft;
myCWEvent = Event::RightJoystickRight;
myFireEvent = Event::RightJoystickFire;
myCCWEvent = Event::RightDrivingCCW;
myCWEvent = Event::RightDrivingCW;
myFireEvent = Event::RightDrivingFire;
myAnalogEvent = Event::RightDrivingAnalog;
}
else
{
@ -66,7 +68,7 @@ void Driving::update()
{
updateButtons();
updateDigitalAxes();
updateControllerAxes();
updateMouseAxes();
updateStelladaptorAxes();
@ -108,18 +110,29 @@ void Driving::updateMouseButtons(bool& firePressed)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Driving::updateDigitalAxes()
void Driving::updateControllerAxes()
{
// Digital events (from keyboard or joystick hats & buttons)
int d_axis = myEvent.get(myXAxisValue);
if(myEvent.get(myCCWEvent) != 0 || d_axis < -16384)
--myCounter;
myCounterHires -= 64;
else if(myEvent.get(myCWEvent) != 0 || d_axis > 16384)
++myCounter;
myCounterHires += 64;
// Analog events (from joystick axes)
int a_axis = myEvent.get(myAnalogEvent);
if( abs(a_axis) > Controller::analogDeadZone()) {
/* a_axis is in -2^15 to +2^15-1; dividing by 2^9 gives us -2^6 to
+2^6-1, which gives us roughly the same range as digital
inputs.
*/
myCounterHires += a_axis/512;
}
// Only consider the lower-most bits (corresponding to pins 1 & 2)
myGrayIndex = Int32(myCounter * SENSITIVITY / 4.0F) & 0b11;
myGrayIndex = Int32((myCounterHires / 256) * SENSITIVITY) & 0b11;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -94,6 +94,9 @@ class Driving : public Controller
// Counter to iterate through the gray codes
Int32 myCounter{0};
// Higher resolution counter for analog (non-Stelladaptor) inputs
uInt32 myCounterHires{0};
// Index into the gray code table
uInt32 myGrayIndex{0};
@ -103,7 +106,7 @@ class Driving : public Controller
// Pre-compute the events we care about based on given port
// This will eliminate test for left or right port in update()
Event::Type myCWEvent, myCCWEvent, myFireEvent,
Event::Type myCWEvent, myCCWEvent, myFireEvent, myAnalogEvent,
myXAxisValue, myYAxisValue;
// Controller to emulate in normal mouse axis mode
@ -129,9 +132,9 @@ class Driving : public Controller
/**
Update the axes pin states according to the keyboard
or joystick hats & buttons events currently set.
or joystick events currently set.
*/
void updateDigitalAxes();
void updateControllerAxes();
/**
Update the axes pin states according to the Stelladaptor axes value

View File

@ -62,6 +62,9 @@ class Event
RightKeyboard7, RightKeyboard8, RightKeyboard9,
RightKeyboardStar, RightKeyboard0, RightKeyboardPound,
LeftDrivingCCW, LeftDrivingCW, LeftDrivingFire, LeftDrivingAnalog,
RightDrivingCCW, RightDrivingCW, RightDrivingFire, RightDrivingAnalog,
CompuMateFunc, CompuMateShift,
CompuMate0, CompuMate1, CompuMate2, CompuMate3, CompuMate4,
CompuMate5, CompuMate6, CompuMate7, CompuMate8, CompuMate9,
@ -180,7 +183,7 @@ class Event
enum Group
{
Menu, Emulation,
Misc, AudioVideo, States, Console, Joystick, Paddles, Keyboard,
Misc, AudioVideo, States, Console, Joystick, Paddles, Keyboard, Driving,
Devices,
Debug, Combo,
LastGroup
@ -237,6 +240,8 @@ class Event
case Event::LeftPaddleBAnalog:
case Event::RightPaddleAAnalog:
case Event::RightPaddleBAnalog:
case Event::LeftDrivingAnalog:
case Event::RightDrivingAnalog:
return true;
default:
return false;
@ -318,4 +323,16 @@ static const Event::EventSet RightKeyboardEvents = {
Event::RightKeyboardStar, Event::RightKeyboard0, Event::RightKeyboardPound,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static const Event::EventSet LeftDrivingEvents = {
Event::LeftDrivingAnalog, Event::LeftDrivingCCW,
Event::LeftDrivingCW, Event::LeftDrivingFire,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static const Event::EventSet RightDrivingEvents = {
Event::RightDrivingAnalog, Event::RightDrivingCCW,
Event::RightDrivingCW, Event::RightDrivingFire,
};
#endif

View File

@ -2214,6 +2214,9 @@ StringList EventHandler::getActionList(Event::Group group) const
case Event::Group::Keyboard:
return getActionList(KeyboardEvents);
case Event::Group::Driving:
return getActionList(DrivingEvents);
case Event::Group::Devices:
return getActionList(DevicesEvents);
@ -2386,6 +2389,9 @@ int EventHandler::getActionListIndex(int idx, Event::Group group) const
case Event::Group::Keyboard:
return getEmulActionListIndex(idx, KeyboardEvents);
case Event::Group::Driving:
return getEmulActionListIndex(idx, DrivingEvents);
case Event::Group::Devices:
return getEmulActionListIndex(idx, DevicesEvents);
@ -2883,6 +2889,16 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::RightKeyboard0, "Right Keyboard 0", "" },
{ Event::RightKeyboardPound, "Right Keyboard #", "" },
{ Event::LeftDrivingAnalog, "Left Driving Analog", "" },
{ Event::LeftDrivingCCW, "Left Driving Turn Left", "" },
{ Event::LeftDrivingCW, "Left Driving Turn Right", "" },
{ Event::LeftDrivingFire, "Left Driving Fire", "" },
{ Event::RightDrivingAnalog, "Right Driving Analog", "" },
{ Event::RightDrivingCCW, "Right Driving Turn Left", "" },
{ Event::RightDrivingCW, "Right Driving Turn Right", "" },
{ Event::RightDrivingFire, "Right Driving Fire", "" },
// Video
{ Event::ToggleInter, "Toggle display interpolation", "" },
{ Event::VidmodeDecrease, "Previous zoom level", "" },
@ -3154,6 +3170,12 @@ const Event::EventSet EventHandler::KeyboardEvents = {
Event::RightKeyboardStar, Event::RightKeyboard0, Event::RightKeyboardPound,
};
const Event::EventSet EventHandler::DrivingEvents = {
Event::LeftDrivingAnalog, Event::LeftDrivingCCW, Event::LeftDrivingCW,
Event::LeftDrivingFire, Event::RightDrivingAnalog, Event::RightDrivingCCW,
Event::RightDrivingCW, Event::RightDrivingFire,
};
const Event::EventSet EventHandler::DevicesEvents = {
Event::DecreaseDeadzone, Event::IncreaseDeadzone,
Event::DecAnalogDeadzone, Event::IncAnalogDeadzone,

View File

@ -445,6 +445,7 @@ class EventHandler
static const Event::EventSet JoystickEvents;
static const Event::EventSet PaddlesEvents;
static const Event::EventSet KeyboardEvents;
static const Event::EventSet DrivingEvents;
static const Event::EventSet DevicesEvents;
static const Event::EventSet ComboEvents;
static const Event::EventSet DebugEvents;
@ -523,7 +524,7 @@ class EventHandler
#else
REFRESH_SIZE = 0,
#endif
EMUL_ACTIONLIST_SIZE = 222 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
EMUL_ACTIONLIST_SIZE = 230 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
MENU_ACTIONLIST_SIZE = 19
;

View File

@ -79,9 +79,10 @@ enum JoyHatMask {
enum class EventMode {
kEmulationMode, // active mapping used for emulation
kMenuMode, // mapping used for dialogs
kJoystickMode, // 4 extra modes for mapping controller keys separately for emulation mode
kJoystickMode, // 5 extra modes for mapping controller keys separately for emulation mode
kPaddlesMode,
kKeyboardMode,
kDrivingMode,
kCompuMateMode, // cannot be remapped
kCommonMode, // mapping common between controllers
kEditMode, // mapping used in editable widgets

View File

@ -63,6 +63,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
VarList::push_back(items, " Joystick", Event::Group::Joystick);
VarList::push_back(items, " Paddles", Event::Group::Paddles);
VarList::push_back(items, " Keyboard", Event::Group::Keyboard);
VarList::push_back(items, " Driving", Event::Group::Driving);
VarList::push_back(items, " Input Devices & Ports", Event::Group::Devices);
VarList::push_back(items, " Combo", Event::Group::Combo);
VarList::push_back(items, " Debug", Event::Group::Debug);

View File

@ -102,9 +102,9 @@ int32_t input_bitmask[4];
break;
case Controller::Type::Driving:
EVENT(Event::LeftJoystickLeft, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
EVENT(Event::LeftJoystickRight, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
EVENT(Event::LeftJoystickFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
EVENT(Event::LeftDrivingCCW, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
EVENT(Event::LeftDrivingCW, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
EVENT(Event::LeftDrivingFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
break;
case Controller::Type::Genesis:
@ -158,9 +158,9 @@ int32_t input_bitmask[4];
break;
case Controller::Type::Driving:
EVENT(Event::RightJoystickLeft, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
EVENT(Event::RightJoystickRight, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
EVENT(Event::RightJoystickFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
EVENT(Event::RightDrivingCCW, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
EVENT(Event::RightDrivingCW, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
EVENT(Event::RightDrivingFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
break;
case Controller::Type::Genesis: