Skip to content

Commit 9dde6a6

Browse files
committed
Make D-Pad SOCD optional
Additional argument that defaults to 'true'
1 parent b81e317 commit 9dde6a6

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/XInput.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,12 @@ void XInputController::setDpad(XInputControl pad, boolean state) {
236236
setButton(pad, state);
237237
}
238238

239-
void XInputController::setDpad(boolean up, boolean down, boolean left, boolean right) {
239+
void XInputController::setDpad(boolean up, boolean down, boolean left, boolean right, boolean useSOCD) {
240240
// Simultaneous Opposite Cardinal Directions (SOCD) Cleaner
241-
if (up && down) { down = false; } // Up + Down = Up
242-
if (left && right) { left = false; right = false; } // Left + Right = Neutral
241+
if (useSOCD) {
242+
if (up && down) { down = false; } // Up + Down = Up
243+
if (left && right) { left = false; right = false; } // Left + Right = Neutral
244+
}
243245

244246
const boolean autoSendTemp = autoSendOption; // Save autosend state
245247
autoSendOption = false; // Disable temporarily

src/XInput.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class XInputController {
8686
void setButton(uint8_t button, boolean state);
8787

8888
void setDpad(XInputControl pad, boolean state);
89-
void setDpad(boolean up, boolean down, boolean left, boolean right);
89+
void setDpad(boolean up, boolean down, boolean left, boolean right, boolean useSOCD = true);
9090

9191
void setTrigger(XInputControl trigger, int32_t val);
9292

0 commit comments

Comments
 (0)