Open the menu for everyone: F1, Esc and Minus+Plus toggle it, the combo never reaches the game, the page offers Continue and Quit game, and closing after Esc gives the mouse capture back

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-26 09:49:15 +03:00
1 parent 81af84d327
commit 0cfc489bbf
8 files changed
+94 -41

No files matched your search

+17
View File
@@ -159,3 +159,20 @@ void input_mouse_stick(int32_t dx, int32_t dy, double dt_s, float sens, int32_t
out[0] = (int32_t)lrint(x);
out[1] = (int32_t)lrint(y);
}
// Minus and Plus held together open or close the menu. *held: the combo was down at the previous poll (the caller keeps it).
// The poll where both are down reports neither to the game, and neither does any later poll of the same hold; Minus alone
// reaches the game unchanged. With the menu open the game sees a neutral pad. Returns 1 in the poll where the combo goes
// down: the caller toggles the menu once.
int input_menu_gate(int *held, int menu_open, uint64_t *buttons, int32_t sticks[4]) {
const uint64_t combo = 1ull << B_MINUS | 1ull << B_PLUS;
int down = (*buttons & combo) == combo;
int edge = down && !*held;
*held = down;
if (down) *buttons &= ~combo;
if (menu_open) {
*buttons = 0;
sticks[0] = sticks[1] = sticks[2] = sticks[3] = 0;
}
return edge;
}