mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 10:00:27 +02:00
Toggle the first-person camera with a right thumbstick click
Clicking the right thumbstick flips first person exactly as the F10 checkbox does, and saves it the same way. It works on the VR controllers in either presentation (with a short tick on the right controller) and on any other gamepad while VR is running. It never reached the game: SDL's stick click only lands in Aurora's extended buttons. A click counts on release, and only if the left thumbstick stayed up and the headset settings panel stayed closed throughout, so the two-thumbstick panel chord in gamepad mode never toggles the camera. A gamepad whose right stick click is bound to a GameCube control on its port, as a button or in an input expression, keeps it for the game. The XR side only posts a request; the toggle itself runs on the game thread with the checkbox. [vr] first_person_toggle_click (default true) and a checkbox under the camera toggle turn the click off. mkw_vr_camera_toggle_tests covers the click rule. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c11a7c9a61
commit
dd7f046214
11 files changed
+245
-4
No files matched your search
@@ -12,6 +12,7 @@
|
||||
#include "vr/openxr_input.h"
|
||||
#include "physical_wheel.h"
|
||||
#include "runtime_config.h"
|
||||
#include "settings_overlay.h"
|
||||
#include "vr/mkw_vr_first_person.h"
|
||||
#include "vr/openxr_diagnostics.h"
|
||||
|
||||
@@ -497,6 +498,7 @@ void OpenXRInput::Idle() {
|
||||
m_last_input_time = 0;
|
||||
m_panel_select_held = false;
|
||||
OpenXRPublishSettingsPanelPointer(false, 0.0f, 0.0f, false, 0.0f);
|
||||
m_first_person_click.Reset();
|
||||
ResetDriving();
|
||||
StopRumble();
|
||||
// Nothing stays held on the gamepad either while input is away.
|
||||
@@ -623,6 +625,17 @@ void OpenXRInput::Sync(XrTime predicted_display_time, const OpenXRPointerScreen&
|
||||
OpenXRSetSettingsPanelOpen(open);
|
||||
}
|
||||
|
||||
// A clean right-thumbstick click toggles the first-person camera. It fires
|
||||
// on release, so the two-thumbstick panel chord never toggles it, and
|
||||
// never while the panel has the controllers.
|
||||
if (m_first_person_click.Update(hands[1].thumbstick_click, hands[0].thumbstick_click,
|
||||
panel.open || panel.withheld) &&
|
||||
RuntimeConfigFile::VrFirstPersonToggleClick()) {
|
||||
settings_overlay::RequestFirstPersonToggle();
|
||||
constexpr XrDuration kToggleTickNs = 20'000'000;
|
||||
ApplyHaptic(1, 0.35f, kToggleTickNs);
|
||||
}
|
||||
|
||||
// The cockpit's wheel before the game reads the controllers: a held wheel
|
||||
// steers through the left stick and keeps its grips from the game.
|
||||
UpdateDriving(predicted_display_time, seat, hands, panel.withheld);
|
||||
|
||||
@@ -45,6 +45,10 @@ bool OpenXRWiiRemoteOwnsGamepad(uint32_t sdl_joystick_id) noexcept {
|
||||
wii_remote_bridge::g_joystick_id.load(std::memory_order_relaxed) == sdl_joystick_id;
|
||||
}
|
||||
|
||||
bool OpenXRIsControllerGamepad(uint32_t sdl_joystick_id) noexcept {
|
||||
return sdl_joystick_id != 0 && wii_remote_bridge::g_joystick_id.load(std::memory_order_relaxed) == sdl_joystick_id;
|
||||
}
|
||||
|
||||
bool OpenXRReadWiiRemote(OpenXRWiiRemoteSample& sample) noexcept {
|
||||
auto& published = wii_remote_bridge::Published();
|
||||
std::lock_guard lock(published.mutex);
|
||||
|
||||
Reference in new issue
Block a user