mirror of
https://github.com/libretro/stella2023.git
synced 2024-12-04 15:36:30 +00:00
fix some joystick mapping bugs
update R77 readme with button combos
This commit is contained in:
parent
e236b0ce95
commit
3348495a55
@ -35,17 +35,19 @@ Inside Launcher:
|
||||
Button 4 COLOR,B/W Open settings
|
||||
|
||||
Inside a dialog:
|
||||
Joystick Button Action
|
||||
-----------------------------------------------------
|
||||
Up SAVE Increase current setting
|
||||
Down RESET Decrease current setting
|
||||
Left LOAD Previous dialog element
|
||||
Right MODE Next dialog element
|
||||
Button 1 SKILL P1 Select element
|
||||
Button 2 SKILL P2 OK
|
||||
Button 3 4:3,16:9 Previous tab
|
||||
Button 4 FRY Next tab
|
||||
Button 6 - Cancel
|
||||
Joystick Button Action
|
||||
------------------------------------------------------
|
||||
Up SAVE Increase current setting
|
||||
Down RESET Decrease current setting
|
||||
Left LOAD Previous dialog element
|
||||
Right MODE Next dialog element
|
||||
Button 1 SKILL P1 Select element
|
||||
Button 2 SKILL P2 OK
|
||||
Button 3 or 4:3,16:9 Previous tab
|
||||
Button 1 + Left
|
||||
Button 4 or FRY Next tab
|
||||
Button 1 + Right
|
||||
Button 6 - Cancel
|
||||
|
||||
Note: If you have a keyboard attached via OTG all keys work as described in
|
||||
the Stella User's Guide.
|
||||
|
@ -37,7 +37,7 @@ void JoyMap::add(const Event::Type event, const EventMode mode, const int button
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void JoyMap::add(const Event::Type event, const EventMode mode, const int button,
|
||||
void JoyMap::add(const Event::Type event, const EventMode mode, const int button,
|
||||
const int hat, const JoyHat hdir)
|
||||
{
|
||||
add(event, JoyMapping(mode, button, hat, hdir));
|
||||
@ -57,7 +57,7 @@ void JoyMap::erase(const EventMode mode, const int button,
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void JoyMap::erase(const EventMode mode, const int button,
|
||||
void JoyMap::erase(const EventMode mode, const int button,
|
||||
const int hat, const JoyHat hdir)
|
||||
{
|
||||
erase(JoyMapping(mode, button, hat, hdir));
|
||||
@ -90,7 +90,7 @@ Event::Type JoyMap::get(const EventMode mode, const int button,
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Event::Type JoyMap::get(const EventMode mode, const int button,
|
||||
Event::Type JoyMap::get(const EventMode mode, const int button,
|
||||
const int hat, const JoyHat hdir) const
|
||||
{
|
||||
return get(JoyMapping(mode, button, hat, hdir));
|
||||
|
@ -232,7 +232,6 @@ void PhysicalJoystickHandler::mapStelladaptors(const string& saport)
|
||||
myOSystem.settings().setValue("saport", saport);
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// Depending on parameters, this method does the following:
|
||||
// 1. update all events with default (event == Event::NoType, updateDefault == true)
|
||||
@ -296,6 +295,10 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even
|
||||
for (const auto& item : DefaultRightKeypadMapping)
|
||||
setDefaultAction(j, item, event, kKeypadMode, updateDefaults);
|
||||
}
|
||||
for(const auto& item : DefaultCommonMapping)
|
||||
setDefaultAction(j, item, event, kCommonMode, updateDefaults);
|
||||
// update running emulation mapping too
|
||||
enableEmulationMappings();
|
||||
break;
|
||||
|
||||
case kMenuMode:
|
||||
@ -562,14 +565,19 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i
|
||||
if (Event::isAnalog(event))
|
||||
{
|
||||
j->joyMap.add(event, evMode, button, axis, JoyDir::ANALOG);
|
||||
// update running emulation mapping too
|
||||
j->joyMap.add(event, kEmulationMode, button, axis, JoyDir::ANALOG);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, turn off the analog event(s) for this axis
|
||||
if (Event::isAnalog(j->joyMap.get(evMode, button, axis, JoyDir::ANALOG)))
|
||||
j->joyMap.erase(evMode, button, axis, JoyDir::ANALOG);
|
||||
|
||||
j->joyMap.add(event, evMode, button, axis, convertAxisValue(value));
|
||||
// update running emulation mapping too
|
||||
if(Event::isAnalog(j->joyMap.get(kEmulationMode, button, axis, JoyDir::ANALOG)))
|
||||
j->joyMap.erase(kEmulationMode, button, axis, JoyDir::ANALOG);
|
||||
j->joyMap.add(event, kEmulationMode, button, axis, convertAxisValue(value));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -587,6 +595,8 @@ bool PhysicalJoystickHandler::addJoyHatMapping(Event::Type event, EventMode mode
|
||||
hat >= 0 && hat < j->numHats && dir != JoyHat::CENTER)
|
||||
{
|
||||
j->joyMap.add(event, getEventMode(event, mode), button, hat, dir);
|
||||
// update running emulation mapping too
|
||||
j->joyMap.add(event, kEmulationMode, button, hat, dir);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -673,7 +683,6 @@ void PhysicalJoystickHandler::handleBtnEvent(int stick, int button, bool pressed
|
||||
{
|
||||
j->buttonLast[stick] = pressed ? button : JOY_CTRL_NONE;
|
||||
|
||||
|
||||
// Handle buttons which switch eventhandler state
|
||||
if (pressed && myHandler.changeStateByEvent(j->joyMap.get(kEmulationMode, button)))
|
||||
return;
|
||||
@ -767,12 +776,6 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultLeftJ
|
||||
{Event::JoystickZeroFire, 0},
|
||||
{Event::JoystickZeroFire5, 1},
|
||||
{Event::JoystickZeroFire9, 2},
|
||||
#if defined(RETRON77)
|
||||
// Left joystick (assume buttons two..four)
|
||||
{Event::CmdMenuMode, 2),
|
||||
{Event::OptionsMenuMode, 3),
|
||||
{Event::ExitMode, 4),
|
||||
#endif
|
||||
// Left joystick left/right directions
|
||||
{Event::JoystickZeroLeft, JOY_CTRL_NONE, JoyAxis::X, JoyDir::NEG},
|
||||
{Event::JoystickZeroRight, JOY_CTRL_NONE, JoyAxis::X, JoyDir::POS},
|
||||
@ -793,15 +796,6 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultRight
|
||||
{Event::JoystickOneFire, 0},
|
||||
{Event::JoystickOneFire5, 1},
|
||||
{Event::JoystickOneFire9, 2},
|
||||
#if defined(RETRON77)
|
||||
// Right joystick (assume buttons two..eight)
|
||||
{Event::CmdMenuMode, 2},
|
||||
{Event::OptionsMenuMode, 3},
|
||||
{Event::ExitMode, 4},
|
||||
{Event::RewindPause, 5},
|
||||
{Event::ConsoleSelect, 7},
|
||||
{Event::ConsoleReset, 8},
|
||||
#endif
|
||||
// Right joystick left/right directions
|
||||
{Event::JoystickOneLeft, JOY_CTRL_NONE, JoyAxis::X, JoyDir::NEG},
|
||||
{Event::JoystickOneRight, JOY_CTRL_NONE, JoyAxis::X, JoyDir::POS},
|
||||
@ -872,6 +866,19 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultRight
|
||||
{Event::KeyboardOnePound, 11},
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultCommonMapping = {
|
||||
// valid for all joysticks
|
||||
//#if defined(RETRON77)
|
||||
{Event::CmdMenuMode, 2},
|
||||
{Event::OptionsMenuMode, 3},
|
||||
{Event::ExitMode, 4},
|
||||
{Event::RewindPause, 5},
|
||||
{Event::ConsoleSelect, 7},
|
||||
{Event::ConsoleReset, 8},
|
||||
//#endif
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultMenuMapping = {
|
||||
// valid for all joysticks
|
||||
|
@ -171,6 +171,7 @@ class PhysicalJoystickHandler
|
||||
|
||||
// Controller menu and common emulation mappings
|
||||
static EventMappingArray DefaultMenuMapping;
|
||||
static EventMappingArray DefaultCommonMapping;
|
||||
// Controller specific mappings
|
||||
static EventMappingArray DefaultLeftJoystickMapping;
|
||||
static EventMappingArray DefaultRightJoystickMapping;
|
||||
|
@ -78,7 +78,7 @@ void PhysicalJoystick::initialize(int index, const string& desc,
|
||||
string PhysicalJoystick::getMap() const
|
||||
{
|
||||
// The mapping structure (for remappable devices) is defined as follows:
|
||||
// <NAME>'$'<MODE>['|'(<EVENT>':'<BUTTON>','<AXIS>','<VALUE>)|(<EVENT>':'<BUTTON>','<HAT>','<HATDIR>)]
|
||||
// <NAME>'>'<MODE>['|'(<EVENT>':'<BUTTON>','<AXIS>','<VALUE>)|(<EVENT>':'<BUTTON>','<HAT>','<HATDIR>)]
|
||||
|
||||
ostringstream joybuf;
|
||||
|
||||
@ -89,7 +89,6 @@ string PhysicalJoystick::getMap() const
|
||||
joybuf << MODE_DELIM << int(kKeypadMode) << "|" << joyMap.saveMapping(kKeypadMode);
|
||||
joybuf << MODE_DELIM << int(kCommonMode) << "|" << joyMap.saveMapping(kCommonMode);
|
||||
|
||||
|
||||
return joybuf.str();
|
||||
}
|
||||
|
||||
|
@ -161,8 +161,11 @@ void EventMappingWidget::startRemapping()
|
||||
myRemapStatus = true;
|
||||
|
||||
// Reset all previous events for determining correct axis/hat values
|
||||
myLastStick = myLastAxis = myLastHat = myLastValue = -1;
|
||||
myLastStick = -1;
|
||||
myLastButton = JOY_CTRL_NONE;
|
||||
myLastAxis = int(JoyAxis::NONE);
|
||||
myLastHat = -1;
|
||||
myLastValue = int(JoyDir::NONE);
|
||||
|
||||
// Reset the previously aggregated key mappings
|
||||
myMod = myLastKey = 0;
|
||||
@ -217,8 +220,11 @@ void EventMappingWidget::stopRemapping()
|
||||
cerr << "stopRemapping " << myRemapStatus << endl;
|
||||
|
||||
// Reset all previous events for determining correct axis/hat values
|
||||
myLastStick = myLastAxis = myLastHat = myLastValue = -1;
|
||||
myLastStick = -1;
|
||||
myLastButton = JOY_CTRL_NONE;
|
||||
myLastAxis = int(JoyAxis::NONE);
|
||||
myLastHat = -1;
|
||||
myLastValue = int(JoyDir::NONE);
|
||||
|
||||
// And re-enable all the widgets
|
||||
enableButtons(true);
|
||||
|
@ -65,7 +65,6 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa
|
||||
xpos += INDENT;
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
|
||||
addUIOptions(wid, xpos, ypos, font);
|
||||
ypos += VGAP * 4;
|
||||
addVideoOptions(wid, xpos, ypos, font);
|
||||
@ -390,7 +389,6 @@ void StellaSettingsDialog::handleOverscanChange()
|
||||
myTVOverscan->setValueUnit("%");
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::switchSettingsMode()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user