Update the LPT ports to 3 ports, cleaned up the ports code.

Re-worked the "win_settings" code module, updated Ports dialog.
Re-worked the "hdc.c" code, no more hdc_name. Needed later.
This commit is contained in:
waltje
2018-04-07 00:23:55 -04:00
parent 971a1f8c9b
commit 054622a75b
60 changed files with 6038 additions and 6195 deletions

View File

@@ -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.9 2018/03/31
* Version: @(#)config.c 1.0.10 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -53,7 +53,8 @@
#include "machine/machine.h"
#include "nvr.h"
#include "device.h"
#include "lpt.h"
#include "serial.h"
#include "parallel.h"
#include "mouse.h"
#include "game/gameport.h"
#include "floppy/fdd.h"
@@ -700,30 +701,25 @@ load_network(void)
static void
load_ports(void)
{
char temp[128];
char *cat = "Ports (COM & LPT)";
char *p;
int i;
serial_enabled[0] = !!config_get_int(cat, "serial1_enabled", 0);
serial_enabled[1] = !!config_get_int(cat, "serial2_enabled", 0);
lpt_enabled = !!config_get_int(cat, "lpt_enabled", 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);
p = (char *)config_get_string(cat, "lpt1_device", NULL);
if (p != NULL)
strcpy(lpt_device_names[0], p);
else
strcpy(lpt_device_names[0], "none");
p = (char *)config_get_string(cat, "lpt2_device", NULL);
if (p != NULL)
strcpy(lpt_device_names[1], p);
else
strcpy(lpt_device_names[1], "none");
p = (char *)config_get_string(cat, "lpt3_device", NULL);
if (p != NULL)
strcpy(lpt_device_names[2], p);
else
strcpy(lpt_device_names[2], "none");
sprintf(temp, "parallel%i_device", i);
p = (char *)config_get_string(cat, temp, NULL);
if (p == NULL)
p = "none";
strcpy(parallel_device[i], p);
}
}
@@ -749,24 +745,14 @@ load_other_peripherals(void)
else
scsi_card_current = 0;
if (hdc_name) {
free(hdc_name);
hdc_name = NULL;
}
p = config_get_string(cat, "hdc", NULL);
if (p == NULL) {
if (machines[machine].flags & MACHINE_HDC) {
hdc_name = (char *) malloc((strlen("internal") + 1) * sizeof(char));
strcpy(hdc_name, "internal");
} else {
hdc_name = (char *) malloc((strlen("none") + 1) * sizeof(char));
strcpy(hdc_name, "none");
if (machines[machine].flags & MACHINE_HDC)
p = "internal";
else
p = "none";
}
} else {
hdc_name = (char *) malloc((strlen(p) + 1) * sizeof(char));
strcpy(hdc_name, p);
}
config_set_string(cat, "hdc", hdc_name);
hdc_type = hdc_get_from_internal_name(p);
memset(temp, '\0', sizeof(temp));
for (c=2; c<4; c++) {
@@ -1345,8 +1331,9 @@ load_other_removable_devices(void)
void
config_load(void)
{
pclog("Loading config file '%ls'..\n", cfg_path);
int i;
pclog("CONFIG: loading file '%ls'..\n", cfg_path);
if (! config_read(cfg_path)) {
cpu = 0;
#ifdef USE_LANGUAGE
@@ -1357,20 +1344,18 @@ config_load(void)
vid_api = plat_vidapi("default");;
enable_sync = 1;
joystick_type = 0;
if (hdc_name) {
free(hdc_name);
hdc_name = NULL;
}
hdc_name = (char *) malloc((strlen("none")+1) * sizeof(char));
strcpy(hdc_name, "none");
serial_enabled[0] = 0;
serial_enabled[1] = 0;
lpt_enabled = 0;
hdc_type = 0;
for (i = 0; i < SERIAL_MAX; i++)
serial_enabled[i] = 0;
for (i = 0; i < PARALLEL_MAX; i++)
parallel_enabled[i] = 0;
fdd_set_type(0, 2);
fdd_set_check_bpb(0, 1);
fdd_set_type(1, 2);
fdd_set_check_bpb(1, 1);
mem_size = 640;
pclog("Config file not present or invalid!\n");
pclog("CONFIG: file not present or invalid, using defaults!\n");
return;
}
@@ -1390,7 +1375,7 @@ config_load(void)
/* Mark the configuration as changed. */
config_changed = 1;
pclog("Config loaded.\n\n");
pclog("CONFIG: file loaded.\n\n");
}
@@ -1701,37 +1686,31 @@ save_network(void)
static void
save_ports(void)
{
char temp[128];
char *cat = "Ports (COM & LPT)";
int i;
if (serial_enabled[0])
config_set_int(cat, "serial1_enabled", serial_enabled[0]);
else
config_delete_var(cat, "serial1_enabled");
for (i = 0; i < SERIAL_MAX; i++) {
if (serial_enabled[i]) {
sprintf(temp, "serial%i_enabled", i);
config_set_int(cat, temp, 1);
} else
config_delete_var(cat, temp);
}
if (serial_enabled[1])
config_set_int(cat, "serial2_enabled", serial_enabled[1]);
else
config_delete_var(cat, "serial2_enabled");
for (i = 0; i < PARALLEL_MAX; i++) {
if (parallel_enabled[i]) {
sprintf(temp, "parallel%i_enabled", i);
config_set_int(cat, temp, 1);
} else
config_delete_var(cat, temp);
if (lpt_enabled)
config_set_int(cat, "lpt_enabled", lpt_enabled);
sprintf(temp, "parallel%i_device", i);
if (strcmp(parallel_device[i], "none"))
config_set_string(cat, temp, parallel_device[i]);
else
config_delete_var(cat, "lpt_enabled");
if (strcmp(lpt_device_names[0], "none"))
config_set_string(cat, "lpt1_device", lpt_device_names[0]);
else
config_delete_var(cat, "lpt1_device");
if (strcmp(lpt_device_names[1], "none"))
config_set_string(cat, "lpt2_device", lpt_device_names[1]);
else
config_delete_var(cat, "lpt2_device");
if (strcmp(lpt_device_names[2], "none"))
config_set_string(cat, "lpt3_device", lpt_device_names[2]);
else
config_delete_var(cat, "lpt3_device");
config_delete_var(cat, temp);
}
delete_section_if_empty(cat);
}
@@ -1751,7 +1730,7 @@ save_other_peripherals(void)
config_set_string(cat, "scsi_card",
scsi_card_get_internal_name(scsi_card_current));
config_set_string(cat, "hdc", hdc_name);
config_set_string(cat, "hdc", hdc_get_internal_name(hdc_type));
memset(temp, '\0', sizeof(temp));
for (c=2; c<4; c++) {

View File

@@ -8,7 +8,7 @@
*
* Common code to handle all sorts of disk controllers.
*
* Version: @(#)hdc.c 1.0.4 2018/04/02
* Version: @(#)hdc.c 1.0.5 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -46,8 +46,6 @@
#include "hdc_ide.h"
char *hdc_name; /* configured HDC name */
int hdc_current;
#ifdef ENABLE_HDC_LOG
int hdc_do_log = ENABLE_HDC_LOG;
#endif
@@ -99,7 +97,7 @@ static const struct {
const device_t *device;
int is_mfm;
} controllers[] = {
{ "None", "none",
{ "Disabled", "none",
&null_device, 0 },
{ "Internal Controller", "internal",
@@ -150,7 +148,7 @@ static const struct {
{ "[VLB] [IDE] PC/AT IDE Adapter (Dual-Channel)", "vlb_isa_2ch",
&ide_vlb_2ch_device, 0 },
{ "", "", NULL, 0 }
{ NULL, NULL, NULL, 0 }
};
@@ -169,37 +167,18 @@ hdc_log(const char *fmt, ...)
}
/* Initialize the 'hdc_current' value based on configured HDC name. */
void
hdc_init(char *name)
{
int c;
#ifdef ENABLE_HDC_LOG
hdc_log("HDC: initializing..\n");
#endif
for (c=0; controllers[c].device; c++) {
if (! strcmp(name, (char *)controllers[c].internal_name)) {
hdc_current = c;
break;
}
}
}
/* Reset the HDC, whichever one that is. */
void
hdc_reset(void)
{
#ifdef ENABLE_HDC_LOG
hdc_log("HDC: reset(current=%d, internal=%d)\n",
hdc_current, (machines[machine].flags & MACHINE_HDC)?1:0);
hdc_type, (machines[machine].flags & MACHINE_HDC)?1:0);
#endif
/* If we have a valid controller, add its device. */
if (hdc_current > 1)
device_add(controllers[hdc_current].device);
if (hdc_type > 1)
device_add(controllers[hdc_type].device);
/* Reconfire and reset the IDE layer. */
ide_ter_disable();
@@ -245,3 +224,18 @@ hdc_available(int hdc)
{
return(device_available(controllers[hdc].device));
}
int
hdc_get_from_internal_name(char *s)
{
int c = 0;
while (controllers[c].internal_name != NULL) {
if (! strcmp((char *)controllers[c].internal_name, s))
return(c);
c++;
}
return(-1);
}

View File

@@ -8,7 +8,7 @@
*
* Definitions for the common disk controller handler.
*
* Version: @(#)hdc.h 1.0.3 2018/04/02
* Version: @(#)hdc.h 1.0.4 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -46,10 +46,6 @@
* least 7 devices, with each device being
* able to support 8 units, but hey... */
extern char *hdc_name;
extern int hdc_current;
extern int hdc_do_log;
#ifdef EMU_DEVICE_H
extern const device_t mfm_xt_xebec_device; /* mfm_xt_xebec */
extern const device_t mfm_xt_dtc5150x_device; /* mfm_xt_dtc */
@@ -82,6 +78,7 @@ extern char *hdc_get_internal_name(int hdc);
extern const device_t *hdc_get_device(int hdc);
extern int hdc_get_flags(int hdc);
extern int hdc_available(int hdc);
extern int hdc_get_from_internal_name(char *s);
#endif /*EMU_HDC_H*/

View File

@@ -8,7 +8,7 @@
*
* Main include file for the application.
*
* Version: @(#)emu.h 1.0.13 2018/04/02
* Version: @(#)emu.h 1.0.14 2018/04/05
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -49,8 +49,6 @@
/* Configuration values. */
#define SERIAL_MAX 2
#define PARALLEL_MAX 1
#define SCREEN_RES_X 640
#define SCREEN_RES_Y 480
@@ -107,13 +105,15 @@ extern int vid_cga_contrast, /* (C) video */
vid_card, /* (C) graphics/video card */
video_speed; /* (C) video */
extern int serial_enabled[], /* (C) enable serial ports */
lpt_enabled, /* (C) enable LPT ports */
parallel_enabled[], /* (C) enable LPT ports */
bugger_enabled; /* (C) enable ISAbugger */
extern char parallel_device[3][16]; /* (C) set up LPT devices */
extern int rctrl_is_lalt; /* (C) set R-CTRL as L-ALT */
extern int update_icons; /* (C) enable icons updates */
#ifdef WALTJE
extern int romdos_enabled; /* (C) enable ROM DOS */
#endif
extern int hdc_type; /* (C) HDC type */
extern int sound_is_float, /* (C) sound uses FP values */
GAMEBLASTER, /* (C) sound option */
GUS, /* (C) sound option */

View File

@@ -8,7 +8,7 @@
*
* Implementation of a generic Game Port.
*
* Version: @(#)gameport.c 1.0.6 2018/03/28
* Version: @(#)gameport.c 1.0.7 2018/04/05
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
@@ -69,7 +69,7 @@ typedef struct _gameport_ {
static const joystick_if_t joystick_none = {
"No joystick",
"Disabled",
NULL,
NULL,
NULL,

View File

@@ -10,7 +10,7 @@
*
* NOTE: FIXME: Strings 2176 and 2193 are same.
*
* Version: @(#)language.h 1.0.5 2018/03/28
* Version: @(#)language.h 1.0.6 2018/04/05
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -147,14 +147,7 @@
#define IDS_2141 2141 // "Invalid PCap device"
#define IDS_2142 2142 // "&Notify disk change"
#define IDS_2143 2143 // "Type"
#define IDS_2144 2144 // "Disabled"
#define IDS_2145 2145 // "Standard 2-button joystick(s)"
#define IDS_2146 2146 // "Standard 4-button joystick"
#define IDS_2147 2147 // "Standard 6-button joystick"
#define IDS_2148 2148 // "Standard 8-button joystick"
#define IDS_2149 2149 // "CH Flightstick Pro"
#define IDS_2150 2150 // "Microsoft SideWinder Pad"
#define IDS_2151 2151 // "Thrustmaster Flight Cont.."
/* IDS_2144-51 available */
#define IDS_2152 2152 // "None"
#define IDS_2153 2153 // "Unable to load Accelerators"
#define IDS_2154 2154 // "Unable to register Raw Input"

300
src/lpt.c
View File

@@ -1,300 +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 LPT style parallel ports.
*
* Version: @(#)lpt.c 1.0.3 2018/03/28
*
* 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.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "emu.h"
#include "io.h"
#include "lpt.h"
#include "sound/snd_lpt_dac.h"
#include "sound/snd_lpt_dss.h"
char lpt_device_names[3][16];
static const struct {
const char *name;
const char *internal_name;
const lpt_device_t *device;
} lpt_devices[] = {
{ "None", "none", NULL },
{ "Disney Sound Source", "dss", &dss_device },
{ "LPT DAC / Covox Speech Thing", "lpt_dac", &lpt_dac_device },
{ "Stereo LPT DAC", "lpt_dac_stereo", &lpt_dac_stereo_device },
{ "", "", NULL }
};
static const lpt_device_t *lpt_device_ts[3];
static void *lpt_device_ps[3];
static uint8_t lpt_dats[3], lpt_ctrls[3];
static uint16_t lpt_addr[3] = {
0x0378, 0x0278, 0x03bc
};
static void
lpt_write(int i, uint16_t port, uint8_t val, void *priv)
{
switch (port & 3) {
case 0:
if (lpt_device_ts[i])
lpt_device_ts[i]->write_data(val, lpt_device_ps[i]);
lpt_dats[i] = val;
break;
case 2:
if (lpt_device_ts[i])
lpt_device_ts[i]->write_ctrl(val, lpt_device_ps[i]);
lpt_ctrls[i] = val;
break;
}
}
static uint8_t
lpt_read(int i, uint16_t port, void *priv)
{
uint8_t ret = 0xff;
switch (port & 3) {
case 0:
ret = lpt_dats[i];
break;
case 1:
if (lpt_device_ts[i])
ret = lpt_device_ts[i]->read_status(lpt_device_ps[i]);
else ret = 0x00;
break;
case 2:
ret = lpt_ctrls[i];
break;
}
return(ret);
}
static void
lpt1_write(uint16_t port, uint8_t val, void *priv)
{
lpt_write(0, port, val, priv);
}
static uint8_t
lpt1_read(uint16_t port, void *priv)
{
return(lpt_read(0, port, priv));
}
static void
lpt2_write(uint16_t port, uint8_t val, void *priv)
{
lpt_write(1, port, val, priv);
}
static uint8_t
lpt2_read(uint16_t port, void *priv)
{
return(lpt_read(1, port, priv));
}
static void
lpt3_write(uint16_t port, uint8_t val, void *priv)
{
lpt_write(2, port, val, priv);
}
static uint8_t
lpt3_read(uint16_t port, void *priv)
{
return(lpt_read(2, port, priv));
}
void
lpt_init(void)
{
if (lpt_enabled) {
lpt_addr[0] = 0x378;
io_sethandler(lpt_addr[0], 3,
lpt1_read,NULL,NULL, lpt1_write,NULL,NULL, NULL);
lpt_addr[1] = 0x278;
io_sethandler(lpt_addr[1], 3,
lpt2_read,NULL,NULL, lpt2_write,NULL,NULL, NULL);
}
}
void
lpt_devices_close(void)
{
int i;
for (i = 0; i < 3; i++) {
if (lpt_device_ts[i])
lpt_device_ts[i]->close(lpt_device_ps[i]);
lpt_device_ts[i] = NULL;
}
}
void
lpt1_init(uint16_t port)
{
if (lpt_enabled) {
lpt_addr[0] = port;
io_sethandler(lpt_addr[0], 3,
lpt1_read,NULL,NULL, lpt1_write,NULL,NULL, NULL);
}
}
void
lpt1_remove(void)
{
if (lpt_enabled) {
io_removehandler(lpt_addr[0], 3,
lpt1_read,NULL,NULL, lpt1_write,NULL,NULL, NULL);
}
}
void
lpt2_init(uint16_t port)
{
if (lpt_enabled) {
lpt_addr[1] = port;
io_sethandler(lpt_addr[1], 3,
lpt2_read,NULL,NULL, lpt2_write,NULL,NULL, NULL);
}
}
void
lpt2_remove(void)
{
if (lpt_enabled) {
io_removehandler(lpt_addr[1], 3,
lpt2_read,NULL,NULL, lpt2_write,NULL,NULL, NULL);
}
}
void
lpt2_remove_ams(void)
{
if (lpt_enabled) {
io_removehandler(0x0379, 2,
lpt2_read,NULL,NULL, lpt2_write,NULL,NULL, NULL);
}
}
void
lpt3_init(uint16_t port)
{
if (lpt_enabled) {
lpt_addr[2] = port;
io_sethandler(lpt_addr[2], 3,
lpt3_read,NULL,NULL, lpt3_write,NULL,NULL, NULL);
}
}
void
lpt3_remove(void)
{
if (lpt_enabled) {
io_removehandler(lpt_addr[2], 3,
lpt3_read,NULL,NULL, lpt3_write,NULL,NULL, NULL);
}
}
void
lpt_devices_init(void)
{
int c, i;
for (i = 0; i < 3; i++) {
c = 0;
while ((char *)strcmp(lpt_devices[c].internal_name, lpt_device_names[i]) && strlen((char *)lpt_devices[c].internal_name) != 0)
c++;
if (strlen((char *)lpt_devices[c].internal_name) == 0)
lpt_device_ts[i] = NULL;
else {
lpt_device_ts[i] = lpt_devices[c].device;
if (lpt_device_ts[i])
lpt_device_ps[i] = lpt_device_ts[i]->init(lpt_devices[c].device);
}
}
}
const char *
lpt_device_get_name(int id)
{
if (strlen((char *)lpt_devices[id].name) == 0)
return(NULL);
return((char *)lpt_devices[id].name);
}
char *
lpt_device_get_internal_name(int id)
{
if (strlen((char *)lpt_devices[id].internal_name) == 0)
return(NULL);
return((char *)lpt_devices[id].internal_name);
}

View File

@@ -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.8 2018/03/27
* Version: @(#)m_amstrad.c 1.0.9 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -80,7 +80,7 @@
#include "../keyboard.h"
#include "../mouse.h"
#include "../game/gameport.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
#include "../sound/sound.h"
@@ -1230,13 +1230,7 @@ machine_amstrad_init(const machine_t *model, void *arg)
nmi_init();
device_add(&amstrad_nvr_device);
lpt2_remove_ams();
io_sethandler(0x0379, 2,
ams_read, NULL, NULL, NULL, NULL, NULL, ams);
io_sethandler(0xdead, 1,
parallel_remove_amstrad();
io_sethandler(0x0078, 1,
@@ -1244,6 +1238,12 @@ machine_amstrad_init(const machine_t *model, void *arg)
io_sethandler(0x007a, 1,
ms_read, NULL, NULL, ms_write, NULL, NULL, ams);
io_sethandler(0x0379, 2,
ams_read, NULL, NULL, NULL, NULL, NULL, ams);
io_sethandler(0xdead, 1,
ams_read, NULL, NULL, ams_write, NULL, NULL, ams);
switch(model->id) {
case ROM_PC1512:

View File

@@ -8,7 +8,7 @@
*
* Standard PC/AT implementation.
*
* Version: @(#)m_at.c 1.0.4 2018/03/21
* Version: @(#)m_at.c 1.0.5 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -47,7 +47,6 @@
#include "../mem.h"
#include "../device.h"
#include "../nvr.h"
#include "../lpt.h"
#include "../keyboard.h"
#include "../game/gameport.h"
#include "../floppy/fdd.h"
@@ -65,9 +64,6 @@ machine_at_common_init(const machine_t *model, void *arg)
pic2_init();
dma16_init();
if (lpt_enabled)
lpt2_remove();
device_add(&at_nvr_device);
if (joystick_type != JOYSTICK_TYPE_NONE)

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Commodore PC3 system.
*
* Version: @(#)m_at_commodore.c 1.0.3 2018/03/21
* Version: @(#)m_at_commodore.c 1.0.4 2018/04/05
*
* 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 "../lpt.h"
#include "../serial.h"
#include "../parallel.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
#include "machine.h"
@@ -53,30 +53,30 @@
static void
pc3_write(uint16_t port, uint8_t val, void *priv)
{
lpt1_remove();
lpt2_remove();
parallel_remove(1);
parallel_remove(2);
switch (val & 3) {
case 1:
lpt1_init(0x3bc);
parallel_setup(1, 0x03bc);
break;
case 2:
lpt1_init(0x378);
parallel_setup(1, 0x0378);
break;
case 3:
lpt1_init(0x278);
parallel_setup(1, 0x0278);
break;
}
switch (val & 0xc) {
case 0x4:
serial_setup(1, 0x2f8, 3);
serial_setup(1, 0x02f8, 3);
break;
case 0x8:
serial_setup(1, 0x3f8, 4);
serial_setup(1, 0x03f8, 4);
break;
}
}

View File

@@ -8,7 +8,7 @@
*
* Emulation of various Compaq PC's.
*
* Version: @(#)m_at_compaq.c 1.0.4 2018/03/21
* Version: @(#)m_at_compaq.c 1.0.5 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -142,13 +142,13 @@ machine_at_compaq_init(const machine_t *model, void *arg)
case ROM_PORTABLEIII386:
machine_olim24_video_init();
if (hdc_current == 1)
if (hdc_type == 1)
device_add(&ide_isa_device);
break;
#endif
#if defined(DEV_BRANCH) && defined(USE_DESKPRO386)
case ROM_DESKPRO_386:
if (hdc_current == 1)
if (hdc_type == 1)
device_add(&ide_isa_device);
break;
#endif

View File

@@ -12,7 +12,7 @@
*
* Used by DTK PKM-0038S E-2
*
* Version: @(#)m_at_sis85c471.c 1.0.4 2018/03/21
* Version: @(#)m_at_sis85c471.c 1.0.5 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -46,8 +46,8 @@
#include "../io.h"
#include "../memregs.h"
#include "../device.h"
#include "../lpt.h"
#include "../serial.h"
#include "../parallel.h"
#include "../disk/hdc.h"
#include "../disk/hdc_ide.h"
#include "../floppy/fdd.h"
@@ -100,9 +100,9 @@ sis_write(uint16_t port, uint8_t val, void *priv)
if (x & 0x10) {
if (val & 0x10)
lpt1_init(0x378);
parallel_setup(1, 0x378);
else
lpt1_remove();
parallel_remove(1);
}
break;
@@ -136,7 +136,7 @@ sis_init(void)
{
int i = 0;
lpt2_remove();
parallel_remove(2);
sis_curreg = 0;
for (i = 0; i < 0x27; i++)

View File

@@ -40,7 +40,7 @@
* 100 joystick port enabled
* f000:e1e2-dc0c CPU speed is 4.77 mhz
* f000:e1e5-f9c0 keyboard processor error
* f000:e1eb-c617 external lpt1 at 0x3bc
* f000:e1eb-c617 external LPT1 at 0x3bc
* f000:e1ee-e8ee external coms at
*
* Routines:
@@ -66,7 +66,7 @@
* bit 1: b8000 memory available
* 0000:046a: 00 jim 250 01 jim 350
*
* Version: @(#)m_europc.c 1.0.5 2018/03/21
* Version: @(#)m_europc.c 1.0.6 2018/04/05
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -120,6 +120,7 @@
#include "../rom.h"
#include "../nvr.h"
#include "../device.h"
#include "../parallel.h"
#include "../keyboard.h"
#include "../mouse.h"
#include "../game/gameport.h"
@@ -655,7 +656,7 @@ europc_boot(const device_t *info)
*
* We only do this if we have not configured another one.
*/
if (hdc_current == 1)
if (hdc_type == 1)
(void)device_add(&europc_hdc_device);
return(sys);

View File

@@ -28,7 +28,7 @@
* boot. Sometimes, they do, and then it shows an "Incorrect
* DOS" error message?? --FvK
*
* Version: @(#)m_ps1.c 1.0.8 2018/03/31
* Version: @(#)m_ps1.c 1.0.9 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -74,7 +74,7 @@
#include "../device.h"
#include "../nvr.h"
#include "../game/gameport.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../keyboard.h"
#include "../disk/hdc.h"
@@ -350,7 +350,7 @@ ps1_write(uint16_t port, uint8_t val, void *priv)
break;
case 0x0102:
lpt1_remove();
parallel_remove(1);
if (val & 0x04)
serial_setup(1, SERIAL1_ADDR, SERIAL1_IRQ);
else
@@ -358,13 +358,13 @@ ps1_write(uint16_t port, uint8_t val, void *priv)
if (val & 0x10) {
switch ((val >> 5) & 3) {
case 0:
lpt1_init(0x03bc);
parallel_setup(1, 0x03bc);
break;
case 1:
lpt1_init(0x0378);
parallel_setup(1, 0x0378);
break;
case 2:
lpt1_init(0x0278);
parallel_setup(1, 0x0278);
break;
}
}
@@ -512,9 +512,9 @@ ps1_setup(int model)
0xf80000, 0x80000, 0x7ffff, 0, MEM_MAPPING_EXTERNAL);
#endif
lpt1_remove();
lpt2_remove();
lpt1_init(0x03bc);
parallel_remove(1);
parallel_remove(2);
parallel_setup(1, 0x03bc);
serial_remove(1);
serial_remove(2);
@@ -540,7 +540,7 @@ ps1_setup(int model)
0xfc0000, 0x40000, 0x3ffff, 0, MEM_MAPPING_EXTERNAL);
#endif
lpt1_init(0x03bc);
parallel_setup(1, 0x03bc);
/* Initialize the video controller. */
if (vid_card == VID_INTERNAL)
@@ -548,7 +548,7 @@ ps1_setup(int model)
}
if (model == 2133) {
lpt1_init(0x03bc);
parallel_setup(1, 0x03bc);
}
}

View File

@@ -8,7 +8,7 @@
*
* Implementation of ISA-based PS/2 machines.
*
* Version: @(#)m_ps2_isa.c 1.0.4 2018/03/21
* Version: @(#)m_ps2_isa.c 1.0.5 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -51,7 +51,7 @@
#include "../device.h"
#include "../nvr.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -114,23 +114,22 @@ static void ps2_write(uint16_t port, uint8_t val, void *p)
ps2_94 = val;
break;
case 0x102:
lpt1_remove();
parallel_remove(1);
if (val & 0x04)
serial_setup(1, SERIAL1_ADDR, SERIAL1_IRQ);
else
serial_remove(1);
if (val & 0x10)
{
switch ((val >> 5) & 3)
{
switch ((val >> 5) & 3) {
case 0:
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
break;
case 1:
lpt1_init(0x378);
parallel_setup(1, 0x378);
break;
case 2:
lpt1_init(0x278);
parallel_setup(1, 0x278);
break;
}
}
@@ -179,7 +178,7 @@ static void ps2board_init(void)
ps2_190 = 0;
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
memset(&ps2_hd, 0, sizeof(ps2_hd));
}

View File

@@ -8,7 +8,7 @@
*
* Implementation of MCA-based PS/2 machines.
*
* Version: @(#)m_ps2_mca.c 1.0.7 2018/03/22
* Version: @(#)m_ps2_mca.c 1.0.8 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -57,7 +57,7 @@
#include "../nvr.h"
#include "../nvr_ps2.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../mouse.h"
#include "../serial.h"
#include "../video/vid_vga.h"
@@ -357,7 +357,7 @@ static void model_50_write(uint16_t port, uint8_t val)
case 0x101:
break;
case 0x102:
lpt1_remove();
parallel_remove(1);
serial_remove(1);
if (val & 0x04)
{
@@ -373,13 +373,13 @@ static void model_50_write(uint16_t port, uint8_t val)
switch ((val >> 5) & 3)
{
case 0:
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
break;
case 1:
lpt1_init(0x378);
parallel_setup(1, 0x378);
break;
case 2:
lpt1_init(0x278);
parallel_setup(1, 0x278);
break;
}
}
@@ -413,7 +413,7 @@ static void model_55sx_write(uint16_t port, uint8_t val)
case 0x101:
break;
case 0x102:
lpt1_remove();
parallel_remove(1);
serial_remove(1);
if (val & 0x04)
{
@@ -429,13 +429,13 @@ static void model_55sx_write(uint16_t port, uint8_t val)
switch ((val >> 5) & 3)
{
case 0:
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
break;
case 1:
lpt1_init(0x378);
parallel_setup(1, 0x378);
break;
case 2:
lpt1_init(0x278);
parallel_setup(1, 0x278);
break;
}
}
@@ -489,7 +489,7 @@ static void model_70_type3_write(uint16_t port, uint8_t val)
case 0x101:
break;
case 0x102:
lpt1_remove();
parallel_remove(1);
serial_remove(1);
if (val & 0x04)
{
@@ -505,13 +505,13 @@ static void model_70_type3_write(uint16_t port, uint8_t val)
switch ((val >> 5) & 3)
{
case 0:
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
break;
case 1:
lpt1_init(0x378);
parallel_setup(1, 0x378);
break;
case 2:
lpt1_init(0x278);
parallel_setup(1, 0x278);
break;
}
}
@@ -539,7 +539,7 @@ static void model_80_write(uint16_t port, uint8_t val)
case 0x101:
break;
case 0x102:
lpt1_remove();
parallel_remove(1);
serial_remove(1);
if (val & 0x04)
{
@@ -555,13 +555,13 @@ static void model_80_write(uint16_t port, uint8_t val)
switch ((val >> 5) & 3)
{
case 0:
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
break;
case 1:
lpt1_init(0x378);
parallel_setup(1, 0x378);
break;
case 2:
lpt1_init(0x278);
parallel_setup(1, 0x278);
break;
}
}
@@ -759,7 +759,7 @@ static void ps2_mca_board_common_init()
ps2.setup = 0xff;
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
}
static uint8_t ps2_mem_expansion_read(int port, void *p)

View File

@@ -8,7 +8,7 @@
*
* Emulation of various Compaq XT-class PC's.
*
* Version: @(#)m_xt_compaq.c 1.0.5 2018/03/21
* Version: @(#)m_xt_compaq.c 1.0.6 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -52,7 +52,7 @@
#include "../floppy/fdc.h"
#include "../game/gameport.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../parallel.h"
#include "machine.h"
@@ -74,8 +74,8 @@ machine_xt_compaq_init(const machine_t *model, void *arg)
switch(model->id) {
case ROM_PORTABLE:
lpt1_remove();
lpt1_init(0x03bc);
parallel_remove(1);
parallel_setup(1, 0x03bc);
break;
}
}

View File

@@ -50,7 +50,7 @@
*
* FIXME: The ROM drive should be re-done using the "option file".
*
* Version: @(#)m_xt_t1000.c 1.0.8 2018/04/03
* Version: @(#)m_xt_t1000.c 1.0.9 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -94,7 +94,7 @@
#include "../nvr.h"
#include "../device.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
#include "../game/gameport.h"

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Xi8088 open-source machine.
*
* Version: @(#)m_xt_xi8088.c 1.0.5 2018/04/03
* Version: @(#)m_xt_xi8088.c 1.0.6 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -50,7 +50,7 @@
#include "../device.h"
#include "../nvr.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../game/gameport.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"

View File

@@ -8,7 +8,7 @@
*
* Handling of the emulated machines.
*
* Version: @(#)machine.c 1.0.10 2018/03/21
* Version: @(#)machine.c 1.0.11 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -47,8 +47,8 @@
#include "../pit.h"
#include "../mem.h"
#include "../rom.h"
#include "../lpt.h"
#include "../serial.h"
#include "../parallel.h"
#include "../disk/hdc.h"
#include "../disk/hdc_ide.h"
#include "../plat.h"
@@ -153,8 +153,17 @@ machine_common_init(const machine_t *model, UNUSED(void *arg))
pic_init();
pit_init();
if (lpt_enabled)
lpt_init();
/* Disable all LPT ports. */
parallel_init();
if (parallel_enabled[0])
parallel_setup(1, PARALLEL1_ADDR);
if (parallel_enabled[1])
parallel_setup(2, PARALLEL2_ADDR);
if (parallel_enabled[2])
parallel_setup(3, PARALLEL3_ADDR);
if (serial_enabled[0])
serial_setup(1, SERIAL1_ADDR, SERIAL1_IRQ);

View File

@@ -11,7 +11,7 @@
* TODO: Add the Genius bus- and serial mouse.
* Remove the '3-button' flag from mouse types.
*
* Version: @(#)mouse.c 1.0.4 2018/03/29
* Version: @(#)mouse.c 1.0.5 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -72,7 +72,7 @@ int mouse_x,
static const device_t mouse_none_device = {
"None",
"Disabled",
0, MOUSE_TYPE_NONE,
NULL, NULL, NULL,
NULL, NULL, NULL, NULL,

View File

@@ -12,7 +12,7 @@
* it should be malloc'ed and then linked to the NETCARD def.
* Will be done later.
*
* Version: @(#)network.c 1.0.3 2018/03/15
* Version: @(#)network.c 1.0.4 2018/04/05
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -65,18 +65,12 @@
static netcard_t net_cards[] = {
{ "None", "none", NULL,
NULL },
{ "[ISA] Novell NE1000", "ne1k", &ne1000_device,
NULL },
{ "[ISA] Novell NE2000", "ne2k", &ne2000_device,
NULL },
{ "[ISA] Realtek RTL8019AS", "ne2kpnp", &rtl8019as_device,
NULL },
{ "[PCI] Realtek RTL8029AS", "ne2kpci", &rtl8029as_device,
NULL },
{ "", "", NULL,
NULL }
{"Disabled", "none", NULL, NULL},
{"[ISA] Novell NE1000", "ne1k", &ne1000_device, NULL},
{"[ISA] Novell NE2000", "ne2k", &ne2000_device, NULL},
{"[ISA] Realtek RTL8019AS", "ne2kpnp", &rtl8019as_device, NULL},
{"[PCI] Realtek RTL8029AS", "ne2kpci", &rtl8029as_device, NULL},
{NULL, NULL, NULL, NULL}
};
@@ -488,7 +482,7 @@ network_card_get_from_internal_name(char *s)
{
int c = 0;
while (strlen((char *)net_cards[c].internal_name)) {
while (net_cards[c].internal_name != NULL) {
if (! strcmp((char *)net_cards[c].internal_name, s))
return(c);
c++;

274
src/parallel.c Normal file
View File

@@ -0,0 +1,274 @@
/*
* 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 "LPT" style parallel ports.
*
* NOTE: Have to re-do the "attach" and "detach" stuff for the
* "device" that use the ports. --FvK
*
* Version: @(#)parallel.c 1.0.4 2018/04/05
*
* 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.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "emu.h"
#include "io.h"
#include "parallel.h"
#include "sound/snd_lpt_dac.h"
#include "sound/snd_lpt_dss.h"
static const struct {
const char *name;
const char *internal_name;
const lpt_device_t *device;
} parallel_devices[] = {
{ "None", "none", NULL },
{ "Disney Sound Source", "dss", &dss_device },
{ "LPT DAC / Covox Speech Thing", "lpt_dac", &lpt_dac_device },
{ "Stereo LPT DAC", "lpt_dac_stereo", &lpt_dac_stereo_device },
{ "", "", NULL }
};
static const uint16_t addr_list[] = { /* valid port addresses */
0x0378, 0x0278, 0x03bc
};
typedef struct {
/* Standard port stuff. */
uint16_t base; /* port base address */
uint8_t dat, /* port data register */
ctrl; /* port control register */
/* Device stuff. */
char device_name[16]; /* name of attached device */
const lpt_device_t *device_ts;
void *device_ps;
} parallel_t;
static parallel_t ports[PARALLEL_MAX]; /* the ports */
/* Write a value to a port (and/or its attached device.) */
static void
parallel_write(uint16_t port, uint8_t val, void *priv)
{
parallel_t *dev = (parallel_t *)priv;
switch (port & 3) {
case 0:
if (dev->device_ts != NULL)
dev->device_ts->write_data(val, dev->device_ps);
dev->dat = val;
break;
case 2:
if (dev->device_ts != NULL)
dev->device_ts->write_ctrl(val, dev->device_ps);
dev->ctrl = val;
break;
}
}
/* Read a value from a port (and/or its attached device.) */
static uint8_t
parallel_read(uint16_t port, void *priv)
{
parallel_t *dev = (parallel_t *)priv;
uint8_t ret = 0xff;
switch (port & 3) {
case 0:
ret = dev->dat;
break;
case 1:
if (dev->device_ts != NULL)
ret = dev->device_ts->read_status(dev->device_ps);
else ret = 0x00;
break;
case 2:
ret = dev->ctrl;
break;
}
return(ret);
}
/* Initialize (all) the parallel ports. */
void
parallel_init(void)
{
parallel_t *dev;
int i;
pclog("LPT: initializing ports...");
for (i = 0; i < PARALLEL_MAX; i++) {
dev = &ports[i];
memset(dev, 0x00, sizeof(parallel_t));
dev->base = addr_list[i];
if (parallel_enabled[i]) {
io_sethandler(dev->base, 3,
parallel_read,NULL,NULL,
parallel_write,NULL,NULL, dev);
pclog(" [%i=%04x]", i, dev->base);
}
}
pclog("\n");
}
/* Disable one of the parallel ports. */
void
parallel_remove(int id)
{
parallel_t *dev = &ports[id-1];
if (! parallel_enabled[id-1]) return;
io_removehandler(dev->base, 3,
parallel_read,NULL,NULL,
parallel_write,NULL,NULL, dev);
dev->base = addr_list[id-1];
}
void
parallel_remove_amstrad(void)
{
parallel_t *dev = &ports[1];
if (parallel_enabled[1]) {
io_removehandler(dev->base+1, 2,
parallel_read,NULL,NULL,
parallel_write,NULL,NULL, dev);
}
}
/* Set up (the address of) one of the parallel ports. */
void
parallel_setup(int id, uint16_t port)
{
parallel_t *dev = &ports[id-1];
if (! parallel_enabled[id-1]) return;
dev->base = port;
io_sethandler(dev->base, 3,
parallel_read,NULL,NULL,
parallel_write,NULL,NULL, dev);
}
const char *
parallel_device_get_name(int id)
{
if (strlen((char *)parallel_devices[id].name) == 0)
return(NULL);
return((char *)parallel_devices[id].name);
}
char *
parallel_device_get_internal_name(int id)
{
if (strlen((char *)parallel_devices[id].internal_name) == 0)
return(NULL);
return((char *)parallel_devices[id].internal_name);
}
/* Attach the configured "LPT" devices. */
void
parallel_devices_init(void)
{
parallel_t *dev;
int c, i;
for (i = 0; i < PARALLEL_MAX; i++) {
dev = &ports[i];
c = 0;
#if 0
/* FIXME: Gotta re-think this junk... --FvK */
while (! strmpdev->device_name, (char *)strcmp(lpt_devices[c].internal_name, lpt_device_names[i]) && strlen((char *)lpt_devices[c].internal_name) != 0)
c++;
if (strlen((char *)lpt_devices[c].internal_name) == 0)
lpt_device_ts[i] = NULL;
else {
lpt_device_ts[i] = lpt_devices[c].device;
if (lpt_device_ts[i])
lpt_device_ps[i] = lpt_device_ts[i]->init(lpt_devices[c].device);
}
#endif
}
}
void
parallel_devices_close(void)
{
parallel_t *dev;
int i;
for (i = 0; i < PARALLEL_MAX; i++) {
dev = &ports[i];
if (dev->device_ts != NULL) {
dev->device_ts->close(dev->device_ps);
dev->device_ts = NULL;
dev->device_ps = NULL;
}
}
}

View File

@@ -6,9 +6,9 @@
*
* This file is part of the VARCem Project.
*
* Definitions for the LPT parallel port handlerss.
* Definitions for the "LPT" parallel port handlerss.
*
* Version: @(#)lpt.h 1.0.2 2018/03/28
* Version: @(#)parallel.h 1.0.3 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -36,8 +36,15 @@
* Boston, MA 02111-1307
* USA.
*/
#ifndef EMU_LPT_H
# define EMU_LPT_H
#ifndef EMU_PARALLEL_H
# define EMU_PARALLEL_H
#define PARALLEL_MAX 3 /* three ports supported */
#define PARALLEL1_ADDR 0x0378
#define PARALLEL2_ADDR 0x0278
#define PARALLEL3_ADDR 0x03BC /* part of the MDA */
typedef struct _lpt_device_ {
@@ -51,23 +58,15 @@ typedef struct _lpt_device_ {
} lpt_device_t;
extern char lpt_device_names[3][16];
extern void parallel_init(void);
extern void parallel_setup(int id, uint16_t port);
extern void parallel_remove(int id);
extern void parallel_remove_amstrad(void);
extern const char *parallel_device_get_name(int id);
extern char *parallel_device_get_internal_name(int id);
extern void parallel_devices_init(void);
extern void parallel_devices_close(void);
extern void lpt_init(void);
extern void lpt1_init(uint16_t port);
extern void lpt1_remove(void);
extern void lpt2_init(uint16_t port);
extern void lpt2_remove(void);
extern void lpt2_remove_ams(void);
extern void lpt3_init(uint16_t port);
extern void lpt3_remove(void);
extern void lpt_devices_init(void);
extern void lpt_devices_close(void);
extern const char *lpt_device_get_name(int id);
extern char *lpt_device_get_internal_name(int id);
#endif /*EMU_LPT_H*/
#endif /*EMU_PARALLEL_H*/

View File

@@ -8,7 +8,7 @@
*
* Main emulator module where most things are controlled.
*
* Version: @(#)pc.c 1.0.19 2018/04/03
* Version: @(#)pc.c 1.0.20 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -65,8 +65,8 @@
#include "device.h"
#include "nvr.h"
#include "bugger.h"
#include "lpt.h"
#include "serial.h"
#include "parallel.h"
#include "keyboard.h"
#include "mouse.h"
#include "game/gameport.h"
@@ -128,13 +128,15 @@ int vid_cga_contrast = 0, /* (C) video */
vid_card = 0, /* (C) graphics/video card */
video_speed = 0; /* (C) video */
int serial_enabled[SERIAL_MAX] = {0,0}, /* (C) enable serial ports */
lpt_enabled = 0, /* (C) enable LPT ports */
parallel_enabled[PARALLEL_MAX] = {0,0,0},/* (C) enable LPT ports */
bugger_enabled = 0; /* (C) enable ISAbugger */
char parallel_device[PARALLEL_MAX][16]; /* (C) set up LPT devices */
int rctrl_is_lalt; /* (C) set R-CTRL as L-ALT */
int update_icons; /* (C) enable icons updates */
#ifdef WALTJE
int romdos_enabled = 0; /* (C) enable ROM DOS */
#endif
int hdc_type = 0; /* (C) HDC type */
int sound_is_float = 1, /* (C) sound uses FP values */
GAMEBLASTER = 0, /* (C) sound option */
GUS = 0, /* (C) sound option */
@@ -764,12 +766,12 @@ pc_init_modules(void)
sound_init();
/* FIXME: should be disk_init(). */
hdc_init(hdc_name);
/* FIXME: should be disk_init() */
cdrom_hard_reset();
zip_hard_reset();
ide_reset_hard();
/* FIXME: should be scsi_init() */
scsi_card_init();
pc_full_speed();
@@ -790,7 +792,7 @@ pc_reset_hard_close(void)
mouse_close();
lpt_devices_close();
parallel_devices_close();
device_close_all();
@@ -850,7 +852,7 @@ pc_reset_hard_init(void)
/* Reset some basic devices. */
speaker_init();
serial_reset();
lpt_devices_init();
parallel_devices_init();
shadowbios = 0;
@@ -976,7 +978,7 @@ pc_close(thread_t *ptr)
plat_mouse_capture(0);
lpt_devices_close();
parallel_devices_close();
for (i=0; i<ZIP_NUM; i++)
zip_close(i);

View File

@@ -8,7 +8,7 @@
*
* Definitions for the SERIAL card.
*
* Version: @(#)serial.h 1.0.1 2018/02/14
* Version: @(#)serial.h 1.0.2 2018/04/05
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -48,7 +48,8 @@
# define EMU_SERIAL_H
#ifdef WALTJE_SERIAL
#define SERIAL_MAX 2 /* two ports supported */
/* Default settings for the standard ports. */
#define SERIAL1_ADDR 0x03f8
#define SERIAL1_IRQ 4
@@ -56,6 +57,8 @@
#define SERIAL2_IRQ 3
#ifdef WALTJE_SERIAL
/* Supported UART types. */
#define UART_TYPE_8250 0 /* standard NS8250 */
#define UART_TYPE_8250A 1 /* updated NS8250(A) */
@@ -138,12 +141,6 @@ void serial_clear_fifo(SERIAL *);
void serial_write_fifo(SERIAL *serial, uint8_t dat);
extern SERIAL serial1, serial2;
/* Default settings for the standard ports. */
#define SERIAL1_ADDR 0x03f8
#define SERIAL1_IRQ 4
#define SERIAL2_ADDR 0x02f8
#define SERIAL2_IRQ 3
#endif

View File

@@ -8,7 +8,7 @@
*
* Implementation of the SMC FDC37C669 Super I/O Chip.
*
* Version: @(#)sio_fdc37c669.c 1.0.2 2018/03/07
* Version: @(#)sio_fdc37c669.c 1.0.3 2018/04/05
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -40,7 +40,7 @@
#include "../io.h"
#include "../device.h"
#include "../pci.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -158,11 +158,11 @@ process_value:
if (valxor & 4)
{
/* pclog("Removing LPT1\n"); */
lpt1_remove();
parallel_remove(1);
if ((fdc37c669_regs[1] & 4) && (fdc37c669_regs[0x23] >= 0x40))
{
/* pclog("LPT1 init (%02X)\n", make_port(0x23)); */
lpt1_init(make_port(0x23));
parallel_setup(1, make_port(0x23));
}
}
if (valxor & 7)
@@ -233,11 +233,11 @@ process_value:
if (valxor)
{
/* pclog("Removing LPT1\n"); */
lpt1_remove();
parallel_remove(1);
if ((fdc37c669_regs[1] & 4) && (fdc37c669_regs[0x23] >= 0x40))
{
/* pclog("LPT1 init (%02X)\n", make_port(0x23)); */
lpt1_init(make_port(0x23));
parallel_setup(1, make_port(0x23));
}
}
break;
@@ -321,10 +321,9 @@ void fdc37c669_reset(void)
serial_remove(2);
serial_setup(2, SERIAL2_ADDR, SERIAL2_IRQ);
lpt2_remove();
lpt1_remove();
lpt1_init(0x378);
parallel_remove(1);
parallel_remove(2);
parallel_setup(1, 0x378);
memset(fdc37c669_regs, 0, 42);
fdc37c669_regs[0] = 0x28;

View File

@@ -9,7 +9,7 @@
* Implementation of the SMC FDC37C663 and FDC37C665 Super
* I/O Chips.
*
* Version: @(#)sio_fdc37c66x.c 1.0.2 2018/03/07
* Version: @(#)sio_fdc37c66x.c 1.0.3 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -45,7 +45,7 @@
#include "../io.h"
#include "../device.h"
#include "../pci.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -173,17 +173,17 @@ static void set_serial2_addr()
static void lpt1_handler()
{
lpt1_remove();
parallel_remove(1);
switch (fdc37c66x_regs[1] & 3)
{
case 1:
lpt1_init(0x3bc);
parallel_setup(1, 0x3bc);
break;
case 2:
lpt1_init(0x378);
parallel_setup(1, 0x378);
break;
case 3:
lpt1_init(0x278);
parallel_setup(1, 0x278);
break;
}
}
@@ -303,10 +303,9 @@ static void fdc37c66x_reset(void)
serial_remove(2);
serial_setup(2, SERIAL2_ADDR, SERIAL2_IRQ);
lpt2_remove();
lpt1_remove();
lpt1_init(0x378);
parallel_remove(1);
parallel_remove(2);
parallel_setup(1, 0x378);
fdc_reset(fdc37c66x_fdc);

View File

@@ -9,7 +9,7 @@
* Implementation of the SMC FDC37C932FR and FDC37C935 Super
* I/O Chips.
*
* Version: @(#)sio_fdc37c93x.c 1.0.4 2018/03/13
* Version: @(#)sio_fdc37c93x.c 1.0.5 2018/04/05
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -41,7 +41,7 @@
#include "../io.h"
#include "../device.h"
#include "../pci.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -108,13 +108,13 @@ static void fdc37c93x_lpt_handler(void)
uint8_t global_enable = !!(fdc37c93x_regs[0x22] & (1 << 3));
uint8_t local_enable = !!fdc37c93x_ld_regs[3][0x30];
lpt1_remove();
parallel_remove(1);
if (global_enable && local_enable)
{
ld_port = make_port(3);
/* pclog("fdc37c93x: Setting LPT1 port to %04X\n", ld_port); */
if ((ld_port >= 0x0100) && (ld_port <= 0x0FFC))
lpt1_init(ld_port);
parallel_setup(1, ld_port);
}
}
@@ -572,7 +572,7 @@ static void fdc37c935_reset(void)
static void fdc37c93x_init(void)
{
lpt2_remove();
parallel_remove(2);
fdc37c93x_fdc = device_add(&fdc_at_smc_device);

View File

@@ -8,7 +8,7 @@
*
* Emulation of the NatSemi PC87306 Super I/O chip.
*
* Version: @(#)sio_pc87306.c 1.0.2 2018/03/07
* Version: @(#)sio_pc87306.c 1.0.3 2018/04/05
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -40,7 +40,7 @@
#include "../io.h"
#include "../device.h"
#include "../pci.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -84,6 +84,7 @@ void lpt1_handler()
{
int temp;
uint16_t lptba;
temp = pc87306_regs[0x01] & 3;
lptba = ((uint16_t) pc87306_regs[0x19]) << 2;
if (pc87306_regs[0x1B] & 0x10) {
@@ -109,7 +110,7 @@ void lpt1_handler()
}
}
if (lpt_port)
lpt1_init(lpt_port);
parallel_setup(1, lpt_port);
}
void serial1_handler()
@@ -228,7 +229,7 @@ process_value:
case 0:
if (valxor & 1)
{
lpt1_remove();
parallel_remove(1);
if (val & 1)
{
lpt1_handler();
@@ -284,7 +285,7 @@ process_value:
case 1:
if (valxor & 3)
{
lpt1_remove();
parallel_remove(1);
if (pc87306_regs[0] & 1)
{
lpt1_handler();
@@ -320,7 +321,7 @@ process_value:
{
if (val & 1)
{
lpt1_remove();
parallel_remove(1);
serial_remove(1);
serial_remove(2);
fdc_remove(pc87306_fdc);
@@ -368,7 +369,7 @@ process_value:
case 0x19:
if (valxor)
{
lpt1_remove();
parallel_remove(1);
if (pc87306_regs[0] & 1)
{
lpt1_handler();
@@ -378,7 +379,7 @@ process_value:
case 0x1B:
if (valxor & 0x70)
{
lpt1_remove();
parallel_remove(1);
if (!(val & 0x40))
{
pc87306_regs[0x19] = 0xEF;
@@ -475,8 +476,8 @@ void pc87306_reset(void)
0 = 360 rpm @ 500 kbps for 3.5"
1 = Default, 300 rpm @ 500,300,250,1000 kbps for 3.5"
*/
lpt1_remove();
lpt2_remove();
parallel_remove(1);
parallel_remove(2);
lpt1_handler();
serial_remove(1);
serial_remove(2);
@@ -490,7 +491,7 @@ void pc87306_init()
{
pc87306_fdc = device_add(&fdc_at_nsc_device);
lpt2_remove();
parallel_remove(2);
pc87306_reset();

View File

@@ -29,7 +29,7 @@
* 70 - IRQ
* 74 - DMA
*
* Version: @(#)sio_um8669f.c 1.0.2 2018/03/07
* Version: @(#)sio_um8669f.c 1.0.3 2018/04/05
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
@@ -63,7 +63,7 @@
#include "../device.h"
#include "../io.h"
#include "../pci.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -181,9 +181,9 @@ void um8669f_pnp_write(uint16_t port, uint8_t val, void *p)
case DEV_LPT1:
if ((um8669f->cur_reg == REG_ENABLE) && valxor)
{
lpt1_remove();
parallel_remove(1);
if (um8669f->dev[DEV_LPT1].enable & 1)
lpt1_init(um8669f->dev[DEV_LPT1].addr);
parallel_setup(1, um8669f->dev[DEV_LPT1].addr);
}
break;
}
@@ -289,10 +289,9 @@ void um8669f_reset(void)
serial_remove(2);
serial_setup(2, SERIAL2_ADDR, SERIAL2_IRQ);
lpt2_remove();
lpt1_remove();
lpt1_init(0x378);
parallel_remove(1);
parallel_remove(2);
parallel_setup(1, 0x378);
if (um8669f_global.pnp_active) {
io_removehandler(0x0279, 0x0001, NULL, NULL, NULL, um8669f_pnp_write, NULL, NULL, &um8669f_global);

View File

@@ -11,7 +11,7 @@
* Winbond W83877F Super I/O Chip
* Used by the Award 430HX
*
* Version: @(#)sio_w83877f.c 1.0.2 2018/03/07
* Version: @(#)sio_w83877f.c 1.0.3 2018/04/05
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -46,7 +46,7 @@
#include "../pci.h"
#include "../mem.h"
#include "../rom.h"
#include "../lpt.h"
#include "../parallel.h"
#include "../serial.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -412,8 +412,8 @@ process_value:
}
if (valxor & 0x80)
{
lpt1_remove();
if (!(w83877f_regs[4] & 0x80)) lpt1_init(make_port(0x23));
parallel_remove(1);
if (!(w83877f_regs[4] & 0x80)) parallel_setup(1, make_port(0x23));
}
break;
case 6:
@@ -457,8 +457,8 @@ process_value:
case 0x23:
if (valxor)
{
lpt1_remove();
if (!(w83877f_regs[4] & 0x80)) lpt1_init(make_port(0x23));
parallel_remove(1);
if (!(w83877f_regs[4] & 0x80)) parallel_setup(1, make_port(0x23));
}
break;
case 0x24:
@@ -517,8 +517,8 @@ uint8_t w83877f_read(uint16_t port, void *priv)
void w83877f_reset(void)
{
lpt1_remove();
lpt1_init(0x378);
parallel_remove(1);
parallel_setup(1, 0x378);
fdc_reset(w83877f_fdc);
@@ -554,7 +554,7 @@ void w83877f_init(void)
{
w83877f_fdc = device_add(&fdc_at_winbond_device);
lpt2_remove();
parallel_remove(2);
w83877f_reset();

View File

@@ -8,7 +8,7 @@
*
* MIDI support module, main file.
*
* Version: @(#)midi.c 1.0.3 2018/03/15
* Version: @(#)midi.c 1.0.4 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -54,19 +54,22 @@
#endif
#define SYSEX_SIZE 1024
#define RAWBUF 1024
int midi_device_current = 0;
static int midi_device_last = 0;
typedef struct {
const char *name;
const char *internal_name;
const device_t *device;
} MIDI_DEVICE;
} midi_t;
static const MIDI_DEVICE devices[] = {
{"None", "none", NULL},
static const midi_t devices[] = {
{"Disabled", "none", NULL },
#ifdef USE_FLUIDSYNTH
{"FluidSynth", "fluidsynth", &fluidsynth_device},
#endif
@@ -74,72 +77,23 @@ static const MIDI_DEVICE devices[] = {
{"Roland MT-32 Emulation", "mt32", &mt32_device },
{"Roland CM-32L Emulation", "cm32l", &cm32l_device },
#endif
{SYSTEM_MIDI_NAME, SYSTEM_MIDI_INTERNAL_NAME, &system_midi_device},
{"", "", NULL}
{SYSTEM_MIDI_NAME, SYSTEM_MIDI_INT, &system_midi_device},
{NULL, NULL, NULL }
};
static midi_device_t *m_device = NULL;
int midi_device_available(int card)
{
if (devices[card].device)
return device_available(devices[card].device);
return 1;
}
char *midi_device_getname(int card)
{
return (char *) devices[card].name;
}
const device_t *midi_device_getdevice(int card)
{
return devices[card].device;
}
int midi_device_has_config(int card)
{
if (!devices[card].device)
return 0;
return devices[card].device->config ? 1 : 0;
}
char *midi_device_get_internal_name(int card)
{
return (char *) devices[card].internal_name;
}
int midi_device_get_from_internal_name(char *s)
{
int c = 0;
while (strlen(devices[c].internal_name))
{
if (!strcmp(devices[c].internal_name, s))
return c;
c++;
}
return 0;
}
void midi_device_init()
{
if (devices[midi_device_current].device)
device_add(devices[midi_device_current].device);
midi_device_last = midi_device_current;
}
static int midi_device_last = 0;
static uint8_t midi_rt_buf[1024];
static uint8_t midi_cmd_buf[1024];
static int midi_cmd_pos = 0;
static int midi_cmd_len = 0;
static uint8_t midi_status = 0;
static unsigned int midi_pos;
static unsigned int midi_sysex_start = 0;
static unsigned int midi_sysex_delay = 0;
uint8_t MIDI_evt_len[256] = {
static uint8_t midi_sysex_data[1024+2];
static const uint8_t MIDI_evt_len[256] = {
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x00
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x10
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x20
@@ -162,10 +116,74 @@ uint8_t MIDI_evt_len[256] = {
0,2,3,2, 0,0,1,0, 1,0,1,1, 1,0,1,0 // 0xf0
};
static unsigned int midi_pos;
static uint8_t midi_sysex_data[1024+2];
void midi_init(midi_device_t* device)
int
midi_device_available(int card)
{
if (devices[card].device != NULL)
return(device_available(devices[card].device));
return(1);
}
char *
midi_device_getname(int card)
{
return((char *)devices[card].name);
}
const device_t *
midi_device_getdevice(int card)
{
return(devices[card].device);
}
int
midi_device_has_config(int card)
{
if (devices[card].device == NULL) return(0);
return(devices[card].device->config ? 1 : 0);
}
char *
midi_device_get_internal_name(int card)
{
return((char *)devices[card].internal_name);
}
int
midi_device_get_from_internal_name(char *s)
{
int c = 0;
while (devices[c].internal_name != NULL) {
if (!strcmp(devices[c].internal_name, s))
return(c);
c++;
}
return(0);
}
void
midi_device_init(void)
{
if (devices[midi_device_current].device != NULL)
device_add(devices[midi_device_current].device);
midi_device_last = midi_device_current;
}
void
midi_init(midi_device_t* device)
{
memset(midi_rt_buf, 0, sizeof(midi_rt_buf));
memset(midi_cmd_buf, 0, sizeof(midi_cmd_buf));
@@ -176,93 +194,82 @@ void midi_init(midi_device_t* device)
midi_sysex_start = midi_sysex_delay = 0;
m_device = device;
}
void midi_close()
void
midi_close(void)
{
m_device = NULL;
}
void midi_poll()
{
if (m_device && m_device->poll) m_device->poll();
}
void play_msg(uint8_t *msg)
void
midi_poll(void)
{
if (m_device->play_msg) m_device->play_msg(msg);
if (m_device && m_device->poll)
m_device->poll();
}
void play_sysex(uint8_t *sysex, unsigned int len)
void
play_msg(uint8_t *msg)
{
if (m_device->play_sysex) m_device->play_sysex(sysex, len);
if (m_device->play_msg)
m_device->play_msg(msg);
}
#define SYSEX_SIZE 1024
#define RAWBUF 1024
void midi_write(uint8_t val)
void
play_sysex(uint8_t *sysex, unsigned int len)
{
if (!m_device) return;
if (m_device->play_sysex)
m_device->play_sysex(sysex, len);
}
void
midi_write(uint8_t val)
{
uint32_t passed_ticks;
if (m_device == NULL) return;
if (m_device->write && m_device->write(val)) return;
uint32_t passed_ticks;
if (midi_sysex_start)
{
if (midi_sysex_start) {
passed_ticks = plat_get_ticks() - midi_sysex_start;
if (passed_ticks < midi_sysex_delay)
{
plat_delay_ms(midi_sysex_delay - passed_ticks);
}
}
/* Test for a realtime MIDI message */
if (val >= 0xf8)
{
if (val >= 0xf8) {
midi_rt_buf[0] = val;
play_msg(midi_rt_buf);
return;
}
/* Test for a active sysex transfer */
if (midi_status == 0xf0)
{
if (!(val & 0x80))
{
if (midi_status == 0xf0) {
if (! (val & 0x80)) {
if (midi_pos < (SYSEX_SIZE-1)) midi_sysex_data[midi_pos++] = val;
return;
}
else
{
} else {
midi_sysex_data[midi_pos++] = 0xf7;
if ((midi_sysex_start) && (midi_pos >= 4) && (midi_pos <= 9) && (midi_sysex_data[1] == 0x41) && (midi_sysex_data[3] == 0x16))
{
if ((midi_sysex_start) && (midi_pos >= 4) && (midi_pos <= 9) && (midi_sysex_data[1] == 0x41) && (midi_sysex_data[3] == 0x16)) {
/* pclog("MIDI: Skipping invalid MT-32 SysEx MIDI message\n"); */
}
else
{
} else {
play_sysex(midi_sysex_data, midi_pos);
if (midi_sysex_start)
{
if (midi_sysex_data[5] == 0x7f)
{
if (midi_sysex_start) {
if (midi_sysex_data[5] == 0x7f) {
midi_sysex_delay = 290; /* All parameters reset */
}
else if ((midi_sysex_data[5] == 0x10) && (midi_sysex_data[6] == 0x00) && (midi_sysex_data[7] == 0x04))
{
} else if ((midi_sysex_data[5] == 0x10) && (midi_sysex_data[6] == 0x00) && (midi_sysex_data[7] == 0x04)) {
midi_sysex_delay = 145; /* Viking Child */
}
else if ((midi_sysex_data[5] == 0x10) && (midi_sysex_data[6] == 0x00) && (midi_sysex_data[7] == 0x01))
{
} else if ((midi_sysex_data[5] == 0x10) && (midi_sysex_data[6] == 0x00) && (midi_sysex_data[7] == 0x01)) {
midi_sysex_delay = 30; /* Dark Sun 1 */
}
else
} else
midi_sysex_delay = (unsigned int) (((float) (midi_pos) * 1.25f) * 1000.0f / 3125.0f) + 2;
midi_sysex_start = plat_get_ticks();
@@ -271,24 +278,20 @@ void midi_write(uint8_t val)
}
}
if (val & 0x80)
{
if (val & 0x80) {
midi_status = val;
midi_cmd_pos = 0;
midi_cmd_len = MIDI_evt_len[val];
if (midi_status == 0xf0)
{
if (midi_status == 0xf0) {
midi_sysex_data[0] = 0xf0;
midi_pos = 1;
}
}
if (midi_cmd_len)
{
if (midi_cmd_len) {
midi_cmd_buf[midi_cmd_pos++] = val;
if (midi_cmd_pos >= midi_cmd_len)
{
if (midi_cmd_pos >= midi_cmd_len) {
play_msg(midi_cmd_buf);
midi_cmd_pos = 1;
}

View File

@@ -8,7 +8,7 @@
*
* Definitions for the MIDI module.
*
* Version: @(#)midi.h 1.0.2 2018/03/15
* Version: @(#)midi.h 1.0.3 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -66,17 +66,12 @@ void midi_close();
void midi_write(uint8_t val);
void midi_poll();
#if 0
#ifdef _WIN32
# define SYSTEM_MIDI_NAME "Windows MIDI"
#define SYSTEM_MIDI_INTERNAL_NAME "windows_midi"
# define SYSTEM_MIDI_INT "system_midi"
#else
# define SYSTEM_MIDI_NAME "System MIDI"
#define SYSTEM_MIDI_INTERNAL_NAME "system_midi"
#endif
#else
#define SYSTEM_MIDI_NAME "System MIDI"
#define SYSTEM_MIDI_INTERNAL_NAME "system_midi"
# define SYSTEM_MIDI_INT "system_midi"
#endif

View File

@@ -8,7 +8,7 @@
*
* Interface to the OpenAL sound processing library.
*
* Version: @(#)openal.c 1.0.5 2018/03/28
* Version: @(#)openal.c 1.0.6 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -209,8 +209,7 @@ initalmain(int argc, char *argv[])
* initialize the MIDI buffer and source, otherwise, do not.
*/
str = midi_device_get_internal_name(midi_device_current);
if (!strcmp(str, "none") ||
!strcmp(str, SYSTEM_MIDI_INTERNAL_NAME)) return;
if (!strcmp(str, "none") || !strcmp(str, SYSTEM_MIDI_INT)) return;
/* Try loading the DLL. */
openal_handle = dynld_module(PATH_AL_DLL, openal_imports);

View File

@@ -8,7 +8,7 @@
*
* Implemantation of LPT-based sound devices.
*
* Version: @(#)snd_lpt_dac.c 1.0.3 2018/03/28
* Version: @(#)snd_lpt_dac.c 1.0.4 2018/04/05
*
* 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 "../lpt.h"
#include "../parallel.h"
#include "../timer.h"
#include "sound.h"
#include "filters.h"

View File

@@ -8,7 +8,7 @@
*
* Implementation of the LPT-based DSS sound device.
*
* Version: @(#)snd_lpt_dss.c 1.0.3 2018/03/28
* Version: @(#)snd_lpt_dss.c 1.0.4 2018/04/05
*
* 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 "../lpt.h"
#include "../parallel.h"
#include "sound.h"
#include "filters.h"
#include "snd_lpt_dss.h"

View File

@@ -8,7 +8,7 @@
*
* Sound emulation core.
*
* Version: @(#)sound.c 1.0.5 2018/04/02
* Version: @(#)sound.c 1.0.6 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -71,7 +71,7 @@ typedef struct {
const char *name;
const char *internal_name;
const device_t *device;
} SOUND_CARD;
} sound_t;
typedef struct {
void (*get_buffer)(int32_t *buffer, int len, void *p);
@@ -100,14 +100,18 @@ static int16_t cd_out_buffer_int16[CD_BUFLEN * 2];
static thread_t *sound_cd_thread_h;
static event_t *sound_cd_event;
static event_t *sound_cd_start_event;
static unsigned int cd_vol_l, cd_vol_r;
static unsigned int cd_vol_l,
cd_vol_r;
static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN;
static volatile int cdaudioon = 0;
static int32_t *outbuffer;
static float *outbuffer_ex;
static int16_t *outbuffer_ex_int16;
static int cd_thread_enable = 0;
static const SOUND_CARD sound_cards[] =
{
{ "None", "none", NULL },
static const sound_t sound_cards[] = {
{"Disabled", "none", NULL },
{"[ISA] Adlib", "adlib", &adlib_device },
{"[ISA] Adlib Gold", "adlibgold", &adgold_device },
{"[ISA] Sound Blaster 1.0", "sb", &sb_1_device },
@@ -126,7 +130,7 @@ static const SOUND_CARD sound_cards[] =
{"[MCA] Sound Blaster Pro MCV", "sbpromcv", &sb_pro_mcv_device},
{"[PCI] Ensoniq AudioPCI (ES1371)", "es1371", &es1371_device },
{"[PCI] Sound Blaster PCI 128", "sbpci128", &es1371_device },
{ "", "", NULL }
{NULL, NULL, NULL }
};
@@ -145,118 +149,126 @@ snddev_log(const char *fmt, ...)
}
int sound_card_available(int card)
int
sound_card_available(int card)
{
if (sound_cards[card].device)
return device_available(sound_cards[card].device);
if (sound_cards[card].device != NULL)
return(device_available(sound_cards[card].device));
return 1;
return(1);
}
char *sound_card_getname(int card)
char *
sound_card_getname(int card)
{
return (char *)sound_cards[card].name;
return((char *)sound_cards[card].name);
}
const device_t *sound_card_getdevice(int card)
{
return sound_cards[card].device;
return(sound_cards[card].device);
}
int sound_card_has_config(int card)
int
sound_card_has_config(int card)
{
if (!sound_cards[card].device)
return 0;
return sound_cards[card].device->config ? 1 : 0;
if (sound_cards[card].device == NULL) return(0);
return(sound_cards[card].device->config ? 1 : 0);
}
char *sound_card_get_internal_name(int card)
char *
sound_card_get_internal_name(int card)
{
return (char *)sound_cards[card].internal_name;
return((char *)sound_cards[card].internal_name);
}
int sound_card_get_from_internal_name(char *s)
int
sound_card_get_from_internal_name(char *s)
{
int c = 0;
while (strlen((char *)sound_cards[c].internal_name))
{
while (sound_cards[c].internal_name != NULL) {
if (! strcmp((char *)sound_cards[c].internal_name, s))
return c;
return(c);
c++;
}
return 0;
return(0);
}
void sound_card_init(void)
void
sound_card_init(void)
{
if (sound_cards[sound_card_current].device)
if (sound_cards[sound_card_current].device != NULL)
device_add(sound_cards[sound_card_current].device);
sound_card_last = sound_card_current;
}
void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r)
void
sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r)
{
cd_vol_l = vol_l;
cd_vol_r = vol_r;
}
static void sound_cd_thread(void *param)
{
int i = 0;
static void
sound_cd_thread(void *param)
{
float cd_buffer_temp[2] = {0.0, 0.0};
float cd_buffer_temp2[2] = {0.0, 0.0};
int32_t cd_buffer_temp4[2] = {0, 0};
int c, has_audio;
int d;
int32_t audio_vol_l;
int32_t audio_vol_r;
int channel_select[2];
int c, d, i, has_audio;
thread_set_event(sound_cd_start_event);
while (cdaudioon)
{
while (cdaudioon) {
thread_wait_event(sound_cd_event, -1);
thread_reset_event(sound_cd_event);
if (!soundon || !cdaudioon)
return;
for (c = 0; c < CD_BUFLEN*2; c += 2)
{
if (sound_is_float)
{
if (!soundon || !cdaudioon) return;
for (c = 0; c < CD_BUFLEN*2; c += 2) {
if (sound_is_float) {
cd_out_buffer[c] = 0.0;
cd_out_buffer[c+1] = 0.0;
}
else
{
} else {
cd_out_buffer_int16[c] = 0;
cd_out_buffer_int16[c+1] = 0;
}
}
for (i = 0; i < CDROM_NUM; i++)
{
for (i = 0; i < CDROM_NUM; i++) {
has_audio = 0;
if (cdrom_drives[i].bus_type == CDROM_BUS_DISABLED)
continue;
if (cdrom_drives[i].handler->audio_callback)
{
if (cdrom_drives[i].bus_type == CDROM_BUS_DISABLED) continue;
if (cdrom_drives[i].handler->audio_callback) {
cdrom_drives[i].handler->audio_callback(i, cd_buffer[i], CD_BUFLEN*2);
has_audio = (cdrom_drives[i].bus_type && cdrom_drives[i].sound_on);
} else
continue;
if (soundon && has_audio)
{
int32_t audio_vol_l = cdrom_mode_sense_get_volume(i, 0);
int32_t audio_vol_r = cdrom_mode_sense_get_volume(i, 1);
int channel_select[2];
if (soundon && has_audio) {
audio_vol_l = cdrom_mode_sense_get_volume(i, 0);
audio_vol_r = cdrom_mode_sense_get_volume(i, 1);
channel_select[0] = cdrom_mode_sense_get_channel(i, 0);
channel_select[1] = cdrom_mode_sense_get_channel(i, 1);
for (c = 0; c < CD_BUFLEN*2; c += 2)
{
for (c = 0; c < CD_BUFLEN*2; c += 2) {
/* First, transfer the CD audio data to the temporary buffer. */
cd_buffer_temp[0] = (float) cd_buffer[i][c];
cd_buffer_temp[1] = (float) cd_buffer[i][c+1];
@@ -270,24 +282,15 @@ static void sound_cd_thread(void *param)
/*Apply ATAPI channel select*/
cd_buffer_temp2[0] = cd_buffer_temp2[1] = 0.0;
if (channel_select[0] & 1)
{
cd_buffer_temp2[0] += cd_buffer_temp[0];
}
if (channel_select[0] & 2)
{
cd_buffer_temp2[1] += cd_buffer_temp[0];
}
if (channel_select[1] & 1)
{
cd_buffer_temp2[0] += cd_buffer_temp[1];
}
if (channel_select[1] & 2)
{
cd_buffer_temp2[1] += cd_buffer_temp[1];
}
if (sound_process_handlers_num)
{
if (sound_process_handlers_num) {
cd_buffer_temp4[0] = (int32_t) cd_buffer_temp2[0];
cd_buffer_temp4[1] = (int32_t) cd_buffer_temp2[1];
@@ -296,9 +299,7 @@ static void sound_cd_thread(void *param)
cd_buffer_temp2[0] = (float) cd_buffer_temp4[0];
cd_buffer_temp2[1] = (float) cd_buffer_temp4[1];
}
else
{
} else {
/*Apply sound card CD volume*/
cd_buffer_temp2[0] *= (float) cd_vol_l;
cd_buffer_temp2[0] /= 65535.0;
@@ -307,13 +308,10 @@ static void sound_cd_thread(void *param)
cd_buffer_temp2[1] /= 65535.0;
}
if (sound_is_float)
{
if (sound_is_float) {
cd_out_buffer[c] += (float)(cd_buffer_temp2[0] / 32768.0);
cd_out_buffer[c+1] += (float)(cd_buffer_temp2[1] / 32768.0);
}
else
{
} else {
if (cd_buffer_temp2[0] > 32767)
cd_buffer_temp2[0] = 32767;
if (cd_buffer_temp2[0] < -32768)
@@ -329,6 +327,7 @@ static void sound_cd_thread(void *param)
}
}
}
if (sound_is_float)
givealbuffer_cd(cd_out_buffer);
else
@@ -336,38 +335,27 @@ static void sound_cd_thread(void *param)
}
}
static int32_t *outbuffer;
static float *outbuffer_ex;
static int16_t *outbuffer_ex_int16;
static int cd_thread_enable = 0;
void sound_realloc_buffers(void)
void
sound_realloc_buffers(void)
{
if (outbuffer_ex != NULL)
{
free(outbuffer_ex);
}
if (outbuffer_ex_int16 != NULL)
{
free(outbuffer_ex_int16);
}
if (sound_is_float)
{
outbuffer_ex = malloc(SOUNDBUFLEN * 2 * sizeof(float));
}
else
{
outbuffer_ex_int16 = malloc(SOUNDBUFLEN * 2 * sizeof(int16_t));
}
}
void sound_init(void)
void
sound_init(void)
{
int i = 0;
int available_cdrom_drives = 0;
int drives = 0;
int i;
initalmain(0,NULL);
inital();
@@ -379,16 +367,12 @@ void sound_init(void)
sound_realloc_buffers();
for (i = 0; i < CDROM_NUM; i++)
{
for (i = 0; i < CDROM_NUM; i++) {
if (cdrom_drives[i].bus_type != CDROM_BUS_DISABLED)
{
available_cdrom_drives++;
}
drives++;
}
if (available_cdrom_drives)
{
if (drives) {
cdaudioon = 1;
sound_cd_start_event = thread_create_event();
@@ -396,40 +380,48 @@ void sound_init(void)
sound_cd_event = thread_create_event();
sound_cd_thread_h = thread_create(sound_cd_thread, NULL);
/* pclog("Waiting for CD start event...\n"); */
#if 0
pclog("Waiting for CD start event...\n");
#endif
thread_wait_event(sound_cd_start_event, -1);
thread_reset_event(sound_cd_start_event);
/* pclog("Done!\n"); */
}
else
#if 0
pclog("Done!\n");
#endif
} else
cdaudioon = 0;
cd_thread_enable = available_cdrom_drives ? 1 : 0;
cd_thread_enable = drives ? 1 : 0;
}
void sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
void
sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
{
sound_handlers[sound_handlers_num].get_buffer = get_buffer;
sound_handlers[sound_handlers_num].priv = p;
sound_handlers_num++;
}
void sound_add_process_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
void
sound_add_process_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
{
sound_process_handlers[sound_process_handlers_num].get_buffer = get_buffer;
sound_process_handlers[sound_process_handlers_num].priv = p;
sound_process_handlers_num++;
}
void sound_poll(void *priv)
void
sound_poll(void *priv)
{
sound_poll_time += sound_poll_latch;
midi_poll();
sound_pos_global++;
if (sound_pos_global == SOUNDBUFLEN)
{
if (sound_pos_global == SOUNDBUFLEN) {
int c;
memset(outbuffer, 0, SOUNDBUFLEN * 2 * sizeof(int32_t));
@@ -437,15 +429,10 @@ void sound_poll(void *priv)
for (c = 0; c < sound_handlers_num; c++)
sound_handlers[c].get_buffer(outbuffer, SOUNDBUFLEN, sound_handlers[c].priv);
for (c = 0; c < SOUNDBUFLEN * 2; c++)
{
if (sound_is_float)
{
for (c = 0; c < SOUNDBUFLEN * 2; c++) {
if (sound_is_float) {
outbuffer_ex[c] = (float)((outbuffer[c]) / 32768.0);
}
else
{
} else {
if (outbuffer[c] > 32767)
outbuffer[c] = 32767;
if (outbuffer[c] < -32768)
@@ -455,23 +442,16 @@ void sound_poll(void *priv)
}
}
if (soundon)
{
if (soundon) {
if (sound_is_float)
{
givealbuffer(outbuffer_ex);
}
else
{
givealbuffer(outbuffer_ex_int16);
}
}
if (cd_thread_enable)
{
if (cd_thread_enable) {
cd_buf_update--;
if (!cd_buf_update)
{
if (! cd_buf_update) {
cd_buf_update = (48000 / SOUNDBUFLEN) / (CD_FREQ / CD_BUFLEN);
thread_set_event(sound_cd_event);
}
@@ -481,14 +461,18 @@ void sound_poll(void *priv)
}
}
void sound_speed_changed(void)
void
sound_speed_changed(void)
{
sound_poll_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / 48000.0));
}
void sound_reset(void)
void
sound_reset(void)
{
int i = 0;
int i;
timer_add(sound_poll, &sound_poll_time, TIMER_ALWAYS_ENABLED, NULL);
@@ -498,30 +482,33 @@ void sound_reset(void)
sound_set_cd_volume(65535, 65535);
for (i = 0; i < CDROM_NUM; i++)
{
for (i = 0; i < CDROM_NUM; i++) {
if (cdrom_drives[i].handler->audio_stop)
{
cdrom_drives[i].handler->audio_stop(i);
}
}
}
void sound_cd_thread_end(void)
void
sound_cd_thread_end(void)
{
if (cdaudioon) {
if (! cdaudioon) return;
cdaudioon = 0;
/* pclog("Waiting for CD Audio thread to terminate...\n"); */
#if 0
pclog("Waiting for CD Audio thread to terminate...\n");
#endif
thread_set_event(sound_cd_event);
thread_wait(sound_cd_thread_h, -1);
/* pclog("CD Audio thread terminated...\n"); */
#if 0
pclog("CD Audio thread terminated...\n");
#endif
if (sound_cd_event) {
thread_destroy_event(sound_cd_event);
sound_cd_event = NULL;
}
sound_cd_thread_h = NULL;
if (sound_cd_start_event) {
@@ -529,23 +516,19 @@ void sound_cd_thread_end(void)
sound_cd_event = NULL;
}
}
}
void sound_cd_thread_reset(void)
{
int i = 0;
int available_cdrom_drives = 0;
for (i = 0; i < CDROM_NUM; i++)
void
sound_cd_thread_reset(void)
{
int drives = 0;
int i;
for (i = 0; i < CDROM_NUM; i++) {
if (cdrom_drives[i].bus_type != CDROM_BUS_DISABLED)
{
available_cdrom_drives++;
drives++;
}
}
if (available_cdrom_drives && !cd_thread_enable)
{
if (drives && !cd_thread_enable) {
cdaudioon = 1;
sound_cd_start_event = thread_create_event();
@@ -555,13 +538,11 @@ void sound_cd_thread_reset(void)
thread_wait_event(sound_cd_start_event, -1);
thread_reset_event(sound_cd_start_event);
}
else if (!available_cdrom_drives && cd_thread_enable)
{
} else if (!drives && cd_thread_enable) {
sound_cd_thread_end();
}
cd_thread_enable = available_cdrom_drives ? 1 : 0;
cd_thread_enable = drives ? 1 : 0;
}

View File

@@ -8,7 +8,7 @@
*
* Plantronics ColorPlus emulation.
*
* Version: @(#)vid_colorplus.c 1.0.2 2018/03/15
* Version: @(#)vid_colorplus.c 1.0.3 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -45,11 +45,11 @@
#include "../emu.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../lpt.h"
#include "../pit.h"
#include "../mem.h"
#include "../timer.h"
#include "../device.h"
#include "../parallel.h"
#include "video.h"
#include "vid_cga.h"
#include "vid_colorplus.h"
@@ -426,7 +426,7 @@ void *colorplus_standalone_init(const device_t *info)
mem_mapping_add(&colorplus->cga.mapping, 0xb8000, 0x08000, colorplus_read, NULL, NULL, colorplus_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, colorplus);
io_sethandler(0x03d0, 0x0010, colorplus_in, NULL, NULL, colorplus_out, NULL, NULL, colorplus);
lpt3_init(0x3BC);
parallel_setup(3, 0x3BC);
return colorplus;
}

View File

@@ -8,7 +8,7 @@
*
* Hercules emulation.
*
* Version: @(#)vid_hercules.c 1.0.2 2018/03/15
* Version: @(#)vid_hercules.c 1.0.3 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -42,13 +42,13 @@
#include <stdlib.h>
#include <wchar.h>
#include "../emu.h"
#include "../io.h"
#include "../pit.h"
#include "../mem.h"
#include "../rom.h"
#include "../io.h"
#include "../lpt.h"
#include "../pit.h"
#include "../timer.h"
#include "../device.h"
#include "../parallel.h"
#include "video.h"
#include "vid_hercules.h"
@@ -391,7 +391,7 @@ void *hercules_init(const device_t *info)
}
cgapal_rebuild();
lpt3_init(0x3BC);
parallel_setup(3, 0x3BC);
return hercules;
}

View File

@@ -8,7 +8,7 @@
*
* Hercules InColor emulation.
*
* Version: @(#)vid_hercules_plus.c 1.0.3 2018/03/15
* Version: @(#)vid_hercules_plus.c 1.0.4 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -43,12 +43,12 @@
#include <wchar.h>
#include "../emu.h"
#include "../io.h"
#include "../lpt.h"
#include "../pit.h"
#include "../mem.h"
#include "../rom.h"
#include "../timer.h"
#include "../device.h"
#include "../parallel.h"
#include "video.h"
#include "vid_herculesplus.h"
@@ -729,7 +729,7 @@ void *herculesplus_init(const device_t *info)
mdacols[0x80][0][1] = mdacols[0x80][1][1] = 16;
mdacols[0x88][0][1] = mdacols[0x88][1][1] = 16;
lpt3_init(0x3BC);
parallel_setup(3, 0x3BC);
return herculesplus;
}

View File

@@ -8,7 +8,7 @@
*
* Hercules InColor emulation.
*
* Version: @(#)vid_incolor.c 1.0.3 2018/03/15
* Version: @(#)vid_incolor.c 1.0.4 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -43,12 +43,12 @@
#include <wchar.h>
#include "../emu.h"
#include "../io.h"
#include "../lpt.h"
#include "../pit.h"
#include "../mem.h"
#include "../rom.h"
#include "../timer.h"
#include "../device.h"
#include "../parallel.h"
#include "video.h"
#include "vid_incolor.h"
@@ -1073,7 +1073,7 @@ void *incolor_init(const device_t *info)
}
incolor->palette_idx = 0;
lpt3_init(0x3BC);
parallel_setup(3, 0x3BC);
return incolor;
}

View File

@@ -8,7 +8,7 @@
*
* MDA emulation.
*
* Version: @(#)vid_mda.c 1.0.2 2018/03/15
* Version: @(#)vid_mda.c 1.0.3 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -43,12 +43,12 @@
#include <wchar.h>
#include "../emu.h"
#include "../io.h"
#include "../lpt.h"
#include "../pit.h"
#include "../mem.h"
#include "../rom.h"
#include "../timer.h"
#include "../device.h"
#include "../parallel.h"
#include "video.h"
#include "vid_mda.h"
@@ -340,7 +340,7 @@ void *mda_init(const device_t *info)
}
cgapal_rebuild();
lpt3_init(0x3BC);
parallel_setup(3, 0x3BC);
return mda;
}

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)VARCem.rc 1.0.12 2018/04/02
* Version: @(#)VARCem.rc 1.0.14 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -215,7 +215,7 @@ BEGIN
END
#endif
MENUITEM "S&tatus", IDM_STATUS
MENUITEM "Take s&creenshot\tCtrl+Esc", IDM_ACTION_SCREENSHOT
MENUITEM "Take s&creenshot\tCtrl+Home", IDM_ACTION_SCREENSHOT
MENUITEM SEPARATOR
MENUITEM "&Update status bar icons", IDM_UPDATE_ICONS
END
@@ -519,25 +519,26 @@ DLG_CFG_PORTS DIALOG DISCARDABLE 97, 0, 267, 99
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "LPT1 Device:",IDT_1716,7,8,61,10
COMBOBOX IDC_COMBO_LPT1,71,7,189,120,CBS_DROPDOWNLIST |
CONTROL "Parallel port 1",IDC_CHECK_PARALLEL1,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,8,70,10
COMBOBOX IDC_COMBO_PARALLEL1,80,7,159,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "LPT2 Device:",IDT_1717,7,27,61,10
COMBOBOX IDC_COMBO_LPT2,71,26,189,120,CBS_DROPDOWNLIST |
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 |
WS_VSCROLL | WS_TABSTOP
LTEXT "LPT3 Device:",IDT_1718,7,46,61,10
COMBOBOX IDC_COMBO_LPT3,71,45,189,120,CBS_DROPDOWNLIST |
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 |
WS_VSCROLL | WS_TABSTOP
CONTROL "Serial port 1",IDC_CHECK_SERIAL1,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,64,94,10
CONTROL "Serial port 2",IDC_CHECK_SERIAL2,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,64,94,10
BS_AUTOCHECKBOX | WS_TABSTOP,7,69,94,10
CONTROL "Parallel port",IDC_CHECK_PARALLEL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,82,94,10
CONTROL "Serial port 2",IDC_CHECK_SERIAL2,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,88,94,10
END
DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 97
@@ -565,7 +566,7 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
END
DLG_CFG_HARD_DISKS DIALOG DISCARDABLE 97, 0, 267, 154
DLG_CFG_DISK DIALOG DISCARDABLE 97, 0, 267, 154
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
@@ -592,7 +593,7 @@ BEGIN
WS_VSCROLL | WS_TABSTOP
END
DLG_CFG_HARD_DISKS_ADD DIALOG DISCARDABLE 0, 0, 219, 111
DLG_CFG_DISK_ADD DIALOG DISCARDABLE 0, 0, 219, 111
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Hard Disk"
FONT 9, "Segoe UI"
@@ -632,7 +633,7 @@ BEGIN
WS_BORDER,7,16,204,12
END
DLG_CFG_FLOPPY_DRIVES DIALOG DISCARDABLE 97, 0, 267, 103
DLG_CFG_FLOPPY DIALOG DISCARDABLE 97, 0, 267, 103
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
@@ -649,7 +650,7 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,196,86,64,10
END
DLG_CFG_OTHER_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 221
DLG_CFG_RMV_DEVICES DIALOG DISCARDABLE 97, 0, 267, 221
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
@@ -754,7 +755,7 @@ END
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
"resource.h"
END
2 TEXTINCLUDE DISCARDABLE
@@ -763,13 +764,13 @@ BEGIN
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""resources.h""\r\n"
"\0"
""
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
""
END
#endif // APSTUDIO_INVOKED
@@ -1023,14 +1024,7 @@ BEGIN
IDS_2141 "Invalid PCap device"
IDS_2142 "&Notify disk change"
IDS_2143 "Type"
IDS_2144 "Disabled"
IDS_2145 "Standard 2-button joystick(s)"
IDS_2146 "Standard 4-button joystick"
IDS_2147 "Standard 6-button joystick"
IDS_2148 "Standard 8-button joystick"
IDS_2149 "CH Flightstick Pro"
IDS_2150 "Microsoft SideWinder Pad"
IDS_2151 "Thrustmaster Flight Control System"
/* IDS_2144-51 available */
IDS_2152 "None"
IDS_2153 "Unable to load Keyboard Accelerators!"
IDS_2154 "Unable to register Raw Input!"
@@ -1039,7 +1033,7 @@ BEGIN
IDS_2157 "%" PRIu64 " MB (CHS: %u, %u, %u)"
IDS_2158 "Floppy %i (%s): %ls"
IDS_2159 "All images (*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0"
IDS_2160 "Configuration files (*.VARC)\0*.VARC\0All files (*.*)\0*.*\0"
IDS_2161 "&New image..."
IDS_2162 "&Existing image..."
IDS_2163 "Existing image (&Write-protected)..."

View File

@@ -8,7 +8,7 @@
#
# Makefile for Windows systems using the MinGW32 environment.
#
# Version: @(#)Makefile.mingw 1.0.18 2018/03/31
# Version: @(#)Makefile.mingw 1.0.19 2018/04/05
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -509,7 +509,7 @@ 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 lpt.o $(SERIAL) \
DEVOBJ := bugger.o parallel.o $(SERIAL) \
sio_fdc37c66x.o sio_fdc37c669.o sio_fdc37c93x.o \
sio_pc87306.o sio_w83877f.o sio_um8669f.o \
keyboard.o \

View File

@@ -8,7 +8,7 @@
#
# Makefile for Windows using Visual Studio 2015.
#
# Version: @(#)Makefile.VC 1.0.3 2018/03/27
# Version: @(#)Makefile.VC 1.0.4 2018/04/05
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -440,9 +440,10 @@ CXXFLAGS := $(WX_FLAGS) $(OPTS) $(CXXOPTS) $(COPTS) $(DOPTS) $(AOPTIM) $(AFLAGS)
# Create the (final) list of objects to build. #
#########################################################################
MAINOBJ := pc.obj config.obj \
random.obj timer.obj io.obj dma.obj nmi.obj pic.obj pit.obj ppi.obj \
pci.obj mca.obj mcr.obj mem.obj memregs.obj rom.obj rom_load.obj \
device.obj nvr.obj nvr_at.obj nvr_ps2.obj $(VNCOBJ) $(RDPOBJ)
random.obj timer.obj io.obj dma.obj nmi.obj pic.obj \
pit.obj ppi.obj pci.obj mca.obj mcr.obj mem.obj \
memregs.obj rom.obj rom_load.obj device.obj nvr.obj \
nvr_at.obj nvr_ps2.obj $(VNCOBJ) $(RDPOBJ)
INTELOBJ := intel.obj \
intel_flash.obj \
@@ -473,7 +474,7 @@ 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 lpt.obj $(SERIAL) \
DEVOBJ := bugger.obj parallel.obj $(SERIAL) \
sio_fdc37c66x.obj sio_fdc37c669.obj sio_fdc37c93x.obj \
sio_pc87306.obj sio_w83877f.obj sio_um8669f.obj \
keyboard.obj \

View File

@@ -8,7 +8,7 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.8 2018/04/02
* Version: @(#)resource.h 1.0.9 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -53,10 +53,10 @@
#define DLG_CFG_NETWORK 115 /* sub-dialog of config */
#define DLG_CFG_PORTS 116 /* sub-dialog of config */
#define DLG_CFG_PERIPHERALS 117 /* sub-dialog of config */
#define DLG_CFG_HARD_DISKS 118 /* sub-dialog of config */
#define DLG_CFG_HARD_DISKS_ADD 119 /* sub-dialog of config */
#define DLG_CFG_FLOPPY_DRIVES 120 /* sub-dialog of config */
#define DLG_CFG_OTHER_REMOVABLE_DEVICES 121 /* sub-dialog of config */
#define DLG_CFG_DISK 118 /* sub-dialog of config */
#define DLG_CFG_DISK_ADD 119 /* sub-dialog of config */
#define DLG_CFG_FLOPPY 120 /* sub-dialog of config */
#define DLG_CFG_RMV_DEVICES 121 /* sub-dialog of config */
/* Static text label IDs. */
#define IDT_1700 1700 /* Language: */
@@ -168,12 +168,14 @@
#define IDC_COMBO_PCAP 1091
#define IDC_COMBO_NET 1092
#define IDC_COMBO_LPT1 1110 /* ports config */
#define IDC_COMBO_LPT2 1111
#define IDC_COMBO_LPT3 1112
#define IDC_CHECK_SERIAL1 1113
#define IDC_CHECK_SERIAL2 1114
#define IDC_CHECK_PARALLEL 1115
#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_OTHER_PERIPH 1120 /* other periph config */
#define IDC_COMBO_SCSI 1121

File diff suppressed because it is too large Load Diff

1738
src/win/win_settings_disk.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,317 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_floppy.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* Floppy Dialog *
* *
************************************************************************/
/* GLobal variables needed for the Floppy dialog. */
static int fd_ignore_change = 0;
static int fdlv_current_sel;
static void
floppy_image_list_init(HWND hwndList)
{
HICON hiconItem;
HIMAGELIST hSmall;
int i;
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
ILC_MASK | ILC_COLOR32, 1, 1);
for (i = 0; i < 14; i++) {
hiconItem = LoadIcon(hinstance, (LPCWSTR)fdd_type_to_icon(i));
ImageList_AddIcon(hSmall, hiconItem);
DestroyIcon(hiconItem);
}
ListView_SetImageList(hwndList, hSmall, LVSIL_SMALL);
}
static BOOL
floppy_recalc_list(HWND hwndList)
{
WCHAR temp[128];
char tempA[128];
LVITEM lvI;
int i;
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.state = 0;
for (i = 0; i < 4; i++) {
lvI.iSubItem = 0;
if (temp_fdd_types[i] > 0) {
strcpy(tempA, fdd_getname(temp_fdd_types[i]));
mbstowcs(temp, tempA, sizeof_w(temp));
lvI.pszText = temp;
} else {
lvI.pszText = plat_get_string(IDS_5376);
}
lvI.iItem = i;
lvI.iImage = temp_fdd_types[i];
if (ListView_InsertItem(hwndList, &lvI) == -1)
return FALSE;
lvI.iSubItem = 1;
lvI.pszText = plat_get_string(temp_fdd_turbo[i] ? IDS_2060 : IDS_2061);
lvI.iItem = i;
lvI.iImage = 0;
if (ListView_SetItem(hwndList, &lvI) == -1)
return FALSE;
lvI.iSubItem = 2;
lvI.pszText = plat_get_string(temp_fdd_check_bpb[i] ? IDS_2060 : IDS_2061);
lvI.iItem = i;
lvI.iImage = 0;
if (ListView_SetItem(hwndList, &lvI) == -1)
return FALSE;
}
return TRUE;
}
static BOOL
floppy_init_columns(HWND hwndList)
{
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.iSubItem = 0;
lvc.pszText = plat_get_string(IDS_2143);
lvc.cx = 292;
lvc.fmt = LVCFMT_LEFT;
if (ListView_InsertColumn(hwndList, 0, &lvc) == -1)
return FALSE;
lvc.iSubItem = 1;
lvc.pszText = plat_get_string(IDS_2059);
lvc.cx = 50;
lvc.fmt = LVCFMT_LEFT;
if (ListView_InsertColumn(hwndList, 1, &lvc) == -1)
return FALSE;
lvc.iSubItem = 2;
lvc.pszText = plat_get_string(IDS_2170);
lvc.cx = 75;
lvc.fmt = LVCFMT_LEFT;
if (ListView_InsertColumn(hwndList, 2, &lvc) == -1)
return FALSE;
return TRUE;
}
static int
floppy_get_selected(HWND hdlg)
{
int drive = -1;
int i, j = 0;
HWND h;
for (i = 0; i < 6; i++) {
h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
j = ListView_GetItemState(h, i, LVIS_SELECTED);
if (j)
drive = i;
}
return drive;
}
static void
floppy_update_item(HWND hwndList, int i)
{
WCHAR temp[128];
char tempA[128];
LVITEM lvI;
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
lvI.iSubItem = 0;
lvI.iItem = i;
if (temp_fdd_types[i] > 0) {
strcpy(tempA, fdd_getname(temp_fdd_types[i]));
mbstowcs(temp, tempA, sizeof_w(temp));
lvI.pszText = temp;
} else {
lvI.pszText = plat_get_string(IDS_5376);
}
lvI.iImage = temp_fdd_types[i];
if (ListView_SetItem(hwndList, &lvI) == -1)
return;
lvI.iSubItem = 1;
lvI.pszText = plat_get_string(temp_fdd_turbo[i] ? IDS_2060 : IDS_2061);
lvI.iItem = i;
lvI.iImage = 0;
if (ListView_SetItem(hwndList, &lvI) == -1)
return;
lvI.iSubItem = 2;
lvI.pszText = plat_get_string(temp_fdd_check_bpb[i] ? IDS_2060 : IDS_2061);
lvI.iItem = i;
lvI.iImage = 0;
if (ListView_SetItem(hwndList, &lvI) == -1)
return;
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
floppy_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
HWND h = INVALID_HANDLE_VALUE;
int i = 0;
int old_sel = 0;
switch (message) {
case WM_INITDIALOG:
fd_ignore_change = 1;
fdlv_current_sel = 0;
h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
floppy_init_columns(h);
floppy_image_list_init(h);
floppy_recalc_list(h);
ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE);
for (i = 0; i < 14; i++) {
if (i == 0) {
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_5376));
} else {
mbstowcs(temp, fdd_getname(i), sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
}
}
SendMessage(h, CB_SETCURSEL, temp_fdd_types[fdlv_current_sel], 0);
h = GetDlgItem(hdlg, IDC_CHECKTURBO);
SendMessage(h, BM_SETCHECK, temp_fdd_turbo[fdlv_current_sel], 0);
h = GetDlgItem(hdlg, IDC_CHECKBPB);
SendMessage(h, BM_SETCHECK, temp_fdd_check_bpb[fdlv_current_sel], 0);
fd_ignore_change = 0;
return TRUE;
case WM_NOTIFY:
if (fd_ignore_change)
return FALSE;
if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_FLOPPY_DRIVES)) {
old_sel = fdlv_current_sel;
fdlv_current_sel = floppy_get_selected(hdlg);
if (fdlv_current_sel == old_sel) {
return FALSE;
} else if (fdlv_current_sel == -1) {
fd_ignore_change = 1;
fdlv_current_sel = old_sel;
ListView_SetItemState(h, fdlv_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
fd_ignore_change = 0;
return FALSE;
}
fd_ignore_change = 1;
h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE);
SendMessage(h, CB_SETCURSEL, temp_fdd_types[fdlv_current_sel], 0);
h = GetDlgItem(hdlg, IDC_CHECKTURBO);
SendMessage(h, BM_SETCHECK, temp_fdd_turbo[fdlv_current_sel], 0);
h = GetDlgItem(hdlg, IDC_CHECKBPB);
SendMessage(h, BM_SETCHECK, temp_fdd_check_bpb[fdlv_current_sel], 0);
fd_ignore_change = 0;
}
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_FD_TYPE:
if (fd_ignore_change)
return FALSE;
fd_ignore_change = 1;
h = GetDlgItem(hdlg, IDC_COMBO_FD_TYPE);
temp_fdd_types[fdlv_current_sel] = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
floppy_update_item(h, fdlv_current_sel);
fd_ignore_change = 0;
return FALSE;
case IDC_CHECKTURBO:
if (fd_ignore_change)
return FALSE;
fd_ignore_change = 1;
h = GetDlgItem(hdlg, IDC_CHECKTURBO);
temp_fdd_turbo[fdlv_current_sel] = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
floppy_update_item(h, fdlv_current_sel);
fd_ignore_change = 0;
return FALSE;
case IDC_CHECKBPB:
if (fd_ignore_change)
return FALSE;
fd_ignore_change = 1;
h = GetDlgItem(hdlg, IDC_CHECKBPB);
temp_fdd_check_bpb[fdlv_current_sel] = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
floppy_update_item(h, fdlv_current_sel);
fd_ignore_change = 0;
return FALSE;
}
default:
break;
}
return FALSE;
}

View File

@@ -0,0 +1,190 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_input.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* Input Dialog *
* *
************************************************************************/
static int
mouse_valid(int num, int m)
{
const device_t *dev;
if ((num == MOUSE_TYPE_INTERNAL) &&
!(machines[m].flags & MACHINE_MOUSE)) return(0);
dev = mouse_get_device(num);
return(device_is_valid(dev, machines[m].flags));
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
char *stransi;
HWND h;
int c;
int d = 0;
switch (message) {
case WM_INITDIALOG:
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
d = 0;
for (c = 0; c < mouse_get_ndev(); c++) {
settings_mouse_to_list[c] = d;
if (mouse_valid(c, temp_machine)) {
stransi = mouse_get_name(c);
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
settings_list_to_mouse[d] = c;
d++;
}
}
SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse], 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE);
if (mouse_has_config(temp_mouse))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
c = 0;
while ((stransi = joystick_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);
h = GetDlgItem(hdlg, IDC_JOY1);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY2);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY3);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY4);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_MOUSE:
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE);
if (mouse_has_config(temp_mouse))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
break;
case IDC_CONFIGURE_MOUSE:
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)mouse_get_device(temp_mouse));
break;
case IDC_COMBO_JOYSTICK:
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_JOY1);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY2);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY3);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY4);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE);
break;
case IDC_JOY1:
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
temp_deviceconfig |= joystickconfig_open(hdlg, 0, temp_joystick);
break;
case IDC_JOY2:
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
temp_deviceconfig |= joystickconfig_open(hdlg, 1, temp_joystick);
break;
case IDC_JOY3:
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
temp_deviceconfig |= joystickconfig_open(hdlg, 2, temp_joystick);
break;
case IDC_JOY4:
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
temp_deviceconfig |= joystickconfig_open(hdlg, 3, temp_joystick);
break;
}
return FALSE;
case WM_SAVESETTINGS:
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
return FALSE;
default:
break;
}
return FALSE;
}

View File

@@ -0,0 +1,320 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_machine.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* Machine Dialog *
* *
************************************************************************/
static void
machine_recalc_cpu(HWND hdlg)
{
HWND h;
#ifdef USE_DYNAREC
int cpu_flags;
#endif
int cpu_type;
int rs = 0;
rs = machine_getromset_ex(temp_machine);
h = GetDlgItem(hdlg, IDC_COMBO_WS);
cpu_type = machines[romstomachine[rs]].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type;
if ((cpu_type >= CPU_286) && (cpu_type <= CPU_386DX))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
#ifdef USE_DYNAREC
h = GetDlgItem(hdlg, IDC_CHECK_DYNAREC);
cpu_flags = machines[romstomachine[rs]].cpu[temp_cpu_m].cpus[temp_cpu].cpu_flags;
if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) && (cpu_flags & CPU_REQUIRES_DYNAREC)) {
fatal("Attempting to select a CPU that requires the recompiler and does not support it at the same time\n");
}
if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) {
if (!(cpu_flags & CPU_SUPPORTS_DYNAREC))
temp_dynarec = 0;
if (cpu_flags & CPU_REQUIRES_DYNAREC)
temp_dynarec = 1;
SendMessage(h, BM_SETCHECK, temp_dynarec, 0);
EnableWindow(h, FALSE);
} else {
EnableWindow(h, TRUE);
}
#endif
h = GetDlgItem(hdlg, IDC_CHECK_FPU);
cpu_type = machines[romstomachine[rs]].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type;
if ((cpu_type < CPU_i486DX) && (cpu_type >= CPU_286)) {
EnableWindow(h, TRUE);
} else if (cpu_type < CPU_286) {
temp_fpu = 0;
EnableWindow(h, FALSE);
} else {
temp_fpu = 1;
EnableWindow(h, FALSE);
}
SendMessage(h, BM_SETCHECK, temp_fpu, 0);
}
static void
machine_recalc_cpu_m(HWND hdlg)
{
WCHAR temp[128];
const char *stransi;
HWND h;
int c = 0;
int rs = 0;
rs = machine_getromset_ex(temp_machine);
h = GetDlgItem(hdlg, IDC_COMBO_CPU);
SendMessage(h, CB_RESETCONTENT, 0, 0);
c = 0;
while (machines[romstomachine[rs]].cpu[temp_cpu_m].cpus[c].cpu_type != -1) {
stransi = machines[romstomachine[rs]].cpu[temp_cpu_m].cpus[c].name;
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
c++;
}
EnableWindow(h, TRUE);
if (temp_cpu >= c)
temp_cpu = (c - 1);
SendMessage(h, CB_SETCURSEL, temp_cpu, 0);
machine_recalc_cpu(hdlg);
}
static void
machine_recalc_machine(HWND hdlg)
{
WCHAR temp[128];
const char *stransi;
HWND h;
int c = 0;
int rs = 0;
UDACCEL accel;
rs = machine_getromset_ex(temp_machine);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MACHINE);
if (machine_getdevice(temp_machine))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_CPU_TYPE);
SendMessage(h, CB_RESETCONTENT, 0, 0);
c = 0;
while (machines[romstomachine[rs]].cpu[c].cpus != NULL && c < 4) {
stransi = machines[romstomachine[rs]].cpu[c].name;
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
c++;
}
EnableWindow(h, TRUE);
if (temp_cpu_m >= c)
temp_cpu_m = (c - 1);
SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0);
if (c == 1)
EnableWindow(h, FALSE);
else
EnableWindow(h, TRUE);
machine_recalc_cpu_m(hdlg);
h = GetDlgItem(hdlg, IDC_MEMSPIN);
SendMessage(h, UDM_SETRANGE, 0, (machines[romstomachine[rs]].min_ram << 16) | machines[romstomachine[rs]].max_ram);
accel.nSec = 0;
accel.nInc = machines[romstomachine[rs]].ram_granularity;
SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel);
if (!(machines[romstomachine[rs]].flags & MACHINE_AT) || (machines[romstomachine[rs]].ram_granularity >= 128)) {
SendMessage(h, UDM_SETPOS, 0, temp_mem_size);
h = GetDlgItem(hdlg, IDC_TEXT_MB);
SendMessage(h, WM_SETTEXT, 0, (LPARAM)plat_get_string(IDS_2094));
} else {
SendMessage(h, UDM_SETPOS, 0, temp_mem_size / 1024);
h = GetDlgItem(hdlg, IDC_TEXT_MB);
SendMessage(h, WM_SETTEXT, 0, (LPARAM)plat_get_string(IDS_2087));
}
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
char tempA[128];
const char *stransi;
HWND h;
int c;
int d = 0;
switch (message) {
case WM_INITDIALOG:
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
for (c = 0; c < ROM_MAX; c++)
romstolist[c] = 0;
c = d = 0;
while (machines[c].id != -1) {
if (romspresent[machines[c].id]) {
stransi = machines[c].name;
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
machinetolist[c] = d;
listtomachine[d] = c;
romstolist[machines[c].id] = d;
romstomachine[machines[c].id] = c;
d++;
}
c++;
}
SendMessage(h, CB_SETCURSEL, machinetolist[temp_machine], 0);
h = GetDlgItem(hdlg, IDC_COMBO_WS);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2131));
for (c = 0; c < 8; c++) {
swprintf(temp, sizeof_w(temp), plat_get_string(2132), c);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
}
SendMessage(h, CB_SETCURSEL, temp_wait_states, 0);
#ifdef USE_DYNAREC
h = GetDlgItem(hdlg, IDC_CHECK_DYNAREC);
SendMessage(h, BM_SETCHECK, temp_dynarec, 0);
#endif
h = GetDlgItem(hdlg, IDC_MEMSPIN);
SendMessage(h, UDM_SETBUDDY, (WPARAM)GetDlgItem(hdlg, IDC_MEMTEXT), 0);
h = GetDlgItem(hdlg, IDC_CHECK_SYNC);
SendMessage(h, BM_SETCHECK, temp_sync, 0);
machine_recalc_machine(hdlg);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_MACHINE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
temp_machine = listtomachine[SendMessage(h, CB_GETCURSEL, 0, 0)];
machine_recalc_machine(hdlg);
}
break;
case IDC_COMBO_CPU_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
h = GetDlgItem(hdlg, IDC_COMBO_CPU_TYPE);
temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0);
temp_cpu = 0;
machine_recalc_cpu_m(hdlg);
}
break;
case IDC_COMBO_CPU:
if (HIWORD(wParam) == CBN_SELCHANGE) {
h = GetDlgItem(hdlg, IDC_COMBO_CPU);
temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0);
machine_recalc_cpu(hdlg);
}
break;
case IDC_CONFIGURE_MACHINE:
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
temp_machine = listtomachine[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)machine_getdevice(temp_machine));
break;
}
return FALSE;
case WM_SAVESETTINGS:
#ifdef USE_DYNAREC
h = GetDlgItem(hdlg, IDC_CHECK_DYNAREC);
temp_dynarec = SendMessage(h, BM_GETCHECK, 0, 0);
#endif
h = GetDlgItem(hdlg, IDC_CHECK_SYNC);
temp_sync = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_FPU);
temp_fpu = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_WS);
temp_wait_states = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_MEMTEXT);
SendMessage(h, WM_GETTEXT, sizeof_w(temp), (LPARAM)temp);
wcstombs(tempA, temp, sizeof(tempA));
sscanf(tempA, "%i", &temp_mem_size);
temp_mem_size &= ~(machines[temp_machine].ram_granularity - 1);
if (temp_mem_size < machines[temp_machine].min_ram)
temp_mem_size = machines[temp_machine].min_ram;
else if (temp_mem_size > machines[temp_machine].max_ram)
temp_mem_size = machines[temp_machine].max_ram;
if ((machines[temp_machine].flags & MACHINE_AT) && (machines[temp_machine].ram_granularity < 128))
temp_mem_size *= 1024;
if (machines[temp_machine].flags & MACHINE_VIDEO)
vid_card = VID_INTERNAL;
return FALSE;
default:
break;
}
return FALSE;
}

View File

@@ -0,0 +1,206 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_network.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* Network Dialog *
* *
************************************************************************/
/* Global variables for the Network dialog. */
static int net_ignore_message = 0;
static void
network_recalc_combos(HWND hdlg)
{
HWND h;
net_ignore_message = 1;
h = GetDlgItem(hdlg, IDC_COMBO_PCAP);
if (temp_net_type == NET_TYPE_PCAP)
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_NET);
if (temp_net_type == NET_TYPE_SLIRP)
EnableWindow(h, TRUE);
else if ((temp_net_type == NET_TYPE_PCAP) && (network_dev_to_id(temp_host_dev) > 0))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_CONFIGURE_NET);
if (network_card_has_config(temp_net_card) && (temp_net_type == NET_TYPE_SLIRP)) {
EnableWindow(h, TRUE);
} else if (network_card_has_config(temp_net_card) &&
(temp_net_type == NET_TYPE_PCAP) &&
(network_dev_to_id(temp_host_dev) > 0)) {
EnableWindow(h, TRUE);
} else {
EnableWindow(h, FALSE);
}
net_ignore_message = 0;
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
char *stransi;
HWND h;
int c, d;
switch (message) {
case WM_INITDIALOG:
h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE);
//FIXME: take strings from network.c table.. --FvK
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)L"None");
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)L"PCap");
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)L"SLiRP");
SendMessage(h, CB_SETCURSEL, temp_net_type, 0);
h = GetDlgItem(hdlg, IDC_COMBO_PCAP);
if (temp_net_type == NET_TYPE_PCAP)
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_PCAP);
for (c = 0; c < network_ndev; c++) {
mbstowcs(temp, network_devs[c].description, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
}
SendMessage(h, CB_SETCURSEL, network_dev_to_id(temp_host_dev), 0);
/*NIC config*/
h = GetDlgItem(hdlg, IDC_COMBO_NET);
c = d = 0;
while (1) {
stransi = network_card_getname(c);
if (stransi == NULL)
break;
settings_network_to_list[c] = d;
if (network_card_available(c) && device_is_valid(network_card_getdevice(c), machines[temp_machine].flags)) {
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
settings_list_to_network[d] = c;
d++;
}
c++;
}
SendMessage(h, CB_SETCURSEL, settings_network_to_list[temp_net_card], 0);
EnableWindow(h, d ? TRUE : FALSE);
network_recalc_combos(hdlg);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_NET_TYPE:
if (net_ignore_message)
return FALSE;
h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE);
temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0);
network_recalc_combos(hdlg);
break;
case IDC_COMBO_PCAP:
if (net_ignore_message)
return FALSE;
h = GetDlgItem(hdlg, IDC_COMBO_PCAP);
memset(temp_host_dev, '\0', sizeof(temp_host_dev));
strcpy(temp_host_dev, network_devs[SendMessage(h, CB_GETCURSEL, 0, 0)].device);
network_recalc_combos(hdlg);
break;
case IDC_COMBO_NET:
if (net_ignore_message)
return FALSE;
h = GetDlgItem(hdlg, IDC_COMBO_NET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
network_recalc_combos(hdlg);
break;
case IDC_CONFIGURE_NET:
if (net_ignore_message)
return FALSE;
h = GetDlgItem(hdlg, IDC_COMBO_NET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)network_card_getdevice(temp_net_card));
break;
}
return FALSE;
case WM_SAVESETTINGS:
h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE);
temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_PCAP);
memset(temp_host_dev, '\0', sizeof(temp_host_dev));
strcpy(temp_host_dev, network_devs[SendMessage(h, CB_GETCURSEL, 0, 0)].device);
h = GetDlgItem(hdlg, IDC_COMBO_NET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
return FALSE;
default:
break;
}
return FALSE;
}

View File

@@ -0,0 +1,257 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_periph.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* (Other) Peripherals Dialog *
* *
************************************************************************/
static char *hdc_names[16];
static const int valid_ide_irqs[11] = { 2, 3, 4, 5, 7, 9, 10, 11, 12, 14, 15 };
static int
find_irq_in_array(int irq, int def)
{
int i;
for (i = 0; i < 11; i++) {
if (valid_ide_irqs[i] == irq)
return(i + 1);
}
return(7 + def);
}
static void
recalc_hdc_list(HWND hdlg, int machine, int use_selected_hdc)
{
WCHAR temp[128];
char old_name[32];
char *stransi;
HWND h;
int valid;
int c, d;
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
valid = 0;
if (use_selected_hdc) {
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (c != -1 && hdc_names[c])
strcpy(old_name, hdc_names[c]);
else
strcpy(old_name, "none");
} else {
strcpy(old_name, hdc_get_internal_name(temp_hdc_type));
}
SendMessage(h, CB_RESETCONTENT, 0, 0);
c = d = 0;
while (1) {
stransi = hdc_get_name(c);
if (stransi == NULL)
break;
if (c==1 && !(machines[temp_machine].flags&MACHINE_HDC)) {
/* Skip "Internal" if machine doesn't have one. */
c++;
continue;
}
if (!hdc_available(c) || !device_is_valid(hdc_get_device(c), machines[temp_machine].flags)) {
c++;
continue;
}
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
hdc_names[d] = hdc_get_internal_name(c);
if (! strcmp(old_name, hdc_names[d])) {
SendMessage(h, CB_SETCURSEL, d, 0);
valid = 1;
}
c++;
d++;
}
if (! valid)
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, d ? TRUE : FALSE);
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
const char *stransi;
const device_t *dev;
int c, d;
HWND h;
switch (message) {
case WM_INITDIALOG:
/*SCSI config*/
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
c = d = 0;
while (1) {
stransi = scsi_card_getname(c);
if (! *stransi)
break;
settings_scsi_to_list[c] = d;
if (scsi_card_available(c)) {
dev = scsi_card_getdevice(c);
if (device_is_valid(dev, machines[temp_machine].flags)) {
if (c == 0) {
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2152));
} else {
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
}
settings_list_to_scsi[d] = c;
d++;
}
}
c++;
}
SendMessage(h, CB_SETCURSEL, settings_scsi_to_list[temp_scsi_card], 0);
EnableWindow(h, d ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CONFIGURE_SCSI);
if (scsi_card_has_config(temp_scsi_card))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
recalc_hdc_list(hdlg, temp_machine, 0);
h = GetDlgItem(hdlg, IDC_COMBO_IDE_TER);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_5376));
for (c = 0; c < 11; c++) {
swprintf(temp, sizeof_w(temp), plat_get_string(IDS_2155), valid_ide_irqs[c]);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
}
if (temp_ide_ter)
SendMessage(h, CB_SETCURSEL, find_irq_in_array(temp_ide_ter_irq, 0), 0);
else
SendMessage(h, CB_SETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_IDE_QUA);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_5376));
for (c = 0; c < 11; c++) {
swprintf(temp, sizeof_w(temp), plat_get_string(IDS_2155), valid_ide_irqs[c]);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
}
if (temp_ide_qua)
SendMessage(h, CB_SETCURSEL, find_irq_in_array(temp_ide_qua_irq, 1), 0);
else
SendMessage(h, CB_SETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_BUGGER);
SendMessage(h, BM_SETCHECK, temp_bugger, 0);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_CONFIGURE_SCSI:
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)scsi_card_getdevice(temp_scsi_card));
break;
case IDC_COMBO_SCSI:
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_SCSI);
if (scsi_card_has_config(temp_scsi_card))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
break;
}
return FALSE;
case WM_SAVESETTINGS:
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (hdc_names[c])
temp_hdc_type = hdc_get_from_internal_name(hdc_names[c]);
else
temp_hdc_type = 0;
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBO_IDE_TER);
temp_ide_ter = SendMessage(h, CB_GETCURSEL, 0, 0);
if (temp_ide_ter > 1) {
temp_ide_ter_irq = valid_ide_irqs[temp_ide_ter - 1];
temp_ide_ter = 1;
}
h = GetDlgItem(hdlg, IDC_COMBO_IDE_QUA);
temp_ide_qua = SendMessage(h, CB_GETCURSEL, 0, 0);
if (temp_ide_qua > 1) {
temp_ide_qua_irq = valid_ide_irqs[temp_ide_qua - 1];
temp_ide_qua = 1;
}
h = GetDlgItem(hdlg, IDC_CHECK_BUGGER);
temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0);
return FALSE;
default:
break;
}
return FALSE;
}

View File

@@ -0,0 +1,130 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_ports.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* Ports Dialog *
* *
************************************************************************/
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
const char *stransi;
HWND h;
int c, d, i;
switch (message) {
case WM_INITDIALOG:
for (i = 0; i < PARALLEL_MAX; i++) {
/* Populate the "devices" list and select one. */
h = GetDlgItem(hdlg, IDC_COMBO_PARALLEL1+i);
c = d = 0;
while (1) {
stransi = parallel_device_get_name(c);
if (stransi == NULL)
break;
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
if (! strcmp(temp_parallel_device[i], parallel_device_get_internal_name(c)))
d = c;
c++;
}
SendMessage(h, CB_SETCURSEL, d, 0);
/* Enable or disable this port. */
d = parallel_enabled[i];
EnableWindow(h, d ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CHECK_PARALLEL1+i);
SendMessage(h, BM_SETCHECK, d, 0);
}
/* Set up the serial port controls. */
for (i = 0; i < SERIAL_MAX; i++) {
h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1+i);
SendMessage(h, BM_SETCHECK, temp_serial[i], 0);
}
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_CHECK_PARALLEL1:
case IDC_CHECK_PARALLEL2:
case IDC_CHECK_PARALLEL3:
h = GetDlgItem(hdlg, LOWORD(wParam));
d = SendMessage(h, BM_GETCHECK, 0, 0);
c = (LOWORD(wParam) - IDC_CHECK_PARALLEL1);
h = GetDlgItem(hdlg, IDC_COMBO_PARALLEL1+c);
EnableWindow(h, d ? TRUE : FALSE);
break;
}
return FALSE;
case WM_SAVESETTINGS:
for (i = 0; i < PARALLEL_MAX; i++) {
h = GetDlgItem(hdlg, IDC_CHECK_PARALLEL1+i);
temp_parallel[i] = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_PARALLEL1+i);
c = SendMessage(h, CB_GETCURSEL, 0, 0);
strcpy(temp_parallel_device[i], parallel_device_get_internal_name(c));
}
for (i = 0; i < SERIAL_MAX; i++) {
h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1+i);
temp_serial[i] = SendMessage(h, BM_GETCHECK, 0, 0);
}
return FALSE;
default:
break;
}
return FALSE;
}

1052
src/win/win_settings_remov.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,275 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_sound.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* Sound Dialog *
* *
************************************************************************/
static int
mpu401_present(void)
{
char *stransi;
stransi = sound_card_get_internal_name(temp_sound_card);
if (stransi != NULL) {
if (!strcmp(stransi, "sb16") || !strcmp(stransi, "sbawe32"))
return 1;
}
return temp_mpu401 ? 1 : 0;
}
static int
mpu401_standalone_allow(void)
{
char *n, *md;
n = sound_card_get_internal_name(temp_sound_card);
md = midi_device_get_internal_name(temp_midi_device);
if (n != NULL) {
if (!strcmp(n, "sb16") || !strcmp(n, "sbawe32"))
return 0;
}
if (md != NULL) {
if (! strcmp(md, "none"))
return 0;
}
return 1;
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
char *stransi;
const device_t *dev;
HWND h;
int c, d;
switch (message) {
case WM_INITDIALOG:
h = GetDlgItem(hdlg, IDC_COMBO_SOUND);
c = d = 0;
while (1) {
stransi = sound_card_getname(c);
if (stransi == NULL)
break;
settings_sound_to_list[c] = d;
if (sound_card_available(c)) {
dev = sound_card_getdevice(c);
if (device_is_valid(dev, machines[temp_machine].flags)) {
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
settings_list_to_sound[d] = c;
d++;
}
}
c++;
}
SendMessage(h, CB_SETCURSEL, settings_sound_to_list[temp_sound_card], 0);
EnableWindow(h, d ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CONFIGURE_SND);
if (sound_card_has_config(temp_sound_card))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
c = d = 0;
while (1) {
stransi = midi_device_getname(c);
if (stransi == NULL)
break;
settings_midi_to_list[c] = d;
if (midi_device_available(c)) {
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
settings_list_to_midi[d] = c;
d++;
}
c++;
}
SendMessage(h, CB_SETCURSEL, settings_midi_to_list[temp_midi_device], 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI);
if (midi_device_has_config(temp_midi_device))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
SendMessage(h, BM_SETCHECK, temp_mpu401, 0);
EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401);
EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CHECK_CMS);
SendMessage(h, BM_SETCHECK, temp_GAMEBLASTER, 0);
h = GetDlgItem(hdlg, IDC_CHECK_GUS);
SendMessage(h, BM_SETCHECK, temp_GUS, 0);
h = GetDlgItem(hdlg, IDC_CHECK_SSI);
SendMessage(h, BM_SETCHECK, temp_SSI2001, 0);
h = GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL);
SendMessage(h, BM_SETCHECK, temp_opl3_type, 0);
h = GetDlgItem(hdlg, IDC_CHECK_FLOAT);
SendMessage(h, BM_SETCHECK, temp_float, 0);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_SOUND:
h = GetDlgItem(hdlg, IDC_COMBO_SOUND);
temp_sound_card = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_SND);
if (sound_card_has_config(temp_sound_card))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
SendMessage(h, BM_SETCHECK, temp_mpu401, 0);
EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401);
EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE);
break;
case IDC_CONFIGURE_SND:
h = GetDlgItem(hdlg, IDC_COMBO_SOUND);
temp_sound_card = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)sound_card_getdevice(temp_sound_card));
break;
case IDC_COMBO_MIDI:
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
temp_midi_device = settings_list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI);
if (midi_device_has_config(temp_midi_device))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
SendMessage(h, BM_SETCHECK, temp_mpu401, 0);
EnableWindow(h, mpu401_standalone_allow() ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401);
EnableWindow(h, (mpu401_standalone_allow() && temp_mpu401) ? TRUE : FALSE);
break;
case IDC_CONFIGURE_MIDI:
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
temp_midi_device = settings_list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_device_getdevice(temp_midi_device));
break;
case IDC_CHECK_MPU401:
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MPU401);
EnableWindow(h, mpu401_present() ? TRUE : FALSE);
break;
case IDC_CONFIGURE_MPU401:
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)&mpu401_device);
break;
}
return FALSE;
case WM_SAVESETTINGS:
h = GetDlgItem(hdlg, IDC_COMBO_SOUND);
temp_sound_card = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
temp_midi_device = settings_list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_CMS);
temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_GUS);
temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_SSI);
temp_SSI2001 = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL);
temp_opl3_type = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_FLOAT);
temp_float = SendMessage(h, BM_GETCHECK, 0, 0);
return FALSE;
default:
break;
}
return FALSE;
}

View File

@@ -0,0 +1,193 @@
/*
* 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 Settings dialog.
*
* Version: @(#)win_settings_video.h 1.0.1 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
*
* 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.
*/
/************************************************************************
* *
* Video Dialog *
* *
************************************************************************/
static void
recalc_vid_list(HWND hdlg)
{
WCHAR temp[128];
const char *stransi;
HWND h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
int c = 0, d = 0;
int found_card = 0;
SendMessage(h, CB_RESETCONTENT, 0, 0);
SendMessage(h, CB_SETCURSEL, 0, 0);
while (1) {
/* Skip "internal" if machine doesn't have it. */
if (c == 1 && !(machines[temp_machine].flags&MACHINE_VIDEO)) {
c++;
continue;
}
stransi = video_card_getname(c);
if (! *stransi)
break;
if (video_card_available(c) && vid_present[video_new_to_old(c)] &&
device_is_valid(video_card_getdevice(c), machines[temp_machine].flags)) {
mbstowcs(temp, stransi, sizeof_w(temp));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp);
if (video_new_to_old(c) == temp_vid_card) {
SendMessage(h, CB_SETCURSEL, d, 0);
found_card = 1;
}
d++;
}
c++;
}
if (! found_card)
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, machines[temp_machine].fixed_vidcard ? FALSE : TRUE);
h = GetDlgItem(hdlg, IDC_CHECK_VOODOO);
EnableWindow(h, (machines[temp_machine].flags & MACHINE_PCI) ? TRUE:FALSE);
h = GetDlgItem(hdlg, IDC_BUTTON_VOODOO);
EnableWindow(h, ((machines[temp_machine].flags & MACHINE_PCI) && temp_voodoo) ? TRUE : FALSE);
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp[128];
char tempA[128];
int vid;
HWND h;
switch (message) {
case WM_INITDIALOG:
recalc_vid_list(hdlg);
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO_SPEED);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2131));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2133));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2134));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2135));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2136));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2137));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2138));
SendMessage(h, CB_SETCURSEL, temp_video_speed+1, 0);
h = GetDlgItem(hdlg, IDC_CHECK_VOODOO);
SendMessage(h, BM_SETCHECK, temp_voodoo, 0);
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp);
wcstombs(tempA, temp, sizeof(tempA));
vid = video_card_getid(tempA);
h = GetDlgItem(hdlg, IDC_CONFIGURE_VID);
if (video_card_has_config(vid))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_VIDEO:
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp);
wcstombs(tempA, temp, sizeof(tempA));
vid = video_card_getid(tempA);
temp_vid_card = video_new_to_old(vid);
h = GetDlgItem(hdlg, IDC_CONFIGURE_VID);
if (video_card_has_config(vid))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
break;
case IDC_CHECK_VOODOO:
h = GetDlgItem(hdlg, IDC_CHECK_VOODOO);
temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_BUTTON_VOODOO);
EnableWindow(h, temp_voodoo ? TRUE : FALSE);
break;
case IDC_BUTTON_VOODOO:
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)&voodoo_device);
break;
case IDC_CONFIGURE_VID:
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp);
wcstombs(tempA, temp, sizeof(temp));
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)video_card_getdevice(video_card_getid(tempA)));
break;
}
return FALSE;
case WM_SAVESETTINGS:
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp);
wcstombs(tempA, temp, sizeof(tempA));
temp_vid_card = video_new_to_old(video_card_getid(tempA));
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO_SPEED);
temp_video_speed = SendMessage(h, CB_GETCURSEL, 0, 0) - 1;
h = GetDlgItem(hdlg, IDC_CHECK_VOODOO);
temp_voodoo = SendMessage(h, BM_GETCHECK, 0, 0);
return FALSE;
default:
break;
}
return FALSE;
}

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Status Bar module.
*
* Version: @(#)win_stbar.c 1.0.5 2018/03/31
* Version: @(#)win_stbar.c 1.0.6 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -661,14 +661,9 @@ ui_sb_update_panes(void)
}
for (i=0; i<CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
if (((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_ONLY) &&
(cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_AND_DMA)) &&
!(hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
continue;
}
@@ -676,20 +671,16 @@ ui_sb_update_panes(void)
(scsi_card_current == 0)) {
continue;
}
if (cdrom_drives[i].bus_type != 0) {
sb_parts++;
}
}
for (i=0; i<ZIP_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
if (((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_ONLY) &&
(zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_AND_DMA)) &&
!(hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
continue;
}
@@ -697,6 +688,7 @@ ui_sb_update_panes(void)
(scsi_card_current == 0)) {
continue;
}
if (zip_drives[i].bus_type != 0) {
sb_parts++;
}
@@ -706,22 +698,22 @@ ui_sb_update_panes(void)
sb_parts++;
}
}
if (c_mfm && (hdint || !memcmp(hdc_name, "mfm", 3))) {
if (c_mfm && (hdint || (hdc_type == hdc_get_from_internal_name("mfm")))) {
/* MFM drives, and MFM or Internal controller. */
sb_parts++;
}
if (c_esdi && (hdint || !memcmp(hdc_name, "esdi", 4))) {
if (c_esdi && (hdint || (hdc_type == hdc_get_from_internal_name("esdi")))) {
/* ESDI drives, and ESDI or Internal controller. */
sb_parts++;
}
if (c_xtide && !memcmp(hdc_name, "xtide", 5)) {
if (c_xtide && (hdc_type == hdc_get_from_internal_name("ide"))) {
sb_parts++;
}
if (c_ide_pio && (hdint || !memcmp(hdc_name, "ide", 3))) {
if (c_ide_pio && (hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
/* IDE_PIO drives, and IDE or Internal controller. */
sb_parts++;
}
if (c_ide_dma && (hdint || !memcmp(hdc_name, "ide", 3))) {
if (c_ide_dma && (hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
/* IDE_DMA drives, and IDE or Internal controller. */
sb_parts++;
}
@@ -758,12 +750,12 @@ ui_sb_update_panes(void)
for (i=0; i<CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
!(hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
!(hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
continue;
}
if ((cdrom_drives[i].bus_type == CDROM_BUS_SCSI) && (scsi_card_current == 0)) {
@@ -779,12 +771,12 @@ ui_sb_update_panes(void)
for (i=0; i<ZIP_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
!(hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
!(hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
continue;
}
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && (scsi_card_current == 0)) {
@@ -805,31 +797,31 @@ ui_sb_update_panes(void)
sb_parts++;
}
}
if (c_mfm && (hdint || !memcmp(hdc_name, "mfm", 3))) {
if (c_mfm && (hdint || (hdc_type == hdc_get_from_internal_name("mfm")))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_MFM;
sb_parts++;
}
if (c_esdi && (hdint || !memcmp(hdc_name, "esdi", 4))) {
if (c_esdi && (hdint || (hdc_type == hdc_get_from_internal_name("esdi")))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_ESDI;
sb_parts++;
}
if (c_xtide && !memcmp(hdc_name, "xtide", 5)) {
if (c_xtide && (hdc_type == hdc_get_from_internal_name("xtide"))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_XTIDE;
sb_parts++;
}
if (c_ide_pio && (hdint || !memcmp(hdc_name, "ide", 3))) {
if (c_ide_pio && (hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_IDE_PIO_ONLY;
sb_parts++;
}
if (c_ide_dma && (hdint || !memcmp(hdc_name, "ide", 3))) {
if (c_ide_dma && (hdint || (hdc_type == hdc_get_from_internal_name("ide")))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_IDE_PIO_AND_DMA;

View File

@@ -8,7 +8,7 @@
*
* Implement the user Interface module.
*
* Version: @(#)win_ui.c 1.0.9 2018/04/02
* Version: @(#)win_ui.c 1.0.10 2018/04/05
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -428,6 +428,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_COMMAND:
UpdateWindow(hwnd);
hmenu = GetMenu(hwnd);
switch (LOWORD(wParam)) {
case IDM_ACTION_SCREENSHOT: