From 15538f1441871337493f6ccc9a4e53a4d34446e4 Mon Sep 17 00:00:00 2001 From: waltje Date: Fri, 27 Oct 2017 20:54:31 -0400 Subject: [PATCH] More portability changes, and some bugfixes found through that. --- src/86box.h | 5 ++++- src/cdrom/cdrom_dosbox.cpp | 6 +----- src/disk/hdc_ide.c | 9 +++++++-- src/network/slirp/slirp.h | 1 + src/pc.c | 17 +++++++++++++++-- src/plat.h | 7 ++++++- src/scsi/scsi_buslogic.c | 4 ++-- src/scsi/scsi_x54x.h | 4 ++-- src/sound/snd_emu8k.c | 2 ++ src/video/video.c | 8 +++++--- 10 files changed, 45 insertions(+), 18 deletions(-) diff --git a/src/86box.h b/src/86box.h index 42d1f9133..e64507a17 100644 --- a/src/86box.h +++ b/src/86box.h @@ -8,7 +8,7 @@ * * Main include file for the application. * - * Version: @(#)86box.h 1.0.7 2017/10/21 + * Version: @(#)86box.h 1.0.8 2017/10/27 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -60,6 +60,9 @@ extern "C" { extern int dump_on_exit; /* (O) dump regs on exit*/ extern int do_dump_config; /* (O) dump cfg after load */ extern int start_in_fullscreen; /* (O) start in fullscreen */ +#ifdef USE_WX +extern int video_fps; /* (O) render speed in fps */ +#endif extern int window_w, window_h, /* (C) window size and */ window_x, window_y, /* position info */ diff --git a/src/cdrom/cdrom_dosbox.cpp b/src/cdrom/cdrom_dosbox.cpp index a729f1cdb..de3c146a4 100644 --- a/src/cdrom/cdrom_dosbox.cpp +++ b/src/cdrom/cdrom_dosbox.cpp @@ -18,11 +18,6 @@ /* Modified for use with PCem by bit */ -//#ifdef FREEBSD -//# define fopen64 fopen -//# define fseeko64 fseeko -//# define ftello64 ftello -//#endif #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #ifdef WIN32 @@ -30,6 +25,7 @@ # define _GNU_SOURCE #endif #include +#include #include #include diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index d06e0a647..097d85c01 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.16 2017/10/26 + * Version: @(#)hdc_ide.c 1.0.17 2017/10/27 * * Authors: Sarah Walker, * Miran Grca, @@ -2012,7 +2012,12 @@ void callbackide(int ide_board) return; case WIN_SET_FEATURES: - if ((ide->type == IDE_NONE)/* || ide_drive_is_cdrom(ide)*/) +#if 1 + /* To avoid Clang warning. --FvK */ + if (ide->type == IDE_NONE) +#else + if ((ide->type == IDE_NONE) || ide_drive_is_cdrom(ide)) +#endif { goto abort_cmd; } diff --git a/src/network/slirp/slirp.h b/src/network/slirp/slirp.h index e0af9414d..532ef657e 100644 --- a/src/network/slirp/slirp.h +++ b/src/network/slirp/slirp.h @@ -64,6 +64,7 @@ typedef unsigned long ioctlsockopt_t; # define HAVE_STDLIB_H # define HAVE_STRING_H # define HAVE_UNISTD_H +# define HAVE_INET_ATON typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; typedef uint32_t u_int32_t; diff --git a/src/pc.c b/src/pc.c index a8166f964..10f3bb955 100644 --- a/src/pc.c +++ b/src/pc.c @@ -8,7 +8,7 @@ * * Main emulator module where most things are controlled. * - * Version: @(#)pc.c 1.0.34 2017/10/25 + * Version: @(#)pc.c 1.0.35 2017/10/27 * * Authors: Sarah Walker, * Miran Grca, @@ -81,6 +81,9 @@ int dump_on_exit = 0; /* (O) dump regs on exit */ int do_dump_config = 0; /* (O) dump config on load */ int start_in_fullscreen = 0; /* (O) start in fullscreen */ +#ifdef USE_WX +int video_fps = RENDER_FPS; /* (O) render speed in fps */ +#endif /* Configuration values. */ int window_w, window_h, /* (C) window size and */ @@ -318,6 +321,9 @@ usage: printf("-D or --dump - dump memory on exit\n"); printf("-F or --fullscreen - start in fullscreen mode\n"); printf("-P or --vmpath path - set 'path' to be root for vm\n"); +#ifdef USE_WX + printf("-R or --fps num - set render speed to 'num' fps\n"); +#endif printf("\nA config file can be specified. If none is, the default file will be used.\n"); return(0); } else if (!wcscasecmp(argv[c], L"--dumpcfg") || @@ -331,9 +337,16 @@ usage: start_in_fullscreen = 1; } else if (!wcscasecmp(argv[c], L"--vmpath") || !wcscasecmp(argv[c], L"-P")) { - if ((c+1) == argc) break; + if ((c+1) == argc) goto usage; wcscpy(cfg_path, argv[++c]); +#ifdef USE_WX + } else if (!wcscasecmp(argv[c], L"--fps") || + !wcscasecmp(argv[c], L"-R")) { + if ((c+1) == argc) goto usage; + + video_fps = wcstol(argv[++c], NULL, 10); +#endif } else if (!wcscasecmp(argv[c], L"--test")) { /* some (undocumented) test function here.. */ diff --git a/src/plat.h b/src/plat.h index 3e9c5a482..6f17c193c 100644 --- a/src/plat.h +++ b/src/plat.h @@ -8,7 +8,7 @@ * * Define the various platform support functions. * - * Version: @(#)plat.h 1.0.14 2017/10/24 + * Version: @(#)plat.h 1.0.15 2017/10/27 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -24,6 +24,11 @@ #endif +#ifndef WIN32 +# define RENDER_FPS 70 /* default render speed */ +#endif + + #ifdef FREEBSD /* FreeBSD has largefile by default. */ # define fopen64 fopen diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index 1133f4969..4d9f644da 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -11,7 +11,7 @@ * 1 - BT-545S ISA; * 2 - BT-958D PCI * - * Version: @(#)scsi_buslogic.c 1.0.26 2017/10/22 + * Version: @(#)scsi_buslogic.c 1.0.27 2017/10/27 * * Authors: TheCollector1995, * Miran Grca, @@ -673,7 +673,7 @@ buslogic_cmds(void *p) FILE *f; uint16_t TargetsPresentMask = 0; - uint8_t Offset; + uint32_t Offset; int i = 0; int j = 0; MailboxInitExtended_t *MailboxInitE; diff --git a/src/scsi/scsi_x54x.h b/src/scsi/scsi_x54x.h index 29c608ff5..cdc7b5ebf 100644 --- a/src/scsi/scsi_x54x.h +++ b/src/scsi/scsi_x54x.h @@ -11,7 +11,7 @@ * of SCSI Host Adapters made by Mylex. * These controllers were designed for various buses. * - * Version: @(#)scsi_x54x.h 1.0.2 2017/10/22 + * Version: @(#)scsi_x54x.h 1.0.3 2017/10/27 * * Authors: TheCollector1995, * Miran Grca, @@ -368,7 +368,7 @@ typedef struct { uint8_t Command; uint8_t CmdBuf[128]; uint8_t CmdParam; - uint8_t CmdParamLeft; + uint32_t CmdParamLeft; uint8_t DataBuf[65536]; uint16_t DataReply; uint16_t DataReplyLeft; diff --git a/src/sound/snd_emu8k.c b/src/sound/snd_emu8k.c index 2c2f61edd..f849140fc 100644 --- a/src/sound/snd_emu8k.c +++ b/src/sound/snd_emu8k.c @@ -316,6 +316,7 @@ static inline int16_t EMU8K_READ(emu8k_t *emu8k, uint32_t addr) return emu8k->ram_pointers[addrmem.hb_address][addrmem.lw_address]; } +#if NOTUSED static inline int16_t EMU8K_READ_INTERP_LINEAR(emu8k_t *emu8k, uint32_t int_addr, uint16_t fract) { /* The interpolation in AWE32 used a so-called patented 3-point interpolation @@ -328,6 +329,7 @@ static inline int16_t EMU8K_READ_INTERP_LINEAR(emu8k_t *emu8k, uint32_t int_addr dat1 += ((dat2-(int32_t)dat1)* fract) >> 16; return dat1; } +#endif static inline int32_t EMU8K_READ_INTERP_CUBIC(emu8k_t *emu8k, uint32_t int_addr, uint16_t fract) { diff --git a/src/video/video.c b/src/video/video.c index 9a666aba0..dfb67a89f 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -40,7 +40,7 @@ * W = 3 bus clocks * L = 4 bus clocks * - * Version: @(#)video.c 1.0.5 2017/10/22 + * Version: @(#)video.c 1.0.6 2017/10/27 * * Authors: Sarah Walker, * Miran Grca, @@ -200,7 +200,9 @@ void blit_thread(void *param) thread_wait_event(blit_data.wake_blit_thread, -1); thread_reset_event(blit_data.wake_blit_thread); - blit_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h); + blit_func(blit_data.x, blit_data.y, + blit_data.y1, blit_data.y2, + blit_data.w, blit_data.h); blit_data.busy = 0; thread_set_event(blit_data.blit_complete); @@ -529,7 +531,7 @@ video_init(void) #endif for (c = 0; c < 65536; c++) video_16to32[c] = calc_16to32(c); - + blit_data.wake_blit_thread = thread_create_event(); blit_data.blit_complete = thread_create_event(); blit_data.buffer_not_in_use = thread_create_event();