diff --git a/bin/win64/logging.conf b/bin/win64/logging.conf new file mode 100644 index 0000000..f87a00a --- /dev/null +++ b/bin/win64/logging.conf @@ -0,0 +1,11 @@ +* GLOBAL: + FORMAT = "[%level] %datetime{%Y-%M-%d %H:%m:%s}: %msg" + FILENAME = "AdvancedSettings.log" + ENABLED = true + TO_FILE = true + TO_STANDARD_OUTPUT = true + MAX_LOG_FILE_SIZE = 2097152 ## 2MB +* DEBUG: + ENABLED = true +* TRACE: + ENABLED = false diff --git a/bin/win64/res/qml/SteamVRPage.qml b/bin/win64/res/qml/SteamVRPage.qml index c4d11e1..1b2d7ba 100644 --- a/bin/win64/res/qml/SteamVRPage.qml +++ b/bin/win64/res/qml/SteamVRPage.qml @@ -40,6 +40,7 @@ MyStackViewPage { steamvrSupersamplingText.text = val.toFixed(1) } onValueChanged: { + console.debug("Supersampling Slider: valueChanged(", this.value, ")") SteamVRTabController.setSuperSampling(this.value.toFixed(1), false) } } @@ -90,6 +91,7 @@ MyStackViewPage { steamvrCompositorSupersamplingText.text = val.toFixed(1) } onValueChanged: { + console.debug("Compositor Supersampling Slider: valueChanged(", this.value, ")") SteamVRTabController.setCompositorSuperSampling(this.value.toFixed(1), false) } } diff --git a/bin/win64/startdesktopmode.bat b/bin/win64/startdesktopmode.bat new file mode 100644 index 0000000..a961b93 --- /dev/null +++ b/bin/win64/startdesktopmode.bat @@ -0,0 +1 @@ +start AdvancedSettings.exe -desktop -nosound \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index c47695e..622c7e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,9 @@ const char* logConfigDefault = " TO_STANDARD_OUTPUT = true\n" " MAX_LOG_FILE_SIZE = 2097152 ## 2MB\n" "* TRACE:\n" -" FORMAT = \"[%level] %datetime{%Y-%M-%d %H:%m:%s} %func: %msg\"\n"; +" ENABLED = false\n" +"* DEBUG:\n" +" ENABLED = false\n"; INITIALIZE_EASYLOGGINGPP @@ -27,6 +29,8 @@ void myQtMessageHandler(QtMsgType type, const QMessageLogContext &context, const QByteArray localMsg = msg.toLocal8Bit(); switch (type) { case QtDebugMsg: + LOG(DEBUG) << localMsg.constData() << "(" << context.file << ":" << context.line << ")"; + break; case QtInfoMsg: LOG(INFO) << localMsg.constData() << "(" << context.file << ":" << context.line << ")"; break; @@ -98,13 +102,14 @@ int main(int argc, char *argv[]) { controller->SetWidget(qobject_cast(quickObj), advsettings::OverlayController::applicationName, advsettings::OverlayController::applicationKey); if (!desktopMode && !noManifest) { - std::string manifestPath = QApplication::applicationDirPath().toStdString() + "\\manifest.vrmanifest"; - if (QFile::exists(QString::fromStdString(manifestPath))) { + auto manifestQPath = QDir(QApplication::applicationDirPath()).absoluteFilePath("manifest.vrmanifest"); + //std::string manifestPath = QDir::toNativeSeparators(QApplication::applicationDirPath()).toStdString() + "\\manifest.vrmanifest"; + if (QFile::exists(manifestQPath)) { bool firstTime = false; if (!vr::VRApplications()->IsApplicationInstalled(advsettings::OverlayController::applicationKey)) { firstTime; } - auto apperror = vr::VRApplications()->AddApplicationManifest(manifestPath.c_str()); + auto apperror = vr::VRApplications()->AddApplicationManifest(QDir::toNativeSeparators(manifestQPath).toStdString().c_str()); if (apperror != vr::VRApplicationError_None) { LOG(ERROR) << "Could not add application manifest: " << vr::VRApplications()->GetApplicationsErrorNameFromEnum(apperror); } else if (firstTime) { @@ -114,7 +119,7 @@ int main(int argc, char *argv[]) { } } } else { - LOG(ERROR) << "Could not find application manifest: " << manifestPath; + LOG(ERROR) << "Could not find application manifest: " << manifestQPath; } } diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp index 7a4d201..3721301 100644 --- a/src/overlaycontroller.cpp +++ b/src/overlaycontroller.cpp @@ -136,12 +136,14 @@ void OverlayController::Shutdown() { if (m_pPumpEventsTimer) { disconnect(m_pPumpEventsTimer.get(), SIGNAL(timeout()), this, SLOT(OnTimeoutPumpEvents())); m_pPumpEventsTimer->stop(); + m_pPumpEventsTimer.reset(); } if (m_pRenderTimer) { disconnect(m_pRenderControl.get(), SIGNAL(renderRequested()), this, SLOT(OnRenderRequest())); disconnect(m_pRenderControl.get(), SIGNAL(sceneChanged()), this, SLOT(OnRenderRequest())); disconnect(m_pRenderTimer.get(), SIGNAL(timeout()), this, SLOT(renderOverlay())); m_pRenderTimer->stop(); + m_pRenderTimer.reset(); } m_pWindow.reset(); m_pRenderControl.reset(); diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h index a581464..8b26e0a 100644 --- a/src/overlaycontroller.h +++ b/src/overlaycontroller.h @@ -41,7 +41,7 @@ class OverlayController : public QObject { public: static constexpr const char* applicationKey = "matzman666.AdvancedSettings"; static constexpr const char* applicationName = "Advanced Settings"; - static constexpr const char* applicationVersionString = "v2.0"; + static constexpr const char* applicationVersionString = "v2.1"; private: vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid; diff --git a/src/tabcontrollers/SteamVRTabController.cpp b/src/tabcontrollers/SteamVRTabController.cpp index a4798f7..bc0a43b 100644 --- a/src/tabcontrollers/SteamVRTabController.cpp +++ b/src/tabcontrollers/SteamVRTabController.cpp @@ -23,8 +23,12 @@ void SteamVRTabController::eventLoopTick() { auto ss = vr::VRSettings()->GetFloat(vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, &vrSettingsError); if (vrSettingsError != vr::VRSettingsError_None) { LOG(WARNING) << "Could not read \"" << vr::k_pch_SteamVR_RenderTargetMultiplier_Float << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); - setSuperSampling(1.0); - } else { + if (m_superSampling != 1.0) { + LOG(DEBUG) << "OpenVR returns an error and we have a custom supersampling value: " << m_superSampling; + setSuperSampling(1.0); + } + } else if (m_superSampling != ss) { + LOG(DEBUG) << "OpenVR reports a changed supersampling value: " << m_superSampling << " => " << ss; setSuperSampling(ss); } auto css = vr::VRSettings()->GetFloat(vrsettings_compositor_category, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, &vrSettingsError); @@ -32,8 +36,12 @@ void SteamVRTabController::eventLoopTick() { if (vrSettingsError != vr::VRSettingsError_UnsetSettingHasNoDefault) { // does not appear in the default settings file as of beta 1477423729 LOG(WARNING) << "Could not read \"compositor::" << vr::k_pch_SteamVR_RenderTargetMultiplier_Float << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError); } - setCompositorSuperSampling(1.0); - } else { + if (m_compositorSuperSampling != 1.0) { + LOG(DEBUG) << "OpenVR returns an error and we have a custom compositor supersampling value: " << m_compositorSuperSampling; + setCompositorSuperSampling(1.0); + } + } else if (m_compositorSuperSampling != css) { + LOG(DEBUG) << "OpenVR reports a changed compositor supersampling value: " << m_compositorSuperSampling << " => " << css; setCompositorSuperSampling(css); } auto air = vr::VRSettings()->GetBool(vr::k_pch_SteamVR_Section, vrsettings_steamvr_allowInterleavedReprojection, &vrSettingsError); @@ -60,9 +68,11 @@ void SteamVRTabController::eventLoopTick() { void SteamVRTabController::setSuperSampling(float value, bool notify) { if (value <= 0.01f) { + LOG(WARNING) << "Encountered a supersampling value <= 0.01, setting supersampling to 1.0"; value = 1.0f; } if (m_superSampling != value) { + LOG(DEBUG) << "Supersampling value changed: " << m_superSampling << " => " << value; m_superSampling = value; vr::VRSettings()->SetFloat(vr::k_pch_SteamVR_Section, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, m_superSampling); vr::VRSettings()->Sync(); @@ -75,9 +85,11 @@ void SteamVRTabController::setSuperSampling(float value, bool notify) { void SteamVRTabController::setCompositorSuperSampling(float value, bool notify) { if (value <= 0.01f) { + LOG(WARNING) << "Encountered a compositor supersampling value <= 0.01, setting supersampling to 1.0"; value = 1.0f; } if (m_compositorSuperSampling != value) { + LOG(DEBUG) << "Compositor supersampling value changed: " << m_compositorSuperSampling << " => " << value; m_compositorSuperSampling = value; vr::VRSettings()->SetFloat(vrsettings_compositor_category, vr::k_pch_SteamVR_RenderTargetMultiplier_Float, m_compositorSuperSampling); vr::VRSettings()->Sync();