diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index d4429ce9b..3d972ddd2 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -202,32 +202,7 @@ void _ChangeSize() void ChangeSize() { - switch (g_settings->aspectmode) - { - case 0: //4:3 - if (g_settings->scr_res_x >= g_settings->scr_res_y * 4.0f / 3.0f) { - g_settings->res_y = g_settings->scr_res_y; - g_settings->res_x = (uint32_t)(g_settings->res_y * 4.0f / 3.0f); - } - else { - g_settings->res_x = g_settings->scr_res_x; - g_settings->res_y = (uint32_t)(g_settings->res_x / 4.0f * 3.0f); - } - break; - case 1: //16:9 - if (g_settings->scr_res_x >= g_settings->scr_res_y * 16.0f / 9.0f) { - g_settings->res_y = g_settings->scr_res_y; - g_settings->res_x = (uint32_t)(g_settings->res_y * 16.0f / 9.0f); - } - else { - g_settings->res_x = g_settings->scr_res_x; - g_settings->res_y = (uint32_t)(g_settings->res_x / 16.0f * 9.0f); - } - break; - default: //stretch or original - g_settings->res_x = g_settings->scr_res_x; - g_settings->res_y = g_settings->scr_res_y; - } + g_settings->UpdateAspectRatio(); _ChangeSize(); rdp.offset_x = (g_settings->scr_res_x - g_settings->res_x) / 2.0f; float offset_y = (g_settings->scr_res_y - g_settings->res_y) / 2.0f; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 1c3e1f9b4..cd0592ea0 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -237,6 +237,39 @@ void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) } } +void CSettings::UpdateAspectRatio(void) +{ + switch (aspectmode) + { + case 0: //4:3 + if (scr_res_x >= scr_res_y * 4.0f / 3.0f) { + res_y = scr_res_y; + res_x = (uint32_t)(res_y * 4.0f / 3.0f); + } + else + { + res_x = scr_res_x; + res_y = (uint32_t)(res_x / 4.0f * 3.0f); + } + break; + case 1: //16:9 + if (scr_res_x >= scr_res_y * 16.0f / 9.0f) + { + res_y = scr_res_y; + res_x = (uint32_t)(res_y * 16.0f / 9.0f); + } + else + { + res_x = scr_res_x; + res_y = (uint32_t)(res_x / 16.0f * 9.0f); + } + break; + default: //stretch or original + res_x = scr_res_x; + res_y = scr_res_y; + } +} + void CSettings::ReadSettings() { #ifdef ANDROID diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 344f62d5d..045bcf329 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -179,6 +179,7 @@ public: void ReadGameSettings(const char * name); void WriteSettings(void); + void UpdateAspectRatio(void); private: void ReadSettings();