This commit is contained in:
RichardG867
2020-03-24 19:10:49 -03:00
532 changed files with 26582 additions and 31166 deletions

View File

@@ -474,6 +474,9 @@ BEGIN
CONTROL "ISABugger device",IDC_CHECK_BUGGER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
CONTROL "POST card",IDC_CHECK_POSTCARD,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,80,94,10
LTEXT "ISA RTC",IDT_1767,7,99,48,10
COMBOBOX IDC_COMBO_ISARTC,64,98,155,120,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.140 2019/12/21
# Version: @(#)Makefile.mingw 1.0.143 2020/01/25
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -83,8 +83,11 @@ ifeq ($(DEV_BUILD), y)
ifndef VECTRA54
VECTRA54 := y
endif
ifndef MICRONICS386
MICRONICS386 := y
ifndef VPP60
VP660 := y
endif
ifndef SIEMENS
SIEMENS := y
endif
ifndef VGAWONDER
VGAWONDER := y
@@ -147,8 +150,11 @@ else
ifndef VECTRA54
VECTRA54 := n
endif
ifndef MICRONICS386
MICRONICS386 := n
ifndef VPP60
VP660 := n
endif
ifndef SIEMENS
SIEMENS := n
endif
ifndef VGAWONDER
VGAWONDER := n
@@ -260,7 +266,7 @@ endif
#########################################################################
# Nothing should need changing from here on.. #
#########################################################################
VPATH := $(EXPATH) . cpu \
VPATH := $(EXPATH) . cpu cpu_common \
cdrom chipset disk floppy game machine \
printer \
sound \
@@ -294,6 +300,17 @@ DEPFILE := win/.depends
# Set up the correct toolchain flags.
OPTS := $(EXTRAS) $(STUFF)
ifeq ($(WX), y)
OPTS += -I. \
-Icpu -Icpu_common \
-Icdrom -Ichipset -Idisk -Ifloppy -Igame -Imachine -Inetwork \
-Iprinter -Isound -Iscsi -Ivideo -Ilang
else
OPTS += -iquote . \
-iquote cpu -iquote cpu_common \
-iquote cdrom -iquote chipset -iquote disk -iquote floppy -iquote game -iquote machine -iquote network \
-iquote printer -iquote sound -iquote scsi -iquote video -iquote lang
endif
ifdef EXFLAGS
OPTS += $(EXFLAGS)
endif
@@ -332,7 +349,7 @@ else
endif
endif
endif
AFLAGS := -msse2 -mfpmath=sse
AFLAGS := -msse2 -mfpmath=387
ifeq ($(ARM), y)
DFLAGS := -march=armv7-a
AOPTIM :=
@@ -461,7 +478,6 @@ endif
ifeq ($(I686), y)
OPTS += -DUSE_I686
DEVBROBJ += m_at_socket8.o
endif
ifeq ($(LASERXT), y)
@@ -506,8 +522,12 @@ ifeq ($(VECTRA54), y)
OPTS += -DUSE_VECTRA54
endif
ifeq ($(MICRONICS386), y)
OPTS += -DUSE_MICRONICS386
ifeq ($(VPP60), y)
OPTS += -DUSE_VPP60
endif
ifeq ($(SIEMENS), y)
OPTS += -DUSE_SIEMENS
endif
ifeq ($(VGAWONDER), y)
@@ -529,8 +549,9 @@ 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
$(AFLAGS) -pipe -fomit-frame-pointer -mstackrealign -Wall \
-fno-strict-aliasing
# -funroll-loops
# Add freetyp2 references through pkgconfig
CFLAGS := $(CFLAGS) `pkg-config.exe --cflags freetype2`
@@ -543,21 +564,22 @@ CXXFLAGS := $(CFLAGS)
#########################################################################
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
CPUOBJ := cpu.o cpu_table.o \
808x.o 386.o \
808x.o \
386.o 386_common.o \
386_dynarec.o \
x86seg.o x87.o \
$(DYNARECOBJ)
CHIPSETOBJ := acc2168.o acer_m3a.o ali1429.o headland.o \
intel_4x0.o neat.o opti495.o scat.o \
intel_4x0.o neat.o opti495.o scamp.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 \
@@ -572,14 +594,18 @@ MCHOBJ := machine.o machine_table.o \
m_ps2_isa.o m_ps2_mca.o \
m_at_compaq.o \
m_at_286_386sx.o m_at_386dx_486.o \
m_at_socket4_5.o m_at_socket7_s7.o
m_at_socket4_5.o m_at_socket7_s7.o \
m_at_socket8.o
DEVOBJ := bugger.o ibm_5161.o isamem.o isartc.o lpt.o $(SERIAL) \
DEVOBJ := bugger.o hwm.o hwm_w83781d.o ibm_5161.o isamem.o isartc.o lpt.o postcard.o $(SERIAL) \
sio_acc3221.o \
sio_fdc37c66x.o sio_fdc37c669.o \
sio_fdc37c93x.o \
sio_pc87306.o sio_w83877f.o \
sio_pc87306.o \
sio_w83787f.o \
sio_w83877f.o sio_w83977f.o \
sio_um8669f.o \
smbus.o \
keyboard.o \
keyboard_xt.o keyboard_at.o \
gameport.o \
@@ -616,7 +642,8 @@ SCSIOBJ := scsi.o scsi_device.o \
scsi_cdrom.o scsi_disk.o \
scsi_x54x.o \
scsi_aha154x.o scsi_buslogic.o \
scsi_ncr5380.o scsi_ncr53c8xx.o
scsi_ncr5380.o scsi_ncr53c8xx.o \
scsi_spock.o
NETOBJ := network.o \
net_pcap.o \
@@ -678,6 +705,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 \
@@ -777,7 +805,7 @@ all: $(PROG).exe pcap_if.exe
$(PROG).exe: $(OBJ) 86Box.res
@echo Linking $(PROG).exe ..
@$(CC) -o $(PROG).exe $(OBJ) 86Box.res $(LIBS)
@$(CC) -o $(PROG).exe $(OBJ) 86Box.res $(LIBS) -pipe
ifneq ($(DEBUG), y)
@$(STRIP) $(PROG).exe
endif

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.140 2019/12/21
# Version: @(#)Makefile.mingw 1.0.142 2020/01/25
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -83,8 +83,11 @@ ifeq ($(DEV_BUILD), y)
ifndef VECTRA54
VECTRA54 := y
endif
ifndef MICRONICS386
MICRONICS386 := y
ifndef VPP60
VPP60 := y
endif
ifndef SIEMENS
SIEMENS := y
endif
ifndef VGAWONDER
VGAWONDER := y
@@ -147,8 +150,11 @@ else
ifndef VECTRA54
VECTRA54 := n
endif
ifndef MICRONICS386
MICRONICS386 := n
ifndef VPP60
VPP60 := n
endif
ifndef SIEMENS
SIEMENS := n
endif
ifndef VGAWONDER
VGAWONDER := n
@@ -260,7 +266,7 @@ endif
#########################################################################
# Nothing should need changing from here on.. #
#########################################################################
VPATH := $(EXPATH) . cpu_new \
VPATH := $(EXPATH) . cpu_new cpu_common \
cdrom chipset disk floppy game machine \
printer \
sound \
@@ -294,6 +300,17 @@ DEPFILE := win/.depends
# Set up the correct toolchain flags.
OPTS := $(EXTRAS) $(STUFF)
ifeq ($(WX), y)
OPTS += -I. \
-Icpu_new -Icpu_common \
-Icdrom -Ichipset -Idisk -Ifloppy -Igame -Imachine -Inetwork \
-Iprinter -Isound -Iscsi -Ivideo -Ilang
else
OPTS += -iquote . \
-iquote cpu_new -iquote cpu_common \
-iquote cdrom -iquote chipset -iquote disk -iquote floppy -iquote game -iquote machine -iquote network \
-iquote printer -iquote sound -iquote scsi -iquote video -iquote lang
endif
ifdef EXFLAGS
OPTS += $(EXFLAGS)
endif
@@ -467,7 +484,6 @@ endif
ifeq ($(I686), y)
OPTS += -DUSE_I686
DEVBROBJ += m_at_socket8.o
endif
ifeq ($(LASERXT), y)
@@ -512,8 +528,12 @@ ifeq ($(VECTRA54), y)
OPTS += -DUSE_VECTRA54
endif
ifeq ($(MICRONICS386), y)
OPTS += -DUSE_MICRONICS386
ifeq ($(VPP60), y)
OPTS += -DUSE_VPP60
endif
ifeq ($(SIEMENS), y)
OPTS += -DUSE_SIEMENS
endif
ifeq ($(VGAWONDER), y)
@@ -536,7 +556,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`
@@ -548,24 +568,25 @@ CXXFLAGS := $(CFLAGS)
# Create the (final) list of objects to build. #
#########################################################################
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)
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 sst_flash.o via_vt82c586b.o $(VNCOBJ) $(RDPOBJ)
INTELOBJ := intel_flash.o \
intel_sio.o intel_piix.o
CPUOBJ := cpu.o cpu_table.o \
808x.o 386.o 386_common.o \
808x.o \
386.o 386_common.o \
386_dynarec.o \
x86seg.o x87.o \
$(DYNARECOBJ)
CHIPSETOBJ := acc2168.o acer_m3a.o ali1429.o headland.o \
intel_4x0.o neat.o opti495.o scat.o \
intel_4x0.o neat.o opti495.o scamp.o scat.o \
sis_85c471.o sis_85c496.o \
wd76c10.o
via_mvp3.o wd76c10.o
MCHOBJ := machine.o machine_table_new.o \
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 \
@@ -578,14 +599,18 @@ MCHOBJ := machine.o machine_table_new.o \
m_ps2_isa.o m_ps2_mca.o \
m_at_compaq.o \
m_at_286_386sx.o m_at_386dx_486.o \
m_at_socket4_5.o m_at_socket7_s7.o
m_at_socket4_5.o m_at_socket7_s7.o \
m_at_socket8.o
DEVOBJ := bugger.o ibm_5161.o isamem.o isartc.o lpt.o $(SERIAL) \
DEVOBJ := bugger.o hwm.o hwm_w83781d.o ibm_5161.o isamem.o isartc.o lpt.o postcard.o $(SERIAL) \
sio_acc3221.o \
sio_fdc37c66x.o sio_fdc37c669.o \
sio_fdc37c93x.o \
sio_pc87306.o sio_w83877f.o \
sio_pc87306.o \
sio_w83787f.o \
sio_w83877f.o sio_w83977f.o \
sio_um8669f.o \
smbus.o \
keyboard.o \
keyboard_xt.o keyboard_at.o \
gameport.o \
@@ -622,7 +647,8 @@ SCSIOBJ := scsi.o scsi_device.o \
scsi_cdrom.o scsi_disk.o \
scsi_x54x.o \
scsi_aha154x.o scsi_buslogic.o \
scsi_ncr5380.o scsi_ncr53c8xx.o
scsi_ncr5380.o scsi_ncr53c8xx.o \
scsi_spock.o
NETOBJ := network.o \
net_pcap.o \
@@ -684,6 +710,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 \

View File

@@ -175,7 +175,7 @@
#define IDC_CHECK_IDE_QUA 1127
#define IDC_BUTTON_IDE_QUA 1128
#define IDC_CHECK_BUGGER 1129
#define IDC_CONFIGURE_BUGGER 1130
#define IDC_CHECK_POSTCARD 1130
#define IDC_COMBO_ISARTC 1131
#define IDC_CONFIGURE_ISARTC 1132
#define IDC_GROUP_ISAMEM 1140

View File

@@ -30,18 +30,18 @@
#include <time.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include "../86box.h"
#include "../config.h"
#include "../device.h"
#include "../keyboard.h"
#include "../mouse.h"
#include "../video/video.h"
#include "86box.h"
#include "config.h"
#include "device.h"
#include "keyboard.h"
#include "mouse.h"
#include "video.h"
#define GLOBAL
#include "../plat.h"
#include "../plat_midi.h"
#include "../ui.h"
#include "plat.h"
#include "plat_midi.h"
#include "ui.h"
#ifdef USE_VNC
# include "../vnc.h"
# include "vnc.h"
#endif
# include "win_d2d.h"
# include "win_sdl.h"
@@ -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

@@ -26,8 +26,8 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../plat.h"
#include "86box.h"
#include "plat.h"
#include "win.h"

View File

@@ -27,14 +27,14 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../config.h"
#include "../disk/hdd.h"
#include "../scsi/scsi_device.h"
#include "../cdrom/cdrom.h"
#include "../disk/zip.h"
#include "../scsi/scsi_disk.h"
#include "../plat.h"
#include "../ui.h"
#include "config.h"
#include "hdd.h"
#include "scsi_device.h"
#include "cdrom.h"
#include "zip.h"
#include "scsi_disk.h"
#include "plat.h"
#include "ui.h"
#include "win.h"

View File

@@ -25,8 +25,8 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "../86box.h"
#include "../plat.h"
#include "86box.h"
#include "plat.h"
#include "win.h"

View File

@@ -27,12 +27,12 @@
#undef BITMAP
#define HAVE_STDARG_H
#include "../86box.h"
#include "../device.h"
#include "../video/video.h"
#include "../plat.h"
#include "../plat_dynld.h"
#include "../ui.h"
#include "86box.h"
#include "device.h"
#include "video.h"
#include "plat.h"
#include "plat_dynld.h"
#include "ui.h"
#include "win.h"
#include "win_d2d.h"

View File

@@ -21,12 +21,12 @@
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../config.h"
#include "../device.h"
#include "../plat.h"
#include "../plat_midi.h"
#include "../ui.h"
#include "86box.h"
#include "config.h"
#include "device.h"
#include "plat.h"
#include "plat_midi.h"
#include "ui.h"
#include "win.h"
#include <windowsx.h>

View File

@@ -27,15 +27,15 @@
#include <string.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include "../86box.h"
#include "../device.h"
#include "../plat.h"
#include "../ui.h"
#include "86box.h"
#include "device.h"
#include "plat.h"
#include "ui.h"
#include "win.h"
WCHAR wopenfilestring[260];
char openfilestring[260];
WCHAR wopenfilestring[512];
char openfilestring[512];
uint8_t filterindex = 0;
@@ -145,7 +145,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

@@ -22,15 +22,11 @@
#include <stringapiset.h>
#include <time.h>
#define HAVE_STDARG_H
#include "../86box.h"
#ifdef USE_NEW_DYNAREC
#include "../cpu_new/cpu.h"
#else
#include "../cpu/cpu.h"
#endif
#include "../machine/machine.h"
#include "../plat.h"
#include "../plat_dynld.h"
#include "86box.h"
#include "cpu.h"
#include "machine.h"
#include "plat.h"
#include "plat_dynld.h"
#include "win_discord.h"
#include "discord_game_sdk.h"
@@ -74,6 +70,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 +87,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

@@ -22,8 +22,8 @@
#include <wchar.h>
#include <windows.h>
#define HAVE_STDARG_H
#include "../86box.h"
#include "../plat_dynld.h"
#include "86box.h"
#include "plat_dynld.h"
#ifdef ENABLE_DYNLD_LOG
@@ -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

@@ -23,10 +23,10 @@
#include <stdint.h>
#include <stdio.h>
#define HAVE_STDARG_H
#include "../86box.h"
#include "../device.h"
#include "../plat.h"
#include "../game/gameport.h"
#include "86box.h"
#include "device.h"
#include "plat.h"
#include "gameport.h"
#include "win.h"
@@ -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

@@ -24,10 +24,10 @@
#include <stdint.h>
#include <stdio.h>
#define HAVE_STDARG_H
#include "../86box.h"
#include "../device.h"
#include "../plat.h"
#include "../game/gameport.h"
#include "86box.h"
#include "device.h"
#include "plat.h"
#include "gameport.h"
#include "win.h"
#define XINPUT_MAX_JOYSTICKS 4
@@ -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

@@ -7,11 +7,11 @@
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../config.h"
#include "../device.h"
#include "../game/gameport.h"
#include "../plat.h"
#include "86box.h"
#include "config.h"
#include "device.h"
#include "gameport.h"
#include "plat.h"
#include "win.h"
@@ -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

@@ -24,10 +24,10 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../86box.h"
#include "../device.h"
#include "../keyboard.h"
#include "../plat.h"
#include "86box.h"
#include "device.h"
#include "keyboard.h"
#include "plat.h"
#include "win.h"

View File

@@ -4,11 +4,11 @@
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../config.h"
#include "../sound/midi.h"
#include "../plat.h"
#include "../plat_midi.h"
#include "86box.h"
#include "config.h"
#include "midi.h"
#include "plat.h"
#include "plat_midi.h"
typedef struct
@@ -18,7 +18,7 @@ typedef struct
HANDLE m_event;
HMIDIOUT midi_out_device;
HMIDIIN midi_in_device;
HMIDIIN midi_in_device;
MIDIHDR m_hdr;
} plat_midi_t;
@@ -137,57 +137,44 @@ 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;
}
uint8_t msg[4] = { ((dwParam1 & 0xff)), (((dwParam1 & 0xff00) >> 8)),
(((dwParam1 & 0xff0000) >> 16)), MIDI_evt_len[((dwParam1 & 0xff))]};
uint8_t *sysex;
uint32_t len;
MIDIHDR *hdr;
switch (wMsg) {
case MM_MIM_DATA: /* 0x3C3 - midi message */
midi_in_msg(msg);
break;
case MM_MIM_OPEN: /* 0x3C1 */
break;
case MM_MIM_CLOSE: /* 0x3C2 */
break;
case MM_MIM_LONGDATA: /* 0x3C4 - sysex */
/* It is midi_in_sysex() that now does the loop. */
hdr = (MIDIHDR *) dwParam1;
sysex = (uint8_t *) hdr->lpData;
len = (uint32_t) hdr->dwBytesRecorded;
midi_in_sysex(sysex, len);
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)
{
@@ -197,11 +184,11 @@ plat_midi_input_init(void)
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 = MMSYSERR_NOERROR;
hr = midiInOpen(&pm_in->midi_in_device, pm_in->midi_input_id,
(uintptr_t) plat_midi_in_callback, 0, CALLBACK_FUNCTION);
(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;
@@ -212,15 +199,16 @@ plat_midi_input_init(void)
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);
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)
{
@@ -235,6 +223,7 @@ plat_midi_input_close(void)
}
}
int
plat_midi_in_get_num_devs(void)
{
@@ -249,4 +238,4 @@ plat_midi_in_get_dev_name(int num, char *s)
midiInGetDevCaps(num, &caps, sizeof(caps));
strcpy(s, caps.szPname);
}
}

View File

@@ -22,9 +22,9 @@
#include <windowsx.h>
#include <stdio.h>
#include <stdint.h>
#include "../86box.h"
#include "../mouse.h"
#include "../plat.h"
#include "86box.h"
#include "mouse.h"
#include "plat.h"
#include "win.h"
int mouse_capture;

View File

@@ -25,12 +25,12 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../plat.h"
#include "../random.h"
#include "../ui.h"
#include "../scsi/scsi_device.h"
#include "../disk/zip.h"
#include "86box.h"
#include "plat.h"
#include "random.h"
#include "ui.h"
#include "scsi_device.h"
#include "zip.h"
#include "win.h"
@@ -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

@@ -25,8 +25,8 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../plat.h"
#include "86box.h"
#include "plat.h"
#include "plat_dir.h"

View File

@@ -12,13 +12,13 @@
* we will not use that, but, instead, use a new window which
* coverrs the entire desktop.
*
* Version: @(#)win_sdl.c 1.0.10 2019/12/06
* Version: @(#)win_sdl.c 1.0.11 2020/01/22
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Michael Dr<44>ing, <michael@drueing.de>
*
* Copyright 2018,2019 Fred N. van Kempen.
* Copyright 2018,2019 Michael Dr<44>ing.
* Copyright 2018-2020 Fred N. van Kempen.
* Copyright 2018-2020 Michael Dr<44>ing.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
@@ -62,12 +62,12 @@
/* This #undef is needed because a SDL include header redefines HAVE_STDARG_H. */
#undef HAVE_STDARG_H
#define HAVE_STDARG_H
#include "../86box.h"
#include "../device.h"
#include "../plat.h"
#include "../plat_dynld.h"
#include "../video/video.h"
#include "../ui.h"
#include "86box.h"
#include "device.h"
#include "plat.h"
#include "plat_dynld.h"
#include "video.h"
#include "ui.h"
#include "win.h"
#include "win_sdl.h"
@@ -108,10 +108,31 @@ sdl_log(const char *fmt, ...)
#endif
static void
sdl_integer_scale(double *d, double *g)
{
double ratio;
if (*d > *g) {
ratio = floor(*d / *g);
*d = *g * ratio;
} else {
ratio = ceil(*d / *g);
*d = *g / ratio;
}
}
static void
sdl_stretch(int *w, int *h, int *x, int *y)
{
double dw, dh, dx, dy, temp, temp2, ratio_w, ratio_h, gsr, hsr;
double hw, gw, hh, gh, dx, dy, dw, dh, gsr, hsr;
hw = (double) sdl_w;
hh = (double) sdl_h;
gw = (double) *w;
gh = (double) *h;
hsr = hw / hh;
switch (video_fullscreen_scale) {
case FULLSCR_SCALE_FULL:
@@ -122,44 +143,37 @@ sdl_stretch(int *w, int *h, int *x, int *y)
break;
case FULLSCR_SCALE_43:
case FULLSCR_SCALE_KEEPRATIO:
dw = (double) sdl_w;
dh = (double) sdl_h;
hsr = dw / dh;
if (video_fullscreen_scale == FULLSCR_SCALE_43)
gsr = 4.0 / 3.0;
else
gsr = ((double) *w) / ((double) *h);
gsr = gw / gh;
if (gsr <= hsr) {
temp = dh * gsr;
dx = (dw - temp) / 2.0;
dw = temp;
*w = (int) dw;
*h = (int) dh;
*x = (int) dx;
*y = 0;
dw = hh * gsr;
dh = hh;
} else {
temp = dw / gsr;
dy = (dh - temp) / 2.0;
dh = temp;
*w = (int) dw;
*h = (int) dh;
*x = 0;
*y = (int) dy;
dw = hw;
dh = hw / gsr;
}
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
*w = (int) hw;
*h = (int) hh;
*x = (int) dx;
*y = (int) dy;
break;
case FULLSCR_SCALE_INT:
dw = (double) sdl_w;
dh = (double) sdl_h;
temp = ((double) *w);
temp2 = ((double) *h);
ratio_w = dw / ((double) *w);
ratio_h = dh / ((double) *h);
if (ratio_h < ratio_w)
ratio_w = ratio_h;
dx = (dw / 2.0) - ((temp * ratio_w) / 2.0);
dy = (dh / 2.0) - ((temp2 * ratio_h) / 2.0);
dw -= (dx * 2.0);
dh -= (dy * 2.0);
gsr = gw / gh;
if (gsr <= hsr) {
dw = hh * gsr;
dh = hh;
} else {
dw = hw;
dh = hw / gsr;
}
sdl_integer_scale(&dw, &gw);
sdl_integer_scale(&dh, &gh);
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
*w = (int) dw;
*h = (int) dh;
*x = (int) dx;

View File

@@ -30,38 +30,36 @@
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../config.h"
#include "../cpu/cpu.h"
#include "../mem.h"
#include "../rom.h"
#include "../device.h"
#include "../timer.h"
#include "../nvr.h"
#include "../machine/machine.h"
#include "../game/gameport.h"
#include "../isamem.h"
#include "../isartc.h"
#include "../lpt.h"
#include "../mouse.h"
#include "../scsi/scsi.h"
#include "../scsi/scsi_device.h"
#include "../cdrom/cdrom.h"
#include "../disk/hdd.h"
#include "../disk/hdc.h"
#include "../disk/hdc_ide.h"
#include "../disk/zip.h"
#include "../floppy/fdd.h"
#include "../network/network.h"
#include "../sound/sound.h"
#include "../sound/midi.h"
#include "../sound/snd_mpu401.h"
#include "../sound/snd_gus.h"
#include "../video/video.h"
#include "../video/vid_voodoo.h"
#include "../plat.h"
#include "../plat_midi.h"
#include "../ui.h"
#include "86box.h"
#include "config.h"
#include "cpu.h"
#include "mem.h"
#include "rom.h"
#include "device.h"
#include "timer.h"
#include "nvr.h"
#include "machine.h"
#include "gameport.h"
#include "isamem.h"
#include "isartc.h"
#include "lpt.h"
#include "mouse.h"
#include "scsi.h"
#include "scsi_device.h"
#include "cdrom.h"
#include "hdd.h"
#include "hdc.h"
#include "hdc_ide.h"
#include "zip.h"
#include "fdd.h"
#include "network.h"
#include "sound.h"
#include "midi.h"
#include "snd_mpu401.h"
#include "video.h"
#include "plat.h"
#include "plat_midi.h"
#include "ui.h"
#include "win.h"
@@ -99,6 +97,7 @@ static int temp_serial[2], temp_lpt[3];
/* Other peripherals category */
static int temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
static int temp_bugger;
static int temp_postcard;
static int temp_isartc;
static int temp_isamem[ISAMEM_MAX];
@@ -250,6 +249,7 @@ win_settings_init(void)
temp_ide_ter = ide_ter_enabled;
temp_ide_qua = ide_qua_enabled;
temp_bugger = bugger_enabled;
temp_postcard = postcard_enabled;
temp_isartc = isartc_type;
/* ISA memory boards. */
@@ -358,6 +358,7 @@ win_settings_changed(void)
i = i || (temp_ide_ter != ide_ter_enabled);
i = i || (temp_ide_qua != ide_qua_enabled);
i = i || (temp_bugger != bugger_enabled);
i = i || (temp_postcard != postcard_enabled);
i = i || (temp_isartc != isartc_type);
/* ISA memory boards. */
@@ -462,6 +463,7 @@ win_settings_save(void)
ide_ter_enabled = temp_ide_ter;
ide_qua_enabled = temp_ide_qua;
bugger_enabled = temp_bugger;
postcard_enabled = temp_postcard;
isartc_type = temp_isartc;
/* ISA memory boards. */
@@ -539,13 +541,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);
}
@@ -975,6 +973,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;
@@ -1004,9 +1003,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);
@@ -1593,6 +1598,9 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
h=GetDlgItem(hdlg, IDC_CHECK_BUGGER);
SendMessage(h, BM_SETCHECK, temp_bugger, 0);
h=GetDlgItem(hdlg, IDC_CHECK_POSTCARD);
SendMessage(h, BM_SETCHECK, temp_postcard, 0);
/* Populate the ISA RTC card dropdown. */
e = 0;
h = GetDlgItem(hdlg, IDC_COMBO_ISARTC);
@@ -1796,6 +1804,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);
h = GetDlgItem(hdlg, IDC_CHECK_POSTCARD);
temp_postcard = SendMessage(h, BM_GETCHECK, 0, 0);
free(stransi);
free(lptsTemp);
@@ -2532,7 +2543,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);
@@ -2850,6 +2861,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;
}
@@ -2880,7 +2892,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)
@@ -2928,8 +2939,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);
@@ -3467,7 +3479,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;
@@ -3476,7 +3488,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
@@ -3731,7 +3747,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;
@@ -3741,7 +3757,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

@@ -25,10 +25,10 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../config.h"
#include "../plat.h"
#include "../sound/sound.h"
#include "86box.h"
#include "config.h"
#include "plat.h"
#include "sound.h"
#include "win.h"

View File

@@ -28,27 +28,27 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../config.h"
#include "../cpu/cpu.h"
#include "../device.h"
#include "../machine/machine.h"
#include "../timer.h"
#include "../disk/hdd.h"
#include "../disk/hdc.h"
#include "../floppy/fdd.h"
#include "../floppy/fdd_86f.h"
#include "../scsi/scsi.h"
#include "../scsi/scsi_device.h"
#include "../cdrom/cdrom.h"
#include "../disk/zip.h"
#include "../cdrom/cdrom_image.h"
#include "../scsi/scsi_disk.h"
#include "../network/network.h"
#include "../video/video.h"
#include "../sound/sound.h"
#include "../plat.h"
#include "../ui.h"
#include "86box.h"
#include "config.h"
#include "cpu.h"
#include "device.h"
#include "machine.h"
#include "timer.h"
#include "hdd.h"
#include "hdc.h"
#include "fdd.h"
#include "fdd_86f.h"
#include "scsi.h"
#include "scsi_device.h"
#include "cdrom.h"
#include "zip.h"
#include "cdrom_image.h"
#include "scsi_disk.h"
#include "network.h"
#include "video.h"
#include "sound.h"
#include "plat.h"
#include "ui.h"
#include "win.h"
#ifndef GWL_WNDPROC

View File

@@ -27,8 +27,8 @@
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../plat.h"
#include "86box.h"
#include "plat.h"
typedef struct {

View File

@@ -8,16 +8,16 @@
*
* user Interface module for WinAPI on Windows.
*
* Version: @(#)win_ui.c 1.0.45 2019/12/05
* Version: @(#)win_ui.c 1.0.46 2020/01/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2019 GH Cao.
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2019,2020 GH Cao.
*/
#define UNICODE
#include <windows.h>
@@ -28,16 +28,16 @@
#include <stdlib.h>
#include <time.h>
#include <wchar.h>
#include "../86box.h"
#include "../config.h"
#include "../device.h"
#include "../keyboard.h"
#include "../mouse.h"
#include "../video/video.h"
#include "../video/vid_ega.h" // for update_overscan
#include "../plat.h"
#include "../plat_midi.h"
#include "../ui.h"
#include "86box.h"
#include "config.h"
#include "device.h"
#include "keyboard.h"
#include "mouse.h"
#include "video.h"
#include "vid_ega.h" // for update_overscan
#include "plat.h"
#include "plat_midi.h"
#include "ui.h"
#include "win.h"
#ifdef USE_DISCORD
# include "win_discord.h"
@@ -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. */
@@ -333,7 +333,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_ACTION_EXIT:
win_notify_dlg_open();
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (no_quit_confirm)
i = 0;
else
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) {
UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC);
@@ -628,8 +631,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;
@@ -700,7 +701,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_CLOSE:
win_notify_dlg_open();
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (no_quit_confirm)
i = 0;
else
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) {
UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC);
@@ -746,7 +750,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (manager_wm)
break;
win_notify_dlg_open();
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (no_quit_confirm)
i = 0;
else
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) {
UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC);
@@ -1099,9 +1106,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);
@@ -1119,7 +1129,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)
@@ -1135,7 +1145,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);