Another cleanup. VNC now has fixed blitters, so 8bit cards (vga,mda,herc et al) work. More cleanups with the %ls stuff, cleanup of threads modules, and MOVED THE MAKEFILE to win/.

This commit is contained in:
waltje
2017-10-14 20:04:21 -04:00
parent 25b4014ce0
commit c1abfe2362
18 changed files with 169 additions and 167 deletions

View File

@@ -10,7 +10,7 @@
# settings, so we can avoid changing the main one for all of # settings, so we can avoid changing the main one for all of
# our local setups. # our local setups.
# #
# Version: @(#)Makefile.local 1.0.3 2017/09/25 # Version: @(#)Makefile.local 1.0.4 2017/10/14
# #
# Author: Fred N. van Kempen, <decwiz@yahoo.com> # Author: Fred N. van Kempen, <decwiz@yahoo.com>
# #
@@ -36,7 +36,7 @@ EXTRAS := #-DYOURNAME
######################################################################### #########################################################################
# Include the master Makefile.MinGW for the rest. # # Include the master Makefile.MinGW for the rest. #
######################################################################### #########################################################################
include Makefile.mingw include win/Makefile.mingw
# End of Makefile.local. # End of Makefile.local.

View File

@@ -12,7 +12,7 @@
* based design. Most cards were WD1003-WA2 or -WAH, where the * based design. Most cards were WD1003-WA2 or -WAH, where the
* -WA2 cards had a floppy controller as well (to save space.) * -WA2 cards had a floppy controller as well (to save space.)
* *
* Version: @(#)hdd_mfm_at.c 1.0.7 2017/10/11 * Version: @(#)hdd_mfm_at.c 1.0.8 2017/10/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -719,7 +719,7 @@ mfm_init(device_t *info)
if ((hdd[d].bus == HDD_BUS_MFM) && (hdd[d].mfm_channel < MFM_NUM)) { if ((hdd[d].bus == HDD_BUS_MFM) && (hdd[d].mfm_channel < MFM_NUM)) {
loadhd(mfm, hdd[d].mfm_channel, d, hdd[d].fn); loadhd(mfm, hdd[d].mfm_channel, d, hdd[d].fn);
pclog("WD1003(%d): (%S) geometry %d/%d/%d\n", c, hdd[d].fn, pclog("WD1003(%d): (%ls) geometry %d/%d/%d\n", c, hdd[d].fn,
(int)hdd[d].tracks, (int)hdd[d].hpc, (int)hdd[d].spt); (int)hdd[d].tracks, (int)hdd[d].hpc, (int)hdd[d].spt);
if (++c >= MFM_NUM) break; if (++c >= MFM_NUM) break;

View File

@@ -8,7 +8,7 @@
* *
* Implementation of the PCjs JSON floppy image format. * Implementation of the PCjs JSON floppy image format.
* *
* Version: @(#)floppy_json.c 1.0.6 2017/10/12 * Version: @(#)floppy_json.c 1.0.7 2017/10/14
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -496,7 +496,7 @@ json_load(int drive, wchar_t *fn)
return; return;
} }
pclog("JSON(%d): %S (%i tracks, %i sides, %i sectors)\n", pclog("JSON(%d): %ls (%i tracks, %i sides, %i sectors)\n",
drive, fn, img->tracks, img->sides, img->spt[0][0]); drive, fn, img->tracks, img->sides, img->spt[0][0]);
/* /*

View File

@@ -8,7 +8,7 @@
* *
* Implementation of the Intel 2 Mbit 8-bit flash devices. * Implementation of the Intel 2 Mbit 8-bit flash devices.
* *
* Version: @(#)intel_flash.c 1.0.7 2017/10/12 * Version: @(#)intel_flash.c 1.0.8 2017/10/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -198,7 +198,7 @@ void *intel_flash_init(uint8_t type)
wcscpy(flash_path, flash_name); wcscpy(flash_path, flash_name);
pclog("Flash path: %S\n", flash_name); pclog("Flash path: %ls\n", flash_name);
flash->flash_id = (type & FLASH_IS_BXB) ? 0x95 : 0x94; flash->flash_id = (type & FLASH_IS_BXB) ? 0x95 : 0x94;
flash->invert_high_pin = (type & FLASH_INVERT); flash->invert_high_pin = (type & FLASH_INVERT);

View File

@@ -8,7 +8,7 @@
* *
* Handle SLiRP library processing. * Handle SLiRP library processing.
* *
* Version: @(#)net_slirp.c 1.0.8 2017/10/11 * Version: @(#)net_slirp.c 1.0.9 2017/10/14
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -32,7 +32,7 @@ static queueADT slirpq; /* SLiRP library handle */
static thread_t *poll_tid; static thread_t *poll_tid;
static NETRXCB poll_rx; /* network RX function to call */ static NETRXCB poll_rx; /* network RX function to call */
static void *poll_arg; /* network RX function arg */ static void *poll_arg; /* network RX function arg */
static void *slirpMutex; static mutex_t *slirpMutex;

View File

@@ -186,7 +186,7 @@
* (DS12887A) which implemented a "century" register to be * (DS12887A) which implemented a "century" register to be
* compatible with Y2K. * compatible with Y2K.
* *
* Version: @(#)nvr.c 1.0.8 2017/10/12 * Version: @(#)nvr.c 1.0.9 2017/10/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -680,7 +680,7 @@ nvr_load(void)
/* We are responsible for loading. */ /* We are responsible for loading. */
f = NULL; f = NULL;
if (saved_nvr->mask != 0) { if (saved_nvr->mask != 0) {
pclog("Opening NVR file: %S...\n", saved_nvr->fname); pclog("Opening NVR file: %ls...\n", saved_nvr->fname);
f = plat_fopen(nvr_path(saved_nvr->fname), L"rb"); f = plat_fopen(nvr_path(saved_nvr->fname), L"rb");
} }
@@ -723,7 +723,7 @@ nvr_save(void)
/* We are responsible for saving. */ /* We are responsible for saving. */
f = NULL; f = NULL;
if (saved_nvr->mask != 0) { if (saved_nvr->mask != 0) {
pclog("Saving NVR file: %S...\n", saved_nvr->fname); pclog("Saving NVR file: %ls...\n", saved_nvr->fname);
f = plat_fopen(nvr_path(saved_nvr->fname), L"wb"); f = plat_fopen(nvr_path(saved_nvr->fname), L"wb");
} }

View File

@@ -8,7 +8,7 @@
* *
* Emulation core dispatcher. * Emulation core dispatcher.
* *
* Version: @(#)pc.c 1.0.25 2017/10/14 * Version: @(#)pc.c 1.0.26 2017/10/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -250,7 +250,7 @@ usage:
*/ */
/* Make sure cfg_path has a trailing backslash. */ /* Make sure cfg_path has a trailing backslash. */
pclog("exe_path=%S\n", exe_path); pclog("exe_path=%ls\n", exe_path);
if ((cfg_path[wcslen(cfg_path)-1] != L'\\') && if ((cfg_path[wcslen(cfg_path)-1] != L'\\') &&
(cfg_path[wcslen(cfg_path)-1] != L'/')) { (cfg_path[wcslen(cfg_path)-1] != L'/')) {
#ifdef WIN32 #ifdef WIN32
@@ -259,7 +259,7 @@ usage:
wcscat(cfg_path, L"/"); wcscat(cfg_path, L"/");
#endif #endif
} }
pclog("cfg_path=%S\n", cfg_path); pclog("cfg_path=%ls\n", cfg_path);
if (cfg != NULL) { if (cfg != NULL) {
/* /*

View File

@@ -8,7 +8,7 @@
* *
* Define the various platform support functions. * Define the various platform support functions.
* *
* Version: @(#)plat.h 1.0.6 2017/10/13 * Version: @(#)plat.h 1.0.7 2017/10/14
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -33,7 +33,7 @@ extern void plat_remove(wchar_t *path);
extern int plat_getcwd(wchar_t *bufp, int max); extern int plat_getcwd(wchar_t *bufp, int max);
extern int plat_chdir(wchar_t *path); extern int plat_chdir(wchar_t *path);
extern void get_executable_name(wchar_t *s, int size); extern void get_executable_name(wchar_t *s, int size);
extern void set_window_title(wchar_t *s); extern wchar_t *set_window_title(wchar_t *s);
extern int dir_check_exist(wchar_t *path); extern int dir_check_exist(wchar_t *path);
extern int dir_create(wchar_t *path); extern int dir_create(wchar_t *path);
@@ -74,22 +74,23 @@ extern void ioctl_close(uint8_t id);
/* Thread support. */ /* Thread support. */
typedef void thread_t; typedef void thread_t;
typedef void event_t; typedef void event_t;
typedef void mutex_t;
extern thread_t *thread_create(void (*thread_rout)(void *param), void *param); extern thread_t *thread_create(void (*thread_rout)(void *param), void *param);
extern void thread_kill(thread_t *handle); extern void thread_kill(thread_t *handle);
extern void thread_sleep(int t);
extern event_t *thread_create_event(void); extern event_t *thread_create_event(void);
extern void thread_set_event(event_t *event); extern void thread_set_event(event_t *event);
extern void thread_reset_event(event_t *_event); extern void thread_reset_event(event_t *_event);
extern int thread_wait_event(event_t *event, int timeout); extern int thread_wait_event(event_t *event, int timeout);
extern void thread_destroy_event(event_t *_event); extern void thread_destroy_event(event_t *_event);
extern void thread_sleep(int t); extern mutex_t *thread_create_mutex(wchar_t *name);
extern void thread_close_mutex(mutex_t *mutex);
extern void *thread_create_mutex(wchar_t *name); extern int thread_wait_mutex(mutex_t *mutex);
extern void thread_close_mutex(void *mutex); extern int thread_release_mutex(mutex_t *mutex);
extern uint8_t thread_wait_mutex(void *mutex);
extern uint8_t thread_release_mutex(void *mutex);
/* Other stuff. */ /* Other stuff. */

View File

@@ -13,7 +13,7 @@
* - c386sx16 BIOS fails checksum * - c386sx16 BIOS fails checksum
* - the loadfont() calls should be done elsewhere * - the loadfont() calls should be done elsewhere
* *
* Version: @(#)rom.c 1.0.10 2017/10/12 * Version: @(#)rom.c 1.0.11 2017/10/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -135,7 +135,7 @@ rom_load_linear(wchar_t *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
FILE *f = rom_fopen(fn, L"rb"); FILE *f = rom_fopen(fn, L"rb");
if (f == NULL) { if (f == NULL) {
pclog("ROM: image '%S' not found\n", fn); pclog("ROM: image '%ls' not found\n", fn);
return(0); return(0);
} }
@@ -166,9 +166,9 @@ rom_load_interleaved(wchar_t *fnl, wchar_t *fnh, uint32_t addr, int sz, int off,
int c; int c;
if (fl == NULL || fh == NULL) { if (fl == NULL || fh == NULL) {
if (fl == NULL) pclog("ROM: image '%S' not found\n", fnl); if (fl == NULL) pclog("ROM: image '%ls' not found\n", fnl);
else (void)fclose(fl); else (void)fclose(fl);
if (fh == NULL) pclog("ROM: image '%S' not found\n", fnh); if (fh == NULL) pclog("ROM: image '%ls' not found\n", fnh);
else (void)fclose(fh); else (void)fclose(fh);
return(0); return(0);

View File

@@ -8,11 +8,12 @@
* *
* Handling of the SCSI controllers. * Handling of the SCSI controllers.
* *
* Version: @(#)scsi.c 1.0.9 2017/10/10 * Version: @(#)scsi.c 1.0.10 2017/10/14
* *
* Authors: TheCollector1995, <mariogplayer@gmail.com> * Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016,2017 Miran Grca. * Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen. * Copyright 2017 Fred N. van Kempen.
*/ */
@@ -48,7 +49,7 @@ int scsi_card_current = 0;
int scsi_card_last = 0; int scsi_card_last = 0;
uint32_t SCSI_BufferLength; uint32_t SCSI_BufferLength;
void *scsiMutex; mutex_t *scsiMutex;
typedef struct { typedef struct {

View File

@@ -8,7 +8,7 @@
* *
* Define the various UI functions. * Define the various UI functions.
* *
* Version: @(#)ui.h 1.0.2 2017/10/12 * Version: @(#)ui.h 1.0.3 2017/10/14
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -28,7 +28,7 @@ extern "C" {
#ifdef WIN32 #ifdef WIN32
# include "win/resource.h" # include "win/resource.h"
#else #else
# include "linux/strings.h" # include "lnx/strings.h"
#endif #endif

View File

@@ -8,7 +8,7 @@
* *
* Define all known video cards. * Define all known video cards.
* *
* Version: @(#)vid_table.c 1.0.1 2017/10/10 * Version: @(#)vid_table.c 1.0.2 2017/10/14
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -135,7 +135,7 @@ video_cards[] = {
{"[PCI] S3 ViRGE/DX", "virge375_pci", &s3_virge_375_pci_device, GFX_VIRGEDX_PCI }, {"[PCI] S3 ViRGE/DX", "virge375_pci", &s3_virge_375_pci_device, GFX_VIRGEDX_PCI },
{"[PCI] S3 ViRGE/DX (VBE 2.0)", "virge375_vbe20_pci", &s3_virge_375_4_pci_device, GFX_VIRGEDX4_PCI }, {"[PCI] S3 ViRGE/DX (VBE 2.0)", "virge375_vbe20_pci", &s3_virge_375_4_pci_device, GFX_VIRGEDX4_PCI },
{"[PCI] Trident TGUI9440", "tgui9440_pci", &tgui9440_pci_device, GFX_TGUI9440_PCI }, {"[PCI] Trident TGUI9440", "tgui9440_pci", &tgui9440_pci_device, GFX_TGUI9440_PCI },
{"", "", NULL, 0 } {"", "", NULL, -1 }
}; };

View File

@@ -8,7 +8,7 @@
* *
* Windows resource script. * Windows resource script.
* *
* Version: @(#)86Box.rc 1.0.16 2017/10/12 * Version: @(#)86Box.rc 1.0.17 2017/10/14
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -823,7 +823,7 @@ BEGIN
IDS_2155 "IRQ %i" IDS_2155 "IRQ %i"
IDS_2156 "%" PRIu64 IDS_2156 "%" PRIu64
IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")" IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")"
IDS_2158 "Floppy %i (%s): %S" IDS_2158 "Floppy %i (%s): %ls"
IDS_2159"All floppy images (*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector-based images (*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0" IDS_2159"All floppy images (*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector-based images (*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0" IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0"
IDS_2161 "&New image..." IDS_2161 "&New image..."
@@ -869,7 +869,7 @@ BEGIN
IDS_4112 "Please enter a valid file name" IDS_4112 "Please enter a valid file name"
IDS_4113 "Remember to partition and format the new drive" IDS_4113 "Remember to partition and format the new drive"
IDS_4114 "MFM/RLL or ESDI CD-ROM drives never existed" IDS_4114 "MFM/RLL or ESDI CD-ROM drives never existed"
IDS_4115 "Removable disk %i (SCSI): %S" IDS_4115 "Removable disk %i (SCSI): %ls"
IDS_4352 "MFM/RLL" IDS_4352 "MFM/RLL"
IDS_4353 "XT IDE" IDS_4353 "XT IDE"

View File

@@ -8,7 +8,7 @@
# #
# Makefile for Win32 (MinGW32) environment. # Makefile for Win32 (MinGW32) environment.
# #
# Version: @(#)Makefile.mingw 1.0.61 2017/10/14 # Version: @(#)Makefile.mingw 1.0.62 2017/10/14
# #
# Authors: Miran Grca, <mgrca8@gmail.com> # Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com> # Fred N. van Kempen, <decwiz@yahoo.com>
@@ -122,6 +122,7 @@ CC := gcc -m32
endif endif
WINDRES := windres WINDRES := windres
DEPS = -MMD -MF $*.d -c $< DEPS = -MMD -MF $*.d -c $<
DEPFILE := win/.depends
# Set up the correct toolchain flags. # Set up the correct toolchain flags.
OPTS := -DWIN32 $(EXTRAS) $(STUFF) OPTS := -DWIN32 $(EXTRAS) $(STUFF)
@@ -204,17 +205,22 @@ endif
ifeq ($(VNC), y) ifeq ($(VNC), y)
CFLAGS += -DUSE_VNC CFLAGS += -DUSE_VNC
RFLAGS += -DUSE_VNC RFLAGS += -DUSE_VNC
ifneq ($(VNC_PATH), )
CFLAGS += -I$(VNC_PATH)\INCLUDE CFLAGS += -I$(VNC_PATH)\INCLUDE
# VNCLIB := $(VNC_PATH)\LIB\libvncserver.a VNCLIB := -L$(VNC_PATH)\LIB
VNCLIB := -lvncserver endif
VNCLIB += -lvncserver
VNCOBJ := win_vnc.o VNCOBJ := win_vnc.o
endif endif
ifeq ($(RDP), y) ifeq ($(RDP), y)
CFLAGS += -DUSE_RDP CFLAGS += -DUSE_RDP
RFLAGS += -DUSE_RDP RFLAGS += -DUSE_RDP
ifneq ($(RDP_PATH), )
CFLAGS += -I$(RDP_PATH)\INCLUDE CFLAGS += -I$(RDP_PATH)\INCLUDE
RDPLIB := $(RDP_PATH)\LIB\librdp.a RDPLIB := -L$(RDP_PATH)\LIB
endif
RDPLIB += -lrdp
RDPOBJ := win_rdp.o RDPOBJ := win_rdp.o
endif endif
@@ -241,6 +247,7 @@ ifeq ($(PAS16), y)
CFLAGS += -DUSE_PAS16 CFLAGS += -DUSE_PAS16
DEVBROBJ += snd_pas16.o DEVBROBJ += snd_pas16.o
endif endif
endif endif
@@ -483,27 +490,27 @@ endif
clean: clean:
@echo Cleaning objects.. @echo Cleaning objects..
@-rm *.o 2>NUL @-rm -f *.o 2>NUL
@-rm *.res 2>NUL @-rm -f *.res 2>NUL
clobber: clean clobber: clean
@echo Cleaning executables.. @echo Cleaning executables..
@-rm *.d 2>NUL @-rm -f *.d 2>NUL
@-rm *.exe 2>NUL @-rm -f *.exe 2>NUL
# @-rm *.depends 2>NUL # @-rm -f $(DEPFILE) 2>NUL
ifneq ($(AUTODEP), y) ifneq ($(AUTODEP), y)
depclean: depclean:
@-rm -f .depends 2>NUL @-rm -f $(DEPFILE) 2>NUL
@echo Creating dependencies.. @echo Creating dependencies..
@echo # Run "make depends" to re-create this file. >.depends @echo # Run "make depends" to re-create this file. $(DEPFILE)
depends: DEPOBJ=$(OBJ:%.o=%.d) depends: DEPOBJ=$(OBJ:%.o=%.d)
depends: depclean $(OBJ:%.o=%.d) depends: depclean $(OBJ:%.o=%.d)
@-cat $(DEPOBJ) >>.depends @-cat $(DEPOBJ) >>$(DEPFILE)
@-rm -f $(DEPOBJ) @-rm -f $(DEPOBJ)
.depends: $(DEPFILE):
endif endif
@@ -512,7 +519,7 @@ ifeq ($(AUTODEP), y)
#-include $(OBJ:%.o=%.d) (better, but sloooowwwww) #-include $(OBJ:%.o=%.d) (better, but sloooowwwww)
-include *.d -include *.d
else else
include $(wildcard .depends) include $(wildcard $(DEPFILE))
endif endif

View File

@@ -8,7 +8,7 @@
* *
* The Emulator's Windows core. * The Emulator's Windows core.
* *
* Version: @(#)win.c 1.0.23 2017/10/13 * Version: @(#)win.c 1.0.24 2017/10/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -1403,7 +1403,7 @@ get_executable_name(wchar_t *s, int size)
} }
void wchar_t *
set_window_title(wchar_t *s) set_window_title(wchar_t *s)
{ {
if (! video_fullscreen) { if (! video_fullscreen) {
@@ -1414,6 +1414,8 @@ set_window_title(wchar_t *s)
SetWindowText(hwndMain, s); SetWindowText(hwndMain, s);
} }
return(s);
} }
@@ -1590,7 +1592,7 @@ take_screenshot(void)
ddraw_fs_take_screenshot(path); ddraw_fs_take_screenshot(path);
else else
ddraw_take_screenshot(path); ddraw_take_screenshot(path);
pclog("Screenshot: fn='%S'\n", path); pclog("Screenshot: fn='%ls'\n", path);
break; break;
case 1: /* d3d9 */ case 1: /* d3d9 */
@@ -1600,7 +1602,7 @@ take_screenshot(void)
d3d_fs_take_screenshot(path); d3d_fs_take_screenshot(path);
else else
d3d_take_screenshot(path); d3d_take_screenshot(path);
pclog("Screenshot: fn='%S'\n", path); pclog("Screenshot: fn='%ls'\n", path);
break; break;
#ifdef USE_VNC #ifdef USE_VNC
@@ -1608,7 +1610,7 @@ take_screenshot(void)
wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info); wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info);
append_filename_w(path, cfg_path, fn, 1024); append_filename_w(path, cfg_path, fn, 1024);
vnc_take_screenshot(path); vnc_take_screenshot(path);
pclog("Screenshot: fn='%S'\n", path); pclog("Screenshot: fn='%ls'\n", path);
break; break;
#endif #endif
} }

View File

@@ -8,7 +8,7 @@
* *
* Implement threads and mutexes for the Win32 platform. * Implement threads and mutexes for the Win32 platform.
* *
* Version: @(#)win_thread.c 1.0.2 2017/10/10 * Version: @(#)win_thread.c 1.0.3 2017/10/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -46,9 +46,7 @@ thread_create(void (*thread_rout)(void *param), void *param)
void void
thread_kill(void *handle) thread_kill(void *handle)
{ {
if (handle == NULL) { if (handle == NULL) return;
return;
}
TerminateThread(handle, 0); TerminateThread(handle, 0);
} }
@@ -64,117 +62,98 @@ thread_sleep(int t)
event_t * event_t *
thread_create_event(void) thread_create_event(void)
{ {
win_event_t *event = malloc(sizeof(win_event_t)); win_event_t *ev = malloc(sizeof(win_event_t));
event->handle = CreateEvent(NULL, FALSE, FALSE, NULL); ev->handle = CreateEvent(NULL, FALSE, FALSE, NULL);
return((event_t *)event); return((event_t *)ev);
} }
void void
thread_set_event(event_t *_event) thread_set_event(event_t *arg)
{ {
if (_event == NULL) { win_event_t *ev = (win_event_t *)arg;
return;
}
win_event_t *event = (win_event_t *)_event; if (arg == NULL) return;
SetEvent(event->handle); SetEvent(ev->handle);
} }
void void
thread_reset_event(event_t *_event) thread_reset_event(event_t *arg)
{ {
if (_event == NULL) { win_event_t *ev = (win_event_t *)arg;
return;
}
win_event_t *event = (win_event_t *)_event; if (arg == NULL) return;
ResetEvent(event->handle); ResetEvent(ev->handle);
} }
int int
thread_wait_event(event_t *_event, int timeout) thread_wait_event(event_t *arg, int timeout)
{ {
if (_event == NULL) { win_event_t *ev = (win_event_t *)arg;
return 0;
}
win_event_t *event = (win_event_t *)_event; if (arg == NULL) return(0);
if (timeout == -1) if (timeout == -1)
timeout = INFINITE; timeout = INFINITE;
if (WaitForSingleObject(event->handle, timeout)) return(1); if (WaitForSingleObject(ev->handle, timeout)) return(1);
return(0); return(0);
} }
void void
thread_destroy_event(event_t *_event) thread_destroy_event(event_t *arg)
{ {
win_event_t *event = (win_event_t *)_event; win_event_t *ev = (win_event_t *)arg;
if (_event == NULL) { if (arg == NULL) return;
return;
}
CloseHandle(event->handle); CloseHandle(ev->handle);
free(event); free(ev);
} }
void * mutex_t *
thread_create_mutex(wchar_t *name) thread_create_mutex(wchar_t *name)
{ {
return((void*)CreateMutex(NULL, FALSE, name)); return((mutex_t*)CreateMutex(NULL, FALSE, name));
} }
void void
thread_close_mutex(void *mutex) thread_close_mutex(mutex_t *mutex)
{ {
if (mutex == NULL) { if (mutex == NULL) return;
return;
}
CloseHandle((HANDLE)mutex); CloseHandle((HANDLE)mutex);
} }
uint8_t int
thread_wait_mutex(void *mutex) thread_wait_mutex(mutex_t *mutex)
{ {
if (mutex == NULL) { if (mutex == NULL) return(0);
return 0;
}
DWORD dwres = WaitForSingleObject((HANDLE)mutex, INFINITE); DWORD dwres = WaitForSingleObject((HANDLE)mutex, INFINITE);
switch (dwres) { if (dwres == WAIT_OBJECT_0) return(1);
case WAIT_OBJECT_0:
return(1);
case WAIT_ABANDONED:
default:
return(0); return(0);
} }
}
uint8_t int
thread_release_mutex(void *mutex) thread_release_mutex(mutex_t *mutex)
{ {
if (mutex == NULL) { if (mutex == NULL) return(0);
return 0;
}
return(!!ReleaseMutex((HANDLE)mutex)); return(!!ReleaseMutex((HANDLE)mutex));
} }

View File

@@ -6,12 +6,12 @@
* *
* This file is part of the 86Box distribution. * This file is part of the 86Box distribution.
* *
* Implement the VNC renderer. * Implement the VNC renderer with LibVNCServer.
* *
* Version: @(#)win_vnc.c 1.0.2 2017/10/13 * Version: @(#)win_vnc.c 1.0.2 2017/10/14
* *
* Authors: RichardG, <richardg867@gmail.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Based on raw code by RichardG, <richardg867@gmail.com>
* *
* Copyright 2017 Fred N. van Kempen. * Copyright 2017 Fred N. van Kempen.
*/ */
@@ -30,11 +30,8 @@
#include "win_vnc.h" #include "win_vnc.h"
extern void video_blit_complete(void); static rfbScreenInfoPtr rfb = NULL;
static int clients;
static rfbScreenInfoPtr rfbScreen;
static int vnc_clients;
static int updatingSize; static int updatingSize;
static int allowedX, static int allowedX,
allowedY; allowedY;
@@ -115,13 +112,12 @@ vnc_clientgone(rfbClientPtr cl)
{ {
pclog("VNC: client disconnected: %s\n", cl->host); pclog("VNC: client disconnected: %s\n", cl->host);
if (vnc_clients > 0) if (clients > 0)
vnc_clients--; clients--;
if (vnc_clients == 0) { if (clients == 0) {
/* No more clients, pause the emulator. */ /* No more clients, pause the emulator. */
plat_pause(1);
pclog("VNC: no clients, pausing..\n"); pclog("VNC: no clients, pausing..\n");
plat_pause(1);
} }
} }
@@ -133,7 +129,7 @@ vnc_newclient(rfbClientPtr cl)
cl->clientGoneHook = vnc_clientgone; cl->clientGoneHook = vnc_clientgone;
pclog("VNC: new client: %s\n", cl->host); pclog("VNC: new client: %s\n", cl->host);
if (++vnc_clients == 1) { if (++clients == 1) {
/* We now have clients, un-pause the emulator. */ /* We now have clients, un-pause the emulator. */
pclog("VNC: unpausing..\n"); pclog("VNC: unpausing..\n");
plat_pause(0); plat_pause(0);
@@ -149,13 +145,11 @@ vnc_display(rfbClientPtr cl)
/* Avoid race condition between resize and update. */ /* Avoid race condition between resize and update. */
if (!updatingSize && cl->newFBSizePending) { if (!updatingSize && cl->newFBSizePending) {
updatingSize = 1; updatingSize = 1;
pclog("VNC: updatingSize=1\n");
} else if (updatingSize && !cl->newFBSizePending) { } else if (updatingSize && !cl->newFBSizePending) {
updatingSize = 0; updatingSize = 0;
pclog("VNC: updatingSize=0\n");
allowedX = rfbScreen->width; allowedX = rfb->width;
allowedY = rfbScreen->height; allowedY = rfb->height;
} }
} }
@@ -196,35 +190,51 @@ vnc_kbdevent(rfbBool down, rfbKeySym k, rfbClientPtr cl)
static void static void
vnc_memtoscreen(int x, int y, int y1, int y2, int w, int h) vnc_blit(int x, int y, int y1, int y2, int w, int h)
{ {
int yy, i; uint32_t *p;
int yy;
for (yy=y1; yy<y2; yy++) {
p = (uint32_t *)&(((uint32_t *)rfb->frameBuffer)[yy*2048]);
/* y1 to <y2. */
for (yy=y1,i=0; yy<y2; yy++,i++) {
if ((y+yy) >= 0 && (y+yy) < 2048) if ((y+yy) >= 0 && (y+yy) < 2048)
memcpy((uint32_t *) &(((uint8_t *) rfbScreen->frameBuffer)[yy*2048*4]), &(((uint32_t *)buffer32->line[y+yy])[x]), w*4); memcpy(p, &(((uint32_t *)buffer32->line[y+yy])[x]), w*4);
} }
video_blit_complete(); video_blit_complete();
if (! updatingSize) if (! updatingSize)
rfbMarkRectAsModified(rfbScreen, 0,0, allowedX,allowedY); rfbMarkRectAsModified(rfb, 0,0, allowedX,allowedY);
} }
static void static void
vnc_memtoscreen_8(int x, int y, int w, int h) vnc_blit8(int x, int y, int w, int h)
{ {
#if 1 uint32_t *p;
pclog("VNC: memtoscreen_8 %i,%i %i,%i\n", x, y, w, h); int xx, yy;
#endif
for (yy = 0; yy < h; yy++) {
p = (uint32_t *)&(((uint32_t *)rfb->frameBuffer)[yy*2048]);
if ((y+yy) >= 0 && (y+yy) < buffer->h) {
for (xx=0; xx<w; xx++)
p[xx] = pal_lookup[buffer->line[y+yy][x+xx]];
}
}
video_blit_complete();
if (! updatingSize)
rfbMarkRectAsModified(rfb, 0,0, x+w,y+h);
} }
int int
vnc_init(HWND h) vnc_init(HWND h)
{ {
static char title[128];
rfbPixelFormat rpf = { rfbPixelFormat rpf = {
/* /*
* Screen format: * Screen format:
@@ -238,34 +248,32 @@ vnc_init(HWND h)
32, 32, 0, 1, 255,255,255, 16, 8, 0, 0, 0 32, 32, 0, 1, 255,255,255, 16, 8, 0, 0, 0
}; };
if (rfbScreen == NULL) { if (rfb == NULL) {
wcstombs(title, set_window_title(NULL), sizeof(title));
updatingSize = 0; updatingSize = 0;
allowedX = allowedY = 2048; allowedX = allowedY = 2048;
rfbScreen = rfbGetScreen(0, NULL, 2048, 2048, 8, 3, 4); rfb = rfbGetScreen(0, NULL, 2048, 2048, 8, 3, 4);
rfbScreen->desktopName = "86Box"; rfb->desktopName = title;
rfbScreen->frameBuffer = (char *)malloc(2048 * 2048 * 4); rfb->frameBuffer = (char *)malloc(2048 * 2048 * 4);
#if 1 rfb->serverFormat = rpf;
rfbScreen->serverFormat = rpf; rfb->alwaysShared = TRUE;
#else rfb->displayHook = vnc_display;
rfbScreen->serverFormat = {32, 32, 0, 1, 255,255,255, 16, 8, 0, 0, 0}; rfb->kbdAddEvent = vnc_kbdevent;
#endif rfb->newClientHook = vnc_newclient;
rfbScreen->alwaysShared = TRUE;
rfbScreen->displayHook = vnc_display;
rfbScreen->kbdAddEvent = vnc_kbdevent;
rfbScreen->newClientHook = vnc_newclient;
rfbInitServer(rfbScreen); rfbInitServer(rfb);
rfbRunEventLoop(rfbScreen, -1, TRUE); rfbRunEventLoop(rfb, -1, TRUE);
} }
video_setblit(vnc_memtoscreen_8, vnc_memtoscreen); /* Set up our BLIT handlers. */
video_setblit(vnc_blit8, vnc_blit);
pclog("VNC: init complete.\n"); pclog("VNC: init complete.\n");
vnc_clients = 0; clients = 0;
return(1); return(1);
} }
@@ -281,17 +289,21 @@ vnc_close(void)
void void
vnc_resize(int x, int y) vnc_resize(int x, int y)
{ {
if ((x != rfbScreen->width || y != rfbScreen->height) && x > 160 && y > 0) { rfbClientIteratorPtr iterator;
rfbClientPtr cl;
if (rfb == NULL) return;
if ((x != rfb->width || y != rfb->height) && x > 160 && y > 0) {
pclog("VNC: updating resolution: %dx%d\n", x, y); pclog("VNC: updating resolution: %dx%d\n", x, y);
allowedX = (rfbScreen->width < x) ? rfbScreen->width : x; allowedX = (rfb->width < x) ? rfb->width : x;
allowedY = (rfbScreen->width < y) ? rfbScreen->width : y; allowedY = (rfb->width < y) ? rfb->width : y;
rfbScreen->width = x; rfb->width = x;
rfbScreen->height = y; rfb->height = y;
rfbClientPtr cl; iterator = rfbGetClientIterator(rfb);
rfbClientIteratorPtr iterator = rfbGetClientIterator(rfbScreen);
while ((cl = rfbClientIteratorNext(iterator)) != NULL) { while ((cl = rfbClientIteratorNext(iterator)) != NULL) {
LOCK(cl->updateMutex); LOCK(cl->updateMutex);
cl->newFBSizePending = 1; cl->newFBSizePending = 1;
@@ -304,7 +316,7 @@ vnc_resize(int x, int y)
int int
vnc_pause(void) vnc_pause(void)
{ {
return((vnc_clients > 0) ? 0 : 1); return((clients > 0) ? 0 : 1);
} }