First phase of cleaning up the use of pathnames internally. We now have the --vmpath (short: -P) commandline option to override the 'work dir' relative to which the program will try to find certain files and folders.

This commit is contained in:
waltje
2017-09-23 21:12:26 -04:00
parent 35c25cab74
commit 637ce66da2
25 changed files with 1086 additions and 894 deletions

View File

@@ -8,7 +8,7 @@
#
# Modified Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.45 2017/09/12
# Version: @(#)Makefile.mingw 1.0.46 2017/09/19
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -34,6 +34,7 @@ STUFF =
# -DENABLE_CDROM_LOG enables extra logging.
# -DENABLE_D86F_LOG enables extra logging.
# -DENABLE_FDC_LOG enables extra logging.
# -DENABLE_HDD_IMAGE_LOG enables extra logging.
# -DENABLE_IDE_LOG enables extra logging.
# -DENABLE_SERIAL_LOG enables extra logging.
# -DENABLE_NIC_LOG enables extra logging.
@@ -464,8 +465,8 @@ x87.o: ibm.h pic.h cpu/x86.h cpu/x86_flags.h cpu/x86_ops.h cpu/x87.h cpu/386_co
bugger.o: ibm.h io.h bugger.h
cdrom.o: 86box.h cdrom.h ibm.h hdd/hdd_ide_at.h piix.h scsi/scsi.h timer.h \
win/plat_iodev.h
cdrom.o: 86box.h cdrom.h ibm.h hdd/hdd_ide_at.h piix.h scsi/scsi.h \
timer.h nvr.h win/plat_iodev.h
cdrom_dosbox.o: cdrom_dosbox.h
@@ -492,7 +493,7 @@ floppy.o: ibm.h config.h floppy.h floppy_fdi.h fdc.h fdd.h timer.h \
floppy_common.o: ibm.h floppy.h floppy_common.h fdc.h fdd.h
floppy_86f.o: lzf/lzf.h config.h dma.h random.h floppy.h floppy_86f.h \
fdc.h fdd.h ibm.h
fdc.h fdd.h ibm.h nvr.h
floppy_fdi.o: ibm.h floppy.h floppy_img.h floppy_fdi.h fdc.h fdd.h fdi2raw.h \
floppy.h floppy_imd.h fdc.h fdd.h config.h floppy_img.h
@@ -535,7 +536,7 @@ hdd_mfm_xebec.o: ibm.h device.h dma.h hdd/hdd_image.h io.h mem.h pic.h rom.h \
intel.o: ibm.h cpu/cpu.h io.h mem.h pit.h timer.h intel.h
intel_flash.o: ibm.h cpu/cpu.h device.h mem.h machine/machine.h rom.h
intel_flash.o: ibm.h cpu/cpu.h device.h mem.h machine/machine.h nvr.h
intel_sio.o: ibm.h dma.h mem.h pci.h intel_sio.h
@@ -629,7 +630,7 @@ machine_at_wd76c10.o: ibm.h floppy.h fdc.h io.h mem.h serial.h machine/machine_
machine_common.o: ibm.h dma.h floppy.h fdd.h fdc.h lpt.h pic.h pit.h serial.h machine/machine_common.h
machine_europc.o: ibm.h cpu/cpu.h io.h device.h gameport.h keyboard_xt.h lpt.h mem.h nmi.h rom.h machine/machine_common.h \
machine_europc.o: ibm.h cpu/cpu.h io.h device.h gameport.h keyboard_xt.h lpt.h mem.h nmi.h rom.h nvr.h machine/machine_common.h \
machine/machine_europc.h
europc_hdd.o: ibm.h io.h dma.h pic.h device.h timer.h hdd/hdd_image.h europc.h
@@ -684,10 +685,10 @@ net_slirp.o: network/slirp/slirp.h network/slirp/queue.h ibm.h config.h device.h
net_ne2000.o: ibm.h io.h mem.h rom.h pci.h pic.h device.h config.h random.h network/network.h network/net_ne2000.h network/bswap.h
nvr.o: ibm.h cpu/cpu.h device.h io.h mem.h machine/machine.h \
nvr.o: ibm.h cpu/cpu.h device.h io.h mem.h nvr.h machine/machine.h \
machine/machine_europc.h nvr.h pic.h rom.h timer.h rtc.h
nvr_ps2.o: ibm.h device.h io.h mem.h rom.h nvr_ps2.h
nvr_ps2.o: ibm.h device.h io.h mem.h nvr.h nvr_ps2.h
pc.o: 86box.h config.h random.h ibm.h mem.h \
cpu/cpu.h cpu/x86_ops.h cpu/codegen.h \
@@ -770,7 +771,7 @@ snd_ad1848.o: ibm.h dma.h pic.h timer.h sound/sound.h sound/snd_ad1848.h
snd_adlib.o: ibm.h io.h mca.h device.h sound/sound.h sound/snd_adlib.h sound/snd_opl.h
snd_adlibgold.o: ibm.h io.h dma.h pic.h pit.h mem.h rom.h timer.h device.h sound/sound.h sound/filters.h sound/snd_opl.h sound/snd_ym7128.h
snd_adlibgold.o: ibm.h io.h dma.h pic.h pit.h mem.h rom.h nvr.h timer.h device.h sound/sound.h sound/filters.h sound/snd_opl.h sound/snd_ym7128.h
snd_cms.o: ibm.h io.h device.h sound/sound.h sound/snd_cms.h
@@ -815,7 +816,7 @@ snd_ym7128.o: ibm.h sound/snd_ym7128.h
sound.o: ibm.h device.h timer.h cdrom.h win/plat_thread.h sound/midi.h sound/sound.h sound/snd_opl.h sound/snd_adlib.h \
sound/snd_pas16.h sound/snd_sb.h sound/snd_sb_dsp.h sound/snd_wss.h sound/filters.h
tandy_eeprom.o: ibm.h device.h mem.h io.h rom.h tandy_eeprom.h
tandy_eeprom.o: ibm.h device.h mem.h io.h nvr.h tandy_eeprom.h
tandy_rom.o: ibm.h device.h io.h mem.h rom.h tandy_rom.h
@@ -823,7 +824,7 @@ timer.o: ibm.h timer.h
usb.o: ibm.h io.h mem.h usb.h
vid_ati_eeprom.o: ibm.h mem.h rom.h video/vid_ati_eeprom.h
vid_ati_eeprom.o: ibm.h mem.h nvr.h video/vid_ati_eeprom.h
vid_ati_mach64.o: ibm.h device.h io.h mem.h pci.h rom.h win/plat_thread.h video/video.h video/vid_svga.h video/vid_svga_render.h \
video/vid_ati68860_ramdac.h video/vid_ati_eeprom.h video/vid_ics2595.h
@@ -904,7 +905,7 @@ vid_sdac_ramdac.o: ibm.h mem.h video/video.h video/vid_svga.h video/vid_sdac_ram
vid_stg_ramdac.o: ibm.h mem.h video/video.h video/vid_svga.h video/vid_stg_ramdac.h
vid_svga.o: ibm.h io.h mem.h rom.h timer.h video/video.h video/vid_svga.h video/vid_svga_render.h
vid_svga.o: ibm.h io.h mem.h nvr.h timer.h video/video.h video/vid_svga.h video/vid_svga_render.h
vid_svga_render.o: ibm.h mem.h video/video.h video/vid_svga.h video/vid_svga_render.h

