From ea5a226a9779dfaca4055a5a514e53bbc4705b61 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 6 Sep 2018 14:38:43 +0200 Subject: [PATCH] Brought the ISA memory card emulation and some other things up to par with VARCem and fixed the ISA memory card configuration. --- src/config.c | 4 +- src/device.c | 95 +++++++------- src/device.h | 55 ++++---- src/isamem.c | 255 ++++++++++++++++++++++-------------- src/isamem.h | 6 +- src/lang/language.h | 5 +- src/sound/midi_fluidsynth.c | 2 +- src/win/86Box.rc | 5 +- src/win/win_settings.c | 105 ++++----------- 9 files changed, 267 insertions(+), 265 deletions(-) diff --git a/src/config.c b/src/config.c index f0b797dab..733666e3e 100644 --- a/src/config.c +++ b/src/config.c @@ -8,7 +8,7 @@ * * Configuration file handler. * - * Version: @(#)config.c 1.0.51 2018/09/03 + * Version: @(#)config.c 1.0.52 2018/09/06 * * Authors: Sarah Walker, * Miran Grca, @@ -1743,7 +1743,7 @@ save_other_peripherals(void) config_delete_var(cat, temp); else config_set_string(cat, temp, - isamem_get_internal_name(isamem_type[c])); + (char *) isamem_get_internal_name(isamem_type[c])); } if (isartc_type == 0) diff --git a/src/device.c b/src/device.c index cd24026d6..865ebf42b 100644 --- a/src/device.c +++ b/src/device.c @@ -9,7 +9,7 @@ * Implementation of the generic device interface to handle * all devices attached to the emulator. * - * Version: @(#)device.c 1.0.10 2018/09/04 + * Version: @(#)device.c 1.0.15 2018/09/06 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -91,19 +91,18 @@ device_log(const char *format, ...) void device_init(void) { - clonedev_t *ptr; - + clonedev_t *ptr; + memset(devices, 0x00, sizeof(devices)); - - ptr = NULL; - while (clones != NULL) - { - ptr = clones->next; - free(clones); - clones = ptr; - } - - clones = NULL; + + ptr = NULL; + while (clones != NULL) { + ptr = clones->next; + free(clones); + clones = ptr; + } + + clones = NULL; } @@ -150,14 +149,14 @@ device_clone(const device_t *master) return((const device_t *)dev); } - + void * device_add(const device_t *d) { void *priv = NULL; int c; - for (c=0; c<256; c++) { + for (c = 0; c < 256; c++) { if (devices[c] == (device_t *)d) { device_log("DEVICE: device already exists!\n"); return(NULL); @@ -169,22 +168,18 @@ device_add(const device_t *d) device_current = (device_t *)d; - devices[c] = (device_t *)d; - if (d->init != NULL) { priv = d->init(d); if (priv == NULL) { if (d->name) device_log("DEVICE: device '%s' init failed\n", d->name); - else + else device_log("DEVICE: device init failed\n"); - - device_priv[c] = NULL; - return(NULL); } } + devices[c] = (device_t *)d; device_priv[c] = priv; return(priv); @@ -197,7 +192,7 @@ device_add_ex(const device_t *d, void *priv) { int c; - for (c=0; c<256; c++) { + for (c = 0; c < 256; c++) { if (devices[c] == (device_t *)d) { fatal("device_add: device already exists!\n"); break; @@ -219,7 +214,7 @@ device_close_all(void) { int c; - for (c=0; cclose != NULL) devices[c]->close(device_priv[c]); @@ -234,7 +229,7 @@ device_reset_all(void) { int c; - for (c=0; creset != NULL) devices[c]->reset(device_priv[c]); @@ -263,7 +258,7 @@ device_get_priv(const device_t *d) { int c; - for (c=0; cspeed_changed != NULL) devices[c]->speed_changed(device_priv[c]); @@ -308,7 +303,7 @@ device_force_redraw(void) { int c; - for (c=0; cforce_redraw != NULL) devices[c]->force_redraw(device_priv[c]); @@ -317,14 +312,14 @@ device_force_redraw(void) } -char * -device_get_config_string(char *s) +const char * +device_get_config_string(const char *s) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) - return(config_get_string((char *)device_current->name, s, (char *)c->default_string)); + return(config_get_string((char *) device_current->name, (char *) s, (char *) c->default_string)); c++; } @@ -334,13 +329,13 @@ device_get_config_string(char *s) int -device_get_config_int(char *s) +device_get_config_int(const char *s) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) - return(config_get_int((char *)device_current->name, s, c->default_int)); + return(config_get_int((char *) device_current->name, (char *) s, c->default_int)); c++; } @@ -350,29 +345,29 @@ device_get_config_int(char *s) int -device_get_config_int_ex(char *s, int default_int) +device_get_config_int_ex(const char *s, int def) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) - return(config_get_int((char *)device_current->name, s, default_int)); + return(config_get_int((char *) device_current->name, (char *) s, def)); c++; } - return(default_int); + return(def); } int -device_get_config_hex16(char *s) +device_get_config_hex16(const char *s) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) - return(config_get_hex16((char *)device_current->name, s, c->default_int)); + return(config_get_hex16((char *) device_current->name, (char *) s, c->default_int)); c++; } @@ -382,13 +377,13 @@ device_get_config_hex16(char *s) int -device_get_config_hex20(char *s) +device_get_config_hex20(const char *s) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) - return(config_get_hex20((char *)device_current->name, s, c->default_int)); + return(config_get_hex20((char *) device_current->name, (char *) s, c->default_int)); c++; } @@ -398,29 +393,29 @@ device_get_config_hex20(char *s) int -device_get_config_mac(char *s, int default_int) +device_get_config_mac(const char *s, int def) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) - return(config_get_mac((char *)device_current->name, s, default_int)); + return(config_get_mac((char *) device_current->name, (char *) s, def)); c++; } - return(default_int); + return(def); } void -device_set_config_int(char *s, int val) +device_set_config_int(const char *s, int val) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) { - config_set_int((char *)device_current->name, s, val); + config_set_int((char *) device_current->name, (char *) s, val); break; } @@ -430,13 +425,13 @@ device_set_config_int(char *s, int val) void -device_set_config_hex16(char *s, int val) +device_set_config_hex16(const char *s, int val) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) { - config_set_hex16((char *)device_current->name, s, val); + config_set_hex16((char *) device_current->name, (char *) s, val); break; } @@ -446,13 +441,13 @@ device_set_config_hex16(char *s, int val) void -device_set_config_hex20(char *s, int val) +device_set_config_hex20(const char *s, int val) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) { - config_set_hex20((char *)device_current->name, s, val); + config_set_hex20((char *) device_current->name, (char *) s, val); break; } @@ -462,13 +457,13 @@ device_set_config_hex20(char *s, int val) void -device_set_config_mac(char *s, int val) +device_set_config_mac(const char *s, int val) { const device_config_t *c = device_current->config; while (c && c->type != -1) { if (! strcmp(s, c->name)) { - config_set_mac((char *)device_current->name, s, val); + config_set_mac((char *) device_current->name, (char *) s, val); break; } diff --git a/src/device.h b/src/device.h index 9e6508172..727a80d4b 100644 --- a/src/device.h +++ b/src/device.h @@ -8,7 +8,7 @@ * * Definitions for the device handler. * - * Version: @(#)device.h 1.0.6 2018/09/02 + * Version: @(#)device.h 1.0.8 2018/09/06 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -53,7 +53,7 @@ enum { - DEVICE_NOT_WORKING = 1, /* does not currently work correctly and will be disabled in a release build*/ + DEVICE_UNSTABLE = 1, /* unstable device, be cautious */ DEVICE_AT = 2, /* requires an AT-compatible system */ DEVICE_PS2 = 4, /* requires a PS/1 or PS/2 system */ DEVICE_ISA = 8, /* requires the ISA bus */ @@ -99,11 +99,11 @@ typedef struct _device_ { uint32_t local; /* flags local to device */ void *(*init)(const struct _device_ *); - void (*close)(void *p); - void (*reset)(void *p); + void (*close)(void *priv); + void (*reset)(void *priv); int (*available)(/*void*/); - void (*speed_changed)(void *p); - void (*force_redraw)(void *p); + void (*speed_changed)(void *priv); + void (*force_redraw)(void *priv); const device_config_t *config; } device_t; @@ -113,29 +113,30 @@ typedef struct _device_ { extern "C" { #endif -extern void device_init(void); +extern void device_init(void); extern const device_t * device_clone(const device_t *master); -extern void *device_add(const device_t *d); -extern void device_add_ex(const device_t *d, void *priv); -extern void device_close_all(void); -extern void device_reset_all(void); -extern void device_reset_all_pci(void); -extern void *device_get_priv(const device_t *d); -extern int device_available(const device_t *d); -extern void device_speed_changed(void); -extern void device_force_redraw(void); +extern void *device_add(const device_t *); +extern void device_add_ex(const device_t *d, void *priv); +extern void device_close_all(void); +extern void device_reset_all(void); +extern void device_reset_all_pci(void); +extern void *device_get_priv(const device_t *); +extern int device_available(const device_t *); +extern void device_speed_changed(void); +extern void device_force_redraw(void); -extern int device_get_config_int(char *name); -extern int device_get_config_int_ex(char *s, int default_int); -extern int device_get_config_hex16(char *name); -extern int device_get_config_hex20(char *name); -extern int device_get_config_mac(char *name, int default_int); -extern void device_set_config_int(char *s, int val); -extern void device_set_config_hex16(char *s, int val); -extern void device_set_config_hex20(char *s, int val); -extern void device_set_config_mac(char *s, int val); -extern char *device_get_config_string(char *name); -extern int device_is_valid(const device_t *device, int machine_flags); +extern int device_is_valid(const device_t *, int machine_flags); + +extern int device_get_config_int(const char *name); +extern int device_get_config_int_ex(const char *s, int dflt_int); +extern int device_get_config_hex16(const char *name); +extern int device_get_config_hex20(const char *name); +extern int device_get_config_mac(const char *name, int dflt_int); +extern void device_set_config_int(const char *s, int val); +extern void device_set_config_hex16(const char *s, int val); +extern void device_set_config_hex20(const char *s, int val); +extern void device_set_config_mac(const char *s, int val); +extern const char *device_get_config_string(const char *name); extern int machine_get_config_int(char *s); extern char *machine_get_config_string(char *s); diff --git a/src/isamem.c b/src/isamem.c index fab98eb3a..3139cb199 100644 --- a/src/isamem.c +++ b/src/isamem.c @@ -32,7 +32,7 @@ * TODO: The EV159 is supposed to support 16b EMS transfers, but the * EMM.sys driver for it doesn't seem to want to do that.. * - * Version: @(#)isamem.c 1.0.3 2018/09/04 + * Version: @(#)isamem.c 1.0.5 2018/09/06 * * Author: Fred N. van Kempen, * @@ -83,6 +83,9 @@ #include "plat.h" #include "isamem.h" + +#define ISAMEM_DEBUG 0 + #define RAM_TOPMEM (640 << 10) /* end of low memory */ #define RAM_UMAMEM (384 << 10) /* upper memory block */ #define RAM_EXTMEM (1024 << 10) /* start of high memory */ @@ -150,6 +153,15 @@ isamem_log(const char *fmt, ...) } +/* Local variables. */ +static const device_t *instance[ISAMEM_MAX] = { + NULL, + NULL, + NULL, + NULL +}; + + /* Read one byte from onboard RAM. */ static uint8_t ram_readb(uint32_t addr, void *priv) @@ -218,6 +230,9 @@ ems_readb(uint32_t addr, void *priv) /* Grab the data. */ ret = *(uint8_t *)(dev->ems[vpage].addr + (addr - map->base)); +#if ISAMEM_DEBUG + if ((addr % 4096)==0) isamem_log("EMS readb(%06x) = %02x\n",addr-map->base,ret); +#endif return(ret); } @@ -237,6 +252,9 @@ ems_readw(uint32_t addr, void *priv) /* Grab the data. */ ret = *(uint16_t *)(dev->ems[vpage].addr + (addr - map->base)); +#if ISAMEM_DEBUG + if ((addr % 4096)==0) isamem_log("EMS readw(%06x) = %04x\n",addr-map->base,ret); +#endif return(ret); } @@ -254,6 +272,9 @@ ems_writeb(uint32_t addr, uint8_t val, void *priv) vpage = ((addr & 0xffff) / EMS_PGSIZE); /* Write the data. */ +#if ISAMEM_DEBUG + if ((addr % 4096)==0) isamem_log("EMS writeb(%06x, %02x)\n",addr-map->base,val); +#endif *(uint8_t *)(dev->ems[vpage].addr + (addr - map->base)) = val; } @@ -270,6 +291,9 @@ ems_writew(uint32_t addr, uint16_t val, void *priv) vpage = ((addr & 0xffff) / EMS_PGSIZE); /* Write the data. */ +#if ISAMEM_DEBUG + if ((addr % 4096)==0) isamem_log("EMS writew(%06x, %04x)\n",addr-map->base,val); +#endif *(uint16_t *)(dev->ems[vpage].addr + (addr - map->base)) = val; } @@ -284,7 +308,7 @@ ems_read(uint16_t port, void *priv) /* Get the viewport page number. */ vpage = (port / EMS_PGSIZE); - port &= (EMS_PGSIZE - 1); + port &= (EMS_PGSIZE - 1); switch(port - dev->base_addr) { case 0x0000: /* page number register */ @@ -292,12 +316,14 @@ ems_read(uint16_t port, void *priv) if (dev->ems[vpage].enabled) ret |= 0x80; break; - + case 0x0001: /* W/O */ break; } +#if ISAMEM_DEBUG isamem_log("ISAMEM: read(%04x) = %02x)\n", port, ret); +#endif return(ret); } @@ -312,11 +338,13 @@ ems_write(uint16_t port, uint8_t val, void *priv) /* Get the viewport page number. */ vpage = (port / EMS_PGSIZE); - port &= (EMS_PGSIZE - 1); + port &= (EMS_PGSIZE - 1); +#if ISAMEM_DEBUG isamem_log("ISAMEM: write(%04x, %02x) page=%d\n", port, val, vpage); - - switch(port - dev->base_addr) { +#endif + + switch(port - dev->base_addr) { case 0x0000: /* page mapping registers */ /* Set the page number. */ dev->ems[vpage].enabled = (val & 0x80); @@ -355,11 +383,17 @@ ems_write(uint16_t port, uint8_t val, void *priv) * * 00 04 08 Address * ----------------- + * 80 c0 e0 C0000 + * 80 c0 e0 C4000 + * 80 c0 e0 C8000 + * 80 c0 e0 CC000 + * 80 c0 e0 D0000 + * 80 c0 e0 D4000 + * 80 c0 e0 D8000 + * 80 c0 e0 DC000 * 80 c0 e0 E0000 */ - - isamem_log("EMS: write(%02x) to register 1 !\n"); - +isamem_log("EMS: write(%02x) to register 1 !\n"); dev->ems[vpage].frame = val; if (val) dev->flags |= FLAG_CONFIG; @@ -380,10 +414,13 @@ isamem_init(const device_t *info) int i; /* Find our device and create an instance. */ + for (i = 0; i < ISAMEM_MAX; i++) + if (instance[i] == info) break; dev = (memdev_t *)malloc(sizeof(memdev_t)); memset(dev, 0x00, sizeof(memdev_t)); dev->name = info->name; dev->board = info->local; + dev->instance = i; /* Do per-board initialization. */ tot = 0; @@ -403,12 +440,12 @@ isamem_init(const device_t *info) break; case 3: /* Micro Mainframe EMS-5150(T) */ - dev->base_addr = device_get_config_hex16("base"); - dev->total_size = device_get_config_int("size"); - dev->frame_addr = 0xD0000; - dev->flags |= (FLAG_EMS | FLAG_CONFIG); - break; - + dev->base_addr = device_get_config_hex16("base"); + dev->total_size = device_get_config_int("size"); + dev->frame_addr = 0xD0000; + dev->flags |= (FLAG_EMS | FLAG_CONFIG); + break; + case 10: /* Everex EV-159 RAM 3000 */ dev->base_addr = device_get_config_hex16("base"); dev->total_size = device_get_config_int("size"); @@ -440,18 +477,25 @@ dev->frame_addr = 0xE0000; /* Say hello! */ isamem_log("ISAMEM: %s (%iKB", info->name, dev->total_size); - if (dev->total_size != tot) isamem_log(", %iKB for RAM", tot); + if (tot && (dev->total_size != tot)) + isamem_log(", %iKB for RAM", tot); if (dev->flags & FLAG_FAST) isamem_log(", FAST"); if (dev->flags & FLAG_WIDE) isamem_log(", 16BIT"); isamem_log(")\n"); /* Force (back to) 8-bit bus if needed. */ - if (AT) { - if (! cpu_16bitbus) - isamem_log("ISAMEM: *WARNING* this board will slow down your PC!\n"); + if (dev->flags & FLAG_WIDE) { + if (AT) { + if (! cpu_16bitbus) + isamem_log("ISAMEM: *WARNING* this board will slow down your PC!\n"); + } else { + isamem_log("ISAMEM: not AT+ system, forcing 8-bit mode!\n"); + dev->flags &= ~FLAG_WIDE; + } } else { - isamem_log("ISAMEM: not AT+ system, forcing 8-bit mode!\n"); - dev->flags &= ~FLAG_WIDE; + if (AT) { + isamem_log("ISAMEM: *WARNING* this board will slow down your PC!\n"); + } } /* Allocate and initialize our RAM. */ @@ -582,7 +626,7 @@ dev->frame_addr = 0xE0000; dev->ems_start = ptr - dev->ram; dev->ems_size = t >> 10; dev->ems_pages = t / EMS_PGSIZE; - isamem_log("ISAMEM: EMS enabled, I/O=%04xH, %iKB (%i pages)", + isamem_log("ISAMEM: EMS enabled, I/O=%04XH, %iKB (%i pages)", dev->base_addr, dev->ems_size, dev->ems_pages); if (dev->frame_addr > 0) isamem_log(", Frame=%05XH", dev->frame_addr); @@ -616,7 +660,7 @@ dev->frame_addr = 0xE0000; } } - /* Just so its not NULL. */ + /* Let them know our device instance. */ return((void *)dev); } @@ -637,10 +681,11 @@ isamem_close(void *priv) } if (dev->ram != NULL) - free(dev->ram); + free(dev->ram); - if (dev != NULL) - free(dev); + instance[dev->instance] = NULL; + + free(dev); } @@ -650,7 +695,7 @@ static const device_config_t ibmxt_config[] = "size", "Memory Size", CONFIG_SPINNER, "", 128, { { 0 } }, { { 0 } }, - { 0, 256, 16 } + { 0, 512, 16 } }, { "start", "Start Address", CONFIG_SPINNER, "", 256, @@ -667,12 +712,8 @@ static const device_t ibmxt_device = { "IBM PC/XT Memory Expansion", DEVICE_ISA, 0, - isamem_init, - isamem_close, - NULL, - NULL, - NULL, - NULL, + isamem_init, isamem_close, NULL, + NULL, NULL, NULL, ibmxt_config }; @@ -705,24 +746,25 @@ static const device_t ibmat_device = { ibmat_config }; + static const device_config_t p5pak_config[] = - { - { - "size", "Memory Size", CONFIG_SPINNER, "", 128, - { { 0 } }, - { { 0 } }, - { 0, 384, 64 } - }, - { - "start", "Start Address", CONFIG_SPINNER, "", 512, - { { 0 } }, - { { 0 } }, - { 64, 576, 64 } - }, - { - "", "", -1 - } - }; +{ + { + "size", "Memory Size", CONFIG_SPINNER, "", 128, + { { 0 } }, + { { 0 } }, + { 0, 384, 64 } + }, + { + "start", "Start Address", CONFIG_SPINNER, "", 512, + { { 0 } }, + { { 0 } }, + { 64, 576, 64 } + }, + { + "", "", -1 + } +}; static const device_t p5pak_device = { "Paradise Systems 5-PAK", @@ -733,40 +775,41 @@ static const device_t p5pak_device = { p5pak_config }; + static const device_config_t ems5150_config[] = { - { - "size", "Memory Size", CONFIG_SPINNER, "", 256, - { { 0 } }, - { { 0 } }, - { 0, 2048, 64 } - }, - { - "base", "Address", CONFIG_HEX16, "", 0, - { - { - "Disabled", 0 - }, - { - "Board 1", 0x0208 - }, - { - "Board 2", 0x020a - }, - { - "Board 3", 0x020c - }, - { - "Board 4", 0x020e - }, - { - "" - } - }, - }, - { - "", "", -1 - } + { + "size", "Memory Size", CONFIG_SPINNER, "", 256, + { { 0 } }, + { { 0 } }, + { 0, 2048, 64 } + }, + { + "base", "Address", CONFIG_HEX16, "", 0, + { + { + "Disabled", 0 + }, + { + "Board 1", 0x0208 + }, + { + "Board 2", 0x020a + }, + { + "Board 3", 0x020c + }, + { + "Board 4", 0x020e + }, + { + "" + } + }, + }, + { + "", "", -1 + } }; static const device_t ems5150_device = { @@ -778,6 +821,7 @@ static const device_t ems5150_device = { ems5150_config }; + static const device_config_t ev159_config[] = { { @@ -987,17 +1031,25 @@ static const device_t isamem_rampage_device = { static const struct { - const char *name; const char *internal_name; const device_t *dev; } boards[] = { - { "None", "none", NULL, }, - { "IBM PC/XT Memory Expansion", "ibmxt", &ibmxt_device, }, - { "IBM PC/AT Memory Expansion", "ibmat", &ibmat_device, }, - { "Micro Mainframe EMS-5150(T)", "ems5150", &ems5150_device }, - { "Paradise Systems 5-PAK", "p5pak", &p5pak_device }, - { "Everex EV-159 RAM 3000 Deluxe", "ev159", &ev159_device, }, - { "", "", NULL, }, + { "none", NULL }, + { "ibmxt", &ibmxt_device }, + { "ibmat", &ibmat_device }, + { "p5pak", &p5pak_device }, + { "ems5150", &ems5150_device }, + { "ev159", &ev159_device }, +#ifdef USE_ISAMEM_BRAT + { "brat", &brat_device }, +#endif +#ifdef USE_ISAMEM_RAMPAGE + { "rampage", &rampage_device }, +#endif +#ifdef USE_ISAMEM_IAB + { "iab", &iab_device }, +#endif + { NULL, NULL } }; @@ -1013,35 +1065,40 @@ isamem_reset(void) /* Clone the device. */ dev = device_clone(boards[k].dev); - + + /* Store the device instance. */ + instance[i] = dev; + /* Add the instance to the system. */ device_add(dev); } } -char * +const char * isamem_get_name(int board) { - return((char *)boards[board].name); + if (boards[board].dev == NULL) return(NULL); + + return(boards[board].dev->name); } -char * +const char * isamem_get_internal_name(int board) { - return((char *)boards[board].internal_name); + return(boards[board].internal_name); } int -isamem_get_from_internal_name(char *s) +isamem_get_from_internal_name(const char *s) { int c = 0; - while (strlen((char *) boards[c].internal_name)) { - if (!strcmp((char *)boards[c].internal_name, s)) + while (boards[c].internal_name != NULL) { + if (! strcmp(boards[c].internal_name, s)) return(c); c++; } @@ -1054,5 +1111,5 @@ isamem_get_from_internal_name(char *s) const device_t * isamem_get_device(int board) { - return(boards[board].dev); + return(instance[board]); } diff --git a/src/isamem.h b/src/isamem.h index 955103d71..a612df500 100644 --- a/src/isamem.h +++ b/src/isamem.h @@ -64,9 +64,9 @@ extern const device_t isamem_ev159_device; /* Functions. */ extern void isamem_reset(void); -extern char *isamem_get_name(int t); -extern char *isamem_get_internal_name(int t); -extern int isamem_get_from_internal_name(char *s); +extern const char *isamem_get_name(int t); +extern const char *isamem_get_internal_name(int t); +extern int isamem_get_from_internal_name(const char *s); extern const device_t *isamem_get_device(int t); #ifdef __cplusplus diff --git a/src/lang/language.h b/src/lang/language.h index 39e3aff6a..6f2f4dcae 100644 --- a/src/lang/language.h +++ b/src/lang/language.h @@ -10,7 +10,7 @@ * * NOTE: FIXME: Strings 2176 and 2193 are same. * - * Version: @(#)language.h 1.0.8 2018/05/25 + * Version: @(#)language.h 1.0.9 2018/09/06 * * Author: Fred N. van Kempen, * @@ -92,6 +92,7 @@ #define IDS_2116 2116 // "%u MB (CHS: %i, %i, %i)" #define IDS_2117 2117 // "Floppy %i (%s): %ls" #define IDS_2118 2118 // "All floppy images (*.0??;*.." +#define IDS_2119 2119 // "You must save the settings.." #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -170,7 +171,7 @@ #define IDS_LANG_ENUS IDS_7168 -#define STR_NUM_2048 71 +#define STR_NUM_2048 72 #define STR_NUM_3072 11 #define STR_NUM_4096 18 #define STR_NUM_4352 7 diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 22d318fbf..55a579faf 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -258,7 +258,7 @@ void* fluidsynth_init(const device_t *info) data->synth = f_new_fluid_synth(data->settings); - char* sound_font = device_get_config_string("sound_font"); + char* sound_font = (char *) device_get_config_string("sound_font"); data->sound_font = f_fluid_synth_sfload(data->synth, sound_font, 1); if (device_get_config_int("chorus")) diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 69b011bc4..328c574f8 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1,4 +1,4 @@ -/* +/* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent @@ -8,7 +8,7 @@ * * Application resource script for Windows. * - * Version: @(#)86Box.rc 1.0.41 2018/09/02 + * Version: @(#)86Box.rc 1.0.42 2018/09/06 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -888,6 +888,7 @@ BEGIN IDS_2116 "%u MB (CHS: %i, %i, %i)" IDS_2117 "Floppy %i (%s): %ls" IDS_2118 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0" + IDS_2119 "You must save the settings first before attempting to configure the memory boards" END STRINGTABLE DISCARDABLE diff --git a/src/win/win_settings.c b/src/win/win_settings.c index fac579bb4..b9d814b88 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Windows 86Box Settings dialog handler. * - * Version: @(#)win_settings.c 1.0.55 2018/09/03 + * Version: @(#)win_settings.c 1.0.56 2018/09/06 * * Authors: Miran Grca, * David Hrdlička, @@ -1493,6 +1493,8 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa int c, d, e, temp_hdc_type; LPTSTR lptsTemp; const device_t *scsi_dev; + const device_t *dev; + char *s; switch (message) { case WM_INITDIALOG: @@ -1563,7 +1565,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa e = 0; h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); for (d = 0; ; d++) { - char *s = isartc_get_name(d); + s = isartc_get_name(d); if (!s[0]) break; @@ -1589,26 +1591,21 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa /* Populate the ISA memory card dropdowns. */ for (c = 0; c < ISAMEM_MAX; c++) { - e = 0; h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1 + c); for (d = 0; ; d++) { - char *s = isamem_get_name(d); - - if (!s[0]) + s = (char *) isamem_get_internal_name(d); + if (s == NULL) break; - settings_device_to_list[2 + c][d] = e; - if (d == 0) { /* Translate "None". */ - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, + (LPARAM)win_get_string(IDS_2112)); } else { + s = (char *) isamem_get_name(d); mbstowcs(lptsTemp, s, strlen(s) + 1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)lptsTemp); } - - settings_list_to_device[2 + c][e] = d; - e++; } SendMessage(h, CB_SETCURSEL, temp_isamem[c], 0); h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c); @@ -1617,7 +1614,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa else EnableWindow(h, FALSE); } - + free(lptsTemp); return TRUE; @@ -1675,76 +1672,31 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa EnableWindow(h, FALSE); break; - case IDC_CONFIGURE_ISAMEM_1: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1); - temp_isamem[0] = settings_list_to_device[2][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[0])); - break; - - case IDC_CONFIGURE_ISAMEM_2: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_2); - temp_isamem[1] = settings_list_to_device[3][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[1])); - break; - - case IDC_CONFIGURE_ISAMEM_3: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_3); - temp_isamem[2] = settings_list_to_device[4][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[2])); - break; - - case IDC_CONFIGURE_ISAMEM_4: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_4); - temp_isamem[3] = settings_list_to_device[5][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[3])); - break; - case IDC_COMBO_ISAMEM_1: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1); - temp_isamem[0] = settings_list_to_device[2][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1); - if (temp_isamem[0] != 0) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - break; - case IDC_COMBO_ISAMEM_2: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_2); - temp_isamem[1] = settings_list_to_device[3][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_2); - if (temp_isamem[1] != 0) - EnableWindow(h, TRUE); - else - EnableWindow(h, FALSE); - break; - case IDC_COMBO_ISAMEM_3: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_3); - temp_isamem[2] = settings_list_to_device[4][SendMessage(h, CB_GETCURSEL, 0, 0)]; + case IDC_COMBO_ISAMEM_4: + c = LOWORD(wParam) - IDC_COMBO_ISAMEM_1; + h = GetDlgItem(hdlg, LOWORD(wParam)); + temp_isamem[c] = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_3); - if (temp_isamem[2] != 0) + h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c); + if (temp_isamem[c] != 0) EnableWindow(h, TRUE); else EnableWindow(h, FALSE); break; - case IDC_COMBO_ISAMEM_4: - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_4); - temp_isamem[3] = settings_list_to_device[5][SendMessage(h, CB_GETCURSEL, 0, 0)]; - - h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_4); - if (temp_isamem[3] != 0) - EnableWindow(h, TRUE); + case IDC_CONFIGURE_ISAMEM_1: + case IDC_CONFIGURE_ISAMEM_2: + case IDC_CONFIGURE_ISAMEM_3: + case IDC_CONFIGURE_ISAMEM_4: + c = LOWORD(wParam) - IDC_CONFIGURE_ISAMEM_1; + dev = isamem_get_device(c); + if (dev != NULL) + temp_deviceconfig |= deviceconfig_open(hdlg, (void *)dev); else - EnableWindow(h, FALSE); + ui_msgbox(MBX_INFO, (wchar_t *)IDS_2119); break; case IDC_CHECK_IDE_TER: @@ -1787,11 +1739,6 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); temp_isartc = settings_list_to_device[1][SendMessage(h, CB_GETCURSEL, 0, 0)]; - for (e = 0; e < ISAMEM_MAX; e++) { - h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1 + e); - temp_isamem[e] = settings_list_to_device[2 + e][SendMessage(h, CB_GETCURSEL, 0, 0)]; - } - h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER); temp_ide_ter = SendMessage(h, BM_GETCHECK, 0, 0);