Re-worked the Game Port and Joystick code. They are now separate.
Moved all "ports" (Game, Parallel, Serial) into new folder ports/.
This commit is contained in:
38
src/config.c
38
src/config.c
@@ -12,7 +12,7 @@
|
||||
* it on Windows XP, and possibly also Vista. Use the
|
||||
* -DANSI_CFG for use on these systems.
|
||||
*
|
||||
* Version: @(#)config.c 1.0.16 2018/04/23
|
||||
* Version: @(#)config.c 1.0.18 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -53,11 +53,12 @@
|
||||
#include "machine/machine.h"
|
||||
#include "nvr.h"
|
||||
#include "device.h"
|
||||
#include "serial.h"
|
||||
#include "parallel.h"
|
||||
#include "parallel_dev.h"
|
||||
#include "ports/game_dev.h"
|
||||
#include "ports/serial.h"
|
||||
#include "ports/parallel.h"
|
||||
#include "ports/parallel_dev.h"
|
||||
#include "mouse.h"
|
||||
#include "game/gameport.h"
|
||||
#include "game/joystick.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "disk/hdd.h"
|
||||
@@ -532,22 +533,23 @@ load_input(const char *cat)
|
||||
p = config_get_string(cat, "mouse_type", "none");
|
||||
mouse_type = mouse_get_from_internal_name(p);
|
||||
|
||||
//FIXME: should be an internal_name string!!
|
||||
joystick_type = config_get_int(cat, "joystick_type", 0);
|
||||
|
||||
for (c=0; c<joystick_get_max_joysticks(joystick_type); c++) {
|
||||
for (c=0; c<gamedev_get_max_joysticks(joystick_type); c++) {
|
||||
sprintf(temp, "joystick_%i_nr", c);
|
||||
joystick_state[c].plat_joystick_nr = config_get_int(cat, temp, 0);
|
||||
|
||||
if (joystick_state[c].plat_joystick_nr) {
|
||||
for (d=0; d<joystick_get_axis_count(joystick_type); d++) {
|
||||
for (d=0; d<gamedev_get_axis_count(joystick_type); d++) {
|
||||
sprintf(temp, "joystick_%i_axis_%i", c, d);
|
||||
joystick_state[c].axis_mapping[d] = config_get_int(cat, temp, d);
|
||||
}
|
||||
for (d=0; d<joystick_get_button_count(joystick_type); d++) {
|
||||
for (d=0; d<gamedev_get_button_count(joystick_type); d++) {
|
||||
sprintf(temp, "joystick_%i_button_%i", c, d);
|
||||
joystick_state[c].button_mapping[d] = config_get_int(cat, temp, d);
|
||||
}
|
||||
for (d=0; d<joystick_get_pov_count(joystick_type); d++) {
|
||||
for (d=0; d<gamedev_get_pov_count(joystick_type); d++) {
|
||||
sprintf(temp, "joystick_%i_pov_%i", c, d);
|
||||
p = config_get_string(cat, temp, "0, 0");
|
||||
joystick_state[c].pov_mapping[d][0] = joystick_state[c].pov_mapping[d][1] = 0;
|
||||
@@ -570,20 +572,20 @@ save_input(const char *cat)
|
||||
if (joystick_type != 0) {
|
||||
config_set_int(cat, "joystick_type", joystick_type);
|
||||
|
||||
for (c=0; c<joystick_get_max_joysticks(joystick_type); c++) {
|
||||
for (c=0; c<gamedev_get_max_joysticks(joystick_type); c++) {
|
||||
sprintf(tmp2, "joystick_%i_nr", c);
|
||||
config_set_int(cat, tmp2, joystick_state[c].plat_joystick_nr);
|
||||
|
||||
if (joystick_state[c].plat_joystick_nr) {
|
||||
for (d=0; d<joystick_get_axis_count(joystick_type); d++) {
|
||||
for (d=0; d<gamedev_get_axis_count(joystick_type); d++) {
|
||||
sprintf(tmp2, "joystick_%i_axis_%i", c, d);
|
||||
config_set_int(cat, tmp2, joystick_state[c].axis_mapping[d]);
|
||||
}
|
||||
for (d=0; d<joystick_get_button_count(joystick_type); d++) {
|
||||
for (d=0; d<gamedev_get_button_count(joystick_type); d++) {
|
||||
sprintf(tmp2, "joystick_%i_button_%i", c, d);
|
||||
config_set_int(cat, tmp2, joystick_state[c].button_mapping[d]);
|
||||
}
|
||||
for (d=0; d<joystick_get_pov_count(joystick_type); d++) {
|
||||
for (d=0; d<gamedev_get_pov_count(joystick_type); d++) {
|
||||
sprintf(tmp2, "joystick_%i_pov_%i", c, d);
|
||||
sprintf(temp, "%i, %i", joystick_state[c].pov_mapping[d][0], joystick_state[c].pov_mapping[d][1]);
|
||||
config_set_string(cat, tmp2, temp);
|
||||
@@ -771,10 +773,14 @@ load_ports(const char *cat)
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
sprintf(temp, "game_enabled");
|
||||
game_enabled = !!config_get_int(cat, temp, 0);
|
||||
|
||||
for (i = 0; i < SERIAL_MAX; i++) {
|
||||
sprintf(temp, "serial%i_enabled", i);
|
||||
serial_enabled[i] = !!config_get_int(cat, temp, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < PARALLEL_MAX; i++) {
|
||||
sprintf(temp, "parallel%i_enabled", i);
|
||||
parallel_enabled[i] = !!config_get_int(cat, temp, 0);
|
||||
@@ -793,6 +799,12 @@ save_ports(const char *cat)
|
||||
char temp[128];
|
||||
int i;
|
||||
|
||||
sprintf(temp, "game_enabled");
|
||||
if (game_enabled) {
|
||||
config_set_int(cat, temp, 1);
|
||||
} else
|
||||
config_delete_var(cat, temp);
|
||||
|
||||
for (i = 0; i < SERIAL_MAX; i++) {
|
||||
sprintf(temp, "serial%i_enabled", i);
|
||||
if (serial_enabled[i]) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Main include file for the application.
|
||||
*
|
||||
* Version: @(#)emu.h 1.0.18 2018/04/14
|
||||
* Version: @(#)emu.h 1.0.19 2018/04/26
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -110,7 +110,8 @@ extern int video_card, /* (C) graphics/video card */
|
||||
voodoo_enabled; /* (C) video option */
|
||||
extern int mouse_type; /* (C) selected mouse type */
|
||||
extern int enable_sync; /* (C) enable time sync */
|
||||
extern int serial_enabled[], /* (C) enable serial ports */
|
||||
extern int game_enabled, /* (C) enable game port */
|
||||
serial_enabled[], /* (C) enable serial ports */
|
||||
parallel_enabled[], /* (C) enable LPT ports */
|
||||
parallel_device[], /* (C) set up LPT devices */
|
||||
bugger_enabled; /* (C) enable ISAbugger */
|
||||
|
||||
@@ -1,330 +0,0 @@
|
||||
/*
|
||||
* 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.7 2018/04/05
|
||||
*
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../io.h"
|
||||
#include "../timer.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_ch_flightstick_pro.h"
|
||||
#include "joystick_standard.h"
|
||||
#include "joystick_sw_pad.h"
|
||||
#include "joystick_tm_fcs.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
int64_t count;
|
||||
int axis_nr;
|
||||
struct _gameport_ *gameport;
|
||||
} g_axis_t;
|
||||
|
||||
typedef struct _gameport_ {
|
||||
uint8_t state;
|
||||
|
||||
g_axis_t axis[4];
|
||||
|
||||
const joystick_if_t *joystick;
|
||||
void *joystick_dat;
|
||||
} gameport_t;
|
||||
|
||||
|
||||
static const joystick_if_t joystick_none = {
|
||||
"Disabled",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static const joystick_if_t *joystick_list[] = {
|
||||
&joystick_none,
|
||||
&joystick_standard,
|
||||
&joystick_standard_4button,
|
||||
&joystick_standard_6button,
|
||||
&joystick_standard_8button,
|
||||
&joystick_ch_flightstick_pro,
|
||||
&joystick_sw_pad,
|
||||
&joystick_tm_fcs,
|
||||
NULL
|
||||
};
|
||||
static gameport_t *gameport_global = NULL;
|
||||
|
||||
|
||||
char *
|
||||
joystick_get_name(int js)
|
||||
{
|
||||
if (! joystick_list[js])
|
||||
return(NULL);
|
||||
return((char *)joystick_list[js]->name);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
joystick_get_max_joysticks(int js)
|
||||
{
|
||||
return(joystick_list[js]->max_joysticks);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
joystick_get_axis_count(int js)
|
||||
{
|
||||
return(joystick_list[js]->axis_count);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
joystick_get_button_count(int js)
|
||||
{
|
||||
return(joystick_list[js]->button_count);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
joystick_get_pov_count(int js)
|
||||
{
|
||||
return(joystick_list[js]->pov_count);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
joystick_get_axis_name(int js, int id)
|
||||
{
|
||||
return((char *)joystick_list[js]->axis_names[id]);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
joystick_get_button_name(int js, int id)
|
||||
{
|
||||
return((char *)joystick_list[js]->button_names[id]);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
joystick_get_pov_name(int js, int id)
|
||||
{
|
||||
return (char *)joystick_list[js]->pov_names[id];
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
gameport_time(int axis)
|
||||
{
|
||||
if (axis == AXIS_NOT_PRESENT) return(0);
|
||||
|
||||
axis += 32768;
|
||||
axis = (axis * 100) / 65; /*Axis now in ohms*/
|
||||
axis = (axis * 11) / 1000;
|
||||
|
||||
return((int)(TIMER_USEC * (axis + 24))); /*max = 11.115 ms*/
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gameport_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
gameport_t *p = (gameport_t *)priv;
|
||||
|
||||
timer_clock();
|
||||
p->state |= 0x0f;
|
||||
|
||||
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 *)priv;
|
||||
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 == JOYSTICK_TYPE_NONE) {
|
||||
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 == JOYSTICK_TYPE_NONE) {
|
||||
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
|
||||
};
|
||||
|
||||
const device_t gameport_201_device = {
|
||||
"Game port (port 201h only)",
|
||||
0, 0,
|
||||
gameport_201_init,
|
||||
gameport_close,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
* 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.5 2018/03/28
|
||||
*
|
||||
* 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 JOYSTICK_TYPE_NONE 0 /* no joystick defined */
|
||||
|
||||
#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 {
|
||||
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
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t gameport_device;
|
||||
extern const device_t gameport_201_device;
|
||||
#endif
|
||||
|
||||
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||
extern joystick_t joystick_state[MAX_JOYSTICKS];
|
||||
extern int joysticks_present;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*EMU_GAMEPORT_H*/
|
||||
@@ -6,14 +6,14 @@
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the joystick driver.
|
||||
* Implementation of generic joystick device.
|
||||
*
|
||||
* Version: @(#)joystick_standard.h 1.0.2 2018/03/15
|
||||
* Version: @(#)joystick.c 1.0.1 2018/04/25
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -34,8 +34,17 @@
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../timer.h"
|
||||
#include "joystick.h"
|
||||
|
||||
|
||||
joystick_t joystick_state[MAX_JOYSTICKS];
|
||||
int joysticks_present;
|
||||
|
||||
|
||||
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;
|
||||
@@ -6,15 +6,15 @@
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the Flight Control System driver.
|
||||
* Definitions for the joystick devices.
|
||||
*
|
||||
* Version: @(#)joystick_tm_fcs.h 1.0.2 2018/03/15
|
||||
* Version: @(#)joystick.h 1.0.1 2018/04/25
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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
|
||||
@@ -34,5 +34,50 @@
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_JOYSTICK_H
|
||||
# define EMU_JOYSTICK_H
|
||||
|
||||
extern const joystick_if_t joystick_tm_fcs;
|
||||
|
||||
#define JOYSTICK_NONE 0 /* no joystick defined */
|
||||
|
||||
#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 {
|
||||
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;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern joystick_t joystick_state[MAX_JOYSTICKS];
|
||||
extern int joysticks_present;
|
||||
|
||||
|
||||
/* Defined in the platform module. */
|
||||
extern void joystick_init(void);
|
||||
extern void joystick_close(void);
|
||||
extern void joystick_process(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*EMU_JOYSTICK_H*/
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_standard.h"
|
||||
|
||||
|
||||
static void *ch_flightstick_pro_init(void)
|
||||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
const 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,
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
{"X axis", "Y axis", "Throttle"},
|
||||
{"Button 1", "Button 2", "Button 3", "Button 4"},
|
||||
{"POV"}
|
||||
};
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
@@ -1,261 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_standard.h"
|
||||
|
||||
|
||||
static void *joystick_standard_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void joystick_standard_close(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
static uint8_t joystick_standard_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_PRESENT(1))
|
||||
{
|
||||
if (joystick_state[1].button[0])
|
||||
ret &= ~0x40;
|
||||
if (joystick_state[1].button[1])
|
||||
ret &= ~0x80;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint8_t joystick_standard_read_4button(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 joystick_standard_write(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
static int joystick_standard_read_axis(void *p, int axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
if (!JOYSTICK_PRESENT(0))
|
||||
return AXIS_NOT_PRESENT;
|
||||
return joystick_state[0].axis[0];
|
||||
case 1:
|
||||
if (!JOYSTICK_PRESENT(0))
|
||||
return AXIS_NOT_PRESENT;
|
||||
return joystick_state[0].axis[1];
|
||||
case 2:
|
||||
if (!JOYSTICK_PRESENT(1))
|
||||
return AXIS_NOT_PRESENT;
|
||||
return joystick_state[1].axis[0];
|
||||
case 3:
|
||||
if (!JOYSTICK_PRESENT(1))
|
||||
return AXIS_NOT_PRESENT;
|
||||
return joystick_state[1].axis[1];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int joystick_standard_read_axis_4button(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 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
static int joystick_standard_read_axis_6button(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 joystick_state[0].button[4] ? -32767 : 32768;
|
||||
case 3:
|
||||
return joystick_state[0].button[5] ? -32767 : 32768;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
static int joystick_standard_read_axis_8button(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:
|
||||
if (joystick_state[0].button[4])
|
||||
return -32767;
|
||||
if (joystick_state[0].button[6])
|
||||
return 32768;
|
||||
return 0;
|
||||
case 3:
|
||||
if (joystick_state[0].button[5])
|
||||
return -32767;
|
||||
if (joystick_state[0].button[7])
|
||||
return 32768;
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void joystick_standard_a0_over(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
const joystick_if_t joystick_standard =
|
||||
{
|
||||
"Standard 2-button joystick(s)",
|
||||
joystick_standard_init,
|
||||
joystick_standard_close,
|
||||
joystick_standard_read,
|
||||
joystick_standard_write,
|
||||
joystick_standard_read_axis,
|
||||
joystick_standard_a0_over,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
2,
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2"}
|
||||
};
|
||||
const joystick_if_t joystick_standard_4button =
|
||||
{
|
||||
"Standard 4-button joystick",
|
||||
joystick_standard_init,
|
||||
joystick_standard_close,
|
||||
joystick_standard_read_4button,
|
||||
joystick_standard_write,
|
||||
joystick_standard_read_axis_4button,
|
||||
joystick_standard_a0_over,
|
||||
2,
|
||||
4,
|
||||
0,
|
||||
1,
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2", "Button 3", "Button 4"}
|
||||
};
|
||||
const joystick_if_t joystick_standard_6button =
|
||||
{
|
||||
"Standard 6-button joystick",
|
||||
joystick_standard_init,
|
||||
joystick_standard_close,
|
||||
joystick_standard_read_4button,
|
||||
joystick_standard_write,
|
||||
joystick_standard_read_axis_6button,
|
||||
joystick_standard_a0_over,
|
||||
2,
|
||||
6,
|
||||
0,
|
||||
1,
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"}
|
||||
};
|
||||
const joystick_if_t joystick_standard_8button =
|
||||
{
|
||||
"Standard 8-button joystick",
|
||||
joystick_standard_init,
|
||||
joystick_standard_close,
|
||||
joystick_standard_read_4button,
|
||||
joystick_standard_write,
|
||||
joystick_standard_read_axis_8button,
|
||||
joystick_standard_a0_over,
|
||||
2,
|
||||
8,
|
||||
0,
|
||||
1,
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6", "Button 7", "Button 8"}
|
||||
};
|
||||
@@ -1,288 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_sw_pad.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int64_t poll_time;
|
||||
int64_t poll_left;
|
||||
int64_t poll_clock;
|
||||
uint64_t poll_data;
|
||||
int64_t poll_mode;
|
||||
|
||||
int64_t trigger_time;
|
||||
int64_t data_mode;
|
||||
} sw_data;
|
||||
|
||||
static void sw_timer_over(void *p)
|
||||
{
|
||||
sw_data *sw = (sw_data *)p;
|
||||
|
||||
while (sw->poll_time <= 0 && sw->poll_left)
|
||||
{
|
||||
sw->poll_clock = !sw->poll_clock;
|
||||
|
||||
if (sw->poll_clock)
|
||||
{
|
||||
sw->poll_data >>= (sw->poll_mode ? 3 : 1);
|
||||
sw->poll_left--;
|
||||
}
|
||||
|
||||
if (sw->poll_left == 1 && !sw->poll_clock)
|
||||
sw->poll_time += TIMER_USEC * 160LL;
|
||||
else if (sw->poll_left)
|
||||
sw->poll_time += TIMER_USEC * 5;
|
||||
else
|
||||
sw->poll_time = 0;
|
||||
}
|
||||
|
||||
if (!sw->poll_left)
|
||||
sw->poll_time = 0;
|
||||
}
|
||||
|
||||
static void sw_trigger_timer_over(void *p)
|
||||
{
|
||||
sw_data *sw = (sw_data *)p;
|
||||
|
||||
sw->trigger_time = 0;
|
||||
}
|
||||
|
||||
static int sw_parity(uint16_t data)
|
||||
{
|
||||
int bits_set = 0;
|
||||
|
||||
while (data)
|
||||
{
|
||||
bits_set++;
|
||||
data &= (data - 1);
|
||||
}
|
||||
|
||||
return bits_set & 1;
|
||||
}
|
||||
|
||||
static void *sw_init(void)
|
||||
{
|
||||
sw_data *sw = (sw_data *)malloc(sizeof(sw_data));
|
||||
memset(sw, 0, sizeof(sw_data));
|
||||
|
||||
timer_add(sw_timer_over, &sw->poll_time, &sw->poll_time, sw);
|
||||
timer_add(sw_trigger_timer_over, &sw->trigger_time, &sw->trigger_time, sw);
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
static void sw_close(void *p)
|
||||
{
|
||||
sw_data *sw = (sw_data *)p;
|
||||
|
||||
free(sw);
|
||||
}
|
||||
|
||||
static uint8_t sw_read(void *p)
|
||||
{
|
||||
sw_data *sw = (sw_data *)p;
|
||||
uint8_t temp = 0;
|
||||
|
||||
if (!JOYSTICK_PRESENT(0))
|
||||
return 0xff;
|
||||
|
||||
if (sw->poll_time)
|
||||
{
|
||||
if (sw->poll_clock)
|
||||
temp |= 0x10;
|
||||
|
||||
if (sw->poll_mode)
|
||||
temp |= (sw->poll_data & 7) << 5;
|
||||
else
|
||||
{
|
||||
temp |= ((sw->poll_data & 1) << 5) | 0xc0;
|
||||
if (sw->poll_left > 31 && !(sw->poll_left & 1))
|
||||
temp &= ~0x80;
|
||||
}
|
||||
}
|
||||
else
|
||||
temp |= 0xf0;
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
static void sw_write(void *p)
|
||||
{
|
||||
sw_data *sw = (sw_data *)p;
|
||||
int64_t time_since_last = sw->trigger_time / TIMER_USEC;
|
||||
|
||||
if (!JOYSTICK_PRESENT(0))
|
||||
return;
|
||||
|
||||
timer_process();
|
||||
|
||||
if (!sw->poll_left)
|
||||
{
|
||||
sw->poll_clock = 1;
|
||||
sw->poll_time = TIMER_USEC * 50;
|
||||
|
||||
if (time_since_last > 9900 && time_since_last < 9940)
|
||||
{
|
||||
sw->poll_mode = 0;
|
||||
sw->poll_left = 49;
|
||||
sw->poll_data = 0x2400ull | (0x1830ull << 15) | (0x19b0ull << 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
int c;
|
||||
|
||||
sw->poll_mode = sw->data_mode;
|
||||
sw->data_mode = !sw->data_mode;
|
||||
|
||||
if (sw->poll_mode)
|
||||
{
|
||||
sw->poll_left = 1;
|
||||
sw->poll_data = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
sw->poll_left = 1;
|
||||
sw->poll_data = 1;
|
||||
}
|
||||
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
uint16_t data = 0x3fff;
|
||||
int b;
|
||||
|
||||
if (!JOYSTICK_PRESENT(c))
|
||||
break;
|
||||
|
||||
if (joystick_state[c].axis[1] < -16383)
|
||||
data &= ~1;
|
||||
if (joystick_state[c].axis[1] > 16383)
|
||||
data &= ~2;
|
||||
if (joystick_state[c].axis[0] > 16383)
|
||||
data &= ~4;
|
||||
if (joystick_state[c].axis[0] < -16383)
|
||||
data &= ~8;
|
||||
|
||||
for (b = 0; b < 10; b++)
|
||||
{
|
||||
if (joystick_state[c].button[b])
|
||||
data &= ~(1 << (b + 4));
|
||||
}
|
||||
|
||||
if (sw_parity(data))
|
||||
data |= 0x4000;
|
||||
|
||||
if (sw->poll_mode)
|
||||
{
|
||||
sw->poll_left += 5;
|
||||
sw->poll_data |= (data << (c*15 + 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
sw->poll_left += 15;
|
||||
sw->poll_data |= (data << (c*15 + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sw->trigger_time = 0;
|
||||
|
||||
timer_update_outstanding();
|
||||
}
|
||||
|
||||
static int sw_read_axis(void *p, int axis)
|
||||
{
|
||||
if (!JOYSTICK_PRESENT(0))
|
||||
return AXIS_NOT_PRESENT;
|
||||
|
||||
return 0LL; /*No analogue support on Sidewinder game pad*/
|
||||
}
|
||||
|
||||
static void sw_a0_over(void *p)
|
||||
{
|
||||
sw_data *sw = (sw_data *)p;
|
||||
|
||||
sw->trigger_time = TIMER_USEC * 10000;
|
||||
}
|
||||
|
||||
const joystick_if_t joystick_sw_pad =
|
||||
{
|
||||
"Microsoft SideWinder Pad",
|
||||
sw_init,
|
||||
sw_close,
|
||||
sw_read,
|
||||
sw_write,
|
||||
sw_read_axis,
|
||||
sw_a0_over,
|
||||
2,
|
||||
10,
|
||||
0,
|
||||
4,
|
||||
{"X axis", "Y axis"},
|
||||
{"A", "B", "C", "X", "Y", "Z", "L", "R", "Start", "M"}
|
||||
};
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_standard.h"
|
||||
|
||||
|
||||
static void *tm_fcs_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void tm_fcs_a0_over(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
const joystick_if_t joystick_tm_fcs =
|
||||
{
|
||||
"Thrustmaster Flight Control System",
|
||||
tm_fcs_init,
|
||||
tm_fcs_close,
|
||||
tm_fcs_read,
|
||||
tm_fcs_write,
|
||||
tm_fcs_read_axis,
|
||||
tm_fcs_a0_over,
|
||||
2,
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2", "Button 3", "Button 4"},
|
||||
{"POV"}
|
||||
};
|
||||
140
src/game/js_ch_fs_pro.c
Normal file
140
src/game/js_ch_fs_pro.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* 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: @(#)js_fs_pro.c 1.0.5 2018/04/26
|
||||
*
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../timer.h"
|
||||
#include "../ports/game_dev.h"
|
||||
#include "joystick.h"
|
||||
|
||||
|
||||
static uint8_t
|
||||
js_read(void *priv)
|
||||
{
|
||||
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
|
||||
js_write(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
js_read_axis(void *priv, 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
|
||||
js_over(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
js_init(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
js_close(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const gamedev_t js_ch_fs_pro = {
|
||||
"CH Flightstick Pro",
|
||||
js_init, js_close,
|
||||
js_read, js_write,
|
||||
js_read_axis,
|
||||
js_over,
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
{ "X axis", "Y axis", "Throttle" },
|
||||
{ "Button 1", "Button 2", "Button 3", "Button 4" },
|
||||
{ "POV" }
|
||||
};
|
||||
301
src/game/js_standard.c
Normal file
301
src/game/js_standard.c
Normal file
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
* 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: @(#)js_standard.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../timer.h"
|
||||
#include "../ports/game_dev.h"
|
||||
#include "joystick.h"
|
||||
|
||||
|
||||
static uint8_t
|
||||
js_read(void *priv)
|
||||
{
|
||||
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_PRESENT(1)) {
|
||||
if (joystick_state[1].button[0])
|
||||
ret &= ~0x40;
|
||||
if (joystick_state[1].button[1])
|
||||
ret &= ~0x80;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
js_read_4button(void *priv)
|
||||
{
|
||||
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
|
||||
js_write(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
js_axis(void *priv, int axis)
|
||||
{
|
||||
int ret = AXIS_NOT_PRESENT;
|
||||
|
||||
switch (axis) {
|
||||
case 0:
|
||||
if (JOYSTICK_PRESENT(0))
|
||||
ret = joystick_state[0].axis[0];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (JOYSTICK_PRESENT(0))
|
||||
ret = joystick_state[0].axis[1];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (JOYSTICK_PRESENT(1))
|
||||
ret = joystick_state[1].axis[0];
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (JOYSTICK_PRESENT(1))
|
||||
ret = joystick_state[1].axis[1];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
js_axis_4button(void *priv, int axis)
|
||||
{
|
||||
int ret = AXIS_NOT_PRESENT;
|
||||
|
||||
if (! JOYSTICK_PRESENT(0)) return(ret);
|
||||
|
||||
switch (axis) {
|
||||
case 0:
|
||||
ret = joystick_state[0].axis[0];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ret = joystick_state[0].axis[1];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
js_axis_6button(void *priv, int axis)
|
||||
{
|
||||
int ret = AXIS_NOT_PRESENT;
|
||||
|
||||
if (! JOYSTICK_PRESENT(0)) return(ret);
|
||||
|
||||
switch (axis) {
|
||||
case 0:
|
||||
ret = joystick_state[0].axis[0];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ret = joystick_state[0].axis[1];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ret = joystick_state[0].button[4] ? -32767 : 32768;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ret = joystick_state[0].button[5] ? -32767 : 32768;
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
js_axis_8button(void *priv, int axis)
|
||||
{
|
||||
int ret = AXIS_NOT_PRESENT;
|
||||
|
||||
if (! JOYSTICK_PRESENT(0)) return(ret);
|
||||
|
||||
switch (axis) {
|
||||
case 0:
|
||||
ret = joystick_state[0].axis[0];
|
||||
|
||||
case 1:
|
||||
ret = joystick_state[0].axis[1];
|
||||
|
||||
case 2:
|
||||
ret = 0;
|
||||
if (joystick_state[0].button[4])
|
||||
ret = -32767;
|
||||
if (joystick_state[0].button[6])
|
||||
ret = 32768;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ret = 0;
|
||||
if (joystick_state[0].button[5])
|
||||
ret = -32767;
|
||||
if (joystick_state[0].button[7])
|
||||
ret = 32768;
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
js_over(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
js_init(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
js_close(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const gamedev_t js_standard = {
|
||||
"Standard 2-button joystick(s)",
|
||||
js_init, js_close,
|
||||
js_read, js_write,
|
||||
js_axis,
|
||||
js_over,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
2,
|
||||
{ "X axis", "Y axis" },
|
||||
{ "Button 1", "Button 2" }
|
||||
};
|
||||
|
||||
const gamedev_t js_standard_4btn = {
|
||||
"Standard 4-button joystick",
|
||||
js_init, js_close,
|
||||
js_read_4button, js_write,
|
||||
js_axis_4button, js_over,
|
||||
2,
|
||||
4,
|
||||
0,
|
||||
1,
|
||||
{ "X axis", "Y axis" },
|
||||
{ "Button 1", "Button 2", "Button 3", "Button 4" }
|
||||
};
|
||||
|
||||
const gamedev_t js_standard_6btn = {
|
||||
"Standard 6-button joystick",
|
||||
js_init, js_close,
|
||||
js_read_4button, js_write,
|
||||
js_axis_6button, js_over,
|
||||
2,
|
||||
6,
|
||||
0,
|
||||
1,
|
||||
{ "X axis", "Y axis" },
|
||||
{ "Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6" }
|
||||
};
|
||||
|
||||
const gamedev_t js_standard_8btn = {
|
||||
"Standard 8-button joystick",
|
||||
js_init, js_close,
|
||||
js_read_4button, js_write,
|
||||
js_axis_8button, js_over,
|
||||
2,
|
||||
8,
|
||||
0,
|
||||
1,
|
||||
{ "X axis", "Y axis" },
|
||||
{ "Button 1", "Button 2", "Button 3", "Button 4",
|
||||
"Button 5", "Button 6", "Button 7", "Button 8" }
|
||||
};
|
||||
285
src/game/js_sw_pad.c
Normal file
285
src/game/js_sw_pad.c
Normal file
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
* 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 enough for 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: @(#)js_sw_pad.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../timer.h"
|
||||
#include "../ports/game_dev.h"
|
||||
#include "joystick.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
int64_t poll_time;
|
||||
int64_t poll_left;
|
||||
int64_t poll_clock;
|
||||
uint64_t poll_data;
|
||||
int64_t poll_mode;
|
||||
|
||||
int64_t trigger_time;
|
||||
int64_t data_mode;
|
||||
} sw_data;
|
||||
|
||||
|
||||
static void
|
||||
timer_over(void *priv)
|
||||
{
|
||||
sw_data *sw = (sw_data *)priv;
|
||||
|
||||
while (sw->poll_time <= 0 && sw->poll_left) {
|
||||
sw->poll_clock = !sw->poll_clock;
|
||||
|
||||
if (sw->poll_clock) {
|
||||
sw->poll_data >>= (sw->poll_mode ? 3 : 1);
|
||||
sw->poll_left--;
|
||||
}
|
||||
|
||||
if (sw->poll_left == 1 && !sw->poll_clock)
|
||||
sw->poll_time += TIMER_USEC * 160LL;
|
||||
else if (sw->poll_left)
|
||||
sw->poll_time += TIMER_USEC * 5;
|
||||
else
|
||||
sw->poll_time = 0;
|
||||
}
|
||||
|
||||
if (! sw->poll_left)
|
||||
sw->poll_time = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
trigger_timer_over(void *priv)
|
||||
{
|
||||
sw_data *sw = (sw_data *)priv;
|
||||
|
||||
sw->trigger_time = 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sw_parity(uint16_t data)
|
||||
{
|
||||
int bits_set = 0;
|
||||
|
||||
while (data) {
|
||||
bits_set++;
|
||||
data &= (data - 1);
|
||||
}
|
||||
|
||||
return(bits_set & 1);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
sw_init(void)
|
||||
{
|
||||
sw_data *sw = (sw_data *)malloc(sizeof(sw_data));
|
||||
|
||||
pclog("SideWinder: initializing..\n");
|
||||
memset(sw, 0x00, sizeof(sw_data));
|
||||
|
||||
timer_add(timer_over, &sw->poll_time, &sw->poll_time, sw);
|
||||
timer_add(trigger_timer_over, &sw->trigger_time, &sw->trigger_time, sw);
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sw_close(void *priv)
|
||||
{
|
||||
sw_data *sw = (sw_data *)priv;
|
||||
|
||||
pclog("SideWinder: closing.\n");
|
||||
free(sw);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
sw_read(void *priv)
|
||||
{
|
||||
sw_data *sw = (sw_data *)priv;
|
||||
uint8_t temp = 0;
|
||||
|
||||
pclog("SideWinder: read(): %d\n", !!JOYSTICK_PRESENT(0));
|
||||
if (! JOYSTICK_PRESENT(0)) return(0xff);
|
||||
|
||||
if (sw->poll_time) {
|
||||
if (sw->poll_clock)
|
||||
temp |= 0x10;
|
||||
|
||||
if (sw->poll_mode)
|
||||
temp |= (sw->poll_data & 7) << 5;
|
||||
else {
|
||||
temp |= ((sw->poll_data & 1) << 5) | 0xc0;
|
||||
if (sw->poll_left > 31 && !(sw->poll_left & 1))
|
||||
temp &= ~0x80;
|
||||
}
|
||||
} else
|
||||
temp |= 0xf0;
|
||||
|
||||
return(temp);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sw_write(void *priv)
|
||||
{
|
||||
sw_data *sw = (sw_data *)priv;
|
||||
int64_t time_since_last = sw->trigger_time / TIMER_USEC;
|
||||
|
||||
pclog("SideWinder: write(): %d\n", !!JOYSTICK_PRESENT(0));
|
||||
if (! JOYSTICK_PRESENT(0)) return;
|
||||
|
||||
timer_process();
|
||||
|
||||
if (! sw->poll_left) {
|
||||
sw->poll_clock = 1;
|
||||
sw->poll_time = TIMER_USEC * 50;
|
||||
|
||||
if (time_since_last > 9900 && time_since_last < 9940) {
|
||||
sw->poll_mode = 0;
|
||||
sw->poll_left = 49;
|
||||
sw->poll_data = 0x2400ull | (0x1830ull << 15) | (0x19b0ull << 30);
|
||||
} else {
|
||||
int c;
|
||||
|
||||
sw->poll_mode = sw->data_mode;
|
||||
sw->data_mode = !sw->data_mode;
|
||||
|
||||
if (sw->poll_mode) {
|
||||
sw->poll_left = 1;
|
||||
sw->poll_data = 7;
|
||||
} else {
|
||||
sw->poll_left = 1;
|
||||
sw->poll_data = 1;
|
||||
}
|
||||
|
||||
for (c = 0; c < 4; c++) {
|
||||
uint16_t data = 0x3fff;
|
||||
int b;
|
||||
|
||||
if (! JOYSTICK_PRESENT(c)) break;
|
||||
|
||||
if (joystick_state[c].axis[1] < -16383)
|
||||
data &= ~1;
|
||||
if (joystick_state[c].axis[1] > 16383)
|
||||
data &= ~2;
|
||||
if (joystick_state[c].axis[0] > 16383)
|
||||
data &= ~4;
|
||||
if (joystick_state[c].axis[0] < -16383)
|
||||
data &= ~8;
|
||||
|
||||
for (b = 0; b < 10; b++) {
|
||||
if (joystick_state[c].button[b])
|
||||
data &= ~(1 << (b + 4));
|
||||
}
|
||||
|
||||
if (sw_parity(data))
|
||||
data |= 0x4000;
|
||||
|
||||
if (sw->poll_mode) {
|
||||
sw->poll_left += 5;
|
||||
sw->poll_data |= (data << (c*15 + 3));
|
||||
} else {
|
||||
sw->poll_left += 15;
|
||||
sw->poll_data |= (data << (c*15 + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sw->trigger_time = 0;
|
||||
|
||||
timer_update_outstanding();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sw_axis(void *priv, int axis)
|
||||
{
|
||||
if (! JOYSTICK_PRESENT(0))
|
||||
return AXIS_NOT_PRESENT;
|
||||
|
||||
return 0LL; /*No analogue support on Sidewinder game pad*/
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sw_over(void *priv)
|
||||
{
|
||||
sw_data *sw = (sw_data *)priv;
|
||||
|
||||
sw->trigger_time = TIMER_USEC * 10000;
|
||||
}
|
||||
|
||||
|
||||
const gamedev_t js_sw_pad = {
|
||||
"Microsoft SideWinder Pad",
|
||||
sw_init, sw_close,
|
||||
sw_read, sw_write,
|
||||
sw_axis, sw_over,
|
||||
2,
|
||||
10,
|
||||
0,
|
||||
4,
|
||||
{"X axis", "Y axis"},
|
||||
{"A", "B", "C", "X", "Y", "Z", "L", "R", "Start", "M"}
|
||||
};
|
||||
148
src/game/js_tm_fcs.c
Normal file
148
src/game/js_tm_fcs.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* 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: @(#)js_tm_fcs.c 1.0.4 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../timer.h"
|
||||
#include "../ports/game_dev.h"
|
||||
#include "joystick.h"
|
||||
|
||||
|
||||
static uint8_t
|
||||
tm_fcs_read(void *priv)
|
||||
{
|
||||
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 *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
tm_fcs_axis(void *priv, int axis)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (! JOYSTICK_PRESENT(0)) return(AXIS_NOT_PRESENT);
|
||||
|
||||
switch (axis) {
|
||||
case 0:
|
||||
ret = joystick_state[0].axis[0];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ret = joystick_state[0].axis[1];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (joystick_state[0].pov[0] == -1)
|
||||
ret = 32767;
|
||||
if (joystick_state[0].pov[0] > 315 || joystick_state[0].pov[0] < 45)
|
||||
ret = -32768;
|
||||
|
||||
if (joystick_state[0].pov[0] >= 45 && joystick_state[0].pov[0] < 135)
|
||||
ret = -16384;
|
||||
|
||||
if (joystick_state[0].pov[0] >= 135 && joystick_state[0].pov[0] < 225)
|
||||
ret = 0;
|
||||
|
||||
if (joystick_state[0].pov[0] >= 225 && joystick_state[0].pov[0] < 315)
|
||||
ret = 16384;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
tm_fcs_over(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
tm_fcs_init(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
tm_fcs_close(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const gamedev_t js_tm_fcs = {
|
||||
"Thrustmaster Flight Control System",
|
||||
tm_fcs_init, tm_fcs_close,
|
||||
tm_fcs_read, tm_fcs_write,
|
||||
tm_fcs_axis, tm_fcs_over,
|
||||
2,
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
{ "X axis", "Y axis" },
|
||||
{ "Button 1", "Button 2", "Button 3", "Button 4" },
|
||||
{ "POV" }
|
||||
};
|
||||
@@ -32,7 +32,7 @@
|
||||
* BIOSES: I need to re-do the bios.txt format so we can load non-BIOS
|
||||
* ROM files for a given machine, such as font roms here..
|
||||
*
|
||||
* Version: @(#)m_amstrad.c 1.0.12 2018/04/14
|
||||
* Version: @(#)m_amstrad.c 1.0.14 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -79,8 +79,7 @@
|
||||
#include "../nvr.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../mouse.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../sound/sound.h"
|
||||
@@ -1318,7 +1317,4 @@ machine_amstrad_init(const machine_t *model, void *arg)
|
||||
if (mouse_type == MOUSE_INTERNAL) {
|
||||
mouse_reset();
|
||||
mouse_set_poll(ms_poll, ams);
|
||||
}
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Standard PC/AT implementation.
|
||||
*
|
||||
* Version: @(#)m_at.c 1.0.5 2018/04/05
|
||||
* Version: @(#)m_at.c 1.0.7 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,7 +48,6 @@
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
@@ -65,9 +64,6 @@ machine_at_common_init(const machine_t *model, void *arg)
|
||||
dma16_init();
|
||||
|
||||
device_add(&at_nvr_device);
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
device_add(&gameport_device);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Commodore PC3 system.
|
||||
*
|
||||
* Version: @(#)m_at_commodore.c 1.0.5 2018/04/07
|
||||
* Version: @(#)m_at_commodore.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -43,8 +43,8 @@
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../io.h"
|
||||
#include "../serial.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine.h"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
* Used by DTK PKM-0038S E-2
|
||||
*
|
||||
* Version: @(#)m_at_sis85c471.c 1.0.7 2018/04/19
|
||||
* Version: @(#)m_at_sis85c471.c 1.0.8 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -46,12 +46,12 @@
|
||||
#include "../io.h"
|
||||
#include "../memregs.h"
|
||||
#include "../device.h"
|
||||
#include "../serial.h"
|
||||
#include "../parallel.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the WD76C10 system controller.
|
||||
*
|
||||
* Version: @(#)m_at_wd76c10.c 1.0.5 2018/04/19
|
||||
* Version: @(#)m_at_wd76c10.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -41,11 +41,11 @@
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../io.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../mem.h"
|
||||
#include "../serial.h"
|
||||
#include "../device.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine.h"
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
* bit 1: b8000 memory available
|
||||
* 0000:046a: 00 jim 250 01 jim 350
|
||||
*
|
||||
* Version: @(#)m_europc.c 1.0.8 2018/04/24
|
||||
* Version: @(#)m_europc.c 1.0.10 2018/04/26
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -120,10 +120,9 @@
|
||||
#include "../rom.h"
|
||||
#include "../nvr.h"
|
||||
#include "../device.h"
|
||||
#include "../parallel.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../mouse.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
@@ -622,9 +621,8 @@ europc_boot(const device_t *info)
|
||||
b = (sys->nvr.regs[MRTC_CONF_C] & 0xfc);
|
||||
if (mouse_type == MOUSE_INTERNAL) {
|
||||
b |= 0x01; /* enable port as MOUSE */
|
||||
} else if (joystick_type != JOYSTICK_TYPE_NONE) {
|
||||
} else if (game_enabled) {
|
||||
b |= 0x02; /* enable port as joysticks */
|
||||
device_add(&gameport_device);
|
||||
}
|
||||
sys->nvr.regs[MRTC_CONF_C] = b;
|
||||
|
||||
@@ -718,6 +716,7 @@ void
|
||||
machine_europc_init(const machine_t *model, void *arg)
|
||||
{
|
||||
machine_common_init(model, arg);
|
||||
|
||||
nmi_init();
|
||||
|
||||
/* Clear the machine state. */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of the Olivetti M24.
|
||||
*
|
||||
* Version: @(#)m_olivetti_m24.c 1.0.7 2018/04/02
|
||||
* Version: @(#)m_olivetti_m24.c 1.0.9 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -56,7 +56,6 @@
|
||||
#include "../mouse.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../sound/sound.h"
|
||||
#include "../sound/snd_speaker.h"
|
||||
#include "../video/video.h"
|
||||
@@ -853,9 +852,6 @@ machine_olim24_init(const machine_t *model, void *arg)
|
||||
mouse_reset();
|
||||
mouse_set_poll(ms_poll, m24);
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
device_add(&gameport_device);
|
||||
|
||||
/* FIXME: make sure this is correct?? */
|
||||
device_add(&at_nvr_device);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of the IBM PCjr.
|
||||
*
|
||||
* Version: @(#)m_pcjr.c 1.0.5 2018/04/03
|
||||
* Version: @(#)m_pcjr.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "../mem.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../serial.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* The reserved 384K is remapped to the top of extended memory.
|
||||
* If this is not done then you get an error on startup.
|
||||
*
|
||||
* Version: @(#)m_ps1.c 1.0.14 2018/04/20
|
||||
* Version: @(#)m_ps1.c 1.0.16 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -68,10 +68,10 @@
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../mouse.h"
|
||||
#include "../ports/game.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
@@ -548,7 +548,13 @@ ps1_setup(int model, romdef_t *bios)
|
||||
static void
|
||||
ps1_common_init(const machine_t *model, void *arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Hack to prevent Game from being initialized there. */
|
||||
i = game_enabled;
|
||||
game_enabled = 0;
|
||||
machine_common_init(model, arg);
|
||||
game_enabled = i;
|
||||
|
||||
mem_remap_top_384k();
|
||||
|
||||
@@ -564,8 +570,8 @@ ps1_common_init(const machine_t *model, void *arg)
|
||||
device_add(&mouse_ps2_device);
|
||||
|
||||
/* Audio uses ports 200h,202-207h, so only initialize gameport on 201h. */
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
device_add(&gameport_201_device);
|
||||
if (game_enabled)
|
||||
device_add(&game_201_device);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
#define HDC_TIME (200*TIMER_USEC)
|
||||
#define HDC_TIME (50*TIMER_USEC)
|
||||
#define HDC_TYPE_USER 47 /* user drive type */
|
||||
#define PS1_HDD_NUM 1 /* we support 1 drive */
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of ISA-based PS/2 machines.
|
||||
*
|
||||
* Version: @(#)m_ps2_isa.c 1.0.9 2018/04/19
|
||||
* Version: @(#)m_ps2_isa.c 1.0.10 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -51,8 +51,8 @@
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of MCA-based PS/2 machines.
|
||||
*
|
||||
* Version: @(#)m_ps2_mca.c 1.0.11 2018/04/19
|
||||
* Version: @(#)m_ps2_mca.c 1.0.12 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -52,14 +52,14 @@
|
||||
#include "../nmi.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../nvr.h"
|
||||
#include "../nvr_ps2.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../parallel.h"
|
||||
#include "../mouse.h"
|
||||
#include "../serial.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of Tandy models 1000, 1000HX and 1000SL2.
|
||||
*
|
||||
* Version: @(#)m_tandy.c 1.0.7 2018/04/09
|
||||
* Version: @(#)m_tandy.c 1.0.9 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -53,10 +53,9 @@
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../sound/sound.h"
|
||||
#include "../sound/snd_sn76489.h"
|
||||
#include "../video/video.h"
|
||||
@@ -1977,9 +1976,6 @@ machine_tandy1k_init(const machine_t *model, void *arg)
|
||||
device_add(&eep_device);
|
||||
}
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
device_add(&gameport_device);
|
||||
|
||||
eep_data_out = 0x0000;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of standard IBM PC/XT class machine.
|
||||
*
|
||||
* Version: @(#)m_xt.c 1.0.6 2018/04/03
|
||||
* Version: @(#)m_xt.c 1.0.8 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -45,10 +45,9 @@
|
||||
#include "../pit.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../keyboard.h"
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
@@ -96,9 +95,6 @@ machine_xt_init(const machine_t *model, void *arg)
|
||||
device_add(&fdc_xt_device);
|
||||
|
||||
nmi_init();
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
device_add(&gameport_device);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of various Compaq XT-class PC's.
|
||||
*
|
||||
* Version: @(#)m_xt_compaq.c 1.0.7 2018/04/07
|
||||
* Version: @(#)m_xt_compaq.c 1.0.9 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,11 +48,10 @@
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../parallel.h"
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
@@ -69,12 +68,8 @@ machine_xt_compaq_init(const machine_t *model, void *arg)
|
||||
|
||||
nmi_init();
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
device_add(&gameport_device);
|
||||
|
||||
switch(model->id) {
|
||||
case ROM_PORTABLE:
|
||||
//FIXME: parallel_remove(1);
|
||||
parallel_setup(1, 0x03bc);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
*
|
||||
* FIXME: The ROM drive should be re-done using the "option file".
|
||||
*
|
||||
* Version: @(#)m_xt_t1000.c 1.0.9 2018/04/05
|
||||
* Version: @(#)m_xt_t1000.c 1.0.10 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -93,11 +93,10 @@
|
||||
#include "../rom.h"
|
||||
#include "../nvr.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../parallel.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../video/video.h"
|
||||
#include "../plat.h"
|
||||
#include "machine.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Xi8088 open-source machine.
|
||||
*
|
||||
* Version: @(#)m_xt_xi8088.c 1.0.6 2018/04/05
|
||||
* Version: @(#)m_xt_xi8088.c 1.0.8 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -50,8 +50,7 @@
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../parallel.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
@@ -180,8 +179,5 @@ machine_xt_xi8088_init(const machine_t *model, void *arg)
|
||||
|
||||
device_add(&keyboard_ps2_device);
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
device_add(&gameport_device);
|
||||
|
||||
device_add(&fdc_xt_device);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handling of the emulated machines.
|
||||
*
|
||||
* Version: @(#)machine.c 1.0.13 2018/04/21
|
||||
* Version: @(#)machine.c 1.0.14 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -47,8 +47,9 @@
|
||||
#include "../pit.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../serial.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/game.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../plat.h"
|
||||
@@ -153,6 +154,9 @@ machine_common_init(const machine_t *model, UNUSED(void *arg))
|
||||
dma_init();
|
||||
pit_init();
|
||||
|
||||
if (game_enabled)
|
||||
device_add(&game_device);
|
||||
|
||||
if (parallel_enabled[0])
|
||||
device_add(¶llel_1_device);
|
||||
if (parallel_enabled[1])
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* TODO: Add the Genius Serial Mouse.
|
||||
*
|
||||
* Version: @(#)mouse_serial.c 1.0.6 2018/04/20
|
||||
* Version: @(#)mouse_serial.c 1.0.7 2018/04/26
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -55,7 +55,7 @@
|
||||
#include "config.h"
|
||||
#include "device.h"
|
||||
#include "timer.h"
|
||||
#include "serial.h"
|
||||
#include "ports/serial.h"
|
||||
#include "mouse.h"
|
||||
|
||||
|
||||
|
||||
17
src/pc.c
17
src/pc.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Main emulator module where most things are controlled.
|
||||
*
|
||||
* Version: @(#)pc.c 1.0.26 2018/04/19
|
||||
* Version: @(#)pc.c 1.0.28 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -65,11 +65,12 @@
|
||||
#include "device.h"
|
||||
#include "nvr.h"
|
||||
#include "bugger.h"
|
||||
#include "serial.h"
|
||||
#include "parallel.h"
|
||||
#include "ports/game.h"
|
||||
#include "ports/serial.h"
|
||||
#include "ports/parallel.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "game/gameport.h"
|
||||
#include "game/joystick.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "floppy/fdd_common.h"
|
||||
#include "disk/hdd.h"
|
||||
@@ -124,7 +125,8 @@ int vid_api = 0, /* (C) video renderer */
|
||||
voodoo_enabled = 0; /* (C) video option */
|
||||
int mouse_type = 0; /* (C) selected mouse type */
|
||||
int enable_sync = 0; /* (C) enable time sync */
|
||||
int serial_enabled[] = {0,0}, /* (C) enable serial ports */
|
||||
int game_enabled = 0, /* (C) enable game port */
|
||||
serial_enabled[] = {0,0}, /* (C) enable serial ports */
|
||||
parallel_enabled[] = {0,0,0}, /* (C) enable LPT ports */
|
||||
parallel_device[] = {0,0,0}, /* (C) set up LPT devices */
|
||||
bugger_enabled = 0; /* (C) enable ISAbugger */
|
||||
@@ -851,8 +853,9 @@ pc_reset_hard_init(void)
|
||||
/* Reset and reconfigure the Network Card layer. */
|
||||
network_reset();
|
||||
|
||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
||||
gameport_update_joystick_type();
|
||||
//FIXME: this needs to be re-done. */
|
||||
if (joystick_type != JOYSTICK_NONE)
|
||||
game_update_joystick_type();
|
||||
|
||||
if (config_changed) {
|
||||
ui_sb_update_panes();
|
||||
|
||||
229
src/ports/game.c
Normal file
229
src/ports/game.c
Normal file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* 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: @(#)game.c 1.0.8 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../io.h"
|
||||
#include "../timer.h"
|
||||
#include "game.h"
|
||||
#include "game_dev.h"
|
||||
#include "../game/joystick.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
int64_t count;
|
||||
int axis_nr;
|
||||
struct _game_ *game;
|
||||
} g_axis_t;
|
||||
|
||||
typedef struct _game_ {
|
||||
uint8_t state;
|
||||
|
||||
g_axis_t axis[4];
|
||||
|
||||
const gamedev_t *joystick;
|
||||
void *joystick_priv;
|
||||
} game_t;
|
||||
|
||||
|
||||
static game_t *game_global = NULL;
|
||||
|
||||
|
||||
static int
|
||||
game_time(int axis)
|
||||
{
|
||||
if (axis == AXIS_NOT_PRESENT) return(0);
|
||||
|
||||
axis += 32768;
|
||||
axis = (axis * 100) / 65; /*Axis now in ohms*/
|
||||
axis = (axis * 11) / 1000;
|
||||
|
||||
return((int)(TIMER_USEC * (axis + 24))); /*max = 11.115 ms*/
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
game_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
game_t *dev = (game_t *)priv;
|
||||
int i;
|
||||
|
||||
timer_clock();
|
||||
|
||||
dev->state |= 0x0f;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
dev->axis[i].count =
|
||||
game_time(dev->joystick->read_axis(dev->joystick_priv, i));
|
||||
}
|
||||
//FIXME: removed too much stuff here! --FvK
|
||||
dev->joystick->write(dev->joystick_priv);
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
game_read(uint16_t addr, void *priv)
|
||||
{
|
||||
game_t *dev = (game_t *)priv;
|
||||
uint8_t ret;
|
||||
|
||||
timer_clock();
|
||||
|
||||
ret = dev->state | dev->joystick->read(dev->joystick_priv);
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* Timer expired... game over. Just couldn't resist... --FvK */
|
||||
static void
|
||||
game_over(void *priv)
|
||||
{
|
||||
g_axis_t *axis = (g_axis_t *)priv;
|
||||
game_t *dev = axis->game;
|
||||
|
||||
dev->state &= ~(1 << axis->axis_nr);
|
||||
axis->count = 0;
|
||||
|
||||
if (axis == &dev->axis[0])
|
||||
dev->joystick->a0_over(dev->joystick_priv);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
game_init(const device_t *info)
|
||||
{
|
||||
game_t *dev;
|
||||
int i;
|
||||
|
||||
pclog("GAME: initializing, type=%d\n", joystick_type);
|
||||
|
||||
if (joystick_type == JOYSTICK_NONE) return(NULL);
|
||||
|
||||
dev = (game_t *)malloc(sizeof(game_t));
|
||||
memset(dev, 0x00, sizeof(game_t));
|
||||
game_global = dev;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
dev->axis[i].game = dev;
|
||||
dev->axis[i].axis_nr = i;
|
||||
}
|
||||
|
||||
dev->joystick = gamedev_get_device(joystick_type);
|
||||
dev->joystick_priv = dev->joystick->init();
|
||||
|
||||
switch(info->local) {
|
||||
case 0: /* regular game port */
|
||||
io_sethandler(0x0200, 8,
|
||||
game_read,NULL,NULL, game_write,NULL,NULL, dev);
|
||||
break;
|
||||
|
||||
case 1: /* special case, 1 I/O port only */
|
||||
io_sethandler(0x0201, 1,
|
||||
game_read,NULL,NULL, game_write,NULL,NULL, dev);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
timer_add(game_over,
|
||||
&dev->axis[0].count, &dev->axis[0].count, &dev->axis[0]);
|
||||
timer_add(game_over,
|
||||
&dev->axis[1].count, &dev->axis[1].count, &dev->axis[1]);
|
||||
timer_add(game_over,
|
||||
&dev->axis[2].count, &dev->axis[2].count, &dev->axis[2]);
|
||||
timer_add(game_over,
|
||||
&dev->axis[3].count, &dev->axis[3].count, &dev->axis[3]);
|
||||
|
||||
return(dev);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
game_close(void *priv)
|
||||
{
|
||||
game_t *dev = (game_t *)priv;
|
||||
|
||||
if (dev == NULL) return;
|
||||
|
||||
dev->joystick->close(dev->joystick_priv);
|
||||
|
||||
game_global = NULL;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
const device_t game_device = {
|
||||
"Standard Game Port",
|
||||
0,
|
||||
0,
|
||||
game_init, game_close, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
const device_t game_201_device = {
|
||||
"Custom Game Port (201H)",
|
||||
0,
|
||||
1,
|
||||
game_init, game_close, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
game_update_joystick_type(void)
|
||||
{
|
||||
game_t *dev = game_global;
|
||||
|
||||
if (dev != NULL) {
|
||||
dev->joystick->close(dev->joystick_priv);
|
||||
dev->joystick = gamedev_get_device(joystick_type);
|
||||
dev->joystick_priv = dev->joystick->init();
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,15 @@
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the Sidewinder Pro driver.
|
||||
* Definitions for the generic game port handlers.
|
||||
*
|
||||
* Version: @(#)joystick_sw_pad.h 1.0.2 2018/03/15
|
||||
* Version: @(#)game.h 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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
|
||||
@@ -34,5 +34,24 @@
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_GAME_H
|
||||
# define EMU_GAME_H
|
||||
|
||||
extern const joystick_if_t joystick_sw_pad;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t game_device;
|
||||
extern const device_t game_201_device;
|
||||
#endif
|
||||
|
||||
extern void game_update_joystick_type(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*EMU_GAME_H*/
|
||||
146
src/ports/game_dev.c
Normal file
146
src/ports/game_dev.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Handle all the various gameport devices.
|
||||
*
|
||||
* Version: @(#)game_dev.c 1.0.1 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "game.h"
|
||||
#include "game_dev.h"
|
||||
|
||||
|
||||
extern const gamedev_t js_standard;
|
||||
extern const gamedev_t js_standard_4btn;
|
||||
extern const gamedev_t js_standard_6btn;
|
||||
extern const gamedev_t js_standard_8btn;
|
||||
|
||||
extern const gamedev_t js_ch_fs_pro;
|
||||
|
||||
extern const gamedev_t js_sw_pad;
|
||||
|
||||
extern const gamedev_t js_tm_fcs;
|
||||
|
||||
|
||||
static const gamedev_t gamedev_none = {
|
||||
"Disabled",
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
static const gamedev_t *devices[] = {
|
||||
&gamedev_none,
|
||||
|
||||
&js_standard,
|
||||
&js_standard_4btn,
|
||||
&js_standard_6btn,
|
||||
&js_standard_8btn,
|
||||
&js_ch_fs_pro,
|
||||
&js_sw_pad,
|
||||
&js_tm_fcs,
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
const gamedev_t *
|
||||
gamedev_get_device(int js)
|
||||
{
|
||||
return(devices[js]);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
gamedev_get_name(int js)
|
||||
{
|
||||
if (devices[js] == NULL)
|
||||
return(NULL);
|
||||
|
||||
return(devices[js]->name);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gamedev_get_max_joysticks(int js)
|
||||
{
|
||||
return(devices[js]->max_joysticks);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gamedev_get_axis_count(int js)
|
||||
{
|
||||
return(devices[js]->axis_count);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gamedev_get_button_count(int js)
|
||||
{
|
||||
return(devices[js]->button_count);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gamedev_get_pov_count(int js)
|
||||
{
|
||||
return(devices[js]->pov_count);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
gamedev_get_axis_name(int js, int id)
|
||||
{
|
||||
return(devices[js]->axis_names[id]);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
gamedev_get_button_name(int js, int id)
|
||||
{
|
||||
return(devices[js]->button_names[id]);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
gamedev_get_pov_name(int js, int id)
|
||||
{
|
||||
return(devices[js]->pov_names[id]);
|
||||
}
|
||||
84
src/ports/game_dev.h
Normal file
84
src/ports/game_dev.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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 devices that attach to the Game Port.
|
||||
*
|
||||
* Version: @(#)game_dev.h 1.0.1 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* 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_GAME_DEV_H
|
||||
# define EMU_GAME_DEV_H
|
||||
|
||||
|
||||
#define AXIS_NOT_PRESENT -99999
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
|
||||
void *(*init)(void);
|
||||
void (*close)(void *priv);
|
||||
uint8_t (*read)(void *priv);
|
||||
void (*write)(void *priv);
|
||||
int (*read_axis)(void *priv, int axis);
|
||||
void (*a0_over)(void *priv);
|
||||
|
||||
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];
|
||||
} gamedev_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const gamedev_t *gamedev_get_device(int js);
|
||||
extern const char *gamedev_get_name(int js);
|
||||
extern int gamedev_get_max_joysticks(int js);
|
||||
extern int gamedev_get_axis_count(int js);
|
||||
extern int gamedev_get_button_count(int js);
|
||||
extern int gamedev_get_pov_count(int js);
|
||||
extern const char *gamedev_get_axis_name(int js, int id);
|
||||
extern const char *gamedev_get_button_name(int js, int id);
|
||||
extern const char *gamedev_get_pov_name(int js, int id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*EMU_GAME_DEV_H*/
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the "LPT" style parallel ports.
|
||||
*
|
||||
* Version: @(#)parallel.c 1.0.7 2018/04/21
|
||||
* Version: @(#)parallel.c 1.0.8 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -40,9 +40,9 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "emu.h"
|
||||
#include "io.h"
|
||||
#include "device.h"
|
||||
#include "../emu.h"
|
||||
#include "../io.h"
|
||||
#include "../device.h"
|
||||
#include "parallel.h"
|
||||
#include "parallel_dev.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the parallel-port-attached devices.
|
||||
*
|
||||
* Version: @(#)parallel_dev.c 1.0.2 2018/04/10
|
||||
* Version: @(#)parallel_dev.c 1.0.3 2018/04/28
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -40,13 +40,13 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "emu.h"
|
||||
#include "io.h"
|
||||
#include "../emu.h"
|
||||
#include "../io.h"
|
||||
#include "parallel.h"
|
||||
#include "parallel_dev.h"
|
||||
|
||||
#include "sound/snd_lpt_dac.h"
|
||||
#include "sound/snd_lpt_dss.h"
|
||||
#include "../sound/snd_lpt_dac.h"
|
||||
#include "../sound/snd_lpt_dss.h"
|
||||
|
||||
|
||||
static const struct {
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of 8250-style serial port.
|
||||
*
|
||||
* Version: @(#)serial.c 1.0.4 2018/04/21
|
||||
* Version: @(#)serial.c 1.0.5 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -41,14 +41,14 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "emu.h"
|
||||
#include "machine/machine.h"
|
||||
#include "io.h"
|
||||
#include "pic.h"
|
||||
#include "mem.h"
|
||||
#include "rom.h"
|
||||
#include "timer.h"
|
||||
#include "device.h"
|
||||
#include "../emu.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../io.h"
|
||||
#include "../pic.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "serial.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the SMC FDC37C669 Super I/O Chip.
|
||||
*
|
||||
* Version: @(#)sio_fdc37c669.c 1.0.5 2018/04/19
|
||||
* Version: @(#)sio_fdc37c669.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -38,10 +38,10 @@
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../io.h"
|
||||
#include "../device.h"
|
||||
#include "../pci.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the SMC FDC37C663 and FDC37C665 Super
|
||||
* I/O Chips.
|
||||
*
|
||||
* Version: @(#)sio_fdc37c66x.c 1.0.5 2018/04/19
|
||||
* Version: @(#)sio_fdc37c66x.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -43,10 +43,10 @@
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../io.h"
|
||||
#include "../device.h"
|
||||
#include "../pci.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the SMC FDC37C932FR and FDC37C935 Super
|
||||
* I/O Chips.
|
||||
*
|
||||
* Version: @(#)sio_fdc37c93x.c 1.0.7 2018/04/19
|
||||
* Version: @(#)sio_fdc37c93x.c 1.0.8 2018/04/26
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -39,10 +39,10 @@
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../io.h"
|
||||
#include "../device.h"
|
||||
#include "../pci.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of the NatSemi PC87306 Super I/O chip.
|
||||
*
|
||||
* Version: @(#)sio_pc87306.c 1.0.5 2018/04/19
|
||||
* Version: @(#)sio_pc87306.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -38,10 +38,10 @@
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../io.h"
|
||||
#include "../device.h"
|
||||
#include "../pci.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* 70 - IRQ
|
||||
* 74 - DMA
|
||||
*
|
||||
* Version: @(#)sio_um8669f.c 1.0.5 2018/04/19
|
||||
* Version: @(#)sio_um8669f.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
@@ -60,11 +60,11 @@
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../io.h"
|
||||
#include "../pci.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "sio.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* Winbond W83877F Super I/O Chip
|
||||
* Used by the Award 430HX
|
||||
*
|
||||
* Version: @(#)sio_w83877f.c 1.0.5 2018/04/19
|
||||
* Version: @(#)sio_w83877f.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -41,13 +41,13 @@
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../device.h"
|
||||
#include "../io.h"
|
||||
#include "../pci.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../parallel.h"
|
||||
#include "../serial.h"
|
||||
#include "../device.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "sio.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implemantation of LPT-based sound devices.
|
||||
*
|
||||
* Version: @(#)snd_lpt_dac.c 1.0.5 2018/04/07
|
||||
* Version: @(#)snd_lpt_dac.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "../emu.h"
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../parallel_dev.h"
|
||||
#include "../ports/parallel_dev.h"
|
||||
#include "../timer.h"
|
||||
#include "sound.h"
|
||||
#include "filters.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the LPT-based DSS sound device.
|
||||
*
|
||||
* Version: @(#)snd_lpt_dss.c 1.0.5 2018/04/07
|
||||
* Version: @(#)snd_lpt_dss.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../timer.h"
|
||||
#include "../parallel_dev.h"
|
||||
#include "../ports/parallel_dev.h"
|
||||
#include "sound.h"
|
||||
#include "filters.h"
|
||||
#include "snd_lpt_dss.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Plantronics ColorPlus emulation.
|
||||
*
|
||||
* Version: @(#)vid_colorplus.c 1.0.5 2018/04/09
|
||||
* Version: @(#)vid_colorplus.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "../mem.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "video.h"
|
||||
#include "vid_cga.h"
|
||||
#include "vid_cga_comp.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Hercules emulation.
|
||||
*
|
||||
* Version: @(#)vid_hercules.c 1.0.4 2018/04/09
|
||||
* Version: @(#)vid_hercules.c 1.0.5 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "../rom.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "video.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Hercules InColor emulation.
|
||||
*
|
||||
* Version: @(#)vid_hercules_plus.c 1.0.6 2018/04/09
|
||||
* Version: @(#)vid_hercules_plus.c 1.0.7 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "../rom.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "video.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Hercules InColor emulation.
|
||||
*
|
||||
* Version: @(#)vid_incolor.c 1.0.6 2018/04/09
|
||||
* Version: @(#)vid_incolor.c 1.0.7 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "../rom.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "video.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* MDA emulation.
|
||||
*
|
||||
* Version: @(#)vid_mda.c 1.0.5 2018/04/09
|
||||
* Version: @(#)vid_mda.c 1.0.6 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "../rom.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../parallel.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "video.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Application resource script for Windows.
|
||||
*
|
||||
* Version: @(#)VARCem.rc 1.0.21 2018/04/25
|
||||
* Version: @(#)VARCem.rc 1.0.21 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -510,26 +510,29 @@ DLG_CFG_PORTS DIALOG DISCARDABLE 97, 0, 267, 99
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
CONTROL "Parallel port 1",IDC_CHECK_PARALLEL1,"Button",
|
||||
CONTROL "Game port",IDC_CHECK_GAME,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,8,70,10
|
||||
COMBOBOX IDC_COMBO_PARALLEL1,80,7,159,120,CBS_DROPDOWNLIST |
|
||||
|
||||
CONTROL "Parallel port 1",IDC_CHECK_PARALLEL1,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,27,70,10
|
||||
COMBOBOX IDC_COMBO_PARALLEL1,80,26,159,120,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
|
||||
CONTROL "Parallel port 2",IDC_CHECK_PARALLEL2,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,27,70,10
|
||||
COMBOBOX IDC_COMBO_PARALLEL2,80,26,159,120,CBS_DROPDOWNLIST |
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,46,70,10
|
||||
COMBOBOX IDC_COMBO_PARALLEL2,80,45,159,120,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
|
||||
CONTROL "Parallel port 3",IDC_CHECK_PARALLEL3,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,46,70,10
|
||||
COMBOBOX IDC_COMBO_PARALLEL3,80,45,159,120,CBS_DROPDOWNLIST |
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,65,70,10
|
||||
COMBOBOX IDC_COMBO_PARALLEL3,80,64,159,120,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
|
||||
CONTROL "Serial port 1",IDC_CHECK_SERIAL1,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,69,94,10
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,88,94,10
|
||||
|
||||
CONTROL "Serial port 2",IDC_CHECK_SERIAL2,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,88,94,10
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,107,94,10
|
||||
END
|
||||
|
||||
DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 97
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Windows systems using the MinGW32 environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.31 2018/04/25
|
||||
# Version: @(#)Makefile.mingw 1.0.33 2018/04/26
|
||||
#
|
||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
@@ -202,7 +202,7 @@ endif
|
||||
# Nothing should need changing from here on.. #
|
||||
#########################################################################
|
||||
VPATH := $(EXPATH) . cpu \
|
||||
cdrom disk floppy floppy/lzf game sio machine \
|
||||
cdrom disk floppy floppy/lzf ports game sio machine \
|
||||
sound \
|
||||
sound/munt sound/munt/c_interface sound/munt/sha1 \
|
||||
sound/munt/srchelper \
|
||||
@@ -365,7 +365,7 @@ else
|
||||
win_ddraw.o win_d3d.o \
|
||||
win_dialog.o win_about.o win_status.o win_stbar.o \
|
||||
win_settings.o win_devconf.o win_snd_gain.o \
|
||||
win_new_floppy.o win_jsconf.o
|
||||
win_new_floppy.o
|
||||
endif
|
||||
|
||||
ifeq ($(OPENAL), y)
|
||||
@@ -517,16 +517,19 @@ MCHOBJ := machine.o machine_table.o \
|
||||
m_at_430lx_nx.o m_at_430fx.o \
|
||||
m_at_430hx.o m_at_430vx.o
|
||||
|
||||
DEVOBJ := bugger.o parallel.o parallel_dev.o $(SERIAL) \
|
||||
sio_fdc37c66x.o sio_fdc37c669.o sio_fdc37c93x.o \
|
||||
sio_pc87306.o sio_w83877f.o sio_um8669f.o \
|
||||
DEVOBJ := bugger.o \
|
||||
game.o game_dev.o \
|
||||
parallel.o parallel_dev.o \
|
||||
$(SERIAL) \
|
||||
sio_fdc37c66x.o sio_fdc37c669.o sio_fdc37c93x.o \
|
||||
sio_pc87306.o sio_w83877f.o sio_um8669f.o \
|
||||
keyboard.o \
|
||||
keyboard_xt.o keyboard_at.o \
|
||||
gameport.o \
|
||||
joystick_standard.o joystick_ch_flightstick_pro.o \
|
||||
joystick_sw_pad.o joystick_tm_fcs.o \
|
||||
mouse.o \
|
||||
mouse_serial.o mouse_ps2.o mouse_bus.o
|
||||
mouse_serial.o mouse_ps2.o mouse_bus.o \
|
||||
joystick.o \
|
||||
js_standard.o js_ch_fs_pro.o \
|
||||
js_sw_pad.o js_tm_fcs.o \
|
||||
|
||||
FDDOBJ := fdc.o \
|
||||
fdd.o \
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Windows using Visual Studio 2015.
|
||||
#
|
||||
# Version: @(#)Makefile.VC 1.0.18 2018/04/25
|
||||
# Version: @(#)Makefile.VC 1.0.20 2018/04/26
|
||||
#
|
||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
@@ -207,7 +207,7 @@ endif
|
||||
# Nothing should need changing from here on.. #
|
||||
#########################################################################
|
||||
VPATH := $(EXPATH) . cpu \
|
||||
cdrom disk floppy floppy/lzf game sio machine \
|
||||
cdrom disk floppy floppy/lzf ports game sio machine \
|
||||
sound \
|
||||
sound/munt sound/munt/c_interface sound/munt/sha1 \
|
||||
sound/munt/srchelper \
|
||||
@@ -333,7 +333,7 @@ else
|
||||
win_ddraw.obj win_d3d.obj \
|
||||
win_dialog.obj win_about.obj win_status.obj win_stbar.obj \
|
||||
win_settings.obj win_devconf.obj win_snd_gain.obj \
|
||||
win_new_floppy.obj win_jsconf.obj
|
||||
win_new_floppy.obj
|
||||
endif
|
||||
|
||||
ifeq ($(OPENAL), y)
|
||||
@@ -482,16 +482,19 @@ MCHOBJ := machine.obj machine_table.obj \
|
||||
m_at_430lx_nx.obj m_at_430fx.obj \
|
||||
m_at_430hx.obj m_at_430vx.obj
|
||||
|
||||
DEVOBJ := bugger.obj parallel.obj parallel_dev.obj $(SERIAL) \
|
||||
sio_fdc37c66x.obj sio_fdc37c669.obj sio_fdc37c93x.obj \
|
||||
sio_pc87306.obj sio_w83877f.obj sio_um8669f.obj \
|
||||
DEVOBJ := bugger.obj \
|
||||
game.obj game_dev.obj \
|
||||
parallel.obj parallel_dev.obj \
|
||||
$(SERIAL) \
|
||||
sio_fdc37c66x.obj sio_fdc37c669.obj sio_fdc37c93x.obj \
|
||||
sio_pc87306.obj sio_w83877f.obj sio_um8669f.obj \
|
||||
keyboard.obj \
|
||||
keyboard_xt.obj keyboard_at.obj \
|
||||
gameport.obj \
|
||||
joystick_standard.obj joystick_ch_flightstick_pro.obj \
|
||||
joystick_sw_pad.obj joystick_tm_fcs.obj \
|
||||
mouse.obj \
|
||||
mouse_serial.obj mouse_ps2.obj mouse_bus.obj
|
||||
joystick.obj \
|
||||
js_standard.obj js_ch_fs_pro.obj \
|
||||
js_sw_pad.obj js_tm_fcs.obj
|
||||
|
||||
FDDOBJ := fdc.obj \
|
||||
fdd.obj \
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows resource defines.
|
||||
*
|
||||
* Version: @(#)resource.h 1.0.11 2018/04/25
|
||||
* Version: @(#)resource.h 1.0.12 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -165,14 +165,15 @@
|
||||
#define IDC_COMBO_PCAP 1091
|
||||
#define IDC_COMBO_NET 1092
|
||||
|
||||
#define IDC_CHECK_PARALLEL1 1110 /* ports config */
|
||||
#define IDC_CHECK_PARALLEL2 1111
|
||||
#define IDC_CHECK_PARALLEL3 1112
|
||||
#define IDC_COMBO_PARALLEL1 1113
|
||||
#define IDC_COMBO_PARALLEL2 1114
|
||||
#define IDC_COMBO_PARALLEL3 1115
|
||||
#define IDC_CHECK_SERIAL1 1116
|
||||
#define IDC_CHECK_SERIAL2 1117
|
||||
#define IDC_CHECK_GAME 1110 /* ports config */
|
||||
#define IDC_CHECK_PARALLEL1 1111
|
||||
#define IDC_CHECK_PARALLEL2 1112
|
||||
#define IDC_CHECK_PARALLEL3 1113
|
||||
#define IDC_COMBO_PARALLEL1 1114
|
||||
#define IDC_COMBO_PARALLEL2 1115
|
||||
#define IDC_COMBO_PARALLEL3 1116
|
||||
#define IDC_CHECK_SERIAL1 1117
|
||||
#define IDC_CHECK_SERIAL2 1118
|
||||
|
||||
#define IDC_OTHER_PERIPH 1120 /* other periph config */
|
||||
#define IDC_COMBO_SCSI 1121
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,594 +0,0 @@
|
||||
/*
|
||||
* 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 Joystick Configuration dialog.
|
||||
*
|
||||
* Version: @(#)win_jsconf.c 1.0.3 2018/03/10
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* 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.
|
||||
*/
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../config.h"
|
||||
#include "../device.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../plat.h"
|
||||
#include "win.h"
|
||||
|
||||
|
||||
static int joystick_nr;
|
||||
static int joystick_config_type;
|
||||
#define AXIS_STRINGS_MAX 3
|
||||
static char *axis_strings[AXIS_STRINGS_MAX] = {"X Axis", "Y Axis", "Z Axis"};
|
||||
|
||||
static uint8_t joystickconfig_changed = 0;
|
||||
|
||||
|
||||
static void rebuild_axis_button_selections(HWND hdlg)
|
||||
{
|
||||
int id = IDC_CONFIG_BASE + 2;
|
||||
HWND h;
|
||||
int joystick;
|
||||
int c, d;
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIG_BASE);
|
||||
joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
for (c = 0; c < joystick_get_axis_count(joystick_config_type); c++)
|
||||
{
|
||||
int sel = c;
|
||||
|
||||
h = GetDlgItem(hdlg, id);
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
if (joystick)
|
||||
{
|
||||
for (d = 0; d < plat_joystick_state[joystick-1].nr_axes; d++)
|
||||
{
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)plat_joystick_state[joystick-1].axis[d].name);
|
||||
if (c < AXIS_STRINGS_MAX)
|
||||
{
|
||||
if (!stricmp(axis_strings[c], plat_joystick_state[joystick-1].axis[d].name))
|
||||
sel = d;
|
||||
}
|
||||
}
|
||||
for (d = 0; d < plat_joystick_state[joystick-1].nr_povs; d++)
|
||||
{
|
||||
char s[80];
|
||||
|
||||
sprintf(s, "%s (X axis)", plat_joystick_state[joystick-1].pov[d].name);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
|
||||
sprintf(s, "%s (Y axis)", plat_joystick_state[joystick-1].pov[d].name);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
|
||||
}
|
||||
SendMessage(h, CB_SETCURSEL, sel, 0);
|
||||
EnableWindow(h, TRUE);
|
||||
}
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
id += 2;
|
||||
}
|
||||
|
||||
for (c = 0; c < joystick_get_button_count(joystick_config_type); c++)
|
||||
{
|
||||
h = GetDlgItem(hdlg, id);
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
if (joystick)
|
||||
{
|
||||
for (d = 0; d < plat_joystick_state[joystick-1].nr_buttons; d++)
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)plat_joystick_state[joystick-1].button[d].name);
|
||||
SendMessage(h, CB_SETCURSEL, c, 0);
|
||||
EnableWindow(h, TRUE);
|
||||
}
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
id += 2;
|
||||
}
|
||||
|
||||
for (c = 0; c < joystick_get_pov_count(joystick_config_type)*2; c++)
|
||||
{
|
||||
int sel = c;
|
||||
|
||||
h = GetDlgItem(hdlg, id);
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
if (joystick)
|
||||
{
|
||||
for (d = 0; d < plat_joystick_state[joystick-1].nr_povs; d++)
|
||||
{
|
||||
char s[80];
|
||||
|
||||
sprintf(s, "%s (X axis)", plat_joystick_state[joystick-1].pov[d].name);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
|
||||
sprintf(s, "%s (Y axis)", plat_joystick_state[joystick-1].pov[d].name);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
|
||||
}
|
||||
for (d = 0; d < plat_joystick_state[joystick-1].nr_axes; d++)
|
||||
{
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)plat_joystick_state[joystick-1].axis[d].name);
|
||||
}
|
||||
SendMessage(h, CB_SETCURSEL, sel, 0);
|
||||
EnableWindow(h, TRUE);
|
||||
}
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
id += 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int get_axis(HWND hdlg, int id)
|
||||
{
|
||||
HWND h = GetDlgItem(hdlg, id);
|
||||
int axis_sel = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
int nr_axes = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr-1].nr_axes;
|
||||
|
||||
if (axis_sel < nr_axes)
|
||||
return axis_sel;
|
||||
|
||||
axis_sel -= nr_axes;
|
||||
if (axis_sel & 1)
|
||||
return POV_Y | (axis_sel >> 1);
|
||||
else
|
||||
return POV_X | (axis_sel >> 1);
|
||||
}
|
||||
|
||||
static int get_pov(HWND hdlg, int id)
|
||||
{
|
||||
HWND h = GetDlgItem(hdlg, id);
|
||||
int axis_sel = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr-1].nr_povs*2;
|
||||
|
||||
if (axis_sel < nr_povs)
|
||||
{
|
||||
if (axis_sel & 1)
|
||||
return POV_Y | (axis_sel >> 1);
|
||||
else
|
||||
return POV_X | (axis_sel >> 1);
|
||||
}
|
||||
|
||||
return axis_sel - nr_povs;
|
||||
}
|
||||
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int c;
|
||||
int id;
|
||||
int joystick;
|
||||
int nr_axes;
|
||||
int nr_povs;
|
||||
int mapping;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
h = GetDlgItem(hdlg, IDC_CONFIG_BASE);
|
||||
id = IDC_CONFIG_BASE + 2;
|
||||
joystick = joystick_state[joystick_nr].plat_joystick_nr;
|
||||
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None");
|
||||
|
||||
for (c = 0; c < joysticks_present; c++)
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)plat_joystick_state[c].name);
|
||||
|
||||
SendMessage(h, CB_SETCURSEL, joystick, 0);
|
||||
|
||||
rebuild_axis_button_selections(hdlg);
|
||||
|
||||
if (joystick_state[joystick_nr].plat_joystick_nr)
|
||||
{
|
||||
nr_axes = plat_joystick_state[joystick-1].nr_axes;
|
||||
nr_povs = plat_joystick_state[joystick-1].nr_povs;
|
||||
for (c = 0; c < joystick_get_axis_count(joystick_config_type); c++)
|
||||
{
|
||||
int mapping = joystick_state[joystick_nr].axis_mapping[c];
|
||||
|
||||
h = GetDlgItem(hdlg, id);
|
||||
if (mapping & POV_X)
|
||||
SendMessage(h, CB_SETCURSEL, nr_axes + (mapping & 3)*2, 0);
|
||||
else if (mapping & POV_Y)
|
||||
SendMessage(h, CB_SETCURSEL, nr_axes + (mapping & 3)*2 + 1, 0);
|
||||
else
|
||||
SendMessage(h, CB_SETCURSEL, mapping, 0);
|
||||
id += 2;
|
||||
}
|
||||
for (c = 0; c < joystick_get_button_count(joystick_config_type); c++)
|
||||
{
|
||||
h = GetDlgItem(hdlg, id);
|
||||
SendMessage(h, CB_SETCURSEL, joystick_state[joystick_nr].button_mapping[c], 0);
|
||||
id += 2;
|
||||
}
|
||||
for (c = 0; c < joystick_get_pov_count(joystick_config_type); c++)
|
||||
{
|
||||
h = GetDlgItem(hdlg, id);
|
||||
mapping = joystick_state[joystick_nr].pov_mapping[c][0];
|
||||
if (mapping & POV_X)
|
||||
SendMessage(h, CB_SETCURSEL, (mapping & 3)*2, 0);
|
||||
else if (mapping & POV_Y)
|
||||
SendMessage(h, CB_SETCURSEL, (mapping & 3)*2 + 1, 0);
|
||||
else
|
||||
SendMessage(h, CB_SETCURSEL, mapping + nr_povs*2, 0);
|
||||
id += 2;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
mapping = joystick_state[joystick_nr].pov_mapping[c][1];
|
||||
if (mapping & POV_X)
|
||||
SendMessage(h, CB_SETCURSEL, (mapping & 3)*2, 0);
|
||||
else if (mapping & POV_Y)
|
||||
SendMessage(h, CB_SETCURSEL, (mapping & 3)*2 + 1, 0);
|
||||
else
|
||||
SendMessage(h, CB_SETCURSEL, mapping + nr_povs*2, 0);
|
||||
id += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_CONFIG_BASE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
rebuild_axis_button_selections(hdlg);
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
{
|
||||
id = IDC_CONFIG_BASE + 2;
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIG_BASE);
|
||||
joystick_state[joystick_nr].plat_joystick_nr = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
if (joystick_state[joystick_nr].plat_joystick_nr)
|
||||
{
|
||||
for (c = 0; c < joystick_get_axis_count(joystick_config_type); c++)
|
||||
{
|
||||
joystick_state[joystick_nr].axis_mapping[c] = get_axis(hdlg, id);
|
||||
id += 2;
|
||||
}
|
||||
for (c = 0; c < joystick_get_button_count(joystick_config_type); c++)
|
||||
{
|
||||
h = GetDlgItem(hdlg, id);
|
||||
joystick_state[joystick_nr].button_mapping[c] = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
id += 2;
|
||||
}
|
||||
for (c = 0; c < joystick_get_button_count(joystick_config_type); c++)
|
||||
{
|
||||
h = GetDlgItem(hdlg, id);
|
||||
joystick_state[joystick_nr].pov_mapping[c][0] = get_pov(hdlg, id);
|
||||
id += 2;
|
||||
h = GetDlgItem(hdlg, id);
|
||||
joystick_state[joystick_nr].pov_mapping[c][1] = get_pov(hdlg, id);
|
||||
id += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
joystickconfig_changed = 1;
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
case IDCANCEL:
|
||||
joystickconfig_changed = 0;
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
{
|
||||
uint16_t *data_block = malloc(16384);
|
||||
uint16_t *data;
|
||||
DLGTEMPLATE *dlg = (DLGTEMPLATE *)data_block;
|
||||
DLGITEMTEMPLATE *item;
|
||||
int y = 10;
|
||||
int id = IDC_CONFIG_BASE;
|
||||
int c;
|
||||
|
||||
joystickconfig_changed = 0;
|
||||
|
||||
joystick_nr = joy_nr;
|
||||
joystick_config_type = type;
|
||||
|
||||
memset(data_block, 0, 4096);
|
||||
|
||||
dlg->style = DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU;
|
||||
dlg->x = 10;
|
||||
dlg->y = 10;
|
||||
dlg->cx = 220;
|
||||
dlg->cy = 70;
|
||||
|
||||
data = (uint16_t *)(dlg + 1);
|
||||
|
||||
*data++ = 0; /*no menu*/
|
||||
*data++ = 0; /*predefined dialog box class*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Device Configuration", -1, data, 50);
|
||||
|
||||
*data++ = 8; /*Point*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "MS Sans Serif", -1, data, 50);
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
|
||||
/*Combo box*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 70;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 140;
|
||||
item->cy = 150;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0085; /* combo box class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Device", -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 10;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 60;
|
||||
item->cy = 15;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0082; /* static class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Device :", -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
|
||||
|
||||
for (c = 0; c < joystick_get_axis_count(type); c++)
|
||||
{
|
||||
/*Combo box*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 70;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 140;
|
||||
item->cy = 150;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0085; /* combo box class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 10;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 60;
|
||||
item->cy = 15;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0082; /* static class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
}
|
||||
|
||||
for (c = 0; c < joystick_get_button_count(type); c++)
|
||||
{
|
||||
/*Combo box*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 70;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 140;
|
||||
item->cy = 150;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0085; /* combo box class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 10;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 60;
|
||||
item->cy = 15;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0082; /* static class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
}
|
||||
|
||||
for (c = 0; c < joystick_get_pov_count(type)*2; c++)
|
||||
{
|
||||
char s[80];
|
||||
|
||||
/*Combo box*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 70;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 140;
|
||||
item->cy = 150;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0085; /* combo box class */
|
||||
|
||||
if (c & 1)
|
||||
sprintf(s, "%s (Y axis)", joystick_get_pov_name(type, c/2));
|
||||
else
|
||||
sprintf(s, "%s (X axis)", joystick_get_pov_name(type, c/2));
|
||||
data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 10;
|
||||
item->y = y;
|
||||
item->id = id++;
|
||||
|
||||
item->cx = 60;
|
||||
item->cy = 15;
|
||||
|
||||
item->style = WS_CHILD | WS_VISIBLE;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0082; /* static class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
}
|
||||
|
||||
dlg->cdit = (id - IDC_CONFIG_BASE) + 2;
|
||||
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 20;
|
||||
item->y = y;
|
||||
item->cx = 50;
|
||||
item->cy = 14;
|
||||
item->id = IDOK; /* OK button identifier */
|
||||
item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
item->x = 80;
|
||||
item->y = y;
|
||||
item->cx = 50;
|
||||
item->cy = 14;
|
||||
item->id = IDCANCEL; /* OK button identifier */
|
||||
item->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;
|
||||
|
||||
data = (uint16_t *)(item + 1);
|
||||
*data++ = 0xFFFF;
|
||||
*data++ = 0x0080; /* button class */
|
||||
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Cancel", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
dlg->cy = y + 20;
|
||||
|
||||
DialogBoxIndirect(hinstance, dlg, hwnd, joystickconfig_dlgproc);
|
||||
|
||||
free(data_block);
|
||||
|
||||
return joystickconfig_changed;
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Settings dialog.
|
||||
*
|
||||
* Version: @(#)win_settings.c 1.0.22 2018/04/14
|
||||
* Version: @(#)win_settings.c 1.0.23 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -52,11 +52,12 @@
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../game/gameport.h"
|
||||
#include "../mouse.h"
|
||||
#include "../parallel.h"
|
||||
#include "../parallel_dev.h"
|
||||
#include "../serial.h"
|
||||
#include "../ports/game_dev.h"
|
||||
#include "../ports/parallel.h"
|
||||
#include "../ports/parallel_dev.h"
|
||||
#include "../ports/serial.h"
|
||||
#include "../game/joystick.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
@@ -101,7 +102,8 @@ static int temp_net_type, temp_net_card;
|
||||
static char temp_host_dev[128];
|
||||
|
||||
/* Ports category. */
|
||||
static int temp_serial[SERIAL_MAX],
|
||||
static int temp_game,
|
||||
temp_serial[SERIAL_MAX],
|
||||
temp_parallel[PARALLEL_MAX],
|
||||
temp_parallel_device[PARALLEL_MAX];
|
||||
|
||||
@@ -204,6 +206,7 @@ settings_init(void)
|
||||
temp_net_card = network_card;
|
||||
|
||||
/* Ports category */
|
||||
temp_game = game_enabled;
|
||||
for (i = 0; i < SERIAL_MAX; i++)
|
||||
temp_serial[i] = serial_enabled[i];
|
||||
for (i = 0; i < PARALLEL_MAX; i++) {
|
||||
@@ -278,6 +281,7 @@ settings_changed(void)
|
||||
i = i || (network_card != temp_net_card);
|
||||
|
||||
/* Ports category */
|
||||
i = i || (temp_game != game_enabled);
|
||||
for (j = 0; j < SERIAL_MAX; j++)
|
||||
i = i || (temp_serial[j] != serial_enabled[j]);
|
||||
for (j = 0; j < PARALLEL_MAX; j++) {
|
||||
@@ -380,6 +384,7 @@ settings_save(void)
|
||||
network_card = temp_net_card;
|
||||
|
||||
/* Ports category */
|
||||
game_enabled = temp_game;
|
||||
for (i = 0; i < SERIAL_MAX; i++)
|
||||
serial_enabled[i] = temp_serial[i];
|
||||
for (i = 0; i < PARALLEL_MAX; i++) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Settings dialog.
|
||||
*
|
||||
* Version: @(#)win_settings_input.h 1.0.4 2018/04/14
|
||||
* Version: @(#)win_settings_input.h 1.0.5 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -100,22 +100,22 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
|
||||
c = 0;
|
||||
while ((stransi = joystick_get_name(c)) != NULL) {
|
||||
while ((stransi = gamedev_get_name(c)) != NULL) {
|
||||
mbstowcs(temp, stransi, sizeof_w(temp));
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
|
||||
c++;
|
||||
}
|
||||
EnableWindow(h, TRUE);
|
||||
SendMessage(h, CB_SETCURSEL, temp_joystick, 0);
|
||||
EnableWindow(h, (temp_game)?TRUE:FALSE);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_JOY1);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE);
|
||||
EnableWindow(h, (temp_game && (gamedev_get_max_joysticks(temp_joystick) >= 1)) ? TRUE : FALSE);
|
||||
h = GetDlgItem(hdlg, IDC_JOY2);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE);
|
||||
EnableWindow(h, (temp_game && (gamedev_get_max_joysticks(temp_joystick) >= 2)) ? TRUE : FALSE);
|
||||
h = GetDlgItem(hdlg, IDC_JOY3);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE);
|
||||
EnableWindow(h, (temp_game && (gamedev_get_max_joysticks(temp_joystick) >= 3)) ? TRUE : FALSE);
|
||||
h = GetDlgItem(hdlg, IDC_JOY4);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE);
|
||||
EnableWindow(h, (temp_game && (gamedev_get_max_joysticks(temp_joystick) >= 4)) ? TRUE : FALSE);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -143,13 +143,13 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_JOY1);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE);
|
||||
EnableWindow(h, (gamedev_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE);
|
||||
h = GetDlgItem(hdlg, IDC_JOY2);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE);
|
||||
EnableWindow(h, (gamedev_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE);
|
||||
h = GetDlgItem(hdlg, IDC_JOY3);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE);
|
||||
EnableWindow(h, (gamedev_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE);
|
||||
h = GetDlgItem(hdlg, IDC_JOY4);
|
||||
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE);
|
||||
EnableWindow(h, (gamedev_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE);
|
||||
break;
|
||||
|
||||
case IDC_JOY1:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Settings dialog.
|
||||
*
|
||||
* Version: @(#)win_settings_ports.h 1.0.2 2018/04/07
|
||||
* Version: @(#)win_settings_ports.h 1.0.3 2018/04/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -56,6 +56,11 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
/* Set up the game port controls. */
|
||||
h = GetDlgItem(hdlg, IDC_CHECK_GAME);
|
||||
SendMessage(h, BM_SETCHECK, temp_game, 0);
|
||||
|
||||
/* Set up the parallel port controls. */
|
||||
for (i = 0; i < PARALLEL_MAX; i++) {
|
||||
/* Populate the "devices" list and select one. */
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_PARALLEL1+i);
|
||||
@@ -87,7 +92,6 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1+i);
|
||||
SendMessage(h, BM_SETCHECK, temp_serial[i], 0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
@@ -102,10 +106,12 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
EnableWindow(h, d ? TRUE : FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
case WM_SAVESETTINGS:
|
||||
h = GetDlgItem(hdlg, IDC_CHECK_GAME);
|
||||
temp_game = SendMessage(h, BM_GETCHECK, 0, 0);
|
||||
|
||||
for (i = 0; i < PARALLEL_MAX; i++) {
|
||||
h = GetDlgItem(hdlg, IDC_CHECK_PARALLEL1+i);
|
||||
temp_parallel[i] = SendMessage(h, BM_GETCHECK, 0, 0);
|
||||
@@ -119,7 +125,6 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1+i);
|
||||
temp_serial[i] = SendMessage(h, BM_GETCHECK, 0, 0);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user