Added Thrustmaster FCS emulation.

This commit is contained in:
SarahW 2016-07-21 20:14:17 +01:00
commit ef4d0ce9c2
6 changed files with 94 additions and 3 deletions

View file

@ -20,7 +20,7 @@ allegro-midi.c allegro-mouse.c allegro-video.c amstrad.c cdrom-ioctl-linux.c cdr
codegen.c codegen_ops.c codegen_timing_486.c codegen_timing_686.c codegen_timing_pentium.c codegen_timing_winchip.c compaq.c config.c cpu.c \
dac.c device.c disc.c disc_fdi.c disc_img.c disc_sector.c dma.c fdc.c fdc37c665.c fdd.c fdi2raw.c gameport.c \
headland.c i430lx.c i430fx.c i430vx.c ide.c intel.c intel_flash.c io.c jim.c joystick_ch_flightstick_pro.c joystick_standard.c joystick_sw_pad.c \
keyboard.c keyboard_amstrad.c keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \
joystick_tm_fcs.c keyboard.c keyboard_amstrad.c keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \
lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c mouse_serial.c neat.c nmi.c nvr.c olivetti_m24.c \
opti.c pc.c pci.c pic.c piix.c pit.c ppi.c ps1.c rom.c rtc.c scat.c serial.c sis496.c sound.c \
sound_ad1848.c sound_adlib.c sound_adlibgold.c sound_cms.c sound_emu8k.c sound_gus.c \

View file

@ -6,7 +6,7 @@ CFLAGS = -O3 -march=i686 -fomit-frame-pointer -msse2 -mstackrealign
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86.o compaq.o config.o cpu.o dac.o \
device.o disc.o disc_fdi.o disc_img.o disc_sector.o dma.o fdc.o fdc37c665.o fdd.o fdi2raw.o gameport.o headland.o i430lx.o i430fx.o \
i430vx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o keyboard.o keyboard_amstrad.o keyboard_at.o \
i430vx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \
keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o model.o mouse.o mouse_ps2.o \
mouse_serial.o neat.o nmi.o nvr.o olivetti_m24.o opti.o pc.o pci.o pic.o piix.o pit.o ppi.o ps1.o rom.o rtc.o \
scat.o serial.o sis496.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o sound_dbopl.o \

View file

@ -6,7 +6,7 @@ CFLAGS = -O3 -fomit-frame-pointer -msse2
OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o ali1429.o amstrad.o cdrom-ioctl.o cdrom-iso.o \
codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86-64.o compaq.o config.o cpu.o dac.o \
device.o disc.o disc_fdi.o disc_img.o disc_sector.o dma.o fdc.o fdc37c665.o fdd.o fdi2raw.o gameport.o headland.o i430lx.o i430fx.o \
i430vx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o keyboard.o keyboard_amstrad.o keyboard_at.o \
i430vx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \
keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o model.o mouse.o mouse_ps2.o \
mouse_serial.o neat.o nmi.o nvr.o olivetti_m24.o opti.o pc.o pci.o pic.o piix.o pit.o ppi.o ps1.o rom.o rtc.o \
scat.o serial.o sis496.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o sound_dbopl.o \

View file

@ -9,6 +9,7 @@
#include "joystick_ch_flightstick_pro.h"
#include "joystick_standard.h"
#include "joystick_sw_pad.h"
#include "joystick_tm_fcs.h"
int joystick_type;
@ -20,6 +21,7 @@ static joystick_if_t *joystick_list[] =
&joystick_standard_8button,
&joystick_ch_flightstick_pro,
&joystick_sw_pad,
&joystick_tm_fcs,
NULL
};

88
src/joystick_tm_fcs.c Normal file
View file

@ -0,0 +1,88 @@
#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 *tm_fcs_init()
{
}
static void tm_fcs_close(void *p)
{
}
static uint8_t tm_fcs_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;
}
return ret;
}
static void tm_fcs_write(void *p)
{
}
static int tm_fcs_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:
if (joystick_state[0].pov[0] == -1)
return 32767;
if (joystick_state[0].pov[0] > 315 || joystick_state[0].pov[0] < 45)
return -32768;
if (joystick_state[0].pov[0] >= 45 && joystick_state[0].pov[0] < 135)
return -16384;
if (joystick_state[0].pov[0] >= 135 && joystick_state[0].pov[0] < 225)
return 0;
if (joystick_state[0].pov[0] >= 225 && joystick_state[0].pov[0] < 315)
return 16384;
return 0;
}
}
static void tm_fcs_a0_over(void *p)
{
}
joystick_if_t joystick_tm_fcs =
{
.name = "Thrustmaster Flight Control System",
.init = tm_fcs_init,
.close = tm_fcs_close,
.read = tm_fcs_read,
.write = tm_fcs_write,
.read_axis = tm_fcs_read_axis,
.a0_over = tm_fcs_a0_over,
.max_joysticks = 1,
.axis_count = 2,
.button_count = 4,
.pov_count = 1,
.axis_names = {"X axis", "Y axis"},
.button_names = {"Button 1", "Button 2", "Button 3", "Button 4"},
.pov_names = {"POV"}
};

1
src/joystick_tm_fcs.h Normal file
View file

@ -0,0 +1 @@
extern joystick_if_t joystick_tm_fcs;