diff --git a/src/main.cpp b/src/main.cpp index 5a54943..79c9d50 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ int main( int argc, char* argv[] ) commandLineArgs.forceRemoveManifest ); } - openvr_init::OpenVR_Init openvr_init( + openvr_init::initializeOpenVR( openvr_init::OpenVrInitializationType::Overlay ); try diff --git a/src/overlaycontroller/openvr_init.cpp b/src/overlaycontroller/openvr_init.cpp index de5d33d..97fbaa4 100644 --- a/src/overlaycontroller/openvr_init.cpp +++ b/src/overlaycontroller/openvr_init.cpp @@ -42,7 +42,7 @@ void initializeProperly( const OpenVrInitializationType initType ) } } -OpenVR_Init::OpenVR_Init( const OpenVrInitializationType initType ) +void initializeOpenVR( const OpenVrInitializationType initType ) { initializeProperly( initType ); @@ -99,8 +99,4 @@ OpenVR_Init::OpenVR_Init( const OpenVrInitializationType initType ) } } -OpenVR_Init::~OpenVR_Init() -{ - vr::VR_Shutdown(); -} } // namespace openvr_init diff --git a/src/overlaycontroller/openvr_init.h b/src/overlaycontroller/openvr_init.h index 5b454b3..efa5685 100644 --- a/src/overlaycontroller/openvr_init.h +++ b/src/overlaycontroller/openvr_init.h @@ -8,37 +8,6 @@ enum class OpenVrInitializationType Utility, }; -/*! -Initializes OpenVR and checks validity of interface versions. Shuts down OpenVR -when destroyed. +void initializeOpenVR( const OpenVrInitializationType initType ); -This object should be declared above all other objects in the class file that -use OpenVR calls, since the order of declaration decides which objects are -initialized first. - -The comment/tooltips have not been provided for the constructor/destructor since -they do not need explanation due to the straightforward nature of their -implementation. -*/ -class OpenVR_Init -{ -public: - OpenVR_Init( const OpenVrInitializationType initType ); - ~OpenVR_Init(); - - // As per the Rule of Five, the following constructors and assignments can - // be created by the compiler automatically if they are used in the code. - // The compiler will not be able to correctly create this class and it - // wouldn't make sense to copy a class that just starts OpenVR. - // They are explicitly deleted to make sure they aren't used, and to - // document that they shouldn't be used. - // Copy constructor - OpenVR_Init( const OpenVR_Init& ) = delete; - // Copy assignment - const OpenVR_Init& operator=( const OpenVR_Init& ) = delete; - // Move constructor - OpenVR_Init( OpenVR_Init&& ) = delete; - // Move assignment - const OpenVR_Init operator=( OpenVR_Init&& ) = delete; -}; } // namespace openvr_init diff --git a/src/utils/setup.h b/src/utils/setup.h index 796d04f..314d598 100644 --- a/src/utils/setup.h +++ b/src/utils/setup.h @@ -295,7 +295,7 @@ void reinstallApplicationManifest( const QString manifestPath ) [[noreturn]] void handleManifests( const bool installManifest, const bool removeManifest ) { - openvr_init::OpenVR_Init openvr_init( + openvr_init::initializeOpenVR( openvr_init::OpenVrInitializationType::Utility ); int exit_code = ReturnErrorCode::SUCCESS;