Monado OpenXR Runtime
settings.hpp
Go to the documentation of this file.
1// Copyright 2023, Shawn Wallace
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief OpenVR IVRSettings interface header.
6 * @author Shawn Wallace <yungwallace@live.com>
7 * @ingroup drv_steamvr_lh
8 */
9
10#pragma once
11
12#include "openvr_driver.h"
13#include "util/u_json.hpp"
14
15class Settings : public vr::IVRSettings
16{
17private:
18 const xrt::auxiliary::util::json::JSONNode steamvr_settings;
19 const xrt::auxiliary::util::json::JSONNode driver_defaults;
20
21public:
22 Settings(const std::string &steam_install, const std::string &steamvr_install);
23
24 const char *
25 GetSettingsErrorNameFromEnum(vr::EVRSettingsError eError) override;
26
27 void
28 SetBool(const char *pchSection,
29 const char *pchSettingsKey,
30 bool bValue,
31 vr::EVRSettingsError *peError = nullptr) override;
32 void
33 SetInt32(const char *pchSection,
34 const char *pchSettingsKey,
35 int32_t nValue,
36 vr::EVRSettingsError *peError = nullptr) override;
37 void
38 SetFloat(const char *pchSection,
39 const char *pchSettingsKey,
40 float flValue,
41 vr::EVRSettingsError *peError = nullptr) override;
42 void
43 SetString(const char *pchSection,
44 const char *pchSettingsKey,
45 const char *pchValue,
46 vr::EVRSettingsError *peError = nullptr) override;
47
48 // Users of the system need to provide a proper default in default.vrsettings in the resources/settings/
49 // directory of either the runtime or the driver_xxx directory. Otherwise the default will be false, 0, 0.0 or
50 // ""
51 bool
52 GetBool(const char *pchSection, const char *pchSettingsKey, vr::EVRSettingsError *peError = nullptr) override;
53 int32_t
54 GetInt32(const char *pchSection, const char *pchSettingsKey, vr::EVRSettingsError *peError = nullptr) override;
55 float
56 GetFloat(const char *pchSection, const char *pchSettingsKey, vr::EVRSettingsError *peError = nullptr) override;
57 void
58 GetString(const char *pchSection,
59 const char *pchSettingsKey,
60 VR_OUT_STRING() char *pchValue,
61 uint32_t unValueLen,
62 vr::EVRSettingsError *peError = nullptr) override;
63
64 void
65 RemoveSection(const char *pchSection, vr::EVRSettingsError *peError = nullptr) override;
66 void
67 RemoveKeyInSection(const char *pchSection,
68 const char *pchSettingsKey,
69 vr::EVRSettingsError *peError = nullptr) override;
70};
Definition: settings.hpp:16
A JSONNode wraps a cJSON object and presents useful functions for accessing the different properties ...
Definition: u_json.hpp:75
C++ wrapper for cJSON.