mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Windows: Hook up the UI scale setting. Need a manual resize to update.
This commit is contained in:
parent
6f1358755c
commit
852018e899
6 changed files with 15 additions and 1 deletions
|
@ -341,6 +341,8 @@ static const ConfigSetting generalSettings[] = {
|
|||
ConfigSetting("RunBehindPauseMenu", &g_Config.bRunBehindPauseMenu, false, CfgFlag::DEFAULT),
|
||||
|
||||
ConfigSetting("ShowGPOLEDs", &g_Config.bShowGPOLEDs, false, CfgFlag::PER_GAME),
|
||||
|
||||
ConfigSetting("UIScaleFactor", &g_Config.iUIScaleFactor, false, CfgFlag::DEFAULT),
|
||||
};
|
||||
|
||||
static bool DefaultSasThread() {
|
||||
|
@ -2151,3 +2153,7 @@ int MultiplierToVolume100(float multiplier) {
|
|||
}
|
||||
return (int)(powf(multiplier, 1.0f / 1.75f) * 100.f + 0.5f);
|
||||
}
|
||||
|
||||
float UIScaleFactorToMultiplier(int factor) {
|
||||
return powf(2.0f, (float)factor / 8.0f);
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ public:
|
|||
int iMemStickSizeGB;
|
||||
bool bLoadPlugins;
|
||||
int iAskForExitConfirmationAfterSeconds;
|
||||
int iUIScaleFactor; // In 8ths of powers of two.
|
||||
|
||||
int iScreenRotation; // The rotation angle of the PPSSPP UI. Only supported on Android and possibly other mobile platforms.
|
||||
int iInternalScreenRotation; // The internal screen rotation angle. Useful for vertical SHMUPs and similar.
|
||||
|
|
|
@ -43,6 +43,8 @@ float Volume100ToMultiplier(int volume);
|
|||
// Used for migration from the old settings.
|
||||
int MultiplierToVolume100(float multiplier);
|
||||
|
||||
float UIScaleFactorToMultiplier(int factor);
|
||||
|
||||
struct ConfigTouchPos {
|
||||
float x;
|
||||
float y;
|
||||
|
|
|
@ -1128,6 +1128,8 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
|
|||
});
|
||||
#endif
|
||||
|
||||
PopupSliderChoice *uiScale = systemSettings->Add(new PopupSliderChoice(&g_Config.iUIScaleFactor, -8, 8, 0, "UI scale factor (DPI adjustment)", screenManager()));
|
||||
|
||||
const Path bgPng = GetSysDirectory(DIRECTORY_SYSTEM) / "background.png";
|
||||
const Path bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) / "background.jpg";
|
||||
if (File::Exists(bgPng) || File::Exists(bgJpg)) {
|
||||
|
|
|
@ -1518,6 +1518,7 @@ static bool IsWindowSmall(int pixelWidth, int pixelHeight) {
|
|||
}
|
||||
|
||||
bool Native_UpdateScreenScale(int pixel_width, int pixel_height, float customScale) {
|
||||
_dbg_assert_(customScale > 0.1f);
|
||||
float g_logical_dpi = System_GetPropertyFloat(SYSPROP_DISPLAY_LOGICAL_DPI);
|
||||
float dpi = System_GetPropertyFloat(SYSPROP_DISPLAY_DPI);
|
||||
|
||||
|
@ -1531,6 +1532,8 @@ bool Native_UpdateScreenScale(int pixel_width, int pixel_height, float customSca
|
|||
bool smallWindow = IsWindowSmall(pixel_width, pixel_height);
|
||||
if (smallWindow) {
|
||||
customScale *= 0.5f;
|
||||
} else {
|
||||
customScale = UIScaleFactorToMultiplier(g_Config.iUIScaleFactor);
|
||||
}
|
||||
|
||||
if (g_display.Recalculate(pixel_width, pixel_height, g_logical_dpi / dpi, customScale)) {
|
||||
|
|
|
@ -298,7 +298,7 @@ namespace MainWindow
|
|||
|
||||
DEBUG_LOG(Log::System, "Pixel width/height: %dx%d", PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
|
||||
|
||||
if (Native_UpdateScreenScale(width, height, 1.0f)) {
|
||||
if (Native_UpdateScreenScale(width, height, UIScaleFactorToMultiplier(g_Config.iUIScaleFactor))) {
|
||||
System_PostUIMessage(UIMessage::GPU_DISPLAY_RESIZED);
|
||||
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue