Merge branch 'master' into master

This commit is contained in:
OBattler
2020-01-18 05:52:59 +01:00
committed by GitHub
192 changed files with 14558 additions and 6730 deletions

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)86Box.rc 1.0.55 2019/12/05
* Version: @(#)86Box.rc 1.0.56 2019/12/21
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -366,7 +366,7 @@ BEGIN
PUSHBUTTON "Joystick 4...",IDC_JOY4,209,44,50,14
END
DLG_CFG_SOUND DIALOG DISCARDABLE 97, 0, 267, 116
DLG_CFG_SOUND DIALOG DISCARDABLE 97, 0, 267, 199
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
@@ -380,37 +380,41 @@ BEGIN
LTEXT "MIDI Out Device:",IDT_1712,7,26,59,10
PUSHBUTTON "Configure",IDC_CONFIGURE_MIDI,214,25,46,12
COMBOBOX IDC_COMBO_MIDI_IN,71,43,140,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "MIDI In Device:",IDT_1713,7,44,59,10
PUSHBUTTON "Configure",IDC_CONFIGURE_MIDI_IN,214,43,46,12
CONTROL "Standalone MPU-401",IDC_CHECK_MPU401,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,45,199,10
PUSHBUTTON "Configure",IDC_CONFIGURE_MPU401,214,44,46,12
BS_AUTOCHECKBOX | WS_TABSTOP,7,65,199,10
PUSHBUTTON "Configure",IDC_CONFIGURE_MPU401,214,64,46,12
CONTROL "Innovation SSI-2001",IDC_CHECK_SSI,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,63,94,10
BS_AUTOCHECKBOX | WS_TABSTOP,7,83,94,10
CONTROL "CMS / Game Blaster",IDC_CHECK_CMS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,63,94,10
BS_AUTOCHECKBOX | WS_TABSTOP,147,83,94,10
CONTROL "Gravis Ultrasound",IDC_CHECK_GUS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,81,94,10
CONTROL "Use Nuked OPL",IDC_CHECK_NUKEDOPL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,81,94,10
CONTROL "Use FLOAT32 sound",IDC_CHECK_FLOAT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,99,94,10
PUSHBUTTON "Configure",IDC_CONFIGURE_GUS,214,99,46,12
CONTROL "Use FLOAT32 sound",IDC_CHECK_FLOAT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,115,94,10
END
DLG_CFG_NETWORK DIALOG DISCARDABLE 97, 0, 267, 63
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "Network type:",IDT_1713,7,8,59,10
LTEXT "Network type:",IDT_1714,7,8,59,10
COMBOBOX IDC_COMBO_NET_TYPE,71,7,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "PCap device:",IDT_1714,7,26,59,10
LTEXT "PCap device:",IDT_1715,7,26,59,10
COMBOBOX IDC_COMBO_PCAP,71,25,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "Network adapter:",IDT_1715,7,44,59,10
LTEXT "Network adapter:",IDT_1716,7,44,59,10
COMBOBOX IDC_COMBO_NET,71,43,140,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_NET,214,43,46,12
@@ -420,15 +424,15 @@ DLG_CFG_PORTS DIALOG DISCARDABLE 97, 0, 267, 117
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "LPT1 Device:",IDT_1716,7,8,61,10
LTEXT "LPT1 Device:",IDT_1717,7,8,61,10
COMBOBOX IDC_COMBO_LPT1,71,7,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "LPT2 Device:",IDT_1717,7,27,61,10
LTEXT "LPT2 Device:",IDT_1718,7,27,61,10
COMBOBOX IDC_COMBO_LPT2,71,26,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "LPT3 Device:",IDT_1718,7,46,61,10
LTEXT "LPT3 Device:",IDT_1719,7,46,61,10
COMBOBOX IDC_COMBO_LPT3,71,45,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
@@ -449,12 +453,12 @@ DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 200
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "SCSI Controller:",IDT_1716,7,8,48,10
LTEXT "SCSI Controller:",IDT_1717,7,8,48,10
COMBOBOX IDC_COMBO_SCSI,64,7,155,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_SCSI,222,7,38,12
LTEXT "HD Controller:",IDT_1717,7,26,48,10
LTEXT "HD Controller:",IDT_1718,7,26,48,10
COMBOBOX IDC_COMBO_HDC,64,25,155,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_HDC,222,25,38,12
@@ -903,7 +907,6 @@ BEGIN
IDS_2120 "Unable to initialize SDL, SDL2.dll is required"
IDS_2121 "Are you sure you want to hard reset the emulated machine?"
IDS_2122 "Are you sure you want to quit 86Box?"
IDS_2123 "Unable to initialize Ghostscript, gsdll32.dll is required for automatic convertion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript files (.ps)."
END
STRINGTABLE DISCARDABLE

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.139 2019/12/05
# Version: @(#)Makefile.mingw 1.0.141 2020/01/14
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -530,7 +530,7 @@ endif
# Final versions of the toolchain flags.
CFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
$(AFLAGS) -fomit-frame-pointer -mstackrealign -Wall \
-fno-strict-aliasing -funroll-loops
-fno-strict-aliasing
# Add freetyp2 references through pkgconfig
CFLAGS := $(CFLAGS) `pkg-config.exe --cflags freetype2`
@@ -541,9 +541,9 @@ CXXFLAGS := $(CFLAGS)
#########################################################################
# Create the (final) list of objects to build. #
#########################################################################
MAINOBJ := pc.o config.o random.o timer.o io.o apm.o dma.o nmi.o \
MAINOBJ := pc.o config.o random.o timer.o io.o apm_new.o dma.o nmi.o \
pic.o pit.o port_92.o ppi.o pci.o mca.o mcr.o mem.o \
rom.o device.o nvr.o nvr_at.o nvr_ps2.o $(VNCOBJ) $(RDPOBJ)
rom.o device.o nvr.o nvr_at.o nvr_ps2.o sst_flash.o via_vt82c586b.o $(VNCOBJ) $(RDPOBJ)
INTELOBJ := intel_flash.o \
intel_sio.o intel_piix.o
@@ -557,7 +557,7 @@ CPUOBJ := cpu.o cpu_table.o \
CHIPSETOBJ := acc2168.o acer_m3a.o ali1429.o headland.o \
intel_4x0.o neat.o opti495.o scat.o \
sis_85c471.o sis_85c496.o \
wd76c10.o
via_mvp3.o wd76c10.o
MCHOBJ := machine.o machine_table.o \
m_xt.o m_xt_compaq.o \
@@ -604,7 +604,7 @@ HDDOBJ := hdd.o \
hdc_ide_sff8038i.o
CDROMOBJ := cdrom.o \
cdrom_dosbox.o cdrom_image.o
cdrom_image_backend.o cdrom_image.o
ZIPOBJ := zip.o
@@ -633,8 +633,8 @@ PRINTOBJ := png.o prt_cpmap.o \
SNDOBJ := sound.o \
openal.o \
snd_opl.o snd_dbopl.o \
dbopl.o nukedopl.o \
snd_opl.o snd_opl_backend.o \
nukedopl.o \
snd_resid.o \
convolve.o convolve-sse.o envelope.o extfilt.o \
filter.o pot.o sid.o voice.o wave6581__ST.o \
@@ -678,6 +678,7 @@ VIDOBJ := video.o \
vid_et4000.o vid_sc1502x_ramdac.o \
vid_et4000w32.o vid_stg_ramdac.o \
vid_ht216.o \
vid_mga.o \
vid_oak_oti.o \
vid_paradise.o \
vid_ti_cf62011.o \
@@ -691,12 +692,8 @@ VIDOBJ := video.o \
PLATOBJ := win.o \
win_dynld.o win_thread.o \
win_cdrom.o win_keyboard.o \
win_midi.o
ifeq ($(DINPUT), y)
PLATOBJ += win_mouse.o win_joystick.o
else
PLATOBJ += win_mouse_rawinput.o win_joystick.o
endif
win_midi.o \
win_mouse.o win_joystick.o
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(CHIPSETOBJ) $(MCHOBJ) \
$(DEVOBJ) $(FDDOBJ) $(CDROMOBJ) $(ZIPOBJ) $(HDDOBJ) \

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.139 2019/12/05
# Version: @(#)Makefile.mingw 1.0.141 2020/01/14
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -536,7 +536,7 @@ endif
# Final versions of the toolchain flags.
CFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
$(AFLAGS) -fomit-frame-pointer -mstackrealign -Wall \
-fno-strict-aliasing -funroll-loops
-fno-strict-aliasing
# Add freetyp2 references through pkgconfig
CFLAGS := $(CFLAGS) `pkg-config.exe --cflags freetype2`
@@ -547,9 +547,9 @@ CXXFLAGS := $(CFLAGS)
#########################################################################
# Create the (final) list of objects to build. #
#########################################################################
MAINOBJ := pc.o config.o random.o timer.o io.o apm.o dma.o nmi.o \
MAINOBJ := pc.o config.o random.o timer.o io.o apm_new.o dma.o nmi.o \
pic.o pit.o port_92.o ppi.o pci.o mca.o mcr.o mem_new.o \
rom.o device.o nvr.o nvr_at.o nvr_ps2.o $(VNCOBJ) $(RDPOBJ)
rom.o device.o nvr.o nvr_at.o nvr_ps2.o sst_flash.o via_vt82c586b.o $(VNCOBJ) $(RDPOBJ)
INTELOBJ := intel_flash.o \
intel_sio.o intel_piix.o
@@ -563,7 +563,7 @@ CPUOBJ := cpu.o cpu_table.o \
CHIPSETOBJ := acc2168.o acer_m3a.o ali1429.o headland.o \
intel_4x0.o neat.o opti495.o scat.o \
sis_85c471.o sis_85c496.o \
wd76c10.o
via_mvp3.o wd76c10.o
MCHOBJ := machine.o machine_table_new.o \
m_xt.o m_xt_compaq.o \
@@ -610,7 +610,7 @@ HDDOBJ := hdd.o \
hdc_ide_sff8038i.o
CDROMOBJ := cdrom.o \
cdrom_dosbox.o cdrom_image.o
cdrom_image_backend.o cdrom_image.o
ZIPOBJ := zip.o
@@ -639,8 +639,8 @@ PRINTOBJ := png.o prt_cpmap.o \
SNDOBJ := sound.o \
openal.o \
snd_opl.o snd_dbopl.o \
dbopl.o nukedopl.o \
snd_opl.o snd_opl_backend.o \
nukedopl.o \
snd_resid.o \
convolve.o convolve-sse.o envelope.o extfilt.o \
filter.o pot.o sid.o voice.o wave6581__ST.o \
@@ -684,6 +684,7 @@ VIDOBJ := video.o \
vid_et4000.o vid_sc1502x_ramdac.o \
vid_et4000w32.o vid_stg_ramdac.o \
vid_ht216.o \
vid_mga.o \
vid_oak_oti.o \
vid_paradise.o \
vid_ti_cf62011.o \
@@ -697,12 +698,8 @@ VIDOBJ := video.o \
PLATOBJ := win.o \
win_dynld.o win_thread.o \
win_cdrom.o win_keyboard.o \
win_midi.o
ifeq ($(DINPUT), y)
PLATOBJ += win_mouse.o win_joystick.o
else
PLATOBJ += win_mouse_rawinput.o win_joystick.o
endif
win_midi.o \
win_mouse.o win_joystick.o
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(CHIPSETOBJ) $(MCHOBJ) \
$(DEVOBJ) $(FDDOBJ) $(CDROMOBJ) $(ZIPOBJ) $(HDDOBJ) \

View File

@@ -8,7 +8,7 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.31 2019/12/05
* Version: @(#)resource.h 1.0.32 2019/12/21
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -54,12 +54,13 @@
#define IDT_1710 1710 /* Joystick: */
#define IDT_1711 1711 /* Sound card: */
#define IDT_1712 1712 /* MIDI Out Device: */
#define IDT_1713 1713 /* Network type: */
#define IDT_1714 1714 /* PCap device: */
#define IDT_1715 1715 /* Network adapter: */
#define IDT_1716 1716 /* SCSI Controller: */
#define IDT_1717 1717 /* HD Controller: */
#define IDT_1718 1718
#define IDT_1713 1713 /* MIDI In Device: */
#define IDT_1714 1714 /* Network type: */
#define IDT_1715 1715 /* PCap device: */
#define IDT_1716 1716 /* Network adapter: */
#define IDT_1717 1717 /* SCSI Controller: */
#define IDT_1718 1718 /* HD Controller: */
#define IDT_1719 1719
#define IDT_1720 1720 /* Hard disks: */
#define IDT_1721 1721 /* Bus: */
#define IDT_1722 1722 /* Channel: */
@@ -144,12 +145,12 @@
#define IDC_CHECK_SSI 1072
#define IDC_CHECK_CMS 1073
#define IDC_CHECK_GUS 1074
#define IDC_CHECK_NUKEDOPL 1075
#define IDC_COMBO_MIDI 1076
#define IDC_CHECK_MPU401 1077
#define IDC_CONFIGURE_MPU401 1078
#define IDC_CHECK_FLOAT 1079
#define IDC_CHECK_GUSMAX 1080
#define IDC_COMBO_MIDI 1075
#define IDC_CHECK_MPU401 1076
#define IDC_CONFIGURE_MPU401 1077
#define IDC_CHECK_FLOAT 1078
#define IDC_CONFIGURE_GUS 1079
#define IDC_COMBO_MIDI_IN 1080
#define IDC_COMBO_NET_TYPE 1090 /* network config */
#define IDC_COMBO_PCAP 1091
@@ -242,6 +243,7 @@
#define IDC_CONFIGURE_PCAP 1306
#define IDC_CONFIGURE_NET 1307
#define IDC_CONFIGURE_MIDI 1308
#define IDC_CONFIGURE_MIDI_IN 1309
#define IDC_JOY1 1310
#define IDC_JOY2 1311
#define IDC_JOY3 1312

View File

@@ -73,6 +73,7 @@ static rc_str_t *lpRCstr2048,
*lpRCstr6144,
*lpRCstr7168;
static int vid_api_inited = 0;
static wchar_t *argbuf;
static const struct {
@@ -267,6 +268,11 @@ CreateConsole(int init)
}
}
}
if (fp != NULL) {
fclose(fp);
fp = NULL;
}
}
@@ -275,7 +281,6 @@ static int
ProcessCommandLine(wchar_t ***argw)
{
WCHAR *cmdline;
wchar_t *argbuf;
wchar_t **args;
int argc_max;
int i, q, argc;
@@ -376,6 +381,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_HAS_SHUTDOWN, (WPARAM) 0, (LPARAM) hwndMain);
free(argbuf);
free(argw);
return(1);
}
@@ -386,6 +393,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
/* Handle our GUI. */
i = ui_init(nCmdShow);
free(argbuf);
free(argw);
return(i);
}

