Skip to content

Commit

Permalink
Debugger: Include all press states for convenience.
Browse files Browse the repository at this point in the history
In case of a multi-button shortcut, which might be common for debugging.
  • Loading branch information
unknownbrackets committed Jan 19, 2021
1 parent e26d205 commit 25cf746
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Core/Debugger/WebSocket/InputBroadcaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
//
// Sent unexpectedly with these properties:
// - buttons: an object with button names as keys and bool press state as values.
// - changed: same as buttons, but only including changed states.
//
// See input.buttons.send in InputSubscriber for button names. Only changed buttons are sent.
// See input.buttons.send in InputSubscriber for button names.

// Analog position change (input.analog)
//
Expand Down Expand Up @@ -55,6 +56,11 @@ static std::string ButtonsEvent(uint32_t lastButtons, uint32_t newButtons) {
j.begin();
j.writeString("event", "input.buttons");
j.pushDict("buttons");
for (auto it : WebSocketInputButtonLookup()) {
j.writeBool(it.first, (newButtons & it.second) != 0);
}
j.pop();
j.pushDict("changed");
for (auto it : WebSocketInputButtonLookup()) {
if (pressed & it.second) {
j.writeBool(it.first, true);
Expand Down

0 comments on commit 25cf746

Please sign in to comment.