Skip to content

Commit 8cf7796

Browse files
committed
Prevent game from closing from proximity/multi-tasking changes
XR_SESSION_STATE_STOPPING assumes that the OpenXR session can be resumed again and that the application temporarily closes it, which is quite hard with an emulator. Listening to the exiting event instead makes it so that you can still press the exit button in SteamVR/Air Link and it'll exit, but not listen to proximity changes.
1 parent 61a7251 commit 8cf7796

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rendering/openxr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,13 +752,13 @@ void OpenXR::ProcessEvents() {
752752
break;
753753
case XR_SESSION_STATE_STOPPING:
754754
Log::print<VERBOSE>("OpenXR has indicated that the session should be ended!");
755-
//this->m_renderer.reset();
756-
PostMessage(CemuHooks::m_cemuTopWindow, WM_CLOSE, 0, 0);
757755
break;
758756
case XR_SESSION_STATE_EXITING:
759757
Log::print<VERBOSE>("OpenXR has indicated that the session should be destroyed!");
760758
// an exception is thrown here instead of using exit() to allow Cemu to ideally gracefully shutdown
761759
//throw std::runtime_error("BetterVR mod has been requested to exit by OpenXR!");
760+
//this->m_renderer.reset();
761+
PostMessage(CemuHooks::m_cemuTopWindow, WM_CLOSE, 0, 0);
762762
break;
763763
case XR_SESSION_STATE_LOSS_PENDING:
764764
Log::print<VERBOSE>("OpenXR has indicated that the session is going to be lost!");

0 commit comments

Comments
 (0)