View File

@@ -88,8 +88,8 @@ extern HICON hIcon[256];
// extern int status_is_open;
extern char openfilestring[260];
extern WCHAR wopenfilestring[260];
extern char openfilestring[512];
extern WCHAR wopenfilestring[512];
extern uint8_t filterindex;

View File

@@ -108,6 +108,21 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
id += 2;
break;
case CONFIG_MIDI_IN:
val_int = config_get_int((char *) config_device.name,
(char *) config->name, config->default_int);
num = plat_midi_in_get_num_devs();
for (c = 0; c < num; c++) {
plat_midi_in_get_dev_name(c, s);
mbstowcs(lptsTemp, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
if (val_int == c)
SendMessage(h, CB_SETCURSEL, c, 0);
}
id += 2;
break;
case CONFIG_SPINNER:
val_int = config_get_int((char *) config_device.name,
(char *) config->name, config->default_int);
@@ -205,6 +220,17 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (val_int != c)
changed = 1;
id += 2;
break;
case CONFIG_MIDI_IN:
val_int = config_get_int((char *) config_device.name,
(char *) config->name, config->default_int);
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (val_int != c)
changed = 1;
@@ -302,6 +328,12 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
c = SendMessage(h, CB_GETCURSEL, 0, 0);
config_set_int((char *) config_device.name, (char *) config->name, c);
id += 2;
break;
case CONFIG_MIDI_IN:
c = SendMessage(h, CB_GETCURSEL, 0, 0);
config_set_int((char *) config_device.name, (char *) config->name, c);
id += 2;
break;
case CONFIG_FNAME:
@@ -358,6 +390,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case CONFIG_SELECTION:
case CONFIG_MIDI:
case CONFIG_MIDI_IN:
case CONFIG_SPINNER:
id += 2;
break;
@@ -478,6 +511,7 @@ deviceconfig_inst_open(HWND hwnd, const device_t *device, int inst)
case CONFIG_SELECTION:
case CONFIG_MIDI:
case CONFIG_MIDI_IN:
case CONFIG_HEX16:
case CONFIG_HEX20:
/*Combo box*/

View File

@@ -34,8 +34,8 @@
#include "win.h"
WCHAR wopenfilestring[260];
char openfilestring[260];
WCHAR wopenfilestring[512];
char openfilestring[512];
uint8_t filterindex = 0;
@@ -139,7 +139,7 @@ file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save)
* not use the contents of szFile to initialize itself.
*/
memcpy(ofn.lpstrFile, fn, (wcslen(fn) << 1) + 2);
ofn.nMaxFile = 259;
ofn.nMaxFile = sizeof_w(wopenfilestring);
ofn.lpstrFilter = f;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;

