Rewritten 808x CPU emulation core based on reenigne's XTCE, VisiOn, SnatchIt, and 8088 MPH now work correctly;

Fixed PC speaker sound volume in PIT mode 0;
A few CPU emulation clean-ups;
Hard disk controller changing redone in a less messy way;
Re-added the long-missing key send delay handling to the XT keyboard handler;
Fixed a bug that was causing SLiRP not to work when compiled with MingW/GCC 7.3.0-2 or newer;
Some serial mouse and port fixes;
A lot of changes to printer emulation, mostly based on DOSBox-X;
Printer PNG writer now uses statically linked libpng;
Added support for the HxC MFM floppy image format and upped 86F format version to 2.12;
Ported various things from PCem and some from VARCem;
Added the S3 86c801/805 emulation (patch from TheCollector1995);
Fixed and renamed the EGA monitor options;
Better synchronized the 808x to the PIT and the CGA;
Fixed the CGA wait state calculation;
Cleaned up some things in mem.c;
Fixed some things in the floppy emulation to make VisiOn get the correct errors from the copy protection disk;
Fixed several renderer-related bugs, including the SDL2 renderer's failure to take screenshots;
The Jenkins builds are now compiled with MingW/GCC 7.4.0-1 and include all the required DLL's.
This commit is contained in:
OBattler
2019-02-06 03:34:39 +01:00
parent c91b1f2b8e
commit 46d0ed2baa
104 changed files with 7749 additions and 6608 deletions

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)86Box.rc 1.0.42 2018/09/06
* Version: @(#)86Box.rc 1.0.44 2018/11/19
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -850,7 +850,7 @@ END
STRINGTABLE DISCARDABLE
BEGIN
IDS_2080 "E&xport to 86F..."
IDS_2081 "Unable to initialize FluidSynth, make sure you have the following libraries\nin your 86Box folder:\n\nlibfluidsynth.dll\nlibglib-2.0-0.dll\nlibiconv-2.dll\nlibintl-8.dll\nlibpcre-1.dll"
IDS_2081 "Unable to initialize FluidSynth, libfluidsynth.dll is required"
IDS_2082 "Bus"
IDS_2083 "File"
IDS_2084 "C"
@@ -887,8 +887,10 @@ BEGIN
IDS_2115 "%u"
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_2118 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F;*.MFM)\0*.86F;*.MFM\0All files (*.*)\0*.*\0"
IDS_2119 "You must save the settings first before attempting to configure the memory boards"
IDS_2120 "Unable to initialize FreeType, freetype.dll is required"
IDS_2121 "Unable to initialize SDL, SDL2.dll is required"
END
STRINGTABLE DISCARDABLE

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.134 2018/10/26
# Version: @(#)Makefile.mingw 1.0.136 2019/01/13
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -47,6 +47,9 @@ ifeq ($(DEV_BUILD), y)
ifndef D2D
D2D := y
endif
ifndef GUS_MAX
GUS_MAX := y
endif
ifndef I686
I686 := y
endif
@@ -87,6 +90,9 @@ else
ifndef D2D
D2D := n
endif
ifndef GUS_MAX
GUS_MAX := n
endif
ifndef I686
I686 := n
endif
@@ -295,7 +301,7 @@ ifneq ($(WX), n)
UIOBJ := wx_main.o wx_ui.o wx_stbar.o wx_render.o
else
UIOBJ := win_ui.o win_stbar.o \
win_ddraw.o win_d2d.o win_d3d.o win_sdl.o \
win_ddraw.o win_d3d.o win_sdl.o \
win_dialog.o win_about.o \
win_settings.o win_devconf.o win_snd_gain.o \
win_new_floppy.o win_jsconf.o
@@ -323,6 +329,7 @@ ifeq ($(D2D), y)
OPTS += -DUSE_D2D
RFLAGS += -DUSE_D2D
D2DLIB := -ld2d1
D2DOBJ := win_d2d.o
endif
ifeq ($(VNC), y)
@@ -361,6 +368,11 @@ OPTS += -DUSE_CRASHDUMP
DEVBROBJ += win_crashdump.o
endif
ifeq ($(GUS_MAX), y)
OPTS += -DUSE_GUSMAX
DEVBROBJ += snd_cs423x.o
endif
ifeq ($(I686), y)
OPTS += -DUSE_I686
endif
@@ -431,6 +443,7 @@ MCHOBJ := machine.o machine_table.o \
m_xt.o m_xt_compaq.o \
m_xt_t1000.o m_xt_t1000_vid.o \
m_xt_xi8088.o \
m_xt_zenith.o \
m_pcjr.o \
m_amstrad.o \
m_europc.o \
@@ -461,7 +474,7 @@ DEVOBJ := bugger.o isamem.o isartc.o lpt.o $(SERIAL) \
FDDOBJ := fdd.o fdc.o fdi2raw.o \
fdd_common.o fdd_86f.o \
fdd_fdi.o fdd_imd.o fdd_img.o fdd_json.o \
fdd_td0.o
fdd_mfm.o fdd_td0.o
HDDOBJ := hdd.o \
hdd_image.o hdd_table.o \
@@ -470,7 +483,7 @@ HDDOBJ := hdd.o \
hdc_xta.o \
hdc_esdi_at.o hdc_esdi_mca.o \
hdc_xtide.o hdc_ide.o
CDROMOBJ := cdrom.o \
cdrom_dosbox.o cdrom_image.o
@@ -539,6 +552,7 @@ VIDOBJ := video.o \
vid_ati18800.o vid_ati28800.o \
vid_ati_mach64.o vid_ati68860_ramdac.o \
vid_bt48x_ramdac.o \
vid_av9194.o \
vid_icd2061.o vid_ics2595.o \
vid_cl54xx.o \
vid_et4000.o vid_sc1502x_ramdac.o \
@@ -548,6 +562,7 @@ VIDOBJ := video.o \
vid_ti_cf62011.o \
vid_tvga.o \
vid_tgui9440.o vid_tkd8001_ramdac.o \
vid_att20c49x_ramdac.o \
vid_s3.o vid_s3_virge.o \
vid_sdac_ramdac.o \
vid_voodoo.o
@@ -560,7 +575,7 @@ PLATOBJ := win.o \
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(MCHOBJ) $(DEVOBJ) \
$(FDDOBJ) $(CDROMOBJ) $(ZIPOBJ) $(HDDOBJ) \
$(USBOBJ) $(NETOBJ) $(PRINTOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \
$(PLATOBJ) $(UIOBJ) $(FSYNTHOBJ) $(MUNTOBJ) \
$(PLATOBJ) $(UIOBJ) $(D2DOBJ) $(FSYNTHOBJ) $(MUNTOBJ) \
$(DEVBROBJ)
ifdef EXOBJ
OBJ += $(EXOBJ)

View File

@@ -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 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.28 2018/09/02
* Version: @(#)resource.h 1.0.30 2019/01/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -149,6 +149,7 @@
#define IDC_CHECK_MPU401 1077
#define IDC_CONFIGURE_MPU401 1078
#define IDC_CHECK_FLOAT 1079
#define IDC_CHECK_GUSMAX 1080
#define IDC_COMBO_NET_TYPE 1090 /* network config */
#define IDC_COMBO_PCAP 1091
@@ -264,10 +265,18 @@
#define IDM_VID_RESIZE 40040
#define IDM_VID_REMEMBER 40041
#define IDM_VID_DDRAW 40050
#ifdef USE_D2D
#define IDM_VID_D2D 40051
#define IDM_VID_D3D 40052
#define IDM_VID_SDL 40053
#define IDM_VID_VNC 40054
#else
#define IDM_VID_D3D 40051
#define IDM_VID_SDL 40052
#ifdef USE_VNC
#define IDM_VID_VNC 40053
#endif
#endif
#define IDM_VID_SCALE_1X 40055
#define IDM_VID_SCALE_2X 40056
#define IDM_VID_SCALE_3X 40057

View File

@@ -8,7 +8,7 @@
*
* Platform main support module for Windows.
*
* Version: @(#)win.c 1.0.54 2018/10/18
* Version: @(#)win.c 1.0.55 2018/11/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -86,7 +86,9 @@ static struct {
} vid_apis[2][RENDERERS_NUM] = {
{
{ "DDraw", 1, (int(*)(void*))ddraw_init, ddraw_close, NULL, ddraw_pause },
#ifdef USE_D2D
{ "D2D", 1, (int(*)(void*))d2d_init, d2d_close, NULL, d2d_pause },
#endif
{ "D3D", 1, (int(*)(void*))d3d_init, d3d_close, d3d_resize, d3d_pause },
{ "SDL", 1, (int(*)(void*))sdl_init, sdl_close, NULL, sdl_pause }
#ifdef USE_VNC
@@ -95,7 +97,9 @@ static struct {
},
{
{ "DDraw", 1, (int(*)(void*))ddraw_init_fs, ddraw_close, NULL, ddraw_pause },
#ifdef USE_D2D
{ "D2D", 1, (int(*)(void*))d2d_init_fs, d2d_close, NULL, d2d_pause },
#endif
{ "D3D", 1, (int(*)(void*))d3d_init_fs, d3d_close, NULL, d3d_pause },
{ "SDL", 1, (int(*)(void*))sdl_init_fs, sdl_close, sdl_resize, sdl_pause }
#ifdef USE_VNC
@@ -633,7 +637,6 @@ plat_vidapi_name(int api)
case 1:
name = "d2d";
break;
#endif
case 2:
name = "d3d";
@@ -642,9 +645,22 @@ plat_vidapi_name(int api)
case 3:
name = "sdl";
break;
#else
case 1:
name = "d3d";
break;
case 2:
name = "sdl";
break;
#endif
#ifdef USE_VNC
#ifdef USE_D2D
case 4:
#else
case 3:
#endif
name = "vnc";
break;
#endif
@@ -753,7 +769,7 @@ take_screenshot(void)
time_t now;
win_log("Screenshot: video API is: %i\n", vid_api);
if ((vid_api < 0) || (vid_api > 2)) return;
if ((vid_api < 0) || (vid_api >= RENDERERS_NUM)) return;
memset(fn, 0, sizeof(fn));
memset(path, 0, sizeof(path));
@@ -780,7 +796,6 @@ take_screenshot(void)
case 1: /* d2d */
d2d_take_screenshot(path);
break;
#endif
case 2: /* d3d9 */
d3d_take_screenshot(path);
@@ -789,9 +804,22 @@ take_screenshot(void)
case 3: /* sdl */
sdl_take_screenshot(path);
break;
#else
case 1: /* d3d9 */
d3d_take_screenshot(path);
break;
case 2: /* sdl */
sdl_take_screenshot(path);
break;
#endif
#ifdef USE_VNC
#ifdef USE_D2D
case 4: /* vnc */
#else
case 3: /* vnc */
#endif
vnc_take_screenshot(path);
break;
#endif

View File

@@ -59,10 +59,18 @@
#define WM_SENDSSTATUS 0x8896
#ifdef USE_VNC
#ifdef USE_D2D
#define RENDERERS_NUM 5
#else
#define RENDERERS_NUM 4
#endif
#else
#ifdef USE_D2D
#define RENDERERS_NUM 4
#else
#define RENDERERS_NUM 3
#endif
#endif
extern HINSTANCE hinstance;

View File

@@ -11,7 +11,7 @@
* NOTES: This code should be re-merged into a single init() with a
* 'fullscreen' argument, indicating FS mode is requested.
*
* Version: @(#)win_ddraw.cpp 1.0.12 2018/10/18
* Version: @(#)win_ddraw.cpp 1.0.13 2018/11/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -186,9 +186,7 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
}
if (ys2 <= 250) {
bmpInfo.bmiHeader.biSizeImage <<= 1;
pBuf2 = malloc(bmpInfo.bmiHeader.biSizeImage);
pBuf2 = malloc(bmpInfo.bmiHeader.biSizeImage << 1);
if (pBuf2 == NULL) {
ddraw_log("[SavePNG] Unable to Allocate Secondary Bitmap Memory");
free(pBuf);
@@ -196,7 +194,6 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
return;
}
bmpInfo.bmiHeader.biHeight <<= 1;
}
ddraw_log("save png w=%i h=%i\n", bmpInfo.bmiHeader.biWidth, bmpInfo.bmiHeader.biHeight);
@@ -205,6 +202,11 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
GetDIBits(hdc, hBitmap, 0, bmpInfo.bmiHeader.biHeight, pBuf, &bmpInfo, DIB_RGB_COLORS);
if (pBuf2) {
bmpInfo.bmiHeader.biSizeImage <<= 1;
bmpInfo.bmiHeader.biHeight <<= 1;
}
png_set_IHDR(png_ptr, info_ptr, bmpInfo.bmiHeader.biWidth, bmpInfo.bmiHeader.biHeight,
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);

View File

@@ -8,7 +8,7 @@
*
* Joystick interface to host device.
*
* Version: @(#)win_joystick.cpp 1.0.10 2018/10/18
* Version: @(#)win_joystick.cpp 1.0.11 2018/11/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -85,7 +85,7 @@ BOOL CALLBACK DIEnumDeviceObjectsCallback(
lpddoi->guidType == GUID_RxAxis || lpddoi->guidType == GUID_RyAxis || lpddoi->guidType == GUID_RzAxis ||
lpddoi->guidType == GUID_Slider)
{
strncpy(state->axis[state->nr_axes].name, lpddoi->tszName, sizeof(state->axis[state->nr_axes].name));
memcpy(state->axis[state->nr_axes].name, lpddoi->tszName, strlen(state->axis[state->nr_axes].name) + 1);
joystick_log("Axis %i : %s %x %x\n", state->nr_axes, state->axis[state->nr_axes].name, lpddoi->dwOfs, lpddoi->dwType);
if (lpddoi->guidType == GUID_XAxis)
state->axis[state->nr_axes].id = 0;
@@ -103,13 +103,13 @@ BOOL CALLBACK DIEnumDeviceObjectsCallback(
}
else if (lpddoi->guidType == GUID_Button)
{
strncpy(state->button[state->nr_buttons].name, lpddoi->tszName, sizeof(state->button[state->nr_buttons].name));
memcpy(state->button[state->nr_buttons].name, lpddoi->tszName, strlen(state->button[state->nr_buttons].name) + 1);
joystick_log("Button %i : %s %x %x\n", state->nr_buttons, state->button[state->nr_buttons].name, lpddoi->dwOfs, lpddoi->dwType);
state->nr_buttons++;
}
else if (lpddoi->guidType == GUID_POV)
{
strncpy(state->pov[state->nr_povs].name, lpddoi->tszName, sizeof(state->pov[state->nr_povs].name));
memcpy(state->pov[state->nr_povs].name, lpddoi->tszName, strlen(state->pov[state->nr_povs].name) + 1);
joystick_log("POV %i : %s %x %x\n", state->nr_povs, state->pov[state->nr_povs].name, lpddoi->dwOfs, lpddoi->dwType);
state->nr_povs++;
}
@@ -155,7 +155,7 @@ void joystick_init()
joystick_log("Joystick %i :\n", c);
joystick_log(" tszInstanceName = %s\n", device_instance.tszInstanceName);
joystick_log(" tszProductName = %s\n", device_instance.tszProductName);
strncpy(plat_joystick_state[c].name, device_instance.tszInstanceName, 64);
memcpy(plat_joystick_state[c].name, device_instance.tszInstanceName, 260);
memset(&devcaps, 0, sizeof(devcaps));
devcaps.dwSize = sizeof(devcaps);

View File

@@ -29,6 +29,7 @@ static void rebuild_axis_button_selections(HWND hdlg)
HWND h;
int joystick;
int c, d;
char s[269];
h = GetDlgItem(hdlg, IDC_CONFIG_BASE);
joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
@@ -53,8 +54,6 @@ static void rebuild_axis_button_selections(HWND hdlg)
}
for (d = 0; d < plat_joystick_state[joystick-1].nr_povs; d++)
{
char s[80];
sprintf(s, "%s (X axis)", plat_joystick_state[joystick-1].pov[d].name);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
sprintf(s, "%s (Y axis)", plat_joystick_state[joystick-1].pov[d].name);
@@ -98,8 +97,6 @@ static void rebuild_axis_button_selections(HWND hdlg)
{
for (d = 0; d < plat_joystick_state[joystick-1].nr_povs; d++)
{
char s[80];
sprintf(s, "%s (X axis)", plat_joystick_state[joystick-1].pov[d].name);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
sprintf(s, "%s (Y axis)", plat_joystick_state[joystick-1].pov[d].name);
@@ -294,6 +291,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type)
int y = 10;
int id = IDC_CONFIG_BASE;
int c;
char s[269];
joystickconfig_changed = 0;
@@ -462,8 +460,6 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type)
for (c = 0; c < joystick_get_pov_count(type)*2; c++)
{
char s[80];
/*Combo box*/
item = (DLGITEMTEMPLATE *)data;
item->x = 70;

View File

@@ -8,7 +8,7 @@
*
* Handle the New Floppy Image dialog.
*
* Version: @(#)win_new_floppy.c 1.0.9 2018/10/02
* Version: @(#)win_new_floppy.c 1.0.10 2019/01/17
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
@@ -75,7 +75,7 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
FILE *f;
uint32_t magic = 0x46423638;
uint16_t version = 0x020B;
uint16_t version = 0x020C;
uint16_t dflags = 0;
uint16_t tflags = 0;
uint32_t index_hole_pos = 0;

View File

@@ -12,7 +12,7 @@
* we will not use that, but, instead, use a new window which
* coverrs the entire desktop.
*
* Version: @(#)win_sdl.c 1.0.3 2018/10/21
* Version: @(#)win_sdl.c 1.0.4 2018/11/18
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Michael Dr<44>ing, <michael@drueing.de>
@@ -67,11 +67,12 @@
#include "../plat.h"
#include "../plat_dynld.h"
#include "../video/video.h"
#include "../ui.h"
#include "win.h"
#include "win_sdl.h"
#define PATH_SDL_DLL "sdl2.dll"
#define PATH_SDL_DLL "SDL2.dll"
static void *sdl_handle = NULL; /* handle to libSDL2 DLL */
@@ -289,10 +290,10 @@ sdl_blit(int x, int y, int y1, int y2, int w, int h)
sdl_UnlockTexture(sdl_tex);
if (sdl_fs) {
pclog("sdl_blit(%i, %i, %i, %i, %i, %i) (%i, %i)\n", x, y, y1, y2, w, h, unscaled_size_x, efscrnsz_y);
sdl_log("sdl_blit(%i, %i, %i, %i, %i, %i) (%i, %i)\n", x, y, y1, y2, w, h, unscaled_size_x, efscrnsz_y);
if (w == unscaled_size_x)
sdl_resize(w, h);
pclog("(%08X, %08X, %08X)\n", sdl_win, sdl_render, sdl_tex);
sdl_log("(%08X, %08X, %08X)\n", sdl_win, sdl_render, sdl_tex);
}
r_src.x = 0;
@@ -373,7 +374,7 @@ sdl_init_common(int fs)
/* Try loading the DLL. */
sdl_handle = dynld_module(PATH_SDL_DLL, sdl_imports);
if (sdl_handle == NULL) {
sdl_log("SDL: unable to load '%s', SDL not available.\n", PATH_SDL_DLL);
ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2121);
return(0);
}
@@ -615,7 +616,7 @@ sdl_resize(int x, int y)
if ((x == cur_w) && (y == cur_h))
return;
pclog("sdl_resize(%i, %i)\n", x, y);
sdl_log("sdl_resize(%i, %i)\n", x, y);
ww = x;
wh = y;
sdl_stretch(&ww, &wh, &wx, &wy);

View File

@@ -21,6 +21,9 @@
#include <windows.h>
#include <windowsx.h>
#undef BITMAP
#ifdef ENABLE_SETTINGS_LOG
#include <assert.h>
#endif
#include <commctrl.h>
#include <inttypes.h>
#include <stdint.h>
@@ -95,16 +98,14 @@ static int temp_float;
/* Network category */
static int temp_net_type, temp_net_card;
static char temp_pcap_dev[520];
static char temp_pcap_dev[522];
/* Ports category */
static char temp_lpt_device_names[3][16];
static int temp_serial[2], temp_lpt;
/* Other peripherals category */
static int temp_scsi_card, temp_ide_ter, temp_ide_qua;
static char temp_hdc_name[32];
static char *hdc_names[32];
static int temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
static int temp_bugger;
static int temp_isartc;
static int temp_isamem[ISAMEM_MAX];
@@ -236,19 +237,29 @@ win_settings_init(void)
/* Network category */
temp_net_type = network_type;
memset(temp_pcap_dev, 0, sizeof(temp_pcap_dev));
strcpy(temp_pcap_dev, network_host);
#ifdef ENABLE_SETTINGS_LOG
assert(sizeof(temp_pcap_dev) == sizeof(network_host));
#endif
memcpy(temp_pcap_dev, network_host, sizeof(network_host));
temp_net_card = network_card;
/* Ports category */
for (i = 0; i < 3; i++)
strncpy(temp_lpt_device_names[i], lpt_device_names[i], sizeof(temp_lpt_device_names[i]) - 1);
#ifdef ENABLE_SETTINGS_LOG
assert(sizeof(temp_lpt_device_names) == sizeof(lpt_device_names));
#endif
for (i = 0; i < 3; i++) {
#ifdef ENABLE_SETTINGS_LOG
assert(sizeof(temp_lpt_device_names[i]) == sizeof(lpt_device_names[i]));
#endif
memcpy(temp_lpt_device_names[i], lpt_device_names[i], sizeof(lpt_device_names[i]));
}
temp_serial[0] = serial_enabled[0];
temp_serial[1] = serial_enabled[1];
temp_lpt = lpt_enabled;
/* Other peripherals category */
temp_scsi_card = scsi_card_current;
strncpy(temp_hdc_name, hdc_name, sizeof(temp_hdc_name) - 1);
temp_hdc = hdc_current;
temp_ide_ter = ide_ter_enabled;
temp_ide_qua = ide_qua_enabled;
temp_bugger = bugger_enabled;
@@ -355,7 +366,7 @@ win_settings_changed(void)
/* Peripherals category */
i = i || (scsi_card_current != temp_scsi_card);
i = i || strncmp(temp_hdc_name, hdc_name, sizeof(temp_hdc_name) - 1);
i = i || (hdc_current != temp_hdc);
i = i || (temp_ide_ter != ide_ter_enabled);
i = i || (temp_ide_qua != ide_qua_enabled);
i = i || (temp_bugger != bugger_enabled);
@@ -452,20 +463,14 @@ win_settings_save(void)
/* Ports category */
for (i = 0; i < 3; i++)
strncpy(lpt_device_names[i], temp_lpt_device_names[i], sizeof(temp_lpt_device_names[i]) - 1);
memcpy(lpt_device_names[i], temp_lpt_device_names[i], sizeof(temp_lpt_device_names[i]));
serial_enabled[0] = temp_serial[0];
serial_enabled[1] = temp_serial[1];
lpt_enabled = temp_lpt;
/* Peripherals category */
scsi_card_current = temp_scsi_card;
if (hdc_name) {
free(hdc_name);
hdc_name = NULL;
}
hdc_name = (char *) malloc(sizeof(temp_hdc_name));
strncpy(hdc_name, temp_hdc_name, sizeof(temp_hdc_name) - 1);
hdc_init(hdc_name);
hdc_current = temp_hdc;
ide_ter_enabled = temp_ide_ter;
ide_qua_enabled = temp_ide_qua;
bugger_enabled = temp_bugger;
@@ -570,7 +575,7 @@ win_settings_machine_recalc_cpu_m(HWND hdlg)
char *stransi;
temp_romset = machine_getromset_ex(temp_machine);
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_CPU);
SendMessage(h, CB_RESETCONTENT, 0, 0);
@@ -603,7 +608,7 @@ win_settings_machine_recalc_machine(HWND hdlg)
device_t *d;
temp_romset = machine_getromset_ex(temp_machine);
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_CONFIGURE_MACHINE);
d = (device_t *) machine_getdevice(temp_machine);
@@ -662,7 +667,7 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
for (c = 0; c < ROM_MAX; c++)
@@ -765,7 +770,7 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
return FALSE;
case WM_SAVESETTINGS:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *)malloc(512);
#ifdef USE_DYNAREC
@@ -872,11 +877,10 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
HWND h;
LPTSTR lptsTemp;
char *stransi;
int gfx;
switch (message) {
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
recalc_vid_list(hdlg);
@@ -887,10 +891,9 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
wcstombs(stransi, lptsTemp, 512);
gfx = video_card_getid(stransi);
h = GetDlgItem(hdlg, IDC_CONFIGURE_VID);
if (video_card_has_config(gfx))
if (video_card_has_config(temp_gfxcard))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
@@ -903,17 +906,16 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_VIDEO:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
wcstombs(stransi, lptsTemp, 512);
gfx = video_card_getid(stransi);
temp_gfxcard = gfx;
temp_gfxcard = video_card_getid(stransi);
h = GetDlgItem(hdlg, IDC_CONFIGURE_VID);
if (video_card_has_config(gfx))
if (video_card_has_config(temp_gfxcard))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
@@ -935,7 +937,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case IDC_CONFIGURE_VID:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
@@ -950,7 +952,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
return FALSE;
case WM_SAVESETTINGS:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
@@ -1150,7 +1152,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_SOUND);
c = d = 0;
@@ -1356,7 +1358,7 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
for (i = 0; i < 3; i++) {
h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i);
@@ -1419,63 +1421,44 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
static void
recalc_hdc_list(HWND hdlg, int machine, int use_selected_hdc)
recalc_hdc_list(HWND hdlg)
{
HWND h;
char *s, old_name[32];
int valid, c, d;
LPTSTR lptsTemp;
lptsTemp = (LPTSTR) malloc(512);
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])
strncpy(old_name, hdc_names[c], sizeof(old_name) - 1);
else
strcpy(old_name, "none");
} else
strncpy(old_name, temp_hdc_name, sizeof(old_name) - 1);
HWND h = GetDlgItem(hdlg, IDC_COMBO_HDC);
int c = 0, d = 0;
int found_card = 0;
WCHAR szText[512];
SendMessage(h, CB_RESETCONTENT, 0, 0);
c = d = 0;
SendMessage(h, CB_SETCURSEL, 0, 0);
while (1) {
s = hdc_get_name(c);
if (s[0] == 0)
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && !(machines[temp_machine].flags & MACHINE_HDC)) {
c++;
continue;
}
char *s = hdc_get_name(c);
if (!s[0])
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(lptsTemp, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
hdc_names[d] = hdc_get_internal_name(c);
if (!strcmp(old_name, hdc_names[d])) {
SendMessage(h, CB_SETCURSEL, d, 0);
valid = 1;
if (hdc_available(c) &&
device_is_valid(hdc_get_device(c), machines[temp_machine].flags)) {
mbstowcs(szText, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText);
if (c == temp_hdc) {
SendMessage(h, CB_SETCURSEL, d, 0);
found_card = 1;
}
d++;
}
c++;
d++;
}
if (!valid)
if (!found_card)
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, d ? TRUE : FALSE);
free(lptsTemp);
}
@@ -1487,15 +1470,27 @@ static BOOL CALLBACK
win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c, d, e, temp_hdc_type;
int c, d;
int e;
LPTSTR lptsTemp;
char *stransi;
const device_t *scsi_dev;
const device_t *dev;
char *s;
switch (message) {
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
/*HD controller config*/
recalc_hdc_list(hdlg);
h = GetDlgItem(hdlg, IDC_CONFIGURE_HDC);
if (hdc_has_config(temp_hdc))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
/*SCSI config*/
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
@@ -1532,11 +1527,6 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
h = GetDlgItem(hdlg, IDC_CONFIGURE_SCSI);
EnableWindow(h, scsi_card_has_config(temp_scsi_card) ? TRUE : FALSE);
recalc_hdc_list(hdlg, temp_machine, 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_HDC);
EnableWindow(h, hdc_has_config(hdc_get_from_internal_name(temp_hdc_name)) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER);
EnableWindow(h, (machines[temp_machine].flags & MACHINE_AT) ? TRUE : FALSE);
@@ -1612,25 +1602,43 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
EnableWindow(h, FALSE);
}
free(stransi);
free(lptsTemp);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_HDC:
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
temp_hdc_type = hdc_get_from_internal_name(hdc_names[SendMessage(h, CB_GETCURSEL, 0, 0)]);
case IDC_CONFIGURE_HDC:
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
h = GetDlgItem(hdlg, IDC_CONFIGURE_HDC);
EnableWindow(h, hdc_has_config(temp_hdc_type) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
wcstombs(stransi, lptsTemp, 512);
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)hdc_get_device(hdc_get_id(stransi)));
free(stransi);
free(lptsTemp);
break;
case IDC_CONFIGURE_HDC:
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
temp_hdc_type = hdc_get_from_internal_name(hdc_names[SendMessage(h, CB_GETCURSEL, 0, 0)]);
case IDC_COMBO_HDC:
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)hdc_get_device(temp_hdc_type));
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
wcstombs(stransi, lptsTemp, 512);
temp_hdc = hdc_get_id(stransi);
h = GetDlgItem(hdlg, IDC_CONFIGURE_HDC);
if (hdc_has_config(temp_hdc))
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
free(stransi);
free(lptsTemp);
break;
case IDC_CONFIGURE_SCSI:
@@ -1720,12 +1728,13 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
return FALSE;
case WM_SAVESETTINGS:
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
stransi = (char *) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (hdc_names[c])
strncpy(temp_hdc_name, hdc_names[c], sizeof(temp_hdc_name) - 1);
else
strcpy(temp_hdc_name, "none");
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
wcstombs(stransi, lptsTemp, 512);
temp_hdc = hdc_get_id(stransi);
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
temp_scsi_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)];
@@ -1742,6 +1751,9 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
h = GetDlgItem(hdlg, IDC_CHECK_BUGGER);
temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0);
free(stransi);
free(lptsTemp);
default:
return FALSE;
}
@@ -1796,7 +1808,7 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"None");
@@ -1961,7 +1973,7 @@ add_locations(HWND hdlg)
HWND h;
int i = 0;
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS);
for (i = 0; i < 5; i++)
@@ -3806,7 +3818,7 @@ cdrom_add_locations(HWND hdlg)
HWND h;
int i = 0;
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
for (i = CDROM_BUS_DISABLED; i <= CDROM_BUS_SCSI; i++) {
@@ -3914,7 +3926,7 @@ zip_add_locations(HWND hdlg)
HWND h;
int i = 0;
lptsTemp = (LPTSTR) malloc(512);
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS);
for (i = ZIP_BUS_DISABLED; i <= ZIP_BUS_SCSI; i++) {
@@ -4514,6 +4526,7 @@ win_settings_confirm(HWND hdlg, int button)
EndDialog(hdlg, 0);
plat_pause(0);
win_settings_communicate_closure();
return button ? TRUE : FALSE;
} else
return button ? FALSE : TRUE;

