mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Detect screen size and choose resolution defaults accordingly.
Also prevent recreate on older Android versions where it doesn't seem reliable.
This commit is contained in:
parent
b03460c169
commit
0986f27f33
4 changed files with 42 additions and 7 deletions
|
@ -360,6 +360,28 @@ static bool DefaultTimerHack() {
|
||||||
#endif
|
#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[] = {
|
static ConfigSetting graphicsSettings[] = {
|
||||||
ConfigSetting("ShowFPSCounter", &g_Config.iShowFPSCounter, 0),
|
ConfigSetting("ShowFPSCounter", &g_Config.iShowFPSCounter, 0),
|
||||||
ReportedConfigSetting("RenderingMode", &g_Config.iRenderingMode, &DefaultRenderingMode),
|
ReportedConfigSetting("RenderingMode", &g_Config.iRenderingMode, &DefaultRenderingMode),
|
||||||
|
@ -368,7 +390,7 @@ static ConfigSetting graphicsSettings[] = {
|
||||||
ReportedConfigSetting("SoftwareSkinning", &g_Config.bSoftwareSkinning, true),
|
ReportedConfigSetting("SoftwareSkinning", &g_Config.bSoftwareSkinning, true),
|
||||||
ReportedConfigSetting("TextureFiltering", &g_Config.iTexFiltering, 1),
|
ReportedConfigSetting("TextureFiltering", &g_Config.iTexFiltering, 1),
|
||||||
ReportedConfigSetting("InternalResolution", &g_Config.iInternalResolution, &DefaultInternalResolution),
|
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("FrameSkip", &g_Config.iFrameSkip, 0),
|
||||||
ReportedConfigSetting("AutoFrameSkip", &g_Config.bAutoFrameSkip, false),
|
ReportedConfigSetting("AutoFrameSkip", &g_Config.bAutoFrameSkip, false),
|
||||||
ReportedConfigSetting("FrameRate", &g_Config.iFpsLimit, 0),
|
ReportedConfigSetting("FrameRate", &g_Config.iFpsLimit, 0),
|
||||||
|
|
|
@ -443,10 +443,23 @@ UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) {
|
||||||
return UI::EVENT_DONE;
|
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) {
|
UI::EventReturn GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) {
|
||||||
System_SendMessage("immersive", "");
|
System_SendMessage("immersive", "");
|
||||||
if (g_Config.iAndroidHwScale != 0)
|
const int SYSTEM_JELLYBEAN = 16;
|
||||||
System_SendMessage("recreate", "");
|
// recreate doesn't seem reliable on earlier versions.
|
||||||
|
if (g_Config.iAndroidHwScale != 0) {
|
||||||
|
RecreateActivity();
|
||||||
|
}
|
||||||
return UI::EVENT_DONE;
|
return UI::EVENT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,14 +513,14 @@ UI::EventReturn GameSettingsScreen::OnResolutionChange(UI::EventParams &e) {
|
||||||
gpu->Resized();
|
gpu->Resized();
|
||||||
}
|
}
|
||||||
if (g_Config.iAndroidHwScale == 1) {
|
if (g_Config.iAndroidHwScale == 1) {
|
||||||
System_SendMessage("recreate", "");
|
RecreateActivity();
|
||||||
}
|
}
|
||||||
Reporting::UpdateConfig();
|
Reporting::UpdateConfig();
|
||||||
return UI::EVENT_DONE;
|
return UI::EVENT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::EventReturn GameSettingsScreen::OnHwScaleChange(UI::EventParams &e) {
|
UI::EventReturn GameSettingsScreen::OnHwScaleChange(UI::EventParams &e) {
|
||||||
System_SendMessage("recreate", "");
|
RecreateActivity();
|
||||||
return UI::EVENT_DONE;
|
return UI::EVENT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
native
2
native
|
@ -1 +1 @@
|
||||||
Subproject commit 1d77b9435562e67d2814db99c89a752febd6dbe4
|
Subproject commit a4a17415a7f12d15eb37f57181df97d46e239531
|
Loading…
Add table
Reference in a new issue