Applied a whole slew of patches, getting RAM usage down by a further 10 MB.

This commit is contained in:
OBattler
2018-03-19 01:02:04 +01:00
parent b6c393cc91
commit b1efb99ed6
222 changed files with 9538 additions and 9980 deletions

View File

@@ -1,6 +1,39 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Implementation of a generic Game Port.
*
* Version: @(#)gameport.c 1.0.3 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -17,261 +50,286 @@
#include "joystick_standard.h"
#include "joystick_sw_pad.h"
#include "joystick_tm_fcs.h"
#include "../plat_joystick.h"
int joystick_type;
typedef struct {
int64_t count;
int axis_nr;
struct _gameport_ *gameport;
} g_axis_t;
typedef struct _gameport_ {
uint8_t state;
joystick_if_t joystick_none =
{
"No joystick",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
0,
0
};
g_axis_t axis[4];
static joystick_if_t *joystick_list[] =
{
&joystick_standard,
&joystick_standard_4button,
&joystick_standard_6button,
&joystick_standard_8button,
&joystick_ch_flightstick_pro,
&joystick_sw_pad,
&joystick_tm_fcs,
&joystick_none,
NULL
};
char *joystick_get_name(int64_t joystick)
{
if (!joystick_list[joystick])
return NULL;
return (char *) joystick_list[joystick]->name;
}
int64_t joystick_get_max_joysticks(int64_t joystick)
{
return joystick_list[joystick]->max_joysticks;
}
int64_t joystick_get_axis_count(int64_t joystick)
{
return joystick_list[joystick]->axis_count;
}
int64_t joystick_get_button_count(int64_t joystick)
{
return joystick_list[joystick]->button_count;
}
int64_t joystick_get_pov_count(int64_t joystick)
{
return joystick_list[joystick]->pov_count;
}
char *joystick_get_axis_name(int64_t joystick, int64_t id)
{
return (char *) joystick_list[joystick]->axis_names[id];
}
char *joystick_get_button_name(int64_t joystick, int64_t id)
{
return (char *) joystick_list[joystick]->button_names[id];
}
char *joystick_get_pov_name(int64_t joystick, int64_t id)
{
return (char *) joystick_list[joystick]->pov_names[id];
}
typedef struct gameport_axis_t
{
int64_t count;
int64_t axis_nr;
struct gameport_t *gameport;
} gameport_axis_t;
typedef struct gameport_t
{
uint8_t state;
gameport_axis_t axis[4];
joystick_if_t *joystick;
void *joystick_dat;
const joystick_if_t *joystick;
void *joystick_dat;
} gameport_t;
int joystick_type;
static const joystick_if_t joystick_none = {
"No joystick",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
0,
0
};
static const joystick_if_t *joystick_list[] = {
&joystick_standard,
&joystick_standard_4button,
&joystick_standard_6button,
&joystick_standard_8button,
&joystick_ch_flightstick_pro,
&joystick_sw_pad,
&joystick_tm_fcs,
&joystick_none,
NULL
};
static gameport_t *gameport_global = NULL;
static int64_t gameport_time(int64_t axis)
{
if (axis == AXIS_NOT_PRESENT)
return 0;
axis += 32768;
axis = (axis * 100) / 65; /*Axis now in ohms*/
axis = (axis * 11) / 1000;
return TIMER_USEC * (axis + 24); /*max = 11.115 ms*/
char *
joystick_get_name(int js)
{
if (! joystick_list[js])
return(NULL);
return((char *)joystick_list[js]->name);
}
void gameport_write(uint16_t addr, uint8_t val, void *p)
int
joystick_get_max_joysticks(int js)
{
gameport_t *gameport = (gameport_t *)p;
timer_clock();
gameport->state |= 0x0f;
pclog("gameport_write : joysticks_present=%i\n", joysticks_present);
gameport->axis[0].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 0));
gameport->axis[1].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 1));
gameport->axis[2].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 2));
gameport->axis[3].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 3));
gameport->joystick->write(gameport->joystick_dat);
cycles -= ISA_CYCLES(8);
return(joystick_list[js]->max_joysticks);
}
uint8_t gameport_read(uint16_t addr, void *p)
int
joystick_get_axis_count(int js)
{
gameport_t *gameport = (gameport_t *)p;
uint8_t ret;
timer_clock();
ret = gameport->state | gameport->joystick->read(gameport->joystick_dat);
cycles -= ISA_CYCLES(8);
return ret;
return(joystick_list[js]->axis_count);
}
void gameport_timer_over(void *p)
int
joystick_get_button_count(int js)
{
gameport_axis_t *axis = (gameport_axis_t *)p;
gameport_t *gameport = axis->gameport;
gameport->state &= ~(1 << axis->axis_nr);
axis->count = 0;
if (axis == &gameport->axis[0])
gameport->joystick->a0_over(gameport->joystick_dat);
return(joystick_list[js]->button_count);
}
void *gameport_init_common(void)
{
gameport_t *gameport = malloc(sizeof(gameport_t));
memset(gameport, 0, sizeof(gameport_t));
gameport->axis[0].gameport = gameport;
gameport->axis[1].gameport = gameport;
gameport->axis[2].gameport = gameport;
gameport->axis[3].gameport = gameport;
gameport->axis[0].axis_nr = 0;
gameport->axis[1].axis_nr = 1;
gameport->axis[2].axis_nr = 2;
gameport->axis[3].axis_nr = 3;
timer_add(gameport_timer_over, &gameport->axis[0].count, &gameport->axis[0].count, &gameport->axis[0]);
timer_add(gameport_timer_over, &gameport->axis[1].count, &gameport->axis[1].count, &gameport->axis[1]);
timer_add(gameport_timer_over, &gameport->axis[2].count, &gameport->axis[2].count, &gameport->axis[2]);
timer_add(gameport_timer_over, &gameport->axis[3].count, &gameport->axis[3].count, &gameport->axis[3]);
gameport->joystick = joystick_list[joystick_type];
gameport->joystick_dat = gameport->joystick->init();
gameport_global = gameport;
return gameport;
int
joystick_get_pov_count(int js)
{
return(joystick_list[js]->pov_count);
}
void gameport_update_joystick_type(void)
char *
joystick_get_axis_name(int js, int id)
{
gameport_t *gameport = gameport_global;
if (gameport)
{
gameport->joystick->close(gameport->joystick_dat);
gameport->joystick = joystick_list[joystick_type];
gameport->joystick_dat = gameport->joystick->init();
}
return((char *)joystick_list[js]->axis_names[id]);
}
void *gameport_init(device_t *info)
char *
joystick_get_button_name(int js, int id)
{
gameport_t *gameport = NULL;
if (joystick_type == 7)
{
gameport = NULL;
return gameport;
}
gameport = gameport_init_common();
io_sethandler(0x0200, 0x0008, gameport_read, NULL, NULL, gameport_write, NULL, NULL, gameport);
return gameport;
return((char *)joystick_list[js]->button_names[id]);
}
void *gameport_201_init(device_t *info)
char *
joystick_get_pov_name(int js, int id)
{
gameport_t *gameport;
if (joystick_type == 7)
{
gameport = NULL;
return gameport;
}
gameport = gameport_init_common();
io_sethandler(0x0201, 0x0001, gameport_read, NULL, NULL, gameport_write, NULL, NULL, gameport);
return gameport;
return (char *)joystick_list[js]->pov_names[id];
}
void gameport_close(void *p)
static int
gameport_time(int axis)
{
gameport_t *gameport = (gameport_t *)p;
if (axis == AXIS_NOT_PRESENT) return(0);
if (!p)
{
return;
}
gameport->joystick->close(gameport->joystick_dat);
axis += 32768;
axis = (axis * 100) / 65; /*Axis now in ohms*/
axis = (axis * 11) / 1000;
gameport_global = NULL;
free(gameport);
return(TIMER_USEC * (axis + 24)); /*max = 11.115 ms*/
}
device_t gameport_device =
static void
gameport_write(uint16_t addr, uint8_t val, void *priv)
{
"Game port",
0, 0,
gameport_init,
gameport_close,
NULL, NULL, NULL, NULL,
NULL
gameport_t *p = (gameport_t *)priv;
timer_clock();
p->state |= 0x0f;
pclog("gameport_write : joysticks_present=%i\n", joysticks_present);
p->axis[0].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 0));
p->axis[1].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 1));
p->axis[2].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 2));
p->axis[3].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 3));
p->joystick->write(p->joystick_dat);
cycles -= ISA_CYCLES(8);
}
static uint8_t
gameport_read(uint16_t addr, void *priv)
{
gameport_t *p = (gameport_t *)p;
uint8_t ret;
timer_clock();
ret = p->state | p->joystick->read(p->joystick_dat);
cycles -= ISA_CYCLES(8);
return(ret);
}
static void
timer_over(void *priv)
{
g_axis_t *axis = (g_axis_t *)priv;
gameport_t *p = axis->gameport;
p->state &= ~(1 << axis->axis_nr);
axis->count = 0;
if (axis == &p->axis[0])
p->joystick->a0_over(p->joystick_dat);
}
static void *
init_common(void)
{
gameport_t *p = malloc(sizeof(gameport_t));
memset(p, 0x00, sizeof(gameport_t));
p->axis[0].gameport = p;
p->axis[1].gameport = p;
p->axis[2].gameport = p;
p->axis[3].gameport = p;
p->axis[0].axis_nr = 0;
p->axis[1].axis_nr = 1;
p->axis[2].axis_nr = 2;
p->axis[3].axis_nr = 3;
timer_add(timer_over, &p->axis[0].count, &p->axis[0].count, &p->axis[0]);
timer_add(timer_over, &p->axis[1].count, &p->axis[1].count, &p->axis[1]);
timer_add(timer_over, &p->axis[2].count, &p->axis[2].count, &p->axis[2]);
timer_add(timer_over, &p->axis[3].count, &p->axis[3].count, &p->axis[3]);
p->joystick = joystick_list[joystick_type];
p->joystick_dat = p->joystick->init();
gameport_global = p;
return(p);
}
void
gameport_update_joystick_type(void)
{
gameport_t *p = gameport_global;
if (p != NULL) {
p->joystick->close(p->joystick_dat);
p->joystick = joystick_list[joystick_type];
p->joystick_dat = p->joystick->init();
}
}
static void *
gameport_init(const device_t *info)
{
gameport_t *p = NULL;
if (joystick_type == 7) {
p = NULL;
return(p);
}
p = init_common();
io_sethandler(0x0200, 8,
gameport_read,NULL,NULL, gameport_write,NULL,NULL, p);
return(p);
}
static void *
gameport_201_init(const device_t *info)
{
gameport_t *p;
if (joystick_type == 7) {
p = NULL;
return(p);
}
p = init_common();
io_sethandler(0x0201, 1,
gameport_read,NULL,NULL, gameport_write,NULL,NULL, p);
return(p);
}
static void
gameport_close(void *priv)
{
gameport_t *p = (gameport_t *)priv;
if (p == NULL) return;
p->joystick->close(p->joystick_dat);
gameport_global = NULL;
free(p);
}
const device_t gameport_device = {
"Game port",
0, 0,
gameport_init,
gameport_close,
NULL, NULL, NULL, NULL,
NULL
};
device_t gameport_201_device =
{
"Game port (port 201h only)",
0, 0,
gameport_201_init,
gameport_close,
NULL, NULL, NULL, NULL,
NULL
const device_t gameport_201_device = {
"Game port (port 201h only)",
0, 0,
gameport_201_init,
gameport_close,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -1,49 +1,142 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the generic game port handlers.
*
* NOTE: This module needs a good cleanup someday.
*
* Version: @(#)gameport.h 1.0.3 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2017 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#ifndef EMU_GAMEPORT_H
# define EMU_GAMEPORT_H
#define AXIS_NOT_PRESENT -99999
#define MAX_PLAT_JOYSTICKS 8
#define MAX_JOYSTICKS 4
#define POV_X 0x80000000
#define POV_Y 0x40000000
#define AXIS_NOT_PRESENT -99999
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
typedef struct
{
const char *name;
void *(*init)(void);
void (*close)(void *p);
uint8_t (*read)(void *p);
void (*write)(void *p);
int (*read_axis)(void *p, int axis);
void (*a0_over)(void *p);
int axis_count, button_count, pov_count;
int max_joysticks;
const char *axis_names[8];
const char *button_names[32];
const char *pov_names[4];
typedef struct {
char name[64];
int a[8];
int b[32];
int p[4];
struct {
char name[32];
int id;
} axis[8];
struct {
char name[32];
int id;
} button[32];
struct {
char name[32];
int id;
} pov[4];
int nr_axes;
int nr_buttons;
int nr_povs;
} plat_joystick_t;
typedef struct {
int axis[8];
int button[32];
int pov[4];
int plat_joystick_nr;
int axis_mapping[8];
int button_mapping[32];
int pov_mapping[4][2];
} joystick_t;
typedef struct {
const char *name;
void *(*init)(void);
void (*close)(void *p);
uint8_t (*read)(void *p);
void (*write)(void *p);
int (*read_axis)(void *p, int axis);
void (*a0_over)(void *p);
int axis_count,
button_count,
pov_count;
int max_joysticks;
const char *axis_names[8];
const char *button_names[32];
const char *pov_names[4];
} joystick_if_t;
#ifdef __cplusplus
extern "C" {
#endif
extern device_t gameport_device;
extern device_t gameport_201_device;
#ifdef EMU_DEVICE_H
extern const device_t gameport_device;
extern const device_t gameport_201_device;
#endif
extern int joystick_type;
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
extern joystick_t joystick_state[MAX_JOYSTICKS];
extern int joysticks_present;
extern int joystick_type;
extern char *joystick_get_name(int64_t joystick);
extern int64_t joystick_get_max_joysticks(int64_t joystick);
extern int64_t joystick_get_axis_count(int64_t joystick);
extern int64_t joystick_get_button_count(int64_t joystick);
extern int64_t joystick_get_pov_count(int64_t joystick);
extern char *joystick_get_axis_name(int64_t joystick, int64_t id);
extern char *joystick_get_button_name(int64_t joystick, int64_t id);
extern char *joystick_get_pov_name(int64_t joystick, int64_t id);
extern void joystick_init(void);
extern void joystick_close(void);
extern void joystick_process(void);
extern char *joystick_get_name(int js);
extern int joystick_get_max_joysticks(int js);
extern int joystick_get_axis_count(int js);
extern int joystick_get_button_count(int js);
extern int joystick_get_pov_count(int js);
extern char *joystick_get_axis_name(int js, int id);
extern char *joystick_get_button_name(int js, int id);
extern char *joystick_get_pov_name(int js, int id);
extern void gameport_update_joystick_type(void);

View File

@@ -1,3 +1,39 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Implementation of the Flight Stick Pro.
*
* Version: @(#)flightstick_pro.c 1.0.4 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -6,12 +42,11 @@
#include "../86box.h"
#include "../device.h"
#include "../timer.h"
#include "../plat_joystick.h"
#include "gameport.h"
#include "joystick_standard.h"
static void *ch_flightstick_pro_init()
static void *ch_flightstick_pro_init(void)
{
return NULL;
}
@@ -78,7 +113,7 @@ static void ch_flightstick_pro_a0_over(void *p)
{
}
joystick_if_t joystick_ch_flightstick_pro =
const joystick_if_t joystick_ch_flightstick_pro =
{
"CH Flightstick Pro",
ch_flightstick_pro_init,

View File

@@ -1 +1,38 @@
extern joystick_if_t joystick_ch_flightstick_pro;
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the Flight Stick Pro driver.
*
* Version: @(#)joystick_ch_flightstickpro.h 1.0.2 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
extern const joystick_if_t joystick_ch_flightstick_pro;

View File

@@ -1,3 +1,39 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Implementation of a standard joystick.
*
* Version: @(#)joystick_standard.c 1.0.4 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -6,12 +42,11 @@
#include "../86box.h"
#include "../device.h"
#include "../timer.h"
#include "../plat_joystick.h"
#include "gameport.h"
#include "joystick_standard.h"
static void *joystick_standard_init()
static void *joystick_standard_init(void)
{
return NULL;
}
@@ -160,7 +195,7 @@ static void joystick_standard_a0_over(void *p)
{
}
joystick_if_t joystick_standard =
const joystick_if_t joystick_standard =
{
"Standard 2-button joystick(s)",
joystick_standard_init,
@@ -176,7 +211,7 @@ joystick_if_t joystick_standard =
{"X axis", "Y axis"},
{"Button 1", "Button 2"}
};
joystick_if_t joystick_standard_4button =
const joystick_if_t joystick_standard_4button =
{
"Standard 4-button joystick",
joystick_standard_init,
@@ -192,7 +227,7 @@ joystick_if_t joystick_standard_4button =
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4"}
};
joystick_if_t joystick_standard_6button =
const joystick_if_t joystick_standard_6button =
{
"Standard 6-button joystick",
joystick_standard_init,
@@ -208,7 +243,7 @@ joystick_if_t joystick_standard_6button =
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"}
};
joystick_if_t joystick_standard_8button =
const joystick_if_t joystick_standard_8button =
{
"Standard 8-button joystick",
joystick_standard_init,

View File

@@ -1,4 +1,41 @@
extern joystick_if_t joystick_standard;
extern joystick_if_t joystick_standard_4button;
extern joystick_if_t joystick_standard_6button;
extern joystick_if_t joystick_standard_8button;
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the joystick driver.
*
* Version: @(#)joystick_standard.h 1.0.2 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
extern const joystick_if_t joystick_standard;
extern const joystick_if_t joystick_standard_4button;
extern const joystick_if_t joystick_standard_6button;
extern const joystick_if_t joystick_standard_8button;

View File

@@ -1,24 +1,60 @@
/*Sidewinder game pad notes :
- Write to 0x201 starts packet transfer (5*N or 15*N bits)
- Currently alternates between Mode A and Mode B (is there any way of
actually controlling which is used?)
- Windows 9x drivers require Mode B when more than 1 pad connected
- Packet preceeded by high data (currently 50us), and followed by low
data (currently 160us) - timings are probably wrong, but good enough
for everything I've tried
- Analogue inputs are only used to time ID packet request. If A0 timing
out is followed after ~64us by another 0x201 write then an ID packet
is triggered
- Sidewinder game pad ID is 'H0003'
- ID is sent in Mode A (1 bit per clock), but data bit 2 must change
during ID packet transfer, or Windows 9x drivers won't use Mode B. I
don't know if it oscillates, mirrors the data transfer, or something
else - the drivers only check that it changes at least 10 times during
the transfer
- Some DOS stuff will write to 0x201 while a packet is being transferred.
This seems to be ignored.
*/
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Implementation of a Side Winder GamePad.
*
* Notes: - Write to 0x201 starts packet transfer (5*N or 15*N bits)
* - Currently alternates between Mode A and Mode B (is there
* any way of actually controlling which is used?)
* - Windows 9x drivers require Mode B when more than 1 pad
* connected
* - Packet preceeded by high data (currently 50us), and
* followed by low data (currently 160us) - timings are
* probably wrong, but good enoughfor everything I've tried
* - Analog inputs are only used to time ID packet request.
* If A0 timing out is followed after ~64us by another 0x201
* write then an ID packet is triggered
* - Sidewinder game pad ID is 'H0003'
* - ID is sent in Mode A (1 bit per clock), but data bit 2
* must change during ID packet transfer, or Windows 9x
* drivers won't use Mode B. I don't know if it oscillates,
* mirrors the data transfer, or something else - the drivers
* only check that it changes at least 10 times during the
* transfer
* - Some DOS stuff will write to 0x201 while a packet is
* being transferred. This seems to be ignored.
*
* Version: @(#)sw_pad.c 1.0.5 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -27,7 +63,6 @@
#include "../86box.h"
#include "../device.h"
#include "../timer.h"
#include "../plat_joystick.h"
#include "gameport.h"
#include "joystick_sw_pad.h"
@@ -90,7 +125,7 @@ static int sw_parity(uint16_t data)
return bits_set & 1;
}
static void *sw_init()
static void *sw_init(void)
{
sw_data *sw = (sw_data *)malloc(sizeof(sw_data));
memset(sw, 0, sizeof(sw_data));
@@ -139,7 +174,7 @@ static uint8_t sw_read(void *p)
static void sw_write(void *p)
{
sw_data *sw = (sw_data *)p;
int time_since_last = sw->trigger_time / TIMER_USEC;
int64_t time_since_last = sw->trigger_time / TIMER_USEC;
if (!JOYSTICK_PRESENT(0))
return;
@@ -177,7 +212,7 @@ static void sw_write(void *p)
for (c = 0; c < 4; c++)
{
uint64_t data = 0x3fff;
uint16_t data = 0x3fff;
int b;
if (!JOYSTICK_PRESENT(c))
@@ -235,7 +270,7 @@ static void sw_a0_over(void *p)
sw->trigger_time = TIMER_USEC * 10000;
}
joystick_if_t joystick_sw_pad =
const joystick_if_t joystick_sw_pad =
{
"Microsoft SideWinder Pad",
sw_init,

View File

@@ -1 +1,38 @@
extern joystick_if_t joystick_sw_pad;
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the Sidewinder Pro driver.
*
* Version: @(#)joystick_sw_pad.h 1.0.2 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
extern const joystick_if_t joystick_sw_pad;

View File

@@ -1,3 +1,39 @@
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Implementation of Thrust Master Flight Control System.
*
* Version: @(#)tm_fcs.c 1.0.3 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -6,7 +42,6 @@
#include "../86box.h"
#include "../device.h"
#include "../timer.h"
#include "../plat_joystick.h"
#include "gameport.h"
#include "joystick_standard.h"
@@ -77,7 +112,7 @@ static void tm_fcs_a0_over(void *p)
{
}
joystick_if_t joystick_tm_fcs =
const joystick_if_t joystick_tm_fcs =
{
"Thrustmaster Flight Control System",
tm_fcs_init,

View File

@@ -1 +1,38 @@
extern joystick_if_t joystick_tm_fcs;
/*
* VARCem Virtual ARchaeological Computer EMulator.
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the Flight Control System driver.
*
* Version: @(#)joystick_tm_fcs.h 1.0.2 2018/03/15
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
extern const joystick_if_t joystick_tm_fcs;