diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-03-02 01:00:56 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-03-02 01:00:56 -0300 |
commit | 440cc5e4b6af1720243cff19f3b8d805b82e9260 (patch) | |
tree | 6963f4ab965a9c75e0f1cc6e68c6e2b85379501f | |
parent | a1f715a4da71fbc2b7d6fad68624bf8b22c6da17 (diff) | |
parent | 9229d9d1bbc3bb850839e022b8c8d37609839edd (diff) |
Merge pull request #1437 from Hinsbart/fix_win_joy
fix get joystick name from registry on some systems
-rw-r--r-- | platform/windows/os_windows.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 13f2c32e77..e392a56aa8 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -715,9 +715,14 @@ String OS_Windows::get_joystick_name(int id, JOYCAPS jcaps) return ""; _snprintf( buffer, sizeof(buffer), "%s\\%s", REGSTR_PATH_JOYOEM, OEM); - res = RegOpenKeyEx ( HKEY_LOCAL_MACHINE, buffer, 0, KEY_QUERY_VALUE, &hKey); - if (res != ERROR_SUCCESS) - return ""; + res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, buffer, 0, KEY_QUERY_VALUE, &hKey); + if (res != ERROR_SUCCESS) + { + res = RegOpenKeyEx(HKEY_CURRENT_USER, buffer, 0, KEY_QUERY_VALUE, &hKey); + if (res != ERROR_SUCCESS) + return ""; + } + sz = sizeof(buffer); res = RegQueryValueEx(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, (LPBYTE) buffer, |