ControllerInterface: Implement axis scaling for axis-to-axis mappings

This feature allows us to work around analog stick range issues at the
intercardinal directions in certain titles (e.g. Rockman DASH 2) caused
by modern controllers having a tighter logical range of reporting than
PS1 analog controllers.
This commit is contained in:
Albert Liu
2020-06-06 18:49:25 -07:00
parent 840a80670f
commit 6b7c068f83
4 changed files with 25 additions and 1 deletions

View File

@ -29,6 +29,9 @@ public:
u32 GetControllerRumbleMotorCount(int controller_index) override;
void SetControllerRumbleStrength(int controller_index, const float* strengths, u32 num_motors) override;
// Set scaling that will be applied on axis-to-axis mappings
bool SetControllerAxisScale(int controller_index, float scale = 1.00f) override;
void PollEvents() override;
bool ProcessSDLEvent(const SDL_Event* event);
@ -42,6 +45,9 @@ private:
int joystick_id;
int player_id;
// Scaling value of 1.30f to 1.40f recommended when using recent controllers
float axis_scale = 1.00f;
std::array<AxisCallback, MAX_NUM_AXISES> axis_mapping;
std::array<ButtonCallback, MAX_NUM_BUTTONS> button_mapping;
std::array<std::array<ButtonCallback, 2>, MAX_NUM_AXISES> axis_button_mapping;