diff options
author | Sven Gothel <[email protected]> | 2015-03-28 01:43:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-28 01:43:35 +0100 |
commit | 4207f9c279e832e3afcb3f5fc6cd8d84cb4cfe4c (patch) | |
tree | cf3671058d55b47ab6cb6f36f369928606137628 /LibOVR/Src/OVR_Profile.cpp | |
parent | c29cd1a2fbff6282bab956ad61661ac9d48c4e6e (diff) |
Bump OculusVR RIFT SDK to 0.5.0.1vanilla_0.5.0.1
Diffstat (limited to 'LibOVR/Src/OVR_Profile.cpp')
-rwxr-xr-x[-rw-r--r--] | LibOVR/Src/OVR_Profile.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/LibOVR/Src/OVR_Profile.cpp b/LibOVR/Src/OVR_Profile.cpp index dcbc95d..273d551 100644..100755 --- a/LibOVR/Src/OVR_Profile.cpp +++ b/LibOVR/Src/OVR_Profile.cpp @@ -32,14 +32,13 @@ limitations under the License. ************************************************************************************/ #include "OVR_Profile.h" -#include "OVR_JSON.h" +#include "Kernel/OVR_JSON.h" #include "Kernel/OVR_SysFile.h" #include "Kernel/OVR_Allocator.h" #include "OVR_Stereo.h" #ifdef OVR_OS_WIN32 -#define WIN32_LEAN_AND_MEAN -#include <Windows.h> +#include "Kernel/OVR_Win32_IncludeWindows.h" #include <Shlobj.h> #elif defined(OVR_OS_MS) // Other Microsoft OSs // Nothing, thanks. @@ -54,6 +53,7 @@ limitations under the License. #endif + #define PROFILE_VERSION 2.0 #define MAX_PROFILE_MAJOR_VERSION 2 #define MAX_DEVICE_PROFILE_MAJOR_VERSION 1 @@ -805,25 +805,41 @@ const char* ProfileManager::GetDefaultUser(const char* product, const char* seri const char* tag_names[2] = {"Product", "Serial"}; const char* tags[2]; + Ptr<Profile> p; if (product && serial) { tags[0] = product; tags[1] = serial; // Look for a default user on this specific device - Ptr<Profile> p = *GetTaggedProfile(tag_names, tags, 2); - if (p == NULL) + Profile* tmp_ptr = GetTaggedProfile(tag_names, tags, 2); + if (tmp_ptr == nullptr) { // Look for a default user on this product - p = *GetTaggedProfile(tag_names, tags, 1); + tmp_ptr = GetTaggedProfile(tag_names, tags, 1); + } + if (tmp_ptr != nullptr) + { + p = *tmp_ptr; } - if (p) - { - const char* user = p->GetValue("DefaultUser"); - if (user != NULL && user[0] != 0) - { - TempBuff = user; - return TempBuff.ToCStr(); - } + } + else if (product) + { + tags[0] = product; + // Look for a default user on this specific device + Profile* tmp_ptr = GetTaggedProfile(tag_names, tags, 1); + if (tmp_ptr != nullptr) + { + p = *tmp_ptr; + } + } + + if (p) + { + const char* user = p->GetValue("DefaultUser"); + if (user != nullptr && user[0] != 0) + { + TempBuff = user; + return TempBuff.ToCStr(); } } @@ -1137,9 +1153,10 @@ bool Profile::LoadDeviceFile(unsigned int productId, const char* printedSerialNu String path = BasePath + "/Devices.json"; // Load the device profiles - Ptr<JSON> root = *JSON::Load(path); - if (root == NULL) + JSON *tmp_ptr = JSON::Load(path); + if (tmp_ptr == NULL) return false; + Ptr<JSON> root = *tmp_ptr; // Quick sanity check of the file type and format before we parse it JSON* version = root->GetFirstItem(); |