diff --git a/Core/Config.cpp b/Core/Config.cpp index 95c69afbd6..d95ed2ad7c 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -360,6 +360,28 @@ static bool DefaultTimerHack() { #endif } +static int DefaultAndroidHwScale() { +#ifdef ANDROID + // Get the real resolution as passed in during startup, not dp_xres and stuff + int xres = System_GetPropertyInt(SYSPROP_DISPLAY_XRES); + int yres = System_GetPropertyInt(SYSPROP_DISPLAY_YRES); + + if (xres < 960) { + // Smaller than the PSP*2, let's go native. + return 0; + } else if (xres <= 480 * 3) { // 720p xres + // Small-ish screen, we should default to 2x + return 2 + 1; + } else { + // Large or very large screen. Default to 3x psp resolution. + return 3 + 1; + } + return 0; +#else + return 1; +#endif +} + static ConfigSetting graphicsSettings[] = { ConfigSetting("ShowFPSCounter", &g_Config.iShowFPSCounter, 0), ReportedConfigSetting("RenderingMode", &g_Config.iRenderingMode, &DefaultRenderingMode), @@ -368,7 +390,7 @@ static ConfigSetting graphicsSettings[] = { ReportedConfigSetting("SoftwareSkinning", &g_Config.bSoftwareSkinning, true), ReportedConfigSetting("TextureFiltering", &g_Config.iTexFiltering, 1), ReportedConfigSetting("InternalResolution", &g_Config.iInternalResolution, &DefaultInternalResolution), - ReportedConfigSetting("AndroidHwScale", &g_Config.iAndroidHwScale, 1), + ReportedConfigSetting("AndroidHwScale", &g_Config.iAndroidHwScale, &DefaultAndroidHwScale), ReportedConfigSetting("FrameSkip", &g_Config.iFrameSkip, 0), ReportedConfigSetting("AutoFrameSkip", &g_Config.bAutoFrameSkip, false), ReportedConfigSetting("FrameRate", &g_Config.iFpsLimit, 0), diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index ea2a9ec19f..261f7d309b 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -443,10 +443,23 @@ UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) { return UI::EVENT_DONE; } +static void RecreateActivity() { + const int SYSTEM_JELLYBEAN = 16; + if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= SYSTEM_JELLYBEAN) { + System_SendMessage("recreate", ""); + } else { + I18NCategory *gs = GetI18NCategory("Graphics"); + System_SendMessage("toast", gs->T("Must Restart", "You must restart PPSSPP for this change to take effect")); + } +} + UI::EventReturn GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) { System_SendMessage("immersive", ""); - if (g_Config.iAndroidHwScale != 0) - System_SendMessage("recreate", ""); + const int SYSTEM_JELLYBEAN = 16; + // recreate doesn't seem reliable on earlier versions. + if (g_Config.iAndroidHwScale != 0) { + RecreateActivity(); + } return UI::EVENT_DONE; } @@ -500,14 +513,14 @@ UI::EventReturn GameSettingsScreen::OnResolutionChange(UI::EventParams &e) { gpu->Resized(); } if (g_Config.iAndroidHwScale == 1) { - System_SendMessage("recreate", ""); + RecreateActivity(); } Reporting::UpdateConfig(); return UI::EVENT_DONE; } UI::EventReturn GameSettingsScreen::OnHwScaleChange(UI::EventParams &e) { - System_SendMessage("recreate", ""); + RecreateActivity(); return UI::EVENT_DONE; } diff --git a/android/src/org/ppsspp/ppsspp/PpssppActivity.java b/android/src/org/ppsspp/ppsspp/PpssppActivity.java index be25171910..4248952d1b 100644 --- a/android/src/org/ppsspp/ppsspp/PpssppActivity.java +++ b/android/src/org/ppsspp/ppsspp/PpssppActivity.java @@ -91,4 +91,4 @@ public class PpssppActivity extends NativeActivity { } correctRatio(sz, (float)scale); } -} \ No newline at end of file +} \ No newline at end of file diff --git a/native b/native index 1d77b94355..a4a17415a7 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 1d77b9435562e67d2814db99c89a752febd6dbe4 +Subproject commit a4a17415a7f12d15eb37f57181df97d46e239531