mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Clean OSD messages code
Some OSD messages were displayed in RenderBase.cpp using global variables and some code duplicated
in OnScreeDisplay.cpp.
Now all messages are displayed using functions in the OSD namepace.
* OSDChoice and OSDTime global variables are gone
* All OSD logic is kept at the same place
* All messages are properly aligned
* Clean characters for all OSD messages
Original commit:
commit f0ec61c057
Author: Aestek <thib.gilles@gmail.com>
Date: Sun Aug 7 16:08:41 2016 +0200
This commit is contained in:
@ -1448,14 +1448,16 @@ void CFrame::ParseHotkeys()
|
||||
|
||||
if (IsHotkey(HK_INCREASE_IR))
|
||||
{
|
||||
OSDChoice = 1;
|
||||
++g_Config.iEFBScale;
|
||||
OSDPrintInternalResolution();
|
||||
}
|
||||
if (IsHotkey(HK_DECREASE_IR))
|
||||
{
|
||||
OSDChoice = 1;
|
||||
if (--g_Config.iEFBScale < SCALE_AUTO)
|
||||
{
|
||||
g_Config.iEFBScale = SCALE_AUTO;
|
||||
}
|
||||
OSDPrintInternalResolution();
|
||||
}
|
||||
if (IsHotkey(HK_TOGGLE_CROP))
|
||||
{
|
||||
@ -1463,28 +1465,26 @@ void CFrame::ParseHotkeys()
|
||||
}
|
||||
if (IsHotkey(HK_TOGGLE_AR))
|
||||
{
|
||||
OSDChoice = 2;
|
||||
// Toggle aspect ratio
|
||||
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
|
||||
OSDPrintAspectRatio();
|
||||
}
|
||||
if (IsHotkey(HK_TOGGLE_EFBCOPIES))
|
||||
{
|
||||
OSDChoice = 3;
|
||||
// Toggle EFB copies between EFB2RAM and EFB2Texture
|
||||
g_Config.bSkipEFBCopyToRam = !g_Config.bSkipEFBCopyToRam;
|
||||
OSDPrintEFB();
|
||||
}
|
||||
if (IsHotkey(HK_TOGGLE_FOG))
|
||||
{
|
||||
OSDChoice = 4;
|
||||
g_Config.bDisableFog = !g_Config.bDisableFog;
|
||||
OSDPrintFog();
|
||||
}
|
||||
if (IsHotkey(HK_TOGGLE_TEXTURES))
|
||||
g_Config.bHiresTextures = !g_Config.bHiresTextures;
|
||||
Core::SetIsThrottlerTempDisabled(IsHotkey(HK_TOGGLE_THROTTLE, true));
|
||||
if (IsHotkey(HK_DECREASE_EMULATION_SPEED))
|
||||
{
|
||||
OSDChoice = 5;
|
||||
|
||||
if (SConfig::GetInstance().m_EmulationSpeed <= 0.0f)
|
||||
SConfig::GetInstance().m_EmulationSpeed = 1.0f;
|
||||
else if (SConfig::GetInstance().m_EmulationSpeed >= 0.2f)
|
||||
@ -1495,17 +1495,19 @@ void CFrame::ParseHotkeys()
|
||||
if (SConfig::GetInstance().m_EmulationSpeed >= 0.95f &&
|
||||
SConfig::GetInstance().m_EmulationSpeed <= 1.05f)
|
||||
SConfig::GetInstance().m_EmulationSpeed = 1.0f;
|
||||
|
||||
OSDPrintEmulationSpeed();
|
||||
}
|
||||
if (IsHotkey(HK_INCREASE_EMULATION_SPEED))
|
||||
{
|
||||
OSDChoice = 5;
|
||||
|
||||
if (SConfig::GetInstance().m_EmulationSpeed > 0.0f)
|
||||
SConfig::GetInstance().m_EmulationSpeed += 0.1f;
|
||||
|
||||
if (SConfig::GetInstance().m_EmulationSpeed >= 0.95f &&
|
||||
SConfig::GetInstance().m_EmulationSpeed <= 1.05f)
|
||||
SConfig::GetInstance().m_EmulationSpeed = 1.0f;
|
||||
|
||||
OSDPrintEmulationSpeed();
|
||||
}
|
||||
if (IsHotkey(HK_SAVE_STATE_SLOT_SELECTED))
|
||||
{
|
||||
@ -1720,3 +1722,79 @@ void CFrame::HandleSignal(wxTimerEvent& event)
|
||||
return;
|
||||
Close();
|
||||
}
|
||||
|
||||
void CFrame::OSDPrintInternalResolution()
|
||||
{
|
||||
std::string text;
|
||||
switch (g_Config.iEFBScale)
|
||||
{
|
||||
case SCALE_AUTO:
|
||||
text = "Auto (fractional)";
|
||||
break;
|
||||
case SCALE_AUTO_INTEGRAL:
|
||||
text = "Auto (integral)";
|
||||
break;
|
||||
case SCALE_1X:
|
||||
text = "Native";
|
||||
break;
|
||||
case SCALE_1_5X:
|
||||
text = "1.5x";
|
||||
break;
|
||||
case SCALE_2X:
|
||||
text = "2x";
|
||||
break;
|
||||
case SCALE_2_5X:
|
||||
text = "2.5x";
|
||||
break;
|
||||
default:
|
||||
text = StringFromFormat("%dx", g_Config.iEFBScale - 3);
|
||||
break;
|
||||
}
|
||||
|
||||
OSD::AddMessage("Internal Resolution: " + text);
|
||||
}
|
||||
|
||||
void CFrame::OSDPrintAspectRatio()
|
||||
{
|
||||
std::string text;
|
||||
switch (g_Config.iAspectRatio)
|
||||
{
|
||||
case ASPECT_AUTO:
|
||||
text = "Auto";
|
||||
break;
|
||||
case ASPECT_STRETCH:
|
||||
text = "Stretch";
|
||||
break;
|
||||
case ASPECT_ANALOG:
|
||||
text = "Force 4:3";
|
||||
break;
|
||||
case ASPECT_ANALOG_WIDE:
|
||||
text = "Force 16:9";
|
||||
break;
|
||||
}
|
||||
|
||||
OSD::AddMessage("Aspect Ratio: " + text + (g_Config.bCrop ? " (crop)" : ""));
|
||||
}
|
||||
|
||||
void CFrame::OSDPrintEFB()
|
||||
{
|
||||
OSD::AddMessage(std::string("Copy EFB: ") +
|
||||
(g_Config.bSkipEFBCopyToRam ? "to Texture" : "to RAM"));
|
||||
}
|
||||
|
||||
void CFrame::OSDPrintFog()
|
||||
{
|
||||
OSD::AddMessage(std::string("Fog: ") + (g_Config.bDisableFog ? "Disabled" : "Enabled"));
|
||||
}
|
||||
|
||||
void CFrame::OSDPrintEmulationSpeed()
|
||||
{
|
||||
std::string text = "Speed Limit: ";
|
||||
|
||||
if (SConfig::GetInstance().m_EmulationSpeed <= 0)
|
||||
text += "Unlimited";
|
||||
else
|
||||
text += StringFromFormat("%li%%", std::lround(SConfig::GetInstance().m_EmulationSpeed * 100.f));
|
||||
|
||||
OSD::AddMessage(text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user