diff --git a/docs/R77_readme.txt b/docs/R77_readme.txt index 9955caf7f..0f2982fc0 100644 --- a/docs/R77_readme.txt +++ b/docs/R77_readme.txt @@ -11,36 +11,37 @@ Stella can be controlled via the console buttons or a joystick in left or right port. Inside Launcher: - Joystick Button Action - -------------------------------------------------- - Up SAVE previous game - Down RESET next game - Left LOAD page up - Right MODE page down - Button SKILL P1 start selected game - Button #2 SKILL P2 open Power-on options dialog - - COLOR,B/W open Settings dialog + Joystick Button Action + ---------------------------------------------------- + Up SAVE previous game + Down RESET next game + Left LOAD page up + Right MODE page down + Button 1 SKILL P1 start selected game + Button 2 SKILL P2 open Power-on options dialog + Button 4 COLOR,B/W open Settings dialog Inside a dialog: - Joystick Button Action - ---------------------------------------------------- - Up SAVE change/increase current option - Down RESET change/decrease current option - Left LOAD previous dialog element - Right MODE next dialog element - Button SKILL P1 select - Button #2 SKILL P2 cancel - - 4:3,16:9 previous tab - - FRY next tab + Joystick Button Action + ----------------------------------------------------- + Up SAVE change/increase current option + Down RESET change/decrease current option + Left LOAD previous dialog element + Right MODE next dialog element + Button 1 SKILL P1 select + Button 2 SKILL P2 cancel + Button 3 4:3,16:9 previous tab + Button 4 FRY next tab During emulation: The joysticks work normal and all console buttons as labeled except of the following. - Button Action - ---------------------------------- - 4:3,16:9 open the Command dialog - FRY return to Launcher + Joystick īButton Action + ---------------------------------------------- + Button 3 4:3,16:9 open the Command dialog + Button 4 - open Settings dialog + Button 5 FRY return to Launcher Note: If you have a keyboard attached via OTG all keys work as described in the Stella User's Guide. diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index b7f65b3d5..75223f449 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -269,39 +269,66 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, switch(mode) { case kEmulationMode: // Default emulation events - if(stick == 0) + switch (stick) { - // Left joystick left/right directions (assume joystick zero) - setDefaultAxis( 0, 0, 0, Event::JoystickZeroLeft ); - setDefaultAxis( 0, 0, 1, Event::JoystickZeroRight ); - // Left joystick up/down directions (assume joystick zero) - setDefaultAxis( 0, 1, 0, Event::JoystickZeroUp ); - setDefaultAxis( 0, 1, 1, Event::JoystickZeroDown ); - // Left joystick (assume joystick zero, button zero) - setDefaultBtn( 0, 0, Event::JoystickZeroFire ); - // Left joystick left/right directions (assume joystick zero and hat 0) - setDefaultHat( 0, 0, JoyHat::LEFT, Event::JoystickZeroLeft ); - setDefaultHat( 0, 0, JoyHat::RIGHT, Event::JoystickZeroRight ); - // Left joystick up/down directions (assume joystick zero and hat 0) - setDefaultHat( 0, 0, JoyHat::UP, Event::JoystickZeroUp ); - setDefaultHat( 0, 0, JoyHat::DOWN, Event::JoystickZeroDown ); - } - else if(stick == 1) - { - // Right joystick left/right directions (assume joystick one) - setDefaultAxis( 1, 0, 0, Event::JoystickOneLeft ); - setDefaultAxis( 1, 0, 1, Event::JoystickOneRight ); - // Right joystick left/right directions (assume joystick one) - setDefaultAxis( 1, 1, 0, Event::JoystickOneUp ); - setDefaultAxis( 1, 1, 1, Event::JoystickOneDown ); - // Right joystick (assume joystick one, button zero) - setDefaultBtn( 1, 0, Event::JoystickOneFire ); - // Right joystick left/right directions (assume joystick one and hat 0) - setDefaultHat( 1, 0, JoyHat::LEFT, Event::JoystickOneLeft ); - setDefaultHat( 1, 0, JoyHat::RIGHT, Event::JoystickOneRight ); - // Right joystick up/down directions (assume joystick one and hat 0) - setDefaultHat( 1, 0, JoyHat::UP, Event::JoystickOneUp ); - setDefaultHat( 1, 0, JoyHat::DOWN, Event::JoystickOneDown ); + case 0: + case 2: + // Left joystick left/right directions (assume joystick zero or two) + setDefaultAxis(stick, 0, 0, Event::JoystickZeroLeft); + setDefaultAxis(stick, 0, 1, Event::JoystickZeroRight); + // Left joystick up/down directions (assume joystick zero or two) + setDefaultAxis(stick, 1, 0, Event::JoystickZeroUp); + setDefaultAxis(stick, 1, 1, Event::JoystickZeroDown); + // Left joystick (assume joystick zero or two, buttons zero..two) + setDefaultBtn(stick, 0, Event::JoystickZeroFire); + setDefaultBtn(stick, 1, Event::JoystickZeroFire5); + setDefaultBtn(stick, 2, Event::JoystickZeroFire9); + // Left joystick left/right directions (assume joystick zero or two and hat 0) + setDefaultHat(stick, 0, JoyHat::LEFT, Event::JoystickZeroLeft); + setDefaultHat(stick, 0, JoyHat::RIGHT, Event::JoystickZeroRight); + // Left joystick up/down directions (assume joystick zero or two and hat 0) + setDefaultHat(stick, 0, JoyHat::UP, Event::JoystickZeroUp); + setDefaultHat(stick, 0, JoyHat::DOWN, Event::JoystickZeroDown); + // FIXME - use the R77 define in the final release + // use the '1' define for testing + #if defined(RETRON77) + // #if 1 + // Left joystick (assume joystick zero or two, buttons two..four) + setDefaultBtn(stick, 2, Event::CmdMenuMode); + setDefaultBtn(stick, 3, Event::OptionsMenuMode); + setDefaultBtn(stick, 4, Event::LauncherMode); + #endif + break; + case 1: + case 3: + // Right joystick left/right directions (assume joystick one or three) + setDefaultAxis(stick, 0, 0, Event::JoystickOneLeft); + setDefaultAxis(stick, 0, 1, Event::JoystickOneRight); + // Right joystick left/right directions (assume joystick one or three) + setDefaultAxis(stick, 1, 0, Event::JoystickOneUp); + setDefaultAxis(stick, 1, 1, Event::JoystickOneDown); + // Right joystick (assume joystick one or three, buttons zero..two) + setDefaultBtn(stick, 0, Event::JoystickOneFire); + setDefaultBtn(stick, 1, Event::JoystickOneFire5); + setDefaultBtn(stick, 2, Event::JoystickOneFire9); + // Right joystick left/right directions (assume joystick one or three and hat 0) + setDefaultHat(stick, 0, JoyHat::LEFT, Event::JoystickOneLeft); + setDefaultHat(stick, 0, JoyHat::RIGHT, Event::JoystickOneRight); + // Right joystick up/down directions (assume joystick one or three and hat 0) + setDefaultHat(stick, 0, JoyHat::UP, Event::JoystickOneUp); + setDefaultHat(stick, 0, JoyHat::DOWN, Event::JoystickOneDown); + // FIXME - use the R77 define in the final release + // use the '1' define for testing + #if defined(RETRON77) + // #if 1 + // Right joystick (assume joystick one or three, buttons two..four) + setDefaultBtn(stick, 2, Event::CmdMenuMode); + setDefaultBtn(stick, 3, Event::OptionsMenuMode); + setDefaultBtn(stick, 4, Event::LauncherMode); + #endif + break; + default: + break; } break; @@ -311,9 +338,11 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, setDefaultAxis( stick, 1, 0, Event::UIUp ); setDefaultAxis( stick, 1, 1, Event::UIDown ); - // joystick (assume buttons zero and one) - setDefaultBtn( stick, 0, Event::UISelect ); - setDefaultBtn( stick, 1, Event::UICancel ); + // joystick (assume buttons zero..three) + setDefaultBtn( stick, 0, Event::UISelect ); + setDefaultBtn( stick, 1, Event::UICancel ); + setDefaultBtn( stick, 2, Event::UITabPrev ); + setDefaultBtn( stick, 3, Event::UITabNext ); setDefaultHat( stick, 0, JoyHat::LEFT, Event::UINavPrev ); setDefaultHat( stick, 0, JoyHat::RIGHT, Event::UINavNext ); diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index d5c6f1d5e..773c70bec 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -458,8 +458,8 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod) } // FIXME - use the R77 define in the final release // use the '1' define for testing - // #if defined(RETRON77) - #if 1 + #if defined(RETRON77) + // #if 1 // special keys used for R77 else if (key == KBDK_F13) e = Event::UITabPrev; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index fc173a6c4..6bd981cb5 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -498,11 +498,13 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::handleJoyDown(int stick, int button) { - // open power-up options for 2nd 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(stick, button, kMenuMode); if (button == 1 && (e == Event::UICancel || e == Event::NoType)) myGlobalProps->open(); + if (button == 3 && e == Event::NoType) + openSettings(); else Dialog::handleJoyDown(stick, button); }