Skip to content

Commit 531ab66

Browse files
committed
Add SOCD cleaner for dpad
Apparently required for some fighting games. Using button inputs directly (press/release/set) will get around this.
1 parent 3448fd9 commit 531ab66

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/XInput.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,15 @@ void XInputGamepad::setButton(XInputControl button, boolean state) {
174174
}
175175
}
176176

177-
// To-do: add SOCD cleaner
178177
void XInputGamepad::setDpad(XInputControl pad, boolean state) {
179178
setButton(pad, state);
180179
}
181180

182-
183181
void XInputGamepad::setDpad(boolean up, boolean down, boolean left, boolean right) {
182+
// Simultaneous Opposite Cardinal Directions (SOCD) Cleaner
183+
if (up && down) { down = false; } // Up + Down = Up
184+
if (left && right) { left = false; right = false; } // Left + Right = Neutral
185+
184186
setDpad(DPAD_UP, up);
185187
setDpad(DPAD_DOWN, down);
186188
setDpad(DPAD_LEFT, left);

0 commit comments

Comments
 (0)