View File

@@ -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.4 2017/09/03
* Version: @(#)cdrom.c 1.0.5 2017/09/19
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016,2017 Miran Grca.
@@ -24,6 +24,7 @@
#include "../piix.h"
#include "../scsi/scsi.h"
#include "../timer.h"
#include "../nvr.h"
#include "../hdd/hdd_ide_at.h"
#include "../win/plat_iodev.h"
#include "cdrom.h"

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
*
* Configuration file handler header.
*
* Version: @(#)config.h 1.0.1 2017/08/23
* Version: @(#)config.h 1.0.2 2017/09/19
*
* Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com>
@@ -29,13 +29,18 @@ extern wchar_t config_file_default[256];
extern "C" {
#endif
extern void config_load(wchar_t *fn);
extern void config_save(void);
extern void config_write(wchar_t *fn);
extern void config_dump(void);
extern void config_delete_var(char *head, char *name);
extern int config_get_int(char *head, char *name, int def);
extern int config_get_hex16(char *head, char *name, int def);
extern int config_get_hex20(char *head, char *name, int def);
extern int config_get_mac(char *head, char *name, int def);
extern char *config_get_string(char *head, char *name, char *def);
extern wchar_t *config_get_wstring(char *head, char *name, wchar_t *def);
extern void config_delete_var(char *head, char *name);
extern void config_set_int(char *head, char *name, int val);
extern void config_set_hex16(char *head, char *name, int val);
extern void config_set_hex20(char *head, char *name, int val);
@@ -50,15 +55,8 @@ extern void append_filename_w(wchar_t *dest, wchar_t *s1, wchar_t *s2, int size)
extern void put_backslash(char *s);
extern void put_backslash_w(wchar_t *s);
extern char *get_extension(char *s);
extern wchar_t *get_extension_w(wchar_t *s);
extern int config_load(wchar_t *fn);
extern void config_save(wchar_t *fn);
extern void config_dump(void);
extern void loadconfig(wchar_t *fn);
extern void saveconfig(void);
#ifdef __cplusplus
}

View File

@@ -8,12 +8,12 @@
*
* 808x CPU emulation.
*
* Version: @(#)808x.c 1.0.0 2017/05/30
* Version: @(#)808x.c 1.0.1 2017/09/19
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2016,2017 Miran Grca.
*/
/*SHR AX,1
@@ -503,7 +503,7 @@ void dumpregs(int force)
#ifndef RELEASE_BUILD
indump = 1;
output=0;
_wchdir(pcempath);
_wchdir(cfg_path);
nopageerrors=1;
f=fopen("ram.dmp","wb");
fwrite(ram,mem_size*1024,1,f);

View File

@@ -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.2 2017/09/03
* Version: @(#)floppy_86f.c 1.0.3 2017/09/19
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016,2017 Miran Grca.
@@ -26,6 +26,7 @@
#include "../ibm.h"
#include "../config.h"
#include "../dma.h"
#include "../nvr.h"
#include "../random.h"
#include "floppy.h"
#include "fdc.h"

View File

@@ -8,7 +8,7 @@
*
* General include file.
*
* Version: @(#)ibm.h 1.0.3 2017/09/03
* Version: @(#)ibm.h 1.0.4 2017/09/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -585,7 +585,9 @@ extern int gated,speakval,speakon;
#define SND_WSS 9 /*Windows Sound System*/
#define SND_PAS16 10 /*Pro Audio Spectrum 16*/
extern wchar_t pcempath[512];
extern wchar_t exe_path[1024];
extern wchar_t cfg_path[1024];
extern wchar_t nvr_path[1024];
/*Hard disk*/
@@ -704,10 +706,6 @@ extern uint64_t star;
#define FPU_CW_Reserved_Bits (0xe0c0)
extern wchar_t nvr_path[1024];
extern int path_len;
wchar_t *nvr_concat(wchar_t *to_concat);
extern int mem_a20_state;
@@ -781,7 +779,6 @@ extern void resetpchard(void);
extern void resetreadlookup(void);
extern void resetx86(void);
extern void runpc(void);
extern void saveconfig(void);
extern void softresetx86(void);
extern void speedchanged(void);
extern void x86_int_sw(int num);

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Intel 2 Mbit 8-bit flash devices.
*
* Version: @(#)intel_flash.c 1.0.1 2017/08/23
* Version: @(#)intel_flash.c 1.0.2 2017/09/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -22,7 +22,7 @@
#include "device.h"
#include "mem.h"
#include "machine/machine.h"
#include "rom.h"
#include "nvr.h"
#define FLASH_IS_BXB 2
#define FLASH_INVERT 1

View File

@@ -8,7 +8,7 @@
*
* CMOS NVRAM emulation.
*
* Version: @(#)nvr.c 1.0.2 2017/09/03
* Version: @(#)nvr.c 1.0.3 2017/09/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -22,6 +22,7 @@
#include <string.h>
#include <wchar.h>
#include "ibm.h"
#include "config.h"
#include "cpu/cpu.h"
#include "device.h"
#include "io.h"
@@ -34,6 +35,7 @@
#include "rom.h"
#include "timer.h"
#include "rtc.h"
#include "win/win.h"
int oldmachine;
@@ -317,7 +319,9 @@ void savenvr(void)
free(machine_name);
}
void nvr_init(void)
void
nvr_init(void)
{
io_sethandler(0x0070, 0x0002, readnvr, NULL, NULL, writenvr, NULL, NULL, NULL);
timer_add(nvr_rtc, &rtctime, TIMER_ALWAYS_ENABLED, NULL);
@@ -325,3 +329,52 @@ void nvr_init(void)
timer_add(nvr_update_end, &nvr_update_end_count, &nvr_update_end_count, NULL);
}
wchar_t *
nvr_concat(wchar_t *str)
{
static wchar_t temp[1024];
wchar_t last;
/* Get the full prefix in place. */
memset(temp, 0x00, sizeof(temp));
append_filename_w(temp, cfg_path, nvr_path, sizeof(temp)-1);
/* Make sure we have a trailing backslash. */
if (temp[wcslen(temp) - 1] != L'/') {
if (temp[wcslen(temp) - 1] != L'\\') {
temp[wcslen(temp)] = L'\\';
temp[wcslen(temp) + 1] = L'\0';
}
}
#ifndef __unix
/* Save the backslash and zap it. */
last = temp[wcslen(temp) - 1];
temp[wcslen(temp) - 1] = 0;
/* Create the directory if needed. */
if (! DirectoryExists(temp))
CreateDirectory(temp, NULL);
/* Restore the backslash. */
temp[wcslen(temp)] = last;
#endif
/* Now append the actual filename. */
wcscat(temp, str);
return(temp);
}
FILE *
nvrfopen(wchar_t *fn, wchar_t *mode)
{
wchar_t *p;
p = nvr_concat(fn);
return(_wfopen(p, mode));
}

View File

@@ -8,7 +8,7 @@
*
* CMOS NVRAM emulation.
*
* Version: @(#)nvr.h 1.0.1 2017/06/03
* Version: @(#)nvr.h 1.0.2 2017/06/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -25,11 +25,13 @@ extern int enable_sync;
extern int nvr_dosave;
extern void nvr_init(void);
extern void time_get(char *nvrram);
extern void nvr_recalc(void);
extern void loadnvr(void);
extern void savenvr(void);
extern wchar_t *nvr_concat(wchar_t *to_concat);
extern void nvr_init(void);
extern FILE *nvrfopen(wchar_t *fn, wchar_t *mode);
extern void time_get(char *nvrram);
extern void nvr_recalc(void);
extern void loadnvr(void);
extern void savenvr(void);
#endif /*EMU_NVR_H*/

View File

@@ -3,7 +3,7 @@
#include "device.h"
#include "io.h"
#include "mem.h"
#include "rom.h"
#include "nvr.h"
#include "nvr_ps2.h"

101
src/pc.c
View File

@@ -8,7 +8,7 @@
*
* Emulation core dispatcher.
*
* Version: @(#)pc.c 1.0.8 2017/09/03
* Version: @(#)pc.c 1.0.10 2017/09/22
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <direct.h>
#include "86box.h"
#include "config.h"
#include "ibm.h"
@@ -81,9 +82,9 @@
#include "cpu/x86_ops.h"
wchar_t pcempath[512];
wchar_t nvr_path[1024];
wchar_t exe_path[1024];
wchar_t cfg_path[1024];
wchar_t nvr_path[1024];
int path_len;
int window_w, window_h, window_x, window_y, window_remember;
@@ -108,7 +109,6 @@ int framecount,fps;
int output;
int atfullspeed;
void saveconfig();
int infocus;
int mousecapture;
@@ -181,7 +181,7 @@ void fatal(const char *format, ...)
va_end(ap);
fflush(stdout);
savenvr();
saveconfig();
config_save();
#ifndef __unix
newline = memmem(msg, strlen(msg), "\n", strlen("\n"));
if (newline != NULL)
@@ -286,41 +286,56 @@ void pc_reset(void)
#undef printf
void initpc(int argc, wchar_t *argv[])
{
wchar_t *p;
wchar_t *config_file = NULL;
int c;
get_executable_name(pcempath, 511);
pclog("executable_name = %S\n", pcempath);
p=get_filename_w(pcempath);
*p=L'\0';
pclog("path = %S\n", pcempath);
wchar_t *p;
#ifdef WALTJE
DIR *dir;
struct direct *dp;
DIR *dir;
#endif
int c;
/* Grab the executable's full path. */
get_executable_name(exe_path, sizeof(exe_path)-1);
p = get_filename_w(exe_path);
*p = L'\0';
pclog("exe_path=%S\n", exe_path);
/*
* Get the current working directory.
* This is normally the directory from where the
* program was run. If we have been started via
* a shortcut (desktop icon), however, the CWD
* could have been set to something else.
*/
_wgetcwd(cfg_path, sizeof(cfg_path)-1);
for (c = 1; c < argc; c++)
{
if (!_wcsicmp(argv[c], L"--help"))
{
usage:
printf("Command line options :\n\n");
printf("--config file.cfg - use given config file as initial configuration\n");
printf("--dump - always dump memory on exit\n");
printf("--fullscreen - start in fullscreen mode\n");
printf("--vmpath pathname - set 'path' to be root for vm\n");
exit(-1);
}
else if (!_wcsicmp(argv[c], L"--config"))
else if (!_wcsicmp(argv[c], L"--config") ||
!_wcsicmp(argv[c], L"-C"))
{
if ((c+1) == argc)
break;
config_file = argv[c+1];
c++;
}
else if (!_wcsicmp(argv[c], L"--dump"))
else if (!_wcsicmp(argv[c], L"--dump") ||
!_wcsicmp(argv[c], L"-D"))
{
dump_on_exit = 1;
}
else if (!_wcsicmp(argv[c], L"--fullscreen"))
else if (!_wcsicmp(argv[c], L"--fullscreen") ||
!_wcsicmp(argv[c], L"-F"))
{
start_in_fullscreen = 1;
}
@@ -328,9 +343,9 @@ void initpc(int argc, wchar_t *argv[])
{
/* some (undocumented) test function here.. */
#ifdef WALTJE
dir = opendirw(pcempath);
dir = opendirw(exe_path);
if (dir != NULL) {
printf("Directory '%S':\n", pcempath);
printf("Directory '%S':\n", exe_path);
for (;;) {
dp = readdir(dir);
if (dp == NULL) break;
@@ -338,26 +353,56 @@ void initpc(int argc, wchar_t *argv[])
}
closedir(dir);
} else {
printf("Could not open '%S'..\n", pcempath);
printf("Could not open '%S'..\n", exe_path);
}
#endif
/* .. and then exit. */
exit(0);
}
else if (!_wcsicmp(argv[c], L"--vmpath") ||
!_wcsicmp(argv[c], L"-P"))
{
if ((c+1) == argc)
break;
wcscpy(cfg_path, argv[c+1]);
c++;
}
/* Uhm... out of options here.. */
else goto usage;
}
if (config_file == NULL)
{
append_filename_w(config_file_default, pcempath, CONFIG_FILE_W, 511);
/* Make sure cfg_path has a trailing backslash. */
if ((cfg_path[wcslen(cfg_path)-1] != L'\\') &&
(cfg_path[wcslen(cfg_path)-1] != L'/')) {
wcscat(cfg_path, L"\\");
}
else
{
append_filename_w(config_file_default, pcempath, config_file, 511);
pclog("cwd_path=%S\n", cfg_path);
if (config_file != NULL) {
/*
* The user specified a configuration file.
*
* If this is an absolute path, keep it, as
* they probably have a reason to do that.
* Otherwise, assume the pathname given is
* relative to whatever the cfg_path is.
*/
if ((config_file[1] == L':') || /* drive letter present */
(config_file[0] == L'\\')) /* backslash, root dir */
append_filename_w(config_file_default,
NULL, /* empty */
config_file, 511);
else
append_filename_w(config_file_default,
cfg_path,
config_file, 511);
} else {
append_filename_w(config_file_default, cfg_path, CONFIG_FILE_W, 511);
}
loadconfig(config_file);
pclog("Config loaded\n");
config_load(config_file);
}
void initmodules(void)

View File

@@ -11,25 +11,22 @@
FILE *romfopen(wchar_t *fn, wchar_t *mode)
{
wchar_t s[512];
wcscpy(s, pcempath);
wchar_t s[1024];
wcscpy(s, exe_path);
put_backslash_w(s);
wcscat(s, fn);
return _wfopen(s, mode);
}
FILE *nvrfopen(wchar_t *fn, wchar_t *mode)
{
return _wfopen(nvr_concat(fn), mode);
}
int rom_getfile(wchar_t *fn, wchar_t *s, int size)
{
FILE *f;
wcscpy(s, pcempath);
wcscpy(s, exe_path);
put_backslash_w(s);
wcscat(s, fn);
f = _wfopen(s, L"rb");
@@ -46,7 +43,7 @@ int rom_present(wchar_t *fn)
FILE *f;
wchar_t s[512];
wcscpy(s, pcempath);
wcscpy(s, exe_path);
put_backslash_w(s);
wcscat(s, fn);
f = _wfopen(s, L"rb");

View File

@@ -2,7 +2,6 @@
see COPYING for more details
*/
extern FILE *romfopen(wchar_t *fn, wchar_t *mode);
extern FILE *nvrfopen(wchar_t *fn, wchar_t *mode);
extern int rom_getfile(wchar_t *fn, wchar_t *s, int size);
extern int rom_present(wchar_t *fn);

View File

@@ -12,7 +12,7 @@
*
* NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go.
*
* Version: @(#)scsi_aha154x.c 1.0.16 2017/09/05
* Version: @(#)scsi_aha154x.c 1.0.17 2017/09/19
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Original Buslogic version by SA1988 and Miran Grca.
@@ -29,6 +29,7 @@
#include "../mem.h"
#include "../mca.h"
#include "../rom.h"
#include "../nvr.h"
#include "../dma.h"
#include "../pic.h"
#include "../timer.h"

View File

@@ -10,7 +10,7 @@
* 0 - BT-545C ISA;
* 1 - BT-958D PCI (but BT-545C ISA on non-PCI machines)
*
* Version: @(#)scsi_buslogic.c 1.0.12 2017/09/05
* Version: @(#)scsi_buslogic.c 1.0.13 2017/09/19
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -27,6 +27,7 @@
#include "../io.h"
#include "../mem.h"
#include "../rom.h"
#include "../nvr.h"
#include "../dma.h"
#include "../pic.h"
#include "../pci.h"

View File

@@ -7,6 +7,7 @@
#include "../pit.h"
#include "../mem.h"
#include "../rom.h"
#include "../nvr.h"
#include "../timer.h"
#include "../device.h"
#include "sound.h"

View File

@@ -6,7 +6,7 @@
#include "device.h"
#include "mem.h"
#include "io.h"
#include "rom.h"
#include "nvr.h"
#include "tandy_eeprom.h"

View File

@@ -3,7 +3,7 @@
*/
#include "../ibm.h"
#include "../mem.h"
#include "../rom.h"
#include "../nvr.h"
#include "vid_ati_eeprom.h"

View File

@@ -8,22 +8,23 @@
*
* Generic SVGA handling.
*
* Version: @(#)vid_svga.c 1.0.0 2017/05/30
* This is intended to be used by another SVGA driver,
* and not as a card in it's own right.
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Version: @(#)vid_svga.c 1.0.1 2017/09/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2016,2017 Miran Grca.
*/
/*This is intended to be used by another SVGA driver, and not as a card in it's own right*/
#include <stdio.h>
#include <stdlib.h>
#include "../ibm.h"
#include "../io.h"
#include "../mem.h"
#ifdef ENABLE_VRAM_DUMP
#include "../rom.h"
# include "../nvr.h"
#endif
#include "../timer.h"
#include "video.h"

View File

@@ -718,7 +718,7 @@ BOOL DirectoryExists(LPCTSTR szPath)
(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
}
void take_screenshot()
void take_screenshot(void)
{
if ((vid_api < 0) || (vid_api > 1)) return;
time(&now);
@@ -727,7 +727,7 @@ void take_screenshot()
memset(screenshot_fn_partial, 0, 4096);
memset(screenshot_path, 0, 8192);
pclog("Video API is: %i\n", vid_api);
append_filename_w(screenshot_path, pcempath, L"screenshots", 4095);
append_filename_w(screenshot_path, cfg_path, L"screenshots", 4095);
if (!DirectoryExists(screenshot_path))
{
CreateDirectory(screenshot_path, NULL);
@@ -735,7 +735,7 @@ void take_screenshot()
if (vid_api == 1)
{
wcsftime(screenshot_fn_partial, 2048, L"screenshots\\%Y%m%d_%H%M%S.png", info);
append_filename_w(screenshot_fn, pcempath, screenshot_fn_partial, 4095);
append_filename_w(screenshot_fn, cfg_path, screenshot_fn_partial, 4095);
if (video_fullscreen)
{
d3d_fs_take_screenshot(screenshot_fn);
@@ -749,7 +749,7 @@ void take_screenshot()
else if (vid_api == 0)
{
wcsftime(screenshot_fn_partial, 2048, L"screenshots\\%Y%m%d_%H%M%S.bmp", info);
append_filename_w(screenshot_fn, pcempath, screenshot_fn_partial, 4095);
append_filename_w(screenshot_fn, cfg_path, screenshot_fn_partial, 4095);
if (video_fullscreen)
{
ddraw_fs_take_screenshot(screenshot_fn);

View File

@@ -8,7 +8,7 @@
*
* The Emulator's Windows core.
*
* Version: @(#)win.c 1.0.8 2017/09/03
* Version: @(#)win.c 1.0.9 2017/09/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -1783,7 +1783,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
{
romset = c;
machine = machine_getmachine(romset);
saveconfig();
config_save();
resetpchard();
break;
}
@@ -1806,7 +1806,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
if (gfx_present[c])
{
gfxcard = c;
saveconfig();
config_save();
resetpchard();
break;
}
@@ -1899,7 +1899,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
Sleep(200);
TerminateThread(mainthreadh,0);
savenvr();
saveconfig();
config_save();
closepc();
vid_apis[video_fullscreen][vid_api].close();
@@ -1996,7 +1996,7 @@ static void win_pc_reset(int hard)
pause=1;
Sleep(100);
savenvr();
saveconfig();
config_save();
if (hard)
{
resetpchard();
@@ -2015,7 +2015,7 @@ void video_toggle_option(HMENU hmenu, int *val, int id)
*val ^= 1;
CheckMenuItem(hmenu, id, *val ? MF_CHECKED : MF_UNCHECKED);
endblit();
saveconfig();
config_save();
device_force_redraw();
}
@@ -2089,7 +2089,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EnableMenuItem(hmenu, IDM_VID_SCALE_3X, vid_resize ? MF_GRAYED : MF_ENABLED);
EnableMenuItem(hmenu, IDM_VID_SCALE_4X, vid_resize ? MF_GRAYED : MF_ENABLED);
win_doresize = 1;
saveconfig();
config_save();
break;
case IDM_VID_REMEMBER:
@@ -2103,7 +2103,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
window_w = rect.right - rect.left;
window_h = rect.bottom - rect.top;
}
saveconfig();
config_save();
break;
case IDM_VID_DDRAW:
@@ -2116,7 +2116,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_VID_DDRAW + vid_api, MF_CHECKED);
vid_apis[0][vid_api].init(hwndRender);
endblit();
saveconfig();
config_save();
device_force_redraw();
cgapal_rebuild();
break;
@@ -2139,7 +2139,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
mouse_init();
leave_fullscreen_flag = 0;
endblit();
saveconfig();
config_save();
device_force_redraw();
cgapal_rebuild();
}
@@ -2152,7 +2152,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_UNCHECKED);
video_fullscreen_scale = LOWORD(wParam) - IDM_VID_FS_FULL;
CheckMenuItem(hmenu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_CHECKED);
saveconfig();
config_save();
device_force_redraw();
break;
@@ -2163,7 +2163,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_VID_SCALE_1X + scale, MF_UNCHECKED);
scale = LOWORD(wParam) - IDM_VID_SCALE_1X;
CheckMenuItem(hmenu, IDM_VID_SCALE_1X + scale, MF_CHECKED);
saveconfig();
config_save();
device_force_redraw();
break;
@@ -2184,7 +2184,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
vid_cga_contrast ^= 1;
CheckMenuItem(hmenu, IDM_VID_CGACON, vid_cga_contrast ? MF_CHECKED : MF_UNCHECKED);
cgapal_rebuild();
saveconfig();
config_save();
break;
case IDM_VID_GRAYCT_601:
@@ -2193,7 +2193,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_VID_GRAYCT_601 + video_graytype, MF_UNCHECKED);
video_graytype = LOWORD(wParam) - IDM_VID_GRAYCT_601;
CheckMenuItem(hmenu, IDM_VID_GRAYCT_601 + video_graytype, MF_CHECKED);
saveconfig();
config_save();
device_force_redraw();
break;
@@ -2205,7 +2205,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_VID_GRAY_RGB + video_grayscale, MF_UNCHECKED);
video_grayscale = LOWORD(wParam) - IDM_VID_GRAY_RGB;
CheckMenuItem(hmenu, IDM_VID_GRAY_RGB + video_grayscale, MF_CHECKED);
saveconfig();
config_save();
device_force_redraw();
break;
@@ -2281,7 +2281,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
if (msgbox_reset_yn(ghwnd) == IDYES)
{
config_save(config_file_default);
config_write(config_file_default);
for (i = 0; i < FDD_NUM; i++)
{
floppy_close(i);
@@ -2303,7 +2303,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
}
resetpchard_close();
loadconfig(wopenfilestring);
config_load(wopenfilestring);
for (i = 0; i < CDROM_NUM; i++)
{
if (cdrom_drives[i].bus_type)
@@ -2348,7 +2348,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
pause = 1;
if (!file_dlg_st(hwnd, IDS_2160, "", 1))
{
config_save(wopenfilestring);
config_write(wopenfilestring);
}
pause = 0;
break;
@@ -2454,7 +2454,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
save_window_pos = 1;
}
saveconfig();
config_save();
break;
case WM_MOVE:
@@ -2494,7 +2494,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
mouse_close();
vid_apis[1][vid_api].close();
video_fullscreen = 0;
saveconfig();
config_save();
vid_apis[0][vid_api].init(hwndRender);
mouse_init();
endblit();
@@ -2589,7 +2589,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
update_status_bar_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
update_tip(SB_FLOPPY | id);
saveconfig();
config_save();
}
break;
@@ -2605,7 +2605,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
update_status_bar_icon_state(SB_FLOPPY | id, 1);
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
update_tip(SB_FLOPPY | id);
saveconfig();
config_save();
break;
case IDM_CDROM_MUTE:
@@ -2618,7 +2618,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
cdrom_drives[id].sound_on ^= 1;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_MUTE | id, cdrom_drives[id].sound_on ? MF_UNCHECKED : MF_CHECKED);
saveconfig();
config_save();
sound_cd_thread_reset();
break;
@@ -2674,7 +2674,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
}
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
update_tip(SB_CDROM | id);
saveconfig();
config_save();
}
break;
@@ -2710,7 +2710,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
update_status_bar_icon_state(SB_CDROM | id, 0);
update_tip(SB_CDROM | id);
saveconfig();
config_save();
break;
case IDM_RDISK_EJECT:
@@ -2755,7 +2755,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | MF_GRAYED);
}
update_tip(SB_RDISK | id);
saveconfig();
config_save();
}
break;

View File

@@ -8,7 +8,7 @@
*
* Windows device configuration dialog implementation.
*
* Version: @(#)win_deviceconfig.c 1.0.1 2017/06/19
* Version: @(#)win_deviceconfig.c 1.0.2 2017/09/19
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -352,7 +352,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
config++;
}
saveconfig();
config_save();
resetpchard();

View File

@@ -8,7 +8,7 @@
*
* Windows IO device menu handler.
*
* Version: @(#)win_iodev.c 1.0.1 2017/09/03
* Version: @(#)win_iodev.c 1.0.2 2017/09/19
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016,2017 Miran Grca.
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <stdint.h>
#include "../ibm.h"
#include "../config.h"
#include "../device.h"
#include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h"
@@ -78,7 +79,7 @@ void cdrom_eject(uint8_t id)
update_status_bar_icon_state(SB_CDROM | id, 1);
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
update_tip(SB_CDROM | id);
saveconfig();
config_save();
}
void cdrom_reload(uint8_t id)
@@ -139,7 +140,7 @@ void cdrom_reload(uint8_t id)
}
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
update_tip(SB_CDROM | id);
saveconfig();
config_save();
}
void removable_disk_unload(uint8_t id)
@@ -170,7 +171,7 @@ void removable_disk_eject(uint8_t id)
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | MF_GRAYED);
update_tip(SB_RDISK | id);
saveconfig();
config_save();
}
void removable_disk_reload(uint8_t id)
@@ -196,6 +197,6 @@ void removable_disk_reload(uint8_t id)
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | (wcslen(hdc[id].fn) ? MF_ENABLED : MF_GRAYED));
update_tip(SB_RDISK | id);
saveconfig();
config_save();
}

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.10 2017/09/03
* Version: @(#)win_settings.c 1.0.11 2017/09/19
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016,2017 Miran Grca.
@@ -22,6 +22,7 @@
#include <commctrl.h>
#include <inttypes.h>
#include "../ibm.h"
#include "../config.h"
#include "../cpu/cpu.h"
#include "../mem.h"
#include "../device.h"
@@ -372,7 +373,7 @@ static void win_settings_save(void)
cpu_update_waitstates();
saveconfig();
config_save();
speedchanged();