Misc: Swap most C format strings for fmt
This commit is contained in:
@ -80,20 +80,21 @@ static bool ReadTrack(CDImage* image, u8 track, MD5Digest* digest, ProgressCallb
|
||||
|
||||
std::string HashToString(const Hash& hash)
|
||||
{
|
||||
return StringUtil::StdStringFromFormat("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", hash[0],
|
||||
hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8],
|
||||
hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]);
|
||||
return fmt::format("{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}",
|
||||
hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8], hash[9], hash[10],
|
||||
hash[11], hash[12], hash[13], hash[14], hash[15]);
|
||||
}
|
||||
|
||||
std::optional<Hash> HashFromString(const std::string_view& str) {
|
||||
auto decoded = StringUtil::DecodeHex(str);
|
||||
if (decoded && decoded->size() == std::tuple_size_v<Hash>)
|
||||
{
|
||||
Hash result;
|
||||
std::copy(decoded->begin(), decoded->end(), result.begin());
|
||||
return result;
|
||||
}
|
||||
return std::nullopt;
|
||||
std::optional<Hash> HashFromString(const std::string_view& str)
|
||||
{
|
||||
auto decoded = StringUtil::DecodeHex(str);
|
||||
if (decoded && decoded->size() == std::tuple_size_v<Hash>)
|
||||
{
|
||||
Hash result;
|
||||
std::copy(decoded->begin(), decoded->end(), result.begin());
|
||||
return result;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool GetImageHash(CDImage* image, Hash* out_hash,
|
||||
|
||||
@ -876,7 +876,7 @@ std::string CDImagePBP::GetSubImageMetadata(u32 index, const std::string_view& t
|
||||
{
|
||||
const std::string* title = LookupStringSFOTableEntry("TITLE", m_sfo_table);
|
||||
if (title && !title->empty())
|
||||
return StringUtil::StdStringFromFormat("%s (Disc %u)", title->c_str(), index + 1);
|
||||
return fmt::format("{} (Disc {})", *title, index + 1);
|
||||
}
|
||||
|
||||
return CDImage::GetSubImageMetadata(index, type);
|
||||
|
||||
@ -36,11 +36,12 @@ CubebAudioStream::~CubebAudioStream()
|
||||
|
||||
void CubebAudioStream::LogCallback(const char* fmt, ...)
|
||||
{
|
||||
LargeString str;
|
||||
std::va_list ap;
|
||||
va_start(ap, fmt);
|
||||
std::string msg(StringUtil::StdStringFromFormatV(fmt, ap));
|
||||
str.format_va(fmt, ap);
|
||||
va_end(ap);
|
||||
Log_DevPrintf("(Cubeb): %s", msg.c_str());
|
||||
Log_DevPrint(str);
|
||||
}
|
||||
|
||||
void CubebAudioStream::DestroyContextAndStream()
|
||||
|
||||
@ -423,7 +423,7 @@ std::string D3D11Device::GetDriverInfo() const
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (SUCCEEDED(dxgi_adapter->GetDesc(&desc)))
|
||||
{
|
||||
ret += StringUtil::StdStringFromFormat("VID: 0x%04X PID: 0x%04X\n", desc.VendorId, desc.DeviceId);
|
||||
fmt::format_to(std::back_inserter(ret), "VID: 0x{:04X} PID: 0x{:04X}\n", desc.VendorId, desc.DeviceId);
|
||||
ret += StringUtil::WideStringToUTF8String(desc.Description);
|
||||
ret += "\n";
|
||||
|
||||
|
||||
@ -1039,7 +1039,7 @@ std::string D3D12Device::GetDriverInfo() const
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (m_adapter && SUCCEEDED(m_adapter->GetDesc(&desc)))
|
||||
{
|
||||
ret += StringUtil::StdStringFromFormat("VID: 0x%04X PID: 0x%04X\n", desc.VendorId, desc.DeviceId);
|
||||
fmt::format_to(std::back_inserter(ret), "VID: 0x{:04X} PID: 0x{:04X}\n", desc.VendorId, desc.DeviceId);
|
||||
ret += StringUtil::WideStringToUTF8String(desc.Description);
|
||||
ret += "\n";
|
||||
|
||||
|
||||
@ -635,7 +635,7 @@ bool GPUDevice::GetRequestedExclusiveFullscreenMode(u32* width, u32* height, flo
|
||||
|
||||
std::string GPUDevice::GetFullscreenModeString(u32 width, u32 height, float refresh_rate)
|
||||
{
|
||||
return StringUtil::StdStringFromFormat("%u x %u @ %f hz", width, height, refresh_rate);
|
||||
return fmt::format("{} x {} @ {} hz", width, height, refresh_rate);
|
||||
}
|
||||
|
||||
std::string GPUDevice::GetShaderDumpPath(const std::string_view& name)
|
||||
|
||||
@ -1691,10 +1691,7 @@ void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
if (s_file_selector_current_directory.empty())
|
||||
{
|
||||
for (std::string& root_path : FileSystem::GetRootDirectoryList())
|
||||
{
|
||||
s_file_selector_items.emplace_back(StringUtil::StdStringFromFormat(ICON_FA_FOLDER " %s", root_path.c_str()),
|
||||
std::move(root_path), false);
|
||||
}
|
||||
s_file_selector_items.emplace_back(fmt::format(ICON_FA_FOLDER " {}", root_path), std::move(root_path), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1722,12 +1719,12 @@ void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
|
||||
for (const FILESYSTEM_FIND_DATA& fd : results)
|
||||
{
|
||||
std::string full_path(StringUtil::StdStringFromFormat(
|
||||
"%s" FS_OSPATH_SEPARATOR_STR "%s", s_file_selector_current_directory.c_str(), fd.FileName.c_str()));
|
||||
std::string full_path =
|
||||
fmt::format("{}" FS_OSPATH_SEPARATOR_STR "{}", s_file_selector_current_directory, fd.FileName);
|
||||
|
||||
if (fd.Attributes & FILESYSTEM_FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
std::string title(StringUtil::StdStringFromFormat(ICON_FA_FOLDER " %s", fd.FileName.c_str()));
|
||||
std::string title = fmt::format(ICON_FA_FOLDER " {}", fd.FileName);
|
||||
s_file_selector_items.emplace_back(std::move(title), std::move(full_path), false);
|
||||
}
|
||||
else
|
||||
@ -1741,7 +1738,7 @@ void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string title(StringUtil::StdStringFromFormat(ICON_FA_FILE " %s", fd.FileName.c_str()));
|
||||
std::string title = fmt::format(ICON_FA_FILE " {}", fd.FileName);
|
||||
s_file_selector_items.emplace_back(std::move(title), std::move(full_path), true);
|
||||
}
|
||||
}
|
||||
@ -1770,7 +1767,7 @@ void ImGuiFullscreen::OpenFileSelector(const char* title, bool select_directory,
|
||||
|
||||
s_file_selector_open = true;
|
||||
s_file_selector_directory = select_directory;
|
||||
s_file_selector_title = StringUtil::StdStringFromFormat("%s##file_selector", title);
|
||||
s_file_selector_title = fmt::format("{}##file_selector", title);
|
||||
s_file_selector_callback = std::move(callback);
|
||||
s_file_selector_filters = std::move(filters);
|
||||
|
||||
@ -1894,7 +1891,7 @@ void ImGuiFullscreen::OpenChoiceDialog(const char* title, bool checkable, Choice
|
||||
|
||||
s_choice_dialog_open = true;
|
||||
s_choice_dialog_checkable = checkable;
|
||||
s_choice_dialog_title = StringUtil::StdStringFromFormat("%s##choice_dialog", title);
|
||||
s_choice_dialog_title = fmt::format("{}##choice_dialog", title);
|
||||
s_choice_dialog_options = std::move(options);
|
||||
s_choice_dialog_callback = std::move(callback);
|
||||
}
|
||||
|
||||
@ -141,13 +141,13 @@ std::string InputSource::ConvertGenericControllerKeyToString(InputBindingKey key
|
||||
modifier = "Full";
|
||||
break;
|
||||
}
|
||||
return StringUtil::StdStringFromFormat("%s-%u/%sAxis%u", InputManager::InputSourceToString(key.source_type),
|
||||
key.source_index, modifier, key.data);
|
||||
return fmt::format("{}-{}/{}Axis{}", InputManager::InputSourceToString(key.source_type),
|
||||
static_cast<u32>(key.source_index), modifier, key.data);
|
||||
}
|
||||
else if (key.source_subtype == InputSubclass::ControllerButton)
|
||||
{
|
||||
return StringUtil::StdStringFromFormat("%s%u/Button%u", InputManager::InputSourceToString(key.source_type),
|
||||
key.source_index, key.data);
|
||||
return fmt::format("{}{}/Button{}", InputManager::InputSourceToString(key.source_type),
|
||||
static_cast<u32>(key.source_index), key.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -261,7 +261,7 @@ std::vector<std::pair<std::string, std::string>> SDLInputSource::EnumerateDevice
|
||||
|
||||
for (const ControllerData& cd : m_controllers)
|
||||
{
|
||||
std::string id(StringUtil::StdStringFromFormat("SDL-%d", cd.player_id));
|
||||
std::string id = fmt::format("SDL-{}", cd.player_id);
|
||||
|
||||
const char* name = cd.game_controller ? SDL_GameControllerName(cd.game_controller) : SDL_JoystickName(cd.joystick);
|
||||
if (name)
|
||||
@ -407,41 +407,40 @@ std::string SDLInputSource::ConvertKeyToString(InputBindingKey key)
|
||||
(key.modifier == InputModifier::FullAxis ? "Full" : (key.modifier == InputModifier::Negate ? "-" : "+"));
|
||||
if (key.data < std::size(s_sdl_axis_names))
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("SDL-%u/%s%s", key.source_index, modifier, s_sdl_axis_names[key.data]);
|
||||
ret = fmt::format("SDL-{}/{}{}", static_cast<u32>(key.source_index), modifier, s_sdl_axis_names[key.data]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("SDL-%u/%sAxis%u%s", key.source_index, modifier,
|
||||
key.data - static_cast<u32>(std::size(s_sdl_axis_names)),
|
||||
key.invert ? "~" : "");
|
||||
ret = fmt::format("SDL-{}/{}Axis{}{}", static_cast<u32>(key.source_index), modifier,
|
||||
key.data - static_cast<u32>(std::size(s_sdl_axis_names)), key.invert ? "~" : "");
|
||||
}
|
||||
}
|
||||
else if (key.source_subtype == InputSubclass::ControllerButton)
|
||||
{
|
||||
if (key.data < std::size(s_sdl_button_names))
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("SDL-%u/%s", key.source_index, s_sdl_button_names[key.data]);
|
||||
ret = fmt::format("SDL-{}/{}", static_cast<u32>(key.source_index), s_sdl_button_names[key.data]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("SDL-%u/Button%u", key.source_index,
|
||||
key.data - static_cast<u32>(std::size(s_sdl_button_names)));
|
||||
ret = fmt::format("SDL-{}/Button{}", static_cast<u32>(key.source_index),
|
||||
key.data - static_cast<u32>(std::size(s_sdl_button_names)));
|
||||
}
|
||||
}
|
||||
else if (key.source_subtype == InputSubclass::ControllerHat)
|
||||
{
|
||||
const u32 hat_index = key.data / static_cast<u32>(std::size(s_sdl_hat_direction_names));
|
||||
const u32 hat_direction = key.data % static_cast<u32>(std::size(s_sdl_hat_direction_names));
|
||||
ret = StringUtil::StdStringFromFormat("SDL-%u/Hat%u%s", key.source_index, hat_index,
|
||||
s_sdl_hat_direction_names[hat_direction]);
|
||||
ret = fmt::format("SDL-{}/Hat{}{}", static_cast<u32>(key.source_index), hat_index,
|
||||
s_sdl_hat_direction_names[hat_direction]);
|
||||
}
|
||||
else if (key.source_subtype == InputSubclass::ControllerMotor)
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("SDL-%u/%sMotor", key.source_index, key.data ? "Large" : "Small");
|
||||
ret = fmt::format("SDL-{}/{}Motor", static_cast<u32>(key.source_index), key.data ? "Large" : "Small");
|
||||
}
|
||||
else if (key.source_subtype == InputSubclass::ControllerHaptic)
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("SDL-%u/Haptic", key.source_index);
|
||||
ret = fmt::format("SDL-{}/Haptic", static_cast<u32>(key.source_index));
|
||||
}
|
||||
}
|
||||
|
||||
@ -681,7 +680,7 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
|
||||
m_controllers.push_back(std::move(cd));
|
||||
|
||||
InputManager::OnInputDeviceConnected(StringUtil::StdStringFromFormat("SDL-%d", player_id), name);
|
||||
InputManager::OnInputDeviceConnected(fmt::format("SDL-{}", player_id), name);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -691,7 +690,7 @@ bool SDLInputSource::CloseDevice(int joystick_index)
|
||||
if (it == m_controllers.end())
|
||||
return false;
|
||||
|
||||
InputManager::OnInputDeviceDisconnected(StringUtil::StdStringFromFormat("SDL-%d", it->player_id));
|
||||
InputManager::OnInputDeviceDisconnected(fmt::format("SDL-{}", it->player_id));
|
||||
|
||||
if (it->haptic)
|
||||
SDL_HapticClose(it->haptic);
|
||||
@ -842,27 +841,27 @@ bool SDLInputSource::GetGenericBindingMapping(const std::string_view& device, Ge
|
||||
const GenericInputBinding negative = s_sdl_generic_binding_axis_mapping[i][0];
|
||||
const GenericInputBinding positive = s_sdl_generic_binding_axis_mapping[i][1];
|
||||
if (negative != GenericInputBinding::Unknown)
|
||||
mapping->emplace_back(negative, StringUtil::StdStringFromFormat("SDL-%d/-%s", pid, s_sdl_axis_names[i]));
|
||||
mapping->emplace_back(negative, fmt::format("SDL-{}/-{}", pid, s_sdl_axis_names[i]));
|
||||
|
||||
if (positive != GenericInputBinding::Unknown)
|
||||
mapping->emplace_back(positive, StringUtil::StdStringFromFormat("SDL-%d/+%s", pid, s_sdl_axis_names[i]));
|
||||
mapping->emplace_back(positive, fmt::format("SDL-{}/+{}", pid, s_sdl_axis_names[i]));
|
||||
}
|
||||
for (u32 i = 0; i < std::size(s_sdl_generic_binding_button_mapping); i++)
|
||||
{
|
||||
const GenericInputBinding binding = s_sdl_generic_binding_button_mapping[i];
|
||||
if (binding != GenericInputBinding::Unknown)
|
||||
mapping->emplace_back(binding, StringUtil::StdStringFromFormat("SDL-%d/%s", pid, s_sdl_button_names[i]));
|
||||
mapping->emplace_back(binding, fmt::format("SDL-{}/{}", pid, s_sdl_button_names[i]));
|
||||
}
|
||||
|
||||
if (it->use_game_controller_rumble || it->haptic_left_right_effect)
|
||||
{
|
||||
mapping->emplace_back(GenericInputBinding::SmallMotor, StringUtil::StdStringFromFormat("SDL-%d/SmallMotor", pid));
|
||||
mapping->emplace_back(GenericInputBinding::LargeMotor, StringUtil::StdStringFromFormat("SDL-%d/LargeMotor", pid));
|
||||
mapping->emplace_back(GenericInputBinding::SmallMotor, fmt::format("SDL-{}/SmallMotor", pid));
|
||||
mapping->emplace_back(GenericInputBinding::LargeMotor, fmt::format("SDL-{}/LargeMotor", pid));
|
||||
}
|
||||
else
|
||||
{
|
||||
mapping->emplace_back(GenericInputBinding::SmallMotor, StringUtil::StdStringFromFormat("SDL-%d/Haptic", pid));
|
||||
mapping->emplace_back(GenericInputBinding::LargeMotor, StringUtil::StdStringFromFormat("SDL-%d/Haptic", pid));
|
||||
mapping->emplace_back(GenericInputBinding::SmallMotor, fmt::format("SDL-{}/Haptic", pid));
|
||||
mapping->emplace_back(GenericInputBinding::LargeMotor, fmt::format("SDL-{}/Haptic", pid));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -1982,8 +1982,8 @@ std::string VulkanDevice::GetDriverInfo() const
|
||||
if (m_optional_extensions.vk_khr_driver_properties)
|
||||
{
|
||||
const VkPhysicalDeviceDriverProperties& props = m_device_driver_properties;
|
||||
ret = StringUtil::StdStringFromFormat(
|
||||
"Driver %u.%u.%u\nVulkan %u.%u.%u\nConformance Version %u.%u.%u.%u\n%s\n%s\n%s", VK_VERSION_MAJOR(driver_version),
|
||||
ret = fmt::format(
|
||||
"Driver {}.{}.{}\nVulkan {}.{}.{}\nConformance Version {}.{}.{}.{}\n{}\n{}\n{}", VK_VERSION_MAJOR(driver_version),
|
||||
VK_VERSION_MINOR(driver_version), VK_VERSION_PATCH(driver_version), VK_API_VERSION_MAJOR(api_version),
|
||||
VK_API_VERSION_MINOR(api_version), VK_API_VERSION_PATCH(api_version), props.conformanceVersion.major,
|
||||
props.conformanceVersion.minor, props.conformanceVersion.subminor, props.conformanceVersion.patch,
|
||||
@ -1991,10 +1991,10 @@ std::string VulkanDevice::GetDriverInfo() const
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("Driver %u.%u.%u\nVulkan %u.%u.%u\n%s", VK_VERSION_MAJOR(driver_version),
|
||||
VK_VERSION_MINOR(driver_version), VK_VERSION_PATCH(driver_version),
|
||||
VK_API_VERSION_MAJOR(api_version), VK_API_VERSION_MINOR(api_version),
|
||||
VK_API_VERSION_PATCH(api_version), m_device_properties.deviceName);
|
||||
ret =
|
||||
fmt::format("Driver {}.{}.{}\nVulkan {}.{}.{}\n{}", VK_VERSION_MAJOR(driver_version),
|
||||
VK_VERSION_MINOR(driver_version), VK_VERSION_PATCH(driver_version), VK_API_VERSION_MAJOR(api_version),
|
||||
VK_API_VERSION_MINOR(api_version), VK_API_VERSION_PATCH(api_version), m_device_properties.deviceName);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@ -215,8 +215,7 @@ std::vector<std::pair<std::string, std::string>> XInputSource::EnumerateDevices(
|
||||
if (!m_controllers[i].connected)
|
||||
continue;
|
||||
|
||||
ret.emplace_back(StringUtil::StdStringFromFormat("XInput-%u", i),
|
||||
StringUtil::StdStringFromFormat("XInput Controller %u", i));
|
||||
ret.emplace_back(fmt::format("XInput-{}", i), fmt::format("XInput Controller {}", i));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -297,15 +296,15 @@ std::string XInputSource::ConvertKeyToString(InputBindingKey key)
|
||||
if (key.source_subtype == InputSubclass::ControllerAxis && key.data < std::size(s_axis_names))
|
||||
{
|
||||
const char modifier = key.modifier == InputModifier::Negate ? '-' : '+';
|
||||
ret = StringUtil::StdStringFromFormat("XInput-%u/%c%s", key.source_index, modifier, s_axis_names[key.data]);
|
||||
ret = fmt::format("XInput-{}/{}{}", static_cast<u32>(key.source_index), modifier, s_axis_names[key.data]);
|
||||
}
|
||||
else if (key.source_subtype == InputSubclass::ControllerButton && key.data < std::size(s_button_names))
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("XInput-%u/%s", key.source_index, s_button_names[key.data]);
|
||||
ret = fmt::format("XInput-{}/{}", static_cast<u32>(key.source_index), s_button_names[key.data]);
|
||||
}
|
||||
else if (key.source_subtype == InputSubclass::ControllerMotor)
|
||||
{
|
||||
ret = StringUtil::StdStringFromFormat("XInput-%u/%sMotor", key.source_index, key.data ? "Large" : "Small");
|
||||
ret = fmt::format("XInput-{}/{}Motor", static_cast<u32>(key.source_index), key.data ? "Large" : "Small");
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,24 +350,22 @@ bool XInputSource::GetGenericBindingMapping(const std::string_view& device, Gene
|
||||
const GenericInputBinding negative = s_xinput_generic_binding_axis_mapping[i][0];
|
||||
const GenericInputBinding positive = s_xinput_generic_binding_axis_mapping[i][1];
|
||||
if (negative != GenericInputBinding::Unknown)
|
||||
mapping->emplace_back(negative, StringUtil::StdStringFromFormat("XInput-%d/-%s", pid, s_axis_names[i]));
|
||||
mapping->emplace_back(negative, fmt::format("XInput-{}/-{}", pid, s_axis_names[i]));
|
||||
|
||||
if (positive != GenericInputBinding::Unknown)
|
||||
mapping->emplace_back(positive, StringUtil::StdStringFromFormat("XInput-%d/+%s", pid, s_axis_names[i]));
|
||||
mapping->emplace_back(positive, fmt::format("XInput-{}/+{}", pid, s_axis_names[i]));
|
||||
}
|
||||
for (u32 i = 0; i < std::size(s_xinput_generic_binding_button_mapping); i++)
|
||||
{
|
||||
const GenericInputBinding binding = s_xinput_generic_binding_button_mapping[i];
|
||||
if (binding != GenericInputBinding::Unknown)
|
||||
mapping->emplace_back(binding, StringUtil::StdStringFromFormat("XInput-%d/%s", pid, s_button_names[i]));
|
||||
mapping->emplace_back(binding, fmt::format("XInput-{}/{}", pid, s_button_names[i]));
|
||||
}
|
||||
|
||||
if (m_controllers[pid].has_small_motor)
|
||||
mapping->emplace_back(GenericInputBinding::SmallMotor,
|
||||
StringUtil::StdStringFromFormat("XInput-%d/SmallMotor", pid));
|
||||
mapping->emplace_back(GenericInputBinding::SmallMotor, fmt::format("XInput-{}/SmallMotor", pid));
|
||||
if (m_controllers[pid].has_large_motor)
|
||||
mapping->emplace_back(GenericInputBinding::LargeMotor,
|
||||
StringUtil::StdStringFromFormat("XInput-%d/LargeMotor", pid));
|
||||
mapping->emplace_back(GenericInputBinding::LargeMotor, fmt::format("XInput-{}/LargeMotor", pid));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -387,14 +384,14 @@ void XInputSource::HandleControllerConnection(u32 index)
|
||||
cd.has_small_motor = caps.Vibration.wRightMotorSpeed != 0;
|
||||
cd.last_state = {};
|
||||
|
||||
InputManager::OnInputDeviceConnected(StringUtil::StdStringFromFormat("XInput-%u", index),
|
||||
StringUtil::StdStringFromFormat("XInput Controller %u", index));
|
||||
InputManager::OnInputDeviceConnected(fmt::format("XInput-{}", index),
|
||||
fmt::format("XInput Controller {}", index));
|
||||
}
|
||||
|
||||
void XInputSource::HandleControllerDisconnection(u32 index)
|
||||
{
|
||||
Log_InfoPrintf("XInput controller %u disconnected.", index);
|
||||
InputManager::OnInputDeviceDisconnected(StringUtil::StdStringFromFormat("XInput-%u", index));
|
||||
InputManager::OnInputDeviceDisconnected(fmt::format("XInput-{}", index));
|
||||
m_controllers[index] = {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user