Implement rumble for all controllers (needs tweaking), fix CFinalInput::InitializeAnalog

This commit is contained in:
Phillip Stephens 2022-04-03 18:13:17 -07:00
parent 3882f0332b
commit ce84609b4e
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
2 changed files with 15 additions and 9 deletions

View File

@ -162,10 +162,10 @@ void CFinalInput::InitializeAnalog(float leftDiv, float rightDiv) {
x21_enableAnaLeftYP = true; x21_enableAnaLeftYP = true;
} else if (xc_anaLeftY > 0.7f && sIsAnalogPressed[x4_controllerIdx][0]) { } else if (xc_anaLeftY > 0.7f && sIsAnalogPressed[x4_controllerIdx][0]) {
x21_enableAnaLeftYP = false; x21_enableAnaLeftYP = false;
} else if (xc_anaLeftY < 0.7f && !sIsAnalogPressed[x4_controllerIdx][0]) { } else if (xc_anaLeftY < -0.7f && !sIsAnalogPressed[x4_controllerIdx][0]) {
x21_enableAnaLeftYP = true; x21_enableAnaLeftYP = true;
sIsAnalogPressed[x4_controllerIdx][0] = true; sIsAnalogPressed[x4_controllerIdx][0] = true;
} else if (xc_anaLeftY < 0.7f && sIsAnalogPressed[x4_controllerIdx][0]) { } else if (xc_anaLeftY < -0.7f && sIsAnalogPressed[x4_controllerIdx][0]) {
x21_enableAnaLeftYP = false; x21_enableAnaLeftYP = false;
} else if (std::fabs(xc_anaLeftY) < 0.7f) { } else if (std::fabs(xc_anaLeftY) < 0.7f) {
x21_enableAnaLeftYP = false; x21_enableAnaLeftYP = false;
@ -177,10 +177,10 @@ void CFinalInput::InitializeAnalog(float leftDiv, float rightDiv) {
x20_enableAnaLeftXP = true; x20_enableAnaLeftXP = true;
} else if (x8_anaLeftX > 0.7f && sIsAnalogPressed[x4_controllerIdx][1]) { } else if (x8_anaLeftX > 0.7f && sIsAnalogPressed[x4_controllerIdx][1]) {
x20_enableAnaLeftXP = false; x20_enableAnaLeftXP = false;
} else if (x8_anaLeftX < 0.7f && !sIsAnalogPressed[x4_controllerIdx][1]) { } else if (x8_anaLeftX < -0.7f && !sIsAnalogPressed[x4_controllerIdx][1]) {
x20_enableAnaLeftXP = true; x20_enableAnaLeftXP = true;
sIsAnalogPressed[x4_controllerIdx][1] = true; sIsAnalogPressed[x4_controllerIdx][1] = true;
} else if (x8_anaLeftX < 0.7f && sIsAnalogPressed[x4_controllerIdx][1]) { } else if (x8_anaLeftX < -0.7f && sIsAnalogPressed[x4_controllerIdx][1]) {
x20_enableAnaLeftXP = false; x20_enableAnaLeftXP = false;
} else if (std::fabs(x8_anaLeftX) < 0.7f) { } else if (std::fabs(x8_anaLeftX) < 0.7f) {
x20_enableAnaLeftXP = false; x20_enableAnaLeftXP = false;
@ -192,10 +192,10 @@ void CFinalInput::InitializeAnalog(float leftDiv, float rightDiv) {
x23_enableAnaRightYP = true; x23_enableAnaRightYP = true;
} else if (x14_anaRightY > 0.7f && sIsAnalogPressed[x4_controllerIdx][2]) { } else if (x14_anaRightY > 0.7f && sIsAnalogPressed[x4_controllerIdx][2]) {
x23_enableAnaRightYP = false; x23_enableAnaRightYP = false;
} else if (x14_anaRightY < 0.7f && !sIsAnalogPressed[x4_controllerIdx][2]) { } else if (x14_anaRightY < -0.7f && !sIsAnalogPressed[x4_controllerIdx][2]) {
x23_enableAnaRightYP = true; x23_enableAnaRightYP = true;
sIsAnalogPressed[x4_controllerIdx][2] = true; sIsAnalogPressed[x4_controllerIdx][2] = true;
} else if (x14_anaRightY < 0.7f && sIsAnalogPressed[x4_controllerIdx][2]) { } else if (x14_anaRightY < -0.7f && sIsAnalogPressed[x4_controllerIdx][2]) {
x23_enableAnaRightYP = false; x23_enableAnaRightYP = false;
} else if (std::fabs(x14_anaRightY) < 0.7f) { } else if (std::fabs(x14_anaRightY) < 0.7f) {
x23_enableAnaRightYP = false; x23_enableAnaRightYP = false;
@ -207,10 +207,10 @@ void CFinalInput::InitializeAnalog(float leftDiv, float rightDiv) {
x22_enableAnaRightXP = true; x22_enableAnaRightXP = true;
} else if (x10_anaRightX > 0.7f && sIsAnalogPressed[x4_controllerIdx][3]) { } else if (x10_anaRightX > 0.7f && sIsAnalogPressed[x4_controllerIdx][3]) {
x22_enableAnaRightXP = false; x22_enableAnaRightXP = false;
} else if (x10_anaRightX < 0.7f && !sIsAnalogPressed[x4_controllerIdx][3]) { } else if (x10_anaRightX < -0.7f && !sIsAnalogPressed[x4_controllerIdx][3]) {
x22_enableAnaRightXP = true; x22_enableAnaRightXP = true;
sIsAnalogPressed[x4_controllerIdx][3] = true; sIsAnalogPressed[x4_controllerIdx][3] = true;
} else if (x10_anaRightX < 0.7f && sIsAnalogPressed[x4_controllerIdx][3]) { } else if (x10_anaRightX < -0.7f && sIsAnalogPressed[x4_controllerIdx][3]) {
x22_enableAnaRightXP = false; x22_enableAnaRightXP = false;
} else if (std::fabs(x10_anaRightX) < 0.7f) { } else if (std::fabs(x10_anaRightX) < 0.7f) {
x22_enableAnaRightXP = false; x22_enableAnaRightXP = false;

View File

@ -452,7 +452,13 @@ void PADControlAllMotors(const u32* commands) {
aurora::input::controller_rumble(instance, 0, 0, 0); aurora::input::controller_rumble(instance, 0, 0, 0);
} }
} else { } else {
// TODO: Figure out sane values for generic controllers if (commands[i] == PAD::MOTOR_STOP) {
aurora::input::controller_rumble(instance, 0, 0, 1);
} else if (commands[i] == PAD::MOTOR_RUMBLE) {
aurora::input::controller_rumble(instance, 32767, 32767, 0);
} else if (commands[i] == PAD::MOTOR_STOP_HARD) {
aurora::input::controller_rumble(instance, 0, 0, 0);
}
} }
} }
} }