From 83bf001a311e0742e6f17c5528d86ecbf4c45b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 6 Oct 2018 13:43:11 +0200 Subject: [PATCH] Disable Android HW scale on TV type devices. --- Core/Config.cpp | 2 +- UI/GameSettingsScreen.cpp | 16 +++++++++------- UI/NativeApp.cpp | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index d803a14c5afa..8ff95fcde5eb 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -510,7 +510,7 @@ static bool DefaultTimerHack() { static int DefaultAndroidHwScale() { #ifdef __ANDROID__ - if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19) { + if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19 || System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV) { // Arbitrary cutoff at Kitkat - modern devices are usually powerful enough that hw scaling // doesn't really help very much and mostly causes problems. See #11151 return 0; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 2a3f494b81d3..43bb8dd58a35 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -330,13 +330,15 @@ void GameSettingsScreen::CreateViews() { resolutionChoice_->SetEnabledPtr(&resolutionEnable_); #ifdef __ANDROID__ - static const char *deviceResolutions[] = { "Native device resolution", "Auto (same as Rendering)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; - int max_res_temp = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)) / 480 + 2; - if (max_res_temp == 3) - max_res_temp = 4; // At least allow 2x - int max_res = std::min(max_res_temp, (int)ARRAY_SIZE(deviceResolutions)); - UI::PopupMultiChoice *hwscale = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAndroidHwScale, gr->T("Display Resolution (HW scaler)"), deviceResolutions, 0, max_res, gr->GetName(), screenManager())); - hwscale->OnChoice.Handle(this, &GameSettingsScreen::OnHwScaleChange); // To refresh the display mode + if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_TV) { + static const char *deviceResolutions[] = { "Native device resolution", "Auto (same as Rendering)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; + int max_res_temp = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)) / 480 + 2; + if (max_res_temp == 3) + max_res_temp = 4; // At least allow 2x + int max_res = std::min(max_res_temp, (int)ARRAY_SIZE(deviceResolutions)); + UI::PopupMultiChoice *hwscale = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAndroidHwScale, gr->T("Display Resolution (HW scaler)"), deviceResolutions, 0, max_res, gr->GetName(), screenManager())); + hwscale->OnChoice.Handle(this, &GameSettingsScreen::OnHwScaleChange); // To refresh the display mode + } #endif #ifdef _WIN32 diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 39c5c7b66beb..18188a989936 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -224,6 +224,10 @@ std::string NativeQueryConfig(std::string query) { return std::string(g_Config.bImmersiveMode ? "1" : "0"); } else if (query == "hwScale") { int scale = g_Config.iAndroidHwScale; + // Override hw scale for TV type devices. + if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV) + scale = 0; + if (scale == 1) { // If g_Config.iInternalResolution is also set to Auto (1), we fall back to "Device resolution" (0). It works out. scale = g_Config.iInternalResolution;