Some improvements to code readability
This commit is contained in:
@@ -61,13 +61,13 @@ typedef struct _joystick_instance_ {
|
|||||||
uint8_t state;
|
uint8_t state;
|
||||||
g_axis_t axis[4];
|
g_axis_t axis[4];
|
||||||
|
|
||||||
const joystick_if_t *intf;
|
const joystick_t *intf;
|
||||||
void *dat;
|
void *dat;
|
||||||
} joystick_instance_t;
|
} joystick_instance_t;
|
||||||
|
|
||||||
int joystick_type = JS_TYPE_NONE;
|
int joystick_type = JS_TYPE_NONE;
|
||||||
|
|
||||||
static const joystick_if_t joystick_none = {
|
static const joystick_t joystick_none = {
|
||||||
.name = "None",
|
.name = "None",
|
||||||
.internal_name = "none",
|
.internal_name = "none",
|
||||||
.init = NULL,
|
.init = NULL,
|
||||||
@@ -86,7 +86,7 @@ static const joystick_if_t joystick_none = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
const joystick_if_t *joystick;
|
const joystick_t *joystick;
|
||||||
} joysticks[] = {
|
} joysticks[] = {
|
||||||
{ &joystick_none },
|
{ &joystick_none },
|
||||||
{ &joystick_2axis_2button },
|
{ &joystick_2axis_2button },
|
||||||
@@ -100,7 +100,7 @@ static const struct {
|
|||||||
{ &joystick_3axis_2button },
|
{ &joystick_3axis_2button },
|
||||||
{ &joystick_2button_yoke_throttle },
|
{ &joystick_2button_yoke_throttle },
|
||||||
{ &joystick_3axis_4button },
|
{ &joystick_3axis_4button },
|
||||||
{ &joystick_win95_steering_wheel }, // Temp
|
{ &joystick_win95_steering_wheel },
|
||||||
{ &joystick_4button_yoke_throttle },
|
{ &joystick_4button_yoke_throttle },
|
||||||
{ &joystick_4axis_4button },
|
{ &joystick_4axis_4button },
|
||||||
{ &joystick_ch_flightstick_pro },
|
{ &joystick_ch_flightstick_pro },
|
||||||
@@ -114,24 +114,39 @@ static const struct {
|
|||||||
static joystick_instance_t *joystick_instance[GAMEPORT_MAX] = { NULL, NULL };
|
static joystick_instance_t *joystick_instance[GAMEPORT_MAX] = { NULL, NULL };
|
||||||
|
|
||||||
static uint8_t gameport_pnp_rom[] = {
|
static uint8_t gameport_pnp_rom[] = {
|
||||||
0x09, 0xf8, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, /* BOX0002, dummy checksum (filled in by isapnp_add_card) */
|
/* BOX0002, serial 0, dummy checksum (filled in by isapnp_add_card) */
|
||||||
0x0a, 0x10, 0x10, /* PnP version 1.0, vendor version 1.0 */
|
0x09, 0xf8, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x82, 0x09, 0x00, 'G', 'a', 'm', 'e', ' ', 'P', 'o', 'r', 't', /* ANSI identifier */
|
/* PnP version 1.0, vendor version 1.0 */
|
||||||
|
0x0a, 0x10, 0x10,
|
||||||
|
/* ANSI identifier */
|
||||||
|
0x82, 0x09, 0x00, 'G', 'a', 'm', 'e', ' ', 'P', 'o', 'r', 't',
|
||||||
|
|
||||||
0x15, 0x09, 0xf8, 0x00, 0x02, 0x01, /* logical device BOX0002, can participate in boot */
|
/* Logical device BOX0002, can participate in boot */
|
||||||
0x1c, 0x41, 0xd0, 0xb0, 0x2f, /* compatible device PNPB02F */
|
0x15, 0x09, 0xf8, 0x00, 0x02, 0x01,
|
||||||
0x31, 0x00, /* start dependent functions, preferred */
|
/* Compatible device PNPB02F */
|
||||||
0x47, 0x01, 0x00, 0x02, 0x00, 0x02, 0x08, 0x08, /* I/O 0x200, decodes 16-bit, 8-byte alignment, 8 addresses */
|
0x1c, 0x41, 0xd0, 0xb0, 0x2f,
|
||||||
0x30, /* start dependent functions, acceptable */
|
/* Start dependent functions, preferred */
|
||||||
0x47, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x08, /* I/O 0x208, decodes 16-bit, 8-byte alignment, 8 addresses */
|
0x31, 0x00,
|
||||||
0x31, 0x02, /* start dependent functions, sub-optimal */
|
/* I/O 0x200, decodes 16-bit, 8-byte alignment, 8 addresses */
|
||||||
0x47, 0x01, 0x00, 0x01, 0xf8, 0xff, 0x08, 0x08, /* I/O 0x100-0xFFF8, decodes 16-bit, 8-byte alignment, 8 addresses */
|
0x47, 0x01, 0x00, 0x02, 0x00, 0x02, 0x08, 0x08,
|
||||||
0x38, /* end dependent functions */
|
/* Start dependent functions, acceptable */
|
||||||
|
0x30,
|
||||||
|
/* I/O 0x208, decodes 16-bit, 8-byte alignment, 8 addresses */
|
||||||
|
0x47, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x08,
|
||||||
|
/* Start dependent functions, sub-optimal */
|
||||||
|
0x31, 0x02,
|
||||||
|
/* I/O 0x100-0xFFF8, decodes 16-bit, 8-byte alignment, 8 addresses */
|
||||||
|
0x47, 0x01, 0x00, 0x01, 0xf8, 0xff, 0x08, 0x08,
|
||||||
|
/* End dependent functions */
|
||||||
|
0x38,
|
||||||
|
|
||||||
0x79, 0x00 /* end tag, dummy checksum (filled in by isapnp_add_card) */
|
/* End tag, dummy checksum (filled in by isapnp_add_card) */
|
||||||
|
0x79, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
static const isapnp_device_config_t gameport_pnp_defaults[] = {
|
static const isapnp_device_config_t gameport_pnp_defaults[] = {
|
||||||
{.activate = 1,
|
{
|
||||||
|
.activate = 1,
|
||||||
.io = {
|
.io = {
|
||||||
{ .base = 0x200 },
|
{ .base = 0x200 },
|
||||||
}
|
}
|
||||||
@@ -244,10 +259,8 @@ gameport_write(UNUSED(uint16_t addr), UNUSED(uint8_t val), void *priv)
|
|||||||
/* Read all axes. */
|
/* Read all axes. */
|
||||||
joystick->state |= 0x0f;
|
joystick->state |= 0x0f;
|
||||||
|
|
||||||
gameport_time(joystick, 0, joystick->intf->read_axis(joystick->dat, 0));
|
for (uint8_t i = 0; i < 4; i++)
|
||||||
gameport_time(joystick, 1, joystick->intf->read_axis(joystick->dat, 1));
|
gameport_time(joystick, i, joystick->intf->read_axis(joystick->dat, i));
|
||||||
gameport_time(joystick, 2, joystick->intf->read_axis(joystick->dat, 2));
|
|
||||||
gameport_time(joystick, 3, joystick->intf->read_axis(joystick->dat, 3));
|
|
||||||
|
|
||||||
/* Notify the interface. */
|
/* Notify the interface. */
|
||||||
joystick->intf->write(joystick->dat);
|
joystick->intf->write(joystick->dat);
|
||||||
@@ -384,20 +397,14 @@ gameport_init(const device_t *info)
|
|||||||
if (!joystick_instance[0] && joystick_type) {
|
if (!joystick_instance[0] && joystick_type) {
|
||||||
joystick_instance[0] = calloc(1, sizeof(joystick_instance_t));
|
joystick_instance[0] = calloc(1, sizeof(joystick_instance_t));
|
||||||
|
|
||||||
joystick_instance[0]->axis[0].joystick = joystick_instance[0];
|
// For each analog joystick axis
|
||||||
joystick_instance[0]->axis[1].joystick = joystick_instance[0];
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
joystick_instance[0]->axis[2].joystick = joystick_instance[0];
|
joystick_instance[0]->axis[i].joystick = joystick_instance[0];
|
||||||
joystick_instance[0]->axis[3].joystick = joystick_instance[0];
|
|
||||||
|
|
||||||
joystick_instance[0]->axis[0].axis_nr = 0;
|
joystick_instance[0]->axis[i].axis_nr = i;
|
||||||
joystick_instance[0]->axis[1].axis_nr = 1;
|
|
||||||
joystick_instance[0]->axis[2].axis_nr = 2;
|
|
||||||
joystick_instance[0]->axis[3].axis_nr = 3;
|
|
||||||
|
|
||||||
timer_add(&joystick_instance[0]->axis[0].timer, timer_over, &joystick_instance[0]->axis[0], 0);
|
timer_add(&joystick_instance[0]->axis[i].timer, timer_over, &joystick_instance[0]->axis[i], 0);
|
||||||
timer_add(&joystick_instance[0]->axis[1].timer, timer_over, &joystick_instance[0]->axis[1], 0);
|
}
|
||||||
timer_add(&joystick_instance[0]->axis[2].timer, timer_over, &joystick_instance[0]->axis[2], 0);
|
|
||||||
timer_add(&joystick_instance[0]->axis[3].timer, timer_over, &joystick_instance[0]->axis[3], 0);
|
|
||||||
|
|
||||||
joystick_instance[0]->intf = joysticks[joystick_type].joystick;
|
joystick_instance[0]->intf = joysticks[joystick_type].joystick;
|
||||||
joystick_instance[0]->dat = joystick_instance[0]->intf->init();
|
joystick_instance[0]->dat = joystick_instance[0]->intf->init();
|
||||||
@@ -771,7 +778,7 @@ gameport_available(int port)
|
|||||||
|
|
||||||
/* UI */
|
/* UI */
|
||||||
const device_t *
|
const device_t *
|
||||||
gameports_getdevice(int port)
|
gameport_getdevice(int port)
|
||||||
{
|
{
|
||||||
return (gameports[port].device);
|
return (gameports[port].device);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Flight Stick Pro.
|
* Implementation of the Flight Stick Pro.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||||
*
|
*
|
||||||
@@ -138,7 +136,7 @@ ch_flightstick_pro_a0_over(UNUSED(void *priv))
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
const joystick_if_t joystick_ch_flightstick_pro = {
|
const joystick_t joystick_ch_flightstick_pro = {
|
||||||
.name = "CH Flightstick Pro",
|
.name = "CH Flightstick Pro",
|
||||||
.internal_name = "ch_flightstick_pro",
|
.internal_name = "ch_flightstick_pro",
|
||||||
.init = ch_flightstick_pro_init,
|
.init = ch_flightstick_pro_init,
|
||||||
@@ -156,7 +154,7 @@ const joystick_if_t joystick_ch_flightstick_pro = {
|
|||||||
.pov_names = { "POV" }
|
.pov_names = { "POV" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_ch_flightstick_pro_ch_pedals = {
|
const joystick_t joystick_ch_flightstick_pro_ch_pedals = {
|
||||||
.name = "CH Flightstick Pro + CH Pedals",
|
.name = "CH Flightstick Pro + CH Pedals",
|
||||||
.internal_name = "ch_flightstick_pro_ch_pedals",
|
.internal_name = "ch_flightstick_pro_ch_pedals",
|
||||||
.init = ch_flightstick_pro_init,
|
.init = ch_flightstick_pro_init,
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ joystick_standard_a0_over(UNUSED(void *priv))
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
const joystick_if_t joystick_2axis_2button = {
|
const joystick_t joystick_2axis_2button = {
|
||||||
.name = "2-axis, 2-button joystick(s)",
|
.name = "2-axis, 2-button joystick(s)",
|
||||||
.internal_name = "2axis_2button",
|
.internal_name = "2axis_2button",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -292,7 +292,7 @@ const joystick_if_t joystick_2axis_2button = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_2button_gamepad = {
|
const joystick_t joystick_2button_gamepad = {
|
||||||
.name = "2-button gamepad(s)",
|
.name = "2-button gamepad(s)",
|
||||||
.internal_name = "2button_gamepad",
|
.internal_name = "2button_gamepad",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -310,7 +310,7 @@ const joystick_if_t joystick_2button_gamepad = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_2button_flight_yoke = {
|
const joystick_t joystick_2button_flight_yoke = {
|
||||||
.name = "2-button flight yoke",
|
.name = "2-button flight yoke",
|
||||||
.internal_name = "2button_flight_yoke",
|
.internal_name = "2button_flight_yoke",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -328,7 +328,7 @@ const joystick_if_t joystick_2button_flight_yoke = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_2axis_4button = {
|
const joystick_t joystick_2axis_4button = {
|
||||||
.name = "2-axis, 4-button joystick",
|
.name = "2-axis, 4-button joystick",
|
||||||
.internal_name = "2axis_4button",
|
.internal_name = "2axis_4button",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -346,7 +346,7 @@ const joystick_if_t joystick_2axis_4button = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_4button_gamepad = {
|
const joystick_t joystick_4button_gamepad = {
|
||||||
.name = "4-button gamepad",
|
.name = "4-button gamepad",
|
||||||
.internal_name = "4button_gamepad",
|
.internal_name = "4button_gamepad",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -364,7 +364,7 @@ const joystick_if_t joystick_4button_gamepad = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_4button_flight_yoke = {
|
const joystick_t joystick_4button_flight_yoke = {
|
||||||
.name = "4-button flight yoke",
|
.name = "4-button flight yoke",
|
||||||
.internal_name = "4button_flight_yoke",
|
.internal_name = "4button_flight_yoke",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -382,7 +382,7 @@ const joystick_if_t joystick_4button_flight_yoke = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_3axis_2button = {
|
const joystick_t joystick_3axis_2button = {
|
||||||
.name = "3-axis, 2-button joystick",
|
.name = "3-axis, 2-button joystick",
|
||||||
.internal_name = "3axis_2button",
|
.internal_name = "3axis_2button",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -400,7 +400,7 @@ const joystick_if_t joystick_3axis_2button = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_2button_yoke_throttle = {
|
const joystick_t joystick_2button_yoke_throttle = {
|
||||||
.name = "2-button flight yoke with throttle",
|
.name = "2-button flight yoke with throttle",
|
||||||
.internal_name = "2button_yoke_throttle",
|
.internal_name = "2button_yoke_throttle",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -418,7 +418,7 @@ const joystick_if_t joystick_2button_yoke_throttle = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_3axis_4button = {
|
const joystick_t joystick_3axis_4button = {
|
||||||
.name = "3-axis, 4-button joystick",
|
.name = "3-axis, 4-button joystick",
|
||||||
.internal_name = "3axis_4button",
|
.internal_name = "3axis_4button",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -436,7 +436,7 @@ const joystick_if_t joystick_3axis_4button = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_4button_yoke_throttle = {
|
const joystick_t joystick_4button_yoke_throttle = {
|
||||||
.name = "4-button flight yoke with throttle",
|
.name = "4-button flight yoke with throttle",
|
||||||
.internal_name = "4button_yoke_throttle",
|
.internal_name = "4button_yoke_throttle",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -454,7 +454,7 @@ const joystick_if_t joystick_4button_yoke_throttle = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_win95_steering_wheel = {
|
const joystick_t joystick_win95_steering_wheel = {
|
||||||
.name = "Win95 Steering Wheel (3-axis, 4-button)",
|
.name = "Win95 Steering Wheel (3-axis, 4-button)",
|
||||||
.internal_name = "win95_steering_wheel",
|
.internal_name = "win95_steering_wheel",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -472,7 +472,7 @@ const joystick_if_t joystick_win95_steering_wheel = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_4axis_4button = {
|
const joystick_t joystick_4axis_4button = {
|
||||||
.name = "4-axis, 4-button joystick",
|
.name = "4-axis, 4-button joystick",
|
||||||
.internal_name = "4axis_4button",
|
.internal_name = "4axis_4button",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -490,7 +490,7 @@ const joystick_if_t joystick_4axis_4button = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_2axis_6button = {
|
const joystick_t joystick_2axis_6button = {
|
||||||
.name = "2-axis, 6-button joystick",
|
.name = "2-axis, 6-button joystick",
|
||||||
.internal_name = "2axis_6button",
|
.internal_name = "2axis_6button",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
@@ -508,7 +508,7 @@ const joystick_if_t joystick_2axis_6button = {
|
|||||||
.pov_names = { NULL }
|
.pov_names = { NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_2axis_8button = {
|
const joystick_t joystick_2axis_8button = {
|
||||||
.name = "2-axis, 8-button joystick",
|
.name = "2-axis, 8-button joystick",
|
||||||
.internal_name = "2axis_8button",
|
.internal_name = "2axis_8button",
|
||||||
.init = joystick_standard_init,
|
.init = joystick_standard_init,
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
* - Some DOS stuff will write to 0x201 while a packet is
|
* - Some DOS stuff will write to 0x201 while a packet is
|
||||||
* being transferred. This seems to be ignored.
|
* being transferred. This seems to be ignored.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||||
*
|
*
|
||||||
@@ -244,7 +242,7 @@ sw_a0_over(void *priv)
|
|||||||
timer_set_delay_u64(&sw->trigger_timer, TIMER_USEC * 10000);
|
timer_set_delay_u64(&sw->trigger_timer, TIMER_USEC * 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const joystick_if_t joystick_sw_pad = {
|
const joystick_t joystick_sw_pad = {
|
||||||
.name = "Microsoft SideWinder Pad",
|
.name = "Microsoft SideWinder Pad",
|
||||||
.internal_name = "sidewinder_pad",
|
.internal_name = "sidewinder_pad",
|
||||||
.init = sw_init,
|
.init = sw_init,
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* Implementation of Thrust Master Flight Control System.
|
* Implementation of Thrust Master Flight Control System.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||||
*
|
*
|
||||||
@@ -148,7 +146,7 @@ tm_fcs_a0_over(UNUSED(void *priv))
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
const joystick_if_t joystick_tm_fcs = {
|
const joystick_t joystick_tm_fcs = {
|
||||||
.name = "Thrustmaster Flight Control System",
|
.name = "Thrustmaster Flight Control System",
|
||||||
.internal_name = "thrustmaster_fcs",
|
.internal_name = "thrustmaster_fcs",
|
||||||
.init = tm_fcs_init,
|
.init = tm_fcs_init,
|
||||||
@@ -166,7 +164,7 @@ const joystick_if_t joystick_tm_fcs = {
|
|||||||
.pov_names = { "POV" }
|
.pov_names = { "POV" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const joystick_if_t joystick_tm_fcs_rcs = {
|
const joystick_t joystick_tm_fcs_rcs = {
|
||||||
.name = "Thrustmaster FCS + Rudder Control System",
|
.name = "Thrustmaster FCS + Rudder Control System",
|
||||||
.internal_name = "thrustmaster_fcs_rcs",
|
.internal_name = "thrustmaster_fcs_rcs",
|
||||||
.init = tm_fcs_init,
|
.init = tm_fcs_init,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#define GAMEPORT_8ADDR 0x080000
|
#define GAMEPORT_8ADDR 0x080000
|
||||||
#define GAMEPORT_SIO 0x1000000
|
#define GAMEPORT_SIO 0x1000000
|
||||||
|
|
||||||
typedef struct joystick_if_t {
|
typedef struct joystick_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *internal_name;
|
const char *internal_name;
|
||||||
|
|
||||||
@@ -70,9 +70,9 @@ typedef struct joystick_if_t {
|
|||||||
const char *axis_names[MAX_JOY_AXES];
|
const char *axis_names[MAX_JOY_AXES];
|
||||||
const char *button_names[MAX_JOY_BUTTONS];
|
const char *button_names[MAX_JOY_BUTTONS];
|
||||||
const char *pov_names[MAX_JOY_POVS];
|
const char *pov_names[MAX_JOY_POVS];
|
||||||
} joystick_if_t;
|
} joystick_t;
|
||||||
|
|
||||||
typedef struct plat_joystick_t {
|
typedef struct plat_joystick_state_t {
|
||||||
char name[260];
|
char name[260];
|
||||||
|
|
||||||
int a[MAX_JOY_AXES];
|
int a[MAX_JOY_AXES];
|
||||||
@@ -97,9 +97,9 @@ typedef struct plat_joystick_t {
|
|||||||
int nr_axes;
|
int nr_axes;
|
||||||
int nr_buttons;
|
int nr_buttons;
|
||||||
int nr_povs;
|
int nr_povs;
|
||||||
} plat_joystick_t;
|
} plat_joystick_state_t;
|
||||||
|
|
||||||
typedef struct joystick_t {
|
typedef struct joystick_state_t {
|
||||||
int axis[MAX_JOY_AXES];
|
int axis[MAX_JOY_AXES];
|
||||||
int button[MAX_JOY_BUTTONS];
|
int button[MAX_JOY_BUTTONS];
|
||||||
int pov[MAX_JOY_POVS];
|
int pov[MAX_JOY_POVS];
|
||||||
@@ -108,7 +108,7 @@ typedef struct joystick_t {
|
|||||||
int axis_mapping[MAX_JOY_AXES];
|
int axis_mapping[MAX_JOY_AXES];
|
||||||
int button_mapping[MAX_JOY_BUTTONS];
|
int button_mapping[MAX_JOY_BUTTONS];
|
||||||
int pov_mapping[MAX_JOY_POVS][2];
|
int pov_mapping[MAX_JOY_POVS][2];
|
||||||
} joystick_t;
|
} joystick_state_t;
|
||||||
|
|
||||||
extern device_t game_ports[GAMEPORT_MAX];
|
extern device_t game_ports[GAMEPORT_MAX];
|
||||||
|
|
||||||
@@ -145,8 +145,8 @@ extern const device_t gameport_sio_1io_device;
|
|||||||
extern const device_t *standalone_gameport_type;
|
extern const device_t *standalone_gameport_type;
|
||||||
#endif
|
#endif
|
||||||
extern int gameport_instance_id;
|
extern int gameport_instance_id;
|
||||||
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
extern plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||||
extern joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
extern joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
||||||
extern int joysticks_present;
|
extern int joysticks_present;
|
||||||
|
|
||||||
extern int joystick_type;
|
extern int joystick_type;
|
||||||
@@ -170,28 +170,28 @@ extern void gameport_update_joystick_type(void);
|
|||||||
extern void gameport_remap(void *priv, uint16_t address);
|
extern void gameport_remap(void *priv, uint16_t address);
|
||||||
extern void *gameport_add(const device_t *gameport_type);
|
extern void *gameport_add(const device_t *gameport_type);
|
||||||
|
|
||||||
extern const joystick_if_t joystick_2axis_2button;
|
extern const joystick_t joystick_2axis_2button;
|
||||||
extern const joystick_if_t joystick_2button_gamepad;
|
extern const joystick_t joystick_2button_gamepad;
|
||||||
extern const joystick_if_t joystick_2button_flight_yoke;
|
extern const joystick_t joystick_2button_flight_yoke;
|
||||||
extern const joystick_if_t joystick_2axis_4button;
|
extern const joystick_t joystick_2axis_4button;
|
||||||
extern const joystick_if_t joystick_4button_gamepad;
|
extern const joystick_t joystick_4button_gamepad;
|
||||||
extern const joystick_if_t joystick_4button_flight_yoke;
|
extern const joystick_t joystick_4button_flight_yoke;
|
||||||
extern const joystick_if_t joystick_3axis_2button;
|
extern const joystick_t joystick_3axis_2button;
|
||||||
extern const joystick_if_t joystick_2button_yoke_throttle;
|
extern const joystick_t joystick_2button_yoke_throttle;
|
||||||
extern const joystick_if_t joystick_3axis_4button;
|
extern const joystick_t joystick_3axis_4button;
|
||||||
extern const joystick_if_t joystick_4button_yoke_throttle;
|
extern const joystick_t joystick_4button_yoke_throttle;
|
||||||
extern const joystick_if_t joystick_win95_steering_wheel;
|
extern const joystick_t joystick_win95_steering_wheel;
|
||||||
extern const joystick_if_t joystick_4axis_4button;
|
extern const joystick_t joystick_4axis_4button;
|
||||||
extern const joystick_if_t joystick_2axis_6button;
|
extern const joystick_t joystick_2axis_6button;
|
||||||
extern const joystick_if_t joystick_2axis_8button;
|
extern const joystick_t joystick_2axis_8button;
|
||||||
|
|
||||||
extern const joystick_if_t joystick_ch_flightstick_pro;
|
extern const joystick_t joystick_ch_flightstick_pro;
|
||||||
extern const joystick_if_t joystick_ch_flightstick_pro_ch_pedals;
|
extern const joystick_t joystick_ch_flightstick_pro_ch_pedals;
|
||||||
|
|
||||||
extern const joystick_if_t joystick_sw_pad;
|
extern const joystick_t joystick_sw_pad;
|
||||||
|
|
||||||
extern const joystick_if_t joystick_tm_fcs;
|
extern const joystick_t joystick_tm_fcs;
|
||||||
extern const joystick_if_t joystick_tm_fcs_rcs;
|
extern const joystick_t joystick_tm_fcs_rcs;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
#include <86box/plat_unused.h>
|
#include <86box/plat_unused.h>
|
||||||
|
|
||||||
int joysticks_present = 0;
|
int joysticks_present = 0;
|
||||||
joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
||||||
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||||
static SDL_Joystick *sdl_joy[MAX_PLAT_JOYSTICKS];
|
static SDL_Joystick *sdl_joy[MAX_PLAT_JOYSTICKS];
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
|
|||||||
@@ -97,14 +97,14 @@ typedef struct {
|
|||||||
} raw_joystick_t;
|
} raw_joystick_t;
|
||||||
|
|
||||||
int joysticks_present = 0;
|
int joysticks_present = 0;
|
||||||
joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
||||||
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||||
|
|
||||||
raw_joystick_t raw_joystick_state[MAX_PLAT_JOYSTICKS];
|
raw_joystick_t raw_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||||
|
|
||||||
/* We only use the first 32 buttons reported, from Usage ID 1-128 */
|
/* We only use the first 32 buttons reported, from Usage ID 1-128 */
|
||||||
void
|
void
|
||||||
joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
|
joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, USAGE usage)
|
||||||
{
|
{
|
||||||
if (joy->nr_buttons >= MAX_JOY_BUTTONS)
|
if (joy->nr_buttons >= MAX_JOY_BUTTONS)
|
||||||
return;
|
return;
|
||||||
@@ -117,7 +117,7 @@ joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
|
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, PHIDP_VALUE_CAPS prop)
|
||||||
{
|
{
|
||||||
if (joy->nr_axes >= MAX_JOY_AXES)
|
if (joy->nr_axes >= MAX_JOY_AXES)
|
||||||
return;
|
return;
|
||||||
@@ -202,7 +202,7 @@ joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
joystick_add_pov(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
|
joystick_add_pov(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, PHIDP_VALUE_CAPS prop)
|
||||||
{
|
{
|
||||||
if (joy->nr_povs >= MAX_JOY_POVS)
|
if (joy->nr_povs >= MAX_JOY_POVS)
|
||||||
return;
|
return;
|
||||||
@@ -217,7 +217,7 @@ joystick_add_pov(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
joystick_get_capabilities(raw_joystick_t *rawjoy, plat_joystick_t *joy)
|
joystick_get_capabilities(raw_joystick_t *rawjoy, plat_joystick_state_t *joy)
|
||||||
{
|
{
|
||||||
UINT size = 0;
|
UINT size = 0;
|
||||||
PHIDP_BUTTON_CAPS btn_caps = NULL;
|
PHIDP_BUTTON_CAPS btn_caps = NULL;
|
||||||
@@ -276,7 +276,7 @@ end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
joystick_get_device_name(raw_joystick_t *rawjoy, plat_joystick_t *joy, PRID_DEVICE_INFO info)
|
joystick_get_device_name(raw_joystick_t *rawjoy, plat_joystick_state_t *joy, PRID_DEVICE_INFO info)
|
||||||
{
|
{
|
||||||
UINT size = 0;
|
UINT size = 0;
|
||||||
WCHAR *device_name = NULL;
|
WCHAR *device_name = NULL;
|
||||||
@@ -340,7 +340,7 @@ joystick_init(void)
|
|||||||
if (info->hid.usUsage != HID_USAGE_GENERIC_JOYSTICK && info->hid.usUsage != HID_USAGE_GENERIC_GAMEPAD)
|
if (info->hid.usUsage != HID_USAGE_GENERIC_JOYSTICK && info->hid.usUsage != HID_USAGE_GENERIC_GAMEPAD)
|
||||||
goto end_loop;
|
goto end_loop;
|
||||||
|
|
||||||
plat_joystick_t *joy = &plat_joystick_state[joysticks_present];
|
plat_joystick_state_t *joy = &plat_joystick_state[joysticks_present];
|
||||||
raw_joystick_t *rawjoy = &raw_joystick_state[joysticks_present];
|
raw_joystick_t *rawjoy = &raw_joystick_state[joysticks_present];
|
||||||
rawjoy->hdevice = deviceList[i].hDevice;
|
rawjoy->hdevice = deviceList[i].hDevice;
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ int fixed_size_x = 640;
|
|||||||
int fixed_size_y = 480;
|
int fixed_size_y = 480;
|
||||||
extern int title_set;
|
extern int title_set;
|
||||||
extern wchar_t sdl_win_title[512];
|
extern wchar_t sdl_win_title[512];
|
||||||
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||||
joystick_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS];
|
||||||
int joysticks_present;
|
int joysticks_present;
|
||||||
SDL_mutex *blitmtx;
|
SDL_mutex *blitmtx;
|
||||||
SDL_threadID eventthread;
|
SDL_threadID eventthread;
|
||||||
|
|||||||
Reference in New Issue
Block a user