summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. Dystopia <jonis9898@hotmail.com>2026-07-19 20:30:21 +0200
committerDr. Dystopia <jonis9898@hotmail.com>2026-07-28 12:39:54 +0200
commit08e183d322981c705ba9fc7f4f1476cc7e7e5f23 (patch)
tree1f64ee7d6bfb5038e37fc2256f0a067f3a648700
parentd742aa8b4c4d052f7dceaa39022b1fe3996f1781 (diff)
Replace string concatination with `fmt::format`
-rw-r--r--Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp4
-rw-r--r--Source/Core/AudioCommon/WASAPIStream.cpp4
-rw-r--r--Source/Core/Core/IOS/USB/Emulated/LogitechMic.cpp4
-rw-r--r--Source/Core/DolphinQt/Debugger/RegisterWidget.cpp18
-rw-r--r--Source/Core/DolphinQt/HotkeyScheduler.cpp2
-rw-r--r--Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp4
-rw-r--r--Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h7
-rw-r--r--Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp6
-rw-r--r--Source/Core/InputCommon/InputProfile.cpp4
-rw-r--r--Source/Core/UICommon/GameFile.cpp5
-rw-r--r--Source/Core/UICommon/NetPlayIndex.cpp31
-rw-r--r--Source/Core/UpdaterCommon/UpdaterCommon.cpp5
12 files changed, 56 insertions, 38 deletions
diff --git a/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp b/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
index 4b61495f7f..3a72e5a1fd 100644
--- a/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
+++ b/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
@@ -3,6 +3,8 @@
#include <android/log.h>
+#include <fmt/format.h>
+
#include "Common/TraversalClient.h"
#include "Core/Boot/Boot.h"
#include "Core/Core.h"
@@ -34,7 +36,7 @@ std::string InetAddressToString(const Common::TraversalInetAddress& addr)
}
}
- return ip + ":" + std::to_string(ntohs(addr.port));
+ return fmt::format("{}:{}", ip, ntohs(addr.port));
}
const char* FailureReasonToString(Common::TraversalClient::FailureReason reason)
diff --git a/Source/Core/AudioCommon/WASAPIStream.cpp b/Source/Core/AudioCommon/WASAPIStream.cpp
index 174ffbc9cb..9571b175bc 100644
--- a/Source/Core/AudioCommon/WASAPIStream.cpp
+++ b/Source/Core/AudioCommon/WASAPIStream.cpp
@@ -15,6 +15,8 @@
#include <thread>
+#include <fmt/format.h>
+
#include "Common/Assert.h"
#include "Common/HRWrap.h"
#include "Common/Logging/Log.h"
@@ -110,7 +112,7 @@ static void ForEachNamedDevice(const std::function<bool(ComPtr<IMMDevice>, std::
{
ComPtr<IMMDevice> device;
devices->Item(i, &device);
- if (!HandleWinAPI("Failed to get device " + std::to_string(i), result))
+ if (!HandleWinAPI(fmt::format("Failed to get device {}", i), result))
continue;
ComPtr<IPropertyStore> device_properties;
diff --git a/Source/Core/Core/IOS/USB/Emulated/LogitechMic.cpp b/Source/Core/Core/IOS/USB/Emulated/LogitechMic.cpp
index fccdbd7939..63396632af 100644
--- a/Source/Core/Core/IOS/USB/Emulated/LogitechMic.cpp
+++ b/Source/Core/Core/IOS/USB/Emulated/LogitechMic.cpp
@@ -6,6 +6,8 @@
#include <algorithm>
#include <utility>
+#include <fmt/format.h>
+
#include "Core/Config/MainSettings.h"
#include "Core/HW/Memmap.h"
#include "Core/System.h"
@@ -81,7 +83,7 @@ private:
}
std::string GetCubebStreamName() const override
{
- return "Dolphin Emulated Logitech USB Microphone " + std::to_string(m_index);
+ return fmt::format("Dolphin Emulated Logitech USB Microphone {}", m_index);
}
s16 GetVolumeModifier() const override
{
diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
index de25c196a3..4f391f4698 100644
--- a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
@@ -12,6 +12,8 @@
#include <QTableWidget>
#include <QVBoxLayout>
+#include <fmt/format.h>
+
#include "Core/Core.h"
#include "Core/Debugger/CodeTrace.h"
#include "Core/HW/ProcessorInterface.h"
@@ -338,13 +340,13 @@ void RegisterWidget::PopulateTable()
{
// General purpose registers (int)
AddRegister(
- i, 0, RegisterType::gpr, "r" + std::to_string(i),
+ i, 0, RegisterType::gpr, fmt::format("r{}", i),
[this, i] { return m_system.GetPPCState().gpr[i]; },
[this, i](u64 value) { m_system.GetPPCState().gpr[i] = value; });
// Floating point registers (double)
AddRegister(
- i, 2, RegisterType::fpr, "f" + std::to_string(i),
+ i, 2, RegisterType::fpr, fmt::format("f{}", i),
[this, i] { return m_system.GetPPCState().ps[i].PS0AsU64(); },
[this, i](u64 value) { m_system.GetPPCState().ps[i].SetPS0(value); });
@@ -360,7 +362,7 @@ void RegisterWidget::PopulateTable()
{
// IBAT registers
AddRegister(
- i, 5, RegisterType::ibat, "IBAT" + std::to_string(i),
+ i, 5, RegisterType::ibat, fmt::format("IBAT{}", i),
[this, i] {
const auto& ppc_state = m_system.GetPPCState();
return (static_cast<u64>(ppc_state.spr[SPR_IBAT0U + i * 2]) << 32) +
@@ -368,7 +370,7 @@ void RegisterWidget::PopulateTable()
},
nullptr);
AddRegister(
- i + 4, 5, RegisterType::ibat, "IBAT" + std::to_string(4 + i),
+ i + 4, 5, RegisterType::ibat, fmt::format("IBAT{}", 4 + i),
[this, i] {
const auto& ppc_state = m_system.GetPPCState();
return (static_cast<u64>(ppc_state.spr[SPR_IBAT4U + i * 2]) << 32) +
@@ -378,7 +380,7 @@ void RegisterWidget::PopulateTable()
// DBAT registers
AddRegister(
- i + 8, 5, RegisterType::dbat, "DBAT" + std::to_string(i),
+ i + 8, 5, RegisterType::dbat, fmt::format("DBAT{}", i),
[this, i] {
const auto& ppc_state = m_system.GetPPCState();
return (static_cast<u64>(ppc_state.spr[SPR_DBAT0U + i * 2]) << 32) +
@@ -386,7 +388,7 @@ void RegisterWidget::PopulateTable()
},
nullptr);
AddRegister(
- i + 12, 5, RegisterType::dbat, "DBAT" + std::to_string(4 + i),
+ i + 12, 5, RegisterType::dbat, fmt::format("DBAT{}", 4 + i),
[this, i] {
const auto& ppc_state = m_system.GetPPCState();
return (static_cast<u64>(ppc_state.spr[SPR_DBAT4U + i * 2]) << 32) +
@@ -399,7 +401,7 @@ void RegisterWidget::PopulateTable()
{
// Graphics quantization registers
AddRegister(
- i + 16, 7, RegisterType::gqr, "GQR" + std::to_string(i),
+ i + 16, 7, RegisterType::gqr, fmt::format("GQR{}", i),
[this, i] { return m_system.GetPPCState().spr[SPR_GQR0 + i]; }, nullptr);
}
@@ -421,7 +423,7 @@ void RegisterWidget::PopulateTable()
{
// SR registers
AddRegister(
- i, 7, RegisterType::sr, "SR" + std::to_string(i),
+ i, 7, RegisterType::sr, fmt::format("SR{}", i),
[this, i] { return m_system.GetPPCState().sr[i]; },
[this, i](u64 value) {
m_system.GetPPCState().sr[i] = value;
diff --git a/Source/Core/DolphinQt/HotkeyScheduler.cpp b/Source/Core/DolphinQt/HotkeyScheduler.cpp
index 62f89c1d3b..478454ed5a 100644
--- a/Source/Core/DolphinQt/HotkeyScheduler.cpp
+++ b/Source/Core/DolphinQt/HotkeyScheduler.cpp
@@ -344,7 +344,7 @@ void HotkeyScheduler::Run()
OSD::AddMessage(std::string("Volume: ") +
(Config::Get(Config::MAIN_AUDIO_MUTED) ?
"Muted" :
- std::to_string(Config::Get(Config::MAIN_AUDIO_VOLUME)) + "%"));
+ fmt::format("{}%", Config::Get(Config::MAIN_AUDIO_VOLUME))));
};
// Volume
diff --git a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp
index 48a55dbef8..170208ddad 100644
--- a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp
+++ b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp
@@ -14,6 +14,8 @@
#include <QStyle>
#include <QVBoxLayout>
+#include <fmt/format.h>
+
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/MathUtil.h"
@@ -395,7 +397,7 @@ void WiiTASInputWindow::LoadExtensionAndMotionPlus()
{
Common::IniFile ini;
ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
- const std::string section_name = "Wiimote" + std::to_string(m_num + 1);
+ const std::string section_name = fmt::format("Wiimote{}", m_num + 1);
std::string extension;
ini.GetIfExists(section_name, "Extension", &extension);
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h
index 0a431866e7..a997437f61 100644
--- a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h
+++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h
@@ -7,6 +7,7 @@
#include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_haptic.h>
+#include <fmt/format.h>
#include "Common/MathUtil.h"
@@ -16,17 +17,17 @@ namespace
{
std::string GetLegacyButtonName(int index)
{
- return "Button " + std::to_string(index);
+ return fmt::format("Button {}", index);
}
std::string GetLegacyAxisName(int index, int range)
{
- return "Axis " + std::to_string(index) + (range < 0 ? '-' : '+');
+ return fmt::format("Axis {}{}", index, range < 0 ? '-' : '+');
}
std::string GetLegacyHatName(int index, int direction)
{
- return "Hat " + std::to_string(index) + ' ' + "NESW"[direction];
+ return fmt::format("Hat {} {}", index, "NESW"[direction]);
}
constexpr int GetDirectionFromHatMask(int mask)
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
index bb51d0026e..0f6730720f 100644
--- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
@@ -14,6 +14,8 @@
#include <sys/eventfd.h>
#include <unistd.h>
+#include <fmt/format.h>
+
#include "Common/Assert.h"
#include "Common/Flag.h"
#include "Common/Logging/Log.h"
@@ -114,7 +116,7 @@ protected:
}
}
- std::string GetIndexedName() const { return "Button " + std::to_string(m_index); }
+ std::string GetIndexedName() const { return fmt::format("Button {}", m_index); }
const u8 m_index;
};
@@ -184,7 +186,7 @@ public:
protected:
std::string GetIndexedName() const
{
- return "Axis " + std::to_string(m_index) + (m_range < 0 ? '-' : '+');
+ return fmt::format("Axis {}{}", m_index, m_range < 0 ? '-' : '+');
}
private:
diff --git a/Source/Core/InputCommon/InputProfile.cpp b/Source/Core/InputCommon/InputProfile.cpp
index f483e8a9c3..e1db4e8a46 100644
--- a/Source/Core/InputCommon/InputProfile.cpp
+++ b/Source/Core/InputCommon/InputProfile.cpp
@@ -133,7 +133,7 @@ void ProfileCycler::CycleProfile(CycleDirection cycle_direction, InputConfig* de
}
else
{
- Core::DisplayMessage("No controller found for index: " + std::to_string(controller_index),
+ Core::DisplayMessage(fmt::format("No controller found for index: {}", controller_index),
display_message_ms);
}
}
@@ -172,7 +172,7 @@ void ProfileCycler::CycleProfileForGame(CycleDirection cycle_direction,
}
else
{
- Core::DisplayMessage("No controller found for index: " + std::to_string(controller_index),
+ Core::DisplayMessage(fmt::format("No controller found for index: {}", controller_index),
display_message_ms);
}
}
diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp
index 818cf2b766..c24bb625f1 100644
--- a/Source/Core/UICommon/GameFile.cpp
+++ b/Source/Core/UICommon/GameFile.cpp
@@ -622,7 +622,7 @@ std::string GameFile::GetNetPlayName(const Core::TitleDatabase& title_database)
if (!GetGameID().empty())
info.push_back(GetGameID());
if (GetRevision() != 0)
- info.push_back("Revision " + std::to_string(GetRevision()));
+ info.push_back(fmt::format("Revision {}", GetRevision()));
const std::string name = GetName(title_database);
@@ -635,8 +635,7 @@ std::string GameFile::GetNetPlayName(const Core::TitleDatabase& title_database)
if (disc_number > 1 && !is_numbered_disc)
{
- std::string disc_text = "Disc ";
- info.push_back(disc_text + std::to_string(disc_number));
+ info.push_back(fmt::format("Disc {}", disc_number));
}
if (info.empty())
return name;
diff --git a/Source/Core/UICommon/NetPlayIndex.cpp b/Source/Core/UICommon/NetPlayIndex.cpp
index 1d4b5e0b8a..b6b228b702 100644
--- a/Source/Core/UICommon/NetPlayIndex.cpp
+++ b/Source/Core/UICommon/NetPlayIndex.cpp
@@ -8,6 +8,7 @@
#include <span>
#include <string>
+#include <fmt/format.h>
#include <picojson.h>
#include "Common/Common.h"
@@ -128,9 +129,12 @@ void NetPlayIndex::NotificationLoop()
{
Common::HttpRequest request;
auto response = request.Get(
- Config::Get(Config::NETPLAY_INDEX_URL) + "/v0/session/active?secret=" + m_secret +
- "&player_count=" + std::to_string(m_player_count) +
- "&game=" + request.EscapeComponent(m_game) + "&in_game=" + std::to_string(m_in_game),
+ fmt::format(
+ "{base}/v0/session/active?secret={secret}&player_count={player_count}&game={game}"
+ "&in_game={in_game}",
+ fmt::arg("base", Config::Get(Config::NETPLAY_INDEX_URL)), fmt::arg("secret", m_secret),
+ fmt::arg("player_count", m_player_count),
+ fmt::arg("game", request.EscapeComponent(m_game)), fmt::arg("in_game", m_in_game)),
{{"X-Is-Dolphin", "1"}}, Common::HttpRequest::AllowedReturnCodes::All);
if (!response)
@@ -162,16 +166,17 @@ bool NetPlayIndex::Add(const NetPlaySession& session)
{
Common::HttpRequest request;
auto response = request.Get(
- Config::Get(Config::NETPLAY_INDEX_URL) +
- "/v0/session/add?name=" + request.EscapeComponent(session.name) +
- "&region=" + request.EscapeComponent(session.region) +
- "&game=" + request.EscapeComponent(session.game_id) +
- "&password=" + std::to_string(session.has_password) + "&method=" + session.method +
- "&server_id=" + session.server_id + "&in_game=" + std::to_string(session.in_game) +
- "&port=" + std::to_string(session.port) + "&player_count=" +
- std::to_string(session.player_count) + "&version=" + Common::GetScmDescStr(),
- {{"X-Is-Dolphin", "1"}}, Common::HttpRequest::AllowedReturnCodes::All);
-
+ fmt::format("{base}/v0/session/add?name={name}&region={region}&game={game}"
+ "&password={password}&method={method}&server_id={server_id}&in_game={in_game}"
+ "&port={port}&player_count={player_count}&version={version}",
+ fmt::arg("base", Config::Get(Config::NETPLAY_INDEX_URL)),
+ fmt::arg("name", request.EscapeComponent(session.name)),
+ fmt::arg("region", request.EscapeComponent(session.region)),
+ fmt::arg("game", request.EscapeComponent(session.game_id)),
+ fmt::arg("password", session.has_password), fmt::arg("method", session.method),
+ fmt::arg("server_id", session.server_id), fmt::arg("in_game", session.in_game),
+ fmt::arg("port", session.port), fmt::arg("player_count", session.player_count),
+ fmt::arg("version", Common::GetScmDescStr())));
if (!response.has_value())
{
m_last_error = "NO_RESPONSE";
diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
index 8a400b21d0..f40fb880ca 100644
--- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp
+++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
@@ -10,6 +10,7 @@
#include <OptionParser.h>
#include <ed25519.h>
+#include <fmt/format.h>
#include <mbedtls/base64.h>
#include <mbedtls/sha256.h>
#include <zlib.h>
@@ -225,8 +226,8 @@ static bool DownloadContent(std::span<const TodoList::DownloadOp> to_download,
if (File::Exists(temp_path + DIR_SEP + hash_filename))
continue;
- UI::SetDescription("Downloading " + download.filename + "... (File " + std::to_string(i + 1) +
- " of " + std::to_string(to_download.size()) + ")");
+ UI::SetDescription(fmt::format("Downloading {}... (File {} of {})", download.filename, i + 1,
+ to_download.size()));
UI::SetCurrentMarquee(false);
// Add slashes where needed.