Merge remote-tracking branch 'upstream/master' into qt-wacom-serial

This commit is contained in:
Cacodemon345
2023-02-15 11:12:25 +06:00
66 changed files with 2938 additions and 710 deletions

View File

@@ -10,13 +10,14 @@
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2020-2021 David Hrdlička.
# Copyright 2020,2021 David Hrdlička.
# Copyright 2021-2022 Jasmine Iwanek.
#
enable_language(RC)
add_library(plat OBJECT win.c win_dynld.c win_cdrom.c win_keyboard.c
win_mouse.c)
win_mouse.c win_serial_passthrough.c)
add_library(ui OBJECT win_ui.c win_icon.c win_stbar.c win_sdl.c win_dialog.c win_about.c
win_settings.c win_devconf.c win_snd_gain.c win_specify_dim.c win_new_floppy.c

View File

@@ -76,6 +76,9 @@ ifeq ($(DEV_BUILD), y)
ifndef PAS16
PAS16 := y
endif
ifndef PCI_DUMMY
PCI_DUMMY := y
endif
ifndef SIO_DETECT
SIO_DETECT := y
endif
@@ -137,6 +140,9 @@ else
ifndef PAS16
PAS16 := n
endif
ifndef PCI_DUMMY
PCI_DUMMY := n
endif
ifndef SIO_DETECT
SIO_DETECT := n
endif
@@ -476,6 +482,11 @@ ifeq ($(DEV_BRANCH), y)
DEVBROBJ += snd_pas16.o
endif
ifeq ($(PCI_DUMMY), y)
OPTS += -DUSE_PCI_DUMMY
DEVBROBJ += pci_dummy.o
endif
ifeq ($(SIO_DETECT), y)
OPTS += -DUSE_SIO_DETECT
DEVBROBJ += sio_detect.o
@@ -586,7 +597,7 @@ DEVOBJ := bugger.o cartridge.o cassette.o hasp.o hwm.o hwm_lm75.o hwm_lm78.o hwm
mouse_bus.o \
mouse_serial.o mouse_ps2.o \
mouse_wacom_tablet.o \
phoenix_486_jumper.o
phoenix_486_jumper.o serial_passthrough.o
SIOOBJ := sio_acc3221.o sio_ali5123.o \
sio_f82c710.o sio_82091aa.o sio_fdc37c6xx.o \
@@ -739,7 +750,7 @@ VOODOOOBJ := vid_voodoo.o vid_voodoo_banshee.o \
PLATOBJ := win.o \
win_dynld.o \
win_cdrom.o win_keyboard.o \
win_mouse.o
win_mouse.o win_serial_passthrough.o
UIOBJ := win_ui.o win_icon.o win_stbar.o discord.o \
win_sdl.o win_opengl.o win_opengl_glslp.o glad.o \
@@ -772,13 +783,19 @@ ifdef EXOBJ
OBJ += $(EXOBJ)
endif
ifeq ($(LOG), y)
MWIN := -lcomdlg32
else
MWIN := -mwindows
endif
ifeq ($(OPENAL), y)
LIBS := -mwindows -lopenal -lcomctl32 -lSDL2 -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32
LIBS := $(MWIN) -lopenal -lcomctl32 -lSDL2 -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32
else
ifeq ($(FAUDIO), y)
LIBS := -mwindows -lfaudio -lcomctl32 -lSDL2 -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32
LIBS := $(MWIN) -lfaudio -lcomctl32 -lSDL2 -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32
else
LIBS := -mwindows -lcomctl32 -lSDL2 -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32
LIBS := $(MWIN) -lcomctl32 -lSDL2 -limagehlp -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32
endif
endif

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Povolit port LPT2"
#define STR_PARALLEL3 "Povolit port LPT3"
#define STR_PARALLEL4 "Povolit port LPT4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Řadič disku:"
#define STR_FDC "Disketový řadič:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Parallelport 2"
#define STR_PARALLEL3 "Parallelport 3"
#define STR_PARALLEL4 "Parallelport 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "HDD-Controller:"
#define STR_FDC "FD-Controller:"

View File

@@ -453,54 +453,78 @@ BEGIN
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT STR_LPT2, IDT_LPT2,
CFG_HMARGIN, 28, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
CFG_HMARGIN, 24, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
COMBOBOX IDC_COMBO_LPT2,
CFG_COMBO_BOX_LEFT, 26, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT,
CFG_COMBO_BOX_LEFT, 22, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT STR_LPT3, IDT_LPT3,
CFG_HMARGIN, 47, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
CFG_HMARGIN, 39, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
COMBOBOX IDC_COMBO_LPT3,
CFG_COMBO_BOX_LEFT, 45, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT,
CFG_COMBO_BOX_LEFT, 37, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT STR_LPT4, IDT_LPT4,
CFG_HMARGIN, 66, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
CFG_HMARGIN, 54, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
COMBOBOX IDC_COMBO_LPT4,
CFG_COMBO_BOX_LEFT, 64, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT,
CFG_COMBO_BOX_LEFT, 52, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL STR_SERIAL1, IDC_CHECK_SERIAL1,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 83, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CFG_HMARGIN, 71, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_SERIAL2, IDC_CHECK_SERIAL2,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 102, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CFG_HMARGIN, 86, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_SERIAL3, IDC_CHECK_SERIAL3,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 121, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CFG_HMARGIN, 101, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_SERIAL4, IDC_CHECK_SERIAL4,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 140, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CFG_HMARGIN, 116, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_PARALLEL1, IDC_CHECK_PARALLEL1,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
167, 83, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
167, 71, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_PARALLEL2, IDC_CHECK_PARALLEL2,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
167, 102, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
167, 86, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_PARALLEL3, IDC_CHECK_PARALLEL3,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
167, 121, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
167, 101, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_PARALLEL4, IDC_CHECK_PARALLEL4,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
167, 140, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
167, 116, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
CONTROL STR_SERIAL_PASS1, IDC_CHECK_SERIAL_PASS1,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 134, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_SERIAL_PASS1,
CFG_COMBO_BTN_LEFT, 131, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
CONTROL STR_SERIAL_PASS2, IDC_CHECK_SERIAL_PASS2,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 150, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_SERIAL_PASS2,
CFG_COMBO_BTN_LEFT, 147, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
CONTROL STR_SERIAL_PASS3, IDC_CHECK_SERIAL_PASS3,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 165, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_SERIAL_PASS3,
CFG_COMBO_BTN_LEFT, 162, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
CONTROL STR_SERIAL_PASS4, IDC_CHECK_SERIAL_PASS4,
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
CFG_HMARGIN, 180, CFG_CHECKBOX_PRI_WIDTH, CFG_CHECKBOX_HEIGHT
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_SERIAL_PASS4,
CFG_COMBO_BTN_LEFT, 177, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
END
DLG_CFG_STORAGE DIALOG DISCARDABLE CFG_PANE_LEFT, CFG_PANE_TOP, CFG_PANE_WIDTH, CFG_PANE_HEIGHT
@@ -996,6 +1020,10 @@ END
#undef STR_PARALLEL2
#undef STR_PARALLEL3
#undef STR_PARALLEL4
#undef STR_SERIAL_PASS1
#undef STR_SERIAL_PASS2
#undef STR_SERIAL_PASS3
#undef STR_SERIAL_PASS4
#undef STR_HDC
#undef STR_FDC

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Parallel port 2"
#define STR_PARALLEL3 "Parallel port 3"
#define STR_PARALLEL4 "Parallel port 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "HD Controller:"
#define STR_FDC "FD Controller:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Parallel port 2"
#define STR_PARALLEL3 "Parallel port 3"
#define STR_PARALLEL4 "Parallel port 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "HD Controller:"
#define STR_FDC "FD Controller:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Puerto paralelo 2"
#define STR_PARALLEL3 "Puerto paralelo 3"
#define STR_PARALLEL4 "Puerto paralelo 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Controladora HD:"
#define STR_FDC "Controladora FD:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Rinnakkaisportti 2"
#define STR_PARALLEL3 "Rinnakkaisportti 3"
#define STR_PARALLEL4 "Rinnakkaisportti 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Kiintolevyohjain:"
#define STR_FDC "Levykeohjain:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Port parallèle 2"
#define STR_PARALLEL3 "Port parallèle 3"
#define STR_PARALLEL4 "Port parallèle 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Contrôleur HD:"
#define STR_FDC "Contrôleur FD:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Paralelna vrata 2"
#define STR_PARALLEL3 "Paralelna vrata 3"
#define STR_PARALLEL4 "Paralelna vrata 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Kontroler tvrdog diska:"
#define STR_FDC "Kontroler diskete:"

View File

@@ -333,6 +333,10 @@ END
#define STR_PARALLEL2 "Párhuzamos port 2"
#define STR_PARALLEL3 "Párhuzamos port 3"
#define STR_PARALLEL4 "Párhuzamos port 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Merevl.-vezérlő:"
#define STR_FDC "Floppy-vezérlő:"

View File

@@ -329,6 +329,10 @@ END
#define STR_PARALLEL2 "Porta parallela 2"
#define STR_PARALLEL3 "Porta parallela 3"
#define STR_PARALLEL4 "Porta parallela 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Controller HD:"
#define STR_FDC "Controller FD:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "パラレルポート2"
#define STR_PARALLEL3 "パラレルポート3"
#define STR_PARALLEL4 "パラレルポート4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "HDコントローラー:"
#define STR_FDC "FDコントローラー:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "병렬 포트 2"
#define STR_PARALLEL3 "병렬 포트 3"
#define STR_PARALLEL4 "병렬 포트 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "HD 컨트롤러:"
#define STR_FDC "FD 컨트롤러:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Port równoległy 2"
#define STR_PARALLEL3 "Port równoległy 3"
#define STR_PARALLEL4 "Port równoległy 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Kontroler dysku twardego:"
#define STR_FDC "Kontroler dyskietek:"

View File

@@ -331,6 +331,10 @@ END
#define STR_PARALLEL2 "Porta paralela 2"
#define STR_PARALLEL3 "Porta paralela 3"
#define STR_PARALLEL4 "Porta paralela 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Controlador HD:"
#define STR_FDC "Controlador FD:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Porta paralela 2"
#define STR_PARALLEL3 "Porta paralela 3"
#define STR_PARALLEL4 "Porta paralela 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Controlador HD:"
#define STR_FDC "Controlador FD:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Параллельный порт LPT2"
#define STR_PARALLEL3 "Параллельный порт LPT3"
#define STR_PARALLEL4 "Параллельный порт LPT4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Контроллер HD:"
#define STR_FDC "Контроллер FD:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Paralelna vrata 2"
#define STR_PARALLEL3 "Paralelna vrata 3"
#define STR_PARALLEL4 "Paralelna vrata 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Krmilnik trdega diska:"
#define STR_FDC "Krmilnik disketnika:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Paralel port 2"
#define STR_PARALLEL3 "Paralel port 3"
#define STR_PARALLEL4 "Paralel port 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "HD Kontrolcüsü:"
#define STR_FDC "FD Kontrolcüsü:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "Паралельний порт LPT2"
#define STR_PARALLEL3 "Паралельний порт LPT3"
#define STR_PARALLEL4 "Паралельний порт LPT4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "Контролер HD:"
#define STR_FDC "Контролер FD:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "并口 2"
#define STR_PARALLEL3 "并口 3"
#define STR_PARALLEL4 "并口 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "硬盘控制器:"
#define STR_FDC "软盘控制器:"

View File

@@ -328,6 +328,10 @@ END
#define STR_PARALLEL2 "並列埠 2"
#define STR_PARALLEL3 "並列埠 3"
#define STR_PARALLEL4 "並列埠 4"
#define STR_SERIAL_PASS1 "Serial port passthrough 1"
#define STR_SERIAL_PASS2 "Serial port passthrough 2"
#define STR_SERIAL_PASS3 "Serial port passthrough 3"
#define STR_SERIAL_PASS4 "Serial port passthrough 4"
#define STR_HDC "硬碟控制器:"
#define STR_FDC "軟碟控制器:"

View File

@@ -36,7 +36,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#define UNICODE
#include <Windows.h>
#include <windows.h>
#include <process.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>

View File

@@ -0,0 +1,223 @@
/*
* 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.
*
* Definitions for platform specific serial to host passthrough
*
*
* Authors: Andreas J. Reichel <webmaster@6th-dimension.com>,
* Jasmine Iwanek <jasmine@iwanek.co.uk>
*
* Copyright 2021 Andreas J. Reichel
* Copyright 2021-2022 Jasmine Iwanek
*/
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <86box/86box.h>
#include <86box/log.h>
#include <86box/timer.h>
#include <86box/plat.h>
#include <86box/device.h>
#include <86box/serial_passthrough.h>
#include <86box/plat_serial_passthrough.h>
#include <windows.h>
#define LOG_PREFIX "serial_passthrough: "
void
plat_serpt_close(void *p)
{
serial_passthrough_t *dev = (serial_passthrough_t *) p;
// fclose(dev->master_fd);
FlushFileBuffers((HANDLE) dev->master_fd);
if (dev->mode == SERPT_MODE_VCON)
DisconnectNamedPipe((HANDLE) dev->master_fd);
if (dev->mode == SERPT_MODE_HOSTSER) {
SetCommState((HANDLE)dev->master_fd, (DCB*)dev->backend_priv);
free(dev->backend_priv);
}
CloseHandle((HANDLE) dev->master_fd);
}
static void
plat_serpt_write_vcon(serial_passthrough_t *dev, uint8_t data)
{
/* fd_set wrfds;
* int res;
*/
/* We cannot use select here, this would block the hypervisor! */
/* FD_ZERO(&wrfds);
FD_SET(ctx->master_fd, &wrfds);
res = select(ctx->master_fd + 1, NULL, &wrfds, NULL, NULL);
if (res <= 0) {
return;
}
*/
/* just write it out */
// fwrite(dev->master_fd, &data, 1);
DWORD bytesWritten = 0;
WriteFile((HANDLE) dev->master_fd, &data, 1, &bytesWritten, NULL);
if (bytesWritten == 0) {
fatal("serial_passthrough: WriteFile pipe write-buffer full!");
}
}
void
plat_serpt_set_params(void *p)
{
serial_passthrough_t *dev = (serial_passthrough_t *)p;
if (dev->mode == SERPT_MODE_HOSTSER) {
DCB serialattr = {};
GetCommState((HANDLE)dev->master_fd, &serialattr);
#define BAUDRATE_RANGE(baud_rate, min, max) if (baud_rate >= min && baud_rate < max) { serialattr.BaudRate = min; }
BAUDRATE_RANGE(dev->baudrate, 110, 300);
BAUDRATE_RANGE(dev->baudrate, 300, 600);
BAUDRATE_RANGE(dev->baudrate, 600, 1200);
BAUDRATE_RANGE(dev->baudrate, 1200, 2400);
BAUDRATE_RANGE(dev->baudrate, 2400, 4800);
BAUDRATE_RANGE(dev->baudrate, 4800, 9600);
BAUDRATE_RANGE(dev->baudrate, 9600, 14400);
BAUDRATE_RANGE(dev->baudrate, 14400, 19200);
BAUDRATE_RANGE(dev->baudrate, 19200, 38400);
BAUDRATE_RANGE(dev->baudrate, 38400, 57600);
BAUDRATE_RANGE(dev->baudrate, 57600, 115200);
BAUDRATE_RANGE(dev->baudrate, 115200, 0xFFFFFFFF);
serialattr.ByteSize = dev->data_bits;
serialattr.StopBits = (dev->serial->lcr & 0x04) ? TWOSTOPBITS : ONESTOPBIT;
if (!(dev->serial->lcr & 0x08)) {
serialattr.fParity = 0;
serialattr.Parity = NOPARITY;
} else {
serialattr.fParity = 1;
if (dev->serial->lcr & 0x20) {
serialattr.Parity = (MARKPARITY) + !!(dev->serial->lcr & 0x10);
} else {
serialattr.Parity = (ODDPARITY) + !!(dev->serial->lcr & 0x10);
}
}
SetCommState((HANDLE)dev->master_fd, &serialattr);
#undef BAUDRATE_RANGE
}
}
void
plat_serpt_write(void *p, uint8_t data)
{
serial_passthrough_t *dev = (serial_passthrough_t *) p;
switch (dev->mode) {
case SERPT_MODE_VCON:
case SERPT_MODE_HOSTSER:
plat_serpt_write_vcon(dev, data);
break;
default:
break;
}
}
uint8_t
plat_serpt_read_vcon(serial_passthrough_t *dev, uint8_t *data)
{
DWORD bytesRead = 0;
ReadFile((HANDLE) dev->master_fd, data, 1, &bytesRead, NULL);
return !!bytesRead;
}
int
plat_serpt_read(void *p, uint8_t *data)
{
serial_passthrough_t *dev = (serial_passthrough_t *) p;
int res = 0;
switch (dev->mode) {
case SERPT_MODE_VCON:
case SERPT_MODE_HOSTSER:
res = plat_serpt_read_vcon(dev, data);
break;
default:
break;
}
return res;
}
static int
open_pseudo_terminal(serial_passthrough_t *dev)
{
char ascii_pipe_name[1024] = { 0 };
snprintf(ascii_pipe_name, sizeof(ascii_pipe_name), "\\\\.\\pipe\\86Box\\%s", vm_name);
dev->master_fd = (intptr_t) CreateNamedPipeA(ascii_pipe_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 32, 65536, 65536, NMPWAIT_USE_DEFAULT_WAIT, NULL);
if (dev->master_fd == (intptr_t) INVALID_HANDLE_VALUE) {
return 0;
}
pclog("Named Pipe @ %s\n", ascii_pipe_name);
return 1;
}
static int
open_host_serial_port(serial_passthrough_t *dev)
{
COMMTIMEOUTS timeouts = {
.ReadIntervalTimeout = MAXDWORD,
.ReadTotalTimeoutConstant = 0,
.ReadTotalTimeoutMultiplier = 0,
.WriteTotalTimeoutMultiplier = 0,
.WriteTotalTimeoutConstant = 1000
};
DCB* serialattr = calloc(1, sizeof(DCB));
if (!serialattr) return 0;
dev->master_fd = (intptr_t) CreateFileA(dev->host_serial_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (dev->master_fd == (intptr_t) INVALID_HANDLE_VALUE) {
free(serialattr);
return 0;
}
if (!SetCommTimeouts((HANDLE) dev->master_fd, &timeouts)) {
pclog(LOG_PREFIX "error setting COM port timeouts.\n");
CloseHandle((HANDLE) dev->master_fd);
free(serialattr);
return 0;
}
GetCommState((HANDLE)dev->master_fd, serialattr);
dev->backend_priv = serialattr;
return 1;
}
int
plat_serpt_open_device(void *p)
{
serial_passthrough_t *dev = (serial_passthrough_t *) p;
switch (dev->mode) {
case SERPT_MODE_VCON:
if (open_pseudo_terminal(dev)) {
return 0;
}
break;
case SERPT_MODE_HOSTSER:
if (open_host_serial_port(dev)) {
return 0;
}
default:
break;
}
return 1;
}

View File

@@ -71,6 +71,7 @@
#include <86box/plat.h>
#include <86box/ui.h>
#include <86box/win.h>
#include <86box/serial_passthrough.h>
#include "../disk/minivhd/minivhd.h"
#include "../disk/minivhd/minivhd_util.h"
@@ -111,6 +112,7 @@ static char temp_pcap_dev[NET_CARD_MAX][128];
/* Ports category */
static int temp_lpt_devices[PARALLEL_MAX];
static int temp_serial[SERIAL_MAX], temp_lpt[PARALLEL_MAX];
static int temp_serial_passthrough_enabled[SERIAL_MAX];
/* Other peripherals category */
static int temp_fdc_card, temp_hdc, temp_ide_ter, temp_ide_qua, temp_cassette;
@@ -358,11 +360,13 @@ win_settings_init(void)
/* Ports category */
for (i = 0; i < PARALLEL_MAX; i++) {
temp_lpt_devices[i] = lpt_ports[i].device;
temp_lpt[i] = lpt_ports[i].enabled;
temp_lpt_devices[i] = lpt_ports[i].device;
temp_lpt[i] = lpt_ports[i].enabled;
}
for (i = 0; i < SERIAL_MAX; i++) {
temp_serial[i] = com_ports[i].enabled;
temp_serial_passthrough_enabled[i] = serial_passthrough_enabled[i];
}
for (i = 0; i < SERIAL_MAX; i++)
temp_serial[i] = com_ports[i].enabled;
/* Storage devices category */
for (i = 0; i < SCSI_BUS_MAX; i++)
@@ -484,8 +488,10 @@ win_settings_changed(void)
i = i || (temp_lpt_devices[j] != lpt_ports[j].device);
i = i || (temp_lpt[j] != lpt_ports[j].enabled);
}
for (j = 0; j < SERIAL_MAX; j++)
for (j = 0; j < SERIAL_MAX; j++) {
i = i || (temp_serial[j] != com_ports[j].enabled);
i = i || (temp_serial_passthrough_enabled[i] != serial_passthrough_enabled[i]);
}
/* Storage devices category */
for (j = 0; j < SCSI_BUS_MAX; j++)
@@ -578,8 +584,10 @@ win_settings_save(void)
lpt_ports[i].device = temp_lpt_devices[i];
lpt_ports[i].enabled = temp_lpt[i];
}
for (i = 0; i < SERIAL_MAX; i++)
for (i = 0; i < SERIAL_MAX; i++) {
com_ports[i].enabled = temp_serial[i];
serial_passthrough_enabled[i] = temp_serial_passthrough_enabled[i];
}
/* Storage devices category */
for (i = 0; i < SCSI_BUS_MAX; i++)
@@ -755,7 +763,7 @@ win_settings_machine_recalc_machine(HWND hdlg)
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
d = (device_t *) machine_getdevice(temp_machine);
d = (device_t *) machine_get_device(temp_machine);
settings_enable_window(hdlg, IDC_CONFIGURE_MACHINE, d && d->config);
settings_reset_content(hdlg, IDC_COMBO_CPU_TYPE);
@@ -987,7 +995,7 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case IDC_CONFIGURE_MACHINE:
temp_machine = listtomachine[settings_get_cur_sel(hdlg, IDC_COMBO_MACHINE)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *) machine_getdevice(temp_machine));
temp_deviceconfig |= deviceconfig_open(hdlg, (void *) machine_get_device(temp_machine));
break;
}
@@ -1764,8 +1772,10 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
settings_enable_window(hdlg, IDC_COMBO_LPT1 + i, temp_lpt[i]);
}
for (i = 0; i < SERIAL_MAX; i++)
for (i = 0; i < SERIAL_MAX; i++) {
settings_set_check(hdlg, IDC_CHECK_SERIAL1 + i, temp_serial[i]);
settings_set_check(hdlg, IDC_CHECK_SERIAL_PASS1 + i, temp_serial_passthrough_enabled[i]);
}
free(lptsTemp);
@@ -1790,8 +1800,10 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
temp_lpt[i] = settings_get_check(hdlg, IDC_CHECK_PARALLEL1 + i);
}
for (i = 0; i < SERIAL_MAX; i++)
for (i = 0; i < SERIAL_MAX; i++) {
temp_serial[i] = settings_get_check(hdlg, IDC_CHECK_SERIAL1 + i);
temp_serial_passthrough_enabled[i] = settings_get_check(hdlg, IDC_CHECK_SERIAL_PASS1 + i);
}
default:
return FALSE;

View File

@@ -2,8 +2,8 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <CommCtrl.h>
#include <windows.h>
#include <commctrl.h>
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/resource.h>