Initializes OpenVR and calls the relevant manifest functions. The .vrmanifest is used by SteamVR however the exact functiontionality is not documented in the official documentation. The manifest is installed upon using the NSIS installer for windows (this program is called with "--force-install-manifest" by the installer) and every time the program is launched without both "--desktop-mode" and "--
| 259 | // "--force-no-manifest". The OpenVR initialization is necessary for both |
| 260 | // removing and installing manifests. |
| 261 | [[noreturn]] void handleManifests( const bool installManifest, |
| 262 | const bool removeManifest ) |
| 263 | { |
| 264 | openvr_init::initializeOpenVR( |
| 265 | openvr_init::OpenVrInitializationType::Utility ); |
| 266 | |
| 267 | int exit_code = ReturnErrorCode::SUCCESS; |
| 268 | try |
| 269 | { |
| 270 | const auto manifestPath |
| 271 | = paths::binaryDirectoryFindFile( manifest::kVRManifestName ); |
| 272 | |
| 273 | if ( !manifestPath.has_value() ) |
| 274 | { |
| 275 | throw std::runtime_error( "Could not find application manifest." ); |
| 276 | } |
| 277 | if ( installManifest ) |
| 278 | { |
| 279 | reinstallApplicationManifest( *manifestPath ); |
| 280 | enableApplicationAutostart(); |
| 281 | LOG( INFO ) << "Manifest reinstalled."; |
| 282 | } |
| 283 | else if ( removeManifest ) |
| 284 | { |
| 285 | forceRemoveApplicationManifest(); |
| 286 | LOG( INFO ) << "Manifest removed."; |
| 287 | } |
| 288 | } |
| 289 | catch ( std::exception& e ) |
| 290 | { |
| 291 | exit_code = ReturnErrorCode::GENERAL_FAILURE; |
| 292 | LOG( ERROR ) << e.what(); |
| 293 | } |
| 294 | |
| 295 | vr::VR_Shutdown(); |
| 296 | exit( exit_code ); |
| 297 | } |
| 298 | } // namespace manifest |
| 299 | |
| 300 | void setUpLogging() |
no test coverage detected