Adjust how deadzones work
Build Dusk / run-tests (push) Failing after 15s
Build Dusk / build-linux (push) Failing after 21s
Build Dusk / build-psp (push) Failing after 17s
Build Dusk / build-gamecube (push) Failing after 17s
Build Dusk / build-wii (push) Failing after 17s
Build Dusk / run-tests (push) Failing after 15s
Build Dusk / build-linux (push) Failing after 21s
Build Dusk / build-psp (push) Failing after 17s
Build Dusk / build-gamecube (push) Failing after 17s
Build Dusk / build-wii (push) Failing after 17s
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "input/input.h"
|
||||
#include "assert/assert.h"
|
||||
#include "log/log.h"
|
||||
#include "util/string.h"
|
||||
|
||||
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||
#ifdef DUSK_INPUT_GAMEPAD
|
||||
@@ -26,13 +28,14 @@ inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||
{ .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_X, .positive = true } } },
|
||||
{ .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_X, .positive = false } } },
|
||||
{ .name = "lstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_Y, .positive = true } } },
|
||||
{ .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_Y, .positive = false } } },
|
||||
{ .name = "rstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_X, .positive = true } } },
|
||||
{ .name = "rstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_X, .positive = false } } },
|
||||
{ .name = "rstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_Y, .positive = true } } },
|
||||
{ .name = "rstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_Y, .positive = false } } },
|
||||
{ .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_Y, .positive = false } } },
|
||||
{ .name = "ltrigger", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_TRIGGER_LEFT, .positive = true } } },
|
||||
{ .name = "rtrigger", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_TRIGGER_RIGHT, .positive = true } } },
|
||||
|
||||
#endif
|
||||
|
||||
{ .name = NULL }
|
||||
@@ -51,29 +54,13 @@ void inputUpdateDolphin(void) {
|
||||
for(uint8_t i = 0; i < INPUT_DOLPHIN_PAD_COUNT; i++) {
|
||||
INPUT.platform.padState[i] = PAD_ButtonsHeld(i);
|
||||
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_LEFT_X] = (
|
||||
INPUT_DOLPHIN_AXIS(PAD_StickX(i))
|
||||
);
|
||||
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_LEFT_Y] = (
|
||||
INPUT_DOLPHIN_AXIS(PAD_StickY(i))
|
||||
);
|
||||
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_C_X] = (
|
||||
INPUT_DOLPHIN_AXIS(PAD_SubStickX(i))
|
||||
);
|
||||
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_C_Y] = (
|
||||
INPUT_DOLPHIN_AXIS(PAD_SubStickY(i))
|
||||
);
|
||||
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_TRIGGER_LEFT] = (
|
||||
INPUT_DOLPHIN_AXIS(PAD_TriggerL(i))
|
||||
);
|
||||
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_TRIGGER_RIGHT] = (
|
||||
INPUT_DOLPHIN_AXIS(PAD_TriggerR(i))
|
||||
);
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_LEFT_X] = PAD_StickX(i);
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_LEFT_Y] = PAD_StickY(i);
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_C_X] = PAD_SubStickX(i);
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_C_Y] = PAD_SubStickY(i);
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_TRIGGER_LEFT]=PAD_TriggerL(i);
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_TRIGGER_RIGHT]=PAD_TriggerR(i);
|
||||
// Because gamecube sticks are hexagons this is going to be weird.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -87,10 +74,11 @@ float_t inputButtonGetValueDolphin(const inputbutton_t button) {
|
||||
}
|
||||
|
||||
case INPUT_BUTTON_TYPE_GAMEPAD_AXIS: {
|
||||
float_t value = INPUT.platform.pads[0][button.gpAxis.axis];
|
||||
float_t axis = INPUT.platform.pads[0][button.gpAxis.axis];
|
||||
float_t value = axis / 128.0f;
|
||||
if(!button.gpAxis.positive) value = -value;
|
||||
if(value >= INPUT.deadzone) return value;
|
||||
return 0.0f;
|
||||
value = inputDeadzone(value, inputGetDeadzoneDolphin(button));
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -99,4 +87,8 @@ float_t inputButtonGetValueDolphin(const inputbutton_t button) {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float_t inputGetDeadzoneDolphin(const inputbutton_t button) {
|
||||
return 0.2f;
|
||||
}
|
||||
@@ -63,4 +63,12 @@ void inputUpdateDolphin(void);
|
||||
* @param button The button to get the value of.
|
||||
* @return The value of the button, between 0 and 1.
|
||||
*/
|
||||
float_t inputButtonGetValueDolphin(const inputbutton_t button);
|
||||
float_t inputButtonGetValueDolphin(const inputbutton_t button);
|
||||
|
||||
/**
|
||||
* Returns the deadzone for the given button.
|
||||
*
|
||||
* @param button The button to get the deadzone of.
|
||||
* @return The deadzone for the button, between 0 and 1.
|
||||
*/
|
||||
float_t inputGetDeadzoneDolphin(const inputbutton_t button);
|
||||
Reference in New Issue
Block a user