Skip to main content
Up and Coming
November 14, 2014

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

    Inspiring
    November 14, 2014
    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
    }
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    mkaAuthor
    Up and Coming
    November 15, 2014
    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.