View File

@@ -74,6 +74,7 @@ discord_update_activity(int paused)
struct DiscordActivity activity;
wchar_t config_name_w[1024];
char config_name[128];
char *temp;
if(discord_activities == NULL)
return;
@@ -90,8 +91,17 @@ discord_update_activity(int paused)
}
else
{
strcpy(activity.details, strchr(machine_getname(), ']') + 2);
strcpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name);
temp = strchr(machine_getname(), ']') + 2;
if (strlen(temp) <= 127)
strcpy(activity.details, temp);
else
strncpy(activity.details, temp, 127);
if (strlen(machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name) <= 127)
strcpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name);
else
strncpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name, 127);
}
activity.timestamps.start = time(NULL);

View File

@@ -65,7 +65,7 @@ dynld_module(const char *name, dllimp_t *table)
if (func == NULL) {
dynld_log("DynLd(\"%s\"): function '%s' not found!\n",
name, imp->name);
CloseHandle(h);
FreeLibrary(h);
return(NULL);
}

View File

@@ -82,37 +82,54 @@ BOOL CALLBACK DIEnumDeviceObjectsCallback(
plat_joystick_t *state = (plat_joystick_t *)pvRef;
if (lpddoi->guidType == GUID_XAxis || lpddoi->guidType == GUID_YAxis || lpddoi->guidType == GUID_ZAxis ||
lpddoi->guidType == GUID_RxAxis || lpddoi->guidType == GUID_RyAxis || lpddoi->guidType == GUID_RzAxis ||
lpddoi->guidType == GUID_Slider)
lpddoi->guidType == GUID_RxAxis || lpddoi->guidType == GUID_RyAxis || lpddoi->guidType == GUID_RzAxis)
{
memcpy(state->axis[state->nr_axes].name, lpddoi->tszName, strlen(lpddoi->tszName) + 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;
else if (lpddoi->guidType == GUID_YAxis)
state->axis[state->nr_axes].id = 1;
else if (lpddoi->guidType == GUID_ZAxis)
state->axis[state->nr_axes].id = 2;
else if (lpddoi->guidType == GUID_RxAxis)
state->axis[state->nr_axes].id = 3;
else if (lpddoi->guidType == GUID_RyAxis)
state->axis[state->nr_axes].id = 4;
else if (lpddoi->guidType == GUID_RzAxis)
state->axis[state->nr_axes].id = 5;
state->nr_axes++;
if (state->nr_axes < 8)
{memcpy(state->axis[state->nr_axes].name, lpddoi->tszName, strlen(lpddoi->tszName) + 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;
else if (lpddoi->guidType == GUID_YAxis)
state->axis[state->nr_axes].id = 1;
else if (lpddoi->guidType == GUID_ZAxis)
state->axis[state->nr_axes].id = 2;
else if (lpddoi->guidType == GUID_RxAxis)
state->axis[state->nr_axes].id = 3;
else if (lpddoi->guidType == GUID_RyAxis)
state->axis[state->nr_axes].id = 4;
else if (lpddoi->guidType == GUID_RzAxis)
state->axis[state->nr_axes].id = 5;
state->nr_axes++;
}
}
else if (lpddoi->guidType == GUID_Button)
{
memcpy(state->button[state->nr_buttons].name, lpddoi->tszName, strlen(lpddoi->tszName) + 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++;
if (state->nr_buttons < 32)
{
memcpy(state->button[state->nr_buttons].name, lpddoi->tszName, strlen(lpddoi->tszName) + 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)
{
memcpy(state->pov[state->nr_povs].name, lpddoi->tszName, strlen(lpddoi->tszName) + 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++;
}
if (state->nr_povs < 4)
{
memcpy(state->pov[state->nr_povs].name, lpddoi->tszName, strlen(lpddoi->tszName) + 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++;
}
}
else if (lpddoi->guidType == GUID_Slider)
{
if (state->nr_sliders < 2)
{
memcpy(state->slider[state->nr_sliders].name, lpddoi->tszName, strlen(lpddoi->tszName) + 1);
state->slider[state->nr_sliders].id = state->nr_sliders | SLIDER;
joystick_log("Slider %i : %s %x %x\n", state->nr_sliders, state->slider[state->nr_sliders].name, lpddoi->dwOfs, lpddoi->dwType);
state->nr_sliders++;
}
}
return DIENUM_CONTINUE;
}
@@ -187,7 +204,11 @@ void joystick_init()
lpdi_joystick[c]->SetProperty(DIPROP_RANGE, &joy_axis_range.diph);
joy_axis_range.diph.dwObj = DIJOFS_RZ;
lpdi_joystick[c]->SetProperty(DIPROP_RANGE, &joy_axis_range.diph);
joy_axis_range.diph.dwObj = DIJOFS_SLIDER(0);
lpdi_joystick[c]->SetProperty(DIPROP_RANGE, &joy_axis_range.diph);
joy_axis_range.diph.dwObj = DIJOFS_SLIDER(1);
lpdi_joystick[c]->SetProperty(DIPROP_RANGE, &joy_axis_range.diph);
if (FAILED(lpdi_joystick[c]->Acquire()))
fatal("joystick_init : Acquire failed\n");
}
@@ -226,6 +247,10 @@ static int joystick_get_axis(int joystick_nr, int mapping)
return 0;
else
return -cos((2*M_PI * (double)pov) / 36000.0) * 32767;
}
else if (mapping & SLIDER)
{
return plat_joystick_state[joystick_nr].s[mapping & 3];
}
else
return plat_joystick_state[joystick_nr].a[plat_joystick_state[joystick_nr].axis[mapping].id];
@@ -235,7 +260,7 @@ void joystick_process(void)
{
int c, d;
if (joystick_type == 7) return;
if (joystick_type == JOYSTICK_TYPE_NONE) return;
for (c = 0; c < joysticks_present; c++)
{
@@ -260,6 +285,8 @@ void joystick_process(void)
plat_joystick_state[c].a[3] = joystate.lRx;
plat_joystick_state[c].a[4] = joystate.lRy;
plat_joystick_state[c].a[5] = joystate.lRz;
plat_joystick_state[c].s[0] = joystate.rglSlider[0];
plat_joystick_state[c].s[1] = joystate.rglSlider[1];
for (b = 0; b < 16; b++)
plat_joystick_state[c].b[b] = joystate.rgbButtons[b] & 0x80;

View File

@@ -216,7 +216,7 @@ void joystick_process(void)
{
int c, d;
if (joystick_type == 7) return;
if (joystick_type == JOYSTICK_TYPE_NONE) return;
joystick_poll();

View File

@@ -58,6 +58,10 @@ static void rebuild_axis_button_selections(HWND hdlg)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
sprintf(s, "%s (Y axis)", plat_joystick_state[joystick-1].pov[d].name);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
}
for (d = 0; d < plat_joystick_state[joystick - 1].nr_sliders; d++)
{
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)plat_joystick_state[joystick - 1].slider[d].name);
}
SendMessage(h, CB_SETCURSEL, sel, 0);
EnableWindow(h, TRUE);
@@ -122,15 +126,23 @@ static int get_axis(HWND hdlg, int id)
HWND h = GetDlgItem(hdlg, id);
int axis_sel = SendMessage(h, CB_GETCURSEL, 0, 0);
int nr_axes = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr-1].nr_axes;
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_povs;
int nr_sliders = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_sliders;
if (axis_sel < nr_axes)
return axis_sel;
axis_sel -= nr_axes;
if (axis_sel & 1)
return POV_Y | (axis_sel >> 1);
else
return POV_X | (axis_sel >> 1);
if (axis_sel < nr_povs * 2)
{
if (axis_sel & 1)
return POV_Y | (axis_sel >> 1);
else
return POV_X | (axis_sel >> 1);
}
axis_sel -= nr_povs;
return SLIDER | (axis_sel >> 1);
}
static int get_pov(HWND hdlg, int id)
@@ -163,6 +175,7 @@ joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
int joystick;
int nr_axes;
int nr_povs;
int nr_sliders;
int mapping;
switch (message)
@@ -186,6 +199,8 @@ joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
nr_axes = plat_joystick_state[joystick-1].nr_axes;
nr_povs = plat_joystick_state[joystick-1].nr_povs;
nr_sliders = plat_joystick_state[joystick - 1].nr_sliders;
for (c = 0; c < joystick_get_axis_count(joystick_config_type); c++)
{
int mapping = joystick_state[joystick_nr].axis_mapping[c];
@@ -195,7 +210,9 @@ joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
SendMessage(h, CB_SETCURSEL, nr_axes + (mapping & 3)*2, 0);
else if (mapping & POV_Y)
SendMessage(h, CB_SETCURSEL, nr_axes + (mapping & 3)*2 + 1, 0);
else
else if (mapping & SLIDER)
SendMessage(h, CB_SETCURSEL, nr_axes + nr_povs * 2 + (mapping & 3), 0);
else
SendMessage(h, CB_SETCURSEL, mapping, 0);
id += 2;
}

View File

@@ -13,16 +13,17 @@
typedef struct
{
int midi_id;
int midi_id, midi_input_id;
HANDLE m_event;
HMIDIOUT midi_out_device;
HMIDIIN midi_in_device;
MIDIHDR m_hdr;
} plat_midi_t;
plat_midi_t *pm = NULL;
plat_midi_t *pm = NULL, *pm_in = NULL;
void
@@ -65,7 +66,7 @@ plat_midi_close(void)
midiOutClose(pm->midi_out_device);
CloseHandle(pm->m_event);
}
free(pm);
pm = NULL;
}
@@ -135,3 +136,117 @@ plat_midi_write(uint8_t val)
{
return 0;
}
void CALLBACK
plat_midi_in_callback(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
{
uint8_t msg[4] = {((dwParam1&0xff)),(((dwParam1&0xff00)>>8)),
(((dwParam1&0xff0000)>>16)),MIDI_evt_len[((dwParam1&0xff))]};
uint8_t *sysex;
uint32_t len;
int cnt;
MIDIHDR *hdr;
switch (wMsg) {
case MM_MIM_DATA: /* 0x3C3 - midi message */
input_msg(midi_in_p, msg);
break;
case MM_MIM_OPEN: /* 0x3C1 */
break;
case MM_MIM_CLOSE: /* 0x3C2 */
break;
case MM_MIM_LONGDATA: /* 0x3C4 - sysex */
hdr = (MIDIHDR *)dwParam1;
sysex = (uint8_t *)hdr->lpData;
len = (uint32_t)hdr->dwBytesRecorded;
cnt = 5;
while (cnt) { /*abort if timed out*/
int ret = input_sysex(midi_in_p, sysex, len, 0);
if (!ret) {
len = 0;
break;
}
if (len==ret)
cnt--;
else
cnt = 5;
sysex += len-ret;
len = ret;
Sleep(5);/*msec*/
}
if (len)
input_sysex(midi_in_p, sysex, 0, 0);
midiInUnprepareHeader(hMidiIn, hdr, sizeof(*hdr));
hdr->dwBytesRecorded = 0;
midiInPrepareHeader(hMidiIn, hdr, sizeof(*hdr));
break;
case MM_MIM_ERROR:
case MM_MIM_LONGERROR:
break;
default:
break;
}
}
void
plat_midi_input_init(void)
{
MMRESULT hr;
pm_in = (plat_midi_t *) malloc(sizeof(plat_midi_t));
memset(pm_in, 0, sizeof(plat_midi_t));
pm_in->midi_input_id = config_get_int(MIDI_INPUT_NAME, "midi_input", 0);
hr = MMSYSERR_NOERROR;
hr = midiInOpen(&pm_in->midi_in_device, pm_in->midi_input_id,
(uintptr_t) plat_midi_in_callback, 0, CALLBACK_FUNCTION);
if (hr != MMSYSERR_NOERROR) {
printf("midiInOpen error - %08X\n", hr);
pm_in->midi_input_id = 0;
hr = midiInOpen(&pm_in->midi_in_device, pm_in->midi_input_id,
(uintptr_t) plat_midi_in_callback, 0, CALLBACK_FUNCTION);
if (hr != MMSYSERR_NOERROR) {
printf("midiInOpen error - %08X\n", hr);
return;
}
}
pm_in->m_hdr.lpData = (char*)&MIDI_InSysexBuf[0];
pm_in->m_hdr.dwBufferLength = SYSEX_SIZE;
pm_in->m_hdr.dwBytesRecorded = 0;
pm_in->m_hdr.dwUser = 0;
midiInPrepareHeader(pm_in->midi_in_device,&pm_in->m_hdr,sizeof(pm_in->m_hdr));
midiInStart(pm_in->midi_in_device);
}
void
plat_midi_input_close(void)
{
if (pm_in) {
if (pm_in->midi_in_device != NULL) {
midiInStop(pm_in->midi_in_device);
midiInClose(pm_in->midi_in_device);
}
free(pm_in);
pm_in = NULL;
}
}
int
plat_midi_in_get_num_devs(void)
{
return midiInGetNumDevs();
}
void
plat_midi_in_get_dev_name(int num, char *s)
{
MIDIINCAPS caps;
midiInGetDevCaps(num, &caps, sizeof(caps));
strcpy(s, caps.szPname);
}

View File

@@ -63,8 +63,9 @@ win_mouse_handle(LPARAM lParam, int infocus)
uint32_t ri_size = 0;
UINT size;
RAWINPUT *raw;
RAWMOUSE state;
RAWMOUSE state;
static int x, y;
if (! infocus) return;
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL,
@@ -109,7 +110,7 @@ win_mouse_handle(LPARAM lParam, int infocus)
* seems to work fine for RDP on Windows 10
* Not sure about other environments.
*/
static int x=state.lLastX, y=state.lLastY;
x=state.lLastX, y=state.lLastY;
mousestate.dx += (state.lLastX - x)/100;
mousestate.dy += (state.lLastY - y)/100;
x=state.lLastX;

View File

@@ -1,103 +0,0 @@
/*
* 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
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Mouse interface to host device.
*
* Version: @(#)win_mouse.cpp 1.0.6 2017/11/25
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
*/
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <stdio.h>
#include <stdint.h>
#include "../86box.h"
#include "../mouse.h"
#include "../plat.h"
#include "win.h"
int mouse_capture;
static LPDIRECTINPUT8 lpdi;
static LPDIRECTINPUTDEVICE8 lpdi_mouse = NULL;
static DIMOUSESTATE mousestate;
void
win_mouse_init(void)
{
atexit(win_mouse_close);
mouse_capture = 0;
if (FAILED(DirectInput8Create(hinstance, DIRECTINPUT_VERSION,
IID_IDirectInput8A, (void **) &lpdi, NULL)))
fatal("plat_mouse_init: DirectInputCreate failed\n");
if (FAILED(lpdi->CreateDevice(GUID_SysMouse, &lpdi_mouse, NULL)))
fatal("plat_mouse_init: CreateDevice failed\n");
if (FAILED(lpdi_mouse->SetCooperativeLevel(hwndMain,
DISCL_FOREGROUND | (video_fullscreen ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE))))
fatal("plat_mouse_init: SetCooperativeLevel failed\n");
if (FAILED(lpdi_mouse->SetDataFormat(&c_dfDIMouse)))
fatal("plat_mouse_init: SetDataFormat failed\n");
}
void
win_mouse_close(void)
{
if (lpdi_mouse != NULL) {
lpdi_mouse->Release();
lpdi_mouse = NULL;
}
}
void
mouse_poll(void)
{
static int buttons = 0;
static int x = 0, y = 0, z = 0;
int b;
if (FAILED(lpdi_mouse->GetDeviceState(sizeof(DIMOUSESTATE),
(LPVOID)&mousestate))) {
lpdi_mouse->Acquire();
lpdi_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mousestate);
}
if (mouse_capture || video_fullscreen) {
if (x != mousestate.lX || y != mousestate.lY || z != mousestate.lZ) {
mouse_x += mousestate.lX;
mouse_y += mousestate.lY;
mouse_z += mousestate.lZ/120;
x = mousestate.lX;
y = mousestate.lY;
z = mousestate.lZ/120;
}
b = 0;
if (mousestate.rgbButtons[0] & 0x80) b |= 1;
if (mousestate.rgbButtons[1] & 0x80) b |= 2;
if (mousestate.rgbButtons[2] & 0x80) b |= 4;
if (buttons != b) {
mouse_buttons = b;
buttons = b;
}
}
}

