Commit 87c7f1bd authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Use wide char string literals.

parent e4f6ec7d
...@@ -132,8 +132,7 @@ static int lv_get_item_data(HWND dialog, int index) ...@@ -132,8 +132,7 @@ static int lv_get_item_data(HWND dialog, int index)
static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf) static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW lpdiaf)
{ {
static const WCHAR no_action[] = {'-','\0'}; const WCHAR *action_text = L"-";
const WCHAR *action_text = no_action;
LVITEMW lvItem; LVITEMW lvItem;
if (item < 0) return; if (item < 0) return;
......
...@@ -686,11 +686,7 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic) ...@@ -686,11 +686,7 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
*/ */
static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WCHAR *guid) static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WCHAR *guid)
{ {
static const WCHAR subkey[] = { static const WCHAR *subkey = L"Software\\Wine\\DirectInput\\Mappings\\%s\\%s\\%s";
'S','o','f','t','w','a','r','e','\\',
'W','i','n','e','\\',
'D','i','r','e','c','t','I','n','p','u','t','\\',
'M','a','p','p','i','n','g','s','\\','%','s','\\','%','s','\\','%','s','\0'};
HKEY hkey; HKEY hkey;
WCHAR *keyname; WCHAR *keyname;
...@@ -733,13 +729,12 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM ...@@ -733,13 +729,12 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
*/ */
for (i = 0; i < lpdiaf->dwNumActions; i++) for (i = 0; i < lpdiaf->dwNumActions; i++)
{ {
static const WCHAR format[] = {'%','x','\0'};
WCHAR label[9]; WCHAR label[9];
if (IsEqualGUID(&didev.guidInstance, &lpdiaf->rgoAction[i].guidInstance) && if (IsEqualGUID(&didev.guidInstance, &lpdiaf->rgoAction[i].guidInstance) &&
lpdiaf->rgoAction[i].dwHow != DIAH_UNMAPPED) lpdiaf->rgoAction[i].dwHow != DIAH_UNMAPPED)
{ {
swprintf( label, 9, format, lpdiaf->rgoAction[i].dwSemantic ); swprintf( label, 9, L"%x", lpdiaf->rgoAction[i].dwSemantic );
RegSetValueExW( hkey, label, 0, REG_DWORD, (const BYTE *)&lpdiaf->rgoAction[i].dwObjID, RegSetValueExW( hkey, label, 0, REG_DWORD, (const BYTE *)&lpdiaf->rgoAction[i].dwObjID,
sizeof(DWORD) ); sizeof(DWORD) );
} }
...@@ -775,11 +770,10 @@ static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMAT ...@@ -775,11 +770,10 @@ static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMAT
/* Try to read each action in the DIACTIONFORMAT from registry */ /* Try to read each action in the DIACTIONFORMAT from registry */
for (i = 0; i < lpdiaf->dwNumActions; i++) for (i = 0; i < lpdiaf->dwNumActions; i++)
{ {
static const WCHAR format[] = {'%','x','\0'};
DWORD id, size = sizeof(DWORD); DWORD id, size = sizeof(DWORD);
WCHAR label[9]; WCHAR label[9];
swprintf( label, 9, format, lpdiaf->rgoAction[i].dwSemantic ); swprintf( label, 9, L"%x", lpdiaf->rgoAction[i].dwSemantic );
if (!RegQueryValueExW(hkey, label, 0, NULL, (LPBYTE) &id, &size)) if (!RegQueryValueExW(hkey, label, 0, NULL, (LPBYTE) &id, &size))
{ {
......
...@@ -83,7 +83,6 @@ static const struct dinput_device *dinput_devices[] = ...@@ -83,7 +83,6 @@ static const struct dinput_device *dinput_devices[] =
HINSTANCE DINPUT_instance; HINSTANCE DINPUT_instance;
static const WCHAR di_em_win_w[] = {'D','I','E','m','W','i','n',0};
static HWND di_em_win; static HWND di_em_win;
static BOOL check_hook_thread(void); static BOOL check_hook_thread(void);
...@@ -498,7 +497,7 @@ static void register_di_em_win_class(void) ...@@ -498,7 +497,7 @@ static void register_di_em_win_class(void)
class.cbSize = sizeof(class); class.cbSize = sizeof(class);
class.lpfnWndProc = di_em_win_wndproc; class.lpfnWndProc = di_em_win_wndproc;
class.hInstance = DINPUT_instance; class.hInstance = DINPUT_instance;
class.lpszClassName = di_em_win_w; class.lpszClassName = L"DIEmWin";
if (!RegisterClassExW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) if (!RegisterClassExW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
WARN( "Unable to register message window class\n" ); WARN( "Unable to register message window class\n" );
...@@ -506,7 +505,7 @@ static void register_di_em_win_class(void) ...@@ -506,7 +505,7 @@ static void register_di_em_win_class(void)
static void unregister_di_em_win_class(void) static void unregister_di_em_win_class(void)
{ {
if (!UnregisterClassW( di_em_win_w, NULL ) && GetLastError() != ERROR_CLASS_DOES_NOT_EXIST) if (!UnregisterClassW( L"DIEmWin", NULL ) && GetLastError() != ERROR_CLASS_DOES_NOT_EXIST)
WARN( "Unable to unregister message window class\n" ); WARN( "Unable to unregister message window class\n" );
} }
...@@ -611,7 +610,7 @@ static HRESULT WINAPI IDirectInputWImpl_GetDeviceStatus( IDirectInput7W *iface, ...@@ -611,7 +610,7 @@ static HRESULT WINAPI IDirectInputWImpl_GetDeviceStatus( IDirectInput7W *iface,
static HRESULT WINAPI IDirectInputWImpl_RunControlPanel( IDirectInput7W *iface, HWND hwndOwner, DWORD dwFlags ) static HRESULT WINAPI IDirectInputWImpl_RunControlPanel( IDirectInput7W *iface, HWND hwndOwner, DWORD dwFlags )
{ {
IDirectInputImpl *This = impl_from_IDirectInput7W( iface ); IDirectInputImpl *This = impl_from_IDirectInput7W( iface );
WCHAR control_exeW[] = {'c','o','n','t','r','o','l','.','e','x','e',0}; WCHAR control_exe[] = {L"control.exe"};
STARTUPINFOW si = {0}; STARTUPINFOW si = {0};
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
...@@ -626,7 +625,7 @@ static HRESULT WINAPI IDirectInputWImpl_RunControlPanel( IDirectInput7W *iface, ...@@ -626,7 +625,7 @@ static HRESULT WINAPI IDirectInputWImpl_RunControlPanel( IDirectInput7W *iface,
if (!This->initialized) if (!This->initialized)
return DIERR_NOTINITIALIZED; return DIERR_NOTINITIALIZED;
if (!CreateProcessW(NULL, control_exeW, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi)) if (!CreateProcessW( NULL, control_exe, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi ))
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
return DI_OK; return DI_OK;
...@@ -1294,8 +1293,7 @@ static DWORD WINAPI hook_thread_proc(void *param) ...@@ -1294,8 +1293,7 @@ static DWORD WINAPI hook_thread_proc(void *param)
DWORD ret; DWORD ret;
MSG msg; MSG msg;
di_em_win = CreateWindowW( di_em_win_w, di_em_win_w, 0, 0, 0, 0, 0, di_em_win = CreateWindowW( L"DIEmWin", L"DIEmWin", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, DINPUT_instance, NULL );
HWND_MESSAGE, 0, DINPUT_instance, NULL );
/* Force creation of the message queue */ /* Force creation of the message queue */
PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ); PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE );
......
...@@ -1812,8 +1812,6 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W ...@@ -1812,8 +1812,6 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W
HANDLE *device, PHIDP_PREPARSED_DATA *preparsed, HANDLE *device, PHIDP_PREPARSED_DATA *preparsed,
HIDD_ATTRIBUTES *attrs, HIDP_CAPS *caps, DWORD version ) HIDD_ATTRIBUTES *attrs, HIDP_CAPS *caps, DWORD version )
{ {
static const WCHAR ig_w[] = {'&','I','G','_',0};
static const WCHAR xi_w[] = {'&','X','I','_',0};
char buffer[sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) + MAX_PATH * sizeof(WCHAR)]; char buffer[sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) + MAX_PATH * sizeof(WCHAR)];
SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail = (void *)buffer; SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail = (void *)buffer;
SP_DEVICE_INTERFACE_DATA iface = {.cbSize = sizeof(iface)}; SP_DEVICE_INTERFACE_DATA iface = {.cbSize = sizeof(iface)};
...@@ -1856,9 +1854,9 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W ...@@ -1856,9 +1854,9 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W
if (override) if (override)
{ {
if (!SetupDiGetDeviceInstanceIdW( set, &devinfo, device_id, MAX_PATH, NULL ) || if (!SetupDiGetDeviceInstanceIdW( set, &devinfo, device_id, MAX_PATH, NULL ) ||
!(tmp = wcsstr( device_id, ig_w ))) !(tmp = wcsstr( device_id, L"&IG_" )))
goto next; goto next;
memcpy( tmp, xi_w, sizeof(xi_w) - sizeof(WCHAR) ); memcpy( tmp, L"&XI_", sizeof(L"&XI_") - sizeof(WCHAR) );
if (!SetupDiOpenDeviceInfoW( xi_set, device_id, NULL, 0, &devinfo )) if (!SetupDiOpenDeviceInfoW( xi_set, device_id, NULL, 0, &devinfo ))
goto next; goto next;
if (!SetupDiEnumDeviceInterfaces( xi_set, &devinfo, &GUID_DEVINTERFACE_WINEXINPUT, 0, &iface )) if (!SetupDiEnumDeviceInterfaces( xi_set, &devinfo, &GUID_DEVINTERFACE_WINEXINPUT, 0, &iface ))
......
...@@ -136,9 +136,6 @@ static HRESULT mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEIN ...@@ -136,9 +136,6 @@ static HRESULT mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEIN
static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseImpl **out ) static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseImpl **out )
{ {
static const WCHAR mouse_wrap_override_w[] = {'M','o','u','s','e','W','a','r','p','O','v','e','r','r','i','d','e',0};
static const WCHAR disable_w[] = {'d','i','s','a','b','l','e',0};
static const WCHAR force_w[] = {'f','o','r','c','e',0};
SysMouseImpl* newDevice; SysMouseImpl* newDevice;
LPDIDATAFORMAT df = NULL; LPDIDATAFORMAT df = NULL;
unsigned i; unsigned i;
...@@ -154,10 +151,10 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm ...@@ -154,10 +151,10 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm
newDevice->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; newDevice->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
get_app_key(&hkey, &appkey); get_app_key(&hkey, &appkey);
if (!get_config_key(hkey, appkey, mouse_wrap_override_w, buffer, sizeof(buffer))) if (!get_config_key( hkey, appkey, L"MouseWarpOverride", buffer, sizeof(buffer) ))
{ {
if (!wcsnicmp( buffer, disable_w, -1 )) newDevice->warp_override = WARP_DISABLE; if (!wcsnicmp( buffer, L"disable", -1 )) newDevice->warp_override = WARP_DISABLE;
else if (!wcsnicmp( buffer, force_w, -1 )) newDevice->warp_override = WARP_FORCE_ON; else if (!wcsnicmp( buffer, L"force", -1 )) newDevice->warp_override = WARP_FORCE_ON;
} }
if (appkey) RegCloseKey(appkey); if (appkey) RegCloseKey(appkey);
if (hkey) RegCloseKey(hkey); if (hkey) RegCloseKey(hkey);
...@@ -687,23 +684,19 @@ static HRESULT WINAPI SysMouseWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, ...@@ -687,23 +684,19 @@ static HRESULT WINAPI SysMouseWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface,
static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow)
{ {
static const WCHAR x_axisW[] = {'X','-','A','x','i','s',0};
static const WCHAR y_axisW[] = {'Y','-','A','x','i','s',0};
static const WCHAR wheelW[] = {'W','h','e','e','l',0};
static const WCHAR buttonW[] = {'B','u','t','t','o','n',' ','%','d',0};
HRESULT res; HRESULT res;
res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow); res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
if (res != DI_OK) return res; if (res != DI_OK) return res;
if (IsEqualGUID( &pdidoi->guidType, &GUID_XAxis )) if (IsEqualGUID( &pdidoi->guidType, &GUID_XAxis ))
wcscpy( pdidoi->tszName, x_axisW ); wcscpy( pdidoi->tszName, L"X-Axis" );
else if (IsEqualGUID( &pdidoi->guidType, &GUID_YAxis )) else if (IsEqualGUID( &pdidoi->guidType, &GUID_YAxis ))
wcscpy( pdidoi->tszName, y_axisW ); wcscpy( pdidoi->tszName, L"Y-Axis" );
else if (IsEqualGUID( &pdidoi->guidType, &GUID_ZAxis )) else if (IsEqualGUID( &pdidoi->guidType, &GUID_ZAxis ))
wcscpy( pdidoi->tszName, wheelW ); wcscpy( pdidoi->tszName, L"Wheel" );
else if (pdidoi->dwType & DIDFT_BUTTON) else if (pdidoi->dwType & DIDFT_BUTTON)
swprintf( pdidoi->tszName, MAX_PATH, buttonW, DIDFT_GETINSTANCE( pdidoi->dwType ) - 3 ); swprintf( pdidoi->tszName, MAX_PATH, L"Button %d", DIDFT_GETINSTANCE( pdidoi->dwType ) - 3 );
if(pdidoi->dwType & DIDFT_AXIS) if(pdidoi->dwType & DIDFT_AXIS)
pdidoi->dwFlags |= DIDOI_ASPECTPOSITION; pdidoi->dwFlags |= DIDOI_ASPECTPOSITION;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment