Added more controller options to idzio

Add axis reversal for dinput and single stick steering for xinput.
This commit is contained in:
85be42b2ce67a8e34b32793360824b056c0c2444
2019-11-22 00:59:08 +00:00
committed by da5669c09fdb0a288ba01e259a609d7779ac7fc9
parent 4bc7eee909
commit 5b50824e2f
7 changed files with 91 additions and 6 deletions

View File

@ -66,6 +66,8 @@ static uint8_t idz_di_shift_up;
static uint8_t idz_di_view_chg;
static uint8_t idz_di_start;
static uint8_t idz_di_gear[6];
static bool idz_di_reverse_brake_axis;
static bool idz_di_reverse_accel_axis;
HRESULT idz_di_init(
const struct idz_di_config *cfg,
@ -265,6 +267,8 @@ static HRESULT idz_di_config_apply(const struct idz_di_config *cfg)
dprintf("Wheel: View Change button : %i\n", cfg->view_chg);
dprintf("Wheel: Shift Down button . : %i\n", cfg->shift_dn);
dprintf("Wheel: Shift Up button . . : %i\n", cfg->shift_up);
dprintf("Wheel: Reverse Brake Axis : %i\n", cfg->reverse_brake_axis);
dprintf("Wheel: Reverse Accel Axis : %i\n", cfg->reverse_accel_axis);
dprintf("Wheel: --- End configuration ---\n");
if (cfg->shifter_name[0] != L'\0') {
@ -287,6 +291,8 @@ static HRESULT idz_di_config_apply(const struct idz_di_config *cfg)
idz_di_view_chg = cfg->view_chg;
idz_di_shift_dn = cfg->shift_dn;
idz_di_shift_up = cfg->shift_up;
idz_di_reverse_brake_axis = cfg->reverse_brake_axis;
idz_di_reverse_accel_axis = cfg->reverse_accel_axis;
for (i = 0 ; i < 6 ; i++) {
idz_di_gear[i] = cfg->gear[i];
@ -501,6 +507,16 @@ static void idz_di_jvs_read_analogs(struct idz_io_analog_state *out)
accel = (LONG *) &state.bytes[idz_di_off_accel];
out->wheel = state.st.lX - 32768;
out->brake = 65535 - *brake;
out->accel = 65535 - *accel;
if (idz_di_reverse_brake_axis) {
out->brake = *brake;
} else {
out->brake = 65535 - *brake;
}
if (idz_di_reverse_accel_axis) {
out->accel = *accel;
} else {
out->accel = 65535 - *accel;
}
}