Additional Joystick options

This commit is contained in:
Jasmine Iwanek
2025-08-26 19:51:37 -04:00
parent ab7de13297
commit 817bfa5aec
28 changed files with 3205 additions and 673 deletions

View File

@@ -88,27 +88,52 @@ static const joystick_t joystick_none = {
static const struct {
const joystick_t *joystick;
} joysticks[] = {
{ &joystick_none },
{ &joystick_2axis_2button },
{ &joystick_2button_gamepad },
{ &joystick_2button_flight_yoke },
{ &joystick_2axis_4button },
{ &joystick_4button_gamepad },
{ &joystick_4button_flight_yoke },
{ &joystick_2axis_6button },
{ &joystick_2axis_8button },
{ &joystick_3axis_2button },
{ &joystick_2button_yoke_throttle },
{ &joystick_3axis_4button },
{ &joystick_steering_wheel_4_button },
{ &joystick_4button_yoke_throttle },
{ &joystick_4axis_4button },
{ &joystick_ch_flightstick_pro },
{ &joystick_ch_flightstick_pro_ch_pedals },
{ &joystick_sw_pad },
{ &joystick_tm_fcs },
{ &joystick_tm_fcs_rcs },
{ NULL }
{ &joystick_none },
{ &joystick_generic_paddle },
{ &joystick_2axis_1button },
{ &joystick_2axis_2button },
{ &joystick_2axis_3button },
{ &joystick_2axis_4button },
{ &joystick_2axis_6button },
{ &joystick_2axis_8button },
{ &joystick_3axis_2button },
{ &joystick_3axis_3button },
{ &joystick_3axis_4button },
{ &joystick_4axis_2button },
{ &joystick_4axis_3button },
{ &joystick_4axis_4button },
{ &joystick_2button_gamepad },
{ &joystick_3button_gamepad },
{ &joystick_4button_gamepad },
{ &joystick_6button_gamepad },
{ &joystick_gravis_gamepad },
{ &joystick_2button_flight_yoke },
{ &joystick_3button_flight_yoke },
{ &joystick_4button_flight_yoke },
{ &joystick_2button_yoke_throttle },
{ &joystick_3button_yoke_throttle },
{ &joystick_4button_yoke_throttle },
{ &joystick_steering_wheel_2_button },
{ &joystick_steering_wheel_3_button },
{ &joystick_steering_wheel_4_button },
{ &joystick_ch_flightstick },
{ &joystick_ch_flightstick_ch_pedals },
{ &joystick_ch_flightstick_ch_pedals_pro },
{ &joystick_ch_flightstick_pro },
{ &joystick_ch_flightstick_pro_ch_pedals },
{ &joystick_ch_flightstick_pro_ch_pedals_pro },
{ &joystick_ch_virtual_pilot },
{ &joystick_ch_virtual_pilot_ch_pedals },
{ &joystick_ch_virtual_pilot_ch_pedals_pro },
{ &joystick_ch_virtual_pilot_pro },
{ &joystick_ch_virtual_pilot_pro_ch_pedals },
{ &joystick_ch_virtual_pilot_pro_ch_pedals_pro },
{ &joystick_sw_pad },
{ &joystick_tm_fcs },
{ &joystick_tm_fcs_rcs },
{ &joystick_tm_formula_t1t2 },
{ &joystick_tm_formula_t1t2wa },
{ NULL }
};
static joystick_instance_t *joystick_instance[GAMEPORT_MAX] = { NULL, NULL };

View File

@@ -57,6 +57,22 @@ ch_flightstick_pro_close(UNUSED(void *priv))
//
}
static uint8_t
ch_flightstick_read(UNUSED(void *priv))
{
uint8_t ret = 0xf0;
uint8_t gp = 0;
if (JOYSTICK_PRESENT(gp, 0)) {
if (joystick_state[gp][0].button[0])
ret &= ~0x10;
if (joystick_state[gp][0].button[1])
ret &= ~0x20;
}
return ret;
}
static uint8_t
ch_flightstick_pro_read(UNUSED(void *priv))
{
@@ -72,20 +88,81 @@ ch_flightstick_pro_read(UNUSED(void *priv))
ret &= ~0x40;
if (joystick_state[gp][0].button[3])
ret &= ~0x80;
// POV Hat
if (joystick_state[gp][0].pov[0] != -1) {
// POV Up
if ((joystick_state[gp][0].pov[0] > 315) || (joystick_state[gp][0].pov[0] < 45))
ret &= ~0xf0;
ret &= ~0xf0; // 1, 2, 3, 4
// POV Right
else if ((joystick_state[gp][0].pov[0]) >= 45 && (joystick_state[gp][0].pov[0] < 135))
ret &= ~0xb0;
else if ((joystick_state[gp][0].pov[0] >= 45) && (joystick_state[gp][0].pov[0] < 135))
ret &= ~0xb0; // 1, 2, 4
// POV Down
else if ((joystick_state[gp][0].pov[0]) >= 135 && (joystick_state[gp][0].pov[0] < 225))
ret &= ~0x70;
else if ((joystick_state[gp][0].pov[0] >= 135) && (joystick_state[gp][0].pov[0] < 225))
ret &= ~0x70; // 1, 2, 3
// POV Left
else if ((joystick_state[gp][0].pov[0]) >= 225 && (joystick_state[gp][0].pov[0] < 315))
ret &= ~0x30;
else if ((joystick_state[gp][0].pov[0] >= 225) && (joystick_state[gp][0].pov[0] < 315))
ret &= ~0x30; // 1, 2
}
}
return ret;
}
static uint8_t
ch_virtual_pilot_pro_read(UNUSED(void *priv))
{
uint8_t gp = 0;
uint8_t ret = 0xf0;
if (JOYSTICK_PRESENT(gp, 0)) {
if (joystick_state[gp][0].button[0]) // 1
ret &= ~0x10;
if (joystick_state[gp][0].button[1]) // 2
ret &= ~0x20;
if (joystick_state[gp][0].button[2]) // 3
ret &= ~0x40;
if (joystick_state[gp][0].button[3]) // 4
ret &= ~0x80;
if (joystick_state[gp][0].button[4]) // 1, 3
ret &= ~0x50;
if (joystick_state[gp][0].button[5]) // 1, 4
ret &= ~0x90;
// Right POV Hat
uint8_t pov_id = 0;
if (joystick_state[gp][0].pov[pov_id] != -1) {
// POV Up
if ((joystick_state[gp][0].pov[pov_id] > 315) || (joystick_state[gp][0].pov[pov_id] < 45))
ret &= ~0xf0; // 1, 2, 3, 4
// POV Right
else if ((joystick_state[gp][0].pov[pov_id] >= 45) && (joystick_state[gp][0].pov[pov_id] < 135))
ret &= ~0xb0; // 1, 2, 4
// POV Down
else if ((joystick_state[gp][0].pov[pov_id] >= 135) && (joystick_state[gp][0].pov[pov_id] < 225))
ret &= ~0x70; // 1, 2, 3
// POV Left
else if ((joystick_state[gp][0].pov[pov_id] >= 225) && (joystick_state[gp][0].pov[pov_id] < 315))
ret &= ~0x30; // 1, 2
}
// Left POV Hat
pov_id = 1;
if (joystick_state[gp][0].pov[pov_id] != -1) {
// POV Up
if ((joystick_state[gp][0].pov[pov_id] > 315) || (joystick_state[gp][0].pov[pov_id] < 45))
ret &= ~0xe0; // 2, 3, 4
// POV Right
else if ((joystick_state[gp][0].pov[pov_id] >= 45) && (joystick_state[gp][0].pov[pov_id] < 135))
ret &= ~0xa0; // 2, 4
// POV Down
else if ((joystick_state[gp][0].pov[pov_id] >= 135) && (joystick_state[gp][0].pov[pov_id] < 225))
ret &= ~0x60; // 2, 3
// POV Left
else if ((joystick_state[gp][0].pov[pov_id] >= 225) && (joystick_state[gp][0].pov[pov_id] < 315))
ret &= ~0xc0; // 3, 4
}
}
@@ -148,6 +225,60 @@ ch_flightstick_pro_a0_over(UNUSED(void *priv))
//
}
const joystick_t joystick_ch_flightstick = {
.name = "CH Flightstick",
.internal_name = "ch_flightstick",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 3,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_ch_flightstick_ch_pedals = {
.name = "CH Flightstick + CH Pedals",
.internal_name = "ch_flightstick_ch_pedals",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle", "Rudder (Yaw)" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_ch_flightstick_ch_pedals_pro = {
.name = "CH Flightstick + CH Pedals Pro",
.internal_name = "ch_flightstick_ch_pedals_pro",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Right Pedal", "Left Pedal" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_ch_flightstick_pro = {
.name = "CH Flightstick Pro",
.internal_name = "ch_flightstick_pro",
@@ -161,7 +292,7 @@ const joystick_t joystick_ch_flightstick_pro = {
.button_count = 4,
.pov_count = 1,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Throttle" },
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { "POV" }
};
@@ -179,7 +310,133 @@ const joystick_t joystick_ch_flightstick_pro_ch_pedals = {
.button_count = 4,
.pov_count = 1,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Throttle", "Rudder" },
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle", "Rudder (Yaw)" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { "POV" }
};
const joystick_t joystick_ch_flightstick_pro_ch_pedals_pro = {
.name = "CH Flightstick Pro + CH Pedals Pro",
.internal_name = "ch_flightstick_pro_ch_pedals_pro",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_pro_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 4,
.pov_count = 1,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Right Pedal", "Left Pedal" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { "POV" }
};
const joystick_t joystick_ch_virtual_pilot = {
.name = "CH Virtual Pilot",
.internal_name = "ch_virtual_pilot",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 3,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_ch_virtual_pilot_ch_pedals = {
.name = "CH Virtual Pilot + CH Pedals",
.internal_name = "ch_virtual_pilot_ch_pedals",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle", "Rudder (Yaw)" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_ch_virtual_pilot_ch_pedals_pro = {
.name = "CH Virtual Pilot + CH Pedals Pro",
.internal_name = "ch_virtual_pilot_ch_pedals_pro",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Right Pedal", "Left Pedal" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_ch_virtual_pilot_pro = {
.name = "CH Virtual Pilot Pro",
.internal_name = "ch_virtual_pilot_pro",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_virtual_pilot_pro_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 3,
.button_count = 6,
.pov_count = 2,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6" },
.pov_names = { "Right POV", "Left POV" }
};
const joystick_t joystick_ch_virtual_pilot_pro_ch_pedals = {
.name = "CH Virtual Pilot Pro + CH Pedals",
.internal_name = "ch_virtual_pilot_pro_ch_pedals",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_virtual_pilot_pro_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 6,
.pov_count = 2,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Throttle", "Rudder (Yaw)" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6" },
.pov_names = { "Right POV", "Left POV" }
};
const joystick_t joystick_ch_virtual_pilot_pro_ch_pedals_pro = {
.name = "CH Virtual Pilot Pro + CH Pedals Pro",
.internal_name = "ch_virtual_pilot_pro_ch_pedals_pro",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_virtual_pilot_pro_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 6,
.pov_count = 2,
.max_joysticks = 1,
.axis_names = { "X axis (Roll)", "Y axis (Pitch)", "Right Pedal", "Left Pedal" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6" },
.pov_names = { "Right POV", "Left POV" }
};

View File

@@ -57,6 +57,27 @@ joystick_standard_close(UNUSED(void *priv))
//
}
static uint8_t
joystick_paddle_read(UNUSED(void *priv))
{
uint8_t gp = 0;
uint8_t ret = 0xf0;
if ((JOYSTICK_PRESENT(gp, 0)) && (joystick_state[gp][0].button[0]))
ret &= ~0x10;
if ((JOYSTICK_PRESENT(gp, 2)) && (joystick_state[gp][2].button[0]))
ret &= ~0x20;
if ((JOYSTICK_PRESENT(gp, 1)) && (joystick_state[gp][1].button[0]))
ret &= ~0x40;
if ((JOYSTICK_PRESENT(gp, 3)) && (joystick_state[gp][3].button[0]))
ret &= ~0x80;
return ret;
}
static uint8_t
joystick_standard_read(UNUSED(void *priv))
{
@@ -80,6 +101,24 @@ joystick_standard_read(UNUSED(void *priv))
return ret;
}
static uint8_t
joystick_standard_read_3button(UNUSED(void *priv))
{
uint8_t gp = 0;
uint8_t ret = 0xf0;
if (JOYSTICK_PRESENT(gp, 0)) {
if (joystick_state[gp][0].button[0])
ret &= ~0x10;
if (joystick_state[gp][0].button[1])
ret &= ~0x20;
if (joystick_state[gp][0].button[2])
ret &= ~0x40;
}
return ret;
}
static uint8_t
joystick_standard_read_4button(UNUSED(void *priv))
{
@@ -106,6 +145,33 @@ joystick_standard_write(UNUSED(void *priv))
//
}
static int
joystick_paddle_read_axis(UNUSED(void *priv), int axis)
{
uint8_t gp = 0;
switch (axis) {
case 0:
if (!JOYSTICK_PRESENT(gp, 0))
return AXIS_NOT_PRESENT;
return joystick_state[gp][0].axis[0];
case 1:
if (!JOYSTICK_PRESENT(gp, 2))
return AXIS_NOT_PRESENT;
return joystick_state[gp][2].axis[0];
case 2:
if (!JOYSTICK_PRESENT(gp, 1))
return AXIS_NOT_PRESENT;
return joystick_state[gp][1].axis[0];
case 3:
if (!JOYSTICK_PRESENT(gp, 3))
return AXIS_NOT_PRESENT;
return joystick_state[gp][3].axis[0];
default:
return 0;
}
}
static int
joystick_standard_read_axis(UNUSED(void *priv), int axis)
{
@@ -134,7 +200,7 @@ joystick_standard_read_axis(UNUSED(void *priv), int axis)
}
static int
joystick_standard_read_axis_4button(UNUSED(void *priv), int axis)
joystick_standard_read_axis_2axis(UNUSED(void *priv), int axis)
{
uint8_t gp = 0;
@@ -168,7 +234,7 @@ joystick_standard_read_axis_with_pov(UNUSED(void *priv), int axis)
return joystick_state[gp][0].axis[0];
case 1: // Y-axis
return joystick_state[gp][0].axis[1];
case 2: // POV Hat (mapped to the 3rd logical axis, index 2)
case 2: // POV Hat
if (joystick_state[gp][0].pov[0] == -1)
return 32767; // Centered/No input (as per tm_fcs_rcs_read_axis example)
if (joystick_state[gp][0].pov[0] > 315 || joystick_state[gp][0].pov[0] < 45)
@@ -179,9 +245,8 @@ joystick_standard_read_axis_with_pov(UNUSED(void *priv), int axis)
return 0; // Right/Left (example, matches tm_fcs_rcs_read_axis)
if (joystick_state[gp][0].pov[0] >= 225 && joystick_state[gp][0].pov[0] < 315)
return 16384; // Down-Left (example value, matches tm_fcs_rcs_read_axis)
return 0; // Fallback
case 3: // This case might be used for a Z-axis if present, or can return 0 if not.
// For gamepads with only X/Y and POV, this will likely be unused or return 0.
return 0;
case 3:
return 0;
default:
return 0;
@@ -289,6 +354,42 @@ joystick_standard_a0_over(UNUSED(void *priv))
//
}
const joystick_t joystick_generic_paddle = {
.name = "Generic Paddle Controller(s)",
.internal_name = "generic_paddle",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_paddle_read,
.write = joystick_standard_write,
.read_axis = joystick_paddle_read_axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 1,
.button_count = 1,
.pov_count = 0,
.max_joysticks = 4,
.axis_names = { "X axis" },
.button_names = { "Button 1" },
.pov_names = { NULL }
};
const joystick_t joystick_2axis_1button = {
.name = "2-axis, 1-button joystick(s)",
.internal_name = "2axis_1button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 1,
.pov_count = 0,
.max_joysticks = 2,
.axis_names = { "X axis", "Y axis" },
.button_names = { "Button 1" },
.pov_names = { NULL }
};
const joystick_t joystick_2axis_2button = {
.name = "2-axis, 2-button joystick(s)",
.internal_name = "2axis_2button",
@@ -307,39 +408,21 @@ const joystick_t joystick_2axis_2button = {
.pov_names = { NULL }
};
const joystick_t joystick_2button_gamepad = {
.name = "2-button gamepad(s)",
.internal_name = "2button_gamepad",
const joystick_t joystick_2axis_3button = {
.name = "2-axis, 3-button joystick",
.internal_name = "2axis_3button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.read = joystick_standard_read_3button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 2,
.button_count = 3,
.pov_count = 0,
.max_joysticks = 2,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_2button_flight_yoke = {
.name = "2-button flight yoke",
.internal_name = "2button_flight_yoke",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 2,
.axis_names = { "Roll axis", "Pitch axis" },
.button_names = { "Trigger", "Button 2" },
.button_names = { "Button 1", "Button 2", "Button 3" },
.pov_names = { NULL }
};
@@ -350,7 +433,7 @@ const joystick_t joystick_2axis_4button = {
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_4button,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 4,
@@ -361,150 +444,6 @@ const joystick_t joystick_2axis_4button = {
.pov_names = { NULL }
};
const joystick_t joystick_4button_gamepad = {
.name = "4-button gamepad",
.internal_name = "4button_gamepad",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_4button,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_4button_flight_yoke = {
.name = "4-button flight yoke",
.internal_name = "4button_flight_yoke",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_4button,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis" },
.button_names = { "Trigger", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_3axis_2button = {
.name = "3-axis, 2-button joystick",
.internal_name = "3axis_2button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_2button_yoke_throttle = {
.name = "2-button flight yoke with throttle",
.internal_name = "2button_yoke_throttle",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis", "Throttle axis" },
.button_names = { "Trigger", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_3axis_4button = {
.name = "3-axis, 4-button joystick",
.internal_name = "3axis_4button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_4button_yoke_throttle = {
.name = "4-button flight yoke with throttle",
.internal_name = "4button_yoke_throttle",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis", "Throttle axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_steering_wheel_4_button = {
.name = "Steering Wheel (3-axis, 4-button)",
.internal_name = "steering_wheel_4_button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Steering axis", "Accelerator axis", "Brake axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_4axis_4button = {
.name = "4-axis, 4-button joystick",
.internal_name = "4axis_4button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_4axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 4,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis", "zX axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_2axis_6button = {
.name = "2-axis, 6-button joystick",
.internal_name = "2axis_6button",
@@ -540,3 +479,401 @@ const joystick_t joystick_2axis_8button = {
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6", "Button 7", "Button 8" },
.pov_names = { NULL }
};
const joystick_t joystick_3axis_2button = {
.name = "3-axis, 2-button joystick",
.internal_name = "3axis_2button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_3axis_3button = {
.name = "3-axis, 3-button joystick",
.internal_name = "3axis_3button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_3button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 3,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis" },
.button_names = { "Button 1", "Button 2", "Button 3" },
.pov_names = { NULL }
};
const joystick_t joystick_3axis_4button = {
.name = "3-axis, 4-button joystick",
.internal_name = "3axis_4button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_4axis_2button = {
.name = "4-axis, 2-button joystick",
.internal_name = "4axis_2button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_4axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 4,
.button_count = 3,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis", "zX axis" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_4axis_3button = {
.name = "4-axis, 3-button joystick",
.internal_name = "4axis_3button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_3button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_4axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 4,
.button_count = 3,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis", "zX axis" },
.button_names = { "Button 1", "Button 2", "Button 3" },
.pov_names = { NULL }
};
const joystick_t joystick_4axis_4button = {
.name = "4-axis, 4-button joystick",
.internal_name = "4axis_4button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_4axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 4,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Z axis", "zX axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_2button_gamepad = {
.name = "2-button gamepad(s)",
.internal_name = "2button_gamepad",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 2,
.axis_names = { "X axis", "Y axis" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_3button_gamepad = {
.name = "3-button gamepad",
.internal_name = "3button_gamepad",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_3button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 3,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis" },
.button_names = { "Button 1", "Button 2", "Button 3" },
.pov_names = { NULL }
};
const joystick_t joystick_4button_gamepad = {
.name = "4-button gamepad",
.internal_name = "4button_gamepad",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_6button_gamepad = {
.name = "6-button gamepad",
.internal_name = "6button_gamepad",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_6button,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 6,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6" },
.pov_names = { NULL }
};
const joystick_t joystick_gravis_gamepad = {
.name = "Gravis PC GamePad",
.internal_name = "gravis_gamepad",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis" },
// TODO: Check this
.button_names = { "Button 1 (Red)", "Button 2 (Blue)", "Button 3 (Yellow)", "Button 4 (Green)" },
.pov_names = { NULL }
};
const joystick_t joystick_2button_flight_yoke = {
.name = "2-button flight yoke",
.internal_name = "2button_flight_yoke",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 2,
.axis_names = { "Roll axis", "Pitch axis" },
.button_names = { "Trigger", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_3button_flight_yoke = {
.name = "3-button flight yoke",
.internal_name = "3button_flight_yoke",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_3button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 3,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis" },
.button_names = { "Trigger", "Button 2", "Button 3" },
.pov_names = { NULL }
};
const joystick_t joystick_4button_flight_yoke = {
.name = "4-button flight yoke",
.internal_name = "4button_flight_yoke",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis" },
.button_names = { "Trigger", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_2button_yoke_throttle = {
.name = "2-button flight yoke with throttle",
.internal_name = "2button_yoke_throttle",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 2,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis", "Throttle axis" },
.button_names = { "Trigger", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_3button_yoke_throttle = {
.name = "3-button flight yoke with throttle",
.internal_name = "3button_yoke_throttle",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_3button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 3,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis", "Throttle axis" },
.button_names = { "Button 1", "Button 2", "Button 3" },
.pov_names = { NULL }
};
const joystick_t joystick_4button_yoke_throttle = {
.name = "4-button flight yoke with throttle",
.internal_name = "4button_yoke_throttle",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Roll axis", "Pitch axis", "Throttle axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_steering_wheel_2_button = {
.name = "Steering Wheel (3-axis, 2-button)",
.internal_name = "steering_wheel_2_button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Steering axis", "Accelerator axis", "Brake axis" },
.button_names = { "Button 1", "Button 2" },
.pov_names = { NULL }
};
const joystick_t joystick_steering_wheel_3_button = {
.name = "Steering Wheel (3-axis, 3-button)",
.internal_name = "steering_wheel_3_button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_3button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Steering axis", "Accelerator axis", "Brake axis" },
.button_names = { "Button 1", "Button 2", "Button 3" },
.pov_names = { NULL }
};
const joystick_t joystick_steering_wheel_4_button = {
.name = "Steering Wheel (3-axis, 4-button)",
.internal_name = "steering_wheel_4_button",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Steering axis", "Accelerator axis", "Brake axis" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { NULL }
};
const joystick_t joystick_tm_formula_t1t2 = {
.name = "Thrustmaster Formula T1/T2 with Adaptor",
.internal_name = "thrustmaster_formula_t1t2",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_2axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 2,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Steering axis", "Accelerator/Brake axis" },
.button_names = { "Shifter Up", "Shifter Down", "Top Console Switch", "Bottom Console Switch" },
.pov_names = { NULL }
};
// TODO Validate this
const joystick_t joystick_tm_formula_t1t2wa = {
.name = "Thrustmaster Formula T1/T2 without Adaptor",
.internal_name = "thrustmaster_formula_t1t2wa",
.init = joystick_standard_init,
.close = joystick_standard_close,
.read = joystick_standard_read_4button,
.write = joystick_standard_write,
.read_axis = joystick_standard_read_axis_3axis,
.a0_over = joystick_standard_a0_over,
.axis_count = 3,
.button_count = 4,
.pov_count = 0,
.max_joysticks = 1,
.axis_names = { "Steering axis", "Accelerator axis", "Brake axis" },
.button_names = { "Shifter Up", "Shifter Down", "Top Console Switch", "Bottom Console Switch" },
.pov_names = { NULL }
};