mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
Use the new UTF-16 conversion function in two places.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
#include "DInput.h"
|
||||
|
||||
#include <StringUtil.h>
|
||||
#include "StringUtil.h"
|
||||
|
||||
#ifdef CIFACE_USE_DINPUT_JOYSTICK
|
||||
#include "DInputJoystick.h"
|
||||
@ -41,24 +41,18 @@ BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
||||
|
||||
std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device)
|
||||
{
|
||||
std::string out;
|
||||
|
||||
DIPROPSTRING str;
|
||||
ZeroMemory(&str, sizeof(str));
|
||||
DIPROPSTRING str = {};
|
||||
str.diph.dwSize = sizeof(str);
|
||||
str.diph.dwHeaderSize = sizeof(str.diph);
|
||||
str.diph.dwHow = DIPH_DEVICE;
|
||||
|
||||
std::string result;
|
||||
if (SUCCEEDED(device->GetProperty(DIPROP_PRODUCTNAME, &str.diph)))
|
||||
{
|
||||
const int size = WideCharToMultiByte(CP_UTF8, 0, str.wsz, -1, NULL, 0, NULL, NULL);
|
||||
char* const data = new char[size];
|
||||
if (size == WideCharToMultiByte(CP_UTF8, 0, str.wsz, -1, data, size, NULL, NULL))
|
||||
out.assign(data);
|
||||
delete[] data;
|
||||
result = StripSpaces(UTF16ToUTF8(str.wsz));
|
||||
}
|
||||
|
||||
return StripSpaces(out);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Init(std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
|
||||
|
Reference in New Issue
Block a user