summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2026-07-29 13:28:58 +1200
committerGitHub <noreply@github.com>2026-07-29 13:28:58 +1200
commit1c10b9e9abde05f2dc484e4f02e44e6e59fdd6ba (patch)
tree1237aeb6fe06b150c93235e4e8d0b42192338e32 /Source/Core/InputCommon/ControllerInterface
parent475f35e2faf1ef297350788f022953c6b31cc833 (diff)
parent08e183d322981c705ba9fc7f4f1476cc7e7e5f23 (diff)
Merge pull request #14738 from tygyh/Replace-concatination-with-stdformat
Replace string concatination with `fmt::format`
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h7
-rw-r--r--Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp6
2 files changed, 8 insertions, 5 deletions
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: