Remove most uses of StringFromFormat in favor of fmt

This commit is contained in:
Pokechu22
2022-10-11 19:21:51 -07:00
parent a5fa95adfd
commit f9fe25291d
12 changed files with 105 additions and 89 deletions

View File

@ -7,6 +7,8 @@
#include <cmath>
#include <thread>
#include <fmt/format.h>
#include <QApplication>
#include <QCoreApplication>
@ -367,7 +369,7 @@ void HotkeyScheduler::Run()
OSD::AddMessage("Internal Resolution: Native");
break;
default:
OSD::AddMessage(StringFromFormat("Internal Resolution: %dx", g_Config.iEFBScale));
OSD::AddMessage(fmt::format("Internal Resolution: {}x", g_Config.iEFBScale));
break;
}
};
@ -415,20 +417,19 @@ void HotkeyScheduler::Run()
{
const bool new_value = !Config::Get(Config::GFX_HACK_EFB_ACCESS_ENABLE);
Config::SetCurrent(Config::GFX_HACK_EFB_ACCESS_ENABLE, new_value);
OSD::AddMessage(
StringFromFormat("%s EFB Access from CPU", new_value ? "Skip" : "Don't skip"));
OSD::AddMessage(fmt::format("{} EFB Access from CPU", new_value ? "Skip" : "Don't skip"));
}
if (IsHotkey(HK_TOGGLE_EFBCOPIES))
{
const bool new_value = !Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
Config::SetCurrent(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM, new_value);
OSD::AddMessage(StringFromFormat("Copy EFB: %s", new_value ? "to Texture" : "to RAM"));
OSD::AddMessage(fmt::format("Copy EFB: {}", new_value ? "to Texture" : "to RAM"));
}
auto ShowXFBCopies = []() {
OSD::AddMessage(StringFromFormat(
"Copy XFB: %s%s", Config::Get(Config::GFX_HACK_IMMEDIATE_XFB) ? " (Immediate)" : "",
OSD::AddMessage(fmt::format(
"Copy XFB: {}{}", Config::Get(Config::GFX_HACK_IMMEDIATE_XFB) ? " (Immediate)" : "",
Config::Get(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM) ? "to Texture" : "to RAM"));
};
@ -448,7 +449,7 @@ void HotkeyScheduler::Run()
{
const bool new_value = !Config::Get(Config::GFX_DISABLE_FOG);
Config::SetCurrent(Config::GFX_DISABLE_FOG, new_value);
OSD::AddMessage(StringFromFormat("Fog: %s", new_value ? "Enabled" : "Disabled"));
OSD::AddMessage(fmt::format("Fog: {}", new_value ? "Enabled" : "Disabled"));
}
if (IsHotkey(HK_TOGGLE_DUMPTEXTURES))
@ -461,10 +462,9 @@ void HotkeyScheduler::Run()
auto ShowEmulationSpeed = []() {
const float emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
OSD::AddMessage(
emulation_speed <= 0 ?
"Speed Limit: Unlimited" :
StringFromFormat("Speed Limit: %li%%", std::lround(emulation_speed * 100.f)));
OSD::AddMessage(emulation_speed <= 0 ?
"Speed Limit: Unlimited" :
fmt::format("Speed Limit: {}%", std::lround(emulation_speed * 100.f)));
};
if (IsHotkey(HK_DECREASE_EMULATION_SPEED))
@ -569,7 +569,7 @@ void HotkeyScheduler::Run()
{
const bool new_value = !Config::Get(Config::FREE_LOOK_ENABLED);
Config::SetCurrent(Config::FREE_LOOK_ENABLED, new_value);
OSD::AddMessage(StringFromFormat("Free Look: %s", new_value ? "Enabled" : "Disabled"));
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
}
// Savestates