Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
mka's avatar
mka
Explorer
11 years ago

What is "official" way to get profile file?

I need to use the procedure

HmdRenderInfo GenerateHmdRenderInfoFromHmdInfo ( HMDInfo const &hmdInfo,
Profile const *profile,
DistortionEqnType distortionType /*= Distortion_CatmullRom10*/,
EyeCupType eyeCupOverride /*= EyeCup_LAST*/ )

in OVR_Stereo.h/cpp. In the .h file it says that the profile parameter can be NULL, but in the actual code it is required. I think I found the profile files in the C:/Users/.../AppData/Local/Oculus directory, namely, ConfigUtilSettings.json and ProfileDB.json. Which is actually my profile? What is the "official" way to get this profile for use with the GenerateHmdRenderInfoFromHmdInfo procedure?

2 Replies

  • You should use the ProfileManager (check OVR_Profile.h). For example:

    Ptr<ProfileManager> pm      = *ProfileManager::Create();
    Ptr<Profile> profile = pm->LoadProfile(Profile_RiftDK1,
    pm->GetDefaultProfileName(Profile_RiftDK1));
    if (profile)
    { // Retrieve the current profile settings
    }
  • Thanks for pointing me in the right direction, cyberreality, but that suggested code from OVR_Profile.h works only in DK 1 and not DK 2. Here is how one can get a profile in DK 2 (the comments in OVR_Profile.h should be updated):

    ProfileDeviceKey::ProfileDeviceKey (const HMDInfo* info);
    ProfileManager::ProfileManager (bool sys_register)
    Profile* ProfileManager::GetProfile (const ProfileDeviceKey& deviceKey, const char* user);
    Profile* ProfileManager::GetDefaultUserProfile (const ProfileDeviceKey& deviceKey);
    Profile* ProfileManager::GetDefaultProfile (HmdTypeEnum device) // HmdType_DK2

    HMDInfo* info;
    ProfileDeviceKey profDevKey (&info);
    Ptr<ProfileManager> pm = new ProfileManager (true/false);
    Ptr<Profile> profile = pm->GetDefaultUserProfile (profDevKey);

    I have one last question. Can you clarify the parameter sys_register in the ProfileManager constructor?
    Should one typically set that to true so that pm and profile will be deleted when one exits the calling procedure? rather than deleting those structures manually?

    Edit: The above will not quite work because the ProfileManager constructor is protected. One needs to first define a derived class. For example,

    class myProfileManager : protected ProfileManager {

    and then make pm above of that type.