diff options
Diffstat (limited to 'Source/Core/UICommon/USBUtils.cpp')
| -rw-r--r-- | Source/Core/UICommon/USBUtils.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/Core/UICommon/USBUtils.cpp b/Source/Core/UICommon/USBUtils.cpp index fe7ad51344..b9860636f1 100644 --- a/Source/Core/UICommon/USBUtils.cpp +++ b/Source/Core/UICommon/USBUtils.cpp @@ -2,19 +2,22 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "UICommon/USBUtils.h" + +#include <string_view> + +#include <fmt/format.h> #ifdef __LIBUSB__ #include <libusb.h> #endif #include "Common/CommonTypes.h" -#include "Common/StringUtil.h" #include "Core/LibusbUtils.h" -#include "UICommon/USBUtils.h" // Because opening and getting the device name from devices is slow, especially on Windows // with usbdk, we cannot do that for every single device. We should however still show // device names for known Wii peripherals. -static const std::map<std::pair<u16, u16>, std::string> s_wii_peripherals = {{ +static const std::map<std::pair<u16, u16>, std::string_view> s_wii_peripherals{{ {{0x046d, 0x0a03}, "Logitech Microphone"}, {{0x057e, 0x0308}, "Wii Speak"}, {{0x057e, 0x0309}, "Nintendo USB Microphone"}, @@ -54,7 +57,7 @@ std::map<std::pair<u16, u16>, std::string> GetInsertedDevices() std::string GetDeviceName(const std::pair<u16, u16> vid_pid) { const auto iter = s_wii_peripherals.find(vid_pid); - const std::string device_name = iter == s_wii_peripherals.cend() ? "Unknown" : iter->second; - return StringFromFormat("%04x:%04x - %s", vid_pid.first, vid_pid.second, device_name.c_str()); + const std::string_view device_name = iter == s_wii_peripherals.cend() ? "Unknown" : iter->second; + return fmt::format("{:04x}:{:04x} - {}", vid_pid.first, vid_pid.second, device_name); } } // namespace USBUtils |
