diff --git a/Makefile b/Makefile
index 97308990..88332844 100644
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,13 @@ ifeq ($(PLATFORM),)
endif
ifeq ($(PLATFORM),rpi3)
- CPU_FLAGS += -std=gnu++14 -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard
+ CPU_FLAGS += -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard
MORE_CFLAGS += -DARMV6T2 -DUSE_ARMNEON
else ifeq ($(PLATFORM),rpi2)
- CPU_FLAGS += -std=gnu++14 -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard
+ CPU_FLAGS += -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard
MORE_CFLAGS += -DARMV6T2 -DUSE_ARMNEON
else ifeq ($(PLATFORM),rpi1)
- CPU_FLAGS += -std=gnu++14 -march=armv6zk -mfpu=vfp -mfloat-abi=hard
+ CPU_FLAGS += -march=armv6zk -mfpu=vfp -mfloat-abi=hard
endif
NAME = amiberry-sdl2
@@ -32,22 +32,26 @@ SDL_CFLAGS = `sdl2-config --cflags --libs`
DEFS += `xml2-config --cflags`
DEFS += -DARMV6_ASSEMBLY -DAMIBERRY -DCPU_arm
DEFS += -DCAPSLOCK_DEBIAN_WORKAROUND
-DEFS += -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\"
+#DEFS += -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\"
DEFS += -DUSE_SDL
MORE_CFLAGS += -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/guisan/include
-MORE_CFLAGS += -Wno-unused -Wno-format -DGCCCONSTFUNC="__attribute__((const))"
-MORE_CFLAGS += -fexceptions -fpermissive
+MORE_CFLAGS += -fdiagnostics-color=auto
+MORE_CFLAGS += -mstructure-size-boundary=32
+MORE_CFLAGS += -falign-functions=32
+MORE_CFLAGS += -std=gnu++14 -pipe
-LDFLAGS += -lpthread -lm -lz -lpng -lrt -lxml2 -lFLAC -lmpg123 -ldl
+LDFLAGS += -lpthread -lz -lpng -lrt -lxml2 -lFLAC -lmpg123 -ldl -lmpeg2convert -lmpeg2
LDFLAGS += -lSDL2 -lSDL2_image -lSDL2_ttf -lguisan -L/opt/vc/lib -Lsrc/guisan/lib
ifndef DEBUG
-MORE_CFLAGS += -Ofast -pipe -Wno-write-strings
+MORE_CFLAGS += -Ofast -pipe
+MORE_CFLAGS += -fweb -frename-registers
+MORE_CFLAGS += -funroll-loops -ftracer -funswitch-loops
else
-MORE_CFLAGS += -g -DDEBUG -Wl,--export-dynamic
-MORE_CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
-LDFLAGS += -ltcmalloc -lprofiler
+MORE_CFLAGS += -g -rdynamic -funwind-tables -mapcs-frame -DDEBUG -Wl,--export-dynamic
+#MORE_CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
+#LDFLAGS += -ltcmalloc -lprofiler
endif
@@ -57,6 +61,7 @@ CXXFLAGS += $(SDL_CFLAGS) $(CPU_FLAGS) $(DEFS) $(MORE_CFLAGS)
OBJS = \
src/akiko.o \
+ src/ar.o \
src/aros.rom.o \
src/audio.o \
src/autoconf.o \
@@ -67,50 +72,70 @@ OBJS = \
src/blkdev_cdimage.o \
src/bsdsocket.o \
src/calc.o \
+ src/cd32_fmv.o \
+ src/cd32_fmv_genlock.o \
src/cdrom.o \
src/cfgfile.o \
src/cia.o \
src/crc32.o \
src/custom.o \
+ src/def_icons.o \
+ src/devices.o \
src/disk.o \
src/diskutil.o \
src/drawing.o \
src/events.o \
src/expansion.o \
+ src/fdi2raw.o \
src/filesys.o \
+ src/flashrom.o \
src/fpp.o \
+ src/fpp_native.o \
+ src/fpp_softfloat.o \
+ src/softfloat/softfloat.o \
+ src/softfloat/softfloat_decimal.o \
+ src/softfloat/softfloat_fpsp.o \
src/fsdb.o \
src/fsdb_unix.o \
src/fsusage.o \
+ src/gayle.o \
src/gfxboard.o \
src/gfxutil.o \
src/hardfile.o \
+ src/hrtmon.rom.o \
+ src/ide.o \
src/inputdevice.o \
src/keybuf.o \
src/main.o \
src/memory.o \
src/native2amiga.o \
src/rommgr.o \
+ src/rtc.o \
src/savestate.o \
+ src/scsi.o \
src/statusline.o \
src/traps.o \
src/uaelib.o \
src/uaeresource.o \
src/zfile.o \
src/zfile_archive.o \
- src/archivers/7z/7zAlloc.o \
- src/archivers/7z/7zDecode.o \
- src/archivers/7z/7zExtract.o \
- src/archivers/7z/7zHeader.o \
- src/archivers/7z/7zIn.o \
- src/archivers/7z/7zItem.o \
src/archivers/7z/7zBuf.o \
src/archivers/7z/7zCrc.o \
+ src/archivers/7z/7zCrcOpt.o \
+ src/archivers/7z/7zDec.o \
+ src/archivers/7z/7zIn.o \
src/archivers/7z/7zStream.o \
src/archivers/7z/Bcj2.o \
src/archivers/7z/Bra.o \
src/archivers/7z/Bra86.o \
src/archivers/7z/LzmaDec.o \
+ src/archivers/7z/Lzma2Dec.o \
+ src/archivers/7z/BraIA64.o \
+ src/archivers/7z/Delta.o \
+ src/archivers/7z/Sha256.o \
+ src/archivers/7z/Xz.o \
+ src/archivers/7z/XzCrc64.o \
+ src/archivers/7z/XzDec.o \
src/archivers/dms/crc_csum.o \
src/archivers/dms/getbits.o \
src/archivers/dms/maketbl.o \
@@ -134,6 +159,7 @@ OBJS = \
src/archivers/lha/uae_lha.o \
src/archivers/lha/util.o \
src/archivers/lzx/unlzx.o \
+ src/archivers/mp2/kjmp2.o \
src/archivers/wrp/warp.o \
src/archivers/zip/unzip.o \
src/machdep/support.o \
@@ -144,6 +170,7 @@ OBJS = \
src/osdep/hardfile_amiberry.o \
src/osdep/keyboard_amiberry.o \
src/osdep/mp3decoder.o \
+ src/osdep/picasso96.o \
src/osdep/writelog.o \
src/osdep/amiberry.o \
src/osdep/amiberry_filesys.o \
@@ -153,14 +180,14 @@ OBJS = \
src/osdep/amiberry_rp9.o \
src/osdep/amiberry_mem.o \
src/osdep/sigsegv_handler.o \
- src/osdep/menu/menu_config.o \
- src/sounddep/sound_sdl_new.o \
+ src/sounddep/sound.o \
src/osdep/gui/UaeRadioButton.o \
src/osdep/gui/UaeDropDown.o \
src/osdep/gui/UaeCheckBox.o \
src/osdep/gui/UaeListBox.o \
src/osdep/gui/InGameMessage.o \
src/osdep/gui/SelectorEntry.o \
+ src/osdep/gui/ShowHelp.o \
src/osdep/gui/ShowMessage.o \
src/osdep/gui/SelectFolder.o \
src/osdep/gui/SelectFile.o \
@@ -168,6 +195,7 @@ OBJS = \
src/osdep/gui/EditFilesysVirtual.o \
src/osdep/gui/EditFilesysHardfile.o \
src/osdep/gui/PanelPaths.o \
+ src/osdep/gui/PanelQuickstart.o \
src/osdep/gui/PanelConfig.o \
src/osdep/gui/PanelCPU.o \
src/osdep/gui/PanelChipset.o \
@@ -183,8 +211,6 @@ OBJS = \
src/osdep/gui/main_window.o \
src/osdep/gui/Navigation.o
-OBJS += src/osdep/picasso96.o
-
ifeq ($(PLATFORM),rpi1)
OBJS += src/osdep/arm_helper.o
else
@@ -199,16 +225,18 @@ OBJS += src/cpustbl.o
OBJS += src/cpuemu_0.o
OBJS += src/cpuemu_4.o
OBJS += src/cpuemu_11.o
+OBJS += src/cpuemu_40.o
+OBJS += src/cpuemu_44.o
OBJS += src/jit/compemu.o
OBJS += src/jit/compstbl.o
OBJS += src/jit/compemu_fpp.o
OBJS += src/jit/compemu_support.o
src/osdep/neon_helper.o: src/osdep/neon_helper.s
- $(CXX) $(CPU_FLAGS) -Wall -o src/osdep/neon_helper.o -c src/osdep/neon_helper.s
+ $(CXX) -falign-functions=32 $(CPU_FLAGS) -Wall -o src/osdep/neon_helper.o -c src/osdep/neon_helper.s
src/osdep/arm_helper.o: src/osdep/arm_helper.s
- $(CXX) $(CPU_FLAGS) -Wall -o src/osdep/arm_helper.o -c src/osdep/arm_helper.s
+ $(CXX) -falign-functions=32 $(CPU_FLAGS) -Wall -o src/osdep/arm_helper.o -c src/osdep/arm_helper.s
$(PROG): $(OBJS)
$(CXX) $(CXXFLAGS) -o $(PROG) $(OBJS) $(LDFLAGS)
@@ -218,3 +246,7 @@ endif
clean:
$(RM) $(PROG) $(OBJS)
+
+bootrom:
+ od -v -t xC -w8 src/filesys |tail -n +5 | sed -e "s,^.......,," -e "s,[0123456789abcdefABCDEF][0123456789abcdefABCDEF],db(0x&);,g" > src/filesys_bootrom.cpp
+ touch src/filesys.cpp
\ No newline at end of file
diff --git a/VSLinux/Amiberry.vcxproj b/VSLinux/Amiberry.vcxproj
index 4cedbdae..7d524080 100644
--- a/VSLinux/Amiberry.vcxproj
+++ b/VSLinux/Amiberry.vcxproj
@@ -51,18 +51,20 @@
- cd ~/projects/Amiberry; make
- cd ~/projects/Amiberry; make clean; make
+ cd ~/projects/Amiberry; make -j4
+ cd ~/projects/Amiberry; make clean; make -j4
cd ~/projects/Amiberry; make clean
- C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\GitHub\amiberry\src\guisan\include;C:\GitHub\amiberry\src\threaddep;C:\GitHub\amiberry\src\osdep;C:\GitHub\amiberry\src;C:\GitHub\amiberry\src\include;$(NMakeIncludeSearchPath)
- DEBUG;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CPU_arm;CAPSLOCK_DEBIAN_WORKAROUND;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions)
+ C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\GitHub\amiberry\src;C:\GitHub\amiberry\src\include;C:\GitHub\amiberry\src\osdep;C:\GitHub\amiberry\src\threaddep;C:\GitHub\amiberry\src\guisan\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;$(NMakeIncludeSearchPath)
+ DEBUG;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CPU_arm;CAPSLOCK_DEBIAN_WORKAROUND;USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions)
+
+
- C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;D:\midwa\Projects\GitHub\amiberry\src\guisan\include;D:\midwa\Projects\GitHub\amiberry\src\threaddep;D:\midwa\Projects\GitHub\amiberry\src\osdep;D:\midwa\Projects\GitHub\amiberry\src;D:\midwa\Projects\GitHub\amiberry\src\include;$(NMakeIncludeSearchPath)
- cd ~/projects/Amiberry; make
- cd ~/projects/Amiberry; make clean; make
+ C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\GitHub\amiberry\src;C:\GitHub\amiberry\src\include;C:\GitHub\amiberry\src\osdep;C:\GitHub\amiberry\src\threaddep;C:\GitHub\amiberry\src\guisan\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;$(NMakeIncludeSearchPath)
+ cd ~/projects/Amiberry; make -j4
+ cd ~/projects/Amiberry; make clean; make -j4
cd ~/projects/Amiberry; make clean
- ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CPU_arm;CAPSLOCK_DEBIAN_WORKAROUND;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions)
+ ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;CPU_arm;CAPSLOCK_DEBIAN_WORKAROUND;USE_SDL;_REENTRANT;$(NMakePreprocessorDefinitions)
@@ -149,18 +151,13 @@
false
-
-
-
-
-
@@ -418,7 +415,6 @@
-
@@ -465,15 +461,9 @@
-
-
-
-
-
-
diff --git a/VSLinux/Amiberry.vcxproj.filters b/VSLinux/Amiberry.vcxproj.filters
index 86ba9691..7f11b0cd 100644
--- a/VSLinux/Amiberry.vcxproj.filters
+++ b/VSLinux/Amiberry.vcxproj.filters
@@ -55,9 +55,6 @@
{b25f6ac8-afcb-45b8-a0fc-f0bc1c88fba1}
-
- {32996091-d9d9-437f-8338-e15198404b91}
-
{767f436f-8275-4c9f-abf9-a880ba80c1f2}
@@ -333,30 +330,12 @@
src
-
- src\archivers\7z
-
src\archivers\7z
src\archivers\7z
-
- src\archivers\7z
-
-
- src\archivers\7z
-
-
- src\archivers\7z
-
-
- src\archivers\7z
-
-
- src\archivers\7z
-
src\archivers\7z
@@ -606,9 +585,6 @@
src\osdep\gui
-
- src\osdep\menu
-
src\sounddep
@@ -762,32 +738,17 @@
src\osdep\gui
+
+ src\archivers\7z
+
-
- src\archivers\7z
-
src\archivers\7z
src\archivers\7z
-
- src\archivers\7z
-
-
- src\archivers\7z
-
-
- src\archivers\7z
-
-
- src\archivers\7z
-
-
- src\archivers\7z
-
src\archivers\7z
diff --git a/VSLinux/Amiberry.vcxproj.user b/VSLinux/Amiberry.vcxproj.user
index 15225acb..799f3f11 100644
--- a/VSLinux/Amiberry.vcxproj.user
+++ b/VSLinux/Amiberry.vcxproj.user
@@ -1,8 +1,8 @@
- ~/projects/amiberry/amiberry-sdl2
- ~/projects/amiberry
+ projects/amiberry/amiberry-sdl2
+ projects/amiberry
LinuxDebugger
diff --git a/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings b/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings
index c7f4f232..aecb317a 100644
--- a/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings
+++ b/VisualGDB/Amiberry/Amiberry-Release.vgdbsettings
@@ -34,6 +34,7 @@
true
true
+
false
false
diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj b/VisualGDB/Amiberry/Amiberry.vcxproj
index 3e58c2ea..c6c259d9 100644
--- a/VisualGDB/Amiberry/Amiberry.vcxproj
+++ b/VisualGDB/Amiberry/Amiberry.vcxproj
@@ -57,12 +57,12 @@
GNUPP14
C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories)
- DEBUG=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
+ DEBUG=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions)
../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories)
- SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames)
+ SDL2;SDL2_image;SDL2_ttf;pthread;z;png;rt;xml2;FLAC;mpg123;dl;guisan;mpeg2convert;mpeg2;%(Link.AdditionalLibraryNames)
-Wl,-gc-sections;%(Link.AdditionalLinkerInputs)
@@ -71,7 +71,7 @@
GNUPP14
C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories)
- NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
+ NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions)
true
true
@@ -79,7 +79,7 @@
-Wl,-gc-sections;%(Link.AdditionalLinkerInputs)
../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories)
- SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;%(Link.AdditionalLibraryNames)
+ SDL2;SDL2_image;SDL2_ttf;pthread;z;png;rt;xml2;FLAC;mpg123;dl;guisan;mpeg2convert;mpeg2;%(Link.AdditionalLibraryNames)
@@ -89,7 +89,7 @@
GNUPP14
C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories)
- NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
+ NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
-march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions)
true
true
@@ -97,7 +97,7 @@
-Wl,-gc-sections;%(Link.AdditionalLinkerInputs)
../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories)
- SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;%(Link.AdditionalLibraryNames)
+ SDL2;SDL2_image;SDL2_ttf;pthread;z;png;rt;xml2;FLAC;mpg123;dl;guisan;mpeg2convert;mpeg2;%(Link.AdditionalLibraryNames)
@@ -108,7 +108,7 @@
GNUPP14
C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories)
- NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
+ NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions)
-march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions)
true
true
@@ -116,7 +116,7 @@
-Wl,-gc-sections;%(Link.AdditionalLinkerInputs)
../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories)
- SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;%(Link.AdditionalLibraryNames)
+ SDL2;SDL2_image;SDL2_ttf;pthread;z;png;rt;xml2;FLAC;mpg123;dl;guisan;mpeg2convert;mpeg2;%(Link.AdditionalLibraryNames)
@@ -130,18 +130,13 @@
-
-
-
-
-
@@ -291,7 +286,6 @@
-
@@ -373,15 +367,9 @@
-
-
-
-
-
-
diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj.filters b/VisualGDB/Amiberry/Amiberry.vcxproj.filters
index 41295ed4..12db2b94 100644
--- a/VisualGDB/Amiberry/Amiberry.vcxproj.filters
+++ b/VisualGDB/Amiberry/Amiberry.vcxproj.filters
@@ -95,9 +95,6 @@
{c55a2e76-0018-4e65-9d5c-199499145eef}
-
- {08cd7b24-548b-44cc-b832-e5c7a01f2527}
-
{d9ec068c-6c88-41d0-ada4-8f8d0eeb19c8}
@@ -486,9 +483,6 @@
Source files\osdep\gui
-
- Source files\osdep\menu
-
Source files\osdep
@@ -522,30 +516,12 @@
Source files\osdep
-
- Source files\archivers\7z
-
Source files\archivers\7z
Source files\archivers\7z
-
- Source files\archivers\7z
-
-
- Source files\archivers\7z
-
-
- Source files\archivers\7z
-
-
- Source files\archivers\7z
-
-
- Source files\archivers\7z
-
Source files\archivers\7z
@@ -714,6 +690,9 @@
Source files\osdep\gui
+
+ Source files\archivers\7z
+
@@ -1260,30 +1239,12 @@
Header files\osdep
-
- Header files\archivers\7z
-
Header files\archivers\7z
Header files\archivers\7z
-
- Header files\archivers\7z
-
-
- Header files\archivers\7z
-
-
- Header files\archivers\7z
-
-
- Header files\archivers\7z
-
-
- Header files\archivers\7z
-
Header files\archivers\7z
diff --git a/src/ar.cpp b/src/ar.cpp
index bc32c4e2..ae9fd529 100644
--- a/src/ar.cpp
+++ b/src/ar.cpp
@@ -206,12 +206,12 @@
#include "options.h"
#include "uae.h"
-#include "memory.h"
+#include "include/memory.h"
#include "rommgr.h"
#include "custom.h"
#include "newcpu.h"
#include "zfile.h"
-#include "ar.h"
+#include "include/ar.h"
#include "savestate.h"
#include "crc32.h"
#include "akiko.h"
diff --git a/src/archivers/7z/7zAlloc.cpp b/src/archivers/7z/7zAlloc.cpp
deleted file mode 100644
index e4825cd4..00000000
--- a/src/archivers/7z/7zAlloc.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* 7zAlloc.c -- Allocation functions
-2010-10-29 : Igor Pavlov : Public domain */
-
-#include "7zAlloc.h"
-
-/* #define _SZ_ALLOC_DEBUG */
-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
-
-#ifdef _SZ_ALLOC_DEBUG
-
-#ifdef _WIN32_
-#include
-#endif
-
-#include
-int g_allocCount = 0;
-int g_allocCountTemp = 0;
-
-#endif
-
-void *SzAlloc(void *p, size_t size)
-{
- p = p;
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
- g_allocCount++;
- #endif
- return malloc(size);
-}
-
-void SzFree(void *p, void *address)
-{
- p = p;
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- {
- g_allocCount--;
- fprintf(stderr, "\nFree; count = %10d", g_allocCount);
- }
- #endif
- free(address);
-}
-
-void *SzAllocTemp(void *p, size_t size)
-{
- p = p;
- if (size == 0)
- return 0;
- #ifdef _SZ_ALLOC_DEBUG
- fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp);
- g_allocCountTemp++;
- #ifdef _WIN32_
- return HeapAlloc(GetProcessHeap(), 0, size);
- #endif
- #endif
- return malloc(size);
-}
-
-void SzFreeTemp(void *p, void *address)
-{
- p = p;
- #ifdef _SZ_ALLOC_DEBUG
- if (address != 0)
- {
- g_allocCountTemp--;
- fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
- }
- #ifdef _WIN32_
- HeapFree(GetProcessHeap(), 0, address);
- return;
- #endif
- #endif
- free(address);
-}
diff --git a/src/archivers/7z/7zAlloc.h b/src/archivers/7z/7zAlloc.h
deleted file mode 100644
index 3344e937..00000000
--- a/src/archivers/7z/7zAlloc.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* 7zAlloc.h -- Allocation functions
-2010-10-29 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_ALLOC_H
-#define __7Z_ALLOC_H
-
-#include
-
-void *SzAlloc(void *p, size_t size);
-void SzFree(void *p, void *address);
-
-void *SzAllocTemp(void *p, size_t size);
-void SzFreeTemp(void *p, void *address);
-
-#endif
diff --git a/src/archivers/7z/7zDecode.cpp b/src/archivers/7z/7zDecode.cpp
deleted file mode 100644
index f18ea9a4..00000000
--- a/src/archivers/7z/7zDecode.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/* 7zDecode.c -- Decoding from 7z folder
-2008-11-23 : Igor Pavlov : Public domain */
-
-#include
-
-#include "Bcj2.h"
-#include "Bra.h"
-#include "LzmaDec.h"
-#include "7zDecode.h"
-
-#define k_Copy 0
-#define k_LZMA 0x30101
-#define k_BCJ 0x03030103
-#define k_BCJ2 0x0303011B
-
-static SRes SzDecodeLzma(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inStream,
- Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain)
-{
- CLzmaDec state;
- SRes res = SZ_OK;
-
- LzmaDec_Construct(&state);
- RINOK(LzmaDec_AllocateProbs(&state, coder->Props.data, unsigned(coder->Props.size), allocMain));
- state.dic = outBuffer;
- state.dicBufSize = outSize;
- LzmaDec_Init(&state);
-
- for (;;)
- {
- Byte *inBuf = nullptr;
- size_t lookahead = (1 << 18);
- if (lookahead > inSize)
- lookahead = size_t(inSize);
- res = inStream->Look((void *)inStream, (void **)&inBuf, &lookahead);
- if (res != SZ_OK)
- break;
-
- {
- SizeT inProcessed = SizeT(lookahead), dicPos = state.dicPos;
- ELzmaStatus status;
- res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);
- lookahead -= inProcessed;
- inSize -= inProcessed;
- if (res != SZ_OK)
- break;
- if (state.dicPos == state.dicBufSize || (inProcessed == 0 && dicPos == state.dicPos))
- {
- if (state.dicBufSize != outSize || lookahead != 0 ||
- (status != LZMA_STATUS_FINISHED_WITH_MARK &&
- status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK))
- res = SZ_ERROR_DATA;
- break;
- }
- res = inStream->Skip((void *)inStream, inProcessed);
- if (res != SZ_OK)
- break;
- }
- }
-
- LzmaDec_FreeProbs(&state, allocMain);
- return res;
- }
-
- static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer)
- {
- while (inSize > 0)
- {
- void *inBuf;
- size_t curSize = (1 << 18);
- if (curSize > inSize)
- curSize = size_t(inSize);
- RINOK(inStream->Look((void *)inStream, (void **)&inBuf, &curSize));
- if (curSize == 0)
- return SZ_ERROR_INPUT_EOF;
- memcpy(outBuffer, inBuf, curSize);
- outBuffer += curSize;
- inSize -= curSize;
- RINOK(inStream->Skip((void *)inStream, curSize));
- }
- return SZ_OK;
- }
-
-#define IS_UNSUPPORTED_METHOD(m) ((m) != k_Copy && (m) != k_LZMA)
-#define IS_UNSUPPORTED_CODER(c) (IS_UNSUPPORTED_METHOD(c.MethodID) || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ(c) (c.MethodID != k_BCJ || c.NumInStreams != 1 || c.NumOutStreams != 1)
-#define IS_NO_BCJ2(c) (c.MethodID != k_BCJ2 || c.NumInStreams != 4 || c.NumOutStreams != 1)
-
- SRes CheckSupportedFolder(const CSzFolder *f)
- {
- if (f->NumCoders < 1 || f->NumCoders > 4)
- return SZ_ERROR_UNSUPPORTED;
- if (IS_UNSUPPORTED_CODER(f->Coders[0]))
- return SZ_ERROR_UNSUPPORTED;
- if (f->NumCoders == 1)
- {
- if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBindPairs != 0)
- return SZ_ERROR_UNSUPPORTED;
- return SZ_OK;
- }
- if (f->NumCoders == 2)
- {
- if (IS_NO_BCJ(f->Coders[1]) ||
- f->NumPackStreams != 1 || f->PackStreams[0] != 0 ||
- f->NumBindPairs != 1 ||
- f->BindPairs[0].InIndex != 1 || f->BindPairs[0].OutIndex != 0)
- return SZ_ERROR_UNSUPPORTED;
- return SZ_OK;
- }
- if (f->NumCoders == 4)
- {
- if (IS_UNSUPPORTED_CODER(f->Coders[1]) ||
- IS_UNSUPPORTED_CODER(f->Coders[2]) ||
- IS_NO_BCJ2(f->Coders[3]))
- return SZ_ERROR_UNSUPPORTED;
- if (f->NumPackStreams != 4 ||
- f->PackStreams[0] != 2 ||
- f->PackStreams[1] != 6 ||
- f->PackStreams[2] != 1 ||
- f->PackStreams[3] != 0 ||
- f->NumBindPairs != 3 ||
- f->BindPairs[0].InIndex != 5 || f->BindPairs[0].OutIndex != 0 ||
- f->BindPairs[1].InIndex != 4 || f->BindPairs[1].OutIndex != 1 ||
- f->BindPairs[2].InIndex != 3 || f->BindPairs[2].OutIndex != 2)
- return SZ_ERROR_UNSUPPORTED;
- return SZ_OK;
- }
- return SZ_ERROR_UNSUPPORTED;
- }
-
- UInt64 GetSum(const UInt64 *values, UInt32 index)
- {
- UInt64 sum = 0;
- UInt32 i;
- for (i = 0; i < index; i++)
- sum += values[i];
- return sum;
- }
-
- SRes SzDecode2(const UInt64 *packSizes, const CSzFolder *folder,
- ILookInStream *inStream, UInt64 startPos,
- Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain,
- Byte *tempBuf[])
- {
- UInt32 ci;
- SizeT tempSizes[3] = { 0, 0, 0};
- SizeT tempSize3 = 0;
- Byte *tempBuf3 = 0;
-
- RINOK(CheckSupportedFolder(folder));
-
- for (ci = 0; ci < folder->NumCoders; ci++)
- {
- CSzCoderInfo *coder = &folder->Coders[ci];
-
- if (coder->MethodID == k_Copy || coder->MethodID == k_LZMA)
- {
- UInt32 si = 0;
- UInt64 offset;
- UInt64 inSize;
- Byte *outBufCur = outBuffer;
- SizeT outSizeCur = outSize;
- if (folder->NumCoders == 4)
- {
- UInt32 indices[] = { 3, 2, 0 };
- UInt64 unpackSize = folder->UnpackSizes[ci];
- si = indices[ci];
- if (ci < 2)
- {
- Byte *temp;
- outSizeCur = (SizeT)unpackSize;
- if (outSizeCur != unpackSize)
- return SZ_ERROR_MEM;
- temp = (Byte *)IAlloc_Alloc(allocMain, outSizeCur);
- if (temp == 0 && outSizeCur != 0)
- return SZ_ERROR_MEM;
- outBufCur = tempBuf[1 - ci] = temp;
- tempSizes[1 - ci] = outSizeCur;
- }
- else if (ci == 2)
- {
- if (unpackSize > outSize) /* check it */
- return SZ_ERROR_PARAM;
- tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize);
- tempSize3 = outSizeCur = (SizeT)unpackSize;
- }
- else
- return SZ_ERROR_UNSUPPORTED;
- }
- offset = GetSum(packSizes, si);
- inSize = packSizes[si];
- RINOK(LookInStream_SeekTo(inStream, startPos + offset));
-
- if (coder->MethodID == k_Copy)
- {
- if (inSize != outSizeCur) /* check it */
- return SZ_ERROR_DATA;
- RINOK(SzDecodeCopy(inSize, inStream, outBufCur));
- }
- else
- {
- RINOK(SzDecodeLzma(coder, inSize, inStream, outBufCur, outSizeCur, allocMain));
- }
- }
- else if (coder->MethodID == k_BCJ)
- {
- UInt32 state;
- if (ci != 1)
- return SZ_ERROR_UNSUPPORTED;
- x86_Convert_Init(state);
- x86_Convert(outBuffer, outSize, 0, &state, 0);
- }
- else if (coder->MethodID == k_BCJ2)
- {
- UInt64 offset = GetSum(packSizes, 1);
- UInt64 s3Size = packSizes[1];
- SRes res;
- if (ci != 3)
- return SZ_ERROR_UNSUPPORTED;
- RINOK(LookInStream_SeekTo(inStream, startPos + offset));
- tempSizes[2] = (SizeT)s3Size;
- if (tempSizes[2] != s3Size)
- return SZ_ERROR_MEM;
- tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]);
- if (tempBuf[2] == 0 && tempSizes[2] != 0)
- return SZ_ERROR_MEM;
- res = SzDecodeCopy(s3Size, inStream, tempBuf[2]);
- RINOK(res)
-
- res = Bcj2_Decode(
- tempBuf3, tempSize3,
- tempBuf[0], tempSizes[0],
- tempBuf[1], tempSizes[1],
- tempBuf[2], tempSizes[2],
- outBuffer, outSize);
- RINOK(res)
- }
- else
- return SZ_ERROR_UNSUPPORTED;
- }
- return SZ_OK;
- }
-
- SRes SzDecode(const UInt64 *packSizes, const CSzFolder *folder,
- ILookInStream *inStream, UInt64 startPos,
- Byte *outBuffer, size_t outSize, ISzAlloc *allocMain)
- {
- Byte *tempBuf[3] = { 0, 0, 0};
- int i;
- SRes res = SzDecode2(packSizes, folder, inStream, startPos,
- outBuffer, (SizeT)outSize, allocMain, tempBuf);
- for (i = 0; i < 3; i++)
- IAlloc_Free(allocMain, tempBuf[i]);
- return res;
- }
diff --git a/src/archivers/7z/7zDecode.h b/src/archivers/7z/7zDecode.h
deleted file mode 100644
index e19fe387..00000000
--- a/src/archivers/7z/7zDecode.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 7zDecode.h -- Decoding from 7z folder
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_DECODE_H
-#define __7Z_DECODE_H
-
-#include "7zItem.h"
-
-SRes SzDecode(const UInt64 *packSizes, const CSzFolder *folder,
- ILookInStream *stream, UInt64 startPos,
- Byte *outBuffer, size_t outSize, ISzAlloc *allocMain);
-
-#endif
diff --git a/src/archivers/7z/7zExtract.cpp b/src/archivers/7z/7zExtract.cpp
deleted file mode 100644
index 99ef3654..00000000
--- a/src/archivers/7z/7zExtract.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* 7zExtract.c -- Extracting from 7z archive
-2008-11-23 : Igor Pavlov : Public domain */
-
-#include "7zCrc.h"
-#include "7zDecode.h"
-#include "7zExtract.h"
-
-SRes SzAr_Extract(
- const CSzArEx *p,
- ILookInStream *inStream,
- UInt32 fileIndex,
- UInt32 *blockIndex,
- Byte **outBuffer,
- size_t *outBufferSize,
- size_t *offset,
- size_t *outSizeProcessed,
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp)
-{
- UInt32 folderIndex = p->FileIndexToFolderIndexMap[fileIndex];
- SRes res = SZ_OK;
- *offset = 0;
- *outSizeProcessed = 0;
- if (folderIndex == (UInt32)-1)
- {
- IAlloc_Free(allocMain, *outBuffer);
- *blockIndex = folderIndex;
- *outBuffer = 0;
- *outBufferSize = 0;
- return SZ_OK;
- }
-
- if (*outBuffer == 0 || *blockIndex != folderIndex)
- {
- CSzFolder *folder = p->db.Folders + folderIndex;
- UInt64 unpackSizeSpec = SzFolder_GetUnpackSize(folder);
- size_t unpackSize = (size_t)unpackSizeSpec;
- UInt64 startOffset = SzArEx_GetFolderStreamPos(p, folderIndex, 0);
-
- if (unpackSize != unpackSizeSpec)
- return SZ_ERROR_MEM;
- *blockIndex = folderIndex;
- IAlloc_Free(allocMain, *outBuffer);
- *outBuffer = 0;
-
- RINOK(LookInStream_SeekTo(inStream, startOffset));
-
- if (res == SZ_OK)
- {
- *outBufferSize = unpackSize;
- if (unpackSize != 0)
- {
- *outBuffer = (Byte *)IAlloc_Alloc(allocMain, unpackSize);
- if (*outBuffer == 0)
- res = SZ_ERROR_MEM;
- }
- if (res == SZ_OK)
- {
- res = SzDecode(p->db.PackSizes +
- p->FolderStartPackStreamIndex[folderIndex], folder,
- inStream, startOffset,
- *outBuffer, unpackSize, allocTemp);
- if (res == SZ_OK)
- {
- if (folder->UnpackCRCDefined)
- {
- if (CrcCalc(*outBuffer, unpackSize) != folder->UnpackCRC)
- res = SZ_ERROR_CRC;
- }
- }
- }
- }
- }
- if (res == SZ_OK)
- {
- UInt32 i;
- CSzFileItem *fileItem = p->db.Files + fileIndex;
- *offset = 0;
- for (i = p->FolderStartFileIndex[folderIndex]; i < fileIndex; i++)
- *offset += (UInt32)p->db.Files[i].Size;
- *outSizeProcessed = (size_t)fileItem->Size;
- if (*offset + *outSizeProcessed > *outBufferSize)
- return SZ_ERROR_FAIL;
- {
- if (fileItem->FileCRCDefined)
- {
- if (CrcCalc(*outBuffer + *offset, *outSizeProcessed) != fileItem->FileCRC)
- res = SZ_ERROR_CRC;
- }
- }
- }
- return res;
-}
diff --git a/src/archivers/7z/7zExtract.h b/src/archivers/7z/7zExtract.h
deleted file mode 100644
index 5f78415f..00000000
--- a/src/archivers/7z/7zExtract.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 7zExtract.h -- Extracting from 7z archive
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_EXTRACT_H
-#define __7Z_EXTRACT_H
-
-#include "7zIn.h"
-
-/*
- SzExtract extracts file from archive
-
- *outBuffer must be 0 before first call for each new archive.
-
- Extracting cache:
- If you need to decompress more than one file, you can send
- these values from previous call:
- *blockIndex,
- *outBuffer,
- *outBufferSize
- You can consider "*outBuffer" as cache of solid block. If your archive is solid,
- it will increase decompression speed.
-
- If you use external function, you can declare these 3 cache variables
- (blockIndex, outBuffer, outBufferSize) as static in that external function.
-
- Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
-*/
-
-SRes SzAr_Extract(
- const CSzArEx *db,
- ILookInStream *inStream,
- UInt32 fileIndex, /* index of file */
- UInt32 *blockIndex, /* index of solid block */
- Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
- size_t *outBufferSize, /* buffer size for output buffer */
- size_t *offset, /* offset of stream for required file in *outBuffer */
- size_t *outSizeProcessed, /* size of file in *outBuffer */
- ISzAlloc *allocMain,
- ISzAlloc *allocTemp);
-
-#endif
diff --git a/src/archivers/7z/7zHeader.cpp b/src/archivers/7z/7zHeader.cpp
deleted file mode 100644
index e48faa48..00000000
--- a/src/archivers/7z/7zHeader.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-/* 7zHeader.c -- 7z Headers
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "7zHeader.h"
-
-Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
diff --git a/src/archivers/7z/7zHeader.h b/src/archivers/7z/7zHeader.h
deleted file mode 100644
index ad095df4..00000000
--- a/src/archivers/7z/7zHeader.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 7zHeader.h -- 7z Headers
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_HEADER_H
-#define __7Z_HEADER_H
-
-#include "Types.h"
-
-#define k7zSignatureSize 6
-extern Byte k7zSignature[k7zSignatureSize];
-
-#define k7zMajorVersion 0
-
-#define k7zStartHeaderSize 0x20
-
-enum EIdEnum
-{
- k7zIdEnd,
-
- k7zIdHeader,
-
- k7zIdArchiveProperties,
-
- k7zIdAdditionalStreamsInfo,
- k7zIdMainStreamsInfo,
- k7zIdFilesInfo,
-
- k7zIdPackInfo,
- k7zIdUnpackInfo,
- k7zIdSubStreamsInfo,
-
- k7zIdSize,
- k7zIdCRC,
-
- k7zIdFolder,
-
- k7zIdCodersUnpackSize,
- k7zIdNumUnpackStream,
-
- k7zIdEmptyStream,
- k7zIdEmptyFile,
- k7zIdAnti,
-
- k7zIdName,
- k7zIdCTime,
- k7zIdATime,
- k7zIdMTime,
- k7zIdWinAttributes,
- k7zIdComment,
-
- k7zIdEncodedHeader,
-
- k7zIdStartPos,
- k7zIdDummy
-};
-
-#endif
diff --git a/src/archivers/7z/7zIn.h b/src/archivers/7z/7zIn.h
deleted file mode 100644
index c8430a7b..00000000
--- a/src/archivers/7z/7zIn.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 7zIn.h -- 7z Input functions
-2008-11-23 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_IN_H
-#define __7Z_IN_H
-
-#include "7zHeader.h"
-#include "7zItem.h"
-
-typedef struct
-{
- CSzAr db;
-
- UInt64 startPosAfterHeader;
- UInt64 dataPos;
-
- UInt32 *FolderStartPackStreamIndex;
- UInt64 *PackStreamStartPositions;
- UInt32 *FolderStartFileIndex;
- UInt32 *FileIndexToFolderIndexMap;
-} CSzArEx;
-
-void SzArEx_Init(CSzArEx *p);
-void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc);
-UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder);
-int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize);
-
-/*
-Errors:
-SZ_ERROR_NO_ARCHIVE
-SZ_ERROR_ARCHIVE
-SZ_ERROR_UNSUPPORTED
-SZ_ERROR_MEM
-SZ_ERROR_CRC
-SZ_ERROR_INPUT_EOF
-SZ_ERROR_FAIL
-*/
-
-SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp);
-
-#endif
diff --git a/src/archivers/7z/7zItem.cpp b/src/archivers/7z/7zItem.cpp
deleted file mode 100644
index db44571e..00000000
--- a/src/archivers/7z/7zItem.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* 7zItem.c -- 7z Items
-2008-10-04 : Igor Pavlov : Public domain */
-
-#include "7zItem.h"
-
-void SzCoderInfo_Init(CSzCoderInfo *p)
-{
- Buf_Init(&p->Props);
-}
-
-void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc)
-{
- Buf_Free(&p->Props, alloc);
- SzCoderInfo_Init(p);
-}
-
-void SzFolder_Init(CSzFolder *p)
-{
- p->Coders = 0;
- p->BindPairs = 0;
- p->PackStreams = 0;
- p->UnpackSizes = 0;
- p->NumCoders = 0;
- p->NumBindPairs = 0;
- p->NumPackStreams = 0;
- p->UnpackCRCDefined = 0;
- p->UnpackCRC = 0;
- p->NumUnpackStreams = 0;
-}
-
-void SzFolder_Free(CSzFolder *p, ISzAlloc *alloc)
-{
- UInt32 i;
- if (p->Coders)
- for (i = 0; i < p->NumCoders; i++)
- SzCoderInfo_Free(&p->Coders[i], alloc);
- IAlloc_Free(alloc, p->Coders);
- IAlloc_Free(alloc, p->BindPairs);
- IAlloc_Free(alloc, p->PackStreams);
- IAlloc_Free(alloc, p->UnpackSizes);
- SzFolder_Init(p);
-}
-
-UInt32 SzFolder_GetNumOutStreams(CSzFolder *p)
-{
- UInt32 result = 0;
- UInt32 i;
- for (i = 0; i < p->NumCoders; i++)
- result += p->Coders[i].NumOutStreams;
- return result;
-}
-
-int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex)
-{
- UInt32 i;
- for (i = 0; i < p->NumBindPairs; i++)
- if (p->BindPairs[i].InIndex == inStreamIndex)
- return i;
- return -1;
-}
-
-
-int SzFolder_FindBindPairForOutStream(CSzFolder *p, UInt32 outStreamIndex)
-{
- UInt32 i;
- for (i = 0; i < p->NumBindPairs; i++)
- if (p->BindPairs[i].OutIndex == outStreamIndex)
- return i;
- return -1;
-}
-
-UInt64 SzFolder_GetUnpackSize(CSzFolder *p)
-{
- int i = (int)SzFolder_GetNumOutStreams(p);
- if (i == 0)
- return 0;
- for (i--; i >= 0; i--)
- if (SzFolder_FindBindPairForOutStream(p, i) < 0)
- return p->UnpackSizes[i];
- /* throw 1; */
- return 0;
-}
-
-void SzFile_Init(CSzFileItem *p)
-{
- p->HasStream = 1;
- p->IsDir = 0;
- p->IsAnti = 0;
- p->FileCRCDefined = 0;
- p->MTimeDefined = 0;
- p->Name = 0;
-}
-
-static void SzFile_Free(CSzFileItem *p, ISzAlloc *alloc)
-{
- IAlloc_Free(alloc, p->Name);
- SzFile_Init(p);
-}
-
-void SzAr_Init(CSzAr *p)
-{
- p->PackSizes = 0;
- p->PackCRCsDefined = 0;
- p->PackCRCs = 0;
- p->Folders = 0;
- p->Files = 0;
- p->NumPackStreams = 0;
- p->NumFolders = 0;
- p->NumFiles = 0;
-}
-
-void SzAr_Free(CSzAr *p, ISzAlloc *alloc)
-{
- UInt32 i;
- if (p->Folders)
- for (i = 0; i < p->NumFolders; i++)
- SzFolder_Free(&p->Folders[i], alloc);
- if (p->Files)
- for (i = 0; i < p->NumFiles; i++)
- SzFile_Free(&p->Files[i], alloc);
- IAlloc_Free(alloc, p->PackSizes);
- IAlloc_Free(alloc, p->PackCRCsDefined);
- IAlloc_Free(alloc, p->PackCRCs);
- IAlloc_Free(alloc, p->Folders);
- IAlloc_Free(alloc, p->Files);
- SzAr_Init(p);
-}
diff --git a/src/archivers/7z/7zItem.h b/src/archivers/7z/7zItem.h
deleted file mode 100644
index 20a7b7bf..00000000
--- a/src/archivers/7z/7zItem.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 7zItem.h -- 7z Items
-2008-10-04 : Igor Pavlov : Public domain */
-
-#ifndef __7Z_ITEM_H
-#define __7Z_ITEM_H
-
-#include "7zBuf.h"
-
-typedef struct
-{
- UInt32 NumInStreams;
- UInt32 NumOutStreams;
- UInt64 MethodID;
- CBuf Props;
-} CSzCoderInfo;
-
-void SzCoderInfo_Init(CSzCoderInfo *p);
-void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc);
-
-typedef struct
-{
- UInt32 InIndex;
- UInt32 OutIndex;
-} CBindPair;
-
-typedef struct
-{
- CSzCoderInfo *Coders;
- CBindPair *BindPairs;
- UInt32 *PackStreams;
- UInt64 *UnpackSizes;
- UInt32 NumCoders;
- UInt32 NumBindPairs;
- UInt32 NumPackStreams;
- int UnpackCRCDefined;
- UInt32 UnpackCRC;
-
- UInt32 NumUnpackStreams;
-} CSzFolder;
-
-void SzFolder_Init(CSzFolder *p);
-UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
-int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex);
-UInt32 SzFolder_GetNumOutStreams(CSzFolder *p);
-UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
-
-typedef struct
-{
- UInt32 Low;
- UInt32 High;
-} CNtfsFileTime;
-
-typedef struct
-{
- CNtfsFileTime MTime;
- UInt64 Size;
- char *Name;
- UInt32 FileCRC;
-
- Byte HasStream;
- Byte IsDir;
- Byte IsAnti;
- Byte FileCRCDefined;
- Byte MTimeDefined;
-} CSzFileItem;
-
-void SzFile_Init(CSzFileItem *p);
-
-typedef struct
-{
- UInt64 *PackSizes;
- Byte *PackCRCsDefined;
- UInt32 *PackCRCs;
- CSzFolder *Folders;
- CSzFileItem *Files;
- UInt32 NumPackStreams;
- UInt32 NumFolders;
- UInt32 NumFiles;
-} CSzAr;
-
-void SzAr_Init(CSzAr *p);
-void SzAr_Free(CSzAr *p, ISzAlloc *alloc);
-
-#endif
diff --git a/src/autoconf.cpp b/src/autoconf.cpp
index 625ef29f..eae34a01 100644
--- a/src/autoconf.cpp
+++ b/src/autoconf.cpp
@@ -12,7 +12,7 @@
#include "options.h"
#include "uae.h"
-#include "memory.h"
+#include "include/memory.h"
#include "custom.h"
#include "newcpu.h"
#include "autoconf.h"
@@ -33,7 +33,7 @@ DECLARE_MEMORY_FUNCTIONS(rtarea);
addrbank rtarea_bank = {
rtarea_lget, rtarea_wget, rtarea_bget,
rtarea_lput, rtarea_wput, rtarea_bput,
- rtarea_xlate, rtarea_check, NULL, _T("rtarea"), _T("UAE Boot ROM"),
+ rtarea_xlate, rtarea_check, nullptr, _T("rtarea"), _T("UAE Boot ROM"),
rtarea_lget, rtarea_wget,
ABFLAG_ROMIN, S_READ, S_WRITE
};
@@ -123,7 +123,7 @@ static void REGPARAM2 rtarea_wput(uaecptr addr, uae_u32 value)
uaecptr addr2 = addr - RTAREA_TRAP_STATUS;
rtarea_bank.baseaddr[addr + 0] = value >> 8;
- rtarea_bank.baseaddr[addr + 1] = (uae_u8)value;
+ rtarea_bank.baseaddr[addr + 1] = uae_u8(value);
}
static void REGPARAM2 rtarea_lput(uaecptr addr, uae_u32 value)
@@ -161,7 +161,7 @@ static int rt_straddr;
uae_u32 addr(int ptr)
{
- return (uae_u32)ptr + rtarea_base;
+ return uae_u32(ptr) + rtarea_base;
}
void db(uae_u8 data)
@@ -171,8 +171,8 @@ void db(uae_u8 data)
void dw(uae_u16 data)
{
- rtarea_bank.baseaddr[rt_addr++] = (uae_u8)(data >> 8);
- rtarea_bank.baseaddr[rt_addr++] = (uae_u8)data;
+ rtarea_bank.baseaddr[rt_addr++] = uae_u8(data >> 8);
+ rtarea_bank.baseaddr[rt_addr++] = uae_u8(data);
}
void dl(uae_u32 data)
@@ -195,13 +195,11 @@ uae_u8 dbg(uaecptr addr)
uae_u32 ds_ansi(const uae_char *str)
{
- int len;
-
if (!str)
return addr(rt_straddr);
- len = strlen(str) + 1;
+ int len = strlen(str) + 1;
rt_straddr -= len;
- strcpy((uae_char*)rtarea_bank.baseaddr + rt_straddr, str);
+ strcpy(reinterpret_cast(rtarea_bank.baseaddr) + rt_straddr, str);
return addr(rt_straddr);
}
@@ -215,14 +213,12 @@ uae_u32 ds(const TCHAR *str)
uae_u32 ds_bstr_ansi(const uae_char *str)
{
- int len;
-
- len = strlen(str) + 2;
+ int len = strlen(str) + 2;
rt_straddr -= len;
while (rt_straddr & 3)
rt_straddr--;
rtarea_bank.baseaddr[rt_straddr] = len - 2;
- strcpy((uae_char*)rtarea_bank.baseaddr + rt_straddr + 1, str);
+ strcpy(reinterpret_cast(rtarea_bank.baseaddr) + rt_straddr + 1, str);
return addr(rt_straddr) >> 2;
}
@@ -276,7 +272,7 @@ void rtarea_init_mem(void)
if (!mapped_malloc(&rtarea_bank)) {
write_log(_T("virtual memory exhausted (rtarea)!\n"));
target_startup_msg(_T("Internal error"), _T("Virtual memory exhausted (rtarea)."));
- uae_restart(1, NULL);
+ uae_restart(1, nullptr);
return;
}
}
@@ -288,7 +284,6 @@ void rtarea_free(void)
void rtarea_init(void)
{
- uae_u32 a;
TCHAR uaever[100];
rt_straddr = 0xFF00 - 2;
@@ -315,7 +310,7 @@ void rtarea_init(void)
deftrap(NULL); /* Generic emulator trap */
- a = here();
+ uae_u32 a = here();
/* Dummy trap - removing this breaks the filesys emulation. */
org(rtarea_base + 0xFF00);
calltrap(deftrap2(nullfunc, TRAPFLAG_NO_RETVAL, _T("")));
@@ -334,7 +329,7 @@ void rtarea_init(void)
if (uae_boot_rom_size >= RTAREA_TRAPS) {
write_log(_T("RTAREA_TRAPS needs to be increased!"));
target_startup_msg(_T("Internal error"), _T("RTAREA_TRAPS needs to be increased."));
- uae_restart(1, NULL);
+ uae_restart(1, nullptr);
return;
}
diff --git a/src/cd32_fmv.cpp b/src/cd32_fmv.cpp
index f915a0db..c028f4ff 100644
--- a/src/cd32_fmv.cpp
+++ b/src/cd32_fmv.cpp
@@ -11,7 +11,7 @@
#include "sysdeps.h"
#include "options.h"
-#include "memory.h"
+#include "include/memory.h"
#include "rommgr.h"
#include "custom.h"
#include "newcpu.h"
@@ -24,7 +24,7 @@
#include "cda_play.h"
#include "archivers/mp2/kjmp2.h"
-#ifdef PANDORA
+#ifdef AMIBERRY
extern "C" {
#include "mpeg2dec/mpeg2.h"
#include "mpeg2dec/mpeg2convert.h"
diff --git a/src/cd32_fmv_genlock.cpp b/src/cd32_fmv_genlock.cpp
index 0ba66481..2069f8cc 100644
--- a/src/cd32_fmv_genlock.cpp
+++ b/src/cd32_fmv_genlock.cpp
@@ -11,7 +11,7 @@
#include "sysdeps.h"
#include "options.h"
-#include "memory.h"
+#include "include/memory.h"
#include "cd32_fmv.h"
#include "custom.h"
#include "xwin.h"
@@ -47,7 +47,7 @@ void cd32_fmv_new_image(int w, int h, int d, uae_u8 *s)
{
if (!mpeg_out_buffer)
mpeg_out_buffer = xmalloc(uae_u8, MAX_MPEG_WIDTH * MAX_MPEG_HEIGHT * MPEG_PIXBYTES_32);
- if (s == NULL || w > MAX_MPEG_WIDTH || h > MAX_MPEG_HEIGHT) {
+ if (s == nullptr || w > MAX_MPEG_WIDTH || h > MAX_MPEG_HEIGHT) {
memset(mpeg_out_buffer, 0, MAX_MPEG_WIDTH * MAX_MPEG_HEIGHT * MPEG_PIXBYTES_32);
mpeg_width = MAX_MPEG_WIDTH;
mpeg_height = MAX_MPEG_HEIGHT;
@@ -72,11 +72,11 @@ static void genlock_32(struct vidbuffer *vbin, struct vidbuffer *vbout, int w, i
for (int hh = 0, sh = -voffset; hh < h; sh++, hh += mult) {
for (int h2 = 0; h2 < mult; h2++) {
uae_u8 *d8 = vbout->bufmem + vbout->rowbytes * (hh + h2 + voffset);
- uae_u32 *d32 = (uae_u32*)d8;
+ uae_u32 *d32 = reinterpret_cast(d8);
uae_u8 *s8 = vbin->bufmem + vbin->rowbytes * (hh + h2 + voffset) ;
- uae_u32 *srcp = NULL;
+ uae_u32 *srcp = nullptr;
if (sh >= 0 && sh < mpeg_height)
- srcp = (uae_u32*)(mpeg_out_buffer + sh * mpeg_width * MPEG_PIXBYTES_32);
+ srcp = reinterpret_cast(mpeg_out_buffer + sh * mpeg_width * MPEG_PIXBYTES_32);
for (int ww = 0, sw = -hoffset; ww < w; sw++, ww += mult) {
uae_u32 sv = fmv_border_color;
if (sw >= 0 && sw < mpeg_width && srcp)
@@ -84,7 +84,7 @@ static void genlock_32(struct vidbuffer *vbin, struct vidbuffer *vbout, int w, i
for (int w2 = 0; w2 < mult; w2++) {
uae_u32 v;
if (s8[0] >= GENLOCK_VAL_32) {
- v = *((uae_u32*)s8);
+ v = *reinterpret_cast(s8);
} else {
v = sv;
}
@@ -101,19 +101,19 @@ static void genlock_16(struct vidbuffer *vbin, struct vidbuffer *vbout, int w, i
for (int hh = 0, sh = -voffset; hh < h; sh++, hh += mult) {
for (int h2 = 0; h2 < mult; h2++) {
uae_u8 *d8 = vbout->bufmem + vbout->rowbytes * (hh + h2 + voffset);
- uae_u16 *d16 = (uae_u16*)d8;
+ uae_u16 *d16 = reinterpret_cast(d8);
uae_u8 *s8 = vbin->bufmem + vbin->rowbytes * (hh + h2 + voffset) ;
- uae_u16 *srcp = NULL;
+ uae_u16 *srcp = nullptr;
if (sh >= 0 && sh < mpeg_height)
- srcp = (uae_u16*)(mpeg_out_buffer + sh * mpeg_width * MPEG_PIXBYTES_16);
+ srcp = reinterpret_cast(mpeg_out_buffer + sh * mpeg_width * MPEG_PIXBYTES_16);
for (int ww = 0, sw = -hoffset; ww < w; sw++, ww += mult) {
uae_u16 sv = fmv_border_color_16;
if (sw >= 0 && sw < mpeg_width && srcp)
sv = srcp[sw];
for (int w2 = 0; w2 < mult; w2++) {
uae_u32 v;
- if ((((uae_u16*)s8)[0] >> 11) >= GENLOCK_VAL_16) {
- v = *((uae_u16*)s8);
+ if ((reinterpret_cast(s8)[0] >> 11) >= GENLOCK_VAL_16) {
+ v = *reinterpret_cast(s8);
} else {
v = sv;
}
@@ -129,18 +129,18 @@ static void genlock_16_nomult(struct vidbuffer *vbin, struct vidbuffer *vbout, i
{
for (int hh = 0, sh = -voffset; hh < h; sh++, hh++) {
uae_u8 *d8 = vbout->bufmem + vbout->rowbytes * (hh + voffset);
- uae_u16 *d16 = (uae_u16*)d8;
+ uae_u16 *d16 = reinterpret_cast(d8);
uae_u8 *s8 = vbin->bufmem + vbin->rowbytes * (hh + voffset) ;
uae_u16 *srcp = NULL;
if (sh >= 0 && sh < mpeg_height)
- srcp = (uae_u16*)(mpeg_out_buffer + sh * mpeg_width * MPEG_PIXBYTES_16);
+ srcp = reinterpret_cast(mpeg_out_buffer + sh * mpeg_width * MPEG_PIXBYTES_16);
for (int ww = 0, sw = -hoffset; ww < w; sw++, ww++) {
uae_u16 sv = fmv_border_color_16;
if (sw >= 0 && sw < mpeg_width && srcp)
sv = srcp[sw];
uae_u32 v;
- if ((((uae_u16*)s8)[0] >> 11) >= GENLOCK_VAL_16) {
- v = *((uae_u16*)s8);
+ if ((reinterpret_cast(s8)[0] >> 11) >= GENLOCK_VAL_16) {
+ v = *reinterpret_cast(s8);
} else {
v = sv;
}
@@ -152,7 +152,6 @@ static void genlock_16_nomult(struct vidbuffer *vbin, struct vidbuffer *vbout, i
void cd32_fmv_genlock(struct vidbuffer *vbin, struct vidbuffer *vbout)
{
- int hoffset, voffset, mult;
int w = vbin->outwidth;
int h = vbin->outheight;
int d = vbin->pixbytes;
@@ -160,7 +159,7 @@ void cd32_fmv_genlock(struct vidbuffer *vbin, struct vidbuffer *vbout)
if (!mpeg_out_buffer)
return;
- mult = 1;
+ int mult = 1;
for (;;) {
if (mult < 4 && mpeg_width * (mult << 1) <= w + 8 && mpeg_height * (mult << 1) <= h + 8) {
mult <<= 1;
@@ -170,8 +169,8 @@ void cd32_fmv_genlock(struct vidbuffer *vbin, struct vidbuffer *vbout)
}
}
- hoffset = (w / mult - mpeg_width) / 2;
- voffset = (h / mult - mpeg_height) / 2;
+ int hoffset = (w / mult - mpeg_width) / 2;
+ int voffset = (h / mult - mpeg_height) / 2;
if (hoffset < 0)
hoffset = 0;
diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp
index 0e7e1847..b445f761 100644
--- a/src/cfgfile.cpp
+++ b/src/cfgfile.cpp
@@ -49,80 +49,80 @@ struct cfg_lines
const TCHAR *config_label, *config_help;
};
-static const TCHAR* guimode1[] = {_T("no"), _T("yes"), _T("nowait"), 0};
-static const TCHAR* guimode2[] = {_T("false"), _T("true"), _T("nowait"), 0};
-static const TCHAR* guimode3[] = {_T("0"), _T("1"), _T("nowait"), 0};
-static const TCHAR* csmode[] = {_T("ocs"), _T("ecs_agnus"), _T("ecs_denise"), _T("ecs"), _T("aga"), 0};
+static const TCHAR* guimode1[] = {_T("no"), _T("yes"), _T("nowait"), nullptr};
+static const TCHAR* guimode2[] = {_T("false"), _T("true"), _T("nowait"), nullptr};
+static const TCHAR* guimode3[] = {_T("0"), _T("1"), _T("nowait"), nullptr};
+static const TCHAR* csmode[] = {_T("ocs"), _T("ecs_agnus"), _T("ecs_denise"), _T("ecs"), _T("aga"), nullptr};
static const TCHAR *linemode[] = {
_T("none"),
_T("double"), _T("scanlines"), _T("scanlines2p"), _T("scanlines3p"),
_T("double2"), _T("scanlines2"), _T("scanlines2p2"), _T("scanlines2p3"),
_T("double3"), _T("scanlines3"), _T("scanlines3p2"), _T("scanlines3p3"),
- 0 };
-static const TCHAR *speedmode[] = { _T("max"), _T("real"), 0 };
-static const TCHAR *colormode1[] = { _T("8bit"), _T("15bit"), _T("16bit"), _T("8bit_dither"), _T("4bit_dither"), _T("32bit"), 0 };
-static const TCHAR *colormode2[] = { _T("8"), _T("15"), _T("16"), _T("8d"), _T("4d"), _T("32"), 0 };
-static const TCHAR *soundmode1[] = { _T("none"), _T("interrupts"), _T("normal"), _T("exact"), 0 };
-static const TCHAR *soundmode2[] = { _T("none"), _T("interrupts"), _T("good"), _T("best"), 0 };
-static const TCHAR *centermode1[] = { _T("none"), _T("simple"), _T("smart"), 0 };
-static const TCHAR *centermode2[] = { _T("false"), _T("true"), _T("smart"), 0 };
-static const TCHAR *stereomode[] = { _T("mono"), _T("stereo"), _T("clonedstereo"), _T("4ch"), _T("clonedstereo6ch"), _T("6ch"), _T("mixed"), 0 };
-static const TCHAR *interpolmode[] = { _T("none"), _T("anti"), _T("sinc"), _T("rh"), _T("crux"), 0 };
-static const TCHAR *collmode[] = { _T("none"), _T("sprites"), _T("playfields"), _T("full"), 0 };
-static const TCHAR *compmode[] = { _T("direct"), _T("indirect"), _T("indirectKS"), _T("afterPic"), 0 };
-static const TCHAR *flushmode[] = { _T("soft"), _T("hard"), 0 };
-static const TCHAR *kbleds[] = { _T("none"), _T("POWER"), _T("DF0"), _T("DF1"), _T("DF2"), _T("DF3"), _T("HD"), _T("CD"), 0 };
-static const TCHAR *onscreenleds[] = { _T("false"), _T("true"), _T("rtg"), _T("both"), 0 };
-static const TCHAR *soundfiltermode1[] = { _T("off"), _T("emulated"), _T("on"), 0 };
-static const TCHAR *soundfiltermode2[] = { _T("standard"), _T("enhanced"), 0 };
-static const TCHAR *lorestype1[] = { _T("lores"), _T("hires"), _T("superhires"), 0 };
-static const TCHAR *lorestype2[] = { _T("true"), _T("false"), 0 };
-static const TCHAR *loresmode[] = { _T("normal"), _T("filtered"), 0 };
-static const TCHAR *horizmode[] = { _T("vertical"), _T("lores"), _T("hires"), _T("superhires"), 0 };
-static const TCHAR *vertmode[] = { _T("horizontal"), _T("single"), _T("double"), _T("quadruple"), 0 };
+ nullptr };
+static const TCHAR *speedmode[] = { _T("max"), _T("real"), nullptr };
+static const TCHAR *colormode1[] = { _T("8bit"), _T("15bit"), _T("16bit"), _T("8bit_dither"), _T("4bit_dither"), _T("32bit"), nullptr };
+static const TCHAR *colormode2[] = { _T("8"), _T("15"), _T("16"), _T("8d"), _T("4d"), _T("32"), nullptr };
+static const TCHAR *soundmode1[] = { _T("none"), _T("interrupts"), _T("normal"), _T("exact"), nullptr };
+static const TCHAR *soundmode2[] = { _T("none"), _T("interrupts"), _T("good"), _T("best"), nullptr };
+static const TCHAR *centermode1[] = { _T("none"), _T("simple"), _T("smart"), nullptr };
+static const TCHAR *centermode2[] = { _T("false"), _T("true"), _T("smart"), nullptr };
+static const TCHAR *stereomode[] = { _T("mono"), _T("stereo"), _T("clonedstereo"), _T("4ch"), _T("clonedstereo6ch"), _T("6ch"), _T("mixed"), nullptr };
+static const TCHAR *interpolmode[] = { _T("none"), _T("anti"), _T("sinc"), _T("rh"), _T("crux"), nullptr };
+static const TCHAR *collmode[] = { _T("none"), _T("sprites"), _T("playfields"), _T("full"), nullptr };
+static const TCHAR *compmode[] = { _T("direct"), _T("indirect"), _T("indirectKS"), _T("afterPic"), nullptr };
+static const TCHAR *flushmode[] = { _T("soft"), _T("hard"), nullptr };
+static const TCHAR *kbleds[] = { _T("none"), _T("POWER"), _T("DF0"), _T("DF1"), _T("DF2"), _T("DF3"), _T("HD"), _T("CD"), nullptr };
+static const TCHAR *onscreenleds[] = { _T("false"), _T("true"), _T("rtg"), _T("both"), nullptr };
+static const TCHAR *soundfiltermode1[] = { _T("off"), _T("emulated"), _T("on"), nullptr };
+static const TCHAR *soundfiltermode2[] = { _T("standard"), _T("enhanced"), nullptr };
+static const TCHAR *lorestype1[] = { _T("lores"), _T("hires"), _T("superhires"), nullptr };
+static const TCHAR *lorestype2[] = { _T("true"), _T("false"), nullptr };
+static const TCHAR *loresmode[] = { _T("normal"), _T("filtered"), nullptr };
+static const TCHAR *horizmode[] = { _T("vertical"), _T("lores"), _T("hires"), _T("superhires"), nullptr };
+static const TCHAR *vertmode[] = { _T("horizontal"), _T("single"), _T("double"), _T("quadruple"), nullptr };
#ifdef GFXFILTER
static const TCHAR *filtermode2[] = { _T("1x"), _T("2x"), _T("3x"), _T("4x"), 0 };
#endif
-static const TCHAR *cartsmode[] = { _T("none"), _T("hrtmon"), 0 };
-static const TCHAR *idemode[] = { _T("none"), _T("a600/a1200"), _T("a4000"), 0 };
-static const TCHAR *rtctype[] = { _T("none"), _T("MSM6242B"), _T("RP5C01A"), _T("MSM6242B_A2000"), 0 };
-static const TCHAR *ciaatodmode[] = { _T("vblank"), _T("50hz"), _T("60hz"), 0 };
-static const TCHAR *ksmirrortype[] = { _T("none"), _T("e0"), _T("a8+e0"), 0 };
+static const TCHAR *cartsmode[] = { _T("none"), _T("hrtmon"), nullptr };
+static const TCHAR *idemode[] = { _T("none"), _T("a600/a1200"), _T("a4000"), nullptr };
+static const TCHAR *rtctype[] = { _T("none"), _T("MSM6242B"), _T("RP5C01A"), _T("MSM6242B_A2000"), nullptr };
+static const TCHAR *ciaatodmode[] = { _T("vblank"), _T("50hz"), _T("60hz"), nullptr };
+static const TCHAR *ksmirrortype[] = { _T("none"), _T("e0"), _T("a8+e0"), nullptr };
static const TCHAR *cscompa[] = {
_T("-"), _T("Generic"), _T("CDTV"), _T("CDTV-CR"), _T("CD32"), _T("A500"), _T("A500+"), _T("A600"),
_T("A1000"), _T("A1200"), _T("A2000"), _T("A3000"), _T("A3000T"), _T("A4000"),
_T("Velvet"),
- NULL
+ nullptr
};
static const TCHAR *qsmodes[] = {
- _T("A500"), _T("A500+"), _T("A600"), _T("A1200"), _T("A4000"), _T("CD32"), NULL };
+ _T("A500"), _T("A500+"), _T("A600"), _T("A1200"), _T("A4000"), _T("CD32"), nullptr };
/* 3-state boolean! */
-static const TCHAR *fullmodes[] = { _T("false"), _T("true"), /* "FILE_NOT_FOUND", */ _T("fullwindow"), 0 };
+static const TCHAR *fullmodes[] = { _T("false"), _T("true"), /* "FILE_NOT_FOUND", */ _T("fullwindow"), nullptr };
/* bleh for compatibility */
-static const TCHAR *scsimode[] = { _T("false"), _T("true"), _T("scsi"), 0 };
-static const TCHAR *maxhoriz[] = { _T("lores"), _T("hires"), _T("superhires"), 0 };
-static const TCHAR *maxvert[] = { _T("nointerlace"), _T("interlace"), 0 };
-static const TCHAR *abspointers[] = { _T("none"), _T("mousehack"), _T("tablet"), 0 };
-static const TCHAR *magiccursors[] = { _T("both"), _T("native"), _T("host"), 0 };
-static const TCHAR *autoscale[] = { _T("none"), _T("auto"), _T("standard"), _T("max"), _T("scale"), _T("resize"), _T("center"), _T("manual"), _T("integer"), _T("integer_auto"), 0 };
-static const TCHAR *autoscale_rtg[] = { _T("resize"), _T("scale"), _T("center"), _T("integer"), 0 };
-static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("mousenowheel"), _T("djoy"), _T("gamepad"), _T("ajoy"), _T("cdtvjoy"), _T("cd32joy"), _T("lightpen"), 0 };
-static const TCHAR *joyaf[] = { _T("none"), _T("normal"), _T("toggle"), 0 };
-static const TCHAR *epsonprinter[] = { _T("none"), _T("ascii"), _T("epson_matrix_9pin"), _T("epson_matrix_24pin"), _T("epson_matrix_48pin"), 0 };
-static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), 0 };
-static const TCHAR *vsyncmodes[] = { _T("false"), _T("true"), _T("autoswitch"), 0 };
-static const TCHAR *vsyncmodes2[] = { _T("normal"), _T("busywait"), 0 };
-static const TCHAR *filterapi[] = { _T("directdraw"), _T("direct3d"), 0 };
+static const TCHAR *scsimode[] = { _T("false"), _T("true"), _T("scsi"), nullptr };
+static const TCHAR *maxhoriz[] = { _T("lores"), _T("hires"), _T("superhires"), nullptr };
+static const TCHAR *maxvert[] = { _T("nointerlace"), _T("interlace"), nullptr };
+static const TCHAR *abspointers[] = { _T("none"), _T("mousehack"), _T("tablet"), nullptr };
+static const TCHAR *magiccursors[] = { _T("both"), _T("native"), _T("host"), nullptr };
+static const TCHAR *autoscale[] = { _T("none"), _T("auto"), _T("standard"), _T("max"), _T("scale"), _T("resize"), _T("center"), _T("manual"), _T("integer"), _T("integer_auto"), nullptr };
+static const TCHAR *autoscale_rtg[] = { _T("resize"), _T("scale"), _T("center"), _T("integer"), nullptr };
+static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("mousenowheel"), _T("djoy"), _T("gamepad"), _T("ajoy"), _T("cdtvjoy"), _T("cd32joy"), _T("lightpen"), nullptr };
+static const TCHAR *joyaf[] = { _T("none"), _T("normal"), _T("toggle"), nullptr };
+static const TCHAR *epsonprinter[] = { _T("none"), _T("ascii"), _T("epson_matrix_9pin"), _T("epson_matrix_24pin"), _T("epson_matrix_48pin"), nullptr };
+static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), nullptr };
+static const TCHAR *vsyncmodes[] = { _T("false"), _T("true"), _T("autoswitch"), nullptr };
+static const TCHAR *vsyncmodes2[] = { _T("normal"), _T("busywait"), nullptr };
+static const TCHAR *filterapi[] = { _T("directdraw"), _T("direct3d"), nullptr };
static const TCHAR *dongles[] =
{
_T("none"),
_T("robocop 3"), _T("leaderboard"), _T("b.a.t. ii"), _T("italy'90 soccer"), _T("dames grand maitre"),
_T("rugby coach"), _T("cricket captain"), _T("leviathan"),
- NULL
+ nullptr
};
-static const TCHAR *cdmodes[] = { _T("disabled"), _T(""), _T("image"), _T("ioctl"), _T("spti"), _T("aspi"), 0 };
-static const TCHAR *cdconmodes[] = { _T(""), _T("uae"), _T("ide"), _T("scsi"), _T("cdtv"), _T("cd32"), 0 };
-static const TCHAR *specialmonitors[] = { _T("none"), _T("autodetect"), _T("a2024"), _T("graffiti"), 0 };
+static const TCHAR *cdmodes[] = { _T("disabled"), _T(""), _T("image"), _T("ioctl"), _T("spti"), _T("aspi"), nullptr };
+static const TCHAR *cdconmodes[] = { _T(""), _T("uae"), _T("ide"), _T("scsi"), _T("cdtv"), _T("cd32"), nullptr };
+static const TCHAR *specialmonitors[] = { _T("none"), _T("autodetect"), _T("a2024"), _T("graffiti"), nullptr };
static const TCHAR *rtgtype[] = {
_T("ZorroII"), _T("ZorroIII"),
_T("PicassoII"),
@@ -131,12 +131,12 @@ static const TCHAR *rtgtype[] = {
_T("PiccoloSD64_Z2"), _T("PiccoloSD64_Z3"),
_T("Spectrum28/24_Z2"), _T("Spectrum28/24_Z3"),
_T("PicassoIV_Z2"), _T("PicassoIV_Z3"),
- 0 };
-static const TCHAR *waitblits[] = { _T("disabled"), _T("automatic"), _T("noidleonly"), _T("always"), 0 };
-static const TCHAR *autoext2[] = { _T("disabled"), _T("copy"), _T("replace"), 0 };
-static const TCHAR *leds[] = { _T("power"), _T("df0"), _T("df1"), _T("df2"), _T("df3"), _T("hd"), _T("cd"), _T("fps"), _T("cpu"), _T("snd"), _T("md"), 0 };
+ nullptr };
+static const TCHAR *waitblits[] = { _T("disabled"), _T("automatic"), _T("noidleonly"), _T("always"), nullptr };
+static const TCHAR *autoext2[] = { _T("disabled"), _T("copy"), _T("replace"), nullptr };
+static const TCHAR *leds[] = { _T("power"), _T("df0"), _T("df1"), _T("df2"), _T("df3"), _T("hd"), _T("cd"), _T("fps"), _T("cpu"), _T("snd"), _T("md"), nullptr };
static int leds_order[] = { 3, 6, 7, 8, 9, 4, 5, 2, 1, 0, 9 };
-static const TCHAR *lacer[] = { _T("off"), _T("i"), _T("p"), 0 };
+static const TCHAR *lacer[] = { _T("off"), _T("i"), _T("p"), nullptr };
struct hdcontrollerconfig
{
@@ -152,27 +152,27 @@ static const struct hdcontrollerconfig hdcontrollers[] = {
{ _T("scsi%d"), 0 },
- { NULL }
+ {nullptr }
};
static const TCHAR *z3mapping[] = {
_T("auto"),
_T("uae"),
_T("real"),
- NULL
+ nullptr
};
static const TCHAR *uaebootrom[] = {
_T("automatic"),
_T("disabled"),
_T("min"),
_T("full"),
- NULL
+ nullptr
};
static const TCHAR *uaeboard[] = {
_T("disabled"),
_T("min"),
_T("full"),
_T("full+indirect"),
- NULL
+ nullptr
};
static const TCHAR *obsolete[] = {
@@ -203,7 +203,7 @@ static const TCHAR *obsolete[] = {
_T("avoid_cmov"),
_T("compforcesettings"),
- NULL
+ nullptr
};
#define UNEXPANDED _T("$(FILE_PATH)")
@@ -212,22 +212,22 @@ static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool c
{
TCHAR buf[MAX_DPATH];
if (!s)
- return NULL;
+ return nullptr;
_tcscpy(buf, s);
_tcscat(buf, _T(","));
TCHAR *p = buf;
for (;;) {
TCHAR *tmpp = _tcschr(p, ',');
- TCHAR *tmpp2 = NULL;
- if (tmpp == NULL)
- return NULL;
+ TCHAR *tmpp2 = nullptr;
+ if (tmpp == nullptr)
+ return nullptr;
*tmpp++ = 0;
if (checkequals) {
tmpp2 = _tcschr(p, '=');
if (tmpp2)
*tmpp2++ = 0;
}
- if (!strcasecmp(p, option)) {
+ if (!_tcsicmp(p, option)) {
if (checkequals && tmpp2)
return tmpp2;
return p;
@@ -238,7 +238,7 @@ static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool c
static bool cfgfile_option_find(const TCHAR *s, const TCHAR *option)
{
- return cfgfile_option_find_it(s, option, false) != NULL;
+ return cfgfile_option_find_it(s, option, false) != nullptr;
}
static TCHAR *cfgfile_option_get(const TCHAR *s, const TCHAR *option)
@@ -256,9 +256,8 @@ static void trimwsa(char *s)
static int match_string(const TCHAR *table[], const TCHAR *str)
{
- int i;
- for (i = 0; table[i] != 0; i++)
- if (strcasecmp(table[i], str) == 0)
+ for (int i = 0; table[i] != nullptr; i++)
+ if (_tcsicmp(table[i], str) == 0)
return i;
return -1;
}
@@ -356,7 +355,7 @@ static TCHAR *cfgfile_escape_min(const TCHAR *s)
static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos, TCHAR separator)
{
bool quoted = false;
- TCHAR *s2 = xmalloc(TCHAR, _tcslen(s) + 1);
+ TCHAR *s2 = xmalloc(TCHAR, _tcslen(s) + 1), c2;
TCHAR *p = s2;
if (s[0] == '\"') {
s++;
@@ -375,7 +374,6 @@ static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos, TCHAR separ
}
if (c == '\\') {
char v = 0;
- TCHAR c2;
c = s[i + 1];
switch (c)
{
@@ -424,7 +422,7 @@ static TCHAR *getnextentry(const TCHAR **valuep, const TCHAR separator)
value = *valuep;
if (*value != 0 && *value != separator) {
xfree(s);
- return NULL;
+ return nullptr;
}
value++;
*valuep = value;
@@ -437,12 +435,11 @@ static TCHAR *getnextentry(const TCHAR **valuep, const TCHAR separator)
static TCHAR *cfgfile_subst_path2(const TCHAR *path, const TCHAR *subst, const TCHAR *file)
{
- /* @@@ use strcasecmp for some targets. */
+ /* @@@ use _tcsicmp for some targets. */
if (_tcslen(path) > 0 && _tcsncmp(file, path, _tcslen(path)) == 0) {
- int l;
- TCHAR *p2, *p = xmalloc(TCHAR, _tcslen(file) + _tcslen(subst) + 2);
+ TCHAR*p = xmalloc(TCHAR, _tcslen(file) + _tcslen(subst) + 2);
_tcscpy(p, subst);
- l = _tcslen(p);
+ int l = _tcslen(p);
while (l > 0 && p[l - 1] == '/')
p[--l] = '\0';
l = _tcslen(path);
@@ -450,11 +447,11 @@ static TCHAR *cfgfile_subst_path2(const TCHAR *path, const TCHAR *subst, const T
l++;
_tcscat(p, _T("/"));
_tcscat(p, file + l);
- p2 = target_expand_environment(p, NULL, 0);
+ TCHAR *p2 = target_expand_environment(p, nullptr, 0);
xfree(p);
return p2;
}
- return NULL;
+ return nullptr;
}
TCHAR *cfgfile_subst_path(const TCHAR *path, const TCHAR *subst, const TCHAR *file)
@@ -462,66 +459,10 @@ TCHAR *cfgfile_subst_path(const TCHAR *path, const TCHAR *subst, const TCHAR *fi
TCHAR *s = cfgfile_subst_path2(path, subst, file);
if (s)
return s;
- s = target_expand_environment(file, NULL, 0);
+ s = target_expand_environment(file, nullptr, 0);
return s;
}
-static TCHAR *cfgfile_get_multipath2(struct multipath *mp, const TCHAR *path, const TCHAR *file, bool dir)
-{
- for (int i = 0; i < MAX_PATHS; i++) {
- if (mp->path[i][0] && _tcscmp(mp->path[i], _T(".\\")) != 0 && _tcscmp(mp->path[i], _T("./")) != 0 && (file[0] != '/' && file[0] != '\\' && !_tcschr(file, ':'))) {
- TCHAR *s = NULL;
- if (path)
- s = cfgfile_subst_path2(path, mp->path[i], file);
- if (!s) {
- TCHAR np[MAX_DPATH];
- _tcscpy(np, mp->path[i]);
- fixtrailing(np);
- _tcscat(np, file);
- s = target_expand_environment(np);
- }
- if (dir) {
- if (my_existsdir(s))
- return s;
- }
- else {
- if (zfile_exists(s))
- return s;
- }
- xfree(s);
- }
- }
- return NULL;
-}
-
-static TCHAR *cfgfile_get_multipath(struct multipath *mp, const TCHAR *path, const TCHAR *file, bool dir)
-{
- TCHAR *s = cfgfile_get_multipath2(mp, path, file, dir);
- if (s)
- return s;
- return my_strdup(file);
-}
-
-static TCHAR *cfgfile_put_multipath(struct multipath *mp, const TCHAR *s)
-{
- for (int i = 0; i < MAX_PATHS; i++) {
- if (mp->path[i][0] && _tcscmp(mp->path[i], _T(".\\")) != 0 && _tcscmp(mp->path[i], _T("./")) != 0) {
- if (_tcsnicmp(mp->path[i], s, _tcslen(mp->path[i])) == 0) {
- return my_strdup(s + _tcslen(mp->path[i]));
- }
- }
- }
- return my_strdup(s);
-}
-
-static TCHAR *cfgfile_subst_path_load(const TCHAR *path, struct multipath *mp, const TCHAR *file, bool dir)
-{
- TCHAR *s = cfgfile_get_multipath2(mp, path, file, dir);
- if (s)
- return s;
- return cfgfile_subst_path(path, mp->path[0], file);
-}
-
static bool isdefault(const TCHAR *s)
{
TCHAR tmp[MAX_DPATH];
@@ -553,7 +494,7 @@ static void cfg_dowrite(struct zfile *f, const TCHAR *option, const TCHAR *optio
TCHAR tmp[CONFIG_BLEN], tmpext[CONFIG_BLEN];
const TCHAR *optionp;
- if (value == NULL)
+ if (value == nullptr)
return;
if (optionext) {
_tcscpy(tmpext, option);
@@ -575,7 +516,7 @@ static void cfg_dowrite(struct zfile *f, const TCHAR *option, const TCHAR *optio
static void cfg_dowrite(struct zfile *f, const TCHAR *option, const TCHAR *value, int d, int target)
{
- cfg_dowrite(f, option, NULL, value, d, target);
+ cfg_dowrite(f, option, nullptr, value, d, target);
}
void cfgfile_write_bool(struct zfile *f, const TCHAR *option, bool b)
{
@@ -698,10 +639,9 @@ void cfgfile_target_dwrite(struct zfile *f, const TCHAR *option, const TCHAR *fo
va_end(parms);
}
-static void cfgfile_write_rom(struct zfile *f, struct multipath *mp, const TCHAR *romfile, const TCHAR *name)
+static void cfgfile_write_rom(struct zfile *f, const TCHAR *path, const TCHAR *romfile, const TCHAR *name)
{
- TCHAR *str = cfgfile_subst_path(mp->path[0], UNEXPANDED, romfile);
- str = cfgfile_put_multipath(mp, str);
+ TCHAR *str = cfgfile_subst_path(path, UNEXPANDED, romfile);
cfgfile_write_str(f, name, str);
struct zfile *zf = zfile_fopen(str, _T("rb"), ZFD_ALL);
if (zf) {
@@ -726,13 +666,6 @@ static void cfgfile_write_path(struct zfile *f, const TCHAR *path, const TCHAR *
xfree(s);
}
-static void cfgfile_dwrite_path(struct zfile *f, struct multipath *mp, const TCHAR *option, const TCHAR *value)
-{
- TCHAR *s = cfgfile_put_multipath(mp, value);
- cfgfile_dwrite_str(f, option, s);
- xfree(s);
-}
-
static void write_filesys_config(struct uae_prefs *p, const TCHAR *unexpanded,
const TCHAR *default_path, struct zfile *f)
{
@@ -742,19 +675,17 @@ static void write_filesys_config(struct uae_prefs *p, const TCHAR *unexpanded,
struct uaedev_config_data *uci = &p->mountconfig[i];
struct uaedev_config_info *ci = &uci->ci;
TCHAR *str1, *str1b, *str1c, *str2b;
- const TCHAR *str2;
int bp = ci->bootpri;
- str2 = _T("");
+ const TCHAR *str2 = "";
if (ci->rootdir[0] == ':') {
- TCHAR *ptr;
// separate harddrive names
str1 = my_strdup(ci->rootdir);
- ptr = _tcschr(str1 + 1, ':');
+ TCHAR *ptr = _tcschr(str1 + 1, ':');
if (ptr) {
*ptr++ = 0;
str2 = ptr;
- ptr = (TCHAR *)_tcschr(str2, ',');
+ ptr = const_cast(_tcschr(str2, ','));
if (ptr)
*ptr = 0;
}
@@ -832,7 +763,7 @@ static void write_filesys_config(struct uae_prefs *p, const TCHAR *unexpanded,
_tcscat(tmp, _T(",CF"));
_tcscat(tmp3, _T(",CF"));
}
- const TCHAR *extras = NULL;
+ const TCHAR *extras = nullptr;
if (ct >= HD_CONTROLLER_TYPE_IDE_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) {
if (ci->unit_feature_level == HD_LEVEL_ATA_1) {
extras = _T("ATA1");
@@ -888,9 +819,8 @@ static void write_filesys_config(struct uae_prefs *p, const TCHAR *unexpanded,
static void write_compatibility_cpu(struct zfile *f, struct uae_prefs *p)
{
TCHAR tmp[100];
- int model;
- model = p->cpu_model;
+ int model = p->cpu_model;
if (model == 68030)
model = 68020;
if (model == 68060)
@@ -904,40 +834,10 @@ static void write_compatibility_cpu(struct zfile *f, struct uae_prefs *p)
cfgfile_write(f, _T("cpu_type"), tmp);
}
-static void write_leds(struct zfile *f, const TCHAR *name, int mask)
-{
- TCHAR tmp[MAX_DPATH];
- tmp[0] = 0;
- for (int i = 0; leds[i]; i++) {
- bool got = false;
- for (int j = 0; leds[j]; j++) {
- if (leds_order[j] == i) {
- if (mask & (1 << j)) {
- if (got)
- _tcscat(tmp, _T(":"));
- _tcscat(tmp, leds[j]);
- got = true;
- }
- }
- }
- if (leds[i + 1] && got)
- _tcscat(tmp, _T(","));
- }
- while (tmp[0] && tmp[_tcslen(tmp) - 1] == ',')
- tmp[_tcslen(tmp) - 1] = 0;
- cfgfile_dwrite_str(f, name, tmp);
-}
-
static void write_resolution(struct zfile *f, const TCHAR *ws, const TCHAR *hs, struct wh *wh)
{
- if (wh->width <= 0 || wh->height <= 0 || wh->special == WH_NATIVE) {
- cfgfile_write_str(f, ws, _T("native"));
- cfgfile_write_str(f, hs, _T("native"));
- }
- else {
cfgfile_write(f, ws, _T("%d"), wh->width);
cfgfile_write(f, hs, _T("%d"), wh->height);
- }
}
static int cfgfile_read_rom_settings(const struct expansionboardsettings *ebs, const TCHAR *buf, TCHAR *configtext)
@@ -1067,11 +967,10 @@ static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, co
{
TCHAR buf[256];
TCHAR name[256];
- const struct expansionromtype *ert;
if (br->device_type == 0)
return;
- ert = get_device_expansion_rom(br->device_type);
+ const struct expansionromtype *ert = get_device_expansion_rom(br->device_type);
if (!ert)
return;
for (int i = 0; i < MAX_BOARD_ROMS; i++) {
@@ -1142,16 +1041,15 @@ static bool cfgfile_readramboard(const TCHAR *option, const TCHAR *value, const
else
_stprintf(tmp1, _T("%s_options"), name);
if (!_tcsicmp(option, tmp1)) {
- TCHAR *s;
- s = cfgfile_option_get(value, _T("order"));
+ TCHAR *s = cfgfile_option_get(value, _T("order"));
if (s)
rb->device_order = _tstol(s);
s = cfgfile_option_get(value, _T("mid"));
if (s)
- rb->manufacturer = (uae_u16)_tstol(s);
+ rb->manufacturer = uae_u16(_tstol(s));
s = cfgfile_option_get(value, _T("pid"));
if (s)
- rb->product = (uae_u8)_tstol(s);
+ rb->product = uae_u8(_tstol(s));
return true;
}
}
@@ -1180,7 +1078,6 @@ static void cfgfile_writeramboard(struct uae_prefs *prefs, struct zfile *f, cons
void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
{
- struct strlist *sl;
TCHAR tmp[MAX_DPATH];
int i;
@@ -1190,42 +1087,22 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
if (p->info[0])
cfgfile_write(f, _T("config_info"), p->info);
cfgfile_write(f, _T("config_version"), _T("%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV);
- cfgfile_write_str(f, _T("config_hardware_path"), p->config_hardware_path);
- cfgfile_write_str(f, _T("config_host_path"), p->config_host_path);
- if (p->config_window_title[0])
- cfgfile_write_str(f, _T("config_window_title"), p->config_window_title);
- for (sl = p->all_lines; sl; sl = sl->next) {
+ for (struct strlist *sl = p->all_lines; sl; sl = sl->next) {
if (sl->unknown) {
if (sl->option)
cfgfile_write_str(f, sl->option, sl->value);
}
}
- for (i = 0; i < MAX_PATHS; i++) {
- if (p->path_rom.path[i][0]) {
- _stprintf(tmp, _T("%s.rom_path"), TARGET_NAME);
- cfgfile_write_str(f, tmp, p->path_rom.path[i]);
- }
- }
- for (i = 0; i < MAX_PATHS; i++) {
- if (p->path_floppy.path[i][0]) {
- _stprintf(tmp, _T("%s.floppy_path"), TARGET_NAME);
- cfgfile_write_str(f, tmp, p->path_floppy.path[i]);
- }
- }
- for (i = 0; i < MAX_PATHS; i++) {
- if (p->path_hardfile.path[i][0]) {
- _stprintf(tmp, _T("%s.hardfile_path"), TARGET_NAME);
- cfgfile_write_str(f, tmp, p->path_hardfile.path[i]);
- }
- }
- for (i = 0; i < MAX_PATHS; i++) {
- if (p->path_cd.path[i][0]) {
- _stprintf(tmp, _T("%s.cd_path"), TARGET_NAME);
- cfgfile_write_str(f, tmp, p->path_cd.path[i]);
- }
- }
+ _stprintf(tmp, _T("%s.rom_path"), TARGET_NAME);
+ cfgfile_write_str(f, tmp, p->path_rom);
+ _stprintf(tmp, _T("%s.floppy_path"), TARGET_NAME);
+ cfgfile_write_str(f, tmp, p->path_floppy);
+ _stprintf(tmp, _T("%s.hardfile_path"), TARGET_NAME);
+ cfgfile_write_str(f, tmp, p->path_hardfile);
+ _stprintf(tmp, _T("%s.cd_path"), TARGET_NAME);
+ cfgfile_write_str(f, tmp, p->path_cd);
cfg_write(_T("; host-specific"), f);
@@ -1234,66 +1111,34 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
cfg_write(_T("; common"), f);
cfgfile_write_str(f, _T("use_gui"), guimode1[p->start_gui]);
- cfgfile_write_bool(f, _T("use_debugger"), p->start_debugger);
- cfgfile_write_rom(f, &p->path_rom, p->romfile, _T("kickstart_rom_file"));
- cfgfile_write_rom(f, &p->path_rom, p->romextfile, _T("kickstart_ext_rom_file"));
- if (p->romextfile2addr) {
- cfgfile_write(f, _T("kickstart_ext_rom_file2_address"), _T("%x"), p->romextfile2addr);
- cfgfile_write_rom(f, &p->path_rom, p->romextfile2, _T("kickstart_ext_rom_file2"));
+ cfgfile_write_rom(f, p->path_rom, p->romfile, _T("kickstart_rom_file"));
+ cfgfile_write_rom(f, p->path_rom, p->romextfile, _T("kickstart_ext_rom_file"));
+
+ for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) {
+ cfgfile_write_board_rom(p, f, p->path_rom, &p->expansionboard[i]);
}
- if (p->romident[0])
- cfgfile_dwrite_str(f, _T("kickstart_rom"), p->romident);
- if (p->romextident[0])
- cfgfile_write_str(f, _T("kickstart_ext_rom="), p->romextident);
- cfgfile_write_rom(f, &p->path_rom, p->a2091romfile, _T("a2091_rom_file"));
- cfgfile_write_rom(f, &p->path_rom, p->a4091romfile, _T("a4091_rom_file"));
- if (p->a2091romident[0])
- cfgfile_dwrite_str(f, _T("a2091_rom"), p->a2091romident);
- if (p->a4091romident[0])
- cfgfile_dwrite_str(f, _T("a4091_rom"), p->a4091romident);
-
- cfgfile_write_path(f, &p->path_rom, _T("flash_file"), p->flashfile);
- cfgfile_write_path(f, &p->path_rom, _T("cart_file"), p->cartfile);
- cfgfile_write_path(f, &p->path_rom, _T("rtc_file"), p->rtcfile);
- if (p->cartident[0])
- cfgfile_write_str(f, _T("cart"), p->cartident);
- if (p->amaxromfile[0])
- cfgfile_write_path(f, &p->path_rom, _T("amax_rom_file"), p->amaxromfile);
-
- cfgfile_write_bool(f, _T("kickshifter"), p->kickshifter);
- cfgfile_write_bool(f, _T("ks_write_enabled"), p->rom_readwrite);
+ cfgfile_write_str(f, _T("flash_file"), p->flashfile);
+ cfgfile_write_str(f, _T("cart_file"), p->cartfile);
p->nr_floppies = 4;
for (i = 0; i < 4; i++) {
_stprintf(tmp, _T("floppy%d"), i);
- cfgfile_write_path(f, &p->path_floppy, tmp, p->floppyslots[i].df);
+ cfgfile_write_path(f, p->path_floppy, tmp, p->floppyslots[i].df);
_stprintf(tmp, _T("floppy%dwp"), i);
cfgfile_dwrite_bool(f, tmp, p->floppyslots[i].forcedwriteprotect);
_stprintf(tmp, _T("floppy%dtype"), i);
cfgfile_dwrite(f, tmp, _T("%d"), p->floppyslots[i].dfxtype);
- _stprintf(tmp, _T("floppy%dsound"), i);
- cfgfile_dwrite(f, tmp, _T("%d"), p->floppyslots[i].dfxclick);
- if (p->floppyslots[i].dfxclick < 0 && p->floppyslots[i].dfxclickexternal[0]) {
- _stprintf(tmp, _T("floppy%dsoundext"), i);
- cfgfile_dwrite(f, tmp, p->floppyslots[i].dfxclickexternal);
- }
if (p->floppyslots[i].dfxtype < 0 && p->nr_floppies > i)
p->nr_floppies = i;
}
- for (i = 0; i < MAX_SPARE_DRIVES; i++) {
- if (p->dfxlist[i][0]) {
- _stprintf(tmp, _T("diskimage%d"), i);
- cfgfile_dwrite_path(f, &p->path_floppy, tmp, p->dfxlist[i]);
- }
- }
for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
if (p->cdslots[i].name[0] || p->cdslots[i].inuse) {
TCHAR tmp2[MAX_DPATH];
_stprintf(tmp, _T("cdimage%d"), i);
- TCHAR *s = cfgfile_put_multipath(&p->path_cd, p->cdslots[i].name);
+ TCHAR *s = cfgfile_subst_path(p->path_cd, UNEXPANDED, p->cdslots[i].name);
_tcscpy(tmp2, s);
xfree(s);
if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr(p->cdslots[i].name, ',') || p->cdslots[i].delayed) {
@@ -1310,30 +1155,10 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
}
}
- for (i = 0; i < MAX_LUA_STATES; i++) {
- if (p->luafiles[i][0]) {
- cfgfile_write_str(f, _T("lua"), p->luafiles[i]);
- }
- }
-
- if (p->statefile[0])
- cfgfile_write_str(f, _T("statefile"), p->statefile);
- if (p->quitstatefile[0])
- cfgfile_write_str(f, _T("statefile_quit"), p->quitstatefile);
-
cfgfile_write(f, _T("nr_floppies"), _T("%d"), p->nr_floppies);
cfgfile_dwrite_bool(f, _T("floppy_write_protect"), p->floppy_read_only);
cfgfile_write(f, _T("floppy_speed"), _T("%d"), p->floppy_speed);
- cfgfile_write(f, _T("floppy_volume"), _T("%d"), p->dfxclickvolume);
- cfgfile_dwrite(f, _T("floppy_channel_mask"), _T("0x%x"), p->dfxclickchannelmask);
- cfgfile_write_bool(f, _T("parallel_on_demand"), p->parallel_demand);
- cfgfile_write_bool(f, _T("serial_on_demand"), p->serial_demand);
- cfgfile_write_bool(f, _T("serial_hardware_ctsrts"), p->serial_hwctsrts);
- cfgfile_write_bool(f, _T("serial_direct"), p->serial_direct);
- cfgfile_dwrite(f, _T("serial_stopbits"), _T("%d"), p->serial_stopbits);
- cfgfile_write_str(f, _T("scsi"), scsimode[p->scsi]);
- cfgfile_write_bool(f, _T("uaeserial"), p->uaeserial);
- cfgfile_write_bool(f, _T("sana2"), p->sana2);
+ cfgfile_write(f, _T("cd_speed"), _T("%d"), p->cd_speed);
cfgfile_write_str(f, _T("sound_output"), soundmode1[p->produce_sound]);
cfgfile_write_str(f, _T("sound_channels"), stereomode[p->sound_stereo]);
@@ -1347,27 +1172,7 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write(f, _T("sound_volume"), _T("%d"), p->sound_volume);
if (p->sound_volume_cd >= 0)
cfgfile_write(f, _T("sound_volume_cd"), _T("%d"), p->sound_volume_cd);
- cfgfile_write_bool(f, _T("sound_auto"), p->sound_auto);
- cfgfile_write_bool(f, _T("sound_stereo_swap_paula"), p->sound_stereo_swap_paula);
- cfgfile_write_bool(f, _T("sound_stereo_swap_ahi"), p->sound_stereo_swap_ahi);
- cfgfile_dwrite(f, _T("sampler_frequency"), _T("%d"), p->sampler_freq);
- cfgfile_dwrite(f, _T("sampler_buffer"), _T("%d"), p->sampler_buffer);
- cfgfile_dwrite_bool(f, _T("sampler_stereo"), p->sampler_stereo);
- cfgfile_write_str(f, _T("comp_trustbyte"), compmode[p->comptrustbyte]);
- cfgfile_write_str(f, _T("comp_trustword"), compmode[p->comptrustword]);
- cfgfile_write_str(f, _T("comp_trustlong"), compmode[p->comptrustlong]);
- cfgfile_write_str(f, _T("comp_trustnaddr"), compmode[p->comptrustnaddr]);
- cfgfile_write_bool(f, _T("comp_nf"), p->compnf);
- cfgfile_write_bool(f, _T("comp_constjump"), p->comp_constjump);
- cfgfile_write_bool(f, _T("comp_oldsegv"), p->comp_oldsegv);
-
- cfgfile_write_str(f, _T("comp_flushmode"), flushmode[p->comp_hardflush]);
- cfgfile_write_bool(f, _T("compfpu"), p->compfpu);
- cfgfile_write_bool(f, _T("fpu_strict"), p->fpu_strict);
- cfgfile_write_bool(f, _T("comp_midopt"), p->comp_midopt);
- cfgfile_write_bool(f, _T("comp_lowopt"), p->comp_lowopt);
- cfgfile_write_bool(f, _T("avoid_cmov"), p->avoid_cmov);
cfgfile_write(f, _T("cachesize"), _T("%d"), p->cachesize);
for (i = 0; i < MAX_JPORTS; i++) {
@@ -1400,13 +1205,13 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
_stprintf(tmp1, _T("joyport%dmode"), i);
cfgfile_write(f, tmp1, joyportmodes[jp->mode]);
}
- if (jp->name[0]) {
+ if (jp->idc.name[0]) {
_stprintf(tmp1, _T("joyportfriendlyname%d"), i);
- cfgfile_write(f, tmp1, jp->name);
+ cfgfile_write(f, tmp1, jp->idc.name);
}
- if (jp->configname[0]) {
+ if (jp->idc.configname[0]) {
_stprintf(tmp1, _T("joyportname%d"), i);
- cfgfile_write(f, tmp1, jp->configname);
+ cfgfile_write(f, tmp1, jp->idc.configname);
}
if (jp->nokeyboardoverride) {
_stprintf(tmp1, _T("joyport%dkeyboardoverride"), i);
@@ -1414,93 +1219,30 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
}
}
}
- if (p->dongle) {
- if (p->dongle + 1 >= sizeof(dongles) / sizeof(TCHAR*))
- cfgfile_write(f, _T("dongle"), _T("%d"), p->dongle);
- else
- cfgfile_write_str(f, _T("dongle"), dongles[p->dongle]);
- }
cfgfile_write_bool(f, _T("bsdsocket_emu"), p->socket_emu);
- cfgfile_write_bool(f, _T("synchronize_clock"), p->tod_hack);
- cfgfile_write(f, _T("maprom"), _T("0x%x"), p->maprom);
- cfgfile_dwrite_str(f, _T("parallel_matrix_emulation"), epsonprinter[p->parallel_matrix_emulation]);
- cfgfile_write_bool(f, _T("parallel_postscript_emulation"), p->parallel_postscript_emulation);
- cfgfile_write_bool(f, _T("parallel_postscript_detection"), p->parallel_postscript_detection);
- cfgfile_write_str(f, _T("ghostscript_parameters"), p->ghostscript_parameters);
- cfgfile_write(f, _T("parallel_autoflush"), _T("%d"), p->parallel_autoflush_time);
- cfgfile_dwrite(f, _T("uae_hide"), _T("%d"), p->uae_hide);
- cfgfile_dwrite_bool(f, _T("uae_hide_autoconfig"), p->uae_hide_autoconfig);
- cfgfile_dwrite_bool(f, _T("magic_mouse"), p->input_magic_mouse);
- cfgfile_dwrite_str(f, _T("magic_mousecursor"), magiccursors[p->input_magic_mouse_cursor]);
+ cfgfile_dwrite_str(f, _T("boot_rom_uae"), uaebootrom[p->boot_rom]);
+ cfgfile_dwrite_str(f, _T("uaeboard"), uaeboard[p->uaeboard]);
cfgfile_dwrite_str(f, _T("absolute_mouse"), abspointers[p->input_tablet]);
- cfgfile_dwrite_bool(f, _T("tablet_library"), p->tablet_library);
- cfgfile_dwrite_bool(f, _T("clipboard_sharing"), p->clipboard_sharing);
- cfgfile_dwrite_bool(f, _T("native_code"), p->native_code);
-
- cfgfile_write(f, _T("gfx_display"), _T("%d"), p->gfx_apmode[APMODE_NATIVE].gfx_display);
- cfgfile_write_str(f, _T("gfx_display_friendlyname"), target_get_display_name(p->gfx_apmode[APMODE_NATIVE].gfx_display, true));
- cfgfile_write_str(f, _T("gfx_display_name"), target_get_display_name(p->gfx_apmode[APMODE_NATIVE].gfx_display, false));
- cfgfile_write(f, _T("gfx_display_rtg"), _T("%d"), p->gfx_apmode[APMODE_RTG].gfx_display);
- cfgfile_write_str(f, _T("gfx_display_friendlyname_rtg"), target_get_display_name(p->gfx_apmode[APMODE_RTG].gfx_display, true));
- cfgfile_write_str(f, _T("gfx_display_name_rtg"), target_get_display_name(p->gfx_apmode[APMODE_RTG].gfx_display, false));
cfgfile_write(f, _T("gfx_framerate"), _T("%d"), p->gfx_framerate);
- write_resolution(f, _T("gfx_width"), _T("gfx_height"), &p->gfx_size_win); /* compatibility with old versions */
- cfgfile_write(f, _T("gfx_top_windowed"), _T("%d"), p->gfx_size_win.x);
- cfgfile_write(f, _T("gfx_left_windowed"), _T("%d"), p->gfx_size_win.y);
- write_resolution(f, _T("gfx_width_windowed"), _T("gfx_height_windowed"), &p->gfx_size_win);
- write_resolution(f, _T("gfx_width_fullscreen"), _T("gfx_height_fullscreen"), &p->gfx_size_fs);
+ write_resolution(f, _T("gfx_width"), _T("gfx_height"), &p->gfx_size); /* compatibility with old versions */
cfgfile_write(f, _T("gfx_refreshrate"), _T("%d"), p->gfx_apmode[0].gfx_refreshrate);
cfgfile_dwrite(f, _T("gfx_refreshrate_rtg"), _T("%d"), p->gfx_apmode[1].gfx_refreshrate);
- cfgfile_write(f, _T("gfx_autoresolution"), _T("%d"), p->gfx_autoresolution);
- cfgfile_dwrite(f, _T("gfx_autoresolution_delay"), _T("%d"), p->gfx_autoresolution_delay);
- cfgfile_dwrite(f, _T("gfx_autoresolution_min_vertical"), vertmode[p->gfx_autoresolution_minv + 1]);
- cfgfile_dwrite(f, _T("gfx_autoresolution_min_horizontal"), horizmode[p->gfx_autoresolution_minh + 1]);
- cfgfile_write_bool(f, _T("gfx_autoresolution_vga"), p->gfx_autoresolution_vga);
- cfgfile_write(f, _T("gfx_backbuffers"), _T("%d"), p->gfx_apmode[0].gfx_backbuffers);
- cfgfile_write(f, _T("gfx_backbuffers_rtg"), _T("%d"), p->gfx_apmode[1].gfx_backbuffers);
- if (p->gfx_apmode[APMODE_NATIVE].gfx_interlaced)
- cfgfile_write_bool(f, _T("gfx_interlace"), p->gfx_apmode[APMODE_NATIVE].gfx_interlaced);
cfgfile_write_str(f, _T("gfx_vsync"), vsyncmodes[p->gfx_apmode[0].gfx_vsync]);
- cfgfile_write_str(f, _T("gfx_vsyncmode"), vsyncmodes2[p->gfx_apmode[0].gfx_vsyncmode]);
cfgfile_write_str(f, _T("gfx_vsync_picasso"), vsyncmodes[p->gfx_apmode[1].gfx_vsync]);
- cfgfile_write_str(f, _T("gfx_vsyncmode_picasso"), vsyncmodes2[p->gfx_apmode[1].gfx_vsyncmode]);
cfgfile_write_bool(f, _T("gfx_lores"), p->gfx_resolution == 0);
cfgfile_write_str(f, _T("gfx_resolution"), lorestype1[p->gfx_resolution]);
- cfgfile_write_str(f, _T("gfx_lores_mode"), loresmode[p->gfx_lores_mode]);
- cfgfile_write_bool(f, _T("gfx_flickerfixer"), p->gfx_scandoubler);
- cfgfile_write_str(f, _T("gfx_linemode"), p->gfx_vresolution > 0 ? linemode[p->gfx_iscanlines * 4 + p->gfx_pscanlines + 1] : linemode[0]);
- cfgfile_write_str(f, _T("gfx_fullscreen_amiga"), fullmodes[p->gfx_apmode[0].gfx_fullscreen]);
- cfgfile_write_str(f, _T("gfx_fullscreen_picasso"), fullmodes[p->gfx_apmode[1].gfx_fullscreen]);
- cfgfile_write_str(f, _T("gfx_center_horizontal"), centermode1[p->gfx_xcenter]);
- cfgfile_write_str(f, _T("gfx_center_vertical"), centermode1[p->gfx_ycenter]);
- cfgfile_write_str(f, _T("gfx_colour_mode"), colormode1[p->color_mode]);
- cfgfile_write_bool(f, _T("gfx_blacker_than_black"), p->gfx_blackerthanblack);
- cfgfile_dwrite_bool(f, _T("gfx_black_frame_insertion"), p->lightboost_strobo);
- cfgfile_write_str(f, _T("gfx_api"), filterapi[p->gfx_api]);
- cfgfile_dwrite(f, _T("gfx_horizontal_tweak"), _T("%d"), p->gfx_extrawidth);
cfgfile_write_bool(f, _T("immediate_blits"), p->immediate_blits);
cfgfile_dwrite_str(f, _T("waiting_blits"), waitblits[p->waiting_blits]);
cfgfile_write_bool(f, _T("ntsc"), p->ntscmode);
- cfgfile_write_bool(f, _T("genlock"), p->genlock);
- cfgfile_dwrite_str(f, _T("monitoremu"), specialmonitors[p->monitoremu]);
cfgfile_dwrite_bool(f, _T("show_leds"), !!(p->leds_on_screen & STATUSLINE_CHIPSET));
cfgfile_dwrite_bool(f, _T("show_leds_rtg"), !!(p->leds_on_screen & STATUSLINE_RTG));
- write_leds(f, _T("show_leds_enabled"), p->leds_on_screen_mask[0]);
- write_leds(f, _T("show_leds_enabled_rtg"), p->leds_on_screen_mask[1]);
- if (p->osd_pos.y || p->osd_pos.x) {
- cfgfile_dwrite(f, _T("osd_position"), _T("%.1f%s:%.1f%s"),
- p->osd_pos.x >= 20000 ? (p->osd_pos.x - 30000) / 10.0 : (float)p->osd_pos.x, p->osd_pos.x >= 20000 ? _T("%") : _T(""),
- p->osd_pos.y >= 20000 ? (p->osd_pos.y - 30000) / 10.0 : (float)p->osd_pos.y, p->osd_pos.y >= 20000 ? _T("%") : _T(""));
- }
- cfgfile_dwrite(f, _T("keyboard_leds"), _T("numlock:%s,capslock:%s,scrolllock:%s"),
- kbleds[p->keyboard_leds[0]], kbleds[p->keyboard_leds[1]], kbleds[p->keyboard_leds[2]]);
if (p->chipset_mask & CSMASK_AGA)
cfgfile_write(f, _T("chipset"), _T("aga"));
else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_DENISE))
@@ -1537,25 +1279,22 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
_tcscat(s, _T(",lace"));
else if (cr->lace == 0)
_tcscat(s, _T(",nlace"));
- if (cr->framelength > 0)
- _tcscat(s, _T(",lof"));
- else if (cr->framelength == 0)
- _tcscat(s, _T(",shf"));
+ if ((cr->resolution & 7) != 7) {
+ if (cr->resolution & 1)
+ _tcscat(s, _T(",lores"));
+ if (cr->resolution & 2)
+ _tcscat(s, _T(",hires"));
+ if (cr->resolution & 4)
+ _tcscat(s, _T(",shres"));
+ }
if (cr->vsync > 0)
_tcscat(s, _T(",vsync"));
else if (cr->vsync == 0)
_tcscat(s, _T(",nvsync"));
if (cr->rtg)
_tcscat(s, _T(",rtg"));
- if (cr->commands[0]) {
- _tcscat(s, _T(","));
- _tcscat(s, cr->commands);
- for (int j = 0; j < _tcslen(s); j++) {
- if (s[j] == '\n')
- s[j] = ',';
- }
- s[_tcslen(s) - 1] = 0;
- }
+ if (cr->defaultdata)
+ _tcscat(s, _T(",default"));
if (i == CHIPSET_REFRESH_PAL)
cfgfile_dwrite(f, _T("displaydata_pal"), tmp);
else if (i == CHIPSET_REFRESH_NTSC)
@@ -1621,7 +1360,7 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
}
cfgfile_writeramboard(p, f, _T("z3mem"), i, &p->z3fastmem[i]);
}
- cfgfile_write(f, _T("z3mem_start"), _T("0x%x"), p->z3fastmem_start);
+ cfgfile_write(f, _T("z3mem_start"), _T("0x%x"), p->z3autoconfig_start);
cfgfile_write(f, _T("bogomem_size"), _T("%d"), p->bogomem_size / 0x40000);
for (int i = 0; i < MAX_RTG_BOARDS; i++) {
struct rtgboardconfig *rbc = &p->rtgboards[i];
@@ -1638,10 +1377,7 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite_str(f, tmp, gfxboard_get_configname(rbc->rtgmem_type));
}
}
- cfgfile_write_bool(f, _T("gfxcard_hardware_vblank"), p->rtg_hardwareinterrupt);
- cfgfile_write_bool(f, _T("gfxcard_hardware_sprite"), p->rtg_hardwaresprite);
cfgfile_write(f, _T("chipmem_size"), _T("%d"), p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000));
- cfgfile_dwrite(f, _T("megachipmem_size"), _T("%d"), p->z3chipmem_size / 0x100000);
// do not save aros rom special space
if (!(p->custom_memory_sizes[0] == 512 * 1024 && p->custom_memory_sizes[1] == 512 * 1024 && p->custom_memory_addrs[0] == 0xa80000 && p->custom_memory_addrs[1] == 0xb00000)) {
if (p->custom_memory_sizes[0])
@@ -1656,47 +1392,24 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
else {
cfgfile_write_str(f, _T("cpu_speed"), p->m68k_speed < 0 ? _T("max") : _T("real"));
}
- cfgfile_write(f, _T("cpu_throttle"), _T("%.1f"), p->m68k_speed_throttle);
/* do not reorder start */
write_compatibility_cpu(f, p);
cfgfile_write(f, _T("cpu_model"), _T("%d"), p->cpu_model);
if (p->fpu_model)
cfgfile_write(f, _T("fpu_model"), _T("%d"), p->fpu_model);
- if (p->mmu_model)
- cfgfile_write(f, _T("mmu_model"), _T("%d"), p->mmu_model);
cfgfile_write_bool(f, _T("cpu_compatible"), p->cpu_compatible);
cfgfile_write_bool(f, _T("cpu_24bit_addressing"), p->address_space_24);
/* do not reorder end */
- if (p->cpu_cycle_exact) {
- if (p->cpu_frequency)
- cfgfile_write(f, _T("cpu_frequency"), _T("%d"), p->cpu_frequency);
- if (p->cpu_clock_multiplier) {
- if (p->cpu_clock_multiplier >= 256)
- cfgfile_write(f, _T("cpu_multiplier"), _T("%d"), p->cpu_clock_multiplier >> 8);
- }
- }
-
- cfgfile_write_bool(f, _T("cpu_cycle_exact"), p->cpu_cycle_exact);
- cfgfile_write_bool(f, _T("blitter_cycle_exact"), p->blitter_cycle_exact);
- cfgfile_write_bool(f, _T("cycle_exact"), p->cpu_cycle_exact && p->blitter_cycle_exact ? 1 : 0);
cfgfile_dwrite_bool(f, _T("fpu_no_unimplemented"), p->fpu_no_unimplemented);
- cfgfile_dwrite_bool(f, _T("cpu_no_unimplemented"), p->int_no_unimplemented);
+ cfgfile_write_bool(f, _T("fpu_strict"), p->fpu_strict);
+ cfgfile_dwrite_bool(f, _T("fpu_softfloat"), p->fpu_softfloat);
- cfgfile_write_bool(f, _T("rtg_nocustom"), p->picasso96_nocustom);
cfgfile_write(f, _T("rtg_modes"), _T("0x%x"), p->picasso96_modeflags);
- cfgfile_write_bool(f, _T("log_illegal_mem"), p->illegal_mem);
- if (p->catweasel >= 100)
- cfgfile_dwrite(f, _T("catweasel"), _T("0x%x"), p->catweasel);
- else
- cfgfile_dwrite(f, _T("catweasel"), _T("%d"), p->catweasel);
-
cfgfile_dwrite(f, _T("state_replay_rate"), _T("%d"), p->statecapturerate);
cfgfile_dwrite(f, _T("state_replay_buffers"), _T("%d"), p->statecapturebuffersize);
- cfgfile_dwrite_bool(f, _T("state_replay_autoplay"), p->inprec_autoplay);
- cfgfile_dwrite_bool(f, _T("warp"), p->turbo_emulation);
cfgfile_write_str(f, _T("kbd_lang"), (p->keyboard_lang == KBD_LANG_DE ? _T("de")
: p->keyboard_lang == KBD_LANG_DK ? _T("dk")
@@ -1723,15 +1436,15 @@ void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type)
static int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, bool numbercheck)
{
- if (name != NULL && _tcscmp(option, name) != 0)
+ if (name != nullptr && _tcscmp(option, name) != 0)
return 0;
- if (strcasecmp(value, _T("yes")) == 0 || strcasecmp(value, _T("y")) == 0
- || strcasecmp(value, _T("true")) == 0 || strcasecmp(value, _T("t")) == 0
- || (numbercheck && strcasecmp(value, _T("1")) == 0))
+ if (_tcsicmp(value, _T("yes")) == 0 || _tcsicmp(value, _T("y")) == 0
+ || _tcsicmp(value, _T("true")) == 0 || _tcsicmp(value, _T("t")) == 0
+ || (numbercheck && _tcsicmp(value, _T("1")) == 0))
*location = 1;
- else if (strcasecmp(value, _T("no")) == 0 || strcasecmp(value, _T("n")) == 0
- || strcasecmp(value, _T("false")) == 0 || strcasecmp(value, _T("f")) == 0
- || (numbercheck && strcasecmp(value, _T("0")) == 0))
+ else if (_tcsicmp(value, _T("no")) == 0 || _tcsicmp(value, _T("n")) == 0
+ || _tcsicmp(value, _T("false")) == 0 || _tcsicmp(value, _T("f")) == 0
+ || (numbercheck && _tcsicmp(value, _T("0")) == 0))
*location = 0;
else {
cfgfile_warning(_T("Option '%s' requires a value of either 'true' or 'false' (was '%s').\n"), option, value);
@@ -1766,7 +1479,7 @@ int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bo
static int cfgfile_doubleval(const TCHAR *option, const TCHAR *value, const TCHAR *name, double *location)
{
TCHAR *endptr;
- if (name != NULL && _tcscmp(option, name) != 0)
+ if (name != nullptr && _tcscmp(option, name) != 0)
return 0;
*location = _tcstod(value, &endptr);
return 1;
@@ -1775,7 +1488,7 @@ static int cfgfile_doubleval(const TCHAR *option, const TCHAR *value, const TCHA
static int cfgfile_floatval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, float *location)
{
TCHAR *endptr;
- if (name == NULL)
+ if (name == nullptr)
return 0;
if (nameext) {
TCHAR tmp[MAX_DPATH];
@@ -1788,13 +1501,13 @@ static int cfgfile_floatval(const TCHAR *option, const TCHAR *value, const TCHAR
if (_tcscmp(option, name) != 0)
return 0;
}
- *location = (float)_tcstod(value, &endptr);
+ *location = float(_tcstod(value, &endptr));
return 1;
}
static int cfgfile_floatval(const TCHAR *option, const TCHAR *value, const TCHAR *name, float *location)
{
- return cfgfile_floatval(option, value, name, NULL, location);
+ return cfgfile_floatval(option, value, name, nullptr, location);
}
static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, unsigned int *location, int scale)
@@ -1803,7 +1516,7 @@ static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *
TCHAR *endptr;
TCHAR tmp[MAX_DPATH];
- if (name == NULL)
+ if (name == nullptr)
return 0;
if (nameext) {
_tcscpy(tmp, name);
@@ -1821,11 +1534,11 @@ static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *
*location = _tcstol(value, &endptr, base) * scale;
if (*endptr != '\0' || *value == '\0') {
- if (strcasecmp(value, _T("false")) == 0 || strcasecmp(value, _T("no")) == 0) {
+ if (_tcsicmp(value, _T("false")) == 0 || _tcsicmp(value, _T("no")) == 0) {
*location = 0;
return 1;
}
- if (strcasecmp(value, _T("true")) == 0 || strcasecmp(value, _T("yes")) == 0) {
+ if (_tcsicmp(value, _T("true")) == 0 || _tcsicmp(value, _T("yes")) == 0) {
*location = 1;
return 1;
}
@@ -1837,16 +1550,16 @@ static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *
static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, unsigned int *location, int scale)
{
- return cfgfile_intval(option, value, name, NULL, location, scale);
+ return cfgfile_intval(option, value, name, nullptr, location, scale);
}
int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale)
{
unsigned int v = 0;
- int r = cfgfile_intval(option, value, name, NULL, &v, scale);
+ int r = cfgfile_intval(option, value, name, nullptr, &v, scale);
if (!r)
return 0;
- *location = (int)v;
+ *location = int(v);
return r;
}
static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, int scale)
@@ -1855,15 +1568,14 @@ static int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *
int r = cfgfile_intval(option, value, name, nameext, &v, scale);
if (!r)
return 0;
- *location = (int)v;
+ *location = int(v);
return r;
}
static int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, const TCHAR *table[], int more)
{
- int val;
TCHAR tmp[MAX_DPATH];
- if (name == NULL)
+ if (name == nullptr)
return 0;
if (nameext) {
_tcscpy(tmp, name);
@@ -1875,14 +1587,14 @@ static int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *
if (_tcscmp(option, name) != 0)
return 0;
}
- val = match_string(table, value);
+ int val = match_string(table, value);
if (val == -1) {
if (more)
return 0;
- if (!strcasecmp(value, _T("yes")) || !strcasecmp(value, _T("true"))) {
+ if (!_tcsicmp(value, _T("yes")) || !_tcsicmp(value, _T("true"))) {
val = 1;
}
- else if (!strcasecmp(value, _T("no")) || !strcasecmp(value, _T("false"))) {
+ else if (!_tcsicmp(value, _T("no")) || !_tcsicmp(value, _T("false"))) {
val = 0;
}
else {
@@ -1896,7 +1608,7 @@ static int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *
int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more)
{
- return cfgfile_strval(option, value, name, NULL, location, table, more);
+ return cfgfile_strval(option, value, name, nullptr, location, table, more);
}
static int cfgfile_strboolval(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, const TCHAR *table[], int more)
@@ -1935,56 +1647,17 @@ static int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *
return 1;
}
-static int cfgfile_path(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz, struct multipath *mp)
+static int cfgfile_path(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
{
if (!cfgfile_string(option, value, name, location, maxsz))
return 0;
-
- TCHAR* s = target_expand_environment(location);
+ TCHAR *s = target_expand_environment(location, NULL, 0);
_tcsncpy(location, s, maxsz - 1);
location[maxsz - 1] = 0;
- if (mp) {
- for (int i = 0; i < MAX_PATHS; i++) {
- if (mp->path[i][0] && _tcscmp(mp->path[i], _T(".\\")) != 0 && _tcscmp(mp->path[i], _T("./")) != 0 && (location[0] != '/' && location[0] != '\\' && !_tcschr(location, ':'))) {
- TCHAR np[MAX_DPATH];
- _tcscpy(np, mp->path[i]);
- fixtrailing(np);
- _tcscat(np, s);
- if (zfile_exists(np)) {
- _tcsncpy(location, np, maxsz - 1);
- location[maxsz - 1] = 0;
- break;
- }
- }
- }
- }
xfree(s);
return 1;
}
-int cfgfile_path(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
-{
- return cfgfile_path(option, value, name, location, maxsz, NULL);
-}
-
-int cfgfile_multipath(const TCHAR *option, const TCHAR *value, const TCHAR *name, struct multipath *mp)
-{
- TCHAR tmploc[MAX_DPATH];
- if (!cfgfile_string(option, value, name, tmploc, 256))
- return 0;
- for (int i = 0; i < MAX_PATHS; i++) {
- if (mp->path[i][0] == 0 || (i == 0 && (!_tcscmp(mp->path[i], _T(".\\")) || !_tcscmp(mp->path[i], _T("./"))))) {
- TCHAR *s = target_expand_environment(tmploc);
- _tcsncpy(mp->path[i], s, 256 - 1);
- mp->path[i][256 - 1] = 0;
- fixtrailing(mp->path[i]);
- xfree(s);
- return 1;
- }
- }
- return 1;
-}
-
static int cfgfile_rom(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
{
TCHAR id[MAX_DPATH];
@@ -1992,9 +1665,9 @@ static int cfgfile_rom(const TCHAR *option, const TCHAR *value, const TCHAR *nam
return 0;
TCHAR *p = _tcschr(id, ',');
if (p) {
- TCHAR *endptr, tmp;
+ TCHAR *endptr;
*p = 0;
- tmp = id[4];
+ TCHAR tmp = id[4];
id[4] = 0;
uae_u32 crc32 = _tcstol(id, &endptr, 16) << 16;
id[4] = tmp;
@@ -2025,7 +1698,7 @@ static int getintval(TCHAR **p, int *result, int delim)
TCHAR *endptr;
TCHAR *p2 = _tcschr(*p, delim);
- if (p2 == 0)
+ if (p2 == nullptr)
return 0;
*p2++ = '\0';
@@ -2041,20 +1714,33 @@ static int getintval(TCHAR **p, int *result, int delim)
return 1;
}
-static int getintval2(TCHAR **p, int *result, int delim)
+static int getintval2(TCHAR **p, int *result, int delim, bool last)
{
TCHAR *value = *p;
int base = 10;
TCHAR *endptr;
- TCHAR *p2 = _tcschr(*p, delim);
+ TCHAR *p2;
+ p2 = _tcschr(*p, delim);
if (p2 == 0) {
- p2 = _tcschr(*p, 0);
- if (p2 == 0) {
- *p = 0;
+ if (last) {
+ if (delim != '.')
+ p2 = _tcschr(*p, ',');
+ if (p2 == 0) {
+ p2 = *p;
+ while (*p2)
+ p2++;
+ if (p2 == *p)
+ return 0;
+ }
+ }
+ else {
return 0;
}
}
+ if (!_istdigit(**p) && **p != '-' && **p != '+')
+ return 0;
+
if (*p2 != 0)
*p2++ = '\0';
@@ -2081,17 +1767,17 @@ static int cfgfile_option_select(TCHAR *s, const TCHAR *option, const TCHAR *sel
TCHAR *p = buf;
for (;;) {
TCHAR *tmpp = _tcschr(p, ',');
- if (tmpp == NULL)
+ if (tmpp == nullptr)
return -1;
*tmpp++ = 0;
TCHAR *tmpp2 = _tcschr(p, '=');
if (!tmpp2)
return -1;
*tmpp2++ = 0;
- if (!strcasecmp(p, option)) {
+ if (!_tcsicmp(p, option)) {
int idx = 0;
while (select[0]) {
- if (!strcasecmp(select, tmpp2))
+ if (!_tcsicmp(select, tmpp2))
return idx;
idx++;
select += _tcslen(select) + 1;
@@ -2111,21 +1797,21 @@ static int cfgfile_option_bool(TCHAR *s, const TCHAR *option)
TCHAR *p = buf;
for (;;) {
TCHAR *tmpp = _tcschr(p, ',');
- if (tmpp == NULL)
+ if (tmpp == nullptr)
return -1;
*tmpp++ = 0;
TCHAR *tmpp2 = _tcschr(p, '=');
if (tmpp2)
*tmpp2++ = 0;
- if (!strcasecmp(p, option)) {
+ if (!_tcsicmp(p, option)) {
if (!tmpp2)
return 0;
TCHAR *tmpp3 = _tcschr(tmpp2, ',');
if (tmpp3)
*tmpp3 = 0;
- if (tmpp2 && !strcasecmp(tmpp2, _T("true")))
+ if (tmpp2 && !_tcsicmp(tmpp2, _T("true")))
return 1;
- if (tmpp2 && !strcasecmp(tmpp2, _T("false")))
+ if (tmpp2 && !_tcsicmp(tmpp2, _T("false")))
return 0;
return 1;
}
@@ -2144,9 +1830,9 @@ static void set_chipset_mask(struct uae_prefs *p, int val)
static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
{
- int i, v;
+ int i;
bool vb;
- TCHAR *section = 0;
+ TCHAR *section = nullptr;
TCHAR *tmpp;
TCHAR tmpbuf[CONFIG_BLEN];
@@ -2165,23 +1851,16 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
*tmpp = '\0';
if (_tcscmp(section, TARGET_NAME) == 0) {
/* We special case the various path options here. */
- if (cfgfile_multipath(option, value, _T("rom_path"), &p->path_rom)
- || cfgfile_multipath(option, value, _T("floppy_path"), &p->path_floppy)
- || cfgfile_multipath(option, value, _T("cd_path"), &p->path_cd)
- || cfgfile_multipath(option, value, _T("hardfile_path"), &p->path_hardfile))
+ if (cfgfile_path(option, value, _T("rom_path"), p->path_rom, sizeof p->path_rom / sizeof(TCHAR))
+ || cfgfile_path(option, value, _T("floppy_path"), p->path_floppy, sizeof p->path_floppy / sizeof(TCHAR))
+ || cfgfile_path(option, value, _T("cd_path"), p->path_cd, sizeof p->path_cd / sizeof(TCHAR))
+ || cfgfile_path(option, value, _T("hardfile_path"), p->path_hardfile, sizeof p->path_hardfile / sizeof(TCHAR)))
return 1;
return target_parse_option(p, option, value);
}
return 0;
}
- for (i = 0; i < MAX_SPARE_DRIVES; i++) {
- _stprintf(tmpbuf, _T("diskimage%d"), i);
- if (cfgfile_path(option, value, tmpbuf, p->dfxlist[i], sizeof p->dfxlist[i] / sizeof(TCHAR), &p->path_floppy)) {
- return 1;
- }
- }
-
for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
TCHAR tmp[20];
_stprintf(tmp, _T("cdimage%d"), i);
@@ -2237,7 +1916,7 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
cfgfile_intval(option, next, tmp, &unitnum, 1);
}
if (_tcslen(value) > 0) {
- TCHAR *s = cfgfile_get_multipath(&p->path_cd, NULL, value, false);
+ TCHAR *s = cfgfile_subst_path(UNEXPANDED, p->path_cd, value);
_tcsncpy(p->cdslots[i].name, s, sizeof p->cdslots[i].name / sizeof(TCHAR));
xfree(s);
}
@@ -2256,114 +1935,31 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
}
}
- if (!_tcsicmp(option, _T("lua"))) {
- for (i = 0; i < MAX_LUA_STATES; i++) {
- if (!p->luafiles[i][0]) {
- _tcscpy(p->luafiles[i], value);
- break;
- }
- }
- return 1;
- }
-
- if (cfgfile_strval(option, value, _T("gfx_autoresolution_min_vertical"), &p->gfx_autoresolution_minv, vertmode, 0)) {
- p->gfx_autoresolution_minv--;
- return 1;
- }
- if (cfgfile_strval(option, value, _T("gfx_autoresolution_min_horizontal"), &p->gfx_autoresolution_minh, horizmode, 0)) {
- p->gfx_autoresolution_minh--;
- return 1;
- }
- if (!_tcsicmp(option, _T("gfx_autoresolution"))) {
- p->gfx_autoresolution = 0;
- cfgfile_intval(option, value, _T("gfx_autoresolution"), &p->gfx_autoresolution, 1);
- if (!p->gfx_autoresolution) {
- v = cfgfile_yesno(option, value, _T("gfx_autoresolution"), &vb);
- if (v > 0)
- p->gfx_autoresolution = vb ? 10 : 0;
- }
- return 1;
- }
-
if (cfgfile_intval(option, value, _T("sound_frequency"), &p->sound_freq, 1)
- || cfgfile_intval(option, value, _T("sound_max_buff"), &p->sound_maxbsiz, 1)
- || cfgfile_intval(option, value, _T("state_replay_rate"), &p->statecapturerate, 1)
- || cfgfile_intval(option, value, _T("state_replay_buffers"), &p->statecapturebuffersize, 1)
- || cfgfile_yesno(option, value, _T("state_replay_autoplay"), &p->inprec_autoplay)
- || cfgfile_intval(option, value, _T("sound_frequency"), &p->sound_freq, 1)
- || cfgfile_intval(option, value, _T("sound_volume"), &p->sound_volume, 1)
|| cfgfile_intval(option, value, _T("sound_volume_cd"), &p->sound_volume_cd, 1)
|| cfgfile_intval(option, value, _T("sound_stereo_separation"), &p->sound_stereo_separation, 1)
|| cfgfile_intval(option, value, _T("sound_stereo_mixing_delay"), &p->sound_mixed_stereo_delay, 1)
- || cfgfile_intval(option, value, _T("sampler_frequency"), &p->sampler_freq, 1)
- || cfgfile_intval(option, value, _T("sampler_buffer"), &p->sampler_buffer, 1)
|| cfgfile_intval(option, value, _T("gfx_framerate"), &p->gfx_framerate, 1)
- || cfgfile_intval(option, value, _T("gfx_top_windowed"), &p->gfx_size_win.x, 1)
- || cfgfile_intval(option, value, _T("gfx_left_windowed"), &p->gfx_size_win.y, 1)
|| cfgfile_intval(option, value, _T("gfx_refreshrate"), &p->gfx_apmode[APMODE_NATIVE].gfx_refreshrate, 1)
|| cfgfile_intval(option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_refreshrate, 1)
- || cfgfile_intval(option, value, _T("gfx_autoresolution_delay"), &p->gfx_autoresolution_delay, 1)
- || cfgfile_intval(option, value, _T("gfx_backbuffers"), &p->gfx_apmode[APMODE_NATIVE].gfx_backbuffers, 1)
- || cfgfile_intval(option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_backbuffers, 1)
- || cfgfile_yesno(option, value, _T("gfx_interlace"), &p->gfx_apmode[APMODE_NATIVE].gfx_interlaced)
- || cfgfile_yesno(option, value, _T("gfx_interlace_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_interlaced)
-
- || cfgfile_intval(option, value, _T("gfx_center_horizontal_position"), &p->gfx_xcenter_pos, 1)
- || cfgfile_intval(option, value, _T("gfx_center_vertical_position"), &p->gfx_ycenter_pos, 1)
- || cfgfile_intval(option, value, _T("gfx_center_horizontal_size"), &p->gfx_xcenter_size, 1)
- || cfgfile_intval(option, value, _T("gfx_center_vertical_size"), &p->gfx_ycenter_size, 1)
|| cfgfile_intval(option, value, _T("filesys_max_size"), &p->filesys_limit, 1)
|| cfgfile_intval(option, value, _T("filesys_max_name_length"), &p->filesys_max_name, 1)
- || cfgfile_intval(option, value, _T("filesys_max_file_size"), &p->filesys_max_file_size, 1)
-
- || cfgfile_intval(option, value, _T("gfx_luminance"), &p->gfx_luminance, 1)
- || cfgfile_intval(option, value, _T("gfx_contrast"), &p->gfx_contrast, 1)
- || cfgfile_intval(option, value, _T("gfx_gamma"), &p->gfx_gamma, 1)
- || cfgfile_floatval(option, value, _T("rtg_vert_zoom_multf"), &p->rtg_vert_zoom_mult)
- || cfgfile_floatval(option, value, _T("rtg_horiz_zoom_multf"), &p->rtg_horiz_zoom_mult)
- || cfgfile_intval(option, value, _T("gfx_horizontal_tweak"), &p->gfx_extrawidth, 1)
-
- || cfgfile_intval(option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1)
- || cfgfile_intval(option, value, _T("floppy1sound"), &p->floppyslots[1].dfxclick, 1)
- || cfgfile_intval(option, value, _T("floppy2sound"), &p->floppyslots[2].dfxclick, 1)
- || cfgfile_intval(option, value, _T("floppy3sound"), &p->floppyslots[3].dfxclick, 1)
- || cfgfile_intval(option, value, _T("floppy_channel_mask"), &p->dfxclickchannelmask, 1)
- || cfgfile_intval(option, value, _T("floppy_volume"), &p->dfxclickvolume, 1))
+ || cfgfile_yesno(option, value, _T("filesys_inject_icons"), &p->filesys_inject_icons)
+ || cfgfile_string(option, value, _T("filesys_inject_icons_drawer"), p->filesys_inject_icons_drawer, sizeof p->filesys_inject_icons_drawer / sizeof(TCHAR))
+ || cfgfile_string(option, value, _T("filesys_inject_icons_project"), p->filesys_inject_icons_project, sizeof p->filesys_inject_icons_project / sizeof(TCHAR))
+ || cfgfile_string(option, value, _T("filesys_inject_icons_tool"), p->filesys_inject_icons_tool, sizeof p->filesys_inject_icons_tool / sizeof(TCHAR)))
return 1;
- if (cfgfile_path(option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickexternal, sizeof p->floppyslots[0].dfxclickexternal / sizeof(TCHAR))
- || cfgfile_path(option, value, _T("floppy1soundext"), p->floppyslots[1].dfxclickexternal, sizeof p->floppyslots[1].dfxclickexternal / sizeof(TCHAR))
- || cfgfile_path(option, value, _T("floppy2soundext"), p->floppyslots[2].dfxclickexternal, sizeof p->floppyslots[2].dfxclickexternal / sizeof(TCHAR))
- || cfgfile_path(option, value, _T("floppy3soundext"), p->floppyslots[3].dfxclickexternal, sizeof p->floppyslots[3].dfxclickexternal / sizeof(TCHAR))
- || cfgfile_string(option, value, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof(TCHAR))
- || cfgfile_string(option, value, _T("config_info"), p->info, sizeof p->info / sizeof(TCHAR))
+ if (cfgfile_string(option, value, _T("config_info"), p->info, sizeof p->info / sizeof(TCHAR))
|| cfgfile_string(option, value, _T("config_description"), p->description, sizeof p->description / sizeof(TCHAR)))
return 1;
- if (cfgfile_yesno(option, value, _T("use_debugger"), &p->start_debugger)
- || cfgfile_yesno(option, value, _T("floppy0wp"), &p->floppyslots[0].forcedwriteprotect)
+ if (cfgfile_yesno(option, value, _T("floppy0wp"), &p->floppyslots[0].forcedwriteprotect)
|| cfgfile_yesno(option, value, _T("floppy1wp"), &p->floppyslots[1].forcedwriteprotect)
|| cfgfile_yesno(option, value, _T("floppy2wp"), &p->floppyslots[2].forcedwriteprotect)
|| cfgfile_yesno(option, value, _T("floppy3wp"), &p->floppyslots[3].forcedwriteprotect)
- || cfgfile_yesno(option, value, _T("sampler_stereo"), &p->sampler_stereo)
- || cfgfile_yesno(option, value, _T("sound_auto"), &p->sound_auto)
- || cfgfile_yesno(option, value, _T("sound_stereo_swap_paula"), &p->sound_stereo_swap_paula)
- || cfgfile_yesno(option, value, _T("sound_stereo_swap_ahi"), &p->sound_stereo_swap_ahi)
- || cfgfile_yesno(option, value, _T("avoid_cmov"), &p->avoid_cmov)
- || cfgfile_yesno(option, value, _T("log_illegal_mem"), &p->illegal_mem)
- || cfgfile_yesno(option, value, _T("filesys_no_fsdb"), &p->filesys_no_uaefsdb)
- || cfgfile_yesno(option, value, _T("gfx_blacker_than_black"), &p->gfx_blackerthanblack)
- || cfgfile_yesno(option, value, _T("gfx_black_frame_insertion"), &p->lightboost_strobo)
- || cfgfile_yesno(option, value, _T("gfx_flickerfixer"), &p->gfx_scandoubler)
- || cfgfile_yesno(option, value, _T("gfx_autoresolution_vga"), &p->gfx_autoresolution_vga)
- || cfgfile_yesno(option, value, _T("magic_mouse"), &p->input_magic_mouse)
- || cfgfile_yesno(option, value, _T("warp"), &p->turbo_emulation)
- || cfgfile_yesno(option, value, _T("headless"), &p->headless)
- || cfgfile_yesno(option, value, _T("clipboard_sharing"), &p->clipboard_sharing)
- || cfgfile_yesno(option, value, _T("native_code"), &p->native_code)
- || cfgfile_yesno(option, value, _T("tablet_library"), &p->tablet_library)
|| cfgfile_yesno(option, value, _T("bsdsocket_emu"), &p->socket_emu))
return 1;
@@ -2377,120 +1973,22 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
|| cfgfile_strboolval(option, value, _T("use_gui"), &p->start_gui, guimode3, 0)
|| cfgfile_strval(option, value, _T("gfx_resolution"), &p->gfx_resolution, lorestype1, 0)
|| cfgfile_strval(option, value, _T("gfx_lores"), &p->gfx_resolution, lorestype2, 0)
- || cfgfile_strval(option, value, _T("gfx_lores_mode"), &p->gfx_lores_mode, loresmode, 0)
- || cfgfile_strval(option, value, _T("gfx_fullscreen_amiga"), &p->gfx_apmode[APMODE_NATIVE].gfx_fullscreen, fullmodes, 0)
- || cfgfile_strval(option, value, _T("gfx_fullscreen_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_fullscreen, fullmodes, 0)
- || cfgfile_strval(option, value, _T("gfx_center_horizontal"), &p->gfx_xcenter, centermode1, 1)
- || cfgfile_strval(option, value, _T("gfx_center_vertical"), &p->gfx_ycenter, centermode1, 1)
- || cfgfile_strval(option, value, _T("gfx_center_horizontal"), &p->gfx_xcenter, centermode2, 0)
- || cfgfile_strval(option, value, _T("gfx_center_vertical"), &p->gfx_ycenter, centermode2, 0)
- || cfgfile_strval(option, value, _T("gfx_colour_mode"), &p->color_mode, colormode1, 1)
- || cfgfile_strval(option, value, _T("gfx_colour_mode"), &p->color_mode, colormode2, 0)
- || cfgfile_strval(option, value, _T("gfx_color_mode"), &p->color_mode, colormode1, 1)
- || cfgfile_strval(option, value, _T("gfx_color_mode"), &p->color_mode, colormode2, 0)
- || cfgfile_strval(option, value, _T("gfx_max_horizontal"), &p->gfx_max_horizontal, maxhoriz, 0)
- || cfgfile_strval(option, value, _T("gfx_max_vertical"), &p->gfx_max_vertical, maxvert, 0)
- || cfgfile_strval(option, value, _T("gfx_api"), &p->gfx_api, filterapi, 0)
- || cfgfile_strval(option, value, _T("magic_mousecursor"), &p->input_magic_mouse_cursor, magiccursors, 0)
|| cfgfile_strval(option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0))
return 1;
if (_tcscmp(option, _T("gfx_width_windowed")) == 0) {
- if (!_tcscmp(value, _T("native"))) {
- p->gfx_size_win.width = 0;
- p->gfx_size_win.height = 0;
- }
- else {
- cfgfile_intval(option, value, _T("gfx_width_windowed"), &p->gfx_size_win.width, 1);
- }
return 1;
}
if (_tcscmp(option, _T("gfx_height_windowed")) == 0) {
- if (!_tcscmp(value, _T("native"))) {
- p->gfx_size_win.width = 0;
- p->gfx_size_win.height = 0;
- }
- else {
- cfgfile_intval(option, value, _T("gfx_height_windowed"), &p->gfx_size_win.height, 1);
- }
return 1;
}
if (_tcscmp(option, _T("gfx_width_fullscreen")) == 0) {
- if (!_tcscmp(value, _T("native"))) {
- p->gfx_size_fs.width = 0;
- p->gfx_size_fs.height = 0;
- p->gfx_size_fs.special = WH_NATIVE;
- }
- else {
- cfgfile_intval(option, value, _T("gfx_width_fullscreen"), &p->gfx_size_fs.width, 1);
- p->gfx_size_fs.special = 0;
- }
return 1;
}
if (_tcscmp(option, _T("gfx_height_fullscreen")) == 0) {
- if (!_tcscmp(value, _T("native"))) {
- p->gfx_size_fs.width = 0;
- p->gfx_size_fs.height = 0;
- p->gfx_size_fs.special = WH_NATIVE;
- }
- else {
- cfgfile_intval(option, value, _T("gfx_height_fullscreen"), &p->gfx_size_fs.height, 1);
- p->gfx_size_fs.special = 0;
- }
return 1;
}
- if (cfgfile_intval(option, value, _T("gfx_display"), &p->gfx_apmode[APMODE_NATIVE].gfx_display, 1)) {
- p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display;
- return 1;
- }
- if (cfgfile_intval(option, value, _T("gfx_display_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_display, 1)) {
- return 1;
- }
- if (_tcscmp(option, _T("gfx_display_friendlyname")) == 0 || _tcscmp(option, _T("gfx_display_name")) == 0) {
- TCHAR tmp[MAX_DPATH];
- if (cfgfile_string(option, value, _T("gfx_display_friendlyname"), tmp, sizeof tmp / sizeof(TCHAR))) {
- int num = target_get_display(tmp);
- if (num >= 0)
- p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display = num;
- }
- if (cfgfile_string(option, value, _T("gfx_display_name"), tmp, sizeof tmp / sizeof(TCHAR))) {
- int num = target_get_display(tmp);
- if (num >= 0)
- p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display = num;
- }
- return 1;
- }
- if (_tcscmp(option, _T("gfx_display_friendlyname_rtg")) == 0 || _tcscmp(option, _T("gfx_display_name_rtg")) == 0) {
- TCHAR tmp[MAX_DPATH];
- if (cfgfile_string(option, value, _T("gfx_display_friendlyname_rtg"), tmp, sizeof tmp / sizeof(TCHAR))) {
- int num = target_get_display(tmp);
- if (num >= 0)
- p->gfx_apmode[APMODE_RTG].gfx_display = num;
- }
- if (cfgfile_string(option, value, _T("gfx_display_name_rtg"), tmp, sizeof tmp / sizeof(TCHAR))) {
- int num = target_get_display(tmp);
- if (num >= 0)
- p->gfx_apmode[APMODE_RTG].gfx_display = num;
- }
- return 1;
- }
-
- if (_tcscmp(option, _T("gfx_linemode")) == 0) {
- int v;
- p->gfx_vresolution = VRES_DOUBLE;
- p->gfx_pscanlines = 0;
- p->gfx_iscanlines = 0;
- if (cfgfile_strval(option, value, _T("gfx_linemode"), &v, linemode, 0)) {
- p->gfx_vresolution = VRES_NONDOUBLE;
- if (v > 0) {
- p->gfx_iscanlines = (v - 1) / 4;
- p->gfx_pscanlines = (v - 1) % 4;
- p->gfx_vresolution = VRES_DOUBLE;
- }
- }
- return 1;
- }
if (_tcscmp(option, _T("gfx_vsync")) == 0) {
if (cfgfile_strval(option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync, vsyncmodes, 0) >= 0)
return 1;
@@ -2501,10 +1999,6 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
return cfgfile_yesno(option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync);
}
- if (cfgfile_strval(option, value, _T("gfx_vsyncmode"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode, vsyncmodes2, 0))
- return 1;
- if (cfgfile_strval(option, value, _T("gfx_vsyncmode_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsyncmode, vsyncmodes2, 0))
- return 1;
if (cfgfile_yesno(option, value, _T("show_leds"), &vb)) {
if (vb)
@@ -2520,104 +2014,35 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
p->leds_on_screen &= ~STATUSLINE_RTG;
return 1;
}
- if (_tcscmp(option, _T("show_leds_enabled")) == 0 || _tcscmp(option, _T("show_leds_enabled_rtg")) == 0) {
- TCHAR tmp[MAX_DPATH];
- int idx = _tcscmp(option, _T("show_leds_enabled")) == 0 ? 0 : 1;
- p->leds_on_screen_mask[idx] = 0;
- _tcscpy(tmp, value);
- _tcscat(tmp, _T(","));
- TCHAR *s = tmp;
- for (;;) {
- TCHAR *s2 = s;
- TCHAR *s3 = _tcschr(s, ':');
- s = _tcschr(s, ',');
- if (!s)
- break;
- if (s3 && s3 < s)
- s = s3;
- *s = 0;
- for (int i = 0; leds[i]; i++) {
- if (!_tcsicmp(s2, leds[i])) {
- p->leds_on_screen_mask[idx] |= 1 << i;
- }
- }
- s++;
- }
- return 1;
- }
-
- if (!_tcscmp(option, _T("osd_position"))) {
- TCHAR *s = value;
- p->osd_pos.x = 0;
- p->osd_pos.y = 0;
- while (s) {
- if (!_tcschr(s, ':'))
- break;
- p->osd_pos.x = (int)(_tstof(s) * 10.0);
- s = _tcschr(s, ':');
- if (!s)
- break;
- if (s[-1] == '%')
- p->osd_pos.x += 30000;
- s++;
- p->osd_pos.y = (int)(_tstof(s) * 10.0);
- s += _tcslen(s);
- if (s[-1] == '%')
- p->osd_pos.y += 30000;
- break;
- }
- return 1;
- }
if (_tcscmp(option, _T("gfx_width")) == 0 || _tcscmp(option, _T("gfx_height")) == 0) {
- cfgfile_intval(option, value, _T("gfx_width"), &p->gfx_size_win.width, 1);
- cfgfile_intval(option, value, _T("gfx_height"), &p->gfx_size_win.height, 1);
- p->gfx_size_fs.width = p->gfx_size_win.width;
- p->gfx_size_fs.height = p->gfx_size_win.height;
- return 1;
- }
-
- if (_tcscmp(option, _T("gfx_fullscreen_multi")) == 0 || _tcscmp(option, _T("gfx_windowed_multi")) == 0) {
- TCHAR tmp[256], *tmpp, *tmpp2;
- struct wh *wh = p->gfx_size_win_xtra;
- if (_tcscmp(option, _T("gfx_fullscreen_multi")) == 0)
- wh = p->gfx_size_fs_xtra;
- _stprintf(tmp, _T(",%s,"), value);
- tmpp2 = tmp;
- for (i = 0; i < 4; i++) {
- tmpp = _tcschr(tmpp2, ',');
- tmpp++;
- wh[i].width = _tstol(tmpp);
- while (*tmpp != ',' && *tmpp != 'x' && *tmpp != '*')
- tmpp++;
- wh[i].height = _tstol(tmpp + 1);
- tmpp2 = tmpp;
- }
+ cfgfile_intval(option, value, _T("gfx_width"), &p->gfx_size.width, 1);
+ cfgfile_intval(option, value, _T("gfx_height"), &p->gfx_size.height, 1);
return 1;
}
if (_tcscmp(option, _T("joyportfriendlyname0")) == 0 || _tcscmp(option, _T("joyportfriendlyname1")) == 0) {
- inputdevice_joyport_config(p, value, _tcscmp(option, _T("joyportfriendlyname0")) == 0 ? 0 : 1, -1, 2, true);
+ inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportfriendlyname0")) == 0 ? 0 : 1, -1, 2);
return 1;
}
if (_tcscmp(option, _T("joyportfriendlyname2")) == 0 || _tcscmp(option, _T("joyportfriendlyname3")) == 0) {
- inputdevice_joyport_config(p, value, _tcscmp(option, _T("joyportfriendlyname2")) == 0 ? 2 : 3, -1, 2, true);
+ inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportfriendlyname2")) == 0 ? 2 : 3, -1, 2);
return 1;
}
if (_tcscmp(option, _T("joyportname0")) == 0 || _tcscmp(option, _T("joyportname1")) == 0) {
- inputdevice_joyport_config(p, value, _tcscmp(option, _T("joyportname0")) == 0 ? 0 : 1, -1, 1, true);
+ inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportname0")) == 0 ? 0 : 1, -1, 1);
return 1;
}
if (_tcscmp(option, _T("joyportname2")) == 0 || _tcscmp(option, _T("joyportname3")) == 0) {
- inputdevice_joyport_config(p, value, _tcscmp(option, _T("joyportname2")) == 0 ? 2 : 3, -1, 1, true);
+ inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyportname2")) == 0 ? 2 : 3, -1, 1);
return 1;
}
if (_tcscmp(option, _T("joyport0")) == 0 || _tcscmp(option, _T("joyport1")) == 0) {
- inputdevice_joyport_config(p, value, _tcscmp(option, _T("joyport0")) == 0 ? 0 : 1, -1, 0, true);
+ inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyport0")) == 0 ? 0 : 1, -1, 0);
return 1;
}
if (_tcscmp(option, _T("joyport2")) == 0 || _tcscmp(option, _T("joyport3")) == 0) {
- inputdevice_joyport_config(p, value, _tcscmp(option, _T("joyport2")) == 0 ? 2 : 3, -1, 0, true);
+ inputdevice_joyport_config_store(p, value, _tcscmp(option, _T("joyport2")) == 0 ? 2 : 3, -1, 0);
return 1;
}
if (cfgfile_strval(option, value, _T("joyport0mode"), &p->jports[0].mode, joyportmodes, 0))
@@ -2636,6 +2061,7 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
if (cfgfile_strval(option, value, _T("joyport3autofire"), &p->jports[3].autofire, joyaf, 0))
return 1;
+
if (cfgfile_yesno(option, value, _T("joyport0keyboardoverride"), &vb)) {
p->jports[0].nokeyboardoverride = !vb;
return 1;
@@ -2653,19 +2079,7 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
}
- if (cfgfile_path(option, value, _T("statefile_quit"), p->quitstatefile, sizeof p->quitstatefile / sizeof(TCHAR)))
- return 1;
-
- if (cfgfile_string(option, value, _T("statefile_name"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
- fetch_statefilepath(savestate_fname, sizeof savestate_fname / sizeof(TCHAR));
- _tcscat(savestate_fname, tmpbuf);
- if (_tcslen(savestate_fname) >= 4 && _tcsicmp(savestate_fname + _tcslen(savestate_fname) - 4, _T(".uss")))
- _tcscat(savestate_fname, _T(".uss"));
- return 1;
- }
-
if (cfgfile_path(option, value, _T("statefile"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
- _tcscpy(p->statefile, tmpbuf);
_tcscpy(savestate_fname, tmpbuf);
if (zfile_exists(savestate_fname)) {
savestate_state = STATE_DORESTORE;
@@ -2688,16 +2102,7 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
}
}
if (!ok) {
- TCHAR tmp[MAX_DPATH];
- fetch_statefilepath(tmp, sizeof tmp / sizeof(TCHAR));
- _tcscat(tmp, savestate_fname);
- if (zfile_exists(tmp)) {
- _tcscpy(savestate_fname, tmp);
- savestate_state = STATE_DORESTORE;
- }
- else {
savestate_fname[0] = 0;
- }
}
}
return 1;
@@ -2712,12 +2117,26 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
}
+ if (_tcscmp(option, _T("kbd_lang")) == 0) {
+ KbdLang l;
+ if ((l = KBD_LANG_DE, _tcsicmp(value, _T("de")) == 0)
+ || (l = KBD_LANG_DK, _tcsicmp(value, _T("dk")) == 0)
+ || (l = KBD_LANG_SE, _tcsicmp(value, _T("se")) == 0)
+ || (l = KBD_LANG_US, _tcsicmp(value, _T("us")) == 0)
+ || (l = KBD_LANG_FR, _tcsicmp(value, _T("fr")) == 0)
+ || (l = KBD_LANG_IT, _tcsicmp(value, _T("it")) == 0)
+ || (l = KBD_LANG_ES, _tcsicmp(value, _T("es")) == 0))
+ p->keyboard_lang = l;
+ else
+ cfgfile_warning(_T("Unknown keyboard language\n"));
+ return 1;
+ }
+
if (cfgfile_string(option, value, _T("config_version"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR))) {
- TCHAR *tmpp2;
tmpp = _tcschr(value, '.');
if (tmpp) {
*tmpp++ = 0;
- tmpp2 = tmpp;
+ TCHAR *tmpp2 = tmpp;
p->config_version = _tstol(tmpbuf) << 16;
tmpp = _tcschr(tmpp, '.');
if (tmpp) {
@@ -2729,59 +2148,25 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
}
- if (cfgfile_string(option, value, _T("keyboard_leds"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR))) {
- TCHAR *tmpp2 = tmpbuf;
- int i, num;
- p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0;
- p->keyboard_leds_in_use = 0;
- _tcscat(tmpbuf, _T(","));
- for (i = 0; i < 3; i++) {
- tmpp = _tcschr(tmpp2, ':');
- if (!tmpp)
- break;
- *tmpp++ = 0;
- num = -1;
- if (!strcasecmp(tmpp2, _T("numlock")))
- num = 0;
- if (!strcasecmp(tmpp2, _T("capslock")))
- num = 1;
- if (!strcasecmp(tmpp2, _T("scrolllock")))
- num = 2;
- tmpp2 = tmpp;
- tmpp = _tcschr(tmpp2, ',');
- if (!tmpp)
- break;
- *tmpp++ = 0;
- if (num >= 0) {
- p->keyboard_leds[num] = match_string(kbleds, tmpp2);
- if (p->keyboard_leds[num])
- p->keyboard_leds_in_use = 1;
- }
- tmpp2 = tmpp;
- }
- return 1;
- }
-
if (_tcscmp(option, _T("displaydata")) == 0 || _tcscmp(option, _T("displaydata_pal")) == 0 || _tcscmp(option, _T("displaydata_ntsc")) == 0) {
_tcsncpy(tmpbuf, value, sizeof tmpbuf / sizeof(TCHAR) - 1);
tmpbuf[sizeof tmpbuf / sizeof(TCHAR) - 1] = '\0';
- int vert = -1, horiz = -1, lace = -1, ntsc = -1, framelength = -1, vsync = -1;
- bool locked = false;
- bool rtg = false;
- double rate = -1;
- TCHAR cmd[MAX_DPATH], label[16] = { 0 };
+ int vert = -1, horiz = -1, lace = -1, ntsc = -1, vsync = -1, hres = 0;
+ bool locked = false, rtg = false;
+ bool defaultdata = false;
+ float rate = -1;
+ TCHAR label[16] = { 0 };
TCHAR *tmpp = tmpbuf;
TCHAR *end = tmpbuf + _tcslen(tmpbuf);
- cmd[0] = 0;
for (;;) {
TCHAR *next = _tcschr(tmpp, ',');
TCHAR *equals = _tcschr(tmpp, '=');
if (!next)
next = end;
- if (equals == NULL || equals > next)
- equals = NULL;
+ if (equals == nullptr || equals > next)
+ equals = nullptr;
else
equals++;
*next = 0;
@@ -2794,18 +2179,18 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
horiz = _tstol(equals);
else if (!_tcsnicmp(tmpp, _T("t="), 2))
_tcsncpy(label, equals, sizeof label / sizeof(TCHAR) - 1);
- else if (equals) {
- if (_tcslen(cmd) + _tcslen(tmpp) + 2 < sizeof(cmd) / sizeof(TCHAR)) {
- _tcscat(cmd, tmpp);
- _tcscat(cmd, _T("\n"));
- }
- }
if (!_tcsnicmp(tmpp, _T("locked"), 4))
locked = true;
if (!_tcsnicmp(tmpp, _T("nlace"), 5))
lace = 0;
if (!_tcsnicmp(tmpp, _T("lace"), 4))
lace = 1;
+ if (!_tcsnicmp(tmpp, _T("lores"), 5))
+ hres |= 1 << RES_LORES;
+ if (!_tcsnicmp(tmpp, _T("hires"), 5))
+ hres |= 1 << RES_HIRES;
+ if (!_tcsnicmp(tmpp, _T("shres"), 5))
+ hres |= 1 << RES_SUPERHIRES;
if (!_tcsnicmp(tmpp, _T("nvsync"), 5))
vsync = 0;
if (!_tcsnicmp(tmpp, _T("vsync"), 4))
@@ -2814,43 +2199,44 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
ntsc = 1;
if (!_tcsnicmp(tmpp, _T("pal"), 3))
ntsc = 0;
- if (!_tcsnicmp(tmpp, _T("lof"), 3))
- framelength = 1;
- if (!_tcsnicmp(tmpp, _T("shf"), 3))
- framelength = 0;
if (!_tcsnicmp(tmpp, _T("rtg"), 3))
rtg = true;
+ if (!_tcsnicmp(tmpp, _T("default"), 7))
+ defaultdata = true;
+
tmpp = next;
if (tmpp >= end)
break;
tmpp++;
}
- if (rate > 0) {
- for (int i = 0; i < MAX_CHIPSET_REFRESH; i++) {
- if (_tcscmp(option, _T("displaydata_pal")) == 0) {
- i = CHIPSET_REFRESH_PAL;
- p->cr[i].rate = -1;
- _tcscpy(label, _T("PAL"));
- }
- else if (_tcscmp(option, _T("displaydata_ntsc")) == 0) {
- i = CHIPSET_REFRESH_NTSC;
- p->cr[i].rate = -1;
- _tcscpy(label, _T("NTSC"));
- }
- if (p->cr[i].rate <= 0) {
- p->cr[i].horiz = horiz;
- p->cr[i].vert = vert;
- p->cr[i].lace = lace;
- p->cr[i].ntsc = ntsc;
- p->cr[i].vsync = vsync;
- p->cr[i].locked = locked;
- p->cr[i].rtg = rtg;
- p->cr[i].framelength = framelength;
- p->cr[i].rate = rate;
- _tcscpy(p->cr[i].commands, cmd);
- _tcscpy(p->cr[i].label, label);
- break;
- }
+ for (int i = 0; i < MAX_CHIPSET_REFRESH; i++) {
+ struct chipset_refresh *cr = &p->cr[i];
+ if (_tcscmp(option, _T("displaydata_pal")) == 0) {
+ i = CHIPSET_REFRESH_PAL;
+ cr = &p->cr[i];
+ cr->rate = -1;
+ _tcscpy(label, _T("PAL"));
+ }
+ else if (_tcscmp(option, _T("displaydata_ntsc")) == 0) {
+ i = CHIPSET_REFRESH_NTSC;
+ cr = &p->cr[i];
+ cr->rate = -1;
+ _tcscpy(label, _T("NTSC"));
+ }
+ if (!cr->inuse) {
+ cr->inuse = true;
+ cr->horiz = horiz;
+ cr->vert = vert;
+ cr->lace = lace;
+ cr->resolution = hres ? hres : 1 + 2 + 4;
+ cr->ntsc = ntsc;
+ cr->vsync = vsync;
+ cr->locked = locked;
+ cr->rtg = rtg;
+ cr->rate = rate;
+ cr->defaultdata = defaultdata;
+ _tcscpy(cr->label, label);
+ break;
}
}
return 1;
@@ -2859,81 +2245,11 @@ static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 0;
}
-static void decode_rom_ident(TCHAR *romfile, int maxlen, const TCHAR *ident, int romflags)
-{
- const TCHAR *p;
- int ver, rev, subver, subrev, round, i;
- TCHAR model[64], *modelp;
- struct romlist **rl;
- TCHAR *romtxt;
-
- if (!ident[0])
- return;
- romtxt = xmalloc(TCHAR, 10000);
- romtxt[0] = 0;
- for (round = 0; round < 2; round++) {
- ver = rev = subver = subrev = -1;
- modelp = NULL;
- memset(model, 0, sizeof model);
- p = ident;
- while (*p) {
- TCHAR c = *p++;
- int *pp1 = NULL, *pp2 = NULL;
- if (_totupper(c) == 'V' && _istdigit(*p)) {
- pp1 = &ver;
- pp2 = &rev;
- }
- else if (_totupper(c) == 'R' && _istdigit(*p)) {
- pp1 = &subver;
- pp2 = &subrev;
- }
- else if (!_istdigit(c) && c != ' ') {
- _tcsncpy(model, p - 1, (sizeof model) / sizeof(TCHAR) - 1);
- p += _tcslen(model);
- modelp = model;
- }
- if (pp1) {
- *pp1 = _tstol(p);
- while (*p != 0 && *p != '.' && *p != ' ')
- p++;
- if (*p == '.') {
- p++;
- if (pp2)
- *pp2 = _tstol(p);
- }
- }
- if (*p == 0 || *p == ';') {
- rl = getromlistbyident(ver, rev, subver, subrev, modelp, romflags, round > 0);
- if (rl) {
- for (i = 0; rl[i]; i++) {
- if (round) {
- TCHAR romname[MAX_DPATH];
- getromname(rl[i]->rd, romname);
- _tcscat(romtxt, romname);
- _tcscat(romtxt, _T("\n"));
- }
- else {
- _tcsncpy(romfile, rl[i]->path, maxlen);
- goto end;
- }
- }
- xfree(rl);
- }
- }
- }
- }
-end:
- if (round && romtxt[0]) {
- //notify_user_parms(NUMSG_ROMNEED, romtxt, romtxt);
- }
- xfree(romtxt);
-}
-
static struct uaedev_config_data* getuci(struct uae_prefs* p)
{
if (p->mountitems < MOUNT_CONFIG_SIZE)
return &p->mountconfig[p->mountitems++];
- return NULL;
+ return nullptr;
}
struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, struct uaedev_config_info *ci)
@@ -2944,7 +2260,7 @@ struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, st
if (index < 0 && (ci->type == UAEDEV_DIR || ci->type == UAEDEV_HDF) && ci->devname && _tcslen(ci->devname) > 0) {
for (i = 0; i < p->mountitems; i++) {
if (p->mountconfig[i].ci.devname && !_tcscmp(p->mountconfig[i].ci.devname, ci->devname))
- return NULL;
+ return nullptr;
}
}
for (;;) {
@@ -2957,7 +2273,7 @@ struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, st
else {
break;
}
- return NULL;
+ return nullptr;
}
if (index < 0) {
if (ci->controller_type != HD_CONTROLLER_TYPE_UAE) {
@@ -2969,9 +2285,9 @@ struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, st
if (p->mountconfig[i].ci.controller_type == ctrl && p->mountconfig[i].ci.controller_type_unit == ctrlunit && p->mountconfig[i].ci.controller_unit == cunit) {
cunit++;
if (ctrl >= HD_CONTROLLER_TYPE_IDE_FIRST && ctrl <= HD_CONTROLLER_TYPE_IDE_LAST && cunit == 4)
- return NULL;
+ return nullptr;
if (ctrl >= HD_CONTROLLER_TYPE_SCSI_FIRST && ctrl <= HD_CONTROLLER_TYPE_SCSI_LAST && cunit >= 7)
- return NULL;
+ return nullptr;
}
}
if (i == p->mountitems) {
@@ -2983,7 +2299,7 @@ struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, st
if (ci->type == UAEDEV_CD) {
for (i = 0; i < p->mountitems; i++) {
if (p->mountconfig[i].ci.type == ci->type)
- return NULL;
+ return nullptr;
}
}
uci = getuci(p);
@@ -2994,11 +2310,11 @@ struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, st
uci = &p->mountconfig[index];
}
if (!uci)
- return NULL;
+ return nullptr;
memcpy(&uci->ci, ci, sizeof(struct uaedev_config_info));
- validatedevicename(uci->ci.devname, NULL);
- validatevolumename(uci->ci.volname, NULL);
+ validatedevicename(uci->ci.devname, nullptr);
+ validatevolumename(uci->ci.volname, nullptr);
if (!uci->ci.devname[0] && ci->type != UAEDEV_CD) {
TCHAR base[32];
TCHAR base2[32];
@@ -3013,14 +2329,13 @@ struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, st
if (!_tcsicmp(base2, p->mountconfig[i].ci.devname)) {
num++;
i = -1;
- continue;
}
}
_tcscpy(uci->ci.devname, base2);
- validatedevicename(uci->ci.devname, NULL);
+ validatedevicename(uci->ci.devname, nullptr);
}
if (ci->type == UAEDEV_DIR) {
- TCHAR *s = filesys_createvolname(uci->ci.volname, uci->ci.rootdir, NULL, _T("Harddrive"));
+ TCHAR *s = filesys_createvolname(uci->ci.volname, uci->ci.rootdir, nullptr, _T("Harddrive"));
_tcscpy(uci->ci.volname, s);
xfree(s);
}
@@ -3130,19 +2445,16 @@ static void get_filesys_controller(const TCHAR *hdc, int *type, int *typenum, in
static bool parse_geo(const TCHAR *tname, struct uaedev_config_info *uci, struct hardfiledata *hfd, bool empty)
{
- struct zfile *f;
- int found;
TCHAR buf[200];
- f = zfile_fopen(tname, _T("r"));
+ struct zfile *f = zfile_fopen(tname, _T("r"));
if (!f)
return false;
- found = hfd == NULL && !empty ? 2 : 0;
+ int found = hfd == nullptr && !empty ? 2 : 0;
if (found)
write_log(_T("Geometry file '%s' detected\n"), tname);
while (zfile_fgets(buf, sizeof buf / sizeof(TCHAR), f)) {
int v;
- TCHAR *sep;
my_trim(buf);
if (_tcslen(buf) == 0)
@@ -3175,7 +2487,7 @@ static bool parse_geo(const TCHAR *tname, struct uaedev_config_info *uci, struct
if (!found)
continue;
- sep = _tcschr(buf, '=');
+ TCHAR *sep = _tcschr(buf, '=');
if (!sep)
continue;
sep[0] = 0;
@@ -3262,13 +2574,13 @@ bool get_hd_geometry(struct uaedev_config_info *uci)
hdf_close(&hfd);
}
else {
- parse_geo(tname, uci, NULL, true);
+ parse_geo(tname, uci, nullptr, true);
}
}
if (uci->rootdir[0]) {
_tcscpy(tname, uci->rootdir);
_tcscat(tname, _T(".geo"));
- return parse_geo(tname, uci, NULL, false);
+ return parse_geo(tname, uci, nullptr, false);
}
return false;
}
@@ -3276,7 +2588,7 @@ bool get_hd_geometry(struct uaedev_config_info *uci)
static int cfgfile_parse_partial_newfilesys(struct uae_prefs *p, int nr, int type, const TCHAR *value, int unit, bool uaehfentry)
{
TCHAR *tmpp;
- TCHAR *name = NULL, *path = NULL;
+ TCHAR *name, *path = nullptr;
// read only harddrive name
if (!uaehfentry)
@@ -3313,20 +2625,20 @@ static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR
{
struct uaedev_config_info uci;
TCHAR *tmpp = _tcschr(value, ','), *tmpp2;
- TCHAR *str = NULL;
+ TCHAR *str = nullptr;
TCHAR devname[MAX_DPATH], volname[MAX_DPATH];
devname[0] = volname[0] = 0;
uci_set_defaults(&uci, false);
config_newfilesystem = 1;
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto invalid_fs;
*tmpp++ = '\0';
- if (strcasecmp(value, _T("ro")) == 0)
+ if (_tcsicmp(value, _T("ro")) == 0)
uci.readonly = true;
- else if (strcasecmp(value, _T("rw")) == 0)
+ else if (_tcsicmp(value, _T("rw")) == 0)
uci.readonly = false;
else
goto invalid_fs;
@@ -3335,13 +2647,13 @@ static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR
if (type == 0) {
uci.type = UAEDEV_DIR;
tmpp = _tcschr(value, ':');
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto empty_fs;
*tmpp++ = 0;
_tcscpy(devname, value);
tmpp2 = tmpp;
tmpp = _tcschr(tmpp, ':');
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto empty_fs;
*tmpp++ = 0;
_tcscpy(volname, tmpp2);
@@ -3359,7 +2671,7 @@ static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR
}
else {
tmpp = _tcschr(tmpp, ',');
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto empty_fs;
*tmpp++ = 0;
_tcscpy(uci.rootdir, tmpp2);
@@ -3371,7 +2683,7 @@ static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR
}
else if (type == 1 || ((type == 2 || type == 3) && uaehfentry)) {
tmpp = _tcschr(value, ':');
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto invalid_fs;
*tmpp++ = '\0';
_tcscpy(devname, value);
@@ -3389,7 +2701,7 @@ static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR
}
else {
tmpp = _tcschr(tmpp, ',');
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto invalid_fs;
*tmpp++ = 0;
_tcscpy(uci.rootdir, tmpp2);
@@ -3405,7 +2717,7 @@ static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR
if (getintval2(&tmpp, &uci.bootpri, ',', false)) {
tmpp2 = tmpp;
tmpp = _tcschr(tmpp, ',');
- if (tmpp != 0) {
+ if (tmpp != nullptr) {
*tmpp++ = 0;
_tcscpy(uci.filesys, tmpp2);
TCHAR *tmpp2 = _tcschr(tmpp, ',');
@@ -3505,7 +2817,7 @@ static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR
int type = -1;
int unit = -1;
TCHAR *tmpp = _tcschr(value, ',');
- if (tmpp == NULL)
+ if (tmpp == nullptr)
return 1;
*tmpp++ = 0;
if (_tcsicmp(value, _T("hdf")) == 0) {
@@ -3539,7 +2851,7 @@ static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR
getintval(&value, &uci->bootpri, 0);
}
else if (!_tcscmp(s, _T("read-only"))) {
- cfgfile_yesno(NULL, value, NULL, &uci->readonly);
+ cfgfile_yesno(nullptr, value, nullptr, &uci->readonly);
}
else if (!_tcscmp(s, _T("volumename"))) {
_tcscpy(uci->volname, value);
@@ -3573,17 +2885,17 @@ static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR
if (config_newfilesystem)
return 1;
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto invalid_fs;
*tmpp++ = '\0';
- if (_tcscmp(value, _T("1")) == 0 || strcasecmp(value, _T("ro")) == 0
- || strcasecmp(value, _T("readonly")) == 0
- || strcasecmp(value, _T("read-only")) == 0)
+ if (_tcscmp(value, _T("1")) == 0 || _tcsicmp(value, _T("ro")) == 0
+ || _tcsicmp(value, _T("readonly")) == 0
+ || _tcsicmp(value, _T("read-only")) == 0)
uci.readonly = true;
- else if (_tcscmp(value, _T("0")) == 0 || strcasecmp(value, _T("rw")) == 0
- || strcasecmp(value, _T("readwrite")) == 0
- || strcasecmp(value, _T("read-write")) == 0)
+ else if (_tcscmp(value, _T("0")) == 0 || _tcsicmp(value, _T("rw")) == 0
+ || _tcsicmp(value, _T("readwrite")) == 0
+ || _tcsicmp(value, _T("read-write")) == 0)
uci.readonly = false;
else
goto invalid_fs;
@@ -3592,7 +2904,7 @@ static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR
if (_tcscmp(option, _T("filesystem")) == 0) {
hdf = false;
tmpp = _tcschr(value, ':');
- if (tmpp == 0)
+ if (tmpp == nullptr)
goto invalid_fs;
*tmpp++ = '\0';
_tcscpy(uci.volname, value);
@@ -3628,10 +2940,10 @@ static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR
int idx = 0;
TCHAR *s = value;
_tcscat(s, _T(","));
- struct uaedev_config_info *ci = NULL;
+ struct uaedev_config_info *ci = nullptr;
for (;;) {
TCHAR *tmpp = _tcschr(s, ',');
- if (tmpp == NULL)
+ if (tmpp == nullptr)
return 1;
*tmpp++ = 0;
if (idx == 0) {
@@ -3649,10 +2961,10 @@ static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR
TCHAR *tmpp2 = _tcschr(s, '=');
if (tmpp2) {
*tmpp2++ = 0;
- if (!strcasecmp(tmpp2, _T("false")))
+ if (!_tcsicmp(tmpp2, _T("false")))
b = false;
}
- if (!strcasecmp(s, _T("inject_icons"))) {
+ if (!_tcsicmp(s, _T("inject_icons"))) {
ci->inject_icons = b;
}
}
@@ -3669,12 +2981,11 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con
TCHAR buf[256], buf2[MAX_DPATH], buf3[MAX_DPATH];
bool dummy;
int val;
- const struct expansionromtype *ert;
for (int i = 0; expansionroms[i].name; i++) {
struct boardromconfig *brc;
int idx;
- ert = &expansionroms[i];
+ const struct expansionromtype *ert = &expansionroms[i];
for (int j = 0; j < MAX_DUPLICATE_EXPANSION_BOARDS; j++) {
TCHAR name[256];
@@ -3746,7 +3057,7 @@ static void addbcromtype(struct uae_prefs *p, int romtype, bool add, const TCHAR
clear_device_rom(p, romtype, devnum, true);
}
else {
- struct boardromconfig *brc = get_device_rom_new(p, romtype, devnum, NULL);
+ struct boardromconfig *brc = get_device_rom_new(p, romtype, devnum, nullptr);
if (brc && !brc->roms[0].romfile[0]) {
_tcscpy(brc->roms[0].romfile, romfile ? romfile : _T(":ENABLED"));
}
@@ -3757,169 +3068,64 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
{
int tmpval, dummyint, i;
bool tmpbool, dummybool;
- TCHAR *section = 0;
+ TCHAR *section = nullptr;
TCHAR tmpbuf[CONFIG_BLEN];
- if (cfgfile_yesno(option, value, _T("cpu_cycle_exact"), &p->cpu_cycle_exact)
- || cfgfile_yesno(option, value, _T("blitter_cycle_exact"), &p->blitter_cycle_exact)) {
- if (p->cpu_model >= 68020 && p->cachesize > 0)
- p->cpu_cycle_exact = p->blitter_cycle_exact = 0;
- /* we don't want cycle-exact in 68020/40+JIT modes */
- return 1;
- }
- if (cfgfile_yesno(option, value, _T("cycle_exact"), &tmpbool)) {
- p->cpu_cycle_exact = p->blitter_cycle_exact = tmpbool;
- if (p->cpu_model >= 68020 && p->cachesize > 0)
- p->cpu_cycle_exact = p->blitter_cycle_exact = false;
- return 1;
- }
-
- if (cfgfile_string(option, value, _T("cpu_multiplier"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
- p->cpu_clock_multiplier = (int)(_tstof(tmpbuf) * 256.0);
- return 1;
- }
-
-
- if (cfgfile_yesno(option, value, _T("scsi_a3000"), &dummybool)) {
- if (dummybool)
- p->cs_mbdmac = 1;
- return 1;
- }
- if (cfgfile_yesno(option, value, _T("scsi_a4000t"), &dummybool)) {
- if (dummybool)
- p->cs_mbdmac = 2;
- return 1;
- }
-
- if (cfgfile_string(option, value, _T("a2065"), p->a2065name, sizeof p->a2065name / sizeof(TCHAR)))
- return 1;
-
if (cfgfile_yesno(option, value, _T("immediate_blits"), &p->immediate_blits)
|| cfgfile_yesno(option, value, _T("fpu_no_unimplemented"), &p->fpu_no_unimplemented)
- || cfgfile_yesno(option, value, _T("cpu_no_unimplemented"), &p->int_no_unimplemented)
|| cfgfile_yesno(option, value, _T("cd32cd"), &p->cs_cd32cd)
|| cfgfile_yesno(option, value, _T("cd32c2p"), &p->cs_cd32c2p)
|| cfgfile_yesno(option, value, _T("cd32nvram"), &p->cs_cd32nvram)
- || cfgfile_yesno(option, value, _T("cdtvcd"), &p->cs_cdtvcd)
- || cfgfile_yesno(option, value, _T("cdtvram"), &p->cs_cdtvram)
- || cfgfile_yesno(option, value, _T("a1000ram"), &p->cs_a1000ram)
|| cfgfile_yesno(option, value, _T("pcmcia"), &p->cs_pcmcia)
- || cfgfile_yesno(option, value, _T("scsi_cdtv"), &p->cs_cdtvscsi)
- || cfgfile_yesno(option, value, _T("scsi_a4091"), &p->a4091)
- || cfgfile_yesno(option, value, _T("scsi_a2091"), &p->a2091)
|| cfgfile_yesno(option, value, _T("cia_overlay"), &p->cs_ciaoverlay)
- || cfgfile_yesno(option, value, _T("bogomem_fast"), &p->cs_slowmemisfast)
|| cfgfile_yesno(option, value, _T("ksmirror_e0"), &p->cs_ksmirror_e0)
|| cfgfile_yesno(option, value, _T("ksmirror_a8"), &p->cs_ksmirror_a8)
- || cfgfile_yesno(option, value, _T("resetwarning"), &p->cs_resetwarning)
|| cfgfile_yesno(option, value, _T("cia_todbug"), &p->cs_ciatodbug)
- || cfgfile_yesno(option, value, _T("denise_noehb"), &p->cs_denisenoehb)
- || cfgfile_yesno(option, value, _T("ics_agnus"), &p->cs_dipagnus)
- || cfgfile_yesno(option, value, _T("agnus_bltbusybug"), &p->cs_agnusbltbusybug)
|| cfgfile_yesno(option, value, _T("z3_autoconfig"), &p->cs_z3autoconfig)
- || cfgfile_yesno(option, value, _T("gfxcard_hardware_vblank"), &p->rtg_hardwareinterrupt)
- || cfgfile_yesno(option, value, _T("gfxcard_hardware_sprite"), &p->rtg_hardwaresprite)
- || cfgfile_yesno(option, value, _T("synchronize_clock"), &p->tod_hack)
- || cfgfile_yesno(option, value, _T("kickshifter"), &p->kickshifter)
- || cfgfile_yesno(option, value, _T("ks_write_enabled"), &p->rom_readwrite)
|| cfgfile_yesno(option, value, _T("ntsc"), &p->ntscmode)
- || cfgfile_yesno(option, value, _T("sana2"), &p->sana2)
- || cfgfile_yesno(option, value, _T("genlock"), &p->genlock)
|| cfgfile_yesno(option, value, _T("cpu_compatible"), &p->cpu_compatible)
|| cfgfile_yesno(option, value, _T("cpu_24bit_addressing"), &p->address_space_24)
- || cfgfile_yesno(option, value, _T("parallel_on_demand"), &p->parallel_demand)
- || cfgfile_yesno(option, value, _T("parallel_postscript_emulation"), &p->parallel_postscript_emulation)
- || cfgfile_yesno(option, value, _T("parallel_postscript_detection"), &p->parallel_postscript_detection)
- || cfgfile_yesno(option, value, _T("serial_on_demand"), &p->serial_demand)
- || cfgfile_yesno(option, value, _T("serial_hardware_ctsrts"), &p->serial_hwctsrts)
- || cfgfile_yesno(option, value, _T("serial_direct"), &p->serial_direct)
- || cfgfile_yesno(option, value, _T("comp_nf"), &p->compnf)
- || cfgfile_yesno(option, value, _T("comp_constjump"), &p->comp_constjump)
- || cfgfile_yesno(option, value, _T("comp_oldsegv"), &p->comp_oldsegv)
- || cfgfile_yesno(option, value, _T("compforcesettings"), &dummybool)
- || cfgfile_yesno(option, value, _T("compfpu"), &p->compfpu)
|| cfgfile_yesno(option, value, _T("fpu_strict"), &p->fpu_strict)
|| cfgfile_yesno(option, value, _T("fpu_softfloat"), &p->fpu_softfloat)
- || cfgfile_yesno(option, value, _T("comp_midopt"), &p->comp_midopt)
- || cfgfile_yesno(option, value, _T("comp_lowopt"), &p->comp_lowopt)
- || cfgfile_yesno(option, value, _T("rtg_nocustom"), &p->picasso96_nocustom)
|| cfgfile_yesno(option, value, _T("floppy_write_protect"), &p->floppy_read_only)
- || cfgfile_yesno(option, value, _T("harddrive_write_protect"), &p->harddrive_read_only)
- || cfgfile_yesno(option, value, _T("uae_hide_autoconfig"), &p->uae_hide_autoconfig)
- || cfgfile_yesno(option, value, _T("uaeserial"), &p->uaeserial))
+ || cfgfile_yesno(option, value, _T("harddrive_write_protect"), &p->harddrive_read_only))
return 1;
if (cfgfile_intval(option, value, _T("cachesize"), &p->cachesize, 1)
- || cfgfile_intval(option, value, _T("chipset_hacks"), &p->cs_hacks, 1)
- || cfgfile_intval(option, value, _T("serial_stopbits"), &p->serial_stopbits, 1)
- || cfgfile_intval(option, value, _T("cpu060_revision"), &p->cpu060_revision, 1)
- || cfgfile_intval(option, value, _T("fpu_revision"), &p->fpu_revision, 1)
- || cfgfile_intval(option, value, _T("cdtvramcard"), &p->cs_cdtvcard, 1)
|| cfgfile_intval(option, value, _T("cd32nvram_size"), &p->cs_cd32nvram_size, 1024)
|| cfgfile_intval(option, value, _T("fatgary"), &p->cs_fatgaryrev, 1)
|| cfgfile_intval(option, value, _T("ramsey"), &p->cs_ramseyrev, 1)
- || cfgfile_doubleval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate)
+ || cfgfile_floatval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate)
|| cfgfile_intval(option, value, _T("a3000mem_size"), &p->mbresmem_low_size, 0x100000)
|| cfgfile_intval(option, value, _T("mbresmem_size"), &p->mbresmem_high_size, 0x100000)
- || cfgfile_intval(option, value, _T("megachipmem_size"), &p->z3chipmem_size, 0x100000)
- || cfgfile_intval(option, value, _T("z3mem_start"), &p->z3fastmem_start, 1)
+ || cfgfile_intval(option, value, _T("z3mem_start"), &p->z3autoconfig_start, 1)
|| cfgfile_intval(option, value, _T("bogomem_size"), &p->bogomem_size, 0x40000)
- || cfgfile_intval(option, value, _T("gfxcard_size"), &p->rtgmem_size, 0x100000)
- || cfgfile_strval(option, value, _T("gfxcard_type"), &p->rtgmem_type, rtgtype, 0)
|| cfgfile_intval(option, value, _T("rtg_modes"), &p->picasso96_modeflags, 1)
|| cfgfile_intval(option, value, _T("floppy_speed"), &p->floppy_speed, 1)
|| cfgfile_intval(option, value, _T("cd_speed"), &p->cd_speed, 1)
|| cfgfile_intval(option, value, _T("floppy_write_length"), &p->floppy_write_length, 1)
- || cfgfile_intval(option, value, _T("floppy_random_bits_min"), &p->floppy_random_bits_min, 1)
- || cfgfile_intval(option, value, _T("floppy_random_bits_max"), &p->floppy_random_bits_max, 1)
|| cfgfile_intval(option, value, _T("nr_floppies"), &p->nr_floppies, 1)
|| cfgfile_intval(option, value, _T("floppy0type"), &p->floppyslots[0].dfxtype, 1)
|| cfgfile_intval(option, value, _T("floppy1type"), &p->floppyslots[1].dfxtype, 1)
|| cfgfile_intval(option, value, _T("floppy2type"), &p->floppyslots[2].dfxtype, 1)
- || cfgfile_intval(option, value, _T("floppy3type"), &p->floppyslots[3].dfxtype, 1)
- || cfgfile_intval(option, value, _T("maprom"), &p->maprom, 1)
- || cfgfile_intval(option, value, _T("parallel_autoflush"), &p->parallel_autoflush_time, 1)
- || cfgfile_intval(option, value, _T("uae_hide"), &p->uae_hide, 1)
- || cfgfile_intval(option, value, _T("cpu_frequency"), &p->cpu_frequency, 1)
- || cfgfile_intval(option, value, _T("kickstart_ext_rom_file2addr"), &p->romextfile2addr, 1)
- || cfgfile_intval(option, value, _T("catweasel"), &p->catweasel, 1))
+ || cfgfile_intval(option, value, _T("floppy3type"), &p->floppyslots[3].dfxtype, 1))
return 1;
- if (cfgfile_strval(option, value, _T("comp_trustbyte"), &p->comptrustbyte, compmode, 0)
- || cfgfile_strval(option, value, _T("rtc"), &p->cs_rtc, rtctype, 0)
+ if (cfgfile_strval(option, value, _T("rtc"), &p->cs_rtc, rtctype, 0)
|| cfgfile_strval(option, value, _T("ciaatod"), &p->cs_ciaatod, ciaatodmode, 0)
- || cfgfile_strval(option, value, _T("ide"), &p->cs_ide, idemode, 0)
- || cfgfile_strval(option, value, _T("scsi"), &p->scsi, scsimode, 0)
- || cfgfile_strval(option, value, _T("comp_trustword"), &p->comptrustword, compmode, 0)
- || cfgfile_strval(option, value, _T("comp_trustlong"), &p->comptrustlong, compmode, 0)
- || cfgfile_strval(option, value, _T("comp_trustnaddr"), &p->comptrustnaddr, compmode, 0)
|| cfgfile_strval(option, value, _T("collision_level"), &p->collision_level, collmode, 0)
- || cfgfile_strval(option, value, _T("parallel_matrix_emulation"), &p->parallel_matrix_emulation, epsonprinter, 0)
- || cfgfile_strval(option, value, _T("monitoremu"), &p->monitoremu, specialmonitors, 0)
|| cfgfile_strval(option, value, _T("waiting_blits"), &p->waiting_blits, waitblits, 0)
|| cfgfile_strval(option, value, _T("floppy_auto_extended_adf"), &p->floppy_auto_ext2, autoext2, 0)
|| cfgfile_strval(option, value, _T("z3mapping"), &p->z3_mapping_mode, z3mapping, 0)
|| cfgfile_strval(option, value, _T("boot_rom_uae"), &p->boot_rom, uaebootrom, 0)
- || cfgfile_strval(option, value, _T("uaeboard"), &p->uaeboard, uaeboard, 0)
- || cfgfile_strboolval(option, value, _T("comp_flushmode"), &p->comp_hardflush, flushmode, 0))
+ || cfgfile_strval(option, value, _T("uaeboard"), &p->uaeboard, uaeboard, 0))
return 1;
- if (cfgfile_path(option, value, _T("kickstart_rom_file"), p->romfile, sizeof p->romfile / sizeof(TCHAR), &p->path_rom)
- || cfgfile_path(option, value, _T("kickstart_ext_rom_file"), p->romextfile, sizeof p->romextfile / sizeof(TCHAR), &p->path_rom)
- || cfgfile_path(option, value, _T("kickstart_ext_rom_file2"), p->romextfile2, sizeof p->romextfile2 / sizeof(TCHAR), &p->path_rom)
- || cfgfile_path(option, value, _T("a2091_rom_file"), p->a2091romfile, sizeof p->a2091romfile / sizeof(TCHAR), &p->path_rom)
- || cfgfile_path(option, value, _T("a4091_rom_file"), p->a4091romfile, sizeof p->a4091romfile / sizeof(TCHAR), &p->path_rom)
- || cfgfile_rom(option, value, _T("kickstart_rom_file_id"), p->romfile, sizeof p->romfile / sizeof(TCHAR))
- || cfgfile_rom(option, value, _T("kickstart_ext_rom_file_id"), p->romextfile, sizeof p->romextfile / sizeof(TCHAR))
- || cfgfile_rom(option, value, _T("a2091_rom_file_id"), p->a2091romfile, sizeof p->a2091romfile / sizeof(TCHAR))
- || cfgfile_rom(option, value, _T("a4091_rom_file_id"), p->a4091romfile, sizeof p->a4091romfile / sizeof(TCHAR))
- || cfgfile_path(option, value, _T("amax_rom_file"), p->amaxromfile, sizeof p->amaxromfile / sizeof(TCHAR))
- || cfgfile_path(option, value, _T("flash_file"), p->flashfile, sizeof p->flashfile / sizeof(TCHAR), &p->path_rom)
- || cfgfile_path(option, value, _T("cart_file"), p->cartfile, sizeof p->cartfile / sizeof(TCHAR), &p->path_rom)
- || cfgfile_path(option, value, _T("rtc_file"), p->rtcfile, sizeof p->rtcfile / sizeof(TCHAR), &p->path_rom)
- || cfgfile_string(option, value, _T("pci_devices"), p->pci_devices, sizeof p->pci_devices / sizeof(TCHAR))
- || cfgfile_string(option, value, _T("ghostscript_parameters"), p->ghostscript_parameters, sizeof p->ghostscript_parameters / sizeof(TCHAR)))
+ if (cfgfile_path(option, value, _T("kickstart_rom_file"), p->romfile, sizeof p->romfile / sizeof(TCHAR))
+ || cfgfile_path(option, value, _T("kickstart_ext_rom_file"), p->romextfile, sizeof p->romextfile / sizeof(TCHAR))
+ || cfgfile_path(option, value, _T("flash_file"), p->flashfile, sizeof p->flashfile / sizeof(TCHAR))
+ || cfgfile_path(option, value, _T("cart_file"), p->cartfile, sizeof p->cartfile / sizeof(TCHAR)))
return 1;
if (cfgfile_string(option, value, _T("uaeboard_options"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
@@ -3938,12 +3144,12 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
if (cfgfile_yesno(option, value, _T("pcmcia"), &p->cs_pcmcia)) {
if (p->cs_pcmcia)
- addbcromtype(p, ROMTYPE_MB_PCMCIA, true, NULL, 0);
+ addbcromtype(p, ROMTYPE_MB_PCMCIA, true, nullptr, 0);
return 1;
}
if (cfgfile_strval(option, value, _T("ide"), &p->cs_ide, idemode, 0)) {
if (p->cs_ide)
- addbcromtype(p, ROMTYPE_MB_IDE, true, NULL, 0);
+ addbcromtype(p, ROMTYPE_MB_IDE, true, nullptr, 0);
return 1;
}
if (cfgfile_yesno(option, value, _T("cd32fmv"), &p->cs_cd32fmv)) {
@@ -4015,7 +3221,7 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
for (i = 0; i < 4; i++) {
_stprintf(tmpbuf, _T("floppy%d"), i);
- if (cfgfile_path(option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR), &p->path_floppy))
+ if (cfgfile_path(option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR)))
return 1;
}
@@ -4043,11 +3249,6 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
return 1;
}
- if (cfgfile_string(option, value, _T("mmu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
- p->mmu_model = _tstol(tmpbuf);
- return 1;
- }
-
if (cfgfile_string(option, value, _T("fpu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
p->fpu_model = _tstol(tmpbuf);
return 1;
@@ -4061,18 +3262,23 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
/* old-style CPU configuration */
if (cfgfile_string(option, value, _T("cpu_type"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
+ // 68000/010 32-bit addressing was not available until 2.8.2
+ bool force24bit = p->config_version <= ((2 << 16) | (8 << 8) | (1 << 0));
p->fpu_model = 0;
- p->address_space_24 = 0;
+ p->address_space_24 = false;
p->cpu_model = 680000;
if (!_tcscmp(tmpbuf, _T("68000"))) {
p->cpu_model = 68000;
+ if (force24bit)
+ p->address_space_24 = true;
}
else if (!_tcscmp(tmpbuf, _T("68010"))) {
p->cpu_model = 68010;
+ if (force24bit)
+ p->address_space_24 = true;
}
else if (!_tcscmp(tmpbuf, _T("68ec020"))) {
p->cpu_model = 68020;
- p->address_space_24 = 1;
}
else if (!_tcscmp(tmpbuf, _T("68020"))) {
p->cpu_model = 68020;
@@ -4080,7 +3286,7 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
else if (!_tcscmp(tmpbuf, _T("68ec020/68881"))) {
p->cpu_model = 68020;
p->fpu_model = 68881;
- p->address_space_24 = 1;
+ p->address_space_24 = true;
}
else if (!_tcscmp(tmpbuf, _T("68020/68881"))) {
p->cpu_model = 68020;
@@ -4090,10 +3296,6 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
p->cpu_model = 68040;
p->fpu_model = 68040;
}
- else if (!_tcscmp(tmpbuf, _T("68060"))) {
- p->cpu_model = 68060;
- p->fpu_model = 68060;
- }
return 1;
}
@@ -4111,26 +3313,17 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
p->m68k_speed *= CYCLE_UNIT;
return 1;
}
- if (cfgfile_doubleval(option, value, _T("cpu_throttle"), &p->m68k_speed_throttle)) {
- return 1;
- }
if (cfgfile_intval(option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1)) {
if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT) {
int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT;
p->m68k_speed = (p->m68k_speed + factor - 1) / factor;
}
- if (strcasecmp(value, _T("max")) == 0)
+ if (_tcsicmp(value, _T("max")) == 0)
p->m68k_speed = -1;
return 1;
}
- if (cfgfile_intval(option, value, _T("dongle"), &p->dongle, 1)) {
- if (p->dongle == 0)
- cfgfile_strval(option, value, _T("dongle"), &p->dongle, dongles, 0);
- return 1;
- }
-
- if (strcasecmp(option, _T("quickstart")) == 0) {
+ if (_tcsicmp(option, _T("quickstart")) == 0) {
int model = 0;
TCHAR *tmpp = _tcschr(value, ',');
if (tmpp) {
@@ -4203,9 +3396,9 @@ void cfgfile_compatibility_rtg(struct uae_prefs *p)
void cfgfile_compatibility_romtype(struct uae_prefs *p)
{
- addbcromtype(p, ROMTYPE_MB_PCMCIA, p->cs_pcmcia, NULL, 0);
+ addbcromtype(p, ROMTYPE_MB_PCMCIA, p->cs_pcmcia, nullptr, 0);
- addbcromtype(p, ROMTYPE_MB_IDE, p->cs_ide != 0, NULL, 0);
+ addbcromtype(p, ROMTYPE_MB_IDE, p->cs_ide != 0, nullptr, 0);
addbcromtype(p, ROMTYPE_CD32CART, p->cs_cd32fmv, p->cartfile, 0);
}
@@ -4218,7 +3411,7 @@ static void calcformula(struct uae_prefs *prefs, TCHAR *in)
TCHAR out[MAX_DPATH], configvalue[CONFIG_BLEN];
TCHAR *p = out;
double val;
- int cnt1, cnt2;
+ int cnt2;
static bool updatestore;
if (_tcslen(in) < 2 || in[0] != '[' || in[_tcslen(in) - 1] != ']')
@@ -4228,7 +3421,7 @@ static void calcformula(struct uae_prefs *prefs, TCHAR *in)
updatestore = false;
if (!configstore)
return;
- cnt1 = cnt2 = 0;
+ int cnt1 = cnt2 = 0;
for (int i = 1; i < _tcslen(in) - 1; i++) {
TCHAR c = _totupper(in[i]);
if (c >= 'A' && c <= 'Z') {
@@ -4263,16 +3456,15 @@ static void calcformula(struct uae_prefs *prefs, TCHAR *in)
return;
}
if (calc(out, &val)) {
- if (val - (int)val != 0.0f)
+ if (val - int(val) != 0.0f)
_stprintf(in, _T("%f"), val);
else
_stprintf(in, _T("%d"), (int)val);
updatestore = true;
- return;
}
}
-int cfgfile_parse_option(struct uae_prefs *p, TCHAR *option, TCHAR *value, int type)
+int cfgfile_parse_option(struct uae_prefs *p, const TCHAR *option, TCHAR *value, int type)
{
calcformula(p, value);
@@ -4284,17 +3476,18 @@ int cfgfile_parse_option(struct uae_prefs *p, TCHAR *option, TCHAR *value, int t
return 1;
if (!_tcscmp(option, _T("config_host")))
return 1;
- if (cfgfile_path(option, value, _T("config_hardware_path"), p->config_hardware_path, sizeof p->config_hardware_path / sizeof(TCHAR)))
- return 1;
- if (cfgfile_path(option, value, _T("config_host_path"), p->config_host_path, sizeof p->config_host_path / sizeof(TCHAR)))
- return 1;
if (type == 0 || (type & CONFIG_TYPE_HARDWARE)) {
if (cfgfile_parse_hardware(p, option, value))
return 1;
}
if (type == 0 || (type & CONFIG_TYPE_HOST)) {
- if (cfgfile_parse_host(p, option, value))
+ // cfgfile_parse_host may modify the option (convert to lowercase).
+ TCHAR* writable_option = my_strdup(option);
+ if (cfgfile_parse_host(p, writable_option, value)) {
+ free(writable_option);
return 1;
+ }
+ free(writable_option);
}
if (type > 0 && (type & (CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST)) != (CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST))
return 1;
@@ -4312,14 +3505,11 @@ static int isutf8ext(TCHAR *s)
int cfgfile_separate_linea(const TCHAR *filename, char *line, TCHAR *line1b, TCHAR *line2b)
{
- char *line1, *line2;
- int i;
-
- line1 = line;
+ char *line1 = line;
line1 += strspn(line1, "\t \r\n");
if (*line1 == ';')
return 0;
- line2 = strchr(line, '=');
+ char *line2 = strchr(line, '=');
if (!line2) {
TCHAR *s = au(line1);
cfgfile_warning(_T("CFGFILE: '%s', linea was incomplete with only %s\n"), filename, s);
@@ -4329,7 +3519,7 @@ int cfgfile_separate_linea(const TCHAR *filename, char *line, TCHAR *line1b, TCH
*line2++ = '\0';
/* Get rid of whitespace. */
- i = strlen(line2);
+ int i = strlen(line2);
while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
|| line2[i - 1] == '\r' || line2[i - 1] == '\n'))
line2[--i] = '\0';
@@ -4358,14 +3548,11 @@ int cfgfile_separate_linea(const TCHAR *filename, char *line, TCHAR *line1b, TCH
static int cfgfile_separate_line(TCHAR *line, TCHAR *line1b, TCHAR *line2b)
{
- TCHAR *line1, *line2;
- int i;
-
- line1 = line;
+ TCHAR *line1 = line;
line1 += _tcsspn(line1, _T("\t \r\n"));
if (*line1 == ';')
return 0;
- line2 = _tcschr(line, '=');
+ TCHAR *line2 = _tcschr(line, '=');
if (!line2) {
cfgfile_warning(_T("CFGFILE: line was incomplete with only %s\n"), line1);
return 0;
@@ -4373,7 +3560,7 @@ static int cfgfile_separate_line(TCHAR *line, TCHAR *line1b, TCHAR *line2b)
*line2++ = '\0';
/* Get rid of whitespace. */
- i = _tcslen(line2);
+ int i = _tcslen(line2);
while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
|| line2[i - 1] == '\r' || line2[i - 1] == '\n'))
line2[--i] = '\0';
@@ -4404,7 +3591,7 @@ static int isobsolete(TCHAR *s)
{
int i = 0;
while (obsolete[i]) {
- if (!strcasecmp(s, obsolete[i])) {
+ if (!_tcsicmp(s, obsolete[i])) {
cfgfile_warning_obsolete(_T("obsolete config entry '%s'\n"), s);
return 1;
}
@@ -4427,14 +3614,13 @@ static void cfgfile_parse_separated_line(struct uae_prefs *p, TCHAR *line1b, TCH
{
TCHAR line3b[CONFIG_BLEN], line4b[CONFIG_BLEN];
struct strlist *sl;
- int ret;
_tcscpy(line3b, line1b);
_tcscpy(line4b, line2b);
- ret = cfgfile_parse_option(p, line1b, line2b, type);
+ int ret = cfgfile_parse_option(p, line1b, line2b, type);
if (!isobsolete(line3b)) {
for (sl = p->all_lines; sl; sl = sl->next) {
- if (sl->option && !strcasecmp(line1b, sl->option)) break;
+ if (sl->option && !_tcsicmp(line1b, sl->option)) break;
}
if (!sl) {
struct strlist *u = xcalloc(struct strlist, 1);
@@ -4508,7 +3694,7 @@ static bool createconfigstore(struct uae_prefs *p)
{
uae_u8 zeros[4] = { 0 };
zfile_fclose(configstore);
- configstore = zfile_fopen_empty(NULL, _T("configstore"), 50000);
+ configstore = zfile_fopen_empty(nullptr, _T("configstore"), 50000);
if (!configstore)
return false;
zfile_fseek(configstore, 0, SEEK_SET);
@@ -4525,16 +3711,14 @@ static char *cfg_fgets(char *line, int max, struct zfile *fh)
if (fh)
return zfile_fgetsa(line, max, fh);
- return 0;
+ return nullptr;
}
static int cfgfile_load_2(struct uae_prefs *p, const TCHAR *filename, bool real, int *type)
{
int i;
- struct zfile *fh;
char linea[CONFIG_BLEN];
TCHAR line[CONFIG_BLEN], line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
- struct strlist *sl;
bool type1 = false, type2 = false;
int askedtype = 0;
@@ -4548,16 +3732,16 @@ static int cfgfile_load_2(struct uae_prefs *p, const TCHAR *filename, bool real,
//reset_inputdevice_config (p);
}
- fh = zfile_fopen(filename, _T("r"), ZFD_NORMAL);
+ struct zfile *fh = zfile_fopen(filename, _T("r"), ZFD_NORMAL);
if (!fh)
return 0;
- while (cfg_fgets(linea, sizeof(linea), fh) != 0) {
+ while (cfg_fgets(linea, sizeof(linea), fh) != nullptr) {
trimwsa(linea);
if (strlen(linea) > 0) {
if (linea[0] == '#' || linea[0] == ';') {
struct strlist *u = xcalloc(struct strlist, 1);
- u->option = NULL;
+ u->option = nullptr;
TCHAR *com = au(linea);
u->value = my_strdup(com);
xfree(com);
@@ -4568,7 +3752,7 @@ static int cfgfile_load_2(struct uae_prefs *p, const TCHAR *filename, bool real,
}
if (!cfgfile_separate_linea(filename, linea, line1b, line2b))
continue;
- type1 = type2 = 0;
+ type1 = type2 = false;
if (cfgfile_yesno(line1b, line2b, _T("config_hardware"), &type1) ||
cfgfile_yesno(line1b, line2b, _T("config_host"), &type2)) {
if (type1 && type)
@@ -4593,7 +3777,7 @@ static int cfgfile_load_2(struct uae_prefs *p, const TCHAR *filename, bool real,
if (!real)
return 1;
- for (sl = temp_lines; sl; sl = sl->next) {
+ for (struct strlist *sl = temp_lines; sl; sl = sl->next) {
_stprintf(line, _T("%s=%s"), sl->option, sl->value);
cfgfile_parse_line(p, line, 0);
}
@@ -4617,14 +3801,13 @@ static int cfgfile_load_2(struct uae_prefs *p, const TCHAR *filename, bool real,
int cfgfile_load(struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig)
{
- int v;
static int recursive;
if (recursive > 1)
return 0;
recursive++;
write_log(_T("load config '%s':%d\n"), filename, type ? *type : -1);
- v = cfgfile_load_2(p, filename, 1, type);
+ int v = cfgfile_load_2(p, filename, true, type);
if (!v) {
cfgfile_warning(_T("cfgfile_load_2 failed\n"));
goto end;
@@ -4652,9 +3835,7 @@ void cfgfile_backup(const TCHAR *path)
int cfgfile_save(struct uae_prefs *p, const TCHAR *filename, int type)
{
- struct zfile *fh;
-
- fh = zfile_fopen(filename, _T("w"), ZFD_NORMAL);
+ struct zfile *fh = zfile_fopen(filename, _T("w"), ZFD_NORMAL);
if (!fh)
return 0;
@@ -4671,7 +3852,7 @@ int cfgfile_get_description(const TCHAR *filename, TCHAR *description)
struct uae_prefs *p = xmalloc(struct uae_prefs, 1);
p->description[0] = 0;
- if (cfgfile_load_2(p, filename, 0, 0)) {
+ if (cfgfile_load_2(p, filename, false, nullptr)) {
result = 1;
if (description)
_tcscpy(description, p->description);
@@ -4688,72 +3869,24 @@ int cfgfile_configuration_change(int v)
return mode;
}
-void cfgfile_show_usage(void)
-{
- int i;
- write_log(_T("UAE Configuration Help:\n") \
- _T("=======================\n"));
- for (i = 0; i < sizeof opttable / sizeof *opttable; i++)
- write_log(_T("%s: %s\n"), opttable[i].config_label, opttable[i].config_help);
-}
-
-/* This implements the old commandline option parsing. I've re-added this
-because the new way of doing things is painful for me (it requires me
-to type a couple hundred characters when invoking UAE). The following
-is far less annoying to use. */
-static void parse_gfx_specs(struct uae_prefs *p, const TCHAR *spec)
-{
- TCHAR *x0 = my_strdup(spec);
- TCHAR *x1, *x2;
-
- x1 = _tcschr(x0, ':');
- if (x1 == 0)
- goto argh;
- x2 = _tcschr(x1 + 1, ':');
- if (x2 == 0)
- goto argh;
- *x1++ = 0; *x2++ = 0;
-
- p->gfx_size_win.width = p->gfx_size_fs.width = _tstoi(x0);
- p->gfx_size_win.height = p->gfx_size_fs.height = _tstoi(x1);
- p->gfx_resolution = _tcschr(x2, 'l') != 0 ? 1 : 0;
- p->gfx_xcenter = _tcschr(x2, 'x') != 0 ? 1 : _tcschr(x2, 'X') != 0 ? 2 : 0;
- p->gfx_ycenter = _tcschr(x2, 'y') != 0 ? 1 : _tcschr(x2, 'Y') != 0 ? 2 : 0;
- p->gfx_vresolution = _tcschr(x2, 'd') != 0 ? VRES_DOUBLE : VRES_NONDOUBLE;
- p->gfx_pscanlines = _tcschr(x2, 'D') != 0;
- if (p->gfx_pscanlines)
- p->gfx_vresolution = VRES_DOUBLE;
- p->gfx_apmode[0].gfx_fullscreen = _tcschr(x2, 'a') != 0;
- p->gfx_apmode[1].gfx_fullscreen = _tcschr(x2, 'p') != 0;
-
- free(x0);
- return;
-
-argh:
- write_log(_T("Bad display mode specification.\n"));
- write_log(_T("The format to use is: \"width:height:modifiers\"\n"));
- write_log(_T("Type \"uae -h\" for detailed help.\n"));
- free(x0);
-}
-
static void parse_sound_spec(struct uae_prefs *p, const TCHAR *spec)
{
TCHAR *x0 = my_strdup(spec);
- TCHAR *x1, *x2 = NULL, *x3 = NULL, *x4 = NULL, *x5 = NULL;
+ TCHAR *x3 = nullptr;
- x1 = _tcschr(x0, ':');
- if (x1 != NULL) {
+ TCHAR *x1 = _tcschr(x0, ':');
+ if (x1 != nullptr) {
*x1++ = '\0';
- x2 = _tcschr(x1 + 1, ':');
- if (x2 != NULL) {
+ TCHAR *x2 = _tcschr(x1 + 1, ':');
+ if (x2 != nullptr) {
*x2++ = '\0';
x3 = _tcschr(x2 + 1, ':');
- if (x3 != NULL) {
+ if (x3 != nullptr) {
*x3++ = '\0';
- x4 = _tcschr(x3 + 1, ':');
- if (x4 != NULL) {
+ TCHAR *x4 = _tcschr(x3 + 1, ':');
+ if (x4 != nullptr) {
*x4++ = '\0';
- x5 = _tcschr(x4 + 1, ':');
+ TCHAR *x5 = _tcschr(x4 + 1, ':');
}
}
}
@@ -4803,7 +3936,7 @@ static void parse_joy_spec(struct uae_prefs *p, const TCHAR *spec)
if (v0 == v1)
goto bad;
/* Let's scare Pascal programmers */
- if (0)
+ if (false)
bad:
write_log(_T("Bad joystick mode specification. Use -J xy, where x and y\n")
_T("can be 0 for joystick 0, 1 for joystick 1, M for mouse, and\n")
@@ -4817,11 +3950,10 @@ static void parse_filesys_spec(struct uae_prefs *p, bool readonly, const TCHAR *
{
struct uaedev_config_info uci;
TCHAR buf[256];
- TCHAR *s2;
uci_set_defaults(&uci, false);
_tcsncpy(buf, spec, 255); buf[255] = 0;
- s2 = _tcschr(buf, ':');
+ TCHAR *s2 = _tcschr(buf, ':');
if (s2) {
*s2++ = '\0';
#ifdef __DOS__
@@ -4853,19 +3985,19 @@ static void parse_hardfile_spec(struct uae_prefs *p, const TCHAR *spec)
uci_set_defaults(&uci, false);
x1 = _tcschr(x0, ':');
- if (x1 == NULL)
+ if (x1 == nullptr)
goto argh;
*x1++ = '\0';
x2 = _tcschr(x1 + 1, ':');
- if (x2 == NULL)
+ if (x2 == nullptr)
goto argh;
*x2++ = '\0';
x3 = _tcschr(x2 + 1, ':');
- if (x3 == NULL)
+ if (x3 == nullptr)
goto argh;
*x3++ = '\0';
x4 = _tcschr(x3 + 1, ':');
- if (x4 == NULL)
+ if (x4 == nullptr)
goto argh;
*x4++ = '\0';
#ifdef FILESYS
@@ -4890,7 +4022,7 @@ static void parse_cpu_specs(struct uae_prefs *p, const TCHAR *spec)
p->cpu_model = (*spec++) * 10 + 68000;
p->address_space_24 = p->cpu_model < 68020;
- p->cpu_compatible = 0;
+ p->cpu_compatible = false;
while (*spec != '\0') {
switch (*spec) {
case 'a':
@@ -4899,14 +4031,14 @@ static void parse_cpu_specs(struct uae_prefs *p, const TCHAR *spec)
else if (p->cpu_model >= 68040)
cfgfile_warning(_T("In 68040/060 emulation, the address space is always 32 bit.\n"));
else
- p->address_space_24 = 1;
+ p->address_space_24 = true;
break;
case 'c':
if (p->cpu_model != 68000)
cfgfile_warning(_T("The more compatible CPU emulation is only available for 68000\n")
_T("emulation, not for 68010 upwards.\n"));
else
- p->cpu_compatible = 1;
+ p->cpu_compatible = true;
break;
default:
cfgfile_warning(_T("Bad CPU parameter specified.\n"));
@@ -4918,7 +4050,7 @@ static void parse_cpu_specs(struct uae_prefs *p, const TCHAR *spec)
static void cmdpath(TCHAR *dst, const TCHAR *src, int maxsz)
{
- TCHAR *s = target_expand_environment(src, NULL, 0);
+ TCHAR *s = target_expand_environment(src, nullptr, 0);
_tcsncpy(dst, s, maxsz);
dst[maxsz] = 0;
xfree(s);
@@ -4957,11 +4089,11 @@ int parse_cmdline_option(struct uae_prefs *p, TCHAR c, const TCHAR *arg)
case 'w': p->m68k_speed = _tstoi(arg); break;
- case 'G': p->start_gui = 0; break;
+ case 'G': p->start_gui = false; break;
case 'n':
- if (_tcschr(arg, 'i') != 0)
- p->immediate_blits = 1;
+ if (_tcschr(arg, 'i') != nullptr)
+ p->immediate_blits = true;
break;
case 'v':
@@ -4993,19 +4125,19 @@ int parse_cmdline_option(struct uae_prefs *p, TCHAR c, const TCHAR *arg)
break;
case 'l':
- if (0 == strcasecmp(arg, _T("de")))
+ if (0 == _tcsicmp(arg, _T("de")))
p->keyboard_lang = KBD_LANG_DE;
- else if (0 == strcasecmp(arg, _T("dk")))
+ else if (0 == _tcsicmp(arg, _T("dk")))
p->keyboard_lang = KBD_LANG_DK;
- else if (0 == strcasecmp(arg, _T("us")))
+ else if (0 == _tcsicmp(arg, _T("us")))
p->keyboard_lang = KBD_LANG_US;
- else if (0 == strcasecmp(arg, _T("se")))
+ else if (0 == _tcsicmp(arg, _T("se")))
p->keyboard_lang = KBD_LANG_SE;
- else if (0 == strcasecmp(arg, _T("fr")))
+ else if (0 == _tcsicmp(arg, _T("fr")))
p->keyboard_lang = KBD_LANG_FR;
- else if (0 == strcasecmp(arg, _T("it")))
+ else if (0 == _tcsicmp(arg, _T("it")))
p->keyboard_lang = KBD_LANG_IT;
- else if (0 == strcasecmp(arg, _T("es")))
+ else if (0 == _tcsicmp(arg, _T("es")))
p->keyboard_lang = KBD_LANG_ES;
break;
@@ -5018,7 +4150,6 @@ int parse_cmdline_option(struct uae_prefs *p, TCHAR c, const TCHAR *arg)
void cfgfile_addcfgparam(TCHAR *line)
{
- struct strlist *u;
TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
if (!line) {
@@ -5030,12 +4161,12 @@ void cfgfile_addcfgparam(TCHAR *line)
xfree(s->option);
xfree(s);
}
- temp_lines = 0;
+ temp_lines = nullptr;
return;
}
if (!cfgfile_separate_line(line, line1b, line2b))
return;
- u = xcalloc(struct strlist, 1);
+ struct strlist *u = xcalloc(struct strlist, 1);
u->option = my_strdup(line1b);
u->value = my_strdup(line2b);
u->next = temp_lines;
@@ -5048,13 +4179,11 @@ static int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max)
int slash = 0;
int quote = 0;
TCHAR tmp1[MAX_DPATH];
- const TCHAR *prev;
- int doout;
- doout = 0;
- prev = s;
+ int doout = 0;
+ const TCHAR *prev = s;
j = 0;
- outp[0] = 0;
+ outp[0] = nullptr;
while (cnt < max) {
TCHAR c = *s++;
if (!c)
@@ -5085,7 +4214,7 @@ static int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max)
if (doout) {
if (_tcslen(tmp1) > 0) {
outp[cnt++] = my_strdup(tmp1);
- outp[cnt] = 0;
+ outp[cnt] = nullptr;
}
tmp1[0] = 0;
doout = 0;
@@ -5095,7 +4224,7 @@ static int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max)
}
if (j > 0 && cnt < max) {
outp[cnt++] = my_strdup(tmp1);
- outp[cnt] = 0;
+ outp[cnt] = nullptr;
}
return cnt;
}
@@ -5182,14 +4311,13 @@ uae_u32 cfgfile_modify(uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *o
{
TCHAR *p;
TCHAR *argc[UAELIB_MAX_PARSE];
- int argv, i;
- uae_u32 err;
+ int i;
static TCHAR *configsearch;
*out = 0;
- err = 0;
- argv = 0;
- p = 0;
+ uae_u32 err = 0;
+ int argv = 0;
+ p = nullptr;
if (index != 0xffffffff) {
if (!configstore) {
err = 20;
@@ -5223,7 +4351,7 @@ uae_u32 cfgfile_modify(uae_u32 index, const TCHAR *parms, uae_u32 size, TCHAR *o
if (argv <= 1 && index == 0xffffffff) {
createconfigstore(&currprefs);
xfree(configsearch);
- configsearch = NULL;
+ configsearch = nullptr;
if (!configstore) {
err = 20;
goto end;
@@ -5258,9 +4386,9 @@ end:
uae_u32 cfgfile_uaelib_modify(TrapContext *ctx, uae_u32 index, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize)
{
- uae_char *p, *parms_p = NULL, *parms_out = NULL;
+ uae_char *p, *parms_p = nullptr, *parms_out = nullptr;
int i, ret;
- TCHAR *out_p = NULL, *parms_in = NULL;
+ TCHAR *out_p = nullptr, *parms_in = nullptr;
if (out)
trap_put_byte(ctx, out, 0);
@@ -5304,12 +4432,11 @@ end:
static const TCHAR *cfgfile_read_config_value(const TCHAR *option)
{
- struct strlist *sl;
- for (sl = currprefs.all_lines; sl; sl = sl->next) {
- if (sl->option && !strcasecmp(sl->option, option))
+ for (struct strlist *sl = currprefs.all_lines; sl; sl = sl->next) {
+ if (sl->option && !_tcsicmp(sl->option, option))
return sl->value;
}
- return NULL;
+ return nullptr;
}
uae_u32 cfgfile_uaelib(TrapContext *ctx, int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen)
@@ -5339,41 +4466,19 @@ uae_u32 cfgfile_uaelib(TrapContext *ctx, int mode, uae_u32 name, uae_u32 dst, ua
#include "sounddep/sound.h"
-void default_prefs(struct uae_prefs *p, int type)
+void default_prefs(struct uae_prefs *p, bool reset, int type)
{
int i;
int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1 };
TCHAR zero = 0;
- struct zfile *f;
reset_inputdevice_config(p, reset);
memset(p, 0, sizeof(*p));
_tcscpy(p->description, _T("UAE default configuration"));
- p->config_hardware_path[0] = 0;
- p->config_host_path[0] = 0;
- p->gfx_scandoubler = false;
p->start_gui = true;
- p->start_debugger = false;
- p->all_lines = 0;
- /* Note to porters: please don't change any of these options! UAE is supposed
- * to behave identically on all platforms if possible.
- * (TW says: maybe it is time to update default config..) */
- p->illegal_mem = 0;
- p->use_serial = 0;
- p->serial_demand = 0;
- p->serial_hwctsrts = 1;
- p->serial_stopbits = 0;
- p->parallel_demand = 0;
- p->parallel_matrix_emulation = 0;
- p->parallel_postscript_emulation = 0;
- p->parallel_postscript_detection = 0;
- p->parallel_autoflush_time = 5;
- p->ghostscript_parameters[0] = 0;
- p->uae_hide = 0;
- p->uae_hide_autoconfig = false;
- p->jit_direct_compatible_memory = true;
+ p->all_lines = nullptr;
p->z3_mapping_mode = Z3MAPPING_AUTO;
p->mountitems = 0;
@@ -5401,188 +4506,66 @@ void default_prefs(struct uae_prefs *p, int type)
p->sound_stereo_separation = 7;
p->sound_mixed_stereo_delay = 0;
p->sound_freq = DEFAULT_SOUND_FREQ;
- p->sound_maxbsiz = DEFAULT_SOUND_MAXB;
p->sound_interpol = 1;
p->sound_filter = FILTER_SOUND_OFF;
p->sound_filter_type = 0;
- p->sound_auto = 1;
p->sound_volume_cd = 20;
- p->sampler_stereo = false;
- p->sampler_buffer = 0;
- p->sampler_freq = 0;
- p->comptrustbyte = 0;
- p->comptrustword = 0;
- p->comptrustlong = 0;
- p->comptrustnaddr = 0;
- p->compnf = 1;
- p->comp_hardflush = 0;
- p->comp_constjump = 1;
- p->comp_oldsegv = 0;
- p->compfpu = 1;
- p->fpu_strict = 0;
p->cachesize = 0;
- p->avoid_cmov = 0;
- p->comp_midopt = 0;
- p->comp_lowopt = 0;
-
- for (i = 0; i < 10; i++)
- p->optcount[i] = -1;
- p->optcount[0] = 4; /* How often a block has to be executed before it is translated */
- p->optcount[1] = 0; /* How often to use the naive translation */
- p->optcount[2] = 0;
- p->optcount[3] = 0;
- p->optcount[4] = 0;
- p->optcount[5] = 0;
p->gfx_framerate = 0;
- p->gfx_autoframerate = 50;
- p->gfx_size_fs.width = 800;
- p->gfx_size_fs.height = 600;
- p->gfx_size_win.width = 720;
- p->gfx_size_win.height = 568;
- for (i = 0; i < 4; i++) {
- p->gfx_size_fs_xtra[i].width = 0;
- p->gfx_size_fs_xtra[i].height = 0;
- p->gfx_size_win_xtra[i].width = 0;
- p->gfx_size_win_xtra[i].height = 0;
- }
- p->gfx_resolution = RES_HIRES;
- p->gfx_vresolution = VRES_DOUBLE;
- p->gfx_apmode[0].gfx_fullscreen = GFX_WINDOW;
- p->gfx_apmode[1].gfx_fullscreen = GFX_WINDOW;
- p->gfx_xcenter = 0; p->gfx_ycenter = 0;
- p->gfx_xcenter_pos = -1;
- p->gfx_ycenter_pos = -1;
- p->gfx_xcenter_size = -1;
- p->gfx_ycenter_size = -1;
- p->gfx_max_horizontal = RES_HIRES;
- p->gfx_max_vertical = VRES_DOUBLE;
- p->gfx_autoresolution_minv = 0;
- p->gfx_autoresolution_minh = 0;
- p->color_mode = 2;
- p->gfx_blackerthanblack = 0;
- p->gfx_autoresolution_vga = true;
- p->gfx_apmode[0].gfx_backbuffers = 2;
- p->gfx_apmode[1].gfx_backbuffers = 1;
+ p->gfx_size.width = 320;
+ p->gfx_size.height = 256;
+ p->gfx_resolution = RES_LORES;
- p->immediate_blits = 0;
+ p->immediate_blits = false;
p->waiting_blits = 0;
p->chipset_refreshrate = 50;
p->collision_level = 2;
p->leds_on_screen = 0;
- p->leds_on_screen_mask[0] = p->leds_on_screen_mask[1] = (1 << LED_MAX) - 1;
p->boot_rom = 0;
- p->keyboard_leds_in_use = 0;
- p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0;
- p->scsi = 0;
- p->uaeserial = 0;
- p->cpu_idle = 0;
- p->turbo_emulation = 0;
- p->headless = 0;
- p->catweasel = 0;
- p->tod_hack = 0;
- p->maprom = 0;
- p->filesys_no_uaefsdb = 0;
- p->filesys_custom_uaefsdb = 1;
- p->picasso96_nocustom = 1;
- p->cart_internal = 1;
- p->sana2 = 0;
- p->clipboard_sharing = false;
- p->native_code = false;
p->cart_internal = 1;
p->cs_compatible = CP_GENERIC;
p->cs_rtc = 2;
- p->cs_df0idhw = 1;
- p->cs_a1000ram = 0;
+ p->cs_df0idhw = true;
p->cs_fatgaryrev = -1;
p->cs_ramseyrev = -1;
- p->cs_agnusrev = -1;
- p->cs_deniserev = -1;
- p->cs_mbdmac = 0;
- p->a2091 = 0;
- p->a4091 = 0;
p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = false;
p->cs_cd32nvram_size = 1024;
- p->cs_cdtvcd = p->cs_cdtvram = false;
- p->cs_cdtvcard = 0;
- p->cs_pcmcia = 0;
- p->cs_ksmirror_e0 = 1;
- p->cs_ksmirror_a8 = 0;
- p->cs_ciaoverlay = 1;
+ p->cs_pcmcia = false;
+ p->cs_ksmirror_e0 = true;
+ p->cs_ksmirror_a8 = false;
+ p->cs_ciaoverlay = true;
p->cs_ciaatod = 0;
- p->cs_df0idhw = 1;
- p->cs_slowmemisfast = 0;
- p->cs_resetwarning = 1;
+ p->cs_df0idhw = true;
p->cs_ciatodbug = false;
- for (int i = APMODE_NATIVE; i <= APMODE_RTG; i++) {
- struct gfx_filterdata *f = &p->gf[i];
- f->gfx_filter = 0;
- f->gfx_filter_scanlineratio = (1 << 4) | 1;
- for (int j = 0; j <= 2 * MAX_FILTERSHADERS; j++) {
- f->gfx_filtershader[i][0] = 0;
- f->gfx_filtermask[i][0] = 0;
- }
- f->gfx_filter_horiz_zoom_mult = 1.0;
- f->gfx_filter_vert_zoom_mult = 1.0;
- f->gfx_filter_bilinear = 0;
- f->gfx_filter_filtermode = 0;
- f->gfx_filter_keep_aspect = 0;
- f->gfx_filter_autoscale = AUTOSCALE_STATIC_AUTO;
- f->gfx_filter_keep_autoscale_aspect = false;
- f->gfx_filteroverlay_overscan = 0;
- }
-
- p->rtg_horiz_zoom_mult = 1.0;
- p->rtg_vert_zoom_mult = 1.0;
-
_tcscpy(p->floppyslots[0].df, _T("df0.adf"));
_tcscpy(p->floppyslots[1].df, _T("df1.adf"));
_tcscpy(p->floppyslots[2].df, _T("df2.adf"));
_tcscpy(p->floppyslots[3].df, _T("df3.adf"));
- for (int i = 0; i < MAX_LUA_STATES; i++) {
- p->luafiles[i][0] = 0;
- }
-
configure_rom(p, roms, 0);
_tcscpy(p->romextfile, _T(""));
- _tcscpy(p->romextfile2, _T(""));
- p->romextfile2addr = 0;
_tcscpy(p->flashfile, _T(""));
_tcscpy(p->cartfile, _T(""));
- _tcscpy(p->rtcfile, _T(""));
sprintf(p->path_rom, _T("%s/kickstarts/"), start_path_data);
sprintf(p->path_floppy, _T("%s/disks/"), start_path_data);
sprintf(p->path_hardfile, _T("%s/"), start_path_data);
sprintf(p->path_cd, _T("%s/cd32/"), start_path_data);
- p->prtname[0] = 0;
- p->sername[0] = 0;
-
p->fpu_model = 0;
p->cpu_model = 68000;
- p->m68k_speed_throttle = 0;
- p->cpu_clock_multiplier = 0;
- p->cpu_frequency = 0;
- p->mmu_model = 0;
- p->cpu060_revision = 6;
- p->fpu_revision = 0;
p->fpu_no_unimplemented = false;
- p->int_no_unimplemented = false;
- p->fpu_strict = 0;
- p->fpu_softfloat = 0;
+ p->fpu_strict = false;
+ p->fpu_softfloat = false;
p->m68k_speed = 0;
- p->cpu_compatible = 0;
- p->address_space_24 = 1;
- p->cpu_cycle_exact = 0;
- p->blitter_cycle_exact = 0;
+ p->cpu_compatible = false;
+ p->address_space_24 = true;
p->chipset_mask = CSMASK_ECS_AGNUS;
- p->genlock = 0;
- p->ntscmode = 0;
+ p->ntscmode = false;
p->filesys_limit = 0;
p->filesys_max_name = 107;
@@ -5608,22 +4591,11 @@ void default_prefs(struct uae_prefs *p, int type)
p->floppyslots[3].dfxtype = DRV_NONE;
p->floppy_speed = 100;
p->floppy_write_length = 0;
- p->floppy_random_bits_min = 1;
- p->floppy_random_bits_max = 3;
- p->dfxclickvolume = 33;
- p->dfxclickchannelmask = 0xffff;
p->cd_speed = 100;
- p->statecapturebuffersize = 100;
- p->statecapturerate = 5 * 50;
- p->inprec_autoplay = true;
-
- p->socket_emu = 0;
+ p->socket_emu = false;
p->input_tablet = TABLET_OFF;
- p->tablet_library = false;
- p->input_magic_mouse = 0;
- p->input_magic_mouse_cursor = 0;
inputdevice_default_prefs(p);
@@ -5642,10 +4614,10 @@ void default_prefs(struct uae_prefs *p, int type)
cr->vert = -1;
cr->lace = -1;
cr->vsync = -1;
- cr->framelength = -1;
cr->rate = 50.0;
cr->ntsc = 0;
cr->locked = false;
+ cr->inuse = true;
_tcscpy(cr->label, _T("PAL"));
cr = &p->cr[CHIPSET_REFRESH_NTSC];
cr->index = CHIPSET_REFRESH_NTSC;
@@ -5653,10 +4625,10 @@ void default_prefs(struct uae_prefs *p, int type)
cr->vert = -1;
cr->lace = -1;
cr->vsync = -1;
- cr->framelength = -1;
cr->rate = 60.0;
cr->ntsc = 1;
cr->locked = false;
+ cr->inuse = true;
_tcscpy(cr->label, _T("NTSC"));
savestate_state = 0;
@@ -5664,8 +4636,8 @@ void default_prefs(struct uae_prefs *p, int type)
target_default_options(p, type);
zfile_fclose(default_file);
- default_file = NULL;
- f = zfile_fopen_empty(NULL, _T("configstore"));
+ default_file = nullptr;
+ struct zfile *f = zfile_fopen_empty(nullptr, _T("configstore"));
if (f) {
uaeconfig++;
cfgfile_save_options(f, p, 0);
@@ -5678,22 +4650,16 @@ void default_prefs(struct uae_prefs *p, int type)
static void buildin_default_prefs_68020(struct uae_prefs *p)
{
p->cpu_model = 68020;
- p->address_space_24 = 1;
- p->cpu_compatible = 0;
+ p->address_space_24 = true;
+ p->cpu_compatible = false;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA;
p->chipmem_size = 0x200000;
p->bogomem_size = 0;
p->m68k_speed = -1;
}
-static void buildin_default_host_prefs(struct uae_prefs *p)
-{
-}
-
static void buildin_default_prefs(struct uae_prefs *p)
{
- buildin_default_host_prefs(p);
-
p->floppyslots[0].dfxtype = DRV_35_DD;
if (p->nr_floppies != 1 && p->nr_floppies != 2)
p->nr_floppies = 2;
@@ -5704,33 +4670,17 @@ static void buildin_default_prefs(struct uae_prefs *p)
p->fpu_model = 0;
p->cpu_model = 68000;
- p->cpu_clock_multiplier = 0;
- p->cpu_frequency = 0;
- p->cpu060_revision = 1;
- p->fpu_revision = -1;
p->m68k_speed = 0;
- p->cpu_compatible = 1;
- p->address_space_24 = 1;
- p->cpu_cycle_exact = 0;
- p->blitter_cycle_exact = 0;
+ p->cpu_compatible = true;
+ p->address_space_24 = true;
p->chipset_mask = CSMASK_ECS_AGNUS;
- p->immediate_blits = 0;
+ p->immediate_blits = false;
p->waiting_blits = 0;
p->collision_level = 2;
if (p->produce_sound < 1)
p->produce_sound = 1;
- p->scsi = 0;
- p->uaeserial = 0;
- p->cpu_idle = 0;
- p->turbo_emulation = 0;
- p->catweasel = 0;
- p->tod_hack = 0;
- p->maprom = 0;
- p->cachesize = 0;
- p->socket_emu = 0;
- p->sound_volume = 0;
+ p->socket_emu = false;
p->sound_volume_cd = 0;
- p->clipboard_sharing = false;
p->chipmem_size = 0x00080000;
p->bogomem_size = 0x00080000;
@@ -5749,38 +4699,22 @@ static void buildin_default_prefs(struct uae_prefs *p)
}
p->cs_rtc = 0;
- p->cs_a1000ram = false;
p->cs_fatgaryrev = -1;
p->cs_ramseyrev = -1;
- p->cs_agnusrev = -1;
- p->cs_deniserev = -1;
- p->cs_mbdmac = 0;
- p->a2091 = false;
- p->a4091 = false;
p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = false;
- p->cs_cdtvcd = p->cs_cdtvram = p->cs_cdtvcard = false;
p->cs_ide = 0;
- p->cs_pcmcia = 0;
- p->cs_ksmirror_e0 = 1;
- p->cs_ksmirror_a8 = 0;
- p->cs_ciaoverlay = 1;
+ p->cs_pcmcia = false;
+ p->cs_ksmirror_e0 = true;
+ p->cs_ksmirror_a8 = false;
+ p->cs_ciaoverlay = true;
p->cs_ciaatod = 0;
- p->cs_df0idhw = 1;
- p->cs_resetwarning = 0;
+ p->cs_df0idhw = true;
p->cs_ciatodbug = false;
- _tcscpy(p->romfile, _T(""));
_tcscpy(p->romextfile, _T(""));
- _tcscpy(p->a2091romfile, _T(""));
- _tcscpy(p->a4091romfile, _T(""));
- _tcscpy(p->flashfile, _T(""));
- _tcscpy(p->cartfile, _T(""));
- _tcscpy(p->rtcfile, _T(""));
- _tcscpy(p->amaxromfile, _T(""));
- p->prtname[0] = 0;
- p->sername[0] = 0;
p->mountitems = 0;
+ p->leds_on_screen = 0;
target_default_options(p, 1);
cfgfile_compatibility_romtype(p);
@@ -5791,15 +4725,11 @@ static void set_68020_compa(struct uae_prefs *p, int compa, int cd32)
switch (compa)
{
case 0:
- p->blitter_cycle_exact = 1;
+ p->cpu_compatible = 0;
p->m68k_speed = 0;
- if (p->cpu_model == 68020 && p->cachesize == 0) {
- p->cpu_cycle_exact = 1;
- p->cpu_clock_multiplier = 4 << 8;
- }
break;
case 1:
- p->cpu_compatible = true;
+ p->cpu_compatible = 0;
p->m68k_speed = 0;
break;
case 2:
@@ -5810,9 +4740,11 @@ static void set_68020_compa(struct uae_prefs *p, int compa, int cd32)
case 3:
p->cpu_compatible = 0;
p->address_space_24 = 0;
- p->cachesize = 8192;
+ p->cachesize = MAX_JIT_CACHE;
break;
}
+ if (p->cpu_model >= 68030)
+ p->address_space_24 = 0;
}
/* 0: cycle-exact
@@ -5823,11 +4755,9 @@ static void set_68020_compa(struct uae_prefs *p, int compa, int cd32)
static void set_68000_compa(struct uae_prefs *p, int compa)
{
- p->cpu_clock_multiplier = 2 << 8;
switch (compa)
{
case 0:
- p->cpu_cycle_exact = p->blitter_cycle_exact = 1;
break;
case 1:
break;
@@ -5857,18 +4787,14 @@ static int bip_a3000(struct uae_prefs *p, int config, int compa, int romcheck)
p->cpu_model = 68030;
p->fpu_model = 68882;
p->fpu_no_unimplemented = true;
- if (compa == 0)
- p->mmu_model = 68030;
- else
- p->cachesize = MAX_JIT_CACHE;
+ p->cachesize = MAX_JIT_CACHE;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
- p->cpu_compatible = p->address_space_24 = 0;
+ p->cpu_compatible = p->address_space_24 = false;
p->m68k_speed = -1;
- p->immediate_blits = 0;
+ p->immediate_blits = false;
p->produce_sound = 2;
p->floppyslots[0].dfxtype = DRV_35_HD;
p->floppy_speed = 0;
- p->cpu_idle = 150;
p->cs_compatible = CP_A3000;
p->mbresmem_low_size = 8 * 1024 * 1024;
built_in_chipset_prefs(p);
@@ -5891,9 +4817,12 @@ static int bip_a4000(struct uae_prefs *p, int config, int compa, int romcheck)
p->mbresmem_low_size = 8 * 1024 * 1024;
p->cpu_model = 68030;
p->fpu_model = 68882;
- if (config > 0) {
+ switch (config)
+ {
+ case 1:
p->cpu_model = 68040;
p->fpu_model = 68040;
+ break;
}
p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
p->cpu_compatible = p->address_space_24 = 0;
@@ -5901,10 +4830,11 @@ static int bip_a4000(struct uae_prefs *p, int config, int compa, int romcheck)
p->immediate_blits = 0;
p->produce_sound = 2;
p->cachesize = MAX_JIT_CACHE;
+
+ p->nr_floppies = 2;
p->floppyslots[0].dfxtype = DRV_35_HD;
p->floppyslots[1].dfxtype = DRV_35_HD;
p->floppy_speed = 0;
- p->cpu_idle = 150;
p->cs_compatible = CP_A4000;
built_in_chipset_prefs(p);
p->cs_ciaatod = p->ntscmode ? 2 : 1;
@@ -5931,79 +4861,20 @@ static int bip_a4000t(struct uae_prefs *p, int config, int compa, int romcheck)
p->fpu_model = 68040;
}
p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
- p->cpu_compatible = p->address_space_24 = 0;
+ p->cpu_compatible = p->address_space_24 = false;
p->m68k_speed = -1;
- p->immediate_blits = 0;
+ p->immediate_blits = false;
p->produce_sound = 2;
p->cachesize = MAX_JIT_CACHE;
p->floppyslots[0].dfxtype = DRV_35_HD;
p->floppyslots[1].dfxtype = DRV_35_HD;
p->floppy_speed = 0;
- p->cpu_idle = 150;
p->cs_compatible = CP_A4000T;
built_in_chipset_prefs(p);
p->cs_ciaatod = p->ntscmode ? 2 : 1;
return configure_rom(p, roms, romcheck);
}
-static int bip_a1000(struct uae_prefs *p, int config, int compa, int romcheck)
-{
- int roms[2];
-
- roms[0] = 24;
- roms[1] = -1;
- p->chipset_mask = 0;
- p->bogomem_size = 0;
- p->sound_filter = FILTER_SOUND_ON;
- set_68000_compa(p, compa);
- p->floppyslots[1].dfxtype = DRV_NONE;
- p->cs_compatible = CP_A1000;
- p->cs_slowmemisfast = 1;
- p->cs_dipagnus = 1;
- p->cs_agnusbltbusybug = 1;
- built_in_chipset_prefs(p);
- if (config > 0)
- p->cs_denisenoehb = 1;
- if (config > 1)
- p->chipmem_size = 0x40000;
- return configure_rom(p, roms, romcheck);
-}
-
-static int bip_cdtv(struct uae_prefs *p, int config, int compa, int romcheck)
-{
- int roms[4];
-
- p->bogomem_size = 0;
- p->chipmem_size = 0x100000;
- p->chipset_mask = CSMASK_ECS_AGNUS;
- p->cs_cdtvcd = p->cs_cdtvram = 1;
- if (config > 0)
- p->cs_cdtvcard = 64;
- p->cs_rtc = 1;
- p->nr_floppies = 0;
- p->floppyslots[0].dfxtype = DRV_NONE;
- if (config > 0)
- p->floppyslots[0].dfxtype = DRV_35_DD;
- p->floppyslots[1].dfxtype = DRV_NONE;
- set_68000_compa(p, compa);
- p->cs_compatible = CP_CDTV;
- built_in_chipset_prefs(p);
- fetch_datapath(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR));
- _tcscat(p->flashfile, _T("cdtv.nvr"));
- roms[0] = 6;
- roms[1] = 32;
- roms[2] = -1;
- if (!configure_rom(p, roms, romcheck))
- return 0;
- roms[0] = 20;
- roms[1] = 21;
- roms[2] = 22;
- roms[3] = -1;
- if (!configure_rom(p, roms, romcheck))
- return 0;
- return 1;
-}
-
static int bip_cd32(struct uae_prefs *p, int config, int compa, int romcheck)
{
int roms[3];
@@ -6088,6 +4959,9 @@ static int bip_a600(struct uae_prefs *p, int config, int compa, int romcheck)
roms[1] = 9;
roms[2] = 8;
roms[3] = -1;
+ set_68000_compa(p, compa);
+ p->cs_compatible = CP_A600;
+ built_in_chipset_prefs(p);
p->bogomem_size = 0;
p->chipmem_size = 0x100000;
if (config > 0)
@@ -6095,11 +4969,8 @@ static int bip_a600(struct uae_prefs *p, int config, int compa, int romcheck)
if (config == 1)
p->chipmem_size = 0x200000;
if (config == 2)
- p->fastmem_size = 0x400000;
+ p->fastmem[0].size = 0x400000;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
- set_68000_compa(p, compa);
- p->cs_compatible = CP_A600;
- built_in_chipset_prefs(p);
return configure_rom(p, roms, romcheck);
}
@@ -6109,6 +4980,9 @@ static int bip_a500p(struct uae_prefs *p, int config, int compa, int romcheck)
roms[0] = 7;
roms[1] = -1;
+ set_68000_compa(p, compa);
+ p->cs_compatible = CP_A500P;
+ built_in_chipset_prefs(p);
p->bogomem_size = 0;
p->chipmem_size = 0x100000;
if (config > 0)
@@ -6116,11 +4990,8 @@ static int bip_a500p(struct uae_prefs *p, int config, int compa, int romcheck)
if (config == 1)
p->chipmem_size = 0x200000;
if (config == 2)
- p->fastmem_size = 0x400000;
+ p->fastmem[0].size = 0x400000;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
- set_68000_compa(p, compa);
- p->cs_compatible = CP_A500P;
- built_in_chipset_prefs(p);
return configure_rom(p, roms, romcheck);
}
@@ -6170,92 +5041,13 @@ static int bip_a500(struct uae_prefs *p, int config, int compa, int romcheck)
p->chipset_mask = 0;
break;
}
+ p->fast_copper = 0;
set_68000_compa(p, compa);
p->cs_compatible = CP_A500;
built_in_chipset_prefs(p);
return configure_rom(p, roms, romcheck);
}
-static int bip_super(struct uae_prefs *p, int config, int compa, int romcheck)
-{
- int roms[8];
-
- roms[0] = 46;
- roms[1] = 16;
- roms[2] = 31;
- roms[3] = 15;
- roms[4] = 14;
- roms[5] = 12;
- roms[6] = 11;
- roms[7] = -1;
- p->bogomem_size = 0;
- p->chipmem_size = 0x400000;
- p->z3fastmem_size = 8 * 1024 * 1024;
- p->rtgmem_size = 16 * 1024 * 1024;
- p->cpu_model = 68040;
- p->fpu_model = 68040;
- p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
- p->cpu_compatible = p->address_space_24 = 0;
- p->m68k_speed = -1;
- p->immediate_blits = 1;
- p->produce_sound = 2;
- p->cachesize = 8192;
- p->floppyslots[0].dfxtype = DRV_35_HD;
- p->floppyslots[1].dfxtype = DRV_35_HD;
- p->floppy_speed = 0;
- p->cpu_idle = 150;
- p->scsi = 1;
- p->uaeserial = 1;
- p->socket_emu = 1;
- p->cart_internal = 0;
- p->picasso96_nocustom = 1;
- p->cs_compatible = 1;
- built_in_chipset_prefs(p);
- p->cs_ide = -1;
- p->cs_ciaatod = p->ntscmode ? 2 : 1;
- //_tcscat(p->flashfile, _T("battclock.nvr"));
- return configure_rom(p, roms, romcheck);
-}
-
-static int bip_arcadia(struct uae_prefs *p, int config, int compa, int romcheck)
-{
- int roms[4], i;
- struct romlist **rl;
-
- p->bogomem_size = 0;
- p->chipset_mask = 0;
- p->cs_rtc = 0;
- p->nr_floppies = 0;
- p->floppyslots[0].dfxtype = DRV_NONE;
- p->floppyslots[1].dfxtype = DRV_NONE;
- set_68000_compa(p, compa);
- p->cs_compatible = CP_A500;
- built_in_chipset_prefs(p);
- fetch_datapath(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR));
- _tcscat(p->flashfile, _T("arcadia.nvr"));
- roms[0] = 5;
- roms[1] = 4;
- roms[2] = -1;
- if (!configure_rom(p, roms, romcheck))
- return 0;
- roms[0] = 51;
- roms[1] = 49;
- roms[2] = -1;
- if (!configure_rom(p, roms, romcheck))
- return 0;
- rl = getarcadiaroms();
- for (i = 0; rl[i]; i++) {
- if (config-- == 0) {
- roms[0] = rl[i]->rd->id;
- roms[1] = -1;
- configure_rom(p, roms, 0);
- break;
- }
- }
- xfree(rl);
- return 1;
-}
-
int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int romcheck)
{
int v = 0;
@@ -6273,39 +5065,24 @@ int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int ro
v = bip_a600(p, config, compa, romcheck);
break;
case 3:
- v = bip_a1000(p, config, compa, romcheck);
- break;
- case 4:
v = bip_a1200(p, config, compa, romcheck);
break;
- case 5:
- v = bip_a3000(p, config, compa, romcheck);
- break;
- case 6:
+ case 4:
v = bip_a4000(p, config, compa, romcheck);
break;
- case 7:
- v = bip_a4000t(p, config, compa, romcheck);
- break;
- case 8:
+ case 5:
v = bip_cd32(p, config, compa, romcheck);
break;
- case 9:
- v = bip_cdtv(p, config, compa, romcheck);
- break;
- case 10:
- v = bip_arcadia(p, config, compa, romcheck);
- break;
- case 11:
- v = bip_super(p, config, compa, romcheck);
- break;
}
- if ((p->cpu_model >= 68020 || !p->cpu_cycle_exact) && !p->immediate_blits)
+ if (!p->immediate_blits)
p->waiting_blits = 1;
if (p->sound_filter_type == FILTER_SOUND_TYPE_A500 && (p->chipset_mask & CSMASK_AGA))
p->sound_filter_type = FILTER_SOUND_TYPE_A1200;
else if (p->sound_filter_type == FILTER_SOUND_TYPE_A1200 && !(p->chipset_mask & CSMASK_AGA))
p->sound_filter_type = FILTER_SOUND_TYPE_A500;
+ if (p->cpu_model >= 68040)
+ p->cs_bytecustomwritebug = true;
+ cfgfile_compatibility_romtype(p);
return v;
}
@@ -6314,79 +5091,65 @@ int built_in_chipset_prefs(struct uae_prefs *p)
if (!p->cs_compatible)
return 1;
- p->cs_a1000ram = 0;
p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 0;
- p->cs_cdtvcd = p->cs_cdtvram = p->cs_cdtvscsi = 0;
p->cs_fatgaryrev = -1;
p->cs_ide = 0;
p->cs_ramseyrev = -1;
- p->cs_deniserev = -1;
- p->cs_agnusrev = -1;
- p->cs_denisenoehb = 0;
- p->cs_dipagnus = 0;
- p->cs_agnusbltbusybug = 0;
- p->cs_mbdmac = 0;
p->cs_pcmcia = 0;
p->cs_ksmirror_e0 = 1;
p->cs_ksmirror_a8 = 0;
p->cs_ciaoverlay = 1;
p->cs_ciaatod = 0;
p->cs_rtc = 0;
- p->cs_rtc_adjust_mode = p->cs_rtc_adjust = 0;
p->cs_df0idhw = 1;
- p->cs_resetwarning = 1;
- p->cs_slowmemisfast = 0;
p->cs_ciatodbug = false;
+ p->cs_z3autoconfig = false;
+ p->cs_bytecustomwritebug = false;
switch (p->cs_compatible)
{
case CP_GENERIC: // generic
- p->cs_rtc = 2;
- p->cs_fatgaryrev = 0;
- p->cs_ide = -1;
- p->cs_mbdmac = -1;
- p->cs_ramseyrev = 0x0f;
- break;
- case CP_CDTV: // CDTV
- p->cs_rtc = 1;
- p->cs_cdtvcd = p->cs_cdtvram = 1;
- p->cs_df0idhw = 1;
- p->cs_ksmirror_e0 = 0;
+ if (p->cpu_model >= 68020) {
+ // big box-like
+ p->cs_rtc = 2;
+ p->cs_fatgaryrev = 0;
+ p->cs_ide = -1;
+ p->cs_ramseyrev = 0x0f;
+ }
+ else if (p->cpu_compatible) {
+ // very A500-like
+ p->cs_df0idhw = 0;
+ if (p->bogomem_size || p->chipmem_size > 0x80000 || p->fastmem[0].size)
+ p->cs_rtc = 1;
+ p->cs_ciatodbug = true;
+ }
+ else {
+ // sort of A500-like
+ p->cs_ide = -1;
+ p->cs_rtc = 1;
+ }
break;
case CP_CD32: // CD32
p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = true;
p->cs_ksmirror_e0 = 0;
p->cs_ksmirror_a8 = 1;
p->cs_ciaoverlay = 0;
- p->cs_resetwarning = 0;
break;
case CP_A500: // A500
p->cs_df0idhw = 0;
- p->cs_resetwarning = 0;
- if (p->bogomem_size || p->chipmem_size > 0x80000 || p->fastmem_size)
+ if (p->bogomem_size || p->chipmem_size > 0x80000 || p->fastmem[0].size)
p->cs_rtc = 1;
p->cs_ciatodbug = true;
break;
case CP_A500P: // A500+
p->cs_rtc = 1;
- p->cs_resetwarning = 0;
p->cs_ciatodbug = true;
break;
case CP_A600: // A600
- p->cs_rtc = 1;
p->cs_ide = IDE_A600A1200;
p->cs_pcmcia = 1;
p->cs_ksmirror_a8 = 1;
p->cs_ciaoverlay = 0;
- p->cs_resetwarning = 0;
- p->cs_ciatodbug = true;
- break;
- case CP_A1000: // A1000
- p->cs_a1000ram = 1;
- p->cs_ciaatod = p->ntscmode ? 2 : 1;
- p->cs_ksmirror_e0 = 0;
- p->cs_agnusbltbusybug = 1;
- p->cs_dipagnus = 1;
p->cs_ciatodbug = true;
break;
case CP_A1200: // A1200
@@ -6394,7 +5157,7 @@ int built_in_chipset_prefs(struct uae_prefs *p)
p->cs_pcmcia = 1;
p->cs_ksmirror_a8 = 1;
p->cs_ciaoverlay = 0;
- if (p->fastmem_size || p->z3fastmem_size)
+ if (p->fastmem[0].size || p->z3fastmem[0].size)
p->cs_rtc = 1;
break;
case CP_A2000: // A2000
@@ -6402,43 +5165,19 @@ int built_in_chipset_prefs(struct uae_prefs *p)
p->cs_ciaatod = p->ntscmode ? 2 : 1;
p->cs_ciatodbug = true;
break;
- case CP_A3000: // A3000
- p->cs_rtc = 2;
- p->cs_fatgaryrev = 0;
- p->cs_ramseyrev = 0x0d;
- p->cs_mbdmac = 1;
- p->cs_ksmirror_e0 = 0;
- p->cs_ciaatod = p->ntscmode ? 2 : 1;
- break;
- case CP_A3000T: // A3000T
- p->cs_rtc = 2;
- p->cs_fatgaryrev = 0;
- p->cs_ramseyrev = 0x0d;
- p->cs_mbdmac = 1;
- p->cs_ksmirror_e0 = 0;
- p->cs_ciaatod = p->ntscmode ? 2 : 1;
- break;
case CP_A4000: // A4000
p->cs_rtc = 2;
p->cs_fatgaryrev = 0;
p->cs_ramseyrev = 0x0f;
p->cs_ide = IDE_A4000;
- p->cs_mbdmac = 0;
- p->cs_ksmirror_a8 = 0;
- p->cs_ksmirror_e0 = 0;
- p->cs_ciaoverlay = 0;
- break;
- case CP_A4000T: // A4000T
- p->cs_rtc = 2;
- p->cs_fatgaryrev = 0;
- p->cs_ramseyrev = 0x0f;
- p->cs_ide = IDE_A4000;
- p->cs_mbdmac = 2;
p->cs_ksmirror_a8 = 0;
p->cs_ksmirror_e0 = 0;
p->cs_ciaoverlay = 0;
+ p->cs_z3autoconfig = true;
break;
}
+ if (p->cpu_model >= 68040)
+ p->cs_bytecustomwritebug = true;
return 1;
}
@@ -6458,7 +5197,7 @@ void config_check_vsync(void)
bool is_error_log(void)
{
- return error_lines != NULL;
+ return error_lines != nullptr;
}
TCHAR* get_error_log(void)
@@ -6470,7 +5209,7 @@ TCHAR* get_error_log(void)
len += _tcslen(sl->option) + 1;
}
if (!len)
- return NULL;
+ return nullptr;
TCHAR* s = xcalloc(TCHAR, len + 1);
for (sl = error_lines; sl; sl = sl->next)
{
@@ -6486,7 +5225,7 @@ void error_log(const TCHAR *format, ...)
int bufsize = 256;
va_list parms;
- if (format == NULL) {
+ if (format == nullptr) {
struct strlist **ps = &error_lines;
while (*ps) {
struct strlist *s = *ps;
@@ -6619,6 +5358,7 @@ int bip_a2000(struct uae_prefs *p, int rom)
p->bogomem_size = 0x00080000;
p->chipset_mask = 0;
p->cpu_compatible = 0;
+ p->fast_copper = 0;
p->nr_floppies = 1;
p->floppyslots[1].dfxtype = DRV_NONE;
return configure_rom(p, roms, 0);
diff --git a/src/custom.cpp b/src/custom.cpp
index cb29814f..807a5a25 100644
--- a/src/custom.cpp
+++ b/src/custom.cpp
@@ -20,7 +20,7 @@
#include "gensound.h"
#include "audio.h"
#include "sounddep/sound.h"
-#include "memory.h"
+#include "include/memory.h"
#include "custom.h"
#include "newcpu.h"
#include "cia.h"
@@ -34,7 +34,7 @@
#include "gui.h"
#include "picasso96.h"
#include "drawing.h"
-#include "ar.h"
+#include "include/ar.h"
#include "akiko.h"
#include "devices.h"
@@ -91,9 +91,6 @@ static int cia_hsync;
#define LOF_TOGGLES_NEEDED 3
static int lof_togglecnt_lace, lof_togglecnt_nlace;
-static uae_u32 sprtaba[256], sprtabb[256];
-static uae_u32 sprite_ab_merge[256];
-
/* Stupid genlock-detection prevention hack.
* We should stop calling vsync_handler() and
* hstop_handler() completely but it is not
diff --git a/src/include/gui.h b/src/include/gui.h
index 01c170a7..ff1ece0c 100644
--- a/src/include/gui.h
+++ b/src/include/gui.h
@@ -29,19 +29,20 @@ extern bool no_gui;
#define LED_CD_ACTIVE2 2
#define LED_CD_AUDIO 4
-#define LED_POWER 0
-#define LED_DF0 1
-#define LED_DF1 2
-#define LED_DF2 3
-#define LED_DF3 4
-#define LED_HD 5
-#define LED_CD 6
-#define LED_FPS 7
-#define LED_CPU 8
-#define LED_SND 9
-#define LED_MD 10
-#define LED_NET 11
-#define LED_MAX 12
+#define LED_NONE 0
+#define LED_POWER 1
+#define LED_DF0 2
+#define LED_DF1 3
+#define LED_DF2 4
+#define LED_DF3 5
+#define LED_DFs 6 // Define for any DF* access
+#define LED_HD 7
+#define LED_CD 8
+#define LED_FPS 9
+#define LED_CPU 10
+#define LED_SND 11
+#define LED_MD 12
+#define LED_MAX 13
struct gui_info
{
diff --git a/src/include/keyboard.h b/src/include/keyboard.h
index cbd789c1..e66777d0 100644
--- a/src/include/keyboard.h
+++ b/src/include/keyboard.h
@@ -133,40 +133,28 @@
#define KBLED_CAPSLOCKM (1 << KBLED_CAPSLOCKB)
#define KBLED_SCROLLLOCKM (1 << KBLED_SCROLLLOCKB)
-enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT_FILE, AKS_SCREENSHOT_CLIPBOARD, AKS_FREEZEBUTTON,
- AKS_FLOPPY0, AKS_FLOPPY1, AKS_FLOPPY2, AKS_FLOPPY3,
- AKS_EFLOPPY0, AKS_EFLOPPY1, AKS_EFLOPPY2, AKS_EFLOPPY3,
+enum aks {
+ AKS_ENTERGUI = 0x200,
+ AKS_SCREENSHOT_FILE,
+ AKS_SCREENSHOT_CLIPBOARD,
+ AKS_FREEZEBUTTON,
+ AKS_FLOPPY0, AKS_FLOPPY1, AKS_FLOPPY2, AKS_FLOPPY3,
+ AKS_EFLOPPY0, AKS_EFLOPPY1, AKS_EFLOPPY2, AKS_EFLOPPY3,
AKS_TOGGLEDEFAULTSCREEN,
- AKS_TOGGLEWINDOWEDFULLSCREEN, AKS_TOGGLEFULLWINDOWFULLSCREEN, AKS_TOGGLEWINDOWFULLWINDOW,
- AKS_ENTERDEBUGGER, AKS_IRQ7,
- AKS_PAUSE, AKS_WARP, AKS_INHIBITSCREEN,
- AKS_STATEREWIND, AKS_STATECURRENT, AKS_STATECAPTURE,
- AKS_VIDEORECORD,
- AKS_VOLDOWN, AKS_VOLUP, AKS_VOLMUTE,
- AKS_MVOLDOWN, AKS_MVOLUP, AKS_MVOLMUTE,
- AKS_QUIT, AKS_HARDRESET, AKS_SOFTRESET,
- AKS_STATESAVEQUICK, AKS_STATERESTOREQUICK,
- AKS_STATESAVEQUICK1, AKS_STATERESTOREQUICK1,
- AKS_STATESAVEQUICK2, AKS_STATERESTOREQUICK2,
- AKS_STATESAVEQUICK3, AKS_STATERESTOREQUICK3,
- AKS_STATESAVEQUICK4, AKS_STATERESTOREQUICK4,
- AKS_STATESAVEQUICK5, AKS_STATERESTOREQUICK5,
- AKS_STATESAVEQUICK6, AKS_STATERESTOREQUICK6,
- AKS_STATESAVEQUICK7, AKS_STATERESTOREQUICK7,
- AKS_STATESAVEQUICK8, AKS_STATERESTOREQUICK8,
- AKS_STATESAVEQUICK9, AKS_STATERESTOREQUICK9,
- AKS_STATESAVEDIALOG, AKS_STATERESTOREDIALOG,
- AKS_DECREASEREFRESHRATE,
- AKS_INCREASEREFRESHRATE,
- AKS_ARCADIADIAGNOSTICS, AKS_ARCADIAPLY1, AKS_ARCADIAPLY2, AKS_ARCADIACOIN1, AKS_ARCADIACOIN2,
- AKS_TOGGLEMOUSEGRAB, AKS_SWITCHINTERPOL, AKS_TOGGLERTG,
- AKS_INPUT_CONFIG_1,AKS_INPUT_CONFIG_2,AKS_INPUT_CONFIG_3,AKS_INPUT_CONFIG_4,
- AKS_DISKSWAPPER_NEXT,AKS_DISKSWAPPER_PREV,
- AKS_DISKSWAPPER_INSERT0,AKS_DISKSWAPPER_INSERT1,AKS_DISKSWAPPER_INSERT2,AKS_DISKSWAPPER_INSERT3,
- AKS_DISK_PREV0, AKS_DISK_PREV1, AKS_DISK_PREV2, AKS_DISK_PREV3,
- AKS_DISK_NEXT0, AKS_DISK_NEXT1, AKS_DISK_NEXT2, AKS_DISK_NEXT3,
- AKS_CDTV_FRONT_PANEL_STOP, AKS_CDTV_FRONT_PANEL_PLAYPAUSE, AKS_CDTV_FRONT_PANEL_PREV,
- AKS_CDTV_FRONT_PANEL_NEXT, AKS_CDTV_FRONT_PANEL_REW, AKS_CDTV_FRONT_PANEL_FF,
+ AKS_TOGGLEWINDOWEDFULLSCREEN,
+ AKS_IRQ7,
+ AKS_PAUSE,
+ AKS_INHIBITSCREEN,
+ AKS_VOLDOWN, AKS_VOLUP, AKS_VOLMUTE,
+ AKS_MVOLDOWN, AKS_MVOLUP, AKS_MVOLMUTE,
+ AKS_QUIT, AKS_HARDRESET, AKS_SOFTRESET,
+ AKS_STATESAVEDIALOG, AKS_STATERESTOREDIALOG,
+ AKS_DECREASEREFRESHRATE,
+ AKS_INCREASEREFRESHRATE,
+ AKS_TOGGLEMOUSEGRAB, AKS_SWITCHINTERPOL,
+ AKS_INPUT_CONFIG_1, AKS_INPUT_CONFIG_2, AKS_INPUT_CONFIG_3, AKS_INPUT_CONFIG_4,
+ AKS_SWAPJOYPORTS,
+ AKS_PASTE,
AKS_QUALIFIER1, AKS_QUALIFIER2, AKS_QUALIFIER3, AKS_QUALIFIER4,
AKS_QUALIFIER5, AKS_QUALIFIER6, AKS_QUALIFIER7, AKS_QUALIFIER8,
AKS_QUALIFIER_SPECIAL, AKS_QUALIFIER_SHIFT, AKS_QUALIFIER_CONTROL,
diff --git a/src/include/options.h b/src/include/options.h
index ce80526c..0248000f 100644
--- a/src/include/options.h
+++ b/src/include/options.h
@@ -22,13 +22,6 @@ typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR,
extern long int version;
-#define MAX_PATHS 8
-
-struct multipath
-{
- TCHAR path[MAX_PATHS][PATH_MAX];
-};
-
struct strlist {
struct strlist *next;
TCHAR *option, *value;
@@ -364,10 +357,10 @@ struct uae_prefs
int cart_internal;
struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES];
- struct multipath path_floppy;
- struct multipath path_hardfile;
- struct multipath path_rom;
- struct multipath path_cd;
+ TCHAR path_floppy[MAX_DPATH];
+ TCHAR path_hardfile[MAX_DPATH];
+ TCHAR path_rom[MAX_DPATH];
+ TCHAR path_cd[MAX_DPATH];
int m68k_speed;
int cpu_model;
diff --git a/src/include/uae.h b/src/include/uae.h
index 92c46d18..2fc07dca 100644
--- a/src/include/uae.h
+++ b/src/include/uae.h
@@ -40,7 +40,7 @@ extern uae_u32 getlocaltime (void);
extern int quit_program;
-extern TCHAR start_path_data[256];
+extern TCHAR start_path_data[MAX_DPATH];
/* This structure is used to define menus. The val field can hold key
* shortcuts, or one of these special codes:
diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp
index 61ec4112..ed2098f1 100644
--- a/src/inputdevice.cpp
+++ b/src/inputdevice.cpp
@@ -26,11 +26,11 @@
#include "custom.h"
#include "xwin.h"
#include "drawing.h"
-#include "memory.h"
+#include "include/memory.h"
#include "newcpu.h"
#include "uae.h"
#include "picasso96.h"
-#include "ar.h"
+#include "include/ar.h"
#include "gui.h"
#include "savestate.h"
#include "zfile.h"
@@ -39,12 +39,6 @@
#include "statusline.h"
#include "native2amiga_api.h"
-#if SIZEOF_TCHAR != 1
-/* FIXME: replace strcasecmp with _tcsicmp in source code instead */
-#undef strcasecmp
-#define strcasecmp _tcsicmp
-#endif
-
// 01 = host events
// 02 = joystick
// 04 = cia buttons
@@ -71,9 +65,9 @@
#define DEFEVENT(A, B, C, D, E, F) {_T(#A), B, NULL, C, D, E, F, 0 },
#define DEFEVENT2(A, B, B2, C, D, E, F, G) {_T(#A), B, B2, C, D, E, F, G },
static const struct inputevent events[] = {
- {0, 0, 0, AM_K, 0, 0, 0, 0},
+ {nullptr, nullptr, nullptr, AM_K, 0, 0, 0, 0},
#include "inputevents.def"
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {nullptr, nullptr, nullptr, 0, 0, 0, 0, 0}
};
#undef DEFEVENT
#undef DEFEVENT2
@@ -124,9 +118,8 @@ static int temp_uid_cnt[IDTYPE_MAX];
static int isdevice (struct uae_input_device *id)
{
- int i, j;
- for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
- for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
+ for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
+ for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
if (id->eventid[i][j] > 0)
return 1;
}
@@ -141,16 +134,13 @@ int inputdevice_uaelib (const TCHAR *s, const TCHAR *parm)
int i;
if (!_tcsncmp(s, _T("KEY_RAW_"), 8)) {
- // KEY_RAW_UP
- // KEY_RAW_DOWN
- int v;
const TCHAR *value = parm;
TCHAR *endptr;
int base = 10;
int state = _tcscmp(s, _T("KEY_RAW_UP")) ? 1 : 0;
if (value[0] == '0' && _totupper(value[1]) == 'X')
value += 2, base = 16;
- v = _tcstol(value, &endptr, base);
+ int v = _tcstol(value, &endptr, base);
for (i = 1; events[i].name; i++) {
const struct inputevent *ie = &events[i];
if (_tcsncmp(ie->confname, _T("KEY_"), 4))
@@ -219,14 +209,14 @@ static struct inputdevice_functions *getidf (int devnum)
{
int type = gettype (devnum);
if (type < 0)
- return NULL;
+ return nullptr;
return &idev[type];
}
const struct inputevent *inputdevice_get_eventinfo(int evt)
{
if (evt > 0 && !events[evt].name)
- return NULL;
+ return nullptr;
return &events[evt];
}
@@ -402,7 +392,7 @@ static struct jport *inputdevice_get_used_device(int portnum, int ageindex)
int idx = -1;
int used[MAX_STORED_JPORTS] = { 0 };
if (ageindex < 0)
- return NULL;
+ return nullptr;
while (ageindex >= 0) {
uae_u32 age = 0;
idx = -1;
@@ -414,7 +404,7 @@ static struct jport *inputdevice_get_used_device(int portnum, int ageindex)
}
}
if (idx < 0)
- return NULL;
+ return nullptr;
used[idx] = 1;
ageindex--;
}
@@ -529,7 +519,7 @@ static bool isemptykey(int keyboard, int scancode)
for (int k = 0; k < MAX_INPUT_SUB_EVENT; k++) {
if (na->eventid[j][k] > 0)
return false;
- if (na->custom[j][k] != NULL)
+ if (na->custom[j][k] != nullptr)
return false;
}
break;
@@ -548,7 +538,7 @@ static void out_config (struct zfile *f, int id, int num, const TCHAR *s1, const
static bool write_config_head (struct zfile *f, int idnum, int devnum, const TCHAR *name, struct uae_input_device *id, struct inputdevice_functions *idf)
{
- TCHAR *s = NULL;
+ TCHAR *s = nullptr;
TCHAR tmp2[CONFIG_BLEN];
if (idnum == GAMEPORT_INPUT_SETTINGS) {
@@ -567,7 +557,7 @@ static bool write_config_head (struct zfile *f, int idnum, int devnum, const TCH
cfgfile_write_str (f, tmp2, s);
}
- s = NULL;
+ s = nullptr;
if (id->configname)
s = id->configname;
else if (devnum < idf->get_num ())
@@ -665,9 +655,9 @@ static void write_config2 (struct zfile *f, int idnum, int i, int offset, const
evt = id->eventid[io][slotorder[j]];
custom = id->custom[io][slotorder[j]];
- if (custom == NULL && evt <= 0) {
+ if (custom == nullptr && evt <= 0) {
for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
- if ((id->port[io][k] == 0 || id->port[io][k] == MAX_JPORTS + 1) && (id->eventid[io][slotorder[k]] > 0 || id->custom[io][slotorder[k]] != NULL))
+ if ((id->port[io][k] == 0 || id->port[io][k] == MAX_JPORTS + 1) && (id->eventid[io][slotorder[k]] > 0 || id->custom[io][slotorder[k]] != nullptr))
break;
}
if (k == MAX_INPUT_SUB_EVENT)
@@ -758,7 +748,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
isempty = false;
break;
}
- if (kbr->custom[i][j] != NULL) {
+ if (kbr->custom[i][j] != nullptr) {
isempty = false;
break;
}
@@ -774,9 +764,9 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
TCHAR *custom = kbr->custom[i][slotorder[j]];
evt = kbr->eventid[i][slotorder[j]];
- if (custom == NULL && evt <= 0) {
+ if (custom == nullptr && evt <= 0) {
for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
- if (kbr->eventid[i][slotorder[k]] > 0 || kbr->custom[i][slotorder[k]] != NULL)
+ if (kbr->eventid[i][slotorder[k]] > 0 || kbr->custom[i][slotorder[k]] != nullptr)
break;
}
if (k == MAX_INPUT_SUB_EVENT)
@@ -801,7 +791,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
}
}
}
- idf->get_widget_type (devnum, i, tmp5, NULL);
+ idf->get_widget_type (devnum, i, tmp5, nullptr);
_stprintf (tmp3, _T("%d%s%s"), kbr->extra[i], tmp5[0] ? _T(".") : _T(""), tmp5[0] ? tmp5 : _T(""));
kbrlabel (tmp3);
_stprintf (tmp1, _T("keyboard.%d.button.%s"), devnum, tmp3);
@@ -827,7 +817,7 @@ static void write_config (struct zfile *f, int idnum, int devnum, const TCHAR *n
write_config2 (f, idnum, i, ID_BUTTON_OFFSET, tmp1, id);
}
-static const TCHAR *kbtypes[] = { _T("amiga"), _T("pc"), NULL };
+static const TCHAR *kbtypes[] = { _T("amiga"), _T("pc"), nullptr };
void write_inputdevice_config (struct uae_prefs *p, struct zfile *f)
{
@@ -913,7 +903,7 @@ static TCHAR *getstring (const TCHAR **pp)
bool quotedd = false;
if (*p == 0)
- return 0;
+ return nullptr;
i = 0;
while (*p != 0 && i < 1000 - 1) {
if (*p == '\"')
@@ -941,7 +931,7 @@ static void reset_inputdevice_settings (struct uae_input_device *uid)
uid->flags[l][i] = 0;
if (uid->custom[l][i]) {
xfree (uid->custom[l][i]);
- uid->custom[l][i] = NULL;
+ uid->custom[l][i] = nullptr;
}
}
}
@@ -1051,7 +1041,7 @@ static void set_kbr_default (struct uae_prefs *p, int index, int devnum, struct
if (input_get_default_keyboard (j))
kbr->enabled = 1;
for (i = 0; i < id->get_widget_num (j); i++) {
- id->get_widget_type (j, i, 0, &scancode);
+ id->get_widget_type (j, i, nullptr, &scancode);
kbr->extra[i] = scancode;
if (j == 0 || kbr->enabled)
set_kbr_default_event (kbr, trans, i);
@@ -1126,7 +1116,7 @@ static void setcompakbevent(struct uae_prefs *p, struct uae_input_device *uid, i
uid->flags[l][0] &= COMPA_RESERVED_FLAGS;
uid->port[l][0] = port + 1;
xfree(uid->custom[l][0]);
- uid->custom[l][0] = NULL;
+ uid->custom[l][0] = nullptr;
setautofireevent(uid, l, 0, af, port);
}
@@ -1233,7 +1223,7 @@ static bool read_slot (const TCHAR *parm, int num, int joystick, int button, str
{
int mask;
- if (custom == NULL && ie->name == NULL) {
+ if (custom == nullptr && ie->name == nullptr) {
if (!_tcscmp (parm, _T("NULL"))) {
if (joystick < 0) {
id->eventid[keynum][subnum] = 0;
@@ -1301,7 +1291,7 @@ static const struct inputevent *readevent (const TCHAR *name, TCHAR **customp)
while (*end && *end != '\'')
end++;
if (!customp || *end == 0)
- return NULL;
+ return nullptr;
TCHAR *custom = my_strdup (name);
custom[end - name] = 0;
*customp = custom;
@@ -1311,43 +1301,43 @@ static const struct inputevent *readevent (const TCHAR *name, TCHAR **customp)
void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *value)
{
- struct uae_input_device *id = NULL;
+ struct uae_input_device *id = nullptr;
const struct inputevent *ie;
int devnum, num, button, joystick, subnum, idnum, keynum, devtype;
const TCHAR *p;
TCHAR *p2, *custom;
struct temp_uids *tid = &temp_uid;
- struct inputdevice_functions *idf = NULL;
+ struct inputdevice_functions *idf = nullptr;
option += 6; /* "input." */
p = getstring (&option);
- if (!strcasecmp (p, _T("config"))) {
+ if (!_tcsicmp (p, _T("config"))) {
pr->input_selected_setting = _tstol (value) - 1;
if (pr->input_selected_setting == -1)
pr->input_selected_setting = GAMEPORT_INPUT_SETTINGS;
if (pr->input_selected_setting < 0 || pr->input_selected_setting > MAX_INPUT_SETTINGS)
pr->input_selected_setting = 0;
}
- if (!strcasecmp (p, _T("joymouse_speed_analog")))
+ if (!_tcsicmp (p, _T("joymouse_speed_analog")))
pr->input_joymouse_multiplier = _tstol (value);
- if (!strcasecmp (p, _T("joymouse_speed_digital")))
+ if (!_tcsicmp (p, _T("joymouse_speed_digital")))
pr->input_joymouse_speed = _tstol (value);
- if (!strcasecmp (p, _T("joystick_deadzone")))
+ if (!_tcsicmp (p, _T("joystick_deadzone")))
pr->input_joystick_deadzone = _tstol (value);
- if (!strcasecmp (p, _T("joymouse_deadzone")))
+ if (!_tcsicmp (p, _T("joymouse_deadzone")))
pr->input_joymouse_deadzone = _tstol (value);
- if (!strcasecmp (p, _T("mouse_speed")))
+ if (!_tcsicmp (p, _T("mouse_speed")))
pr->input_mouse_speed = _tstol (value);
- if (!strcasecmp (p, _T("autofire")))
+ if (!_tcsicmp (p, _T("autofire")))
pr->input_autofire_linecnt = _tstol (value) * 312;
- if (!strcasecmp (p, _T("autofire_speed")))
+ if (!_tcsicmp (p, _T("autofire_speed")))
pr->input_autofire_linecnt = _tstol (value);
- if (!strcasecmp (p, _T("analog_joystick_multiplier")))
+ if (!_tcsicmp (p, _T("analog_joystick_multiplier")))
pr->input_analog_joystick_mult = _tstol (value);
- if (!strcasecmp (p, _T("analog_joystick_offset")))
+ if (!_tcsicmp (p, _T("analog_joystick_offset")))
pr->input_analog_joystick_offset = _tstol (value);
- if (!strcasecmp (p, _T("keyboard_type"))) {
- cfgfile_strval (option, value, NULL, &pr->input_keyboard_type, kbtypes, 0);
+ if (!_tcsicmp (p, _T("keyboard_type"))) {
+ cfgfile_strval (option, value, nullptr, &pr->input_keyboard_type, kbtypes, 0);
keyboard_default = keyboard_default_table[pr->input_keyboard_type];
inputdevice_default_kb_all (pr);
}
@@ -1534,8 +1524,8 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
}
xfree(tid->configname);
xfree(tid->name);
- tid->configname = NULL;
- tid->name = NULL;
+ tid->configname = nullptr;
+ tid->name = nullptr;
}
if (idnum == GAMEPORT_INPUT_SETTINGS && id->enabled == 0)
@@ -1565,12 +1555,12 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
p = value;
bool oldcustommapping = false;
- custom = NULL;
+ custom = nullptr;
for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) {
uae_u64 flags;
int port;
xfree (custom);
- custom = NULL;
+ custom = nullptr;
p2 = getstring (&p);
if (!p2)
break;
@@ -1597,7 +1587,7 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
flags2 = getnum (&p) & ID_FLAG_SAVE_MASK_CONFIG;
if (p[-1] == '.' && (p[0] >= 'A' && p[0] <= 'Z') || (p[0] >= 'a' && p[0] <= 'z'))
flags |= getqual (&p);
- TCHAR *custom2 = NULL;
+ TCHAR *custom2 = nullptr;
const struct inputevent *ie2 = readevent (p2, &custom2);
read_slot (p2, num, joystick, button, id, keynum, SPARE_SUB_EVENT, ie2, flags2, MAX_JPORTS + 1, custom2);
}
@@ -1610,7 +1600,7 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
}
if (!read_slot (p2, num, joystick, button, id, keynum, subnum, ie, flags, port, custom))
continue;
- custom = NULL;
+ custom = nullptr;
}
if (joystick < 0 && !oldcustommapping)
tid->kbreventcnt[devnum]++;
@@ -1676,7 +1666,7 @@ static void mousehack_reset (void)
if (mousehack_address)
put_byte_host(mousehack_address + MH_E, 0);
}
- mousehack_address = 0;
+ mousehack_address = nullptr;
mousehack_enabled = false;
}
@@ -2928,7 +2918,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode)
int newport = 0;
int newslot = -1;
int flags = 0;
- TCHAR *name = NULL, *fname = NULL;
+ TCHAR *name = nullptr, *fname = nullptr;
int otherbuttonpressed = 0;
int acc = input_acquired;
@@ -3040,7 +3030,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode)
} else {
inputdevice_joyport_config (&changed_prefs, name, name, newport, -1, 1, true);
}
- inputdevice_validate_jports (&changed_prefs, -1, NULL);
+ inputdevice_validate_jports (&changed_prefs, -1, nullptr);
inputdevice_copyconfig (&changed_prefs, &currprefs);
if (acc)
inputdevice_acquire (TRUE);
@@ -3108,7 +3098,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode)
write_log (_T("inputdevice input change '%s':%d->%d\n"), name, num, newport);
inputdevice_unacquire ();
inputdevice_copyconfig (&currprefs, &changed_prefs);
- inputdevice_validate_jports (&changed_prefs, -1, NULL);
+ inputdevice_validate_jports (&changed_prefs, -1, nullptr);
inputdevice_copyconfig (&changed_prefs, &currprefs);
if (acc)
inputdevice_acquire (TRUE);
@@ -3295,7 +3285,7 @@ static void setbuttonstateall (struct uae_input_device *id, struct uae_input_dev
handle_input_event (evt, toggled, 1, autofire);
} else {
#endif
- if (!checkqualifiers (evt, flags, qualmask, NULL)) {
+ if (!checkqualifiers (evt, flags, qualmask, nullptr)) {
if (!state && !(flags & ID_FLAG_CANRELEASE)) {
if (!invert)
continue;
@@ -3558,7 +3548,7 @@ int intputdevice_compa_get_eventtype (int evt, const int **axistablep)
if (axistable[i + 2] == evt)
return IDEV_WIDGET_BUTTONAXIS;
}
- *axistablep = NULL;
+ *axistablep = nullptr;
return IDEV_WIDGET_BUTTON;
}
@@ -3734,17 +3724,17 @@ static void inputdevice_sparerestore (struct uae_input_device *uid, int num, int
uid->eventid[num][sub] = 0;
uid->flags[num][sub] = 0;
xfree (uid->custom[num][sub]);
- uid->custom[num][sub] = 0;
+ uid->custom[num][sub] = nullptr;
}
uid->eventid[num][SPARE_SUB_EVENT] = 0;
uid->flags[num][SPARE_SUB_EVENT] = 0;
uid->port[num][SPARE_SUB_EVENT] = 0;
- uid->custom[num][SPARE_SUB_EVENT] = 0;
+ uid->custom[num][SPARE_SUB_EVENT] = nullptr;
if (uid->flags[num][MAX_INPUT_SUB_EVENT - 1] & ID_FLAG_RESERVEDGAMEPORTSCUSTOM) {
uid->eventid[num][MAX_INPUT_SUB_EVENT - 1] = 0;
uid->flags[num][MAX_INPUT_SUB_EVENT - 1] = 0;
uid->port[num][MAX_INPUT_SUB_EVENT - 1] = 0;
- uid->custom[num][MAX_INPUT_SUB_EVENT - 1] = 0;
+ uid->custom[num][MAX_INPUT_SUB_EVENT - 1] = nullptr;
}
}
@@ -3752,19 +3742,19 @@ void inputdevice_sparecopy (struct uae_input_device *uid, int num, int sub)
{
if (uid->port[num][SPARE_SUB_EVENT] != 0)
return;
- if (uid->eventid[num][sub] <= 0 && uid->custom[num][sub] == NULL) {
+ if (uid->eventid[num][sub] <= 0 && uid->custom[num][sub] == nullptr) {
uid->eventid[num][SPARE_SUB_EVENT] = 0;
uid->flags[num][SPARE_SUB_EVENT] = 0;
uid->port[num][SPARE_SUB_EVENT] = 0;
xfree (uid->custom[num][SPARE_SUB_EVENT]);
- uid->custom[num][SPARE_SUB_EVENT] = NULL;
+ uid->custom[num][SPARE_SUB_EVENT] = nullptr;
} else {
uid->eventid[num][SPARE_SUB_EVENT] = uid->eventid[num][sub];
uid->flags[num][SPARE_SUB_EVENT] = uid->flags[num][sub];
uid->port[num][SPARE_SUB_EVENT] = MAX_JPORTS + 1;
xfree (uid->custom[num][SPARE_SUB_EVENT]);
uid->custom[num][SPARE_SUB_EVENT] = uid->custom[num][sub];
- uid->custom[num][sub] = NULL;
+ uid->custom[num][sub] = nullptr;
}
}
@@ -3798,11 +3788,11 @@ int inputdevice_get_compatibility_input (struct uae_prefs *prefs, int index, int
{
if (index >= MAX_JPORTS || joymodes[index] < 0)
return -1;
- if (typelist != NULL)
+ if (typelist != nullptr)
*typelist = joymodes[index];
- if (at != NULL)
+ if (at != nullptr)
*at = axistable;
- if (inputlist == NULL)
+ if (inputlist == nullptr)
return -1;
//write_log (_T("%d %p %p\n"), *typelist, *inputlist, *at);
@@ -3820,7 +3810,7 @@ int inputdevice_get_compatibility_input (struct uae_prefs *prefs, int index, int
int port, k, l;
uae_u64 flags;
bool ignore = false;
- int evtnum2 = inputdevice_get_mapping (devnum, j, &flags, &port, NULL, NULL, sub);
+ int evtnum2 = inputdevice_get_mapping (devnum, j, &flags, &port, nullptr, nullptr, sub);
if (port - 1 != index)
continue;
for (k = 0; axistable[k] >= 0; k += 3) {
@@ -3858,7 +3848,7 @@ static void clearevent (struct uae_input_device *uid, int evt)
uid->eventid[i][j] = 0;
uid->flags[i][j] &= COMPA_RESERVED_FLAGS;
xfree (uid->custom[i][j]);
- uid->custom[i][j] = NULL;
+ uid->custom[i][j] = nullptr;
}
}
}
@@ -3871,7 +3861,7 @@ static void clearkbrevent (struct uae_input_device *uid, int evt)
uid->eventid[i][j] = 0;
uid->flags[i][j] &= COMPA_RESERVED_FLAGS;
xfree (uid->custom[i][j]);
- uid->custom[i][j] = NULL;
+ uid->custom[i][j] = nullptr;
if (j == 0)
set_kbr_default_event (uid, keyboard_default, i);
}
@@ -3950,7 +3940,7 @@ static void cleardev_custom (struct uae_input_device *uid, int num, int index)
uid[num].eventid[i][j] = 0;
uid[num].flags[i][j] &= COMPA_RESERVED_FLAGS;
xfree (uid[num].custom[i][j]);
- uid[num].custom[i][j] = NULL;
+ uid[num].custom[i][j] = nullptr;
uid[num].port[i][j] = 0;
if (uid[num].port[i][SPARE_SUB_EVENT])
inputdevice_sparerestore (&uid[num], i, j);
@@ -3966,7 +3956,7 @@ static void cleardevkbr_custom(struct uae_input_device *uid, int num, int index)
uid[num].eventid[i][j] = 0;
uid[num].flags[i][j] &= COMPA_RESERVED_FLAGS;
xfree (uid[num].custom[i][j]);
- uid[num].custom[i][j] = NULL;
+ uid[num].custom[i][j] = nullptr;
uid[num].port[i][j] = 0;
if (uid[num].port[i][SPARE_SUB_EVENT]) {
inputdevice_sparerestore (&uid[num], i, j);
@@ -4020,7 +4010,7 @@ static void cleardev (struct uae_input_device *uid, int num)
uid[num].eventid[i][j] = 0;
uid[num].flags[i][j] = 0;
xfree (uid[num].custom[i][j]);
- uid[num].custom[i][j] = NULL;
+ uid[num].custom[i][j] = nullptr;
}
}
}
@@ -4065,7 +4055,7 @@ static void setjoydevices (struct uae_prefs *prefs, bool gameportsmode, int port
static void setjoyinputs (struct uae_prefs *prefs, int port)
{
- joyinputs[port] = NULL;
+ joyinputs[port] = nullptr;
switch (joymodes[port])
{
case JSEM_MODE_JOYSTICK:
@@ -4130,7 +4120,7 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
for (i = 0; i < MAX_JPORTS; i++) {
joymodes[i] = prefs->jports[i].mode;
- joyinputs[i]= NULL;
+ joyinputs[i]= nullptr;
// remove all mappings from this port
if (gameports)
remove_compa_config (prefs, i);
@@ -4317,7 +4307,7 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
for (i = 0; i < 2; i++) {
if (prefs->jports[i].id >= 0) {
- int *kb = NULL;
+ int *kb = nullptr;
int mode = prefs->jports[i].mode;
int af = prefs->jports[i].autofire;
for (joy = 0; used[joy]; joy++);
@@ -4438,7 +4428,7 @@ static void disableifempty2 (struct uae_input_device *uid)
{
for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
- if (uid->eventid[i][j] > 0 || uid->custom[i][j] != NULL)
+ if (uid->eventid[i][j] > 0 || uid->custom[i][j] != nullptr)
return;
}
}
@@ -4542,9 +4532,9 @@ static void matchdevices (struct inputdevice_functions *inf, struct uae_input_de
break;
}
for (i = 0; i < inf->get_num (); i++) {
- if (uid[i].name == NULL)
+ if (uid[i].name == nullptr)
uid[i].name = my_strdup (inf->get_friendlyname (i));
- if (uid[i].configname == NULL)
+ if (uid[i].configname == nullptr)
uid[i].configname = my_strdup (inf->get_uniquename (i));
}
}
@@ -4571,9 +4561,9 @@ bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int
keyboards = prefs->keyboard_settings[input_selected_setting];
for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
int port2 = 0;
- inputdevice_get_mapping (devnum, num, NULL, &port2, NULL, NULL, sub);
+ inputdevice_get_mapping (devnum, num, nullptr, &port2, nullptr, nullptr, sub);
if (port2 == port + 1) {
- inputdevice_set_mapping (devnum, num, NULL, NULL, 0, 0, sub);
+ inputdevice_set_mapping (devnum, num, nullptr, nullptr, 0, 0, sub);
}
}
return true;
@@ -4586,19 +4576,19 @@ bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int
keyboards = prefs->keyboard_settings[input_selected_setting];
sub = 0;
- if (inputdevice_get_widget_type (devnum, num, NULL, false) != IDEV_WIDGET_KEY) {
+ if (inputdevice_get_widget_type (devnum, num, nullptr, false) != IDEV_WIDGET_KEY) {
for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
int port2 = 0;
- int evt = inputdevice_get_mapping (devnum, num, NULL, &port2, NULL, NULL, sub);
+ int evt = inputdevice_get_mapping (devnum, num, nullptr, &port2, nullptr, nullptr, sub);
if (port2 == port + 1 && evt == evtnum)
break;
- if (!inputdevice_get_mapping (devnum, num, NULL, NULL, NULL, NULL, sub))
+ if (!inputdevice_get_mapping (devnum, num, nullptr, nullptr, nullptr, nullptr, sub))
break;
}
}
if (sub >= MAX_INPUT_SUB_EVENT)
sub = MAX_INPUT_SUB_EVENT - 1;
- inputdevice_set_mapping (devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, sub);
+ inputdevice_set_mapping (devnum, num, name, nullptr, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, sub);
joysticks = prefs->joystick_settings[prefs->input_selected_setting];
mice = prefs->mouse_settings[prefs->input_selected_setting];
@@ -4611,7 +4601,7 @@ bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int
inputdevice_get_mapping (devnum, num, &xflags, &xport, xname, xcustom, 0);
if (xport == 0)
inputdevice_set_mapping (devnum, num, xname, xcustom, xflags, MAX_JPORTS + 1, SPARE_SUB_EVENT);
- inputdevice_set_mapping (devnum, num, name, NULL, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, 0);
+ inputdevice_set_mapping (devnum, num, name, nullptr, IDEV_MAPPED_GAMEPORTSCUSTOM1 | flags, port + 1, 0);
}
return true;
}
@@ -5073,7 +5063,7 @@ void inputdevice_close (void)
static struct uae_input_device *get_uid (const struct inputdevice_functions *id, int devnum)
{
- struct uae_input_device *uid = 0;
+ struct uae_input_device *uid = nullptr;
if (id == &idev[IDTYPE_JOYSTICK]) {
uid = &joysticks[devnum];
} else if (id == &idev[IDTYPE_MOUSE]) {
@@ -5087,7 +5077,7 @@ static struct uae_input_device *get_uid (const struct inputdevice_functions *id,
static int get_event_data (const struct inputdevice_functions *id, int devnum, int num, int *eventid, TCHAR **custom, uae_u64 *flags, int *port, int sub)
{
const struct uae_input_device *uid = get_uid (id, devnum);
- int type = id->get_widget_type (devnum, num, 0, 0);
+ int type = id->get_widget_type (devnum, num, nullptr, nullptr);
int i;
if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) {
i = num - id->get_widget_first (devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET;
@@ -5127,7 +5117,7 @@ static TCHAR *stripstrdup (const TCHAR *s)
{
TCHAR *out = my_strdup (s);
if (!out)
- return NULL;
+ return nullptr;
for (int i = 0; out[i]; i++) {
if (out[i] < ' ')
out[i] = ' ';
@@ -5138,7 +5128,7 @@ static TCHAR *stripstrdup (const TCHAR *s)
static int put_event_data (const struct inputdevice_functions *id, int devnum, int num, int eventid, TCHAR *custom, uae_u64 flags, int port, int sub)
{
struct uae_input_device *uid = get_uid (id, devnum);
- int type = id->get_widget_type (devnum, num, 0, 0);
+ int type = id->get_widget_type (devnum, num, nullptr, nullptr);
int i, ret;
for (i = 0; i < MAX_INPUT_QUALIFIERS; i++) {
@@ -5148,7 +5138,7 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
flags &= ~mask2;
}
if (custom && custom[0] == 0)
- custom = NULL;
+ custom = nullptr;
if (custom)
eventid = 0;
if (eventid <= 0 && !custom)
@@ -5191,7 +5181,7 @@ static int is_event_used (const struct inputdevice_functions *id, int devnum, in
for (num = 0; num < id->get_widget_num (devnum); num++) {
for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
- if (get_event_data (id, devnum, num, &evt, NULL, NULL, NULL, sub) >= 0) {
+ if (get_event_data (id, devnum, num, &evt, nullptr, nullptr, nullptr, sub) >= 0) {
if (evt == isevent && isnum != num)
return 1;
}
@@ -5240,7 +5230,7 @@ TCHAR *inputdevice_get_device_unique_name (int type, int devnum)
int inputdevice_get_device_status (int devnum)
{
const struct inputdevice_functions *idf = getidf (devnum);
- if (idf == NULL)
+ if (idf == nullptr)
return -1;
struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
return uid->enabled != 0;
@@ -5297,7 +5287,7 @@ int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af)
return 0;
}
mask = 0;
- type = idf->get_widget_type (devindex, num, NULL, NULL);
+ type = idf->get_widget_type (devindex, num, nullptr, nullptr);
if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) {
if (idf == &idev[IDTYPE_JOYSTICK]) {
mask |= AM_JOY_BUT;
@@ -5329,7 +5319,7 @@ int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af)
}
if (!(ie->allow_mask & mask))
continue;
- get_event_data (idf, devindex, num, &data, NULL, &flags, NULL, 0);
+ get_event_data (idf, devindex, num, &data, nullptr, &flags, nullptr, 0);
inputdevice_get_eventname (ie, name);
*af = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0;
return 1;
@@ -5344,7 +5334,7 @@ int inputdevice_get_mapping (int devnum, int num, uae_u64 *pflags, int *pport, T
int port, data;
uae_u64 flags = 0, flag;
int devindex = inputdevice_get_device_index (devnum);
- TCHAR *customp = NULL;
+ TCHAR *customp = nullptr;
if (name)
_tcscpy (name, _T(""));
@@ -5354,7 +5344,7 @@ int inputdevice_get_mapping (int devnum, int num, uae_u64 *pflags, int *pport, T
*pflags = 0;
if (pport)
*pport = 0;
- if (uid == 0 || num < 0)
+ if (uid == nullptr || num < 0)
return 0;
if (get_event_data (idf, devindex, num, &data, &customp, &flag, &port, sub) < 0)
return 0;
@@ -5405,9 +5395,9 @@ int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHAR *cust
uae_u64 flag;
TCHAR ename[256];
int devindex = inputdevice_get_device_index (devnum);
- TCHAR *customp = NULL;
+ TCHAR *customp = nullptr;
- if (uid == 0 || num < 0)
+ if (uid == nullptr || num < 0)
return 0;
if (name) {
eid = 1;
@@ -5563,7 +5553,7 @@ void inputdevice_swap_compa_ports (struct uae_prefs *prefs, int portswap)
memcpy (&tmp, &prefs->jports[portswap], sizeof (struct jport));
memcpy (&prefs->jports[portswap], &prefs->jports[portswap + 1], sizeof (struct jport));
memcpy (&prefs->jports[portswap + 1], &tmp, sizeof (struct jport));
- inputdevice_updateconfig (NULL, prefs);
+ inputdevice_updateconfig (nullptr, prefs);
}
// swap device "devnum" ports 0<>1 and 2<>3
@@ -5807,7 +5797,7 @@ void setjoystickstate (int joy, int axis, int state, int max)
static int prevdir;
static struct timeval tv1;
struct timeval tv2;
- gettimeofday (&tv2, NULL);
+ gettimeofday (&tv2, nullptr);
if ((uae_s64)tv2.tv_sec * 1000000 + tv2.tv_usec < (uae_s64)tv1.tv_sec * 1000000 + tv1.tv_usec + 500000 && prevdir == v1) {
switchdevice (&joysticks[joy], v1 < 0 ? 0 : 1, false);
tv1.tv_sec = 0;
@@ -5988,7 +5978,7 @@ static void inputdevice_get_previous_joy(struct uae_prefs *p, int portnum)
if (jp->idc.configname[0]) {
found = inputdevice_joyport_config(p, jp->idc.name, jp->idc.configname, portnum, jp->mode, 1, true) != 0;
if (!found && jp->id == JPORT_UNPLUGGED)
- found = inputdevice_joyport_config(p, jp->idc.name, NULL, portnum, jp->mode, 1, true) != 0;
+ found = inputdevice_joyport_config(p, jp->idc.name, nullptr, portnum, jp->mode, 1, true) != 0;
} else if (jp->id < JSEM_JOYS && jp->id >= 0) {
jpx->id = jp->id;
found = true;
@@ -6049,7 +6039,7 @@ void inputdevice_validate_jports (struct uae_prefs *p, int changedport, bool *fi
if (!other && p->jports[i].id != p->jports[j].id)
break;
- struct jport *jp = NULL;
+ struct jport *jp = nullptr;
for (;;) {
jp = inputdevice_get_used_device(k, cnt);
cnt++;
@@ -6164,7 +6154,7 @@ int inputdevice_joyport_config (struct uae_prefs *p, const TCHAR *value1, const
{
int start = JPORT_NONE, got = 0, max = -1;
int type = -1;
- const TCHAR *pp = NULL;
+ const TCHAR *pp = nullptr;
if (_tcsncmp (value1, _T("kbd"), 3) == 0) {
start = JSEM_KBDLAYOUT;
pp = value1 + 3;
@@ -6283,7 +6273,7 @@ void inputdevice_fix_prefs(struct uae_prefs *p, bool userconfig)
if (!matched[i]) {
struct jport *jp = &jport_config_store[i];
if (jp->idc.configname[0]) {
- if (inputdevice_joyport_config(p, NULL, jp->idc.configname, i, jp->mode, 1, userconfig)) {
+ if (inputdevice_joyport_config(p, nullptr, jp->idc.configname, i, jp->mode, 1, userconfig)) {
inputdevice_validate_jports(p, i, matched);
inputdevice_store_used_device(&p->jports[i], i, defaultports);
matched[i] = true;
@@ -6297,7 +6287,7 @@ void inputdevice_fix_prefs(struct uae_prefs *p, bool userconfig)
if (!matched[i]) {
struct jport *jp = &jport_config_store[i];
if (jp->idc.name[0]) {
- if (inputdevice_joyport_config(p, jp->idc.name, NULL, i, jp->mode, 1, userconfig)) {
+ if (inputdevice_joyport_config(p, jp->idc.name, nullptr, i, jp->mode, 1, userconfig)) {
inputdevice_validate_jports(p, i, matched);
inputdevice_store_used_device(&p->jports[i], i, defaultports);
matched[i] = true;
@@ -6311,7 +6301,7 @@ void inputdevice_fix_prefs(struct uae_prefs *p, bool userconfig)
if (!matched[i]) {
struct jport *jp = &jport_config_store[i];
if (jp->idc.shortid[0] && !jp->idc.name[0] && !jp->idc.configname[0]) {
- if (inputdevice_joyport_config(p, jp->idc.shortid, NULL, i, jp->mode, 0, userconfig)) {
+ if (inputdevice_joyport_config(p, jp->idc.shortid, nullptr, i, jp->mode, 0, userconfig)) {
inputdevice_validate_jports(p, i, matched);
inputdevice_store_used_device(&p->jports[i], i, defaultports);
matched[i] = true;
diff --git a/src/jit/compemu_support.cpp b/src/jit/compemu_support.cpp
index 64846eb2..8421eac6 100644
--- a/src/jit/compemu_support.cpp
+++ b/src/jit/compemu_support.cpp
@@ -168,7 +168,7 @@ static blockinfo* hold_bi[MAX_HOLD_BI];
blockinfo* active;
blockinfo* dormant;
-#ifdef PANDORA
+#ifdef AMIBERRY
#include
void cache_free (uae_u8 *cache, int size)
diff --git a/src/machdep/support.cpp b/src/machdep/support.cpp
index 69bf3340..0f4cdedd 100644
--- a/src/machdep/support.cpp
+++ b/src/machdep/support.cpp
@@ -18,8 +18,8 @@ int64_t g_uae_epoch = 0;
int machdep_init (void)
{
- picasso_requested_on = 0;
- picasso_on = 0;
+ picasso_requested_on = false;
+ picasso_on = false;
screen_is_picasso = 0;
// Initialize timebase
diff --git a/src/main.cpp b/src/main.cpp
index 62122b12..2a0b4127 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -63,17 +63,15 @@ TCHAR optionsfile[256];
void my_trim(TCHAR *s)
{
- int len;
while (_tcslen(s) > 0 && _tcscspn(s, _T("\t \r\n")) == 0)
memmove(s, s + 1, (_tcslen(s + 1) + 1) * sizeof(TCHAR));
- len = _tcslen(s);
+ int len = _tcslen(s);
while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
s[--len] = '\0';
}
TCHAR *my_strdup_trim(const TCHAR *s)
{
- TCHAR *out;
int len;
if (s[0] == 0)
@@ -83,7 +81,7 @@ TCHAR *my_strdup_trim(const TCHAR *s)
len = _tcslen(s);
while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
len--;
- out = xmalloc(TCHAR, len + 1);
+ TCHAR *out = xmalloc(TCHAR, len + 1);
memcpy(out, s, len * sizeof(TCHAR));
out[len] = 0;
return out;
@@ -435,10 +433,8 @@ void uae_restart(int opengui, const TCHAR *cfgfile)
static void parse_cmdline_2(int argc, TCHAR **argv)
{
- int i;
-
cfgfile_addcfgparam(0);
- for (i = 1; i < argc; i++) {
+ for (int i = 1; i < argc; i++) {
if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) {
cfgfile_addcfgparam(argv[i] + 10);
}
@@ -466,9 +462,7 @@ static TCHAR *parsetext(const TCHAR *s)
}
return d;
}
- else {
- return my_strdup(s);
- }
+ return my_strdup(s);
}
static TCHAR *parsetextpath(const TCHAR *s)
{
@@ -480,7 +474,6 @@ static TCHAR *parsetextpath(const TCHAR *s)
static void parse_cmdline(int argc, TCHAR **argv)
{
- int i;
static bool started;
bool firstconfig = true;
bool loaded = false;
@@ -490,7 +483,7 @@ static void parse_cmdline(int argc, TCHAR **argv)
return;
started = true;
- for (i = 1; i < argc; i++) {
+ for (int i = 1; i < argc; i++) {
if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
if (i + 1 < argc)
i++;
@@ -639,10 +632,8 @@ void check_error_sdl(bool check, const char* message) {
}
}
-static int real_main2 (int argc, TCHAR **argv)
+static void initialize_sdl2()
{
- printf("Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas\n");
-
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
SDL_Log("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
@@ -650,11 +641,11 @@ static int real_main2 (int argc, TCHAR **argv)
}
sdlWindow = SDL_CreateWindow("Amiberry-SDL2 v2",
- SDL_WINDOWPOS_UNDEFINED,
- SDL_WINDOWPOS_UNDEFINED,
- 0,
- 0,
- SDL_WINDOW_FULLSCREEN_DESKTOP);
+ SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED,
+ 0,
+ 0,
+ SDL_WINDOW_FULLSCREEN_DESKTOP);
check_error_sdl(sdlWindow == nullptr, "Unable to create window");
renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
@@ -669,6 +660,13 @@ static int real_main2 (int argc, TCHAR **argv)
SDL_Log("SDL could not grab the keyboard");
SDL_ShowCursor(SDL_DISABLE);
+}
+
+static int real_main2 (int argc, TCHAR **argv)
+{
+ printf("Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas\n");
+
+ initialize_sdl2();
set_config_changed();
if (restart_config[0]) {
@@ -699,9 +697,9 @@ static int real_main2 (int argc, TCHAR **argv)
changed_prefs = currprefs;
no_gui = !currprefs.start_gui;
if (restart_program == 2)
- no_gui = 1;
+ no_gui = true;
else if (restart_program == 3)
- no_gui = 0;
+ no_gui = false;
restart_program = 0;
if (!no_gui) {
int err = gui_init();
@@ -711,23 +709,21 @@ static int real_main2 (int argc, TCHAR **argv)
write_log(_T("Failed to initialize the GUI\n"));
return -1;
}
- else if (err == -2) {
+ if (err == -2) {
return 1;
}
}
else
{
- setCpuSpeed();
update_display(&currprefs);
}
-
memset(&gui_data, 0, sizeof gui_data);
gui_data.cd = -1;
gui_data.hd = -1;
if (!init_shm()) {
if (currprefs.start_gui)
- uae_restart(-1, NULL);
+ uae_restart(-1, nullptr);
return 0;
}
#ifdef PICASSO96
@@ -774,7 +770,7 @@ void real_main(int argc, TCHAR **argv)
{
restart_program = 1;
- fetch_configurationpath(restart_config, sizeof(restart_config) / sizeof(TCHAR));
+ fetch_configurationpath(restart_config, sizeof restart_config / sizeof(TCHAR));
_tcscat(restart_config, OPTIONSFILENAME);
_tcscat(restart_config, ".uae");
default_config = 1;
diff --git a/src/osdep/amiberry.cpp b/src/osdep/amiberry.cpp
index 99e7cf74..d4046f2c 100644
--- a/src/osdep/amiberry.cpp
+++ b/src/osdep/amiberry.cpp
@@ -21,7 +21,7 @@
#include "options.h"
#include "threaddep/thread.h"
#include "gui.h"
-#include "memory.h"
+#include "include/memory.h"
#include "inputdevice.h"
#include "keyboard.h"
#include "disk.h"
@@ -366,7 +366,7 @@ void fetch_configurationpath(char *out, int size)
void set_configurationpath(char *newpath)
{
- strncpy(config_path, newpath, MAX_DPATH);
+ strcpy(config_path, newpath);
}
void fetch_rompath(char *out, int size)
@@ -376,7 +376,7 @@ void fetch_rompath(char *out, int size)
void set_rompath(char *newpath)
{
- strncpy(rom_path, newpath, MAX_DPATH);
+ strcpy(rom_path, newpath);
}
@@ -460,12 +460,12 @@ int check_configfile(char *file)
return 1;
}
- strncpy(tmp, file, MAX_PATH);
+ strcpy(tmp, file);
char *ptr = strstr(tmp, ".uae");
if (ptr > 0)
{
*(ptr + 1) = '\0';
- strncat(tmp, "conf", MAX_PATH);
+ strcat(tmp, "conf");
f = fopen(tmp, "rt");
if (f)
{
@@ -482,12 +482,12 @@ void extractFileName(const char * str, char *buffer)
while (*p != '/' && p > str)
p--;
p++;
- strncpy(buffer, p, MAX_PATH);
+ strcpy(buffer, p);
}
void extractPath(char *str, char *buffer)
{
- strncpy(buffer, str, MAX_PATH);
+ strcpy(buffer, str);
char *p = buffer + strlen(buffer) - 1;
while (*p != '/' && p > buffer)
p--;
@@ -854,19 +854,7 @@ int handle_msgpump()
switch (rEvent.key.keysym.sym)
{
- case SDLK_NUMLOCKCLEAR:
- if (currprefs.keyboard_leds[KBLED_NUMLOCKB] > 0)
- {
- //oldleds ^= KBLED_NUMLOCKM;
- //ch = true;
- }
- break;
case SDLK_CAPSLOCK: // capslock
- if (currprefs.keyboard_leds[KBLED_CAPSLOCKB] > 0)
- {
- //oldleds ^= KBLED_CAPSLOCKM;
- //ch = true;
- }
// Treat CAPSLOCK as a toggle. If on, set off and vice/versa
ioctl(0, KDGKBLED, &kbd_flags);
ioctl(0, KDGETLED, &kbd_led_status);
@@ -887,15 +875,6 @@ int handle_msgpump()
ioctl(0, KDSETLED, kbd_led_status);
ioctl(0, KDSKBLED, kbd_flags);
break;
-
- case SDLK_SCROLLLOCK:
- if (currprefs.keyboard_leds[KBLED_SCROLLLOCKB] > 0)
- {
- //oldleds ^= KBLED_SCROLLLOCKM;
- //ch = true;
- }
- break;
-
default:
if (currprefs.customControls)
{
diff --git a/src/osdep/amiberry_gfx.cpp b/src/osdep/amiberry_gfx.cpp
index 728ec1e7..57533e3a 100644
--- a/src/osdep/amiberry_gfx.cpp
+++ b/src/osdep/amiberry_gfx.cpp
@@ -275,6 +275,18 @@ void show_screen(int mode)
//init_row_map();
}
+unsigned long target_lastsynctime(void)
+{
+ return last_synctime;
+}
+
+bool show_screen_maybe(bool show)
+{
+ if (show)
+ show_screen(0);
+ return false;
+}
+
static void graphics_subinit()
{
if (screen == nullptr)
@@ -339,7 +351,7 @@ int target_get_display(const TCHAR *name)
const TCHAR *target_get_display_name(int num, bool friendlyname)
{
if (num <= 0)
- return NULL;
+ return nullptr;
if (friendlyname)
return "Raspberry Pi display";
return "0";
@@ -562,18 +574,15 @@ bool target_graphics_buffer_update()
#ifdef PICASSO96
-int picasso_palette()
+int picasso_palette(struct MyCLUTEntry *CLUT)
{
int changed = 0;
- for (int i = 0; i < 256; i++)
- {
- int r = picasso96_state.CLUT[i].Red;
- int g = picasso96_state.CLUT[i].Green;
- int b = picasso96_state.CLUT[i].Blue;
- int value = (r << 16 | g << 8 | b);
- uae_u32 v = CONVERT_RGB(value);
- if (v != picasso_vidinfo.clut[i])
- {
+ for (int i = 0; i < 256; i++) {
+ int r = CLUT[i].Red;
+ int g = CLUT[i].Green;
+ int b = CLUT[i].Blue;
+ uae_u32 v = CONVERT_RGB(r << 16 | g << 8 | b);
+ if (v != picasso_vidinfo.clut[i]) {
picasso_vidinfo.clut[i] = v;
changed = 1;
}
diff --git a/src/osdep/amiberry_gui.cpp b/src/osdep/amiberry_gui.cpp
index 684f69bf..eaab29be 100644
--- a/src/osdep/amiberry_gui.cpp
+++ b/src/osdep/amiberry_gui.cpp
@@ -13,7 +13,7 @@
#include "gui.h"
#include "osdep/gui/SelectorEntry.hpp"
#include "gui/gui_handling.h"
-#include "memory.h"
+#include "include/memory.h"
#include "rommgr.h"
#include "newcpu.h"
#include "custom.h"
@@ -251,18 +251,13 @@ static int scan_rom_2(struct zfile* f, void* dummy)
return 0;
}
-static void scan_rom(char* path)
+static void scan_rom(char *path)
{
- if (!isromext(path))
- {
+ if (!isromext(path)) {
//write_log("ROMSCAN: skipping file '%s', unknown extension\n", path);
return;
}
- struct romdata* rd = getarcadiarombyname(path);
- if (rd)
- addrom(rd, path);
- else
- zfile_zopen(path, scan_rom_2, nullptr);
+ zfile_zopen(path, scan_rom_2, 0);
}
@@ -287,13 +282,15 @@ void RescanROMs()
}
int id = 1;
- for (;;)
- {
- struct romdata* rd = getromdatabyid(id);
+ for (;;) {
+ struct romdata *rd = getromdatabyid(id);
if (!rd)
break;
if (rd->crc32 == 0xffffffff && strncmp(rd->model, "AROS", 4) == 0)
addrom(rd, ":AROS");
+ if (rd->crc32 == 0xffffffff && rd->id == 63) {
+ addrom(rd, ":HRTMon");
+ }
id++;
}
}
@@ -309,100 +306,44 @@ static void ClearConfigFileList()
}
-void ReadConfigFileList()
+void ReadConfigFileList(void)
{
- char path[MAX_DPATH];
- vector files;
- const char* filter_rp9[] = {".rp9", "\0"};
- const char* filter_uae[] = {".uae", "\0"};
- const char* filter_conf[] = {".conf", "\0"};
+ char path[MAX_PATH];
+ std::vector files;
+ const char *filter_rp9[] = { ".rp9", "\0" };
+ const char *filter_uae[] = { ".uae", "\0" };
ClearConfigFileList();
- // Add built-in configs: A500
- ConfigFileInfo* buildin = new ConfigFileInfo();
- strcpy(buildin->FullPath, "");
- strcpy(buildin->Name, "Amiga 500");
- strcpy(buildin->Description, _T("Built-in, A500, OCS, 512KB"));
- buildin->BuiltInID = BUILTINID_A500;
- ConfigFilesList.push_back(buildin);
-
- // A1200
- buildin = new ConfigFileInfo();
- strcpy(buildin->FullPath, "");
- strcpy(buildin->Name, "Amiga 1200");
- strcpy(buildin->Description, _T("Built-in, A1200"));
- buildin->BuiltInID = BUILTINID_A1200;
- ConfigFilesList.push_back(buildin);
-
- // CD32
- buildin = new ConfigFileInfo();
- strcpy(buildin->FullPath, "");
- strcpy(buildin->Name, "CD32");
- strcpy(buildin->Description, _T("Built-in"));
- buildin->BuiltInID = BUILTINID_CD32;
- ConfigFilesList.push_back(buildin);
-
// Read rp9 files
- fetch_rp9path(path, sizeof path);
- ReadDirectory(path, nullptr, &files);
+ fetch_rp9path(path, MAX_PATH);
+ ReadDirectory(path, NULL, &files);
FilterFiles(&files, filter_rp9);
- for (int i = 0; i < files.size(); ++i)
+ for (int i = 0; iFullPath, path);
- strcat(tmp->FullPath, files[i].c_str());
- strcpy(tmp->Name, files[i].c_str());
+ ConfigFileInfo *tmp = new ConfigFileInfo();
+ strncpy(tmp->FullPath, path, MAX_DPATH);
+ strncat(tmp->FullPath, files[i].c_str(), MAX_DPATH);
+ strncpy(tmp->Name, files[i].c_str(), MAX_DPATH);
removeFileExtension(tmp->Name);
- strcpy(tmp->Description, _T("rp9"));
- tmp->BuiltInID = BUILTINID_NONE;
+ strncpy(tmp->Description, _T("rp9"), MAX_PATH);
ConfigFilesList.push_back(tmp);
}
// Read standard config files
- fetch_configurationpath(path, sizeof path);
- ReadDirectory(path, nullptr, &files);
+ fetch_configurationpath(path, MAX_PATH);
+ ReadDirectory(path, NULL, &files);
FilterFiles(&files, filter_uae);
- for (int i = 0; i < files.size(); ++i)
+ for (int i = 0; iFullPath, path);
- strcat(tmp->FullPath, files[i].c_str());
- strcpy(tmp->Name, files[i].c_str());
+ ConfigFileInfo *tmp = new ConfigFileInfo();
+ strncpy(tmp->FullPath, path, MAX_DPATH);
+ strncat(tmp->FullPath, files[i].c_str(), MAX_DPATH);
+ strncpy(tmp->Name, files[i].c_str(), MAX_DPATH);
removeFileExtension(tmp->Name);
- cfgfile_get_description(tmp->FullPath, tmp->Description, nullptr, nullptr, nullptr);
- tmp->BuiltInID = BUILTINID_NONE;
+ cfgfile_get_description(tmp->FullPath, tmp->Description);
ConfigFilesList.push_back(tmp);
}
-
- // Read also old style configs
- ReadDirectory(path, nullptr, &files);
- FilterFiles(&files, filter_conf);
- for (int i = 0; i < files.size(); ++i)
- {
- if (strcmp(files[i].c_str(), "adfdir.conf"))
- {
- ConfigFileInfo* tmp = new ConfigFileInfo();
- strcpy(tmp->FullPath, path);
- strcat(tmp->FullPath, files[i].c_str());
- strcpy(tmp->Name, files[i].c_str());
- removeFileExtension(tmp->Name);
- strcpy(tmp->Description, "Old style configuration file");
- tmp->BuiltInID = BUILTINID_NONE;
- for (int j = 0; j < ConfigFilesList.size(); ++j)
- {
- if (!strcmp(ConfigFilesList[j]->Name, tmp->Name))
- {
- // Config in new style already in list
- delete tmp;
- tmp = nullptr;
- break;
- }
- }
- if (tmp != nullptr)
- ConfigFilesList.push_back(tmp);
- }
- }
}
ConfigFileInfo* SearchConfigInList(const char* name)
@@ -416,21 +357,20 @@ ConfigFileInfo* SearchConfigInList(const char* name)
}
-static void prefs_to_gui(struct uae_prefs* p)
+static void prefs_to_gui()
{
- workprefs = *p;
/* filesys hack */
- workprefs.mountitems = currprefs.mountitems;
- memcpy(&workprefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
+ changed_prefs.mountitems = currprefs.mountitems;
+ memcpy(&changed_prefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
}
-static void gui_to_prefs()
+static void gui_to_prefs(void)
{
/* filesys hack */
currprefs.mountitems = changed_prefs.mountitems;
memcpy(&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof(struct uaedev_config_info));
- fixup_prefs(&changed_prefs);
+ fixup_prefs(&changed_prefs, true);
}
@@ -464,7 +404,7 @@ int gui_init()
if (lstAvailableROMs.size() == 0)
RescanROMs();
- prefs_to_gui(&changed_prefs);
+ prefs_to_gui();
run_gui();
gui_to_prefs();
if (quit_program < 0)
@@ -491,17 +431,6 @@ void gui_exit()
void gui_purge_events()
{
- // TODO Test if this is still needed in SDL2 or should be removed!
- //int counter = 0;
-
- //SDL_Event event;
- //SDL_Delay(150);
- //// Strangely PS3 controller always send events, so we need a maximum number of event to purge.
- //while (SDL_PollEvent(&event) && counter < 50)
- //{
- // counter++;
- // SDL_Delay(10);
- //}
keybuf_init();
}
@@ -510,7 +439,7 @@ int gui_update()
{
char tmp[MAX_DPATH];
- fetch_statefilepath(savestate_fname, sizeof savestate_fname);
+ fetch_savestatepath(savestate_fname, sizeof savestate_fname);
fetch_screenshotpath(screenshot_filename, MAX_DPATH);
if (strlen(currprefs.floppyslots[0].df) > 0)
@@ -519,7 +448,7 @@ int gui_update()
strcpy(tmp, last_loaded_config);
strncat(savestate_fname, tmp, sizeof savestate_fname);
- strncat(screenshot_filename, tmp, MAX_DPATH);
+ strncat(screenshot_filename, tmp, sizeof screenshot_filename);
removeFileExtension(savestate_fname);
removeFileExtension(screenshot_filename);
@@ -557,10 +486,13 @@ void gui_display(int shortcut)
if (lstAvailableROMs.size() == 0)
RescanROMs();
- prefs_to_gui(&changed_prefs);
+ prefs_to_gui();
run_gui();
gui_to_prefs();
+ if (quit_program)
+ screen_is_picasso = 0;
+
update_display(&changed_prefs);
reset_sound();
@@ -576,10 +508,6 @@ void gui_display(int shortcut)
}
-void gui_disk_image_change(int unitnum, const char* name, bool writeprotected)
-{
-}
-
void gui_led(int led, int on)
{
unsigned char kbd_led_status;
@@ -629,16 +557,6 @@ void gui_flicker_led(int led, int unitnum, int status)
gui_led(led, status);
}
-void gui_fps(int fps, int idle, int color)
-{
- gui_data.fps = fps;
- gui_data.idle = idle;
- gui_data.fps_color = color;
- gui_led(LED_FPS, 0);
- gui_led(LED_CPU, 0);
- gui_led(LED_SND, (gui_data.sndbuf_status > 1 || gui_data.sndbuf_status < 0) ? 0 : 1);
-}
-
void gui_filename(int num, const char* name)
{
}
@@ -669,6 +587,28 @@ void notify_user(int msg)
}
}
+void notify_user_parms(int msg, const TCHAR *parms, ...)
+{
+ TCHAR msgtxt[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
+ int c = 0;
+ va_list parms2;
+
+ int i = 0;
+ while (gui_msglist[i].num >= 0)
+ {
+ if (gui_msglist[i].num == msg)
+ {
+ strncpy(tmp, gui_msglist[i].msg, MAX_DPATH);
+ va_start(parms2, parms);
+ _vsntprintf(msgtxt, sizeof msgtxt / sizeof(TCHAR), tmp, parms2);
+ gui_message(msgtxt);
+ va_end(parms2);
+ break;
+ }
+ ++i;
+ }
+}
int translate_message(int msg, TCHAR* out)
{
diff --git a/src/osdep/amiberry_mem.cpp b/src/osdep/amiberry_mem.cpp
index 2719101a..5f4d3da9 100644
--- a/src/osdep/amiberry_mem.cpp
+++ b/src/osdep/amiberry_mem.cpp
@@ -4,7 +4,7 @@
#include "uae.h"
#include "options.h"
#include "gui.h"
-#include "memory.h"
+#include "include/memory.h"
#include "newcpu.h"
#include "custom.h"
#include "autoconf.h"
diff --git a/src/osdep/amiberry_rp9.cpp b/src/osdep/amiberry_rp9.cpp
index 1296db13..0faa1b17 100644
--- a/src/osdep/amiberry_rp9.cpp
+++ b/src/osdep/amiberry_rp9.cpp
@@ -185,7 +185,6 @@ static void parse_clip(struct uae_prefs *p, xmlNode *node)
if (attr != NULL)
{
top = atoi((const char *)attr) / 2;
- p->pandora_vertical_offset = top - 41 + OFFSET_Y_ADJUST;
xmlFree(attr);
}
attr = xmlGetProp(curr_node, (const xmlChar *)_T("width"));
diff --git a/src/osdep/fsdb_host.cpp b/src/osdep/fsdb_host.cpp
index 740d267c..43a04c1d 100644
--- a/src/osdep/fsdb_host.cpp
+++ b/src/osdep/fsdb_host.cpp
@@ -33,7 +33,7 @@ int dos_errno(void)
#endif
default:
- write_log(("Unimplemented error %s\n", strerror(e)));
+ //write_log(("Unimplemented error %s\n", strerror(e)));
return ERROR_NOT_IMPLEMENTED;
}
}
diff --git a/src/osdep/gui/PanelCPU.cpp b/src/osdep/gui/PanelCPU.cpp
index 2cf96e28..d4afbb15 100644
--- a/src/osdep/gui/PanelCPU.cpp
+++ b/src/osdep/gui/PanelCPU.cpp
@@ -8,11 +8,13 @@
#include "sysconfig.h"
#include "sysdeps.h"
+#include "config.h"
#include "options.h"
+#include "include/memory.h"
+#include "newcpu.h"
#include "uae.h"
#include "gui.h"
#include "gui_handling.h"
-#include "newcpu.h"
static gcn::Window* grpCPU;
static gcn::UaeRadioButton* optCPU68000;
diff --git a/src/osdep/gui/PanelChipset.cpp b/src/osdep/gui/PanelChipset.cpp
index 783c4c49..72a48353 100644
--- a/src/osdep/gui/PanelChipset.cpp
+++ b/src/osdep/gui/PanelChipset.cpp
@@ -9,8 +9,11 @@
#include "sysconfig.h"
#include "sysdeps.h"
+#include "config.h"
#include "options.h"
+#include "uae.h"
#include "gui.h"
+#include "include/memory.h"
#include "newcpu.h"
#include "custom.h"
#include "gui_handling.h"
diff --git a/src/osdep/gui/PanelConfig.cpp b/src/osdep/gui/PanelConfig.cpp
index b4ac881a..aad81029 100644
--- a/src/osdep/gui/PanelConfig.cpp
+++ b/src/osdep/gui/PanelConfig.cpp
@@ -336,7 +336,7 @@ void RefreshPanelConfig()
{
for (int i = 0; i < ConfigFilesList.size(); ++i)
{
- if (!strcmp(ConfigFilesList[i]->Name, txtName->getText().c_str()))
+ if (!_tcscmp(ConfigFilesList[i]->Name, txtName->getText().c_str()))
{
// Select current entry
lstConfigs->setSelected(i);
diff --git a/src/osdep/gui/gui_handling.h b/src/osdep/gui/gui_handling.h
index b62fba20..a00709f7 100644
--- a/src/osdep/gui/gui_handling.h
+++ b/src/osdep/gui/gui_handling.h
@@ -17,7 +17,7 @@
#define DROPDOWN_HEIGHT 15
#define SLIDER_HEIGHT 18
#define TITLEBAR_HEIGHT 24
-#include "guisan/sdl/sdlinput.hpp"
+#include
typedef struct _ConfigCategory
{
diff --git a/src/osdep/gui/main_window.cpp b/src/osdep/gui/main_window.cpp
index 61a3a90a..e7a79548 100644
--- a/src/osdep/gui/main_window.cpp
+++ b/src/osdep/gui/main_window.cpp
@@ -2,7 +2,7 @@
#include
#include
#include
-#include "guisan/sdl/sdltruetypefont.hpp"
+#include
#include "SelectorEntry.hpp"
#include "sysconfig.h"
@@ -221,7 +221,7 @@ namespace sdl
SDL_ShowCursor(SDL_ENABLE);
//-------------------------------------------------
- // Create helpers for guichan
+ // Create helpers for guisan
//-------------------------------------------------
gui_imageLoader = new gcn::SDLImageLoader();
// The ImageLoader in use is static and must be set to be
@@ -678,6 +678,9 @@ void run_gui()
try
{
sdl::gui_init();
+#ifdef DEBUG
+ printf("Calling widgets::gui_init\n");
+#endif
widgets::gui_init();
if (_tcslen(startup_message) > 0) {
ShowMessage(startup_title, startup_message, _T(""), _T("Ok"), _T(""));
diff --git a/src/osdep/keyboard_amiberry.cpp b/src/osdep/keyboard_amiberry.cpp
index c7b23fb0..36b8acf0 100644
--- a/src/osdep/keyboard_amiberry.cpp
+++ b/src/osdep/keyboard_amiberry.cpp
@@ -14,24 +14,22 @@
#include "gui.h"
#include
-char keyboard_type = 0;
-
static struct uae_input_device_kbr_default keytrans_amiga[] = {
{ VK_ESCAPE, INPUTEVENT_KEY_ESC },
- { SDLK_F1, INPUTEVENT_KEY_F1, 0, INPUTEVENT_SPC_FLOPPY0, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY0, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
- { SDLK_F2, INPUTEVENT_KEY_F2, 0, INPUTEVENT_SPC_FLOPPY1, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY1, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
- { SDLK_F3, INPUTEVENT_KEY_F3, 0, INPUTEVENT_SPC_FLOPPY2, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY2, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
- { SDLK_F4, INPUTEVENT_KEY_F4, 0, INPUTEVENT_SPC_FLOPPY3, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_EFLOPPY3, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
+ { SDLK_F1, INPUTEVENT_KEY_F1 },
+ { SDLK_F2, INPUTEVENT_KEY_F2 },
+ { SDLK_F3, INPUTEVENT_KEY_F3 },
+ { SDLK_F4, INPUTEVENT_KEY_F4 },
- { SDLK_F5, INPUTEVENT_KEY_F5, 0, INPUTEVENT_SPC_STATERESTOREDIALOG, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_STATESAVEDIALOG, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
+ { SDLK_F5, INPUTEVENT_KEY_F5 },
{ SDLK_F6, INPUTEVENT_KEY_F6 },
{ SDLK_F7, INPUTEVENT_KEY_F7 },
{ SDLK_F8, INPUTEVENT_KEY_F8 },
{ SDLK_F9, INPUTEVENT_KEY_F9 },
{ SDLK_F10, INPUTEVENT_KEY_F10 },
-
+
{ SDLK_1, INPUTEVENT_KEY_1 },
{ SDLK_2, INPUTEVENT_KEY_2 },
{ SDLK_3, INPUTEVENT_KEY_3 },
@@ -85,10 +83,10 @@ static struct uae_input_device_kbr_default keytrans_amiga[] = {
{ SDLK_KP_9, INPUTEVENT_KEY_NP_9 },
{ SDLK_KP_0, INPUTEVENT_KEY_NP_0 },
{ SDLK_KP_PERIOD, INPUTEVENT_KEY_PERIOD },
- { SDLK_KP_PLUS, INPUTEVENT_KEY_NP_ADD, 0, INPUTEVENT_SPC_VOLUME_UP, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_MASTER_VOLUME_UP, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_CONTROL, INPUTEVENT_SPC_INCREASE_REFRESHRATE, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
- { SDLK_KP_MINUS, INPUTEVENT_KEY_NP_SUB, 0, INPUTEVENT_SPC_VOLUME_DOWN, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_MASTER_VOLUME_DOWN, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_CONTROL, INPUTEVENT_SPC_DECREASE_REFRESHRATE, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
- { SDLK_KP_MULTIPLY, INPUTEVENT_KEY_NP_MUL, 0, INPUTEVENT_SPC_VOLUME_MUTE, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_MASTER_VOLUME_MUTE, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_CONTROL },
- { SDLK_KP_DIVIDE, INPUTEVENT_KEY_NP_DIV, 0, ID_FLAG_QUALIFIER_SPECIAL },
+ { SDLK_KP_PLUS, INPUTEVENT_KEY_NP_ADD },
+ { SDLK_KP_MINUS, INPUTEVENT_KEY_NP_SUB },
+ { SDLK_KP_MULTIPLY, INPUTEVENT_KEY_NP_MUL },
+ { SDLK_KP_DIVIDE, INPUTEVENT_KEY_NP_DIV },
{ SDLK_KP_ENTER, INPUTEVENT_KEY_ENTER }, // The ENT from keypad..
{ SDLK_MINUS, INPUTEVENT_KEY_SUB },
@@ -127,12 +125,12 @@ static struct uae_input_device_kbr_default keytrans_amiga[] = {
{ SDLK_COMMA, INPUTEVENT_KEY_COMMA },
{ SDLK_PERIOD, INPUTEVENT_KEY_PERIOD },
{ SDLK_SLASH, INPUTEVENT_KEY_DIV },
- { SDLK_SYSREQ, INPUTEVENT_SPC_SCREENSHOT_CLIPBOARD, 0, INPUTEVENT_SPC_SCREENSHOT, ID_FLAG_QUALIFIER_SPECIAL },
+ { SDLK_SYSREQ, INPUTEVENT_SPC_SCREENSHOT_CLIPBOARD },
{SDLK_END, INPUTEVENT_SPC_QUALIFIER_SPECIAL },
- {SDLK_PAUSE, INPUTEVENT_SPC_PAUSE, 0, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_IRQ7, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
+ {SDLK_PAUSE, INPUTEVENT_SPC_PAUSE },
- {SDLK_F12, INPUTEVENT_SPC_ENTERGUI, 0, ID_FLAG_QUALIFIER_SPECIAL, ID_FLAG_QUALIFIER_SHIFT, INPUTEVENT_SPC_TOGGLEDEFAULTSCREEN, ID_FLAG_QUALIFIER_CONTROL },
+ {SDLK_F12, INPUTEVENT_SPC_ENTERGUI },
{ -1, 0 }
};
@@ -202,27 +200,6 @@ void setcapslockstate(int state)
capslockstate = state;
}
-int getcapslock()
-{
- const Uint8 *state = SDL_GetKeyboardState(nullptr);
-
- int capstable[7];
-
- // this returns bogus state if caps change when in exclusive mode..
- host_capslockstate = state[SDL_SCANCODE_CAPSLOCK] & 1;
- host_numlockstate = state[SDL_SCANCODE_NUMLOCKCLEAR] & 1;
- host_scrolllockstate = state[SDL_SCANCODE_SCROLLLOCK] & 1;
- capstable[0] = SDLK_CAPSLOCK;
- capstable[1] = host_capslockstate;
- capstable[2] = SDLK_NUMLOCKCLEAR;
- capstable[3] = host_numlockstate;
- capstable[4] = SDLK_SCROLLLOCK;
- capstable[5] = host_scrolllockstate;
- capstable[6] = 0;
- capslockstate = inputdevice_synccapslock(capslockstate, capstable);
- return capslockstate;
-}
-
void clearallkeys()
{
inputdevice_updateconfig(&changed_prefs, &currprefs);
diff --git a/src/osdep/menu/menu_config.cpp b/src/osdep/menu/menu_config.cpp
index 74827740..a64ba9ff 100644
--- a/src/osdep/menu/menu_config.cpp
+++ b/src/osdep/menu/menu_config.cpp
@@ -12,7 +12,7 @@
#include "custom.h"
#include "uae.h"
#include "disk.h"
-#include "SDL.h"
+#include
static int kickstart;
@@ -181,7 +181,7 @@ int loadconfig_old(struct uae_prefs* p, const char* orgpath)
else
p->chipset_refreshrate = 50;
fscanf(f, "displayedLines=%d\n", &p->gfx_size.height);
- fscanf(f, "screenWidth=%d\n", &p->gfx_size_fs.width);
+ fscanf(f, "screenWidth=%d\n", &p->gfx_size.width);
fscanf(f, "amiberry.custom_controls=%d\n", &p->customControls);
fscanf(f, "amiberry.custom_up=%d\n", &p->custom_up);
fscanf(f, "amiberry.custom_down=%d\n", &p->custom_down);
diff --git a/src/osdep/picasso96.cpp b/src/osdep/picasso96.cpp
index 2a9b16ed..7438b76b 100644
--- a/src/osdep/picasso96.cpp
+++ b/src/osdep/picasso96.cpp
@@ -52,7 +52,7 @@
#include "config.h"
#include "options.h"
#include "threaddep/thread.h"
-#include "memory.h"
+#include "include/memory.h"
#include "custom.h"
#include "newcpu.h"
#include "xwin.h"
@@ -3181,8 +3181,6 @@ addrbank *gfxmem_banks[MAX_RTG_BOARDS];
* Also put it in reset_drawing() for safe-keeping. */
void InitPicasso96(void)
{
- int i;
-
gfxmem_banks[0] = &gfxmem_bank;
//fastscreen
@@ -3190,7 +3188,7 @@ void InitPicasso96(void)
//fastscreen
memset(&picasso96_state_uaegfx, 0, sizeof(struct picasso96_state_struct));
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
p2ctab[i][0] = (((i & 128) ? 0x01000000 : 0)
| ((i & 64) ? 0x010000 : 0)
| ((i & 32) ? 0x0100 : 0)
diff --git a/src/osdep/target.h b/src/osdep/target.h
index 828cc30d..ccd3247d 100644
--- a/src/osdep/target.h
+++ b/src/osdep/target.h
@@ -36,18 +36,14 @@ unsigned long target_lastsynctime(void);
extern int screen_is_picasso;
void saveAdfDir(void);
-bool SetVSyncRate(int hz);
-void setCpuSpeed(void);
-void resetCpuSpeed(void);
void update_display(struct uae_prefs *);
void black_screen_now(void);
void graphics_subshutdown(void);
-void moveVertical(int value);
void amiberry_stop_sound();
void keyboard_settrans();
-void translate_amiberry_keys(int symbol, int *modifier);
+void translate_amiberry_keys(int symbol, int newstate);
void SimulateMouseOrJoy(int code, int keypressed);
#define REMAP_MOUSEBUTTON_LEFT -1
diff --git a/src/traps.cpp b/src/traps.cpp
index f4809b3a..4153c8cb 100644
--- a/src/traps.cpp
+++ b/src/traps.cpp
@@ -14,7 +14,7 @@
#include "sysdeps.h"
#include "options.h"
-#include "memory.h"
+#include "include/memory.h"
#include "custom.h"
#include "newcpu.h"
#include "threaddep/thread.h"
@@ -105,30 +105,25 @@ unsigned int define_trap(TrapHandler handler_func, int flags, const TCHAR *name)
if (trap_count == MAX_TRAPS) {
write_log(_T("Ran out of emulator traps\n"));
target_startup_msg(_T("Internal error"), _T("Ran out of emulator traps."));
- uae_restart(1, NULL);
+ uae_restart(1, nullptr);
return -1;
}
- else {
- int i;
- unsigned int trap_num;
- struct Trap *trap;
- uaecptr addr = here();
+ uaecptr addr = here();
- for (i = 0; i < trap_count; i++) {
- if (addr == traps[i].addr)
- return i;
- }
-
- trap_num = trap_count++;
- trap = &traps[trap_num];
-
- trap->handler = handler_func;
- trap->flags = flags;
- trap->name = name;
- trap->addr = addr;
-
- return trap_num;
+ for (int i = 0; i < trap_count; i++) {
+ if (addr == traps[i].addr)
+ return i;
}
+
+ unsigned int trap_num = trap_count++;
+ struct Trap *trap = &traps[trap_num];
+
+ trap->handler = handler_func;
+ trap->flags = flags;
+ trap->name = name;
+ trap->addr = addr;
+
+ return trap_num;
}
@@ -157,7 +152,7 @@ void REGPARAM2 m68k_handle_trap(unsigned int trap_num)
}
else {
/* Handle simple trap */
- retval = (trap->handler) (NULL);
+ retval = (trap->handler) (nullptr);
if (has_retval)
m68k_dreg(regs, 0) = retval;
@@ -237,7 +232,7 @@ static uaecptr m68k_return_trapaddr;
static uaecptr exit_trap_trapaddr;
/* For IPC between main thread and trap context */
-static uae_sem_t trap_mutex = 0;
+static uae_sem_t trap_mutex = nullptr;
static TrapContext *current_context;
@@ -283,7 +278,7 @@ static void *trap_thread(void *arg)
/* Good bye, cruel world... */
/* dummy return value */
- return 0;
+ return nullptr;
}
/*
@@ -466,11 +461,10 @@ static uae_u32 REGPARAM2 exit_trap_handler(TrapContext *dummy_ctx)
*/
uae_u32 CallLib(TrapContext *ctx, uaecptr base, uae_s16 offset)
{
- uae_u32 retval;
uaecptr olda6 = trap_get_areg(ctx, 6);
trap_set_areg(ctx, 6, base);
- retval = trap_Call68k(ctx, base + offset);
+ uae_u32 retval = trap_Call68k(ctx, base + offset);
trap_set_areg(ctx, 6, olda6);
return retval;
@@ -507,9 +501,9 @@ void init_extended_traps(void)
exit_trap_trapaddr = here();
calltrap(deftrap2(exit_trap_handler, TRAPFLAG_NO_RETVAL, _T("exit_trap")));
- if (trap_mutex != 0)
+ if (trap_mutex != nullptr)
uae_sem_destroy(&trap_mutex);
- trap_mutex = 0;
+ trap_mutex = nullptr;
uae_sem_init(&trap_mutex, 0, 1);
}
@@ -549,7 +543,6 @@ uae_u32 trap_call_lib(TrapContext *ctx, uaecptr base, uae_s16 offset)
}
uae_u32 trap_call_func(TrapContext *ctx, uaecptr func)
{
- uae_u32 v;
uae_u32 storedregs[16];
bool storedregsused[16];
for (int i = 0; i < 16; i++) {
@@ -563,7 +556,7 @@ uae_u32 trap_call_func(TrapContext *ctx, uaecptr func)
}
ctx->calllib_reg_inuse[i] = 0;
}
- v = CallFunc(ctx, func);
+ uae_u32 v = CallFunc(ctx, func);
for (int i = 0; i < 16; i++) {
if (storedregsused[i]) {
regs.regs[i] = storedregs[i];
@@ -598,7 +591,7 @@ void trap_put_quad(TrapContext *ctx, uaecptr addr, uae_u64 v)
{
uae_u8 out[8];
put_long_host(out + 0, v >> 32);
- put_long_host(out + 4, (uae_u32)(v >> 0));
+ put_long_host(out + 4, uae_u32(v >> 0));
trap_put_bytes(ctx, out, addr, 8);
}
void trap_put_long(TrapContext *ctx, uaecptr addr, uae_u32 v)
diff --git a/src/zfile.cpp b/src/zfile.cpp
index 1a70b4ef..52490dd1 100644
--- a/src/zfile.cpp
+++ b/src/zfile.cpp
@@ -789,9 +789,9 @@ static struct zfile *wrp(struct zfile *z, int *retcode)
#endif
#ifdef A_7Z
-#include "7z/Xz.h"
-#include "7z/LzmaDec.h"
-#include "7z/7zCrc.h"
+#include "archivers/7z/Xz.h"
+#include "archivers/7z/LzmaDec.h"
+#include "archivers/7z/7zCrc.h"
static void *SzAlloc(void *p, size_t size)
{
diff --git a/src/zfile_archive.cpp b/src/zfile_archive.cpp
index b76c2dfe..f9b3f3e1 100644
--- a/src/zfile_archive.cpp
+++ b/src/zfile_archive.cpp
@@ -486,11 +486,11 @@ static struct zfile *archive_unpack_zip(struct zfile *zf)
#ifdef A_7Z
/* 7Z */
-#include "7z/7z.h"
-#include "7z/Alloc.h"
-#include "7z/7zFile.h"
-#include "7z/7zVersion.h"
-#include "7z/7zCrc.h"
+#include "archivers/7z/7z.h"
+#include "archivers/7z/Alloc.h"
+#include "archivers/7z/7zFile.h"
+#include "archivers/7z/7zVersion.h"
+#include "archivers/7z/7zCrc.h"
static void *SzAlloc(void *p, size_t size)
{