mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-09-11 21:06:22 -05:00
Replace string concatination with fmt::format
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user