Skip to content

Commit 7cdb5d6

Browse files
committed
Callbacks triggered at the beginning of function, instead of at the end.
1 parent 6e24a3a commit 7cdb5d6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

SerialPrograms/Source/Controllers/KeyboardInput/KeyboardInput.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,20 @@ class KeyboardManager : public KeyboardInputController, public KeyboardEventHand
123123
deltas.to_state(static_cast<StateType&>(state));
124124
}
125125
virtual void cancel_all_commands() override{
126+
report_keyboard_command_stopped();
126127
WriteSpinLock lg(m_lock);
127128
if (m_controller == nullptr){
128129
return;
129130
}
130131
m_controller->cancel_all_commands();
131-
report_keyboard_command_stopped();
132132
}
133133
virtual void replace_on_next_command() override{
134+
report_keyboard_command_stopped();
134135
WriteSpinLock lg(m_lock);
135136
if (m_controller == nullptr){
136137
return;
137138
}
138139
m_controller->replace_on_next_command();
139-
report_keyboard_command_stopped();
140140
}
141141

142142

SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_ProController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ProController::KeyboardManager final :
5252
}
5353
virtual void send_state(const ControllerState& state) override{
5454
const ProControllerState& switch_state = static_cast<const ProControllerState&>(state);
55+
report_keyboard_command_sent(switch_state);
5556
#if 0
5657
m_controller.logger().log(
5758
"VirtualController: (" + button_to_string(switch_state.buttons) +
@@ -78,7 +79,6 @@ class ProController::KeyboardManager final :
7879
switch_state.right_y
7980
);
8081

81-
report_keyboard_command_sent(switch_state);
8282
}
8383

8484

0 commit comments

Comments
 (0)