View File

@@ -80,7 +80,7 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
uint16_t tflags = 0;
uint32_t index_hole_pos = 0;
uint32_t tarray[512];
uint32_t array_size, array_size2;
uint32_t array_size;
uint32_t track_base, track_size;
int i;
uint32_t shift = 0;
@@ -133,11 +133,6 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
break;
}
array_size2 = (array_size << 3);
array_size = (array_size2 >> 4) << 1;
if (array_size2 & 15)
array_size += 2;
empty = (unsigned char *) malloc(array_size);
memset(tarray, 0, 2048);
@@ -515,7 +510,7 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi,
static int fdd_id, sb_part;
static int file_type = 0; /* 0 = IMG, 1 = Japanese FDI, 2 = 86F */
static wchar_t fd_file_name[512];
static wchar_t fd_file_name[1024];
/* Show a MessageBox dialog. This is nasty, I know. --FvK */
@@ -556,7 +551,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_INITDIALOG:
plat_pause(1);
memset(fd_file_name, 0, 512 * sizeof(wchar_t));
memset(fd_file_name, 0, 1024 * sizeof(wchar_t));
h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE);
if (is_zip) {
zip_types = zip_drives[fdd_id].is_250 ? 2 : 1;
@@ -613,6 +608,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
new_floppy_msgbox(hdlg, MBX_ERROR, (wchar_t *)IDS_4108);
return TRUE;
}
/*FALLTHROUGH*/
case IDCANCEL:
EndDialog(hdlg, 0);
plat_pause(0);

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.62 2019/11/19
* Version: @(#)win_settings.c 1.0.63 2019/12/21
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* David Hrdlička, <hrdlickadavid@outlook.com>
@@ -55,8 +55,8 @@
#include "../network/network.h"
#include "../sound/sound.h"
#include "../sound/midi.h"
#include "../sound/snd_dbopl.h"
#include "../sound/snd_mpu401.h"
#include "../sound/snd_gus.h"
#include "../video/video.h"
#include "../video/vid_voodoo.h"
#include "../plat.h"
@@ -85,7 +85,7 @@ static int temp_gfxcard, temp_voodoo;
static int temp_mouse, temp_joystick;
/* Sound category */
static int temp_sound_card, temp_midi_device, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl_type;
static int temp_sound_card, temp_midi_device, temp_midi_input_device, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS;
static int temp_float;
/* Network category */
@@ -124,6 +124,7 @@ extern int is486;
static int listtomachine[256], machinetolist[256];
static int settings_device_to_list[2][20], settings_list_to_device[2][20];
static int settings_midi_to_list[20], settings_list_to_midi[20];
static int settings_midi_in_to_list[20], settings_list_to_midi_in[20];
static int max_spt = 63, max_hpc = 255, max_tracks = 266305;
static uint64_t mfm_tracking, esdi_tracking, xta_tracking, ide_tracking, scsi_tracking[2];
@@ -219,11 +220,11 @@ win_settings_init(void)
/* Sound category */
temp_sound_card = sound_card_current;
temp_midi_device = midi_device_current;
temp_midi_input_device = midi_input_device_current;
temp_mpu401 = mpu401_standalone_enable;
temp_SSI2001 = SSI2001;
temp_GAMEBLASTER = GAMEBLASTER;
temp_GUS = GUS;
temp_opl_type = opl_type;
temp_float = sound_is_float;
/* Network category */
@@ -331,11 +332,11 @@ win_settings_changed(void)
/* Sound category */
i = i || (sound_card_current != temp_sound_card);
i = i || (midi_device_current != temp_midi_device);
i = i || (midi_input_device_current != temp_midi_input_device);
i = i || (mpu401_standalone_enable != temp_mpu401);
i = i || (SSI2001 != temp_SSI2001);
i = i || (GAMEBLASTER != temp_GAMEBLASTER);
i = i || (GUS != temp_GUS);
i = i || (opl_type != temp_opl_type);
i = i || (sound_is_float != temp_float);
/* Network category */
@@ -434,11 +435,11 @@ win_settings_save(void)
/* Sound category */
sound_card_current = temp_sound_card;
midi_device_current = temp_midi_device;
midi_input_device_current = temp_midi_input_device;
mpu401_standalone_enable = temp_mpu401;
SSI2001 = temp_SSI2001;
GAMEBLASTER = temp_GAMEBLASTER;
GUS = temp_GUS;
opl_type = temp_opl_type;
sound_is_float = temp_float;
/* Network category */
@@ -538,13 +539,9 @@ win_settings_machine_recalc_cpu(HWND hdlg)
h = GetDlgItem(hdlg, IDC_CHECK_FPU);
cpu_type = machines[temp_machine].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type;
// if ((cpu_type < CPU_i486DX) && (cpu_type >= CPU_286))
if (cpu_type < CPU_i486DX)
EnableWindow(h, TRUE);
else if (cpu_type < CPU_286) {
temp_fpu = 0;
EnableWindow(h, FALSE);
} else {
else {
temp_fpu = 1;
EnableWindow(h, FALSE);
}
@@ -974,6 +971,7 @@ static BOOL CALLBACK
win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
wchar_t str[128];
char *joy_name;
HWND h;
int c, d;
@@ -1003,9 +1001,15 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
c = 0;
while (joystick_get_name(c)) {
SendMessage(h, CB_ADDSTRING, 0, win_get_string(2105 + c));
joy_name = joystick_get_name(c);
while (joy_name)
{
mbstowcs(str, joy_name, strlen(joy_name) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)str);
// SendMessage(h, CB_ADDSTRING, 0, win_get_string(2105 + c));
c++;
joy_name = joystick_get_name(c);
}
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_joystick, 0);
@@ -1104,19 +1108,19 @@ mpu401_present(void)
int
mpu401_standalone_allow(void)
{
char *md;
char *md, *mdin;
md = midi_device_get_internal_name(temp_midi_device);
mdin = midi_in_device_get_internal_name(temp_midi_input_device);
if (md != NULL) {
if (!strcmp(md, "none"))
if (!strcmp(md, "none") && !strcmp(mdin, "none"))
return 0;
}
return 1;
}
#if defined(__amd64__) || defined(__aarch64__)
static LRESULT CALLBACK
#else
@@ -1199,25 +1203,58 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
else
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN);
c = d = 0;
while (1) {
s = midi_in_device_getname(c);
if (!s[0])
break;
settings_midi_in_to_list[c] = d;
if (midi_in_device_available(c)) {
if (c == 0)
SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112));
else {
mbstowcs(lptsTemp, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
settings_list_to_midi_in[d] = c;
d++;
}
c++;
}
SendMessage(h, CB_SETCURSEL, settings_midi_in_to_list[temp_midi_input_device], 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI_IN);
if (midi_in_device_has_config(temp_midi_input_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_CONFIGURE_GUS);
EnableWindow(h, (temp_GUS) ? TRUE : FALSE);
h=GetDlgItem(hdlg, IDC_CHECK_SSI);
SendMessage(h, BM_SETCHECK, temp_SSI2001, 0);
h=GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL);
SendMessage(h, BM_SETCHECK, temp_opl_type, 0);
h=GetDlgItem(hdlg, IDC_CHECK_FLOAT);
SendMessage(h, BM_SETCHECK, temp_float, 0);
@@ -1277,6 +1314,31 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_device_getdevice(temp_midi_device));
break;
case IDC_COMBO_MIDI_IN:
h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN);
temp_midi_input_device = settings_list_to_midi_in[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_MIDI_IN);
if (midi_in_device_has_config(temp_midi_input_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_IN:
h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN);
temp_midi_input_device = settings_list_to_midi_in[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_in_device_getdevice(temp_midi_input_device));
break;
case IDC_CHECK_MPU401:
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0);
@@ -1289,6 +1351,18 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
temp_deviceconfig |= deviceconfig_open(hdlg, (machines[temp_machine].flags & MACHINE_MCA) ?
(void *)&mpu401_mca_device : (void *)&mpu401_device);
break;
case IDC_CHECK_GUS:
h = GetDlgItem(hdlg, IDC_CHECK_GUS);
temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_GUS);
EnableWindow(h, temp_GUS ? TRUE : FALSE);
break;
case IDC_CONFIGURE_GUS:
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)&gus_device);
break;
}
return FALSE;
@@ -1299,6 +1373,9 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
temp_midi_device = settings_list_to_midi[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBO_MIDI_IN);
temp_midi_input_device = settings_list_to_midi_in[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CHECK_MPU401);
temp_mpu401 = SendMessage(h, BM_GETCHECK, 0, 0);
@@ -1311,9 +1388,6 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
h = GetDlgItem(hdlg, IDC_CHECK_SSI);
temp_SSI2001 = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL);
temp_opl_type = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_FLOAT);
temp_float = SendMessage(h, BM_GETCHECK, 0, 0);
@@ -2461,7 +2535,7 @@ static int hdconf_initialize_hdt_combo(HWND hdlg)
h = GetDlgItem(hdlg, IDC_COMBO_HD_TYPE);
for (i = 0; i < 127; i++) {
temp_size = hdd_table[i][0] * hdd_table[i][1] * hdd_table[i][2];
temp_size = ((uint64_t) hdd_table[i][0]) * hdd_table[i][1] * hdd_table[i][2];
size_mb = (uint32_t) (temp_size >> 11LL);
wsprintf(szText, plat_get_string(IDS_2116), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText);
@@ -2779,6 +2853,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
f = _wfopen(wopenfilestring, (existing & 1) ? L"rb" : L"wb");
if (f == NULL) {
hdd_add_file_open_error:
fclose(f);
settings_msgbox(MBX_ERROR, (existing & 1) ? (wchar_t *)IDS_4107 : (wchar_t *)IDS_4108);
return TRUE;
}
@@ -2809,7 +2884,6 @@ hdd_add_file_open_error:
} else {
fseeko64(f, 0, SEEK_END);
size = ftello64(f);
fclose(f);
if (((size % 17) == 0) && (size <= 142606336)) {
spt = 17;
if (size <= 26738688)
@@ -2857,8 +2931,9 @@ hdd_add_file_open_error:
chs_enabled = 1;
no_update = 0;
} else
fclose(f);
}
fclose(f);
}
h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME);
@@ -3396,7 +3471,7 @@ win_settings_floppy_drives_recalc_list(HWND hwndList)
{
LVITEM lvI;
int i = 0;
char s[256];
char s[256], *t;
WCHAR szText[256];
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
@@ -3405,7 +3480,11 @@ win_settings_floppy_drives_recalc_list(HWND hwndList)
for (i = 0; i < 4; i++) {
lvI.iSubItem = 0;
if (temp_fdd_types[i] > 0) {
strcpy(s, fdd_getname(temp_fdd_types[i]));
t = fdd_getname(temp_fdd_types[i]);
if (strlen(t) <= 256)
strcpy(s, t);
else
strncpy(s, t, 256);
mbstowcs(szText, s, strlen(s) + 1);
lvI.pszText = szText;
} else
@@ -3660,7 +3739,7 @@ static void
win_settings_floppy_drives_update_item(HWND hwndList, int i)
{
LVITEM lvI;
char s[256];
char s[256], *t;
WCHAR szText[256];
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
@@ -3670,7 +3749,11 @@ win_settings_floppy_drives_update_item(HWND hwndList, int i)
lvI.iItem = i;
if (temp_fdd_types[i] > 0) {
strcpy(s, fdd_getname(temp_fdd_types[i]));
t = fdd_getname(temp_fdd_types[i]);
if (strlen(t) <= 256)
strcpy(s, t);
else
strncpy(s, t, 256);
mbstowcs(szText, s, strlen(s) + 1);
lvI.pszText = szText;
} else

View File

@@ -59,8 +59,8 @@ int infocus = 1;
int rctrl_is_lalt = 0;
int user_resize = 0;
char openfilestring[260];
WCHAR wopenfilestring[260];
char openfilestring[512];
WCHAR wopenfilestring[512];
/* Local data. */
@@ -628,8 +628,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
plat_vidapi_enable(0);
temp_y -= sbar_height;
if (temp_x < 1)
temp_x = 1;
if (temp_y < 1)
temp_y = 1;
@@ -1079,9 +1077,12 @@ wchar_t *
ui_window_title(wchar_t *s)
{
if (! video_fullscreen) {
if (s != NULL)
wcscpy(wTitle, s);
else
if (s != NULL) {
if (wcslen(s) <= 512)
wcscpy(wTitle, s);
else
wcsncpy(wTitle, s, 512);
} else
s = wTitle;
SetWindowText(hwndMain, s);
@@ -1099,7 +1100,7 @@ void
plat_pause(int p)
{
static wchar_t oldtitle[512];
wchar_t title[512];
wchar_t title[512], *t;
/* If un-pausing, as the renderer if that's OK. */
if (p == 0)
@@ -1115,7 +1116,11 @@ plat_pause(int p)
}
if (p) {
wcscpy(oldtitle, ui_window_title(NULL));
t = ui_window_title(NULL);
if (wcslen(t) <= 511)
wcscpy(oldtitle, ui_window_title(NULL));
else
wcsncpy(oldtitle, ui_window_title(NULL), 511);
wcscpy(title, oldtitle);
wcscat(title, L" - PAUSED -");
ui_window_title(title);