mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 01:00:14 +02:00
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>
62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
//
|
|
// The right-thumbstick click that toggles the first-person camera
|
|
// (vr/camera_toggle.h).
|
|
|
|
#include "vr/camera_toggle.h"
|
|
|
|
#include <iostream>
|
|
|
|
namespace {
|
|
|
|
using mkw::vr::ClickToggle;
|
|
|
|
int g_failures = 0;
|
|
|
|
void Check(bool condition, const char* what) {
|
|
if (!condition) {
|
|
++g_failures;
|
|
std::cerr << "FAILED: " << what << '\n';
|
|
}
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main() {
|
|
ClickToggle click;
|
|
Check(!click.Update(true, false, false), "nothing on press");
|
|
Check(!click.Update(true, false, false), "nothing while held");
|
|
Check(click.Update(false, false, false), "a clean click fires on release");
|
|
Check(!click.Update(false, false, false), "fires once");
|
|
|
|
// Both thumbsticks (the gamepad settings-panel chord), in either order.
|
|
click.Update(true, false, false);
|
|
click.Update(true, true, false);
|
|
Check(!click.Update(false, true, false), "right then left: the chord, no toggle");
|
|
click.Update(false, true, false);
|
|
click.Update(true, true, false);
|
|
Check(!click.Update(false, false, false), "left then right: the chord, no toggle");
|
|
|
|
// The panel owned the controllers during the press.
|
|
click.Update(true, false, false);
|
|
click.Update(true, false, true);
|
|
Check(!click.Update(false, false, false), "blocked midway: no toggle");
|
|
click.Update(true, false, false);
|
|
Check(!click.Update(false, false, true), "blocked at release: no toggle");
|
|
|
|
// Recovers for the next clean click.
|
|
click.Update(true, false, false);
|
|
Check(click.Update(false, false, false), "a later clean click fires again");
|
|
|
|
click.Update(true, false, false);
|
|
click.Reset();
|
|
Check(!click.Update(false, false, false), "reset forgets a held press");
|
|
|
|
if (g_failures != 0) {
|
|
std::cerr << g_failures << " check(s) failed\n";
|
|
return 1;
|
|
}
|
|
std::cout << "vr camera toggle tests passed\n";
|
|
return 0;
|
|
}
|