diff --git a/src/86box.cfg b/src/86box.cfg new file mode 100644 index 000000000..ad83f0d35 Binary files /dev/null and b/src/86box.cfg differ diff --git a/src/CPU/codegen_x86-64.c b/src/CPU/codegen_x86-64.c index 7673a08e4..e591adc95 100644 --- a/src/CPU/codegen_x86-64.c +++ b/src/CPU/codegen_x86-64.c @@ -1,16 +1,14 @@ #ifdef __amd64__ #include -#include "ibm.h" +#include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_flags.h" #include "x86_ops.h" #include "x87.h" -#include "mem.h" - #include "386_common.h" - #include "codegen.h" #include "codegen_ops.h" #include "codegen_ops_x86-64.h" diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 25f80b092..2ff2c218c 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -8,7 +8,7 @@ # # Modified Makefile for Win32 MinGW 32-bit environment. # -# Version: @(#)Makefile.mingw 1.0.12 2017/05/12 +# Version: @(#)Makefile.mingw 1.0.13 2017/05/17 # # Authors: Kotori, # Fred N. van Kempen, @@ -29,20 +29,24 @@ STUFF = -DDEV_BRANCH EXTRAS = # Do we want a debugging build? -DEBUG = n +DEBUG = y OPTIM = n X64 = n +# Where is the WinPcap DLL ? +PCAPDLL = C:\\Windows\\System32\\wpcap.dll + ######################################################################### # Nothing should need changing from here on.. # ######################################################################### -VPATH = . cpu sound sound/resid-fp video lzf slirp +VPATH = . cpu sound sound/resid-fp video lzf slirp win +PLAT = win/ CPP = g++.exe CC = gcc.exe WINDRES = windres.exe -OPTS = -DWIN32 $(EXTRAS) $(STUFF) +OPTS = -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF) ifeq ($(DEBUG), y) ifeq ($(VRAMDUMP), y) DFLAGS = -march=i686 -ggdb -DDEBUG -DENABLE_VRAM_DUMP @@ -129,7 +133,7 @@ DEVOBJ = bugger.o lpt.o serial.o \ disc_86f.o disc_fdi.o disc_imd.o disc_img.o \ disc_random.o disc_td0.o \ cdrom.o \ - cdrom-dosbox.o cdrom-image.o cdrom-ioctl.o cdrom-null.o + cdrom_dosbox.o cdrom_image.o cdrom_ioctl.o cdrom_null.o USBOBJ = usb.o NETOBJ = network.o \ net_pcap.o net_slirp.o \ @@ -174,12 +178,12 @@ VIDOBJ = video.o \ vid_pc1512.o vid_pc1640.o vid_pc200.o \ vid_tandy.o vid_tandysl.o WINOBJ = win.o \ - win-d3d.o win-d3d-fs.o \ - win-ddraw.o win-ddraw-fs.o win-ddraw-screenshot.o \ - win-language.o win-status.o win-opendir.o \ - win-video.o win-serial.o win-mouse.o \ - win-joystick.o win-midi.o \ - win-settings.o win-deviceconfig.o win-joystickconfig.o \ + win_d3d.o win_d3d-fs.o \ + win_ddraw.o win_ddraw-fs.o win_ddraw-screenshot.o \ + win_language.o win_status.o win_opendir.o \ + win_video.o win_serial.o win_mouse.o \ + win_joystick.o win_midi.o \ + win_settings.o win_deviceconfig.o win_joystickconfig.o \ 86Box.res OBJ = $(MAINOBJ) $(CPUOBJ) $(SYSOBJ) $(DEVOBJ) $(USBOBJ) \ $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) $(WINOBJ) @@ -197,7 +201,7 @@ LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \ # Build rules. %.o: %.c @echo $< - @$(CC) $(CFLAGS) -c $< + $(CC) $(CFLAGS) -c $< %.o: %.cc @echo $< @@ -236,11 +240,15 @@ clean: 86Box.res: 86Box.rc @echo Processing $< - @$(WINDRES) $(RFLAGS) -i 86Box.rc -o 86Box.res + @$(WINDRES) $(RFLAGS) -i win/86Box.rc -o 86Box.res + +libwpcapdelay.a: $(PCAPDLL) + @dlltool --export-all-symbols --output-def wpcap.def $(PCAPDLL) + @dlltool --def wpcap.def --output-delaylib libwpcapdelay.a pcap_if.res: pcap_if.rc @echo Processing $< - @$(WINDRES) $(RFLAGS) -i pcap_if.rc -o pcap_if.res + @$(WINDRES) $(RFLAGS) -i win/pcap_if.rc -o pcap_if.res # End of Makefile.mingw. diff --git a/src/SOUND/snd_mpu401.c b/src/SOUND/snd_mpu401.c index eace343f3..474d717b9 100644 --- a/src/SOUND/snd_mpu401.c +++ b/src/SOUND/snd_mpu401.c @@ -2,7 +2,7 @@ #include "../io.h" #include "../pic.h" #include "../timer.h" -#include "../plat-midi.h" +#include "../win/plat_midi.h" /*YUCK*/ #include "snd_mpu401.h" #include diff --git a/src/SOUND/snd_sb_dsp.c b/src/SOUND/snd_sb_dsp.c index 92f7cacd0..8c6f4a036 100644 --- a/src/SOUND/snd_sb_dsp.c +++ b/src/SOUND/snd_sb_dsp.c @@ -9,7 +9,7 @@ #include "../io.h" #include "../pic.h" #include "../dma.h" -#include "../plat-midi.h" +#include "../win/plat_midi.h" /*YUCK*/ #include "../timer.h" #include "sound.h" #include "snd_mpu401.h" diff --git a/src/VIDEO/vid_cga.c b/src/VIDEO/vid_cga.c index 41553f671..afae65439 100644 --- a/src/VIDEO/vid_cga.c +++ b/src/VIDEO/vid_cga.c @@ -13,7 +13,7 @@ #include "vid_cga.h" #include "vid_cga_comp.h" #ifndef __unix -#include "../win-cgapal.h" +# include "../win/win_cgapal.h" /*YUCK*/ #endif diff --git a/src/VIDEO/vid_hercules.c b/src/VIDEO/vid_hercules.c index a7c5ab73a..bbb8b57b6 100644 --- a/src/VIDEO/vid_hercules.c +++ b/src/VIDEO/vid_hercules.c @@ -11,7 +11,7 @@ #include "video.h" #include "vid_hercules.h" #ifndef __unix -#include "../win-cgapal.h" +# include "../win/win_cgapal.h" /*YUCK*/ #endif diff --git a/src/VIDEO/vid_mda.c b/src/VIDEO/vid_mda.c index 7180a4921..d9e254b3a 100644 --- a/src/VIDEO/vid_mda.c +++ b/src/VIDEO/vid_mda.c @@ -11,7 +11,7 @@ #include "video.h" #include "vid_mda.h" #ifndef __unix -#include "../win-cgapal.h" +# include "../win/win_cgapal.h" /*YUCK*/ #endif diff --git a/src/VIDEO/video.c b/src/VIDEO/video.c index c7bbe2c79..30f015570 100644 --- a/src/VIDEO/video.c +++ b/src/VIDEO/video.c @@ -17,7 +17,7 @@ #include "video.h" #include "vid_svga.h" #ifndef __unix -#include "../win-cgapal.h" +# include "../win/win_cgapal.h" /*YUCK*/ #endif diff --git a/src/86Box.manifest b/src/WIN/86Box.manifest similarity index 100% rename from src/86Box.manifest rename to src/WIN/86Box.manifest diff --git a/src/86Box.rc b/src/WIN/86Box.rc similarity index 100% rename from src/86Box.rc rename to src/WIN/86Box.rc diff --git a/src/pcap_if.rc b/src/WIN/pcap_if.rc similarity index 100% rename from src/pcap_if.rc rename to src/WIN/pcap_if.rc diff --git a/src/plat-dinput.h b/src/WIN/plat_dinput.h similarity index 100% rename from src/plat-dinput.h rename to src/WIN/plat_dinput.h diff --git a/src/plat-dir.h b/src/WIN/plat_dir.h similarity index 97% rename from src/plat-dir.h rename to src/WIN/plat_dir.h index f9fbf2a9d..6eb372aa0 100644 --- a/src/plat-dir.h +++ b/src/WIN/plat_dir.h @@ -8,7 +8,7 @@ * * Definitions for the platform OpenDir module. * - * Version: @(#)plat-dir.h 1.0.1 2017/05/12 + * Version: @(#)plat_dir.h 1.0.1 2017/05/17 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. diff --git a/src/plat-joystick.h b/src/WIN/plat_joystick.h similarity index 100% rename from src/plat-joystick.h rename to src/WIN/plat_joystick.h diff --git a/src/plat-keyboard.h b/src/WIN/plat_keyboard.h similarity index 100% rename from src/plat-keyboard.h rename to src/WIN/plat_keyboard.h diff --git a/src/plat-midi.h b/src/WIN/plat_midi.h similarity index 100% rename from src/plat-midi.h rename to src/WIN/plat_midi.h diff --git a/src/plat-mouse.h b/src/WIN/plat_mouse.h similarity index 100% rename from src/plat-mouse.h rename to src/WIN/plat_mouse.h diff --git a/src/plat-serial.h b/src/WIN/plat_serial.h similarity index 96% rename from src/plat-serial.h rename to src/WIN/plat_serial.h index e11737a89..cf87192c0 100644 --- a/src/plat-serial.h +++ b/src/WIN/plat_serial.h @@ -8,7 +8,7 @@ * * Definitions for the Bottom Half of the SERIAL card. * - * Version: @(#)plat-serial.h 1.0.3 2017/05/06 + * Version: @(#)plat_serial.h 1.0.3 2017/05/17 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. diff --git a/src/resource.h b/src/WIN/resource.h similarity index 100% rename from src/resource.h rename to src/WIN/resource.h diff --git a/src/win.c b/src/WIN/win.c similarity index 98% rename from src/win.c rename to src/WIN/win.c index f5e5a96eb..a56660e20 100644 --- a/src/win.c +++ b/src/WIN/win.c @@ -16,39 +16,39 @@ #include #include #include -#include "86box.h" -#include "device.h" -#include "disc.h" -#include "fdd.h" -#include "hdd.h" -#include "ibm.h" -#include "cpu/cpu.h" -#include "mem.h" -#include "rom.h" -#include "nvr.h" -#include "thread.h" -#include "config.h" -#include "model.h" -#include "ide.h" -#include "cdrom.h" -#include "cdrom-null.h" -#include "cdrom-ioctl.h" -#include "cdrom-image.h" -#include "video/video.h" -#include "video/vid_ega.h" -#include "plat-keyboard.h" -#include "plat-mouse.h" -#include "plat-midi.h" -#include "mouse.h" -#include "sound/sound.h" -#include "sound/snd_dbopl.h" +#include "../86box.h" +#include "../device.h" +#include "../disc.h" +#include "../fdd.h" +#include "../hdd.h" +#include "../ibm.h" +#include "../cpu/cpu.h" +#include "../mem.h" +#include "../rom.h" +#include "../nvr.h" +#include "../thread.h" +#include "../config.h" +#include "../model.h" +#include "../ide.h" +#include "../cdrom.h" +#include "../cdrom_null.h" +#include "../cdrom_ioctl.h" +#include "../cdrom_image.h" +#include "../video/video.h" +#include "../video/vid_ega.h" +#include "../mouse.h" +#include "../sound/sound.h" +#include "../sound/snd_dbopl.h" +#include "plat_keyboard.h" +#include "plat_mouse.h" +#include "plat_midi.h" #include "win.h" -#include "win-ddraw.h" -#include "win-ddraw-fs.h" -#include "win-d3d.h" -#include "win-d3d-fs.h" -#include "win-language.h" +#include "win_ddraw.h" +#include "win_ddraw-fs.h" +#include "win_d3d.h" +#include "win_d3d-fs.h" +#include "win_language.h" #include "resource.h" diff --git a/src/win.h b/src/WIN/win.h similarity index 100% rename from src/win.h rename to src/WIN/win.h diff --git a/src/win-cgapal.h b/src/WIN/win_cgapal.h similarity index 100% rename from src/win-cgapal.h rename to src/WIN/win_cgapal.h diff --git a/src/win-crashdump.c b/src/WIN/win_crashdump.c similarity index 98% rename from src/win-crashdump.c rename to src/WIN/win_crashdump.c index b640c61ae..3fee061b3 100644 --- a/src/win-crashdump.c +++ b/src/WIN/win_crashdump.c @@ -1,7 +1,7 @@ /* Copyright holders: Riley see COPYING for more details - win-crashdump.c : Windows exception handler to make a crash dump just before a crash happens. + win_crashdump.c : Windows exception handler to make a crash dump just before a crash happens. */ #define _WIN32_WINNT 0x0501 #include @@ -9,8 +9,8 @@ #include #include #include -#include "86box.h" -#include "win-crashdump.h" +#include "../86box.h" +#include "win_crashdump.h" PVOID hExceptionHandler; char* ExceptionHandlerBuffer; @@ -182,4 +182,4 @@ void InitCrashDump() { ExceptionHandlerBuffer = malloc(ExceptionHandlerBufferSize); // Register the exception handler. Zero first argument means this exception handler gets called last, therefore, crash dump is only made, when a crash is going to happen. hExceptionHandler = AddVectoredExceptionHandler(0,MakeCrashDump); -} \ No newline at end of file +} diff --git a/src/win-crashdump.h b/src/WIN/win_crashdump.h similarity index 100% rename from src/win-crashdump.h rename to src/WIN/win_crashdump.h diff --git a/src/win-d3d-fs.cc b/src/WIN/win_d3d-fs.cc similarity index 99% rename from src/win-d3d-fs.cc rename to src/WIN/win_d3d-fs.cc index dff2e0d6f..4e6a367cb 100644 --- a/src/win-d3d-fs.cc +++ b/src/WIN/win_d3d-fs.cc @@ -8,11 +8,11 @@ #include #undef BITMAP #include -#include "86box.h" -#include "video/video.h" -#include "win-d3d-fs.h" +#include "../86box.h" +#include "../video/video.h" #include "win.h" -#include "win-cgapal.h" +#include "win_d3d-fs.h" +#include "win_cgapal.h" #include "resource.h" diff --git a/src/win-d3d-fs.h b/src/WIN/win_d3d-fs.h similarity index 100% rename from src/win-d3d-fs.h rename to src/WIN/win_d3d-fs.h diff --git a/src/win-d3d.cc b/src/WIN/win_d3d.cc similarity index 99% rename from src/win-d3d.cc rename to src/WIN/win_d3d.cc index abfce0bfb..258bcd4f8 100644 --- a/src/win-d3d.cc +++ b/src/WIN/win_d3d.cc @@ -7,10 +7,11 @@ #include #undef BITMAP #include +#include "win.h" +#include "win_d3d.h" +#include "../video/video.h" +#include "win_cgapal.h" #include "resource.h" -#include "win-d3d.h" -#include "video/video.h" -#include "win-cgapal.h" extern "C" void fatal(const char *format, ...); diff --git a/src/win-d3d.h b/src/WIN/win_d3d.h similarity index 100% rename from src/win-d3d.h rename to src/WIN/win_d3d.h diff --git a/src/win-ddraw-fs.cc b/src/WIN/win_ddraw-fs.cc similarity index 99% rename from src/win-ddraw-fs.cc rename to src/WIN/win_ddraw-fs.cc index 9fc355c63..42fd984ed 100644 --- a/src/win-ddraw-fs.cc +++ b/src/WIN/win_ddraw-fs.cc @@ -6,10 +6,10 @@ #define BITMAP WINDOWS_BITMAP #include #undef BITMAP -#include "win-ddraw-fs.h" -#include "win-ddraw-screenshot.h" -#include "video/video.h" -#include "win-cgapal.h" +#include "../video/video.h" +#include "win_ddraw-fs.h" +#include "win_ddraw-screenshot.h" +#include "win_cgapal.h" extern "C" void fatal(const char *format, ...); diff --git a/src/win-ddraw-fs.h b/src/WIN/win_ddraw-fs.h similarity index 100% rename from src/win-ddraw-fs.h rename to src/WIN/win_ddraw-fs.h diff --git a/src/win-ddraw-screenshot.cc b/src/WIN/win_ddraw-screenshot.cc similarity index 97% rename from src/win-ddraw-screenshot.cc rename to src/WIN/win_ddraw-screenshot.cc index e8a891fe9..bb3cb6660 100644 --- a/src/win-ddraw-screenshot.cc +++ b/src/WIN/win_ddraw-screenshot.cc @@ -7,10 +7,10 @@ #define BITMAP WINDOWS_BITMAP #include #undef BITMAP +#include "../video/video.h" #include "win.h" -#include "win-ddraw-screenshot.h" -#include "win-language.h" -#include "video/video.h" +#include "win_ddraw-screenshot.h" +#include "win_language.h" extern "C" void fatal(const char *format, ...); diff --git a/src/win-ddraw-screenshot.h b/src/WIN/win_ddraw-screenshot.h similarity index 100% rename from src/win-ddraw-screenshot.h rename to src/WIN/win_ddraw-screenshot.h diff --git a/src/win-ddraw.cc b/src/WIN/win_ddraw.cc similarity index 98% rename from src/win-ddraw.cc rename to src/WIN/win_ddraw.cc index 509124205..af329eb29 100644 --- a/src/win-ddraw.cc +++ b/src/WIN/win_ddraw.cc @@ -7,10 +7,10 @@ #define BITMAP WINDOWS_BITMAP #include #undef BITMAP -#include "win-ddraw.h" -#include "win-ddraw-screenshot.h" -#include "video/video.h" -#include "win-cgapal.h" +#include "../video/video.h" +#include "win_ddraw.h" +#include "win_ddraw-screenshot.h" +#include "win_cgapal.h" extern "C" void fatal(const char *format, ...); diff --git a/src/win-ddraw.h b/src/WIN/win_ddraw.h similarity index 100% rename from src/win-ddraw.h rename to src/WIN/win_ddraw.h diff --git a/src/win-deviceconfig.c b/src/WIN/win_deviceconfig.c similarity index 99% rename from src/win-deviceconfig.c rename to src/WIN/win_deviceconfig.c index 196845359..457a38f75 100644 --- a/src/win-deviceconfig.c +++ b/src/WIN/win_deviceconfig.c @@ -6,9 +6,9 @@ #include #undef BITMAP -#include "ibm.h" -#include "config.h" -#include "device.h" +#include "../ibm.h" +#include "../config.h" +#include "../device.h" #include "resource.h" #include "win.h" diff --git a/src/win-joystick.cc b/src/WIN/win_joystick.cc similarity index 99% rename from src/win-joystick.cc rename to src/WIN/win_joystick.cc index 13cc3c1ff..63d970eaa 100644 --- a/src/win-joystick.cc +++ b/src/WIN/win_joystick.cc @@ -6,10 +6,10 @@ #include #include extern "C" { -#include "device.h" -#include "gameport.h" +#include "../device.h" +#include "../gameport.h" } -#include "plat-joystick.h" +#include "plat_joystick.h" #include "win.h" extern "C" int video_fullscreen; diff --git a/src/win-joystickconfig.c b/src/WIN/win_joystickconfig.c similarity index 99% rename from src/win-joystickconfig.c rename to src/WIN/win_joystickconfig.c index 1432379ff..8962366d6 100644 --- a/src/win-joystickconfig.c +++ b/src/WIN/win_joystickconfig.c @@ -6,11 +6,11 @@ #include #undef BITMAP -#include "ibm.h" -#include "config.h" -#include "device.h" -#include "gameport.h" -#include "plat-joystick.h" +#include "../ibm.h" +#include "../config.h" +#include "../device.h" +#include "../gameport.h" +#include "plat_joystick.h" #include "resource.h" #include "win.h" diff --git a/src/win-language.c b/src/WIN/win_language.c similarity index 98% rename from src/win-language.c rename to src/WIN/win_language.c index c2525db48..e87964d37 100644 --- a/src/win-language.c +++ b/src/WIN/win_language.c @@ -10,12 +10,12 @@ #include -#include "ibm.h" -#include "device.h" -#include "ide.h" +#include "../ibm.h" +#include "../device.h" +#include "../ide.h" #include "resource.h" #include "win.h" -#include "win-language.h" +#include "win_language.h" LCID dwLanguage; diff --git a/src/win-language.h b/src/WIN/win_language.h similarity index 100% rename from src/win-language.h rename to src/WIN/win_language.h diff --git a/src/win-midi.c b/src/WIN/win_midi.c similarity index 98% rename from src/win-midi.c rename to src/WIN/win_midi.c index a11c7bfea..2fdf58bec 100644 --- a/src/win-midi.c +++ b/src/WIN/win_midi.c @@ -3,9 +3,9 @@ */ #include #include -#include "ibm.h" -#include "config.h" -#include "plat-midi.h" +#include "../ibm.h" +#include "../config.h" +#include "plat_midi.h" int midi_id; static HMIDIOUT midi_out_device = NULL; diff --git a/src/win-mouse.cc b/src/WIN/win_mouse.cc similarity index 98% rename from src/win-mouse.cc rename to src/WIN/win_mouse.cc index 0eacdee78..f64b714a0 100644 --- a/src/win-mouse.cc +++ b/src/WIN/win_mouse.cc @@ -3,7 +3,7 @@ */ #define DIRECTINPUT_VERSION 0x0800 #include -#include "plat-mouse.h" +#include "plat_mouse.h" #include "win.h" extern "C" int video_fullscreen; diff --git a/src/win-opendir.c b/src/WIN/win_opendir.c similarity index 97% rename from src/win-opendir.c rename to src/WIN/win_opendir.c index 847265582..00347a365 100644 --- a/src/win-opendir.c +++ b/src/WIN/win_opendir.c @@ -10,7 +10,7 @@ * * Based on old original code @(#)dir_win32.c 1.2.0 2007/04/19 * - * Version: @(#)win-opendir.c 1.0.1 2017/05/12 + * Version: @(#)win_opendir.c 1.0.1 2017/05/17 * * Author: Fred N. van Kempen, * Copyright 1998-2007 MicroWalt Corporation @@ -23,8 +23,8 @@ #include #include #include -#include "ibm.h" -#include "plat-dir.h" +#include "../ibm.h" +#include "plat_dir.h" #ifdef UNICODE diff --git a/src/win-serial.c b/src/WIN/win_serial.c similarity index 99% rename from src/win-serial.c rename to src/WIN/win_serial.c index fb92b8bea..cfe8f0b43 100644 --- a/src/win-serial.c +++ b/src/WIN/win_serial.c @@ -12,7 +12,7 @@ * Windows and UNIX systems, with support for FTDI and Prolific * USB ports. Support for these has been removed. * - * Version: @(#)win-serial.c 1.0.2 2017/05/05 + * Version: @(#)win_serial.c 1.0.2 2017/05/17 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. @@ -22,7 +22,7 @@ #include #include #define BHTTY_C -#include "plat-serial.h" +#include "plat_serial.h" extern void pclog(char *__fmt, ...); diff --git a/src/win-settings.c b/src/WIN/win_settings.c similarity index 97% rename from src/win-settings.c rename to src/WIN/win_settings.c index 308477b70..6916bca28 100644 --- a/src/win-settings.c +++ b/src/WIN/win_settings.c @@ -9,29 +9,29 @@ #include #include -#include "ibm.h" -#include "mem.h" -#include "cpu/cpu.h" -#include "nvr.h" -#include "model.h" -#include "device.h" -#include "cdrom.h" -#include "disc.h" -#include "fdd.h" -#include "hdd.h" -#include "ide.h" -#include "scsi.h" -#include "scsi_buslogic.h" -#include "network.h" -#include "plat-midi.h" -#include "sound/sound.h" -#include "sound/snd_dbopl.h" -#include "video/video.h" -#include "video/vid_voodoo.h" -#include "gameport.h" -#include "mouse.h" +#include "../ibm.h" +#include "../mem.h" +#include "../cpu/cpu.h" +#include "../nvr.h" +#include "../model.h" +#include "../device.h" +#include "../cdrom.h" +#include "../disc.h" +#include "../fdd.h" +#include "../hdd.h" +#include "../ide.h" +#include "../scsi.h" +#include "../scsi_buslogic.h" +#include "../network.h" +#include "../sound/sound.h" +#include "../sound/snd_dbopl.h" +#include "../video/video.h" +#include "../video/vid_voodoo.h" +#include "../gameport.h" +#include "../mouse.h" +#include "plat_midi.h" #include "win.h" -#include "win-language.h" +#include "win_language.h" #include "resource.h" @@ -82,8 +82,9 @@ static int settings_scsi_to_list[20], settings_list_to_scsi[20]; static int settings_network_to_list[20], settings_list_to_network[20]; static char *hdd_names[16]; + /* This does the initial read of global variables into the temporary ones. */ -static void win_settings_init() +static void win_settings_init(void) { int i = 0; @@ -115,8 +116,8 @@ static void win_settings_init() /* Network category */ temp_net_type = network_type; - memset(temp_pcap_dev, 0, 520); - strcpy(temp_pcap_dev, pcap_dev); + memset(temp_pcap_dev, '\0', sizeof(temp_pcap_dev)); + strcpy(temp_pcap_dev, network_pcap); temp_net_card = network_card; /* Peripherals category */ @@ -146,8 +147,9 @@ static void win_settings_init() memcpy(temp_cdrom_drives, cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t)); } + /* This returns 1 if any variable has changed, 0 if not. */ -static int win_settings_changed() +static int win_settings_changed(void) { int i = 0; int j = 0; @@ -180,7 +182,7 @@ static int win_settings_changed() /* Network category */ i = i || (network_type != temp_net_type); - i = i || strcmp(temp_pcap_dev, pcap_dev); + i = i || strcmp(temp_pcap_dev, network_pcap); i = i || (network_card != temp_net_card); /* Peripherals category */ @@ -212,7 +214,8 @@ static int win_settings_changed() return i; } -static int settings_msgbox_reset() + +static int settings_msgbox_reset(void) { int i = 0; int changed = 0; @@ -242,8 +245,9 @@ static int settings_msgbox_reset() } } + /* This saves the settings back to the global variables. */ -static void win_settings_save() +static void win_settings_save(void) { int i = 0; @@ -276,8 +280,8 @@ static void win_settings_save() /* Network category */ network_type = temp_net_type; - memset(pcap_dev, 0, 512); - strcpy(pcap_dev, temp_pcap_dev); + memset(network_pcap, '\0', sizeof(network_pcap)); + strcpy(network_pcap, temp_pcap_dev); network_card = temp_net_card; /* Peripherals category */ @@ -324,6 +328,7 @@ static void win_settings_save() update_status_bar_panes(hwndStatus); } + static void win_settings_machine_recalc_cpu(HWND hdlg) { HWND h; @@ -387,6 +392,7 @@ static void win_settings_machine_recalc_cpu(HWND hdlg) SendMessage(h, BM_SETCHECK, temp_fpu, 0); } + static void win_settings_machine_recalc_cpu_m(HWND hdlg) { HWND h; @@ -416,6 +422,7 @@ static void win_settings_machine_recalc_cpu_m(HWND hdlg) free(lptsTemp); } + static void win_settings_machine_recalc_model(HWND hdlg) { HWND h; @@ -482,6 +489,7 @@ static void win_settings_machine_recalc_model(HWND hdlg) free(lptsTemp); } + static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h; @@ -629,6 +637,7 @@ static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM w return FALSE; } + static void recalc_vid_list(HWND hdlg) { HWND h = GetDlgItem(hdlg, IDC_COMBO_VIDEO); @@ -674,6 +683,7 @@ static void recalc_vid_list(HWND hdlg) EnableWindow(h, ((models[model].flags & MODEL_PCI) && temp_voodoo) ? TRUE : FALSE); } + static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h; @@ -959,6 +969,7 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa return FALSE; } + static void recalc_hdd_list(HWND hdlg, int model, int use_selected_hdd) { HWND h; @@ -1066,8 +1077,10 @@ static void recalc_hdd_list(HWND hdlg, int model, int use_selected_hdd) free(lptsTemp); } + int valid_ide_irqs[11] = { 2, 3, 4, 5, 7, 9, 10, 11, 12, 14, 15 }; + int find_irq_in_array(int irq, int def) { int i = 0; @@ -1083,6 +1096,7 @@ int find_irq_in_array(int irq, int def) return 7 + def; } + static char midi_dev_name_buf[512]; static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) @@ -1226,6 +1240,7 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa return FALSE; } + static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h; @@ -1424,6 +1439,7 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR return FALSE; } + int net_ignore_message = 0; static void network_recalc_combos(HWND hdlg) @@ -1433,7 +1449,7 @@ static void network_recalc_combos(HWND hdlg) net_ignore_message = 1; h = GetDlgItem(hdlg, IDC_COMBOPCAP); - if (temp_net_type == 1) + if (temp_net_type == NET_TYPE_PCAP) { EnableWindow(h, TRUE); } @@ -1443,11 +1459,12 @@ static void network_recalc_combos(HWND hdlg) } h = GetDlgItem(hdlg, IDC_COMBONET); - if (temp_net_type == 0) + if (temp_net_type == NET_TYPE_SLIRP) { EnableWindow(h, TRUE); } - else if ((temp_net_type == 1) && (network_dev_to_id(temp_pcap_dev) > 0)) + else if ((temp_net_type == NET_TYPE_PCAP) && + (network_dev_to_id(temp_pcap_dev) > 0)) { EnableWindow(h, TRUE); } @@ -1457,11 +1474,14 @@ static void network_recalc_combos(HWND hdlg) } h = GetDlgItem(hdlg, IDC_CONFIGURENET); - if (network_card_has_config(temp_net_card) && (temp_net_type == 0)) + if (network_card_has_config(temp_net_card) && + (temp_net_type == NET_TYPE_SLIRP)) { EnableWindow(h, TRUE); } - else if (network_card_has_config(temp_net_card) && (temp_net_type == 1) && (network_dev_to_id(temp_pcap_dev) > 0)) + else if (network_card_has_config(temp_net_card) && + (temp_net_type == NET_TYPE_PCAP) && + (network_dev_to_id(temp_pcap_dev) > 0)) { EnableWindow(h, TRUE); } @@ -1490,10 +1510,10 @@ static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM w SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"None"); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"PCap"); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"SLiRP"); - SendMessage(h, CB_SETCURSEL, temp_net_type + 1, 0); + SendMessage(h, CB_SETCURSEL, temp_net_type, 0); h = GetDlgItem(hdlg, IDC_COMBOPCAP); - if (temp_net_type == 0) + if (temp_net_type == NET_TYPE_PCAP) { EnableWindow(h, TRUE); } @@ -1503,9 +1523,9 @@ static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM w } h = GetDlgItem(hdlg, IDC_COMBOPCAP); - for (c = 0; c < netdev_num; c++) + for (c = 0; c < network_ndev; c++) { - mbstowcs(lptsTemp, netdev_list[c].description, strlen(netdev_list[c].description) + 1); + mbstowcs(lptsTemp, network_devs[c].description, strlen(network_devs[c].description) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } SendMessage(h, CB_SETCURSEL, network_dev_to_id(temp_pcap_dev), 0); @@ -1517,7 +1537,7 @@ static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM w { char *s = network_card_getname(c); - if (!s[0]) + if (s[0] == '\0') { break; } @@ -1559,7 +1579,7 @@ static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM w } h = GetDlgItem(hdlg, IDC_COMBONETTYPE); - temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0) - 1; + temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0); network_recalc_combos(hdlg); break; @@ -1571,8 +1591,8 @@ static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM w } h = GetDlgItem(hdlg, IDC_COMBOPCAP); - memset(temp_pcap_dev, 0, 520); - strcpy(temp_pcap_dev, netdev_list[SendMessage(h, CB_GETCURSEL, 0, 0)].device); + memset(temp_pcap_dev, '\0', sizeof(temp_pcap_dev)); + strcpy(temp_pcap_dev, network_devs[SendMessage(h, CB_GETCURSEL, 0, 0)].device); network_recalc_combos(hdlg); break; @@ -1605,11 +1625,11 @@ static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM w case WM_SAVESETTINGS: h = GetDlgItem(hdlg, IDC_COMBONETTYPE); - temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0) - 1; + temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0); h = GetDlgItem(hdlg, IDC_COMBOPCAP); - memset(temp_pcap_dev, 0, 520); - strcpy(temp_pcap_dev, netdev_list[SendMessage(h, CB_GETCURSEL, 0, 0)].device); + memset(temp_pcap_dev, '\0', sizeof(temp_pcap_dev)); + strcpy(temp_pcap_dev, network_devs[SendMessage(h, CB_GETCURSEL, 0, 0)].device); h = GetDlgItem(hdlg, IDC_COMBONET); temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)]; diff --git a/src/win-status.c b/src/WIN/win_status.c similarity index 96% rename from src/win-status.c rename to src/WIN/win_status.c index a39d38700..59a7a5947 100644 --- a/src/win-status.c +++ b/src/WIN/win_status.c @@ -6,11 +6,11 @@ #include #undef BITMAP -#include "ibm.h" -#include "mem.h" -#include "cpu/x86_ops.h" -#include "cpu/codegen.h" -#include "device.h" +#include "../ibm.h" +#include "../mem.h" +#include "../cpu/x86_ops.h" +#include "../cpu/codegen.h" +#include "../device.h" #include "resource.h" #include "win.h" diff --git a/src/win-video.c b/src/WIN/win_video.c similarity index 95% rename from src/win-video.c rename to src/WIN/win_video.c index 15aec3785..3a50f7b9f 100644 --- a/src/win-video.c +++ b/src/WIN/win_video.c @@ -4,8 +4,8 @@ #include #include #include -#include "video/video.h" -#include "win-cgapal.h" +#include "../video/video.h" +#include "win_cgapal.h" BITMAP *screen; diff --git a/src/cdrom-dosbox.cpp b/src/cdrom_dosbox.cpp similarity index 99% rename from src/cdrom-dosbox.cpp rename to src/cdrom_dosbox.cpp index 6f966cf1b..e076fb9b1 100644 --- a/src/cdrom-dosbox.cpp +++ b/src/cdrom_dosbox.cpp @@ -28,7 +28,7 @@ #include #include #include -#include "cdrom-dosbox.h" +#include "cdrom_dosbox.h" #if !defined(WIN32) #include diff --git a/src/cdrom-dosbox.h b/src/cdrom_dosbox.h similarity index 100% rename from src/cdrom-dosbox.h rename to src/cdrom_dosbox.h diff --git a/src/cdrom-image.cc b/src/cdrom_image.cc similarity index 99% rename from src/cdrom-image.cc rename to src/cdrom_image.cc index 5ec185d65..831255db8 100644 --- a/src/cdrom-image.cc +++ b/src/cdrom_image.cc @@ -6,10 +6,10 @@ #include #include "config.h" -#include "cdrom-dosbox.h" +#include "cdrom_dosbox.h" #include "cdrom.h" -#include "cdrom-image.h" -#include "cdrom-null.h" +#include "cdrom_image.h" +#include "cdrom_null.h" #define __USE_LARGEFILE64 #define _LARGEFILE_SOURCE diff --git a/src/cdrom-image.h b/src/cdrom_image.h similarity index 100% rename from src/cdrom-image.h rename to src/cdrom_image.h diff --git a/src/cdrom-ioctl.c b/src/cdrom_ioctl.c similarity index 99% rename from src/cdrom-ioctl.c rename to src/cdrom_ioctl.c index 98c7cc538..8d8e28612 100644 --- a/src/cdrom-ioctl.c +++ b/src/cdrom_ioctl.c @@ -10,7 +10,7 @@ #include "ntddscsi.h" #include "ibm.h" #include "cdrom.h" -#include "cdrom-ioctl.h" +#include "cdrom_ioctl.h" #include "scsi.h" #define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f) diff --git a/src/cdrom-ioctl.h b/src/cdrom_ioctl.h similarity index 100% rename from src/cdrom-ioctl.h rename to src/cdrom_ioctl.h diff --git a/src/cdrom-ioctl-linux.c b/src/cdrom_ioctl_linux.c similarity index 99% rename from src/cdrom-ioctl-linux.c rename to src/cdrom_ioctl_linux.c index 5b993b612..bf1f73994 100644 --- a/src/cdrom-ioctl-linux.c +++ b/src/cdrom_ioctl_linux.c @@ -9,7 +9,7 @@ #include #include "ibm.h" #include "ide.h" -#include "cdrom-ioctl.h" +#include "cdrom_ioctl.h" static ATAPI ioctl_atapi; diff --git a/src/cdrom-null.c b/src/cdrom_null.c similarity index 98% rename from src/cdrom-null.c rename to src/cdrom_null.c index f7d117077..5d86b7992 100644 --- a/src/cdrom-null.c +++ b/src/cdrom_null.c @@ -3,7 +3,7 @@ */ #include "ibm.h" #include "cdrom.h" -#include "cdrom-ioctl.h" +#include "cdrom_ioctl.h" static CDROM null_cdrom; diff --git a/src/cdrom-null.h b/src/cdrom_null.h similarity index 100% rename from src/cdrom-null.h rename to src/cdrom_null.h diff --git a/src/config.c b/src/config.c index 8796c7061..a24772e19 100644 --- a/src/config.c +++ b/src/config.c @@ -23,9 +23,9 @@ #include "mouse.h" #include "network.h" #include "nvr.h" -#include "plat-joystick.h" -#include "plat-midi.h" #include "scsi.h" +#include "plat_joystick.h" +#include "plat_midi.h" #include "sound/snd_dbopl.h" #include "sound/snd_opl.h" #include "sound/sound.h" @@ -37,7 +37,7 @@ #include #undef BITMAP #include "win.h" -#include "win-language.h" +#include "win_language.h" #endif @@ -82,6 +82,7 @@ typedef struct entry_t (new)->next = NULL; \ } + void config_dump(void) { section_t *current_section; @@ -109,7 +110,8 @@ void config_dump(void) } } -void config_free(void) + +static void config_free(void) { section_t *current_section; current_section = (section_t *)config_head.next; @@ -134,6 +136,7 @@ void config_free(void) } } + static wchar_t cfgbuffer[1024]; static char sname[256]; static char ename[256]; @@ -231,13 +234,13 @@ void config_load(wchar_t *fn) } - void config_new(void) { FILE *f = _wfopen(config_file, L"wt, ccs=UNICODE"); fclose(f); } + static section_t *find_section(char *name) { section_t *current_section; @@ -257,6 +260,7 @@ static section_t *find_section(char *name) return NULL; } + static entry_t *find_entry(section_t *section, char *name) { entry_t *current_entry; @@ -273,6 +277,7 @@ static entry_t *find_entry(section_t *section, char *name) return NULL; } + static section_t *create_section(char *name) { section_t *new_section = malloc(sizeof(section_t)); @@ -284,6 +289,7 @@ static section_t *create_section(char *name) return new_section; } + static entry_t *create_entry(section_t *section, char *name) { entry_t *new_entry = malloc(sizeof(entry_t)); @@ -293,7 +299,8 @@ static entry_t *create_entry(section_t *section, char *name) return new_entry; } - + + int config_get_int(char *head, char *name, int def) { section_t *section; @@ -315,6 +322,7 @@ int config_get_int(char *head, char *name, int def) return value; } + int config_get_hex16(char *head, char *name, int def) { section_t *section; @@ -336,6 +344,7 @@ int config_get_hex16(char *head, char *name, int def) return value; } + char *config_get_string(char *head, char *name, char *def) { section_t *section; @@ -354,6 +363,7 @@ char *config_get_string(char *head, char *name, char *def) return entry->data; } + wchar_t *config_get_wstring(char *head, char *name, wchar_t *def) { section_t *section; @@ -372,6 +382,7 @@ wchar_t *config_get_wstring(char *head, char *name, wchar_t *def) return entry->wdata; } + void config_set_int(char *head, char *name, int val) { section_t *section; @@ -391,6 +402,7 @@ void config_set_int(char *head, char *name, int val) mbstowcs(entry->wdata, entry->data, 512); } + void config_set_hex16(char *head, char *name, int val) { section_t *section; @@ -410,6 +422,7 @@ void config_set_hex16(char *head, char *name, int val) mbstowcs(entry->wdata, entry->data, 512); } + void config_set_string(char *head, char *name, char *val) { section_t *section; @@ -429,6 +442,7 @@ void config_set_string(char *head, char *name, char *val) mbstowcs(entry->wdata, entry->data, 256); } + void config_set_wstring(char *head, char *name, wchar_t *val) { section_t *section; @@ -460,6 +474,7 @@ char *get_filename(char *s) return s; } + wchar_t *get_filename_w(wchar_t *s) { int c = wcslen(s) - 1; @@ -472,16 +487,19 @@ wchar_t *get_filename_w(wchar_t *s) return s; } + void append_filename(char *dest, char *s1, char *s2, int size) { sprintf(dest, "%s%s", s1, s2); } + void append_filename_w(wchar_t *dest, wchar_t *s1, wchar_t *s2, int size) { _swprintf(dest, L"%s%s", s1, s2); } + void put_backslash(char *s) { int c = strlen(s) - 1; @@ -489,6 +507,7 @@ void put_backslash(char *s) s[c] = '/'; } + void put_backslash_w(wchar_t *s) { int c = wcslen(s) - 1; @@ -496,6 +515,7 @@ void put_backslash_w(wchar_t *s) s[c] = L'/'; } + char *get_extension(char *s) { int c = strlen(s) - 1; @@ -512,6 +532,7 @@ char *get_extension(char *s) return &s[c+1]; } + wchar_t *get_extension_w(wchar_t *s) { int c = wcslen(s) - 1; @@ -528,8 +549,10 @@ wchar_t *get_extension_w(wchar_t *s) return &s[c+1]; } + static wchar_t wname[512]; + void config_save(wchar_t *fn) { FILE *f = _wfopen(fn, L"wt, ccs=UNICODE"); @@ -581,19 +604,21 @@ void config_save(wchar_t *fn) fclose(f); } -static char temps[512]; -void loadconfig_general(void) + +/* General */ +static void loadconfig_general(void) { + char *cat = "General"; + char temps[512]; wchar_t *wp; char *p; - /* General */ - vid_resize = !!config_get_int("General", "vid_resize", 0); + vid_resize = !!config_get_int(cat, "vid_resize", 0); - p = (char *)config_get_string("General", "vid_renderer", "d3d9"); - memset(temps, 0, 512); - if (p) + memset(temps, '\0', sizeof(temps)); + p = config_get_string(cat, "vid_renderer", "d3d9"); + if (p != NULL) { strcpy(temps, p); } @@ -606,27 +631,22 @@ void loadconfig_general(void) vid_api = 1; } - video_fullscreen_scale = config_get_int("General", "video_fullscreen_scale", 0); - video_fullscreen_first = config_get_int("General", "video_fullscreen_first", 1); + video_fullscreen_scale = config_get_int(cat, "video_fullscreen_scale", 0); + video_fullscreen_first = config_get_int(cat, "video_fullscreen_first", 1); - force_43 = !!config_get_int("General", "force_43", 0); - scale = !!config_get_int("General", "scale", 1); - enable_overscan = !!config_get_int("General", "enable_overscan", 0); + force_43 = !!config_get_int(cat, "force_43", 0); + scale = !!config_get_int(cat, "scale", 1); + enable_overscan = !!config_get_int(cat, "enable_overscan", 0); - p = config_get_string("General", "window_coordinates", "0, 0, 0, 0"); - if (p) - { - sscanf(p, "%i, %i, %i, %i", &window_w, &window_h, &window_x, &window_y); - } - else - { - sscanf("0, 0, 0, 0", "%i, %i, %i, %i", &window_w, &window_h, &window_x, &window_y); - } - window_remember = config_get_int("General", "window_remember", 0); + p = config_get_string(cat, "window_coordinates", NULL); + if (p == NULL) + p = "0, 0, 0, 0"; + sscanf(p, "%i, %i, %i, %i", &window_w, &window_h, &window_x, &window_y); + window_remember = config_get_int(cat, "window_remember", 0); - memset(nvr_path, 0, 2048); - wp = (wchar_t *)config_get_wstring("General", "nvr_path", L""); - if (wp) { + memset(nvr_path, 0x00, sizeof(nvr_path)); + wp = config_get_wstring(cat, "nvr_path", L""); + if (wp != NULL) { if (wcslen(wp) && (wcslen(wp) <= 992)) wcscpy(nvr_path, wp); else { @@ -649,31 +669,31 @@ void loadconfig_general(void) #ifndef __unix /* Currently, 86Box is English (US) only, but in the future (version 1.30 at the earliest) other languages will be added, therefore it is better to future-proof the code. */ - dwLanguage = config_get_hex16("General", "language", 0x0409); + dwLanguage = config_get_hex16(cat, "language", 0x0409); #endif } + +/* Machine */ static void loadconfig_machine(void) { + char *cat = "Machine"; char *p; - /* Machine */ - p = (char *)config_get_string("Machine", "model", ""); - if (p) + p = config_get_string(cat, "model", NULL); + if (p != NULL) model = model_get_model_from_internal_name(p); else model = 0; - if (model >= model_count()) model = model_count() - 1; romset = model_getromset(); - cpu_manufacturer = config_get_int("Machine", "cpu_manufacturer", 0); - cpu = config_get_int("Machine", "cpu", 0); + cpu_manufacturer = config_get_int(cat, "cpu_manufacturer", 0); + cpu = config_get_int(cat, "cpu", 0); + cpu_waitstates = config_get_int(cat, "cpu_waitstates", 0); - cpu_waitstates = config_get_int("Machine", "cpu_waitstates", 0); - - mem_size = config_get_int("Machine", "mem_size", 4096); + mem_size = config_get_int(cat, "mem_size", 4096); if (mem_size < ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram)) mem_size = ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram); if (mem_size > 1048576) @@ -681,66 +701,69 @@ static void loadconfig_machine(void) mem_size = 1048576; } - cpu_use_dynarec = !!config_get_int("Machine", "cpu_use_dynarec", 0); + cpu_use_dynarec = !!config_get_int(cat, "cpu_use_dynarec", 0); - enable_external_fpu = !!config_get_int("Machine", "cpu_enable_fpu", 0); + enable_external_fpu = !!config_get_int(cat, "cpu_enable_fpu", 0); - enable_sync = !!config_get_int("Machine", "enable_sync", 1); + enable_sync = !!config_get_int(cat, "enable_sync", 1); } + +/* Video */ static void loadconfig_video(void) { + char *cat = "Video"; char *p; - /* Video */ - p = (char *)config_get_string("Video", "gfxcard", ""); - if (p) + p = config_get_string(cat, "gfxcard", NULL); + if (p != NULL) gfxcard = video_get_video_from_internal_name(p); else gfxcard = 0; - video_speed = config_get_int("Video", "video_speed", 3); + video_speed = config_get_int(cat, "video_speed", 3); - voodoo_enabled = !!config_get_int("Video", "voodoo", 0); + voodoo_enabled = !!config_get_int(cat, "voodoo", 0); } -static char s[512]; +/* Input devices */ static void loadconfig_input_devices(void) { + char *cat = "Input devices"; + char temps[512]; int c, d; char *p; - /* Input devices */ - p = (char *)config_get_string("Input devices", "mouse_type", ""); - if (p) + p = config_get_string(cat, "mouse_type", NULL); + if (p != NULL) mouse_type = mouse_get_from_internal_name(p); else mouse_type = 0; - joystick_type = config_get_int("Input devices", "joystick_type", 0); + joystick_type = config_get_int(cat, "joystick_type", 0); for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++) { - sprintf(s, "joystick_%i_nr", c); - joystick_state[c].plat_joystick_nr = config_get_int("Input devices", s, 0); + sprintf(temps, "joystick_%i_nr", c); + joystick_state[c].plat_joystick_nr = config_get_int(cat, temps, 0); if (joystick_state[c].plat_joystick_nr) { for (d = 0; d < joystick_get_axis_count(joystick_type); d++) { - sprintf(s, "joystick_%i_axis_%i", c, d); - joystick_state[c].axis_mapping[d] = config_get_int("Input devices", s, d); + sprintf(temps, "joystick_%i_axis_%i", c, d); + joystick_state[c].axis_mapping[d] = config_get_int(cat, temps, d); } for (d = 0; d < joystick_get_button_count(joystick_type); d++) { - sprintf(s, "joystick_%i_button_%i", c, d); - joystick_state[c].button_mapping[d] = config_get_int("Input devices", s, d); + sprintf(temps, "joystick_%i_button_%i", c, d); + joystick_state[c].button_mapping[d] = config_get_int(cat, temps, d); } for (d = 0; d < joystick_get_pov_count(joystick_type); d++) { - sprintf(s, "joystick_%i_pov_%i", c, d); - p = (char *)config_get_string("Input devices", s, "0, 0"); + sprintf(temps, "joystick_%i_pov_%i", c, d); + p = config_get_string(cat, temps, "0, 0"); joystick_state[c].pov_mapping[d][0] = joystick_state[c].pov_mapping[d][1] = 0; sscanf(p, "%i, %i", &joystick_state[c].pov_mapping[d][0], &joystick_state[c].pov_mapping[d][1]); } @@ -748,37 +771,41 @@ static void loadconfig_input_devices(void) } } + +/* Sound */ static void loadconfig_sound(void) { + char *cat = "Sound"; char *p; - /* Sound */ - p = (char *)config_get_string("Sound", "sndcard", ""); - if (p) + p = config_get_string(cat, "sndcard", NULL); + if (p != NULL) sound_card_current = sound_card_get_from_internal_name(p); else sound_card_current = 0; - midi_id = config_get_int("Sound", "midi_host_device", 0); + midi_id = config_get_int(cat, "midi_host_device", 0); - SSI2001 = !!config_get_int("Sound", "ssi2001", 0); - GAMEBLASTER = !!config_get_int("Sound", "gameblaster", 0); - GUS = !!config_get_int("Sound", "gus", 0); - opl3_type = !!config_get_int("Sound", "opl3_type", 1); + SSI2001 = !!config_get_int(cat, "ssi2001", 0); + GAMEBLASTER = !!config_get_int(cat, "gameblaster", 0); + GUS = !!config_get_int(cat, "gus", 0); + opl3_type = !!config_get_int(cat, "opl3_type", 1); } + +/* Network */ static void loadconfig_network(void) { + char *cat = "Network"; char *p; - /* Network */ - network_type = config_get_int("Network", "net_type", -1); - memset(pcap_dev, 0, 512); - p = (char *)config_get_string("Network", "net_pcap_device", "none"); - if (p) - if ((network_dev_to_id(p) == -1) || (netdev_num == 1)) + network_type = config_get_int(cat, "net_type", NET_TYPE_NONE); + memset(network_pcap, '\0', sizeof(network_pcap)); + p = config_get_string(cat, "net_pcap_device", "none"); + if (p != NULL) + if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) { - if ((netdev_num == 1) && strcmp(pcap_dev, "none")) + if ((network_ndev == 1) && strcmp(network_pcap, "none")) { msgbox_error(ghwnd, 2107); } @@ -787,59 +814,59 @@ static void loadconfig_network(void) msgbox_error(ghwnd, 2200); } - strcpy(pcap_dev, "none"); + strcpy(network_pcap, "none"); } else { - strcpy(pcap_dev, p); + strcpy(network_pcap, p); } else - strcpy(pcap_dev, "none"); - p = (char *)config_get_string("Network", "net_card", NULL); - network_card = (p) ? network_card_get_from_internal_name(p) : 0; + strcpy(network_pcap, "none"); + p = config_get_string(cat, "net_card", NULL); + if (p != NULL) + network_card = network_card_get_from_internal_name(p); + else + network_card = 0; } + +/* Other peripherals */ static void loadconfig_other_peripherals(void) { - int c; + char *cat = "Other peripherals"; + char temps[512]; char *p; + int c; - /* Other peripherals */ - p = (char *)config_get_string("Other peripherals", "scsicard", ""); - if (p) + p = config_get_string(cat, "scsicard", NULL); + if (p != NULL) scsi_card_current = scsi_card_get_from_internal_name(p); else scsi_card_current = 0; - memset(hdd_controller_name, 0, 16); - p = (char *)config_get_string("Other peripherals", "hdd_controller", ""); - if (p) + memset(hdd_controller_name, '\0', sizeof(hdd_controller_name)); + p = config_get_string(cat, "hdd_controller", NULL); + if (p != NULL) strcpy(hdd_controller_name, p); else strcpy(hdd_controller_name, "none"); - memset(temps, 0, 512); + memset(temps, '\0', sizeof(temps)); for (c = 2; c < 4; c++) { sprintf(temps, "ide_%02i", c + 1); - p = config_get_string("Other peripherals", temps, "0, 00"); - if (p) - { - sscanf(p, "%i, %02i", &ide_enable[c], &ide_irq[c]); - } - else - { - sscanf(p, "0, 00", &ide_enable[c], &ide_irq[c]); - } + p = config_get_string(cat, temps, NULL); + if (p == NULL) + p = "0, 00"; + sscanf(p, "%i, %02i", &ide_enable[c], &ide_irq[c]); } - serial_enabled[0] = !!config_get_int("Other peripherals", "serial1_enabled", 1); - serial_enabled[1] = !!config_get_int("Other peripherals", "serial2_enabled", 1); - lpt_enabled = !!config_get_int("Other peripherals", "lpt_enabled", 1); - bugger_enabled = !!config_get_int("Other peripherals", "bugger_enabled", 0); + serial_enabled[0] = !!config_get_int(cat, "serial1_enabled", 1); + serial_enabled[1] = !!config_get_int(cat, "serial2_enabled", 1); + lpt_enabled = !!config_get_int(cat, "lpt_enabled", 1); + bugger_enabled = !!config_get_int(cat, "bugger_enabled", 0); } -static char temps2[512]; static int config_string_to_bus(char *str, int cdrom) { @@ -917,26 +944,26 @@ no_mfm_cdrom: return 0; } + +/* Hard disks */ static void loadconfig_hard_disks(void) { + char *cat = "Hard disks"; + char temps[512]; + char temps2[512]; + char s[512]; int c; char *p; wchar_t *wp; - /* Hard disks */ - memset(temps, 0, 512); + memset(temps, '\0', sizeof(temps)); for (c = 0; c < HDC_NUM; c++) { sprintf(temps, "hdd_%02i_parameters", c + 1); - p = (char *)config_get_string("Hard disks", temps, "0, 0, 0, none"); - if (p) - { - sscanf(p, "%" PRIu64 ", %" PRIu64", %" PRIu64 ", %s", &hdc[c].spt, &hdc[c].hpc, &hdc[c].tracks, s); - } - else - { - sscanf("0, 0, 0, none", "%" PRIu64 ", %" PRIu64", %" PRIu64 ", %s", &hdc[c].spt, &hdc[c].hpc, &hdc[c].tracks, s); - } + p = config_get_string(cat, temps, NULL); + if (p == NULL) + p = "0, 0, 0, none"; + sscanf(p, "%" PRIu64 ", %" PRIu64", %" PRIu64 ", %s", &hdc[c].spt, &hdc[c].hpc, &hdc[c].tracks, s); hdc[c].bus = config_string_to_bus(s, 0); @@ -954,14 +981,14 @@ static void loadconfig_hard_disks(void) } sprintf(temps, "hdd_%02i_mfm_channel", c + 1); - hdc[c].mfm_channel = config_get_int("Hard disks", temps, 0); + hdc[c].mfm_channel = config_get_int(cat, temps, 0); if (hdc[c].mfm_channel > 1) { hdc[c].mfm_channel = 1; } sprintf(temps, "hdd_%02i_ide_channel", c + 1); - hdc[c].ide_channel = config_get_int("Hard disks", temps, 0); + hdc[c].ide_channel = config_get_int(cat, temps, 0); if (hdc[c].ide_channel > 7) { hdc[c].ide_channel = 7; @@ -969,13 +996,14 @@ static void loadconfig_hard_disks(void) sprintf(temps, "hdd_%02i_scsi_location", c + 1); sprintf(temps2, "%02u:%02u", c, 0); - p = (char *)config_get_string("Hard disks", temps, temps2); - if (p) + p = config_get_string(cat, temps, temps2); + if (p != NULL) { sscanf(p, "%02u:%02u", &hdc[c].scsi_id, &hdc[c].scsi_lun); } else { + /* FIXME: Can never happen, 'temps' above is non-NULL. */ sscanf(temps2, "%02u:%02u", &hdc[c].scsi_id, &hdc[c].scsi_lun); } @@ -990,7 +1018,8 @@ static void loadconfig_hard_disks(void) memset(hdd_fn[c], 0, 1024); sprintf(temps, "hdd_%02i_fn", c + 1); - wp = (wchar_t *)config_get_wstring("Hard disks", temps, L""); + wp = config_get_wstring(cat, temps, L""); + /*FIXME: wcslen(wp) instead of 512? */ if (wp) memcpy(hdd_fn[c], wp, 512); else { memcpy(hdd_fn[c], L"", 2); @@ -999,20 +1028,25 @@ static void loadconfig_hard_disks(void) } } + +/* Removable devices */ static void loadconfig_removable_devices(void) { + char *cat = "Removable devices"; + char temps[512]; + char temps2[512]; + char s[512]; int c; char *p; wchar_t *wp; - /* Removable devices */ for (c = 0; c < FDD_NUM; c++) { sprintf(temps, "fdd_%02i_type", c + 1); - p = (char *)config_get_string("Removable devices", temps, (c < 2) ? "525_2dd" : "none"); + p = config_get_string(cat, temps, (c < 2) ? "525_2dd" : "none"); if (p) fdd_set_type(c, fdd_get_from_internal_name(p)); - else + else /*FIXME: never happens, "none" is non-NULL */ fdd_set_type(c, (c < 2) ? 2 : 0); if (fdd_get_type(c) > 13) { @@ -1020,7 +1054,8 @@ static void loadconfig_removable_devices(void) } sprintf(temps, "fdd_%02i_fn", c + 1); - wp = (wchar_t *)config_get_wstring("Removable devices", temps, L""); + wp = config_get_wstring(cat, temps, L""); + /*FIXME: see above, wcslen(wp) ? */ if (wp) memcpy(discfns[c], wp, 512); else { memcpy(discfns[c], L"", 2); @@ -1028,19 +1063,19 @@ static void loadconfig_removable_devices(void) } printf("Floppy: %ws\n", discfns[c]); sprintf(temps, "fdd_%02i_writeprot", c + 1); - ui_writeprot[c] = !!config_get_int("Removable devices", temps, 0); + ui_writeprot[c] = !!config_get_int(cat, temps, 0); } memset(temps, 0, 512); for (c = 0; c < CDROM_NUM; c++) { sprintf(temps, "cdrom_%02i_host_drive", c + 1); - cdrom_drives[c].host_drive = config_get_int("Removable devices", temps, 0); + cdrom_drives[c].host_drive = config_get_int(cat, temps, 0); cdrom_drives[c].prev_host_drive = cdrom_drives[c].host_drive; sprintf(temps, "cdrom_%02i_parameters", c + 1); - p = (char *)config_get_string("Removable devices", temps, "0, none"); - if (p) + p = config_get_string(cat, temps, NULL); + if (p != NULL) { sscanf(p, "%u, %s", &cdrom_drives[c].sound_on, s); } @@ -1052,7 +1087,7 @@ static void loadconfig_removable_devices(void) cdrom_drives[c].bus_type = config_string_to_bus(s, 1); sprintf(temps, "cdrom_%02i_ide_channel", c + 1); - cdrom_drives[c].ide_channel = config_get_int("Removable devices", temps, c + 2); + cdrom_drives[c].ide_channel = config_get_int(cat, temps, c + 2); if (cdrom_drives[c].ide_channel > 7) { cdrom_drives[c].ide_channel = 7; @@ -1060,12 +1095,12 @@ static void loadconfig_removable_devices(void) sprintf(temps, "cdrom_%02i_scsi_location", c + 1); sprintf(temps2, "%02u:%02u", c + 2, 0); - p = (char *)config_get_string("Removable devices", temps, temps2); - if (p) + p = config_get_string(cat, temps, temps2); + if (p != NULL) { sscanf(p, "%02u:%02u", &cdrom_drives[c].scsi_device_id, &cdrom_drives[c].scsi_device_lun); } - else + else /*FIXME: never happens, 'temps2' is non-NULL */ { sscanf(temps2, "%02u:%02u", &cdrom_drives[c].scsi_device_id, &cdrom_drives[c].scsi_device_lun); } @@ -1081,8 +1116,9 @@ static void loadconfig_removable_devices(void) } sprintf(temps, "cdrom_%02i_image_path", c + 1); - wp = (wchar_t *)config_get_wstring("Removable devices", temps, L""); - if (wp) memcpy(cdrom_image[c].image_path, wp, 512); + wp = config_get_wstring(cat, temps, L""); + /*FIXME see above, wcslen(wp) */ + if (wp != NULL) memcpy(cdrom_image[c].image_path, wp, 512); else { memcpy(cdrom_image[c].image_path, L"", 2); cdrom_image[c].image_path[0] = L'\0'; @@ -1090,12 +1126,12 @@ static void loadconfig_removable_devices(void) } } + void loadconfig(wchar_t *fn) { - if (!fn) - config_load(config_file_default); - else - config_load(fn); + if (fn == NULL) + fn = config_file_default; + config_load(fn); /* General */ loadconfig_general(); @@ -1126,10 +1162,10 @@ void loadconfig(wchar_t *fn) } -wchar_t temp_nvr_path[1024]; wchar_t *nvr_concat(wchar_t *to_concat) { + static wchar_t temp_nvr_path[1024]; char *p; wchar_t *wp; @@ -1144,146 +1180,171 @@ wchar_t *nvr_concat(wchar_t *to_concat) return temp_nvr_path; } -void saveconfig_general(void) + +static void saveconfig_general(void) { - config_set_int("General", "vid_resize", vid_resize); + char *cat = "General"; + char temps[512]; + + config_set_int(cat, "vid_resize", vid_resize); switch(vid_api) { case 0: - config_set_string("General", "vid_renderer", "ddraw"); + config_set_string(cat, "vid_renderer", "ddraw"); break; case 1: default: - config_set_string("General", "vid_renderer", "d3d9"); + config_set_string(cat, "vid_renderer", "d3d9"); break; } - config_set_int("General", "video_fullscreen_scale", video_fullscreen_scale); - config_set_int("General", "video_fullscreen_first", video_fullscreen_first); + config_set_int(cat, "video_fullscreen_scale", video_fullscreen_scale); + config_set_int(cat, "video_fullscreen_first", video_fullscreen_first); - config_set_int("General", "force_43", force_43); - config_set_int("General", "scale", scale); - config_set_int("General", "enable_overscan", enable_overscan); + config_set_int(cat, "force_43", force_43); + config_set_int(cat, "scale", scale); + config_set_int(cat, "enable_overscan", enable_overscan); sprintf(temps, "%i, %i, %i, %i", window_w, window_h, window_x, window_y); - config_set_string("General", "window_coordinates", temps); - config_set_int("General", "window_remember", window_remember); + config_set_string(cat, "window_coordinates", temps); + config_set_int(cat, "window_remember", window_remember); - config_set_wstring("General", "nvr_path", nvr_path); + config_set_wstring(cat, "nvr_path", nvr_path); #ifndef __unix - config_set_hex16("General", "language", dwLanguage); + config_set_hex16(cat, "language", dwLanguage); #endif } -void saveconfig_machine(void) -{ - /* Machine */ - config_set_string("Machine", "model", model_get_internal_name()); - config_set_int("Machine", "cpu_manufacturer", cpu_manufacturer); - config_set_int("Machine", "cpu", cpu); - config_set_int("Machine", "cpu_waitstates", cpu_waitstates); - config_set_int("Machine", "mem_size", mem_size); - config_set_int("Machine", "cpu_use_dynarec", cpu_use_dynarec); - config_set_int("Machine", "cpu_enable_fpu", enable_external_fpu); - config_set_int("Machine", "enable_sync", enable_sync); +/* Machine */ +static void saveconfig_machine(void) +{ + char *cat = "Machine"; + + config_set_string(cat, "model", model_get_internal_name()); + config_set_int(cat, "cpu_manufacturer", cpu_manufacturer); + config_set_int(cat, "cpu", cpu); + config_set_int(cat, "cpu_waitstates", cpu_waitstates); + + config_set_int(cat, "mem_size", mem_size); + config_set_int(cat, "cpu_use_dynarec", cpu_use_dynarec); + config_set_int(cat, "cpu_enable_fpu", enable_external_fpu); + config_set_int(cat, "enable_sync", enable_sync); } -void saveconfig_video(void) + +/* Video */ +static void saveconfig_video(void) { - /* Video */ - config_set_string("Video", "gfxcard", video_get_internal_name(video_old_to_new(gfxcard))); - config_set_int("Video", "video_speed", video_speed); - config_set_int("Video", "voodoo", voodoo_enabled); + char *cat = "Video"; + + config_set_string(cat, "gfxcard", video_get_internal_name(video_old_to_new(gfxcard))); + config_set_int(cat, "video_speed", video_speed); + config_set_int(cat, "voodoo", voodoo_enabled); } -void saveconfig_input_devices(void) + +/* Input devices */ +static void saveconfig_input_devices(void) { + char *cat = "Input devices"; + char temps[512]; + char s[512]; int c, d; - /* Input devices */ - config_set_string("Input devices", "mouse_type", mouse_get_internal_name(mouse_type)); + config_set_string(cat, "mouse_type", mouse_get_internal_name(mouse_type)); - config_set_int("Input devices", "joystick_type", joystick_type); + config_set_int(cat, "joystick_type", joystick_type); for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++) { sprintf(s, "joystick_%i_nr", c); - config_set_int("Input devices", s, joystick_state[c].plat_joystick_nr); + config_set_int(cat, s, joystick_state[c].plat_joystick_nr); if (joystick_state[c].plat_joystick_nr) { for (d = 0; d < joystick_get_axis_count(joystick_type); d++) { sprintf(s, "joystick_%i_axis_%i", c, d); - config_set_int("Input devices", s, joystick_state[c].axis_mapping[d]); + config_set_int(cat, s, joystick_state[c].axis_mapping[d]); } for (d = 0; d < joystick_get_button_count(joystick_type); d++) { sprintf(s, "joystick_%i_button_%i", c, d); - config_set_int("Input devices", s, joystick_state[c].button_mapping[d]); + config_set_int(cat, s, joystick_state[c].button_mapping[d]); } for (d = 0; d < joystick_get_pov_count(joystick_type); d++) { sprintf(s, "joystick_%i_pov_%i", c, d); sprintf(temps, "%i, %i", joystick_state[c].pov_mapping[d][0], joystick_state[c].pov_mapping[d][1]); - config_set_string("Input devices", s, temps); + config_set_string(cat, s, temps); } } } } -void saveconfig_sound(void) + +/* Sound */ +static void saveconfig_sound(void) { - /* Sound */ - config_set_string("Sound", "sndcard", sound_card_get_internal_name(sound_card_current)); + char *cat = "Sound"; - config_set_int("Sound", "midi_host_device", midi_id); + config_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current)); - config_set_int("Sound", "gameblaster", GAMEBLASTER); - config_set_int("Sound", "gus", GUS); - config_set_int("Sound", "ssi2001", SSI2001); - config_set_int("Sound", "opl3_type", opl3_type); + config_set_int(cat, "midi_host_device", midi_id); + + config_set_int(cat, "gameblaster", GAMEBLASTER); + config_set_int(cat, "gus", GUS); + config_set_int(cat, "ssi2001", SSI2001); + config_set_int(cat, "opl3_type", opl3_type); } -void saveconfig_network(void) + +/* Network */ +static void saveconfig_network(void) { - /* Network */ - if (pcap_dev != NULL) + char *cat = "Network"; + + if (network_pcap[0] != '\0') { - config_set_string("Network", "net_pcap_device", pcap_dev); + config_set_string(cat, "net_pcap_device", network_pcap); } else { - config_set_string("Network", "net_pcap_device", "none"); + config_set_string(cat, "net_pcap_device", "none"); } - config_set_int("Network", "net_type", network_type); - config_set_string("Network", "net_card", network_card_get_internal_name(network_card)); + config_set_int(cat, "net_type", network_type); + config_set_string(cat, "net_card", network_card_get_internal_name(network_card)); } -void saveconfig_other_peripherals(void) + +/* Other peripherals */ +static void saveconfig_other_peripherals(void) { + char *cat = "Other peripherals"; + char temps[512]; + char temps2[512]; int c, d; - /* Other peripherals */ - config_set_string("Other peripherals", "scsicard", scsi_card_get_internal_name(scsi_card_current)); + config_set_string(cat, "scsicard", scsi_card_get_internal_name(scsi_card_current)); - config_set_string("Other peripherals", "hdd_controller", hdd_controller_name); + config_set_string(cat, "hdd_controller", hdd_controller_name); - memset(temps, 0, 512); + memset(temps, '\0', sizeof(temps)); for (c = 2; c < 4; c++) { sprintf(temps, "ide_%02i", c + 1); sprintf(temps2, "%i, %02i", !!ide_enable[c], ide_irq[c]); - config_set_string("Other peripherals", temps, temps2); + config_set_string(cat, temps, temps2); } - config_set_int("Other peripherals", "serial1_enabled", serial_enabled[0]); - config_set_int("Other peripherals", "serial2_enabled", serial_enabled[1]); - config_set_int("Other peripherals", "lpt_enabled", lpt_enabled); - config_set_int("Other peripherals", "bugger_enabled", bugger_enabled); + config_set_int(cat, "serial1_enabled", serial_enabled[0]); + config_set_int(cat, "serial2_enabled", serial_enabled[1]); + config_set_int(cat, "lpt_enabled", lpt_enabled); + config_set_int(cat, "bugger_enabled", bugger_enabled); } + static char *config_bus_to_string(int bus) { switch (bus) @@ -1307,74 +1368,84 @@ static char *config_bus_to_string(int bus) } } -void saveconfig_hard_disks(void) + +/* Hard disks */ +static void saveconfig_hard_disks(void) { + char *cat = "Hard disks"; + char temps[512]; + char temps2[512]; + char s[512]; int c, d; char *p; - /* Hard disks */ - memset(temps, 0, 512); + memset(temps, '\0', sizeof(temps)); for (c = 0; c < HDC_NUM; c++) { sprintf(temps, "hdd_%02i_parameters", c + 1); - memset(s, 0, 512); + memset(s, '\0', sizeof(s)); p = config_bus_to_string(hdc[c].bus); sprintf(temps2, "%" PRIu64 ", %" PRIu64", %" PRIu64 ", %s", hdc[c].spt, hdc[c].hpc, hdc[c].tracks, p); - config_set_string("Hard disks", temps, temps2); + config_set_string(cat, temps, temps2); sprintf(temps, "hdd_%02i_mfm_channel", c + 1); - config_set_int("Hard disks", temps, hdc[c].mfm_channel); + config_set_int(cat, temps, hdc[c].mfm_channel); sprintf(temps, "hdd_%02i_ide_channel", c + 1); - config_set_int("Hard disks", temps, hdc[c].ide_channel); + config_set_int(cat, temps, hdc[c].ide_channel); sprintf(temps, "hdd_%02i_scsi_location", c + 1); sprintf(temps2, "%02u:%02u", hdc[c].scsi_id, hdc[c].scsi_lun); - config_set_string("Hard disks", temps, temps2); + config_set_string(cat, temps, temps2); sprintf(temps, "hdd_%02i_fn", c + 1); - config_set_wstring("Hard disks", temps, hdd_fn[c]); + config_set_wstring(cat, temps, hdd_fn[c]); } } -void saveconfig_removable_devices(void) + +/* Removable devices */ +static void saveconfig_removable_devices(void) { + char *cat = "Removable devices"; + char temps[512]; + char temps2[512]; int c, d; - /* Removable devices */ - memset(temps, 0, 512); + memset(temps, '\0', sizeof(temps)); for (c = 0; c < FDD_NUM; c++) { sprintf(temps, "fdd_%02i_type", c + 1); - config_set_string("Removable devices", temps, fdd_get_internal_name(fdd_get_type(c))); + config_set_string(cat, temps, fdd_get_internal_name(fdd_get_type(c))); sprintf(temps, "fdd_%02i_fn", c + 1); - config_set_wstring("Removable devices", temps, discfns[c]); + config_set_wstring(cat, temps, discfns[c]); sprintf(temps, "fdd_%02i_writeprot", c + 1); - config_set_int("Removable devices", temps, ui_writeprot[c]); + config_set_int(cat, temps, ui_writeprot[c]); } - memset(temps, 0, 512); + memset(temps, '\0', sizeof(temps)); for (c = 0; c < CDROM_NUM; c++) { sprintf(temps, "cdrom_%02i_host_drive", c + 1); - config_set_int("Removable devices", temps, cdrom_drives[c].host_drive); + config_set_int(cat, temps, cdrom_drives[c].host_drive); sprintf(temps, "cdrom_%02i_parameters", c + 1); sprintf(temps2, "%u, %s", cdrom_drives[c].sound_on, config_bus_to_string(cdrom_drives[c].bus_type)); - config_set_string("Removable devices", temps, temps2); + config_set_string(cat, temps, temps2); sprintf(temps, "cdrom_%02i_ide_channel", c + 1); - config_set_int("Removable devices", temps, cdrom_drives[c].ide_channel); + config_set_int(cat, temps, cdrom_drives[c].ide_channel); sprintf(temps, "cdrom_%02i_scsi_location", c + 1); sprintf(temps2, "%02u:%02u", cdrom_drives[c].scsi_device_id, cdrom_drives[c].scsi_device_lun); - config_set_string("Removable devices", temps, temps2); + config_set_string(cat, temps, temps2); sprintf(temps, "cdrom_%02i_image_path", c + 1); - config_set_wstring("Removable devices", temps, cdrom_image[c].image_path); + config_set_wstring(cat, temps, cdrom_image[c].image_path); } } + void saveconfig(void) { int c, d; diff --git a/src/config.h b/src/config.h index 766257f37..fb33cd98d 100644 --- a/src/config.h +++ b/src/config.h @@ -1,37 +1,39 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ -int config_get_int(char *head, char *name, int def); -char *config_get_string(char *head, char *name, char *def); -wchar_t *config_get_wstring(char *head, char *name, wchar_t *def); -void config_set_int(char *head, char *name, int val); -void config_set_string(char *head, char *name, char *val); -void config_set_wstring(char *head, char *name, wchar_t *val); -char *get_filename(char *s); -wchar_t *get_filename_w(wchar_t *s); -void 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); -void put_backslash(char *s); -void put_backslash_w(wchar_t *s); -char *get_extension(char *s); + +extern wchar_t config_file_default[256]; + #ifdef __cplusplus extern "C" { #endif -wchar_t *get_extension_w(wchar_t *s); +extern int config_get_int(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_set_int(char *head, char *name, int val); +extern void config_set_string(char *head, char *name, char *val); +extern void config_set_wstring(char *head, char *name, wchar_t *val); + +extern char *get_filename(char *s); +extern wchar_t *get_filename_w(wchar_t *s); +extern void append_filename(char *dest, char *s1, char *s2, int size); +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 void 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 } #endif - -void config_load(wchar_t *fn); -void config_save(wchar_t *fn); -void config_dump(void); -void config_free(void); - -extern wchar_t config_file_default[256]; - -void loadconfig(wchar_t *fn); -void saveconfig(void); diff --git a/src/gameport.c b/src/gameport.c index b75e9f6ce..a80d962b7 100644 --- a/src/gameport.c +++ b/src/gameport.c @@ -8,12 +8,12 @@ #include "device.h" #include "io.h" #include "timer.h" -#include "plat-joystick.h" #include "gameport.h" #include "joystick_ch_flightstick_pro.h" #include "joystick_standard.h" #include "joystick_sw_pad.h" #include "joystick_tm_fcs.h" +#include "plat_joystick.h" int joystick_type; diff --git a/src/joystick_ch_flightstick_pro.c b/src/joystick_ch_flightstick_pro.c index 9f0e97250..9697c1c6a 100644 --- a/src/joystick_ch_flightstick_pro.c +++ b/src/joystick_ch_flightstick_pro.c @@ -4,7 +4,8 @@ #include "timer.h" #include "gameport.h" #include "joystick_standard.h" -#include "plat-joystick.h" +#include "plat_joystick.h" + static void *ch_flightstick_pro_init() { diff --git a/src/joystick_standard.c b/src/joystick_standard.c index 7c8098ba7..c73260cac 100644 --- a/src/joystick_standard.c +++ b/src/joystick_standard.c @@ -4,7 +4,8 @@ #include "timer.h" #include "gameport.h" #include "joystick_standard.h" -#include "plat-joystick.h" +#include "plat_joystick.h" + static void *joystick_standard_init() { diff --git a/src/joystick_sw_pad.c b/src/joystick_sw_pad.c index 5fce2447a..d256c290f 100644 --- a/src/joystick_sw_pad.c +++ b/src/joystick_sw_pad.c @@ -26,7 +26,8 @@ #include "timer.h" #include "gameport.h" #include "joystick_sw_pad.h" -#include "plat-joystick.h" +#include "plat_joystick.h" + typedef struct { diff --git a/src/joystick_tm_fcs.c b/src/joystick_tm_fcs.c index a60e0ca5d..1380c052d 100644 --- a/src/joystick_tm_fcs.c +++ b/src/joystick_tm_fcs.c @@ -4,7 +4,8 @@ #include "timer.h" #include "gameport.h" #include "joystick_standard.h" -#include "plat-joystick.h" +#include "plat_joystick.h" + static void *tm_fcs_init() { diff --git a/src/keyboard.c b/src/keyboard.c index 22924f504..75ec25887 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2,7 +2,7 @@ see COPYING for more details */ #include "ibm.h" -#include "plat-keyboard.h" +#include "plat_keyboard.h" #include "keyboard.h" int keybsendcallback = 0; diff --git a/src/mouse_bus.c b/src/mouse_bus.c index ca2c4f80a..5d5d5e97e 100644 --- a/src/mouse_bus.c +++ b/src/mouse_bus.c @@ -32,7 +32,7 @@ * Based on an early driver for MINIX 1.5. * Based on the 86Box PS/2 mouse driver as a framework. * - * Version: @(#)mouse_bus.c 1.0.4 2017/05/06 + * Version: @(#)mouse_bus.c 1.0.4 2017/05/17 * * Author: Fred N. van Kempen, * Copyright 1989-2017 Fred N. van Kempen. @@ -44,7 +44,7 @@ #include "pic.h" #include "mouse.h" #include "mouse_bus.h" -#include "plat-mouse.h" +#include "plat_mouse.h" #define ENABLE_3BTN 1 /* enable 3-button mode */ diff --git a/src/mouse_ps2.c b/src/mouse_ps2.c index fa9eda980..d5627eda8 100644 --- a/src/mouse_ps2.c +++ b/src/mouse_ps2.c @@ -3,7 +3,8 @@ #include "keyboard_at.h" #include "mouse.h" #include "mouse_ps2.h" -#include "plat-mouse.h" +#include "plat_mouse.h" + int mouse_scan = 0; diff --git a/src/net_ne2000.c b/src/net_ne2000.c index 0a4a66781..51fdd7b4e 100644 --- a/src/net_ne2000.c +++ b/src/net_ne2000.c @@ -11,7 +11,7 @@ * NOTE: Its still a mess, but we're getting there. The file will * also implement an NE1000 for 8-bit ISA systems. * - * Version: @(#)net_ne2000.c 1.0.3 2017/05/12 + * Version: @(#)net_ne2000.c 1.0.4 2017/05/17 * * Authors: Fred N. van Kempen, * Peter Grehan, grehan@iprg.nokia.com> @@ -49,9 +49,6 @@ typedef union { } bar_t; -/* This stuff should go into the struct. --FvK */ -static uint8_t maclocal[6] = {0xac, 0xde, 0x48, 0x88, 0xbb, 0xaa}; -static uint8_t maclocal_pci[6] = {0xac, 0xde, 0x48, 0x88, 0xbb, 0xaa}; #if ENABLE_NE2000_LOG static int nic_do_log = ENABLE_NE2000_LOG; #else @@ -216,6 +213,7 @@ typedef struct { int disable_netbios; int tx_timer_index; int tx_timer_active; + uint8_t maclocal[6]; /* configured MAC (local) address */ uint8_t pci_regs[256]; uint8_t eeprom[128]; /* for RTL8029AS */ rom_t bios_rom; @@ -1767,14 +1765,15 @@ nic_rom_init(nic_t *dev, wchar_t *s) } -uint32_t -ne2000_get_maclocal(void) +/* Return the 'local' part of our configured MAC address. */ +static uint32_t +nic_get_maclocal(nic_t *dev) { uint32_t temp; - temp = (((int) maclocal[3]) << 16); - temp |= (((int) maclocal[4]) << 8); - temp |= ((int) maclocal[5]); + temp = (((int) dev->maclocal[3]) << 16); + temp |= (((int) dev->maclocal[4]) << 8); + temp |= ((int) dev->maclocal[5]); return(temp); } @@ -1784,23 +1783,17 @@ static void * nic_init(int board) { uint32_t mac; - uint8_t *ptr; nic_t *dev; dev = malloc(sizeof(nic_t)); memset(dev, 0x00, sizeof(nic_t)); dev->board = board; dev->is_rtl8029as = (PCI && (board == NE2K_RTL8029AS)) ? 1 : 0; - if (board == NE2K_RTL8029AS) - { + if (board == NE2K_RTL8029AS) { strcpy(dev->name, "RTL8029AS"); - } - else if (board == NE2K_NE1000) - { + } else if (board == NE2K_NE1000) { strcpy(dev->name, "NE1000"); - } - else - { + } else { strcpy(dev->name, "NE2000"); } @@ -1812,32 +1805,35 @@ nic_init(int board) dev->base_address = device_get_config_int("addr"); } + /* See if we have a local MAC address configured. */ mac = device_get_config_int_ex("mac", -1); /* Set up our MAC address. */ if (dev->is_rtl8029as) { - maclocal[0] = 0x00; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */ - maclocal[1] = 0x20; - maclocal[2] = 0x18; + dev->maclocal[0] = 0x00; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */ + dev->maclocal[1] = 0x20; + dev->maclocal[2] = 0x18; } else { - maclocal[0] = 0x00; /* 00:00:D8 (NE2000 ISA vendor prefix). */ - maclocal[1] = 0x00; - maclocal[2] = 0xD8; + dev->maclocal[0] = 0x00; /* 00:00:D8 (NE2000 ISA vendor prefix). */ + dev->maclocal[1] = 0x00; + dev->maclocal[2] = 0xD8; } - ptr = maclocal; -pclog(1, "MAClocal: mac=%08lx\n", mac); if (mac & 0xff000000) { /* Generating new MAC. */ - ptr[3] = disc_random_generate(); - ptr[4] = disc_random_generate(); - ptr[5] = disc_random_generate() | 1; - device_set_config_int("mac", ne2000_get_maclocal()); + dev->maclocal[3] = disc_random_generate(); + dev->maclocal[4] = disc_random_generate(); + dev->maclocal[5] = disc_random_generate() | 1; + device_set_config_int("mac", nic_get_maclocal(dev)); } else { - ptr[3] = (mac>>16) & 0xff; - ptr[4] = (mac>>8) & 0xff; - ptr[5] = (mac & 0xff) | 1; + dev->maclocal[3] = (mac>>16) & 0xff; + dev->maclocal[4] = (mac>>8) & 0xff; +#if 1 + dev->maclocal[5] = (mac & 0xfe); +#else + dev->maclocal[5] = (mac & 0xff) | 1; +#endif } - memcpy(dev->physaddr, ptr, 6); + memcpy(dev->physaddr, dev->maclocal, sizeof(dev->maclocal)); pclog(1,"%s: I/O=%04x, IRQ=%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x BIOS=%d\n", dev->name, dev->base_address, dev->base_irq, diff --git a/src/net_ne2000.h b/src/net_ne2000.h index 4ff2fd0f6..44dcc3311 100644 --- a/src/net_ne2000.h +++ b/src/net_ne2000.h @@ -8,7 +8,7 @@ * * Definitions for the NE2000 ethernet controller. * - * Version: @(#)net_ne2000.h 1.0.2 2017/05/11 + * Version: @(#)net_ne2000.h 1.0.3 2017/05/17 * * Author: Fred N. van Kempen, */ @@ -26,11 +26,4 @@ extern device_t ne2000_device; extern device_t rtl8029as_device; -extern void ne2000_generate_maclocal(uint32_t mac); -extern uint32_t ne2000_get_maclocal(void); - -extern void ne2000_generate_maclocal_pci(uint32_t mac); -extern uint32_t ne2000_get_maclocal_pci(void); - - #endif /*NET_NE2000_H*/ diff --git a/src/net_pcap.c b/src/net_pcap.c index 459e04c71..5eb57bb4c 100644 --- a/src/net_pcap.c +++ b/src/net_pcap.c @@ -8,7 +8,7 @@ * * Handle WinPcap library processing. * - * Version: @(#)net_pcap.c 1.0.1 2017/05/11 + * Version: @(#)net_pcap.c 1.0.2 2017/05/17 * * Author: Fred N. van Kempen, */ @@ -29,9 +29,6 @@ static thread_t *poll_tid; static NETRXCB poll_rx; /* network RX function to call */ static void *poll_arg; /* network RX function arg */ - int netdev_num; - netdev_t netdev_list[512]; - #ifdef WALTJE int pcap_do_log = 1; @@ -108,8 +105,6 @@ poll_thread(void *arg) } -char pcap_dev[512]; - /* Initialize WinPcap for us. */ int network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg) @@ -135,11 +130,12 @@ network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg) pclog("Initializing WinPcap, version %s\n", temp); /* Get the value of our capture interface. */ - if (pcap_dev == NULL) { + dev = network_pcap; + if ((dev[0] == '\0') || !strcmp(dev, "none")) { pclog(" No network device configured!\n"); return(-1); } - pclog(" Network interface: '%s'\n", pcap_dev); + pclog(" Network interface: '%s'\n", dev); pcap = pcap_open_live(dev, /* interface name */ 1518, /* maximum packet size */ @@ -227,16 +223,15 @@ network_devlist(netdev_t *list) pcap_if_t *devlist, *dev; int i = 0; - /* Note by Kotori: Add the first (and guaranteed to be always present) device - "None". */ + /* Create a first entry that's always there - needed by UI. */ strcpy(list->device, "none"); strcpy(list->description, "None"); - list++; - i++; + list++; i++; /* Retrieve the device list from the local machine */ if (pcap_findalldevs(&devlist, errbuf) == -1) { - pclog("NETWORK: error in pcap_findalldevs_ex: %s\n", errbuf); - return(i); /* Note by Kotori: The list will always have at least one entry - "None". */ + pclog("NETWORK: error in pcap_findalldevs: %s\n", errbuf); + return(i); } for (dev=devlist; dev!=NULL; dev=dev->next) { @@ -245,8 +240,7 @@ network_devlist(netdev_t *list) strcpy(list->description, dev->description); else memset(list->description, '\0', sizeof(list->description)); - list++; - i++; + list++; i++; } /* Release the memory. */ @@ -254,19 +248,3 @@ network_devlist(netdev_t *list) return(i); } - -int network_dev_to_id(char *dev) -{ - int i = 0; - - for (i = 0; i < netdev_num; i++) - { - if (!strcmp(netdev_list[i].device, dev)) - { - return i; - } - } - - /* If the device does not match the list, consider it as if it was set to "none". */ - return 0; -} \ No newline at end of file diff --git a/src/net_slirp.c b/src/net_slirp.c index 43574eccf..ca1d42869 100644 --- a/src/net_slirp.c +++ b/src/net_slirp.c @@ -8,7 +8,7 @@ * * Handle SLiRP library processing. * - * Version: @(#)net_slirp.c 1.0.1 2017/05/11 + * Version: @(#)net_slirp.c 1.0.2 2017/05/17 * * Author: Fred N. van Kempen, */ @@ -29,7 +29,6 @@ static queueADT slirpq; /* SLiRP library handle */ static thread_t *poll_tid; static NETRXCB poll_rx; /* network RX function to call */ static void *poll_arg; /* network RX function arg */ -static int fizz; /* Instead of calling this and crashing some times @@ -38,27 +37,29 @@ static int fizz; static void slirp_tic(void) { - int ret2,nfds; + int ret2, nfds; struct timeval tv; fd_set rfds, wfds, xfds; int tmo; - nfds=-1; + /* Let SLiRP create a list of all open sockets. */ + nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); tmo = slirp_select_fill(&nfds, &rfds, &wfds, &xfds); /* this can crash */ - if (tmo < 0) { + if (tmo < 0) tmo = 500; - } tv.tv_sec = 0; - tv.tv_usec = tmo; /* basilisk default 10000 */ + tv.tv_usec = tmo; + /* Now wait for something to happen, or at most 'tmo' usec. */ ret2 = select(nfds+1, &rfds, &wfds, &xfds, &tv); - if (ret2 >= 0) { + + /* If something happened, let SLiRP handle it. */ + if (ret2 >= 0) slirp_select_poll(&rfds, &wfds, &xfds); - } } @@ -77,10 +78,8 @@ poll_thread(void *arg) pclog("SLiRP: poll event is %08lx\n", evt); while (slirpq != NULL) { - if (++fizz > 1200) { - fizz = 0; - slirp_tic(); - } + /* See if there is any work. */ + slirp_tic(); /* Wait for the next packet to arrive. */ if (QueuePeek(slirpq) == 0) { @@ -124,8 +123,6 @@ network_slirp_setup(uint8_t *mac, NETRXCB func, void *arg) slirpq = QueueCreate(); pclog(" Packet queue is at %08lx\n", &slirpq); - fizz = 0; - /* Save the callback info. */ poll_rx = func; poll_arg = arg; diff --git a/src/network.c b/src/network.c index 7d1d6e98f..63a8c0f9d 100644 --- a/src/network.c +++ b/src/network.c @@ -12,7 +12,7 @@ * it should be malloc'ed and then linked to the NETCARD def. * Will be done later. * - * Version: @(#)network.c 1.0.3 2017/05/12 + * Version: @(#)network.c 1.0.4 2017/05/17 * * Authors: Kotori, * Fred N. van Kempen, @@ -41,8 +41,12 @@ static netcard_t net_cards[] = { }; -int network_card; -int network_type; +/* Global variables. */ +int network_card; +int network_type; +int network_ndev; +netdev_t network_devs[32]; +char network_pcap[512]; /* @@ -55,8 +59,11 @@ int network_type; void network_init(void) { + network_type = NET_TYPE_NONE; network_card = 0; - network_type = -1; + + /* Initialize list of PCap devices. */ + network_ndev = network_devlist(network_devs); } @@ -80,11 +87,11 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx) /* Start the platform module. */ switch(network_type) { - case 0: + case NET_TYPE_PCAP: ret = network_pcap_setup(mac, rx, dev); break; - case 1: + case NET_TYPE_SLIRP: ret = network_slirp_setup(mac, rx, dev); break; } @@ -98,11 +105,11 @@ void network_close(void) { switch(network_type) { - case 0: + case NET_TYPE_PCAP: network_pcap_close(); break; - case 1: + case NET_TYPE_SLIRP: network_slirp_close(); break; } @@ -127,10 +134,11 @@ network_reset(void) network_close(); /* If no active card, we're done. */ - if (!network_card || (network_type<0)) return; + if ((network_type==NET_TYPE_NONE) || (network_card==0)) return; pclog("NETWORK: set up for %s, card=%s\n", - (network_type==1)?"SLiRP":"WinPcap", net_cards[network_card].name); + (network_type==NET_TYPE_SLIRP)?"SLiRP":"WinPcap", + net_cards[network_card].name); pclog("NETWORK: reset (card=%d)\n", network_card); /* Add the (new?) card to the I/O system. */ @@ -147,11 +155,11 @@ void network_tx(uint8_t *bufp, int len) { switch(network_type) { - case 0: + case NET_TYPE_PCAP: network_pcap_in(bufp, len); break; - case 1: + case NET_TYPE_SLIRP: network_slirp_in(bufp, len); break; } @@ -217,3 +225,19 @@ network_card_get_from_internal_name(char *s) return(-1); } + + +int +network_dev_to_id(char *dev) +{ + int i = 0; + + for (i=0; i * Fred N. van Kempen, @@ -18,6 +18,12 @@ # include +/* Network provider types. */ +#define NET_TYPE_NONE 0 /* networking disabled */ +#define NET_TYPE_PCAP 1 /* use the (Win)Pcap API */ +#define NET_TYPE_SLIRP 2 /* use the SLiRP port forwarder */ + +/* Supported network cards. */ #define NE1000 1 #define NE2000 2 #define RTL8029AS 3 @@ -44,11 +50,9 @@ typedef struct { /* Global variables. */ extern int network_card; extern int network_type; - -extern char pcap_dev[512]; - -extern int netdev_num; -extern netdev_t netdev_list[512]; +extern int network_ndev; +extern netdev_t network_devs[32]; +extern char network_pcap[512]; /* Function prototypes. */ @@ -68,13 +72,13 @@ extern void network_slirp_close(void); extern void network_slirp_in(uint8_t *, int); extern int network_devlist(netdev_t *); +extern int network_dev_to_id(char *); extern int network_card_available(int); extern char *network_card_getname(int); extern int network_card_has_config(int); extern char *network_card_get_internal_name(int); extern int network_card_get_from_internal_name(char *); -extern struct device_t *network_card_getdevice(int); +extern device_t *network_card_getdevice(int); - int network_dev_to_id(char *dev); #endif /*NETWORK_H*/ diff --git a/src/pc.c b/src/pc.c index 9fced90fb..7e05e9260 100644 --- a/src/pc.c +++ b/src/pc.c @@ -18,8 +18,6 @@ #include "device.h" #include "ali1429.h" -#include "cdrom.h" -#include "cdrom-ioctl.h" #include "disc.h" #include "disc_86f.h" #include "disc_fdi.h" @@ -31,20 +29,21 @@ #include "fdc.h" #include "fdd.h" #include "gameport.h" -#include "plat-joystick.h" -#include "plat-midi.h" +#include "plat_joystick.h" +#include "plat_midi.h" #include "hdd.h" #include "ide.h" #include "cdrom.h" -#include "cdrom-image.h" -#include "cdrom-null.h" +#include "cdrom_ioctl.h" +#include "cdrom_image.h" +#include "cdrom_null.h" #include "scsi.h" #include "keyboard.h" -#include "plat-keyboard.h" +#include "plat_keyboard.h" #include "keyboard_at.h" #include "model.h" #include "mouse.h" -#include "plat-mouse.h" +#include "plat_mouse.h" #include "network.h" #include "serial.h" #include "sound/sound.h" @@ -60,7 +59,7 @@ #include "amstrad.h" #ifdef WALTJE # define UNICODE -# include "plat-dir.h" +# include "plat_dir.h" #endif #ifndef __unix @@ -69,7 +68,7 @@ #include #undef BITMAP #include "win.h" -#include "win-language.h" +#include "win_language.h" #endif @@ -288,9 +287,6 @@ void initpc(int argc, wchar_t *argv[]) *p=L'\0'; pclog("path = %ws\n", pcempath); - /* Initialize list of PCap devices. */ - netdev_num = network_devlist(netdev_list); - for (c = 1; c < argc; c++) { if (!_wcsicmp(argv[c], L"--help")) diff --git a/src/ppi.c b/src/ppi.c index 0eb9f3a0f..e5d5a27ec 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -10,9 +10,8 @@ #include "ibm.h" #include "pit.h" - -#include "plat-keyboard.h" -#include "plat-mouse.h" +#include "plat_keyboard.h" +#include "plat_mouse.h" void ppi_reset() { diff --git a/src/serial.c b/src/serial.c index a2b896321..ae376960a 100644 --- a/src/serial.c +++ b/src/serial.c @@ -33,7 +33,7 @@ * * Based on the 86Box serial port driver as a framework. * - * Version: @(#)serial.c 1.0.5 2017/05/07 + * Version: @(#)serial.c 1.0.5 2017/05/17 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. @@ -43,7 +43,7 @@ #include "pic.h" #include "timer.h" #include "serial.h" -#include "plat-serial.h" +#include "plat_serial.h" enum {