[Glide64] Move aspect ratio calc to settings
This commit is contained in:
parent
c98923d2af
commit
5071861d13
|
@ -202,32 +202,7 @@ void _ChangeSize()
|
||||||
|
|
||||||
void ChangeSize()
|
void ChangeSize()
|
||||||
{
|
{
|
||||||
switch (g_settings->aspectmode)
|
g_settings->UpdateAspectRatio();
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
_ChangeSize();
|
_ChangeSize();
|
||||||
rdp.offset_x = (g_settings->scr_res_x - g_settings->res_x) / 2.0f;
|
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;
|
float offset_y = (g_settings->scr_res_y - g_settings->res_y) / 2.0f;
|
||||||
|
|
|
@ -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()
|
void CSettings::ReadSettings()
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
|
|
@ -179,6 +179,7 @@ public:
|
||||||
|
|
||||||
void ReadGameSettings(const char * name);
|
void ReadGameSettings(const char * name);
|
||||||
void WriteSettings(void);
|
void WriteSettings(void);
|
||||||
|
void UpdateAspectRatio(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ReadSettings();
|
void ReadSettings();
|
||||||
|
|
Loading…
Reference in New Issue