Files
spice2x.github.io/src/spice2x/games/ddr/io.h
T
bicarus 6bc1357d6a ddr: add support for analog axis-only pads and handle left+right / up+down input (#659)
## Link to GitHub Issue or related Pull Request, if one exists
n/a

## Description of change
Some crappy DDR soft mats (either USB-based or console pads with crappy
adapters that lack a dedicated "DDR pad mode") use X and Y analog axis
for arrows, which means they cannot cleanly report Up+Down or Left+Right
input.

According to some ancient Stepmania code, a lot of these report a middle
value (value between center and right, for example, for left+right).
Borrow this hack from Stepmania and implement it in spice as analog
input for DDR.

Also, for rawinput/xinput automatic bind scenario, update the logic so
that face buttons are always detected before analog axis / dpads for
consistency. This would help with binding any DDR pads that
simultaneously input face buttons / dpad / analog axis, so that we can
prefer face buttons when detected.

## Testing
I don't have any soft mats that have this, but it was tested with an
xbox controller.
2026-04-27 20:17:54 -07:00

195 lines
4.6 KiB
C++

#pragma once
#include <vector>
#include "cfg/api.h"
namespace games::ddr {
// all buttons in correct order
namespace Buttons {
enum {
SERVICE,
TEST,
COIN_MECH,
P1_START,
P1_PANEL_UP,
P1_PANEL_DOWN,
P1_PANEL_LEFT,
P1_PANEL_RIGHT,
P1_MENU_UP,
P1_MENU_DOWN,
P1_MENU_LEFT,
P1_MENU_RIGHT,
P2_START,
P2_PANEL_UP,
P2_PANEL_DOWN,
P2_PANEL_LEFT,
P2_PANEL_RIGHT,
P2_MENU_UP,
P2_MENU_DOWN,
P2_MENU_LEFT,
P2_MENU_RIGHT,
};
}
// all analogs in correct order
namespace Analogs {
enum {
P1_LEFT_RIGHT,
P1_UP_DOWN,
P2_LEFT_RIGHT,
P2_UP_DOWN
};
}
// all lights in correct order
namespace Lights {
enum {
P1_FOOT_LEFT,
P1_FOOT_UP,
P1_FOOT_RIGHT,
P1_FOOT_DOWN,
P2_FOOT_LEFT,
P2_FOOT_UP,
P2_FOOT_RIGHT,
P2_FOOT_DOWN,
SPOT_RED,
SPOT_BLUE,
TOP_SPOT_RED,
TOP_SPOT_BLUE,
P1_HALOGEN_UPPER,
P1_HAL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_MONITOR_SIDE_LEFT_AVG_G,
GOLD_MONITOR_SIDE_LEFT_AVG_B,
GOLD_MONITOR_SIDE_RIGHT_AVG_R,
GOLD_MONITOR_SIDE_RIGHT_AVG_G,
GOLD_MONITOR_SIDE_RIGHT_AVG_B,
GOLD_P1_FOOT_UP_AVG_R,
GOLD_P1_FOOT_UP_AVG_G,
GOLD_P1_FOOT_UP_AVG_B,
GOLD_P1_FOOT_DOWN_AVG_R,
GOLD_P1_FOOT_DOWN_AVG_G,
GOLD_P1_FOOT_DOWN_AVG_B,
GOLD_P1_FOOT_LEFT_AVG_R,
GOLD_P1_FOOT_LEFT_AVG_G,
GOLD_P1_FOOT_LEFT_AVG_B,
GOLD_P1_FOOT_RIGHT_AVG_R,
GOLD_P1_FOOT_RIGHT_AVG_G,
GOLD_P1_FOOT_RIGHT_AVG_B,
GOLD_P2_FOOT_UP_AVG_R,
GOLD_P2_FOOT_UP_AVG_G,
GOLD_P2_FOOT_UP_AVG_B,
GOLD_P2_FOOT_DOWN_AVG_R,
GOLD_P2_FOOT_DOWN_AVG_G,
GOLD_P2_FOOT_DOWN_AVG_B,
GOLD_P2_FOOT_LEFT_AVG_R,
GOLD_P2_FOOT_LEFT_AVG_G,
GOLD_P2_FOOT_LEFT_AVG_B,
GOLD_P2_FOOT_RIGHT_AVG_R,
GOLD_P2_FOOT_RIGHT_AVG_G,
GOLD_P2_FOOT_RIGHT_AVG_B,
GOLD_P1_STAGE_UP_LEFT,
GOLD_P1_STAGE_UP_RIGHT,
GOLD_P1_STAGE_DOWN_LEFT,
GOLD_P1_STAGE_DOWN_RIGHT,
GOLD_P2_STAGE_UP_LEFT,
GOLD_P2_STAGE_UP_RIGHT,
GOLD_P2_STAGE_DOWN_LEFT,
GOLD_P2_STAGE_DOWN_RIGHT,
};
}
// getters
std::vector<Button> &get_buttons();
std::string get_buttons_help();
std::string get_analogs_help();
std::vector<Analog> &get_analogs();
std::vector<Light> &get_lights();
}