mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 09:35:32 -07:00
More cleanups to separate main code from platform support and UI support, plus a few bugfixes.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Modified Makefile for Win32 (MinGW32) environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.56 2017/10/10
|
||||
# Version: @(#)Makefile.mingw 1.0.57 2017/10/11
|
||||
#
|
||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -453,7 +453,7 @@ clean:
|
||||
@-rm *.res 2>NUL
|
||||
|
||||
clobber: clean
|
||||
@echO Cleaning executables..
|
||||
@echo Cleaning executables..
|
||||
@-rm *.d 2>NUL
|
||||
@-rm *.exe 2>NUL
|
||||
# @-rm *.depends 2>NUL
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||
* commands, for both ATAPI and SCSI usage.
|
||||
*
|
||||
* Version: @(#)cdrom.c 1.0.15 2017/10/10
|
||||
* Version: @(#)cdrom.c 1.0.16 2017/10/12
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -989,16 +989,16 @@ void cdrom_mode_sense_load(uint8_t id)
|
||||
switch(id)
|
||||
{
|
||||
case 0:
|
||||
f = _wfopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"rb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"rb");
|
||||
break;
|
||||
case 1:
|
||||
f = _wfopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"rb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"rb");
|
||||
break;
|
||||
case 2:
|
||||
f = _wfopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"rb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"rb");
|
||||
break;
|
||||
case 3:
|
||||
f = _wfopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"rb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"rb");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@@ -1017,16 +1017,16 @@ void cdrom_mode_sense_save(uint8_t id)
|
||||
switch(id)
|
||||
{
|
||||
case 0:
|
||||
f = _wfopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"wb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"wb");
|
||||
break;
|
||||
case 1:
|
||||
f = _wfopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"wb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"wb");
|
||||
break;
|
||||
case 2:
|
||||
f = _wfopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"wb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"wb");
|
||||
break;
|
||||
case 3:
|
||||
f = _wfopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"wb");
|
||||
f = plat_fopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"wb");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#ifdef WIN32
|
||||
//FIXME: should not be needed. */
|
||||
# define _GNU_SOURCE
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cctype>
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../config.h"
|
||||
#include "../plat.h"
|
||||
#include "cdrom_dosbox.h"
|
||||
#include "cdrom.h"
|
||||
#include "cdrom_image.h"
|
||||
@@ -990,10 +991,10 @@ int image_open(uint8_t id, wchar_t *fn)
|
||||
|
||||
if (!cdrom_image[id].image_inited || cdrom_image[id].image_changed)
|
||||
{
|
||||
_swprintf(cdrom_image[id].image_path, L"%ws", fn);
|
||||
swprintf(cdrom_image[id].image_path, sizeof(cdrom_image[id].image_path)/sizeof(wchar_t), L"%ws", fn);
|
||||
}
|
||||
|
||||
if (!wcsicmp(get_extension_w(fn), L"ISO"))
|
||||
if (! wcscasecmp(get_extension_w(fn), L"ISO"))
|
||||
{
|
||||
cdrom_image[id].image_is_iso = 1;
|
||||
}
|
||||
|
||||
20
src/config.c
20
src/config.c
@@ -8,11 +8,7 @@
|
||||
*
|
||||
* Configuration file handler.
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* Version: @(#)config.c 1.0.16 2017/10/10
|
||||
=======
|
||||
* Version: @(#)config.c 1.0.16 2017/10/11
|
||||
>>>>>>> 89ec4e0fa703eacfdada3ab3d55f885bc28522f1
|
||||
* Version: @(#)config.c 1.0.18 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -57,9 +53,10 @@
|
||||
#include "sound/snd_opl.h"
|
||||
#include "sound/sound.h"
|
||||
#include "video/video.h"
|
||||
#include "ui.h"
|
||||
#include "plat.h"
|
||||
#include "plat_joystick.h"
|
||||
#include "plat_midi.h"
|
||||
#include "ui.h"
|
||||
|
||||
|
||||
typedef struct _list_ {
|
||||
@@ -245,9 +242,9 @@ config_read(wchar_t *fn)
|
||||
FILE *f;
|
||||
|
||||
#ifdef ANSI_CFG
|
||||
f = _wfopen(fn, L"rt");
|
||||
f = plat_fopen(fn, L"rt");
|
||||
#else
|
||||
f = _wfopen(fn, L"rt, ccs=UNICODE");
|
||||
f = plat_fopen(fn, L"rt, ccs=UNICODE");
|
||||
#endif
|
||||
if (f == NULL) return(0);
|
||||
|
||||
@@ -343,9 +340,9 @@ config_write(wchar_t *fn)
|
||||
int fl = 0;
|
||||
|
||||
#ifdef ANSI_CFG
|
||||
f = _wfopen(fn, L"wt");
|
||||
f = plat_fopen(fn, L"wt");
|
||||
#else
|
||||
f = _wfopen(fn, L"wt, ccs=UNICODE");
|
||||
f = plat_fopen(fn, L"wt, ccs=UNICODE");
|
||||
#endif
|
||||
if (f == NULL) return;
|
||||
|
||||
@@ -2010,7 +2007,8 @@ append_filename(char *dest, char *s1, char *s2, int size)
|
||||
void
|
||||
append_filename_w(wchar_t *dest, wchar_t *s1, wchar_t *s2, int size)
|
||||
{
|
||||
_swprintf(dest, L"%s%s", s1, s2);
|
||||
/* We assume 512 here (pathnames) which "should" be safe. --FvK */
|
||||
swprintf(dest, 512, L"%s%s", s1, s2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,20 +41,20 @@ x86seg _oldds;
|
||||
|
||||
extern int cpl_override;
|
||||
|
||||
int has_fpu;
|
||||
extern int fpucount;
|
||||
uint16_t rds;
|
||||
uint16_t ea_rseg;
|
||||
|
||||
int is486;
|
||||
int cgate32;
|
||||
|
||||
uint32_t cr2, cr3, cr4;
|
||||
uint32_t dr[8];
|
||||
|
||||
|
||||
#if FIXME
|
||||
/* in mem.c and rom.c */
|
||||
uint8_t romext[32768];
|
||||
uint8_t *ram,*rom;
|
||||
#endif
|
||||
|
||||
uint32_t rmdat32;
|
||||
#define rmdat rmdat32
|
||||
|
||||
@@ -45,17 +45,16 @@ int trap;
|
||||
|
||||
int cpl_override=0;
|
||||
|
||||
int has_fpu;
|
||||
int fpucount=0;
|
||||
uint16_t rds;
|
||||
uint16_t ea_rseg;
|
||||
|
||||
int is486;
|
||||
int cgate32;
|
||||
|
||||
|
||||
#if FIXME
|
||||
uint8_t romext[32768];
|
||||
uint8_t *ram,*rom;
|
||||
#endif
|
||||
|
||||
uint32_t rmdat32;
|
||||
uint32_t backupregs[16];
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
* 2 clocks - fetch opcode 1 2 clocks - execute
|
||||
* 2 clocks - fetch opcode 2 etc
|
||||
*
|
||||
* Version: @(#)808x.c 1.0.3 2017/10/04
|
||||
* Version: @(#)808x.c 1.0.4 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
@@ -32,14 +33,16 @@
|
||||
#include "../ibm.h"
|
||||
#include "cpu.h"
|
||||
#include "x86.h"
|
||||
#include "../keyboard.h" /* its WRONG to have this in here!! --FvK */
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../nmi.h"
|
||||
#include "../pic.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h" /* for scsi.h */
|
||||
#include "../keyboard.h" /* its WRONG to have this in here!! --FvK */
|
||||
#include "../scsi/scsi.h" /* its WRONG to have this in here!! --FvK */
|
||||
#include "../plat.h"
|
||||
|
||||
|
||||
int xt_cpu_multi;
|
||||
int nmi = 0;
|
||||
@@ -131,7 +134,10 @@ int noint=0;
|
||||
|
||||
int output=0;
|
||||
|
||||
#if 0
|
||||
/* Also in mem.c */
|
||||
int shadowbios=0;
|
||||
#endif
|
||||
|
||||
int ins=0;
|
||||
|
||||
@@ -487,7 +493,10 @@ void makeznptable()
|
||||
if (c&0x8000) znptable16[c]|=N_FLAG;
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
/* Also in mem.c */
|
||||
int timetolive=0;
|
||||
#endif
|
||||
|
||||
extern uint32_t oldcs2;
|
||||
extern uint32_t oldpc2;
|
||||
@@ -507,7 +516,7 @@ void dumpregs(int force)
|
||||
#ifndef RELEASE_BUILD
|
||||
indump = 1;
|
||||
output=0;
|
||||
_wchdir(cfg_path);
|
||||
(void)plat_chdir(cfg_path);
|
||||
nopageerrors=1;
|
||||
f=fopen("ram.dmp","wb");
|
||||
fwrite(ram,mem_size*1024,1,f);
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
*
|
||||
* CPU type handler.
|
||||
*
|
||||
* Version: @(#)cpu.c 1.0.2 2017/09/24
|
||||
* Version: @(#)cpu.c 1.0.3 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 leilei.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -114,7 +115,7 @@ int cpu_waitstates;
|
||||
int cpu_cache_int_enabled, cpu_cache_ext_enabled;
|
||||
int cpu_pci_speed;
|
||||
|
||||
int is286, is386;
|
||||
int is286, is386, is486;
|
||||
int israpidcad, is_pentium;
|
||||
|
||||
uint64_t tsc = 0;
|
||||
|
||||
@@ -17,7 +17,7 @@ uint8_t opcode;
|
||||
int noint;
|
||||
|
||||
uint16_t lastcs,lastpc;
|
||||
int timetolive,keyboardtimer;
|
||||
extern int timetolive,keyboardtimer;
|
||||
|
||||
#define setznp168 setznp16
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
*
|
||||
* x86 CPU segment emulation.
|
||||
*
|
||||
* Version: @(#)x86seg.c 1.0.2 2017/10/02
|
||||
* Version: @(#)x86seg.c 1.0.3 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
@@ -39,7 +40,6 @@
|
||||
int stimes = 0;
|
||||
int dtimes = 0;
|
||||
int btimes = 0;
|
||||
int is486=1;
|
||||
|
||||
uint32_t abrt_error;
|
||||
int cgate16,cgate32;
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
*
|
||||
* x86 CPU segment emulation.
|
||||
*
|
||||
* Version: @(#)x86seg.h 1.0.0 2017/05/30
|
||||
* Version: @(#)x86seg.h 1.0.1 2017/10/12
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
|
||||
void do_seg_load(x86seg *s, uint16_t *segdat);
|
||||
extern void do_seg_load(x86seg *s, uint16_t *segdat);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the IDE emulation for hard disks and ATAPI
|
||||
* CD-ROM devices.
|
||||
*
|
||||
* Version: @(#)hdc_ide.c 1.0.11 2017/10/09
|
||||
* Version: @(#)hdc_ide.c 1.0.12 2017/10/11
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -17,6 +17,9 @@
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -621,7 +624,7 @@ void ide_reset(void)
|
||||
ide_drives[d].type = IDE_NONE;
|
||||
if (ide_drives[d].hdd_num != -1)
|
||||
hdd_image_close(ide_drives[d].hdd_num);
|
||||
if (ide_drive_is_cdrom(&ide_drives[d]))
|
||||
if ((d < 8) && ide_drive_is_cdrom(&ide_drives[d]))
|
||||
{
|
||||
cdrom[atapi_cdrom_drives[d]].status = READY_STAT | DSC_STAT;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* based design. Most cards were WD1003-WA2 or -WAH, where the
|
||||
* -WA2 cards had a floppy controller as well (to save space.)
|
||||
*
|
||||
* Version: @(#)hdd_mfm_at.c 1.0.6 2017/10/09
|
||||
* Version: @(#)hdd_mfm_at.c 1.0.7 2017/10/11
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -20,6 +20,9 @@
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* Since all controllers (including the ones made by DTC) use
|
||||
* (mostly) the same API, we keep them all in this module.
|
||||
*
|
||||
* Version: @(#)hdd_mfm_xt.c 1.0.8 2017/10/09
|
||||
* Version: @(#)hdd_mfm_xt.c 1.0.9 2017/10/11
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -49,6 +49,9 @@
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
*
|
||||
* Handling of hard disk image files.
|
||||
*
|
||||
* Version: @(#)hdd_image.c 1.0.2 2017/10/01
|
||||
* Version: @(#)hdd_image.c 1.0.4 2017/11/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
@@ -28,6 +29,7 @@
|
||||
#include <wchar.h>
|
||||
#include <errno.h>
|
||||
#include "../ibm.h"
|
||||
#include "../plat.h"
|
||||
#include "hdd.h"
|
||||
|
||||
|
||||
@@ -75,7 +77,7 @@ int image_is_hdi(const wchar_t *s)
|
||||
return 0;
|
||||
}
|
||||
memcpy(ext, ws + ((len - 4) << 1), 8);
|
||||
if (wcsicmp(ext, L".HDI") == 0)
|
||||
if (! wcscasecmp(ext, L".HDI"))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -105,7 +107,7 @@ image_is_hdx(const wchar_t *s, int check_signature)
|
||||
{
|
||||
if (check_signature)
|
||||
{
|
||||
f = _wfopen(s, L"rb");
|
||||
f = plat_fopen((wchar_t *)s, L"rb");
|
||||
if (!f)
|
||||
{
|
||||
return 0;
|
||||
@@ -176,7 +178,7 @@ int hdd_image_load(int id)
|
||||
memset(hdd[id].fn, 0, sizeof(hdd[id].fn));
|
||||
return 0;
|
||||
}
|
||||
hdd_images[id].file = _wfopen(fn, L"rb+");
|
||||
hdd_images[id].file = plat_fopen(fn, L"rb+");
|
||||
if (hdd_images[id].file == NULL)
|
||||
{
|
||||
/* Failed to open existing hard disk image */
|
||||
@@ -191,7 +193,7 @@ int hdd_image_load(int id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
hdd_images[id].file = _wfopen(fn, L"wb+");
|
||||
hdd_images[id].file = plat_fopen(fn, L"wb+");
|
||||
if (hdd_images[id].file == NULL)
|
||||
{
|
||||
hdd_image_log("Unable to open image\n");
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Generic floppy disk interface that communicates with the
|
||||
* other handlers.
|
||||
*
|
||||
* Version: @(#)floppy.c 1.0.6 2017/10/09
|
||||
* Version: @(#)floppy.c 1.0.8 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "../rom.h"
|
||||
#include "../config.h"
|
||||
#include "../timer.h"
|
||||
#include "../plat.h"
|
||||
#include "../ui.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_86f.h"
|
||||
@@ -136,14 +137,14 @@ void floppy_load(int drive, wchar_t *fn)
|
||||
if (!fn) return;
|
||||
p = get_extension_w(fn);
|
||||
if (!p) return;
|
||||
f = _wfopen(fn, L"rb");
|
||||
f = plat_fopen(fn, L"rb");
|
||||
if (!f) return;
|
||||
fseek(f, -1, SEEK_END);
|
||||
size = ftell(f) + 1;
|
||||
fclose(f);
|
||||
while (loaders[c].ext)
|
||||
{
|
||||
if (!_wcsicmp(p, loaders[c].ext) && (size == loaders[c].size || loaders[c].size == -1))
|
||||
if (!wcscasecmp(p, loaders[c].ext) && (size == loaders[c].size || loaders[c].size == -1))
|
||||
{
|
||||
driveloaders[drive] = c;
|
||||
memcpy(floppyfns[drive], fn, (wcslen(fn) << 1) + 2);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* data in the form of FM/MFM-encoded transitions) which also
|
||||
* forms the core of the emulator's floppy disk emulation.
|
||||
*
|
||||
* Version: @(#)floppy_86f.c 1.0.6 2017/10/09
|
||||
* Version: @(#)floppy_86f.c 1.0.7 2017/10/12
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "../dma.h"
|
||||
#include "../nvr.h"
|
||||
#include "../random.h"
|
||||
#include "../plat.h"
|
||||
#include "../ui.h"
|
||||
#include "floppy.h"
|
||||
#include "fdc.h"
|
||||
@@ -3072,7 +3073,7 @@ void d86f_writeback(int drive)
|
||||
/* The image is compressed. */
|
||||
|
||||
/* Open the original, compressed file. */
|
||||
cf = _wfopen(d86f[drive].original_file_name, L"wb");
|
||||
cf = plat_fopen(d86f[drive].original_file_name, L"wb");
|
||||
|
||||
/* Write the header to the original file. */
|
||||
fwrite(header, 1, header_size, cf);
|
||||
@@ -3364,10 +3365,10 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f_unregister(drive);
|
||||
|
||||
writeprot[drive] = 0;
|
||||
d86f[drive].f = _wfopen(fn, L"rb+");
|
||||
d86f[drive].f = plat_fopen(fn, L"rb+");
|
||||
if (!d86f[drive].f)
|
||||
{
|
||||
d86f[drive].f = _wfopen(fn, L"rb");
|
||||
d86f[drive].f = plat_fopen(fn, L"rb");
|
||||
if (!d86f[drive].f)
|
||||
{
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
@@ -3478,7 +3479,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
fclose(d86f[drive].f);
|
||||
d86f[drive].f = NULL;
|
||||
|
||||
d86f[drive].f = _wfopen(temp_file_name, L"wb");
|
||||
d86f[drive].f = plat_fopen(temp_file_name, L"wb");
|
||||
if (!d86f[drive].f)
|
||||
{
|
||||
d86f_log("86F: Unable to create temporary decompressed file\n");
|
||||
@@ -3486,7 +3487,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
return;
|
||||
}
|
||||
|
||||
tf = _wfopen(fn, L"rb");
|
||||
tf = plat_fopen(fn, L"rb");
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
@@ -3512,12 +3513,12 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
if (!temp)
|
||||
{
|
||||
d86f_log("86F: Error decompressing file\n");
|
||||
_wremove(temp_file_name);
|
||||
plat_remove(temp_file_name);
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
d86f[drive].f = _wfopen(temp_file_name, L"rb+");
|
||||
d86f[drive].f = plat_fopen(temp_file_name, L"rb+");
|
||||
}
|
||||
|
||||
if (d86f[drive].disk_flags & 0x100)
|
||||
@@ -3528,7 +3529,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f[drive].f = NULL;
|
||||
if (d86f[drive].is_compressed)
|
||||
{
|
||||
_wremove(temp_file_name);
|
||||
plat_remove(temp_file_name);
|
||||
}
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
@@ -3542,7 +3543,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f[drive].f = NULL;
|
||||
if (d86f[drive].is_compressed)
|
||||
{
|
||||
_wremove(temp_file_name);
|
||||
plat_remove(temp_file_name);
|
||||
}
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
@@ -3561,11 +3562,11 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
|
||||
if (d86f[drive].is_compressed)
|
||||
{
|
||||
d86f[drive].f = _wfopen(temp_file_name, L"rb");
|
||||
d86f[drive].f = plat_fopen(temp_file_name, L"rb");
|
||||
}
|
||||
else
|
||||
{
|
||||
d86f[drive].f = _wfopen(fn, L"rb");
|
||||
d86f[drive].f = plat_fopen(fn, L"rb");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3675,5 +3676,5 @@ void d86f_close(int drive)
|
||||
d86f[drive].f = NULL;
|
||||
}
|
||||
if (d86f[drive].is_compressed)
|
||||
_wremove(temp_file_name);
|
||||
plat_remove(temp_file_name);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
* Implementation of the FDI floppy stream image format
|
||||
* interface to the FDI2RAW module.
|
||||
*
|
||||
* Version: @(#)floppy_fdi.c 1.0.2 2017/09/24
|
||||
* Version: @(#)floppy_fdi.c 1.0.3 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
@@ -21,6 +22,7 @@
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../plat.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_86f.h"
|
||||
#include "floppy_img.h"
|
||||
@@ -264,7 +266,7 @@ void fdi_load(int drive, wchar_t *fn)
|
||||
char header[26];
|
||||
|
||||
writeprot[drive] = fwriteprot[drive] = 1;
|
||||
fdi[drive].f = _wfopen(fn, L"rb");
|
||||
fdi[drive].f = plat_fopen(fn, L"rb");
|
||||
if (!fdi[drive].f)
|
||||
{
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the IMD floppy image format.
|
||||
*
|
||||
* Version: @(#)floppy_imd.c 1.0.2 2017/09/24
|
||||
* Version: @(#)floppy_imd.c 1.0.3 2017/10/12
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../plat.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_imd.h"
|
||||
#include "fdc.h"
|
||||
@@ -89,10 +90,10 @@ void imd_load(int drive, wchar_t *fn)
|
||||
d86f_unregister(drive);
|
||||
|
||||
writeprot[drive] = 0;
|
||||
imd[drive].f = _wfopen(fn, L"rb+");
|
||||
imd[drive].f = plat_fopen(fn, L"rb+");
|
||||
if (!imd[drive].f)
|
||||
{
|
||||
imd[drive].f = _wfopen(fn, L"rb");
|
||||
imd[drive].f = plat_fopen(fn, L"rb");
|
||||
if (!imd[drive].f)
|
||||
{
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
* Implementation of the raw sector-based floppy image format,
|
||||
* as well as the Japanese FDI, CopyQM, and FDF formats.
|
||||
*
|
||||
* Version: @(#)floppy_img.c 1.0.2 2017/09/24
|
||||
* Version: @(#)floppy_img.c 1.0.3 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
@@ -23,6 +24,7 @@
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../config.h"
|
||||
#include "../plat.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_img.h"
|
||||
#include "fdc.h"
|
||||
@@ -349,10 +351,10 @@ void img_load(int drive, wchar_t *fn)
|
||||
d86f_unregister(drive);
|
||||
|
||||
writeprot[drive] = 0;
|
||||
img[drive].f = _wfopen(fn, L"rb+");
|
||||
img[drive].f = plat_fopen(fn, L"rb+");
|
||||
if (!img[drive].f)
|
||||
{
|
||||
img[drive].f = _wfopen(fn, L"rb");
|
||||
img[drive].f = plat_fopen(fn, L"rb");
|
||||
if (!img[drive].f)
|
||||
{
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
@@ -370,7 +372,7 @@ void img_load(int drive, wchar_t *fn)
|
||||
|
||||
img[drive].interleave = img[drive].skew = 0;
|
||||
|
||||
if (_wcsicmp(ext, L"FDI") == 0)
|
||||
if (! wcscasecmp(ext, L"FDI"))
|
||||
{
|
||||
/* This is a Japanese FDI image, so let's read the header */
|
||||
pclog("img_load(): File is a Japanese FDI image...\n");
|
||||
@@ -415,7 +417,7 @@ void img_load(int drive, wchar_t *fn)
|
||||
pclog("img_load(): File is a FDF image...\n");
|
||||
fwriteprot[drive] = writeprot[drive] = 1;
|
||||
fclose(img[drive].f);
|
||||
img[drive].f = _wfopen(fn, L"rb");
|
||||
img[drive].f = plat_fopen(fn, L"rb");
|
||||
|
||||
fdf = 1;
|
||||
|
||||
@@ -600,7 +602,7 @@ void img_load(int drive, wchar_t *fn)
|
||||
pclog("img_load(): File is a CopyQM image...\n");
|
||||
fwriteprot[drive] = writeprot[drive] = 1;
|
||||
fclose(img[drive].f);
|
||||
img[drive].f = _wfopen(fn, L"rb");
|
||||
img[drive].f = plat_fopen(fn, L"rb");
|
||||
|
||||
fseek(img[drive].f, 0x03, SEEK_SET);
|
||||
fread(&bpb_bps, 1, 2, img[drive].f);
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
*
|
||||
* Implementation of the PCjs JSON floppy image format.
|
||||
*
|
||||
* Version: @(#)floppy_json.c 1.0.4 2017/10/07
|
||||
* Version: @(#)floppy_json.c 1.0.6 2017/10/12
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
@@ -19,6 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../plat.h"
|
||||
#include "floppy.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
@@ -476,7 +478,7 @@ json_load(int drive, wchar_t *fn)
|
||||
memset(img, 0x00, sizeof(json_t));
|
||||
|
||||
/* Open the image file. */
|
||||
img->f = _wfopen(fn, L"rb");
|
||||
img->f = plat_fopen(fn, L"rb");
|
||||
if (img->f == NULL) {
|
||||
memset(fn, 0x00, sizeof(wchar_t));
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Teledisk floppy image format.
|
||||
*
|
||||
* Version: @(#)floppy_td0.c 1.0.3 2017/09/24
|
||||
* Version: @(#)floppy_td0.c 1.0.4 2017/10/12
|
||||
*
|
||||
* Authors: Milodrag Milanovic,
|
||||
* Haruhiko OKUMURA,
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../plat.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_td0.h"
|
||||
#include "fdc.h"
|
||||
@@ -533,7 +534,7 @@ void td0_load(int drive, wchar_t *fn)
|
||||
d86f_unregister(drive);
|
||||
|
||||
writeprot[drive] = 1;
|
||||
td0[drive].f = _wfopen(fn, L"rb");
|
||||
td0[drive].f = plat_fopen(fn, L"rb");
|
||||
if (!td0[drive].f)
|
||||
{
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
*
|
||||
* Implementation of the Intel 2 Mbit 8-bit flash devices.
|
||||
*
|
||||
* Version: @(#)intel_flash.c 1.0.5 2017/10/04
|
||||
* Version: @(#)intel_flash.c 1.0.7 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
@@ -26,6 +27,8 @@
|
||||
#include "mem.h"
|
||||
#include "machine/machine.h"
|
||||
#include "nvr.h"
|
||||
#include "plat.h"
|
||||
|
||||
|
||||
#define FLASH_IS_BXB 2
|
||||
#define FLASH_INVERT 1
|
||||
@@ -178,7 +181,7 @@ static void intel_flash_add_mappings_inverted(flash_t *flash)
|
||||
void *intel_flash_init(uint8_t type)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
int i, l;
|
||||
flash_t *flash;
|
||||
wchar_t *machine_name;
|
||||
wchar_t *flash_name;
|
||||
@@ -186,10 +189,12 @@ void *intel_flash_init(uint8_t type)
|
||||
flash = malloc(sizeof(flash_t));
|
||||
memset(flash, 0, sizeof(flash_t));
|
||||
|
||||
machine_name = (wchar_t *) malloc((strlen(machine_get_internal_name_ex(machine)) << 1) + 2);
|
||||
mbstowcs(machine_name, machine_get_internal_name_ex(machine), strlen(machine_get_internal_name_ex(machine)) + 1);
|
||||
flash_name = (wchar_t *) malloc((wcslen(machine_name) << 1) + 2 + 8);
|
||||
_swprintf(flash_name, L"%s.bin", machine_name);
|
||||
l = strlen(machine_get_internal_name_ex(machine)) + 1;
|
||||
machine_name = (wchar_t *) malloc(l << 1);
|
||||
mbstowcs(machine_name, machine_get_internal_name_ex(machine), l);
|
||||
l = wcslen(machine_name) + 5;
|
||||
flash_name = (wchar_t *) malloc(l << 1);
|
||||
swprintf(flash_name, l, L"%s.bin", machine_name);
|
||||
|
||||
wcscpy(flash_path, flash_name);
|
||||
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
#include "../plat.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
} event_pthread_t;
|
||||
|
||||
|
||||
thread_t *
|
||||
thread_create(void (*thread_rout)(void *param), void *param)
|
||||
{
|
||||
pthread_t *thread = malloc(sizeof(pthread_t));
|
||||
|
||||
if (thread != NULL)
|
||||
pthread_create(thread, NULL, thread_rout, param);
|
||||
|
||||
return(thread);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
thread_kill(thread_t *handle)
|
||||
{
|
||||
pthread_t *thread = (pthread_t *)handle;
|
||||
|
||||
if (thread != NULL) {
|
||||
pthread_cancel(*thread);
|
||||
pthread_join(*thread, NULL);
|
||||
|
||||
free(thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
event_t *
|
||||
thread_create_event(void)
|
||||
{
|
||||
event_pthread_t *event = malloc(sizeof(event_pthread_t));
|
||||
|
||||
if (event != NULL) {
|
||||
pthread_cond_init(&event->cond, NULL);
|
||||
pthread_mutex_init(&event->mutex, NULL);
|
||||
}
|
||||
|
||||
return((event_t *)event);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
thread_set_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
if (event != NULL) {
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_broadcast(&event->cond);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
thread_reset_event(event_t *handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
thread_wait_event(event_t *handle, int timeout)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
struct timespec abstime;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||
abstime.tv_nsec += (timeout % 1000) * 1000000;
|
||||
abstime.tv_sec += (timeout / 1000);
|
||||
if (abstime.tv_nsec > 1000000000) {
|
||||
abstime.tv_nsec -= 1000000000;
|
||||
abstime.tv_sec++;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_timedwait(&event->cond, &event->mutex, &abstime);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
thread_destroy_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
if (event != NULL) {
|
||||
pthread_cond_destroy(&event->cond);
|
||||
pthread_mutex_destroy(&event->mutex);
|
||||
|
||||
free(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
thread_sleep(int t)
|
||||
{
|
||||
usleep(t * 1000);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
#ifndef PLAT_THREAD_H
|
||||
# define PLAT_THREAD_H
|
||||
|
||||
|
||||
typedef void thread_t;
|
||||
typedef void event_t;
|
||||
|
||||
|
||||
extern thread_t *thread_create(void (*thread_rout)(void *param), void *param);
|
||||
extern void thread_kill(thread_t *handle);
|
||||
|
||||
extern event_t *thread_create_event(void);
|
||||
extern void thread_set_event(event_t *event);
|
||||
extern void thread_reset_event(event_t *_event);
|
||||
extern int thread_wait_event(event_t *event, int timeout);
|
||||
extern void thread_destroy_event(event_t *_event);
|
||||
|
||||
extern void thread_sleep(int t);
|
||||
|
||||
|
||||
#endif /*PLAT_THREAD_H*/
|
||||
@@ -55,7 +55,8 @@ int writelookup[256],writelookupp[256];
|
||||
uintptr_t *writelookup2;
|
||||
int writelnext;
|
||||
|
||||
int shadowbios,shadowbios_write;
|
||||
int shadowbios = 0,
|
||||
shadowbios_write;
|
||||
|
||||
int mem_a20_state;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle WinPcap library processing.
|
||||
*
|
||||
* Version: @(#)net_pcap.c 1.0.8 2017/10/10
|
||||
* Version: @(#)net_pcap.c 1.0.9 2017/10/11
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle SLiRP library processing.
|
||||
*
|
||||
* Version: @(#)net_slirp.c 1.0.7 2017/10/10
|
||||
* Version: @(#)net_slirp.c 1.0.8 2017/10/11
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
* terms and conditions of the copyright.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include "slirp.h"
|
||||
|
||||
FILE *dfd = NULL;
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
#define WANT_SYS_IOCTL_H
|
||||
#include <stdlib.h>
|
||||
#ifndef WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include "slirp.h"
|
||||
|
||||
u_int curtime, time_fasttimo, last_slowtimo, detach_time;
|
||||
|
||||
@@ -59,6 +59,12 @@ typedef unsigned long ioctlsockopt_t;
|
||||
# define init_udp slirp_init_udp
|
||||
# define final_udp slirp_final_udp
|
||||
#else
|
||||
# include <inttypes.h>
|
||||
typedef uint8_t u_int8_t;
|
||||
typedef uint16_t u_int16_t;
|
||||
typedef uint32_t u_int32_t;
|
||||
typedef uint64_t u_int64_t;
|
||||
typedef char *SLIRPcaddr_t;
|
||||
typedef int ioctlsockopt_t;
|
||||
# define ioctlsocket ioctl
|
||||
# define closesocket(s) close(s)
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
#define WANT_SYS_IOCTL_H
|
||||
#include <stdlib.h>
|
||||
#ifndef WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include "slirp.h"
|
||||
#include "ip_icmp.h"
|
||||
#include "main.h"
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
|
||||
#define WANT_SYS_IOCTL_H
|
||||
#include <stdlib.h>
|
||||
#ifndef WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include "slirp.h"
|
||||
|
||||
/* patchable/settable parameters for tcp */
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifndef WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include "slirp.h"
|
||||
#include "ip_icmp.h"
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
* (DS12887A) which implemented a "century" register to be
|
||||
* compatible with Y2K.
|
||||
*
|
||||
* Version: @(#)nvr.c 1.0.6 2017/10/09
|
||||
* Version: @(#)nvr.c 1.0.7 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -681,7 +681,7 @@ nvr_load(void)
|
||||
f = NULL;
|
||||
if (saved_nvr->mask != 0) {
|
||||
pclog("Opening NVR file: %ws...\n", saved_nvr->fname);
|
||||
f = _wfopen(nvr_path(saved_nvr->fname), L"rb");
|
||||
f = plat_fopen(nvr_path(saved_nvr->fname), L"rb");
|
||||
}
|
||||
|
||||
if (f != NULL) {
|
||||
@@ -724,7 +724,7 @@ nvr_save(void)
|
||||
f = NULL;
|
||||
if (saved_nvr->mask != 0) {
|
||||
pclog("Saving NVR file: %ws...\n", saved_nvr->fname);
|
||||
f = _wfopen(nvr_path(saved_nvr->fname), L"wb");
|
||||
f = plat_fopen(nvr_path(saved_nvr->fname), L"wb");
|
||||
}
|
||||
|
||||
if (f != NULL) {
|
||||
@@ -775,5 +775,5 @@ nvr_path(wchar_t *str)
|
||||
FILE *
|
||||
nvr_fopen(wchar_t *str, wchar_t *mode)
|
||||
{
|
||||
return(_wfopen(nvr_path(str), mode));
|
||||
return(plat_fopen(nvr_path(str), mode));
|
||||
}
|
||||
|
||||
11
src/pc.c
11
src/pc.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation core dispatcher.
|
||||
*
|
||||
* Version: @(#)pc.c 1.0.23 2017/10/11
|
||||
* Version: @(#)pc.c 1.0.24 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -212,12 +212,12 @@ pc_init(int argc, wchar_t *argv[])
|
||||
* a shortcut (desktop icon), however, the CWD
|
||||
* could have been set to something else.
|
||||
*/
|
||||
_wgetcwd(cfg_path, sizeof(cfg_path)-1);
|
||||
plat_getcwd(cfg_path, sizeof(cfg_path)-1);
|
||||
|
||||
for (c=1; c<argc; c++) {
|
||||
if (argv[c][0] != L'-') break;
|
||||
|
||||
if (!_wcsicmp(argv[c], L"--help") || !_wcsicmp(argv[c], L"-?")) {
|
||||
if (!wcscasecmp(argv[c], L"--help") || !wcscasecmp(argv[c], L"-?")) {
|
||||
usage:
|
||||
printf("\nUsage: 86box [options] [cfg-file]\n\n");
|
||||
printf("Valid options are:\n\n");
|
||||
@@ -770,9 +770,8 @@ pc_run(void)
|
||||
mbstowcs(wmachine, machine_getname(), strlen(machine_getname())+1);
|
||||
mbstowcs(wcpu, machines[machine].cpu[cpu_manufacturer].cpus[cpu].name,
|
||||
strlen(machines[machine].cpu[cpu_manufacturer].cpus[cpu].name)+1);
|
||||
_swprintf(s, L"%s v%s - %i%% - %s - %s - %s",
|
||||
EMU_NAME_W, EMU_VERSION_W,
|
||||
fps, wmachine, wcpu,
|
||||
swprintf(s, 100, L"%s v%s - %i%% - %s - %s - %s",
|
||||
EMU_NAME_W, EMU_VERSION_W, fps, wmachine, wcpu,
|
||||
(!mousecapture) ? plat_get_string(IDS_2077)
|
||||
: ((mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON) ? plat_get_string(IDS_2078) : plat_get_string(IDS_2079)));
|
||||
set_window_title(s);
|
||||
|
||||
11
src/plat.h
11
src/plat.h
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Define the various platform support functions.
|
||||
*
|
||||
* Version: @(#)plat.h 1.0.4 2017/10/10
|
||||
* Version: @(#)plat.h 1.0.5 2017/10/12
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -28,12 +28,20 @@ extern "C" {
|
||||
|
||||
|
||||
/* System-related functions. */
|
||||
extern FILE *plat_fopen(wchar_t *path, wchar_t *mode);
|
||||
extern void plat_remove(wchar_t *path);
|
||||
extern int plat_getcwd(wchar_t *bufp, int max);
|
||||
extern int plat_chdir(wchar_t *path);
|
||||
extern void get_executable_name(wchar_t *s, int size);
|
||||
extern void set_window_title(wchar_t *s);
|
||||
extern int dir_check_exist(wchar_t *path);
|
||||
extern int dir_create(wchar_t *path);
|
||||
extern void leave_fullscreen(void);
|
||||
|
||||
#ifdef WIN32
|
||||
# define wcscasecmp _wcsicmp
|
||||
#endif
|
||||
|
||||
|
||||
/* Resource management. */
|
||||
extern wchar_t *plat_get_string(int id);
|
||||
@@ -95,5 +103,4 @@ extern void startslirp(void);
|
||||
extern void endslirp(void);
|
||||
|
||||
|
||||
|
||||
#endif /*EMU_PLAT_H*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* - c386sx16 BIOS fails checksum
|
||||
* - the loadfont() calls should be done elsewhere
|
||||
*
|
||||
* Version: @(#)rom.c 1.0.7 2017/10/10
|
||||
* Version: @(#)rom.c 1.0.9 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "mem.h"
|
||||
#include "rom.h"
|
||||
#include "video/video.h" /* for loadfont() */
|
||||
#include "plat.h"
|
||||
|
||||
|
||||
int romspresent[ROM_MAX];
|
||||
@@ -47,7 +48,7 @@ rom_fopen(wchar_t *fn, wchar_t *mode)
|
||||
put_backslash_w(temp);
|
||||
wcscat(temp, fn);
|
||||
|
||||
return(_wfopen(temp, mode));
|
||||
return(plat_fopen(temp, mode));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +61,7 @@ rom_getfile(wchar_t *fn, wchar_t *s, int size)
|
||||
put_backslash_w(s);
|
||||
wcscat(s, fn);
|
||||
|
||||
f = _wfopen(s, L"rb");
|
||||
f = plat_fopen(s, L"rb");
|
||||
if (f != NULL) {
|
||||
(void)fclose(f);
|
||||
return(1);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Emulation of SCSI fixed and removable disks.
|
||||
*
|
||||
* Version: @(#)scsi_disk.c 1.0.13 2017/10/10
|
||||
* Version: @(#)scsi_disk.c 1.0.14 2017/10/12
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2017 Miran Grca.
|
||||
@@ -698,8 +698,8 @@ void scsi_hd_mode_sense_load(uint8_t id)
|
||||
FILE *f;
|
||||
wchar_t temp[512];
|
||||
memset(temp, 0, 1024);
|
||||
_swprintf(temp, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
f = _wfopen(nvr_path(temp), L"rb");
|
||||
swprintf(temp, 512, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
f = plat_fopen(nvr_path(temp), L"rb");
|
||||
if (!f)
|
||||
{
|
||||
return;
|
||||
@@ -713,8 +713,8 @@ void scsi_hd_mode_sense_save(uint8_t id)
|
||||
FILE *f;
|
||||
wchar_t temp[512];
|
||||
memset(temp, 0, 1024);
|
||||
_swprintf(temp, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
f = _wfopen(nvr_path(temp), L"wb");
|
||||
swprintf(temp, 512, L"scsi_hd_%02i_mode_sense.bin", id);
|
||||
f = plat_fopen(nvr_path(temp), L"wb");
|
||||
if (!f)
|
||||
{
|
||||
return;
|
||||
|
||||
2
src/ui.h
2
src/ui.h
@@ -28,7 +28,7 @@ extern "C" {
|
||||
#ifdef WIN32
|
||||
# include "win/resource.h"
|
||||
#else
|
||||
# ... dunno yet ...
|
||||
# include "lnx/strings.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of the 3DFX Voodoo Graphics controller.
|
||||
*
|
||||
* Version: @(#)vid_voodoo.c 1.0.1 2017/10/10
|
||||
* Version: @(#)vid_voodoo.c 1.0.2 2017/10/11
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <wchar.h>
|
||||
#include <math.h>
|
||||
#include "../ibm.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* The Emulator's Windows core.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.20 2017/10/10
|
||||
* Version: @(#)win.c 1.0.21 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -1335,6 +1335,36 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil)
|
||||
}
|
||||
|
||||
|
||||
FILE *
|
||||
plat_fopen(wchar_t *path, wchar_t *mode)
|
||||
{
|
||||
return(_wfopen(path, mode));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
plat_remove(wchar_t *path)
|
||||
{
|
||||
_wremove(path);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
plat_getcwd(wchar_t *bufp, int max)
|
||||
{
|
||||
(void)_wgetcwd(bufp, max);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
plat_chdir(wchar_t *path)
|
||||
{
|
||||
return(_wchdir(path));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_executable_name(wchar_t *s, int size)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Try to load a support DLL.
|
||||
*
|
||||
* Version: @(#)win_dynld.c 1.0.4 2017/10/10
|
||||
* Version: @(#)win_dynld.c 1.0.5 2017/10/11
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <pcap.h>
|
||||
#include <windows.h>
|
||||
#include "../ibm.h"
|
||||
#include "../plat_dynld.h"
|
||||
@@ -31,7 +30,6 @@ dynld_module(const char *name, dllimp_t *table)
|
||||
HMODULE h;
|
||||
dllimp_t *imp;
|
||||
void *func;
|
||||
/* char **foo; */
|
||||
|
||||
/* See if we can load the desired module. */
|
||||
if ((h = LoadLibrary(name)) == NULL) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Joystick interface to host device.
|
||||
*
|
||||
* Version: @(#)win_joystick.cc 1.0.3 2017/10/10
|
||||
* Version: @(#)win_joystick.cc 1.0.4 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -19,6 +19,7 @@
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
extern "C" {
|
||||
#include "../device.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Mouse interface to host device.
|
||||
*
|
||||
* Version: @(#)win_mouse.cc 1.0.3 2017/10/10
|
||||
* Version: @(#)win_mouse.cc 1.0.4 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "../plat.h"
|
||||
#include "../plat_mouse.h"
|
||||
|
||||
Reference in New Issue
Block a user