Preliminary analog input fix
This commit is contained in:
parent
a9b48ab8ef
commit
ca6959c8e8
@ -90,8 +90,8 @@ bnusio_GetFirmwareVersion () {
|
||||
return 126;
|
||||
}
|
||||
|
||||
u16 drumMin = 10000;
|
||||
u16 drumMax = 20000;
|
||||
u16 drumMin = 15000;
|
||||
u16 drumMax = 30000;
|
||||
u16 drumWaitPeriod = 4;
|
||||
|
||||
u16 lastHitValue = drumMin;
|
||||
@ -107,9 +107,14 @@ SDLAxis analogBindings[] = {SDL_AXIS_LEFT_DOWN, SDL_AXIS_LEFT_RIGHT, SDL_AXIS_RI
|
||||
|
||||
u16
|
||||
bnusio_GetAnalogIn (u8 which) {
|
||||
u16 analogValue;
|
||||
if (useTaikoController) {
|
||||
return (int)(65535 * ControllerAxisIsDown (analogBindings[which]));
|
||||
} else {
|
||||
analogValue = (u16)(32768 * ControllerAxisIsDown (analogBindings[which]));
|
||||
if (analogValue > 100) {
|
||||
return analogValue;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
auto button = analogButtons[which];
|
||||
if (which == 0) {
|
||||
if (buttonWaitPeriodP1 > 0) buttonWaitPeriodP1--;
|
||||
@ -151,7 +156,6 @@ bnusio_GetAnalogIn (u8 which) {
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool testEnabled = false;
|
||||
@ -321,7 +325,10 @@ Init () {
|
||||
auto drum = openConfigSection (config, "drum");
|
||||
if (drum) drumWaitPeriod = readConfigInt (drum, "wait_period", drumWaitPeriod);
|
||||
auto taikoController = openConfigSection (config, "controller");
|
||||
if (taikoController) useTaikoController = readConfigBool (taikoController, "analog", useTaikoController);
|
||||
if (taikoController) {
|
||||
printf("Using analog input mode. All other input has been disabled.\n");
|
||||
useTaikoController = readConfigBool (taikoController, "analog", useTaikoController);
|
||||
}
|
||||
toml_free (config);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user