Files
spice2x.github.io/src/spice2x/games/ftt/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

76 lines
1.8 KiB
C++

#include "io.h"
std::vector<Button> &games::ftt::get_buttons() {
static std::vector<Button> buttons;
if (buttons.empty()) {
buttons = GameAPI::Buttons::getButtons("FutureTomTom");
GameAPI::Buttons::sortButtons(
&buttons,
"Service",
"Test",
"Pad 1",
"Pad 2",
"Pad 3",
"Pad 4"
);
}
return buttons;
}
std::string games::ftt::get_buttons_help() {
// keep to max 100 characters wide
return
" Pad1 Pad2 Pad3 Pad4"
"\n"
"Drum pads are velocity-sensitive."
;
}
std::vector<Analog> &games::ftt::get_analogs() {
static std::vector<Analog> analogs;
if (analogs.empty()) {
analogs = GameAPI::Analogs::getAnalogs("FutureTomTom");
using GameAPI::Analogs::AnalogType;
GameAPI::Analogs::sortAnalogsWithType(&analogs, {
{ "Pad 1", AnalogType::LinearPositive },
{ "Pad 2", AnalogType::LinearPositive },
{ "Pad 3", AnalogType::LinearPositive },
{ "Pad 4", AnalogType::LinearPositive }
});
}
return analogs;
}
std::vector<Light> &games::ftt::get_lights() {
static std::vector<Light> lights;
if (lights.empty()) {
lights = GameAPI::Lights::getLights("FutureTomTom");
GameAPI::Lights::sortLights(
&lights,
"Pad 1 Red",
"Pad 1 Green",
"Pad 1 Blue",
"Pad 2 Red",
"Pad 2 Green",
"Pad 2 Blue",
"Pad 3 Red",
"Pad 3 Green",
"Pad 3 Blue",
"Pad 4 Red",
"Pad 4 Green",
"Pad 4 Blue"
);
}
return lights;
}