Files
86Box/src/joystick_ch_flightstick_pro.c
OBattler f6ef1f833c Vastly overhauled the UI, there's now a completely new Settings dialog as well as a status bar with disk activity icons and removable drive menus;
Thoroughly clean up the code to vastly reduce the number of compiler warnings and found and fixed several bugs in the process;
Applied all mainline PCem commits;
Added SCSI hard disk emulation;
Commented out all unfinished machines and graphics cards;
Added the AOpen AP53 and ASUS P/I-P55T2 machines as well as another Tyan 440FX machine, all three with AMI WinBIOS (patch from TheCollector1995);
Added the Diamond Stealth 3D 3000 (S3 ViRGE/VX) graphics card (patch from TheCollector1995);
Added the PS/2 XT IDE (AccuLogic) HDD Controller (patch from TheCollector1995);
Added Microsoft/Logitech Bus Mouse emulation (patch from waltje);
Overhauled the makefiles (patch from waltje);
Added the Adaptec AHA-1542CF SCSI controller (patch from waltje);
Added preliminary (but still unfinished) Adaptec AHA-154x SCSI controller BIOS support (patch from waltje);
Added an ISABugger debugging device (patch from waltje);
Added sanity checks to the Direct3D code.
2017-05-05 01:49:42 +02:00

93 lines
2.4 KiB
C

#include <stdlib.h>
#include "ibm.h"
#include "device.h"
#include "timer.h"
#include "gameport.h"
#include "joystick_standard.h"
#include "plat-joystick.h"
static void *ch_flightstick_pro_init()
{
return NULL;
}
static void ch_flightstick_pro_close(void *p)
{
}
static uint8_t ch_flightstick_pro_read(void *p)
{
uint8_t ret = 0xf0;
if (JOYSTICK_PRESENT(0))
{
if (joystick_state[0].button[0])
ret &= ~0x10;
if (joystick_state[0].button[1])
ret &= ~0x20;
if (joystick_state[0].button[2])
ret &= ~0x40;
if (joystick_state[0].button[3])
ret &= ~0x80;
if (joystick_state[0].pov[0] != -1)
{
if (joystick_state[0].pov[0] > 315 || joystick_state[0].pov[0] < 45)
ret &= ~0xf0;
else if (joystick_state[0].pov[0] >= 45 && joystick_state[0].pov[0] < 135)
ret &= ~0xb0;
else if (joystick_state[0].pov[0] >= 135 && joystick_state[0].pov[0] < 225)
ret &= ~0x70;
else if (joystick_state[0].pov[0] >= 225 && joystick_state[0].pov[0] < 315)
ret &= ~0x30;
}
}
return ret;
}
static void ch_flightstick_pro_write(void *p)
{
}
static int ch_flightstick_pro_read_axis(void *p, int axis)
{
if (!JOYSTICK_PRESENT(0))
return AXIS_NOT_PRESENT;
switch (axis)
{
case 0:
return joystick_state[0].axis[0];
case 1:
return joystick_state[0].axis[1];
case 2:
return 0;
case 3:
return joystick_state[0].axis[2];
default:
return 0;
}
}
static void ch_flightstick_pro_a0_over(void *p)
{
}
joystick_if_t joystick_ch_flightstick_pro =
{
"CH Flightstick Pro",
ch_flightstick_pro_init,
ch_flightstick_pro_close,
ch_flightstick_pro_read,
ch_flightstick_pro_write,
ch_flightstick_pro_read_axis,
ch_flightstick_pro_a0_over,
1,
3,
4,
1,
{"X axis", "Y axis", "Throttle"},
{"Button 1", "Button 2", "Button 3", "Button 4"},
{"POV"}
};