Files
spice2x.github.io/src/spice2x/games/we/io.cpp
T
bicarus af8d8dae9f rawinput: distinguish between circular and linear analog input (#665)
## Link to GitHub Issue or related Pull Request, if one exists
n/a

## Description of change
Currently, all analogs are treated as circular values that wrap around.
This works for knobs and turntables, but can get weird for linear values
(like tilt sensors and sliders) especially once analog options are
enabled, such as sensitivity.

This PR groups analogs into 3 buckets: circular, linear (centered), and
linear (positive). Linear types get different algorithms applied to it
when options are set (e.g., sensitivity caps out at 0, 1 instead of
wrapping around).

In linear mode:
* Sensitivity value applies an exponential response curve (power curve)
to the original value.
* Multiplier/divisor serves as a linear cut-off.
* Relative mode works as you expect, but of course, values don't wrap
around.
* Invert and deadzone work as you expect (since they applied to the
controller input anyway)
* Smoothing is removed from the UI and has no effect.
* Delay is unaffected.

Also, fix a small bug with -/+ button not working for analog `Delay`
option.

## Testing
WIP
2026-05-01 19:02:32 -07:00

85 lines
2.1 KiB
C++

#include "io.h"
std::vector<Button> &games::we::get_buttons() {
static std::vector<Button> buttons;
if (buttons.empty()) {
buttons = GameAPI::Buttons::getButtons("Winning Eleven");
GameAPI::Buttons::sortButtons(
&buttons,
"Service",
"Test",
"Coin Mech",
"Start",
"Up",
"Down",
"Left",
"Right",
"Button A",
"Button B",
"Button C",
"Button D",
"Button E",
"Button F",
"Pad Start",
"Pad Select",
"Pad Up",
"Pad Down",
"Pad Left",
"Pad Right",
"Pad Triangle",
"Pad Cross",
"Pad Square",
"Pad Circle",
"Pad L1",
"Pad L2",
"Pad L3",
"Pad R1",
"Pad R2",
"Pad R3"
);
}
return buttons;
}
std::vector<Analog> &games::we::get_analogs() {
static std::vector<Analog> analogs;
if (analogs.empty()) {
analogs = GameAPI::Analogs::getAnalogs("Winning Eleven");
using GameAPI::Analogs::AnalogType;
GameAPI::Analogs::sortAnalogsWithType(&analogs, {
{ "Pad Stick Left X", AnalogType::LinearCentered },
{ "Pad Stick Left Y", AnalogType::LinearCentered },
{ "Pad Stick Right X", AnalogType::LinearCentered },
{ "Pad Stick Right Y", AnalogType::LinearCentered }
});
}
return analogs;
}
std::vector<Light> &games::we::get_lights() {
static std::vector<Light> lights;
if (lights.empty()) {
lights = GameAPI::Lights::getLights("Winning Eleven");
GameAPI::Lights::sortLights(
&lights,
"Left Red",
"Left Green",
"Left Blue",
"Right Red",
"Right Green",
"Right Blue"
);
}
return lights;
}