From b7498f4581e661aba9bd9b7ee0983597a82fe832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 3 Apr 2015 11:50:03 +0200 Subject: [PATCH] Make some UI adjustments on TV devices --- Core/Config.cpp | 15 ++++- UI/DevScreens.cpp | 8 +-- UI/GameSettingsScreen.cpp | 64 ++++++++++--------- UI/GameSettingsScreen.h | 2 +- android/AndroidManifest.xml | 2 +- .../src/org/ppsspp/ppsspp/PpssppActivity.java | 5 -- 6 files changed, 53 insertions(+), 43 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 9cb45f26c8..c75c44a62a 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -487,11 +487,20 @@ static ConfigSetting soundSettings[] = { static bool DefaultShowTouchControls() { #if defined(MOBILE_DEVICE) - std::string name = System_GetProperty(SYSPROP_NAME); - if (KeyMap::HasBuiltinController(name)) { + int deviceType = System_GetPropertyInt(SYSPROP_DEVICE_TYPE); + if (deviceType == DEVICE_TYPE_MOBILE) { + std::string name = System_GetProperty(SYSPROP_NAME); + if (KeyMap::HasBuiltinController(name)) { + return false; + } else { + return true; + } + } else if (deviceType == DEVICE_TYPE_TV) { + return false; + } else if (deviceType == DEVICE_TYPE_DESKTOP) { return false; } else { - return true; + return false; } #else return false; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index d6575b686b..4f0674a7c3 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -423,7 +423,7 @@ void SystemInfoScreen::CreateViews() { SplitString(g_all_gl_extensions, ' ', exts); std::sort(exts.begin(), exts.end()); for (size_t i = 0; i < exts.size(); i++) { - oglExtensions->Add(new TextView(exts[i])); + oglExtensions->Add(new TextView(exts[i]))->SetFocusable(true); } exts.clear(); @@ -442,7 +442,7 @@ void SystemInfoScreen::CreateViews() { eglExtensions->Add(new ItemHeader("EGL Extensions")); for (size_t i = 0; i < exts.size(); i++) { - eglExtensions->Add(new TextView(exts[i])); + eglExtensions->Add(new TextView(exts[i]))->SetFocusable(true); } } } @@ -607,7 +607,7 @@ void JitCompareScreen::UpdateDisasm() { char temp[256]; MIPSDisAsm(Memory::Read_Instruction(addr), addr, temp, true); std::string mipsDis = temp; - leftDisasm_->Add(new TextView(mipsDis)); + leftDisasm_->Add(new TextView(mipsDis))->SetFocusable(true); } #if defined(ARM) @@ -616,7 +616,7 @@ void JitCompareScreen::UpdateDisasm() { std::vector targetDis = DisassembleX86(block->normalEntry, block->codeSize); #endif for (size_t i = 0; i < targetDis.size(); i++) { - rightDisasm_->Add(new TextView(targetDis[i])); + rightDisasm_->Add(new TextView(targetDis[i]))->SetFocusable(true); } int numMips = leftDisasm_->GetNumSubviews(); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 1008613640..e05bd84d54 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -379,39 +379,43 @@ void GameSettingsScreen::CreateViews() { controlsSettings->Add(new PopupMultiChoice(&g_Config.iTiltInputType, c->T("Tilt Input Type"), tiltTypes, 0, ARRAY_SIZE(tiltTypes), c, screenManager()))->OnClick.Handle(this, &GameSettingsScreen::OnTiltTypeChange); Choice *customizeTilt = controlsSettings->Add(new Choice(c->T("Customize tilt"))); - customizeTilt->OnClick.Handle(this, &GameSettingsScreen::OnTiltCuztomize); + customizeTilt->OnClick.Handle(this, &GameSettingsScreen::OnTiltCustomize); customizeTilt->SetEnabledPtr((bool *)&g_Config.iTiltInputType); //<- dirty int-to-bool cast #endif - controlsSettings->Add(new ItemHeader(c->T("OnScreen", "On-Screen Touch Controls"))); - controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls"))); - layoutEditorChoice_ = controlsSettings->Add(new Choice(c->T("Custom layout..."))); - layoutEditorChoice_->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlLayout); - layoutEditorChoice_->SetEnabledPtr(&g_Config.bShowTouchControls); - // Re-centers itself to the touch location on touch-down. - CheckBox *floatingAnalog = controlsSettings->Add(new CheckBox(&g_Config.bAutoCenterTouchAnalog, c->T("Auto-centering analog stick"))); - floatingAnalog->SetEnabledPtr(&g_Config.bShowTouchControls); + // TVs don't have touch control, at least not yet. + if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_TV) { + controlsSettings->Add(new ItemHeader(c->T("OnScreen", "On-Screen Touch Controls"))); + controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls"))); + layoutEditorChoice_ = controlsSettings->Add(new Choice(c->T("Custom layout..."))); + layoutEditorChoice_->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlLayout); + layoutEditorChoice_->SetEnabledPtr(&g_Config.bShowTouchControls); - // On systems that aren't Symbian, iOS, and Maemo, offer to let the user see this button. - // Some Windows touch devices don't have a back button or other button to call up the menu. + // Re-centers itself to the touch location on touch-down. + CheckBox *floatingAnalog = controlsSettings->Add(new CheckBox(&g_Config.bAutoCenterTouchAnalog, c->T("Auto-centering analog stick"))); + floatingAnalog->SetEnabledPtr(&g_Config.bShowTouchControls); + + // On systems that aren't Symbian, iOS, and Maemo, offer to let the user see this button. + // Some Windows touch devices don't have a back button or other button to call up the menu. #if !defined(__SYMBIAN32__) && !defined(IOS) && !defined(MAEMO) - CheckBox *enablePauseBtn = controlsSettings->Add(new CheckBox(&g_Config.bShowTouchPause, c->T("Show Touch Pause Menu Button"))); + CheckBox *enablePauseBtn = controlsSettings->Add(new CheckBox(&g_Config.bShowTouchPause, c->T("Show Touch Pause Menu Button"))); - // Don't allow the user to disable it once in-game, so they can't lock themselves out of the menu. - if (!PSP_IsInited()) { - enablePauseBtn->SetEnabledPtr(&g_Config.bShowTouchControls); - } else { - enablePauseBtn->SetEnabled(false); - } + // Don't allow the user to disable it once in-game, so they can't lock themselves out of the menu. + if (!PSP_IsInited()) { + enablePauseBtn->SetEnabledPtr(&g_Config.bShowTouchControls); + } else { + enablePauseBtn->SetEnabled(false); + } #endif - CheckBox *disableDiags = controlsSettings->Add(new CheckBox(&g_Config.bDisableDpadDiagonals, c->T("Disable D-Pad diagonals (4-way touch)"))); - disableDiags->SetEnabledPtr(&g_Config.bShowTouchControls); - View *opacity = controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 0, 100, c->T("Button Opacity"), screenManager())); - opacity->SetEnabledPtr(&g_Config.bShowTouchControls); - static const char *touchControlStyles[] = {"Classic", "Thin borders"}; - View *style = controlsSettings->Add(new PopupMultiChoice(&g_Config.iTouchButtonStyle, c->T("Button style"), touchControlStyles, 0, ARRAY_SIZE(touchControlStyles), c, screenManager())); - style->SetEnabledPtr(&g_Config.bShowTouchControls); + CheckBox *disableDiags = controlsSettings->Add(new CheckBox(&g_Config.bDisableDpadDiagonals, c->T("Disable D-Pad diagonals (4-way touch)"))); + disableDiags->SetEnabledPtr(&g_Config.bShowTouchControls); + View *opacity = controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 0, 100, c->T("Button Opacity"), screenManager())); + opacity->SetEnabledPtr(&g_Config.bShowTouchControls); + static const char *touchControlStyles[] = {"Classic", "Thin borders"}; + View *style = controlsSettings->Add(new PopupMultiChoice(&g_Config.iTouchButtonStyle, c->T("Button style"), touchControlStyles, 0, ARRAY_SIZE(touchControlStyles), c, screenManager())); + style->SetEnabledPtr(&g_Config.bShowTouchControls); + } #ifdef _WIN32 static const char *inverseDeadzoneModes[] = { "Off", "X", "Y", "X + Y" }; @@ -493,9 +497,11 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new ItemHeader(s->T("General"))); #ifdef ANDROID - static const char *screenRotation[] = {"Auto", "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed"}; - PopupMultiChoice *rot = systemSettings->Add(new PopupMultiChoice(&g_Config.iScreenRotation, c->T("Screen Rotation"), screenRotation, 0, ARRAY_SIZE(screenRotation), c, screenManager())); - rot->OnChoice.Handle(this, &GameSettingsScreen::OnScreenRotation); + if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_MOBILE) { + static const char *screenRotation[] = {"Auto", "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed"}; + PopupMultiChoice *rot = systemSettings->Add(new PopupMultiChoice(&g_Config.iScreenRotation, c->T("Screen Rotation"), screenRotation, 0, ARRAY_SIZE(screenRotation), c, screenManager())); + rot->OnChoice.Handle(this, &GameSettingsScreen::OnScreenRotation); + } #endif systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, s->T("VersionCheck", "Check for new versions of PPSSPP"))); @@ -946,7 +952,7 @@ UI::EventReturn GameSettingsScreen::OnTiltTypeChange(UI::EventParams &e){ return UI::EVENT_DONE; }; -UI::EventReturn GameSettingsScreen::OnTiltCuztomize(UI::EventParams &e){ +UI::EventReturn GameSettingsScreen::OnTiltCustomize(UI::EventParams &e){ screenManager()->push(new TiltAnalogSettingsScreen()); return UI::EVENT_DONE; }; diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 61d9d6c486..209afb4977 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -65,7 +65,7 @@ private: UI::EventReturn OnDumpNextFrameToLog(UI::EventParams &e); UI::EventReturn OnReloadCheats(UI::EventParams &e); UI::EventReturn OnTiltTypeChange(UI::EventParams &e); - UI::EventReturn OnTiltCuztomize(UI::EventParams &e); + UI::EventReturn OnTiltCustomize(UI::EventParams &e); // Global settings handlers UI::EventReturn OnLanguage(UI::EventParams &e); diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 15b6c85242..a0d8c5b0b7 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -36,7 +36,7 @@ android:banner="@drawable/tv_banner"> diff --git a/android/src/org/ppsspp/ppsspp/PpssppActivity.java b/android/src/org/ppsspp/ppsspp/PpssppActivity.java index f86e785070..c30d5a9cd0 100644 --- a/android/src/org/ppsspp/ppsspp/PpssppActivity.java +++ b/android/src/org/ppsspp/ppsspp/PpssppActivity.java @@ -68,11 +68,6 @@ public class PpssppActivity extends NativeActivity { return; } - UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); - if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { - Log.i(TAG, "Running on an Android TV Device"); - } - // In case app launched from homescreen shortcut, get shortcut parameter // using Intent extra string. Intent extra will be null if launch normal // (from app drawer).