From ed4529b1640ba5521951e63a660036e832cbf2ca Mon Sep 17 00:00:00 2001 From: thrust26 Date: Wed, 1 May 2019 11:28:23 +0200 Subject: [PATCH] allow open Power-on options via joystick 2nd button add initial documentation for R77 (navigation only) --- docs/R77_readme.txt | 50 +++++++++++++++++++++++++++++++++ src/common/PJoystickHandler.cxx | 3 +- src/gui/LauncherDialog.cxx | 17 +++++++++-- src/gui/LauncherDialog.hxx | 1 + 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 docs/R77_readme.txt diff --git a/docs/R77_readme.txt b/docs/R77_readme.txt new file mode 100644 index 000000000..9955caf7f --- /dev/null +++ b/docs/R77_readme.txt @@ -0,0 +1,50 @@ +TODOs: +- convert into HTML +- maybe display inside a R77 specific help dialog (from Command dialog) +- check if Command dialog and Settings shoud use the same button (16:9,4:3) +- explain Command and Settings dialog +- explain Power-on options dialog (or refer to Stella User's Guide) + +*** Navigation *** + +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 + +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 + +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 + +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 4ebb98201..455a02784 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -307,8 +307,9 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, setDefaultAxis( stick, 1, 0, Event::UIUp ); setDefaultAxis( stick, 1, 1, Event::UIDown ); - // Left joystick (assume joystick zero, button zero) + // joystick (assume buttons zero and one) setDefaultBtn( stick, 0, Event::UISelect ); + setDefaultBtn( stick, 1, Event::UICancel ); setDefaultHat( stick, 0, JoyHat::LEFT, Event::UINavPrev ); setDefaultHat( stick, 0, JoyHat::RIGHT, Event::UINavNext ); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 018567802..2ce9ecc42 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -464,11 +464,11 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod) switch(key) { case KBDK_F8: // front ("Skill P2") - openSettings(); + myGlobalProps->open(); break; case KBDK_F4: // back ("COLOR", "B/W") - myGlobalProps->open(); + openSettings(); break; case KBDK_F11: // front ("LOAD") @@ -491,6 +491,18 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod) #endif } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void LauncherDialog::handleJoyDown(int stick, int button) +{ + // open power-up options for 2nd 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(); + else + Dialog::handleJoyDown(stick, button); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event::Type LauncherDialog::getJoyAxisEvent(int stick, int axis, int value) { @@ -541,6 +553,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd, showOnlyROMs(myAllFiles ? !myAllFiles->getState() : true); updateListing(); break; + case kLoadROMCmd: case ListWidget::kActivatedCmd: case ListWidget::kDoubleClickedCmd: diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index cf525fcb5..e6203b6b7 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -88,6 +88,7 @@ class LauncherDialog : public Dialog void handleKeyDown(StellaKey key, StellaMod mod) override; void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; + void handleJoyDown(int stick, int button); Event::Type getJoyAxisEvent(int stick, int axis, int value) override; void loadConfig() override;