Skip to content

Commit

Permalink
Fix FGC socd after remapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Zhao committed May 28, 2024
1 parent a824de9 commit 4a8b548
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
5 changes: 1 addition & 4 deletions config/mode_selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ void select_mode(CommunicationBackend *backend) {
InputState &inputs = backend->GetInputs();
if (inputs.mod_x && !inputs.mod_y && inputs.start) {
if (inputs.l) {
set_mode(
backend,
new Melee20Button(socd::SOCD_2IP_NO_REAC, { .crouch_walk_os = false })
);
set_mode(backend, new Melee20Button(socd::SOCD_2IP, { .crouch_walk_os = false }));
} else if (inputs.left) {
set_mode(
backend,
Expand Down
2 changes: 0 additions & 2 deletions config/pico/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ GpioButtonMapping button_mappings[] = {
{ &InputState::mod_y, 7 },

{ &InputState::start, 0 },
// { &InputState::select, 10},
// { &InputState::home, 11},

{ &InputState::c_up, 12 },
{ &InputState::c_left, 13 },
Expand Down
20 changes: 10 additions & 10 deletions src/modes/FgcMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
FgcMode::FgcMode(socd::SocdType horizontal_socd, socd::SocdType vertical_socd) {
_socd_pair_count = 4;
_socd_pairs = new socd::SocdPair[_socd_pair_count]{
socd::SocdPair{ &InputState::left, &InputState::right, horizontal_socd },
/* Mod X override C-Up input if both are pressed. Without this, neutral SOCD doesn't work
socd::SocdPair{ &InputState::left, &InputState::right, horizontal_socd },
/* Mod Y override C-Up input if both are pressed. Without this, neutral SOCD doesn't work
properly if Down and both Up buttons are pressed, because it first resolves Down + Mod X
to set both as unpressed, and then it sees C-Up as pressed but not Down, so you get an up
input instead of neutral. */
socd::SocdPair{ &InputState::mod_x, &InputState::c_up, socd::SOCD_DIR1_PRIORITY },
socd::SocdPair{ &InputState::down, &InputState::mod_x, vertical_socd },
socd::SocdPair{ &InputState::down, &InputState::c_up, vertical_socd },
socd::SocdPair{ &InputState::mod_y, &InputState::c_left, socd::SOCD_DIR1_PRIORITY },
socd::SocdPair{ &InputState::down, &InputState::mod_y, vertical_socd },
socd::SocdPair{ &InputState::down, &InputState::c_left, vertical_socd },
};
}

Expand All @@ -19,7 +19,7 @@ void FgcMode::UpdateDigitalOutputs(InputState &inputs, OutputState &outputs) {
outputs.dpadLeft = inputs.left;
outputs.dpadRight = inputs.right;
outputs.dpadDown = inputs.down;
outputs.dpadUp = inputs.mod_y || inputs.a;
outputs.dpadUp = inputs.mod_y || inputs.c_left;

// Right hand bottom row
outputs.a = inputs.x;
Expand All @@ -35,10 +35,10 @@ void FgcMode::UpdateDigitalOutputs(InputState &inputs, OutputState &outputs) {

// Menu keys
outputs.start = inputs.start;
outputs.select = inputs.c_up;
outputs.home = inputs.c_right;
outputs.leftStickClick = inputs.l || inputs.c_left;
outputs.rightStickClick = inputs.c_down || inputs.mod_x;
outputs.select = inputs.c_right;
outputs.home = inputs.c_down;
outputs.leftStickClick = inputs.l || inputs.a;
outputs.rightStickClick = inputs.c_up || inputs.mod_x;
}

void FgcMode::UpdateAnalogOutputs(InputState &inputs, OutputState &outputs) {
Expand Down

0 comments on commit 4a8b548

Please sign in to comment.