diff options
-rw-r--r-- | backends/platform/androidsdl/androidsdl-sdl.cpp | 31 | ||||
-rw-r--r-- | backends/platform/androidsdl/androidsdl-sdl.h | 1 | ||||
-rw-r--r-- | common/system.h | 7 | ||||
-rw-r--r-- | gui/options.cpp | 20 | ||||
-rw-r--r-- | gui/options.h | 1 | ||||
-rw-r--r-- | gui/themes/default.inc | 18 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 127371 -> 127529 bytes | |||
-rw-r--r-- | gui/themes/scummclassic/classic_layout.stx | 3 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout_lowres.stx | 3 | ||||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1646989 -> 1647069 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 3 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 3 |
12 files changed, 82 insertions, 8 deletions
diff --git a/backends/platform/androidsdl/androidsdl-sdl.cpp b/backends/platform/androidsdl/androidsdl-sdl.cpp index 61b01920bb..f841426a9d 100644 --- a/backends/platform/androidsdl/androidsdl-sdl.cpp +++ b/backends/platform/androidsdl/androidsdl-sdl.cpp @@ -45,19 +45,22 @@ void OSystem_ANDROIDSDL::initBackend() { if (!ConfMan.hasKey("gfx_mode")) ConfMan.set("gfx_mode", "2x"); + if (!ConfMan.hasKey("swap_menu_and_back")) + ConfMan.setBool("swap_menu_and_back", true); + else + swapMenuAndBackButtons(ConfMan.getBool("swap_menu_and_back")); + if (!ConfMan.hasKey("touchpad_mouse_mode")) { const bool enable = (SDL_ANDROID_GetMouseEmulationMode() == 0) ? false : true; ConfMan.setBool("touchpad_mouse_mode", enable); - } else { + } else touchpadMode(ConfMan.getBool("touchpad_mouse_mode")); - } if (!ConfMan.hasKey("onscreen_control")) { const bool enable = (SDL_ANDROID_GetScreenKeyboardShown() == 0) ? false : true; ConfMan.setBool("onscreen_control", enable); - } else { + } else showOnScreenControl(ConfMan.getBool("onscreen_control")); - } // Call parent implementation of this method OSystem_POSIX::initBackend(); @@ -77,6 +80,18 @@ void OSystem_ANDROIDSDL::touchpadMode(bool enable) { switchToDirectMouseMode(); } +void OSystem_ANDROIDSDL::swapMenuAndBackButtons(bool enable) { + static int KEYCODE_MENU = 82; + static int KEYCODE_BACK = 4; + if (enable) { + SDL_ANDROID_SetAndroidKeycode(KEYCODE_BACK, SDLK_F13); + SDL_ANDROID_SetAndroidKeycode(KEYCODE_MENU, SDLK_ESCAPE); + } else { + SDL_ANDROID_SetAndroidKeycode(KEYCODE_BACK, SDLK_ESCAPE); + SDL_ANDROID_SetAndroidKeycode(KEYCODE_MENU, SDLK_F13); + } +} + void OSystem_ANDROIDSDL::switchToDirectMouseMode() { SDL_ANDROID_SetMouseEmulationMode(0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); } @@ -95,6 +110,10 @@ void OSystem_ANDROIDSDL::setFeatureState(Feature f, bool enable) { ConfMan.setBool("onscreen_control", enable); showOnScreenControl(enable); break; + case kFeatureSwapMenuAndBackButtons: + ConfMan.setBool("swap_menu_and_back", enable); + swapMenuAndBackButtons(enable); + break; } OSystem_POSIX::setFeatureState(f, enable); @@ -108,6 +127,9 @@ bool OSystem_ANDROIDSDL::getFeatureState(Feature f) { case kFeatureOnScreenControl: return ConfMan.getBool("onscreen_control"); break; + case kFeatureSwapMenuAndBackButtons: + return ConfMan.getBool("swap_menu_and_back"); + break; default: return OSystem_POSIX::getFeatureState(f); break; @@ -117,5 +139,6 @@ bool OSystem_ANDROIDSDL::getFeatureState(Feature f) { bool OSystem_ANDROIDSDL::hasFeature(Feature f) { return (f == kFeatureTouchpadMode || f == kFeatureOnScreenControl || + f == kFeatureSwapMenuAndBackButtons || f == OSystem_POSIX::getFeatureState(f)); } diff --git a/backends/platform/androidsdl/androidsdl-sdl.h b/backends/platform/androidsdl/androidsdl-sdl.h index 4976e320df..e83f610d10 100644 --- a/backends/platform/androidsdl/androidsdl-sdl.h +++ b/backends/platform/androidsdl/androidsdl-sdl.h @@ -32,6 +32,7 @@ public: virtual bool getFeatureState(Feature f); virtual bool hasFeature(Feature f); void touchpadMode(bool enable); + void swapMenuAndBackButtons(bool enable); void switchToDirectMouseMode(); void switchToRelativeMouseMode(); void showOnScreenControl(bool enable); diff --git a/common/system.h b/common/system.h index eda4ec6b10..1b03fb0a15 100644 --- a/common/system.h +++ b/common/system.h @@ -346,7 +346,12 @@ public: /** * mouse emulation mode */ - kFeatureTouchpadMode + kFeatureTouchpadMode, + + /** + * swap menu and back buttons + */ + kFeatureSwapMenuAndBackButtons }; /** diff --git a/gui/options.cpp b/gui/options.cpp index fdd5db4c32..056476f170 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -139,6 +139,7 @@ void OptionsDialog::init() { _enableControlSettings = false; _onscreenCheckbox = 0; _touchpadCheckbox = 0; + _swapMenuAndBackBtnsCheckbox = 0; _enableGraphicSettings = false; _gfxPopUp = 0; _gfxPopUpDesc = 0; @@ -221,6 +222,13 @@ void OptionsDialog::build() { _touchpadCheckbox->setState(touchpadState); } } + if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) { + if (ConfMan.hasKey("swap_menu_and_back", _domain)) { + bool state = g_system->getFeatureState(OSystem::kFeatureSwapMenuAndBackButtons); + if (_swapMenuAndBackBtnsCheckbox != 0) + _swapMenuAndBackBtnsCheckbox->setState(state); + } + } // Graphic options if (_fullscreenCheckbox) { @@ -411,6 +419,11 @@ void OptionsDialog::apply() { g_system->setFeatureState(OSystem::kFeatureTouchpadMode, _touchpadCheckbox->getState()); } } + if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) { + if (ConfMan.getBool("swap_menu_and_back", _domain) != _swapMenuAndBackBtnsCheckbox->getState()) { + g_system->setFeatureState(OSystem::kFeatureSwapMenuAndBackButtons, _swapMenuAndBackBtnsCheckbox->getState()); + } + } } // Graphic options @@ -841,6 +854,10 @@ void OptionsDialog::setSubtitleSettingsState(bool enabled) { if (g_system->hasFeature(OSystem::kFeatureTouchpadMode)) _touchpadCheckbox = new CheckboxWidget(boss, prefix + "grTouchpadCheckbox", _("Touchpad mouse mode")); + // Swap menu and back buttons + if (g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) + _swapMenuAndBackBtnsCheckbox = new CheckboxWidget(boss, prefix + "grSwapMenuAndBackBtnsCheckbox", _("Swap Menu and Back buttons")); + _enableControlSettings = true; } @@ -1275,7 +1292,8 @@ void GlobalOptionsDialog::build() { // The control tab (currently visible only for AndroidSDL platform, visibility checking by features // if (g_system->hasFeature(OSystem::kFeatureTouchpadMode) || - g_system->hasFeature(OSystem::kFeatureOnScreenControl)) { + g_system->hasFeature(OSystem::kFeatureOnScreenControl) || + g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons)) { tab->addTab(_("Control")); addControlControls(tab, "GlobalOptions_Control."); } diff --git a/gui/options.h b/gui/options.h index cb86e265bb..626ffaf2db 100644 --- a/gui/options.h +++ b/gui/options.h @@ -122,6 +122,7 @@ private: CheckboxWidget *_touchpadCheckbox; CheckboxWidget *_onscreenCheckbox; + CheckboxWidget *_swapMenuAndBackBtnsCheckbox; // // Graphics controls diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 9254e97f40..d8baae8d0e 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -813,7 +813,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "</layout>" "</layout>" "</dialog>" - "<dialog name='GlobalOptions_Control' overlays='Dialog.GlobalOptions.TabWidget'>" "<layout type='vertical' padding='16,16,16,16' spacing='8'>" "<widget name='grOnScreenCheckbox' " @@ -822,9 +821,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "<widget name='grTouchpadCheckbox' " "type='Checkbox' " "/>" +"<widget name='grSwapMenuAndBackBtnsCheckbox' " +"type='Checkbox' " +"/>" "</layout>" "</dialog>" - "<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>" "<layout type='vertical' padding='16,16,16,16' spacing='8'>" "<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" @@ -2367,6 +2368,19 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "</layout>" "</layout>" "</dialog>" +"<dialog name='GlobalOptions_Control' overlays='Dialog.GlobalOptions.TabWidget'>" +"<layout type='vertical' padding='16,16,16,16' spacing='6'>" +"<widget name='grOnScreenCheckbox' " +"type='Checkbox' " +"/>" +"<widget name='grTouchpadCheckbox' " +"type='Checkbox' " +"/>" +"<widget name='grSwapMenuAndBackBtnsCheckbox' " +"type='Checkbox' " +"/>" +"</layout>" +"</dialog>" "<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'>" "<layout type='vertical' padding='16,16,16,16' spacing='8'>" "<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 22eaa76fde..d90289a4be 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index a1a148b0c7..aa91cdb35f 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -246,6 +246,9 @@ <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> </layout> </dialog> diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 1627ee6ce2..c925a39d18 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -243,6 +243,9 @@ <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> </layout> </dialog> diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex a42d6ed620..f10102503e 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 16e85a0761..80b913a3a4 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -260,6 +260,9 @@ <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> </layout> </dialog> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index a2d51d9904..308ba44b7e 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -241,6 +241,9 @@ <widget name = 'grTouchpadCheckbox' type = 'Checkbox' /> + <widget name = 'grSwapMenuAndBackBtnsCheckbox' + type = 'Checkbox' + /> </layout> </dialog> |