View File

@@ -485,6 +485,7 @@ ui_sb_update_panes(void)
int c_mfm, c_esdi, c_xta;
int c_ide, c_scsi;
int do_net;
char *hdc_name;
if (sb_ready) {
sb_ready = 0;
@@ -526,6 +527,7 @@ ui_sb_update_panes(void)
if (fdd_get_type(i) != 0)
sb_parts++;
}
hdc_name = hdc_get_internal_name(hdc_current);
for (i=0; i<CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) &&

View File

@@ -8,7 +8,7 @@
*
* user Interface module for WinAPI on Windows.
*
* Version: @(#)win_ui.c 1.0.37 2018/10/28
* Version: @(#)win_ui.c 1.0.38 2018/11/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -156,11 +156,17 @@ ResetAllMenus(void)
CheckMenuItem(menuMain, IDM_VID_DDRAW+0, MF_UNCHECKED);
#ifdef USE_D2D
CheckMenuItem(menuMain, IDM_VID_DDRAW+1, MF_UNCHECKED);
#endif
CheckMenuItem(menuMain, IDM_VID_DDRAW+2, MF_UNCHECKED);
CheckMenuItem(menuMain, IDM_VID_DDRAW+3, MF_UNCHECKED);
#ifdef USE_VNC
CheckMenuItem(menuMain, IDM_VID_DDRAW+4, MF_UNCHECKED);
#endif
#else
CheckMenuItem(menuMain, IDM_VID_DDRAW+1, MF_UNCHECKED);
CheckMenuItem(menuMain, IDM_VID_DDRAW+2, MF_UNCHECKED);
#ifdef USE_VNC
CheckMenuItem(menuMain, IDM_VID_DDRAW+3, MF_UNCHECKED);
#endif
#endif
CheckMenuItem(menuMain, IDM_VID_FS_FULL+0, MF_UNCHECKED);
CheckMenuItem(menuMain, IDM_VID_FS_FULL+1, MF_UNCHECKED);