Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Pause the game, if it is in the Driving mode, and the VR view loses focus #17

Open
dlipovetsky opened this issue Jun 14, 2024 · 3 comments

Comments

@dlipovetsky
Copy link

Today, when the game is in Driving mode, and the VR view loses focus, the game is not paused.

There are different reasons that the VR view can lose focus. One reason might be that the player removes an HMD with a proximity sensor from their head. Another reason might be that the HMD displays an overlay that covers the game view.

Some personal motivation for this feature: I use OpenRBRVR with the OpenXR runtime and a Meta Quest 3 HMD. There is a known issue, where the HMD suddenly and unpredictably displays a dialog that covers the game view, and requires the user to acknowledge the dialog. If I am driving and I receive this dialog, I nearly always crash, because I am not able to pause the game in time. That can be frustrating, especially when it happens in the middle of a long stage. It could also cause a DNF in an online race.

@dlipovetsky
Copy link
Author

I think this feature is possible with the OpenXR runtime. I don't know if this feature is possible with the OpenVR runtime. The following is a sketch of how I think it might work. I'm a software engineer, but I have no experience with VR runtimes.

Here's some pseudocode:

state := vr.current_session_state()
if state != focused:
  if rbr.gameMode == Driving:
    rbr.pause_game()
render_desktop_view()
# Do not render the VR view
return

From what I can tell, this belongs in the Present function.

I will experiment with this idea in my fork, and if I make progress, I'll open a PR.

From the OpenXR docs, it looks like there is exactly one state in which the game is visible to the user, and can receive XR input: XR_SESSION_STATE_FOCUSED.

@Detegr
Copy link
Owner

Detegr commented Jun 14, 2024

This sounds like a good idea to me. The correct place to handle this would be in init_or_update_game_data function. I am not sure if the game can be paused by just writing at the memory location containing the game mode. From previous experiences I would guess that's not the case but it's worth a shot.

@dlipovetsky
Copy link
Author

dlipovetsky commented Jun 15, 2024

Thanks for the feedback!

I am not sure if the game can be paused by just writing at the memory location containing the game mode.

That makes sense. I definitely hallucinated the rbr.pause_game() function. 😂

I learned a little bit from the original (?) reverse engineering report on RBR.

I'll try to set a conditional breakpoint that triggers when the "game mode" address is set to the pause value. If I can do that, maybe I can find out how to call the function that pauses the game.

I was also thinking about a completely different approach: sending an input event that is bound to the pause command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants