diff options
author | Hinsbart <entenflugstuhl@gmail.com> | 2015-02-25 16:33:08 +0100 |
---|---|---|
committer | Hinsbart <entenflugstuhl@gmail.com> | 2015-02-25 16:33:08 +0100 |
commit | 9229d9d1bbc3bb850839e022b8c8d37609839edd (patch) | |
tree | 423e4fe9292892f47ca8dee6949ff47feb7e456f | |
parent | 1d7337ba10ad593f0786d3e356cf0b05aa9be2b4 (diff) |
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, |