diff --git a/Makefile b/Makefile
index fe5d390f..3e5ae654 100644
--- a/Makefile
+++ b/Makefile
@@ -156,7 +156,7 @@ OBJS = \
src/osdep/charset.o \
src/osdep/fsdb_host.o \
src/osdep/hardfile_amiberry.o \
- src/osdep/keyboard.o \
+ src/osdep/keyboard_amiberry.o \
src/osdep/mp3decoder.o \
src/osdep/writelog.o \
src/osdep/amiberry.o \
diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj b/VisualGDB/Amiberry/Amiberry.vcxproj
index c015c2fa..e3e659ea 100644
--- a/VisualGDB/Amiberry/Amiberry.vcxproj
+++ b/VisualGDB/Amiberry/Amiberry.vcxproj
@@ -235,7 +235,7 @@
-
+
diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj.filters b/VisualGDB/Amiberry/Amiberry.vcxproj.filters
index a65a6982..866625cd 100644
--- a/VisualGDB/Amiberry/Amiberry.vcxproj.filters
+++ b/VisualGDB/Amiberry/Amiberry.vcxproj.filters
@@ -429,9 +429,6 @@
Source files\osdep
-
- Source files\osdep
-
Source files\osdep
@@ -561,6 +558,9 @@
Source files\osdep
+
+ Source files\osdep
+
diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp
index 7a7db97f..bda229c1 100644
--- a/src/cfgfile.cpp
+++ b/src/cfgfile.cpp
@@ -9,7 +9,9 @@
#include "sysconfig.h"
#include "sysdeps.h"
+
#include
+
#include "options.h"
#include "uae.h"
#include "audio.h"
@@ -21,21 +23,21 @@
#include "rommgr.h"
#include "gui.h"
#include "newcpu.h"
-#include "custom.h"
#include "zfile.h"
#include "filesys.h"
#include "fsdb.h"
#include "disk.h"
#include "blkdev.h"
+#include "statusline.h"
#include "calc.h"
#include "gfxboard.h"
-//#include "SDL_keysym.h"
static int config_newfilesystem;
-static struct strlist* temp_lines;
-static struct strlist* error_lines;
+static struct strlist *temp_lines;
+static struct strlist *error_lines;
static struct zfile *default_file, *configstore;
static int uaeconfig;
+static int unicode_config = 0;
/* @@@ need to get rid of this... just cut part of the manual and print that
* as a help text. */
@@ -44,102 +46,201 @@ struct cfg_lines
const TCHAR *config_label, *config_help;
};
+static const struct cfg_lines opttable[] =
+{
+ { _T("help"), _T("Prints this help") },
+ { _T("config_description"), _T("") },
+ { _T("config_info"), _T("") },
+ { _T("use_gui"), _T("Enable the GUI? If no, then goes straight to emulator") },
+ { _T("use_debugger"), _T("Enable the debugger?") },
+ { _T("cpu_speed"), _T("can be max, real, or a number between 1 and 20") },
+ { _T("cpu_model"), _T("Can be 68000, 68010, 68020, 68030, 68040, 68060") },
+ { _T("fpu_model"), _T("Can be 68881, 68882, 68040, 68060") },
+ { _T("cpu_compatible"), _T("yes enables compatibility-mode") },
+ { _T("cpu_24bit_addressing"), _T("must be set to 'no' in order for Z3mem or P96mem to work") },
+ { _T("autoconfig"), _T("yes = add filesystems and extra ram") },
+ { _T("log_illegal_mem"), _T("print illegal memory access by Amiga software?") },
+ { _T("fastmem_size"), _T("Size in megabytes of fast-memory") },
+ { _T("chipmem_size"), _T("Size in megabytes of chip-memory") },
+ { _T("bogomem_size"), _T("Size in megabytes of bogo-memory at 0xC00000") },
+ { _T("a3000mem_size"), _T("Size in megabytes of A3000 memory") },
+ { _T("gfxcard_size"), _T("Size in megabytes of Picasso96 graphics-card memory") },
+ { _T("z3mem_size"), _T("Size in megabytes of Zorro-III expansion memory") },
+ { _T("gfx_test_speed"), _T("Test graphics speed?") },
+ { _T("gfx_framerate"), _T("Print every nth frame") },
+ { _T("gfx_width"), _T("Screen width") },
+ { _T("gfx_height"), _T("Screen height") },
+ { _T("gfx_refreshrate"), _T("Fullscreen refresh rate") },
+ { _T("gfx_vsync"), _T("Sync screen refresh to refresh rate") },
+ { _T("gfx_lores"), _T("Treat display as lo-res?") },
+ { _T("gfx_linemode"), _T("Can be none, double, or scanlines") },
+ { _T("gfx_fullscreen_amiga"), _T("Amiga screens are fullscreen?") },
+ { _T("gfx_fullscreen_picasso"), _T("Picasso screens are fullscreen?") },
+ { _T("gfx_center_horizontal"), _T("Center display horizontally?") },
+ { _T("gfx_center_vertical"), _T("Center display vertically?") },
+ { _T("gfx_colour_mode"), _T("") },
+ { _T("32bit_blits"), _T("Enable 32 bit blitter emulation") },
+ { _T("immediate_blits"), _T("Perform blits immediately") },
+ { _T("show_leds"), _T("LED display") },
+ { _T("keyboard_leds"), _T("Keyboard LEDs") },
+ { _T("gfxlib_replacement"), _T("Use graphics.library replacement?") },
+ { _T("sound_output"), _T("") },
+ { _T("sound_frequency"), _T("") },
+ { _T("sound_bits"), _T("") },
+ { _T("sound_channels"), _T("") },
+ { _T("sound_max_buff"), _T("") },
+ { _T("comp_trustbyte"), _T("How to access bytes in compiler (direct/indirect/indirectKS/afterPic") },
+ { _T("comp_trustword"), _T("How to access words in compiler (direct/indirect/indirectKS/afterPic") },
+ { _T("comp_trustlong"), _T("How to access longs in compiler (direct/indirect/indirectKS/afterPic") },
+ { _T("comp_nf"), _T("Whether to optimize away flag generation where possible") },
+ { _T("comp_fpu"), _T("Whether to provide JIT FPU emulation") },
+ { _T("compforcesettings"), _T("Whether to force the JIT compiler settings") },
+ { _T("cachesize"), _T("How many MB to use to buffer translated instructions") },
+ { _T("override_dga_address"),_T("Address from which to map the frame buffer (upper 16 bits) (DANGEROUS!)") },
+ { _T("avoid_cmov"), _T("Set to yes on machines that lack the CMOV instruction") },
+ { _T("avoid_dga"), _T("Set to yes if the use of DGA extension creates problems") },
+ { _T("avoid_vid"), _T("Set to yes if the use of the Vidmode extension creates problems") },
+ { _T("parallel_on_demand"), _T("") },
+ { _T("serial_on_demand"), _T("") },
+ { _T("scsi"), _T("scsi.device emulation") },
+ { _T("joyport0"), _T("") },
+ { _T("joyport1"), _T("") },
+ { _T("pci_devices"), _T("List of PCI devices to make visible to the emulated Amiga") },
+ { _T("kickstart_rom_file"), _T("Kickstart ROM image, (C) Copyright Amiga, Inc.") },
+ { _T("kickstart_ext_rom_file"), _T("Extended Kickstart ROM image, (C) Copyright Amiga, Inc.") },
+ { _T("kickstart_key_file"), _T("Key-file for encrypted ROM images (from Cloanto's Amiga Forever)") },
+ { _T("flash_ram_file"), _T("Flash/battery backed RAM image file.") },
+ { _T("cart_file"), _T("Freezer cartridge ROM image file.") },
+ { _T("floppy0"), _T("Diskfile for drive 0") },
+ { _T("floppy1"), _T("Diskfile for drive 1") },
+ { _T("floppy2"), _T("Diskfile for drive 2") },
+ { _T("floppy3"), _T("Diskfile for drive 3") },
+ { _T("hardfile"), _T("access,sectors, surfaces, reserved, blocksize, path format") },
+ { _T("filesystem"), _T("access,'Amiga volume-name':'host directory path' - where 'access' can be 'read-only' or 'read-write'") },
+ { _T("catweasel"), _T("Catweasel board io base address") }
+};
+
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* speedmode[] = {_T("max"), _T("real"), 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* 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* 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* abspointers[] = {_T("none"), _T("mousehack"), _T("tablet"), 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* 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* rtgtype[] = {
- _T("ZorroII"),
- _T("ZorroIII"),
+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 };
+#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 *cscompa[] = {
+ _T("-"), _T("Generic"), _T("CDTV"), _T("CD32"), _T("A500"), _T("A500+"), _T("A600"),
+ _T("A1000"), _T("A1200"), _T("A2000"), _T("A3000"), _T("A3000T"), _T("A4000"), _T("A4000T"), 0
+};
+static const TCHAR *qsmodes[] = {
+ _T("A500"), _T("A500+"), _T("A600"), _T("A1000"), _T("A1200"), _T("A3000"), _T("A4000"), _T(""), _T("CD32"), _T("CDTV"), _T("ARCADIA"), NULL };
+/* 3-state boolean! */
+static const TCHAR *fullmodes[] = { _T("false"), _T("true"), /* "FILE_NOT_FOUND", */ _T("fullwindow"), 0 };
+/* 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 *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
+};
+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 *rtgtype[] = {
+ _T("ZorroII"), _T("ZorroIII"),
_T("PicassoII"),
_T("PicassoII+"),
- _T("Piccolo_Z2"),
- _T("Piccolo_Z3"),
- _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};
+ _T("Piccolo_Z2"), _T("Piccolo_Z3"),
+ _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 };
+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 *obsolete[] = {
+ _T("accuracy"), _T("gfx_opengl"), _T("gfx_32bit_blits"), _T("32bit_blits"),
+ _T("gfx_immediate_blits"), _T("gfx_ntsc"), _T("win32"), _T("gfx_filter_bits"),
+ _T("sound_pri_cutoff"), _T("sound_pri_time"), _T("sound_min_buff"), _T("sound_bits"),
+ _T("gfx_test_speed"), _T("gfxlib_replacement"), _T("enforcer"), _T("catweasel_io"),
+ _T("kickstart_key_file"), _T("fast_copper"), _T("sound_adjust"), _T("sound_latency"),
+ _T("serial_hardware_dtrdsr"), _T("gfx_filter_upscale"),
+ _T("gfx_correct_aspect"), _T("gfx_autoscale"), _T("parallel_sampler"), _T("parallel_ascii_emulation"),
+ _T("avoid_vid"), _T("avoid_dga"), _T("z3chipmem_size"), _T("state_replay_buffer"), _T("state_replay"),
+
+ _T("gfx_filter_vert_zoom"),_T("gfx_filter_horiz_zoom"),
+ _T("gfx_filter_vert_zoom_mult"), _T("gfx_filter_horiz_zoom_mult"),
+ _T("gfx_filter_vert_offset"), _T("gfx_filter_horiz_offset"),
+ _T("rtg_vert_zoom_multf"), _T("rtg_horiz_zoom_multf"),
-static const TCHAR* obsolete[] = {
- _T("accuracy"),
- _T("gfx_opengl"),
- _T("gfx_32bit_blits"),
- _T("32bit_blits"),
- _T("gfx_immediate_blits"),
- _T("gfx_ntsc"),
- _T("win32"),
- _T("gfx_filter_bits"),
- _T("sound_pri_cutoff"),
- _T("sound_pri_time"),
- _T("sound_min_buff"),
- _T("sound_bits"),
- _T("gfx_test_speed"),
- _T("gfxlib_replacement"),
- _T("enforcer"),
- _T("catweasel_io"),
- _T("kickstart_key_file"),
- _T("sound_adjust"),
- _T("sound_latency"),
- _T("serial_hardware_dtrdsr"),
- _T("gfx_filter_upscale"),
- _T("gfx_autoscale"),
- _T("parallel_sampler"),
- _T("parallel_ascii_emulation"),
- _T("avoid_vid"),
- _T("avoid_dga"),
- _T("z3chipmem_size"),
- _T("state_replay_buffer"),
- _T("state_replay"),
- _T("gfx_filter_vert_zoom"),
- _T("gfx_filter_horiz_zoom"),
- _T("gfx_filter_vert_zoom_mult"),
- _T("gfx_filter_horiz_zoom_mult"),
- _T("gfx_filter_vert_offset"),
- _T("gfx_filter_horiz_offset"),
- _T("rtg_vert_zoom_multf"),
- _T("rtg_horiz_zoom_multf"),
NULL
};
#define UNEXPANDED _T("$(FILE_PATH)")
-static void trimwsa(char* s)
+static void trimwsa(char *s)
{
/* Delete trailing whitespace. */
int len = strlen(s);
-
while (len > 0 && strcspn(s + len - 1, "\t \r\n") == 0)
s[--len] = '\0';
}
-static int match_string(const TCHAR* table[], const TCHAR* str)
+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)
return i;
-
return -1;
}
@@ -373,24 +474,74 @@ TCHAR* cfgfile_subst_path(const TCHAR* path, const TCHAR* subst, const TCHAR* fi
return s;
}
-static bool isdefault(const TCHAR* 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];
-
if (!default_file || uaeconfig)
return false;
-
zfile_fseek(default_file, 0, SEEK_SET);
-
- while (zfile_fgets(tmp, sizeof tmp / sizeof(TCHAR), default_file))
- {
+ while (zfile_fgets(tmp, sizeof tmp / sizeof(TCHAR), default_file)) {
if (tmp[0] && tmp[_tcslen(tmp) - 1] == '\n')
tmp[_tcslen(tmp) - 1] = 0;
-
if (!_tcscmp(tmp, s))
return true;
}
-
return false;
}
@@ -435,67 +586,56 @@ static void cfg_dowrite(struct zfile* f, const TCHAR* option, const TCHAR* optio
cfg_write(tmp, f);
}
-static void cfg_dowrite(struct zfile* f, const TCHAR* option, const TCHAR* value, int d, int target)
+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);
}
-
-void cfgfile_write_bool(struct zfile* f, const TCHAR* option, bool b)
+void cfgfile_write_bool(struct zfile *f, const TCHAR *option, bool b)
{
cfg_dowrite(f, option, b ? _T("true") : _T("false"), 0, 0);
}
-
-void cfgfile_dwrite_bool(struct zfile* f, const TCHAR* option, bool b)
+void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, bool b)
{
cfg_dowrite(f, option, b ? _T("true") : _T("false"), 1, 0);
}
-
-void cfgfile_dwrite_bool(struct zfile* f, const TCHAR* option, const TCHAR* optionext, bool b)
+void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, const TCHAR *optionext, bool b)
{
cfg_dowrite(f, option, optionext, b ? _T("true") : _T("false"), 1, 0);
}
-
-void cfgfile_dwrite_bool(struct zfile* f, const TCHAR* option, int b)
+void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, int b)
{
cfgfile_dwrite_bool(f, option, b != 0);
}
-
-void cfgfile_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value)
+void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value)
{
cfg_dowrite(f, option, value, 0, 0);
}
-
-void cfgfile_write_str(struct zfile* f, const TCHAR* option, const TCHAR* optionext, const TCHAR* value)
+void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value)
{
cfg_dowrite(f, option, optionext, value, 0, 0);
}
-
-void cfgfile_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* value)
+void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value)
{
cfg_dowrite(f, option, value, 1, 0);
}
-
-void cfgfile_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* optionext, const TCHAR* value)
+void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value)
{
cfg_dowrite(f, option, optionext, value, 1, 0);
}
-void cfgfile_target_write_bool(struct zfile* f, const TCHAR* option, bool b)
+void cfgfile_target_write_bool(struct zfile *f, const TCHAR *option, bool b)
{
cfg_dowrite(f, option, b ? _T("true") : _T("false"), 0, 1);
}
-
-void cfgfile_target_dwrite_bool(struct zfile* f, const TCHAR* option, bool b)
+void cfgfile_target_dwrite_bool(struct zfile *f, const TCHAR *option, bool b)
{
cfg_dowrite(f, option, b ? _T("true") : _T("false"), 1, 1);
}
-
-void cfgfile_target_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value)
+void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value)
{
cfg_dowrite(f, option, value, 0, 1);
}
-
-void cfgfile_target_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* value)
+void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value)
{
cfg_dowrite(f, option, value, 1, 1);
}
@@ -574,80 +714,63 @@ void cfgfile_target_dwrite(struct zfile* f, const TCHAR* option, const TCHAR* fo
va_end(parms);
}
-static void cfgfile_write_rom(struct zfile* f, const TCHAR* path, const TCHAR* romfile, const TCHAR* name)
+static void cfgfile_write_rom(struct zfile *f, struct multipath *mp, const TCHAR *romfile, const TCHAR *name)
{
- TCHAR* str = cfgfile_subst_path(path, UNEXPANDED, romfile);
+ TCHAR *str = cfgfile_subst_path(mp->path[0], UNEXPANDED, romfile);
+ str = cfgfile_put_multipath(mp, str);
cfgfile_write_str(f, name, str);
- struct zfile* zf = zfile_fopen(str, _T("rb"), ZFD_ALL);
-
- if (zf)
- {
- struct romdata* rd = getromdatabyzfile(zf);
-
- if (rd)
- {
+ struct zfile *zf = zfile_fopen(str, _T("rb"), ZFD_ALL);
+ if (zf) {
+ struct romdata *rd = getromdatabyzfile(zf);
+ if (rd) {
TCHAR name2[MAX_DPATH], str2[MAX_DPATH];
_tcscpy(name2, name);
_tcscat(name2, _T("_id"));
_stprintf(str2, _T("%08X,%s"), rd->crc32, rd->name);
cfgfile_write_str(f, name2, str2);
}
-
zfile_fclose(zf);
}
-
xfree(str);
+
}
-static void cfgfile_write_path(struct zfile* f, const TCHAR* path, const TCHAR* option, const TCHAR* value)
+static void cfgfile_write_path(struct zfile *f, struct multipath *mp, const TCHAR *option, const TCHAR *value)
{
- TCHAR* s = cfgfile_subst_path(path, UNEXPANDED, value);
+ TCHAR *s = cfgfile_put_multipath(mp, value);
cfgfile_write_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)
+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, struct zfile *f)
{
int i;
TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH], tmp3[MAX_DPATH];
+ TCHAR *hdcontrollers[] = { _T("uae"),
+ _T("ide0"), _T("ide1"), _T("ide2"), _T("ide3"),
+ _T("scsi0"), _T("scsi1"), _T("scsi2"), _T("scsi3"), _T("scsi4"), _T("scsi5"), _T("scsi6"),
+ _T("scsram"), _T("scide") }; /* scsram = smart card sram = pcmcia sram card */
- const TCHAR* hdcontrollers[] = {
- _T("uae"),
- _T("ide0"),
- _T("ide1"),
- _T("ide2"),
- _T("ide3"),
- _T("scsi0"),
- _T("scsi1"),
- _T("scsi2"),
- _T("scsi3"),
- _T("scsi4"),
- _T("scsi5"),
- _T("scsi6"),
- _T("scsram"),
- _T("scide")
- }; /* scsram = smart card sram = pcmcia sram card */
-
- for (i = 0; i < p->mountitems; i++)
- {
- struct uaedev_config_data* uci = &p->mountconfig[i];
- struct uaedev_config_info* ci = &uci->ci;
+ for (i = 0; i < p->mountitems; i++) {
+ struct uaedev_config_data *uci = &p->mountconfig[i];
+ struct uaedev_config_info *ci = &uci->ci;
TCHAR *str1, *str2, *str1b, *str2b;
int bp = ci->bootpri;
str2 = _T("");
-
- if (ci->rootdir[0] == ':')
- {
- TCHAR* ptr;
+ if (ci->rootdir[0] == ':') {
+ TCHAR *ptr;
// separate harddrive names
str1 = my_strdup(ci->rootdir);
ptr = _tcschr(str1 + 1, ':');
- if (ptr)
- {
+ if (ptr) {
*ptr++ = 0;
str2 = ptr;
ptr = _tcschr(str2, ',');
@@ -655,98 +778,60 @@ static void write_filesys_config(struct uae_prefs* p,
*ptr = 0;
}
}
- else
- {
- str1 = cfgfile_subst_path(default_path, unexpanded, ci->rootdir);
+ else {
+ str1 = cfgfile_put_multipath(&p->path_hardfile, ci->rootdir);
}
str1b = cfgfile_escape(str1, _T(":,"), true);
str2b = cfgfile_escape(str2, _T(":,"), true);
-
- if (ci->type == UAEDEV_DIR)
- {
- _stprintf(tmp,
- _T("%s,%s:%s:%s,%d"),
- ci->readonly ? _T("ro") : _T("rw"),
- ci->devname,
- ci->volname,
- str1,
- bp);
-
+ if (ci->type == UAEDEV_DIR) {
+ _stprintf(tmp, _T("%s,%s:%s:%s,%d"), ci->readonly ? _T("ro") : _T("rw"),
+ ci->devname ? ci->devname : _T(""), ci->volname, str1, bp);
cfgfile_write_str(f, _T("filesystem2"), tmp);
_tcscpy(tmp3, tmp);
}
- else if (ci->type == UAEDEV_HDF || ci->type == UAEDEV_CD || ci->type == UAEDEV_TAPE)
- {
- _stprintf(tmp,
- _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"),
- ci->readonly ? _T("ro") : _T("rw"),
- ci->devname,
- str1,
- ci->sectors,
- ci->surfaces,
- ci->reserved,
- ci->blocksize,
- bp,
- ci->filesys,
- hdcontrollers[ci->controller]);
-
- _stprintf(tmp3,
- _T("%s,%s:%s%s%s,%d,%d,%d,%d,%d,%s,%s"),
- ci->readonly ? _T("ro") : _T("rw"),
- ci->devname,
- str1b,
- str2b[0] ? _T(":") : _T(""),
- str2b,
- ci->sectors,
- ci->surfaces,
- ci->reserved,
- ci->blocksize,
- bp,
- ci->filesys,
- hdcontrollers[ci->controller]);
-
- if (ci->highcyl)
- {
- TCHAR* s = tmp + _tcslen(tmp);
- TCHAR* s2 = s;
+ else if (ci->type == UAEDEV_HDF || ci->type == UAEDEV_CD || ci->type == UAEDEV_TAPE) {
+ _stprintf(tmp, _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"),
+ ci->readonly ? _T("ro") : _T("rw"),
+ ci->devname ? ci->devname : _T(""), str1,
+ ci->sectors, ci->surfaces, ci->reserved, ci->blocksize,
+ bp, ci->filesys ? ci->filesys : _T(""), hdcontrollers[ci->controller]);
+ _stprintf(tmp3, _T("%s,%s:%s%s%s,%d,%d,%d,%d,%d,%s,%s"),
+ ci->readonly ? _T("ro") : _T("rw"),
+ ci->devname ? ci->devname : _T(""), str1b, str2b[0] ? _T(":") : _T(""), str2b,
+ ci->sectors, ci->surfaces, ci->reserved, ci->blocksize,
+ bp, ci->filesys ? ci->filesys : _T(""), hdcontrollers[ci->controller]);
+ if (ci->highcyl) {
+ TCHAR *s = tmp + _tcslen(tmp);
+ TCHAR *s2 = s;
_stprintf(s2, _T(",%d"), ci->highcyl);
-
- if (ci->pcyls && ci->pheads && ci->psecs)
- {
- TCHAR* s = tmp + _tcslen(tmp);
+ if (ci->pcyls && ci->pheads && ci->psecs) {
+ TCHAR *s = tmp + _tcslen(tmp);
_stprintf(s, _T(",%d/%d/%d"), ci->pcyls, ci->pheads, ci->psecs);
}
-
_tcscat(tmp3, s2);
}
-
if (ci->type == UAEDEV_HDF)
cfgfile_write_str(f, _T("hardfile2"), tmp);
}
_stprintf(tmp2, _T("uaehf%d"), i);
-
- if (ci->type == UAEDEV_CD)
- {
+ if (ci->type == UAEDEV_CD) {
cfgfile_write(f, tmp2, _T("cd%d,%s"), ci->device_emu_unit, tmp);
}
- else if (ci->type == UAEDEV_TAPE)
- {
+ else if (ci->type == UAEDEV_TAPE) {
cfgfile_write(f, tmp2, _T("tape%d,%s"), ci->device_emu_unit, tmp);
}
- else
- {
+ else {
cfgfile_write(f, tmp2, _T("%s,%s"), ci->type == UAEDEV_HDF ? _T("hdf") : _T("dir"), tmp3);
}
-
- xfree (str1b);
- xfree (str2b);
- xfree (str1);
+ xfree(str1b);
+ xfree(str2b);
+ xfree(str1);
}
}
-static void write_compatibility_cpu(struct zfile* f, struct uae_prefs* p)
+static void write_compatibility_cpu(struct zfile *f, struct uae_prefs *p)
{
TCHAR tmp[100];
int model;
@@ -754,59 +839,101 @@ static void write_compatibility_cpu(struct zfile* f, struct uae_prefs* p)
model = p->cpu_model;
if (model == 68030)
model = 68020;
-
if (model == 68060)
model = 68040;
-
if (p->address_space_24 && model == 68020)
- _tcscpy(tmp, _T("68ec020"));
+ _tcscpy(tmp, _T("68ec020"));
else
- _stprintf(tmp, _T("%d"), model);
-
+ _stprintf(tmp, _T("%d"), model);
if (model == 68020 && (p->fpu_model == 68881 || p->fpu_model == 68882))
- _tcscat(tmp, _T("/68881"));
-
+ _tcscat(tmp, _T("/68881"));
cfgfile_write(f, _T("cpu_type"), tmp);
}
-static void write_resolution(struct zfile* f, const TCHAR* ws, const TCHAR* hs, struct wh* wh)
+static void write_leds(struct zfile *f, const TCHAR *name, int mask)
{
- cfgfile_write(f, ws, _T("%d"), wh->width);
- cfgfile_write(f, hs, _T("%d"), wh->height);
+ 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);
+ }
}
void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type)
{
- struct strlist* sl;
+ struct strlist *sl;
TCHAR tmp[MAX_DPATH];
int i;
cfgfile_write_str(f, _T("config_description"), p->description);
cfgfile_write_bool(f, _T("config_hardware"), type & CONFIG_TYPE_HARDWARE);
- cfgfile_write_bool(f, _T("config_host"), !! (type & CONFIG_TYPE_HOST));
-
+ cfgfile_write_bool(f, _T("config_host"), !!(type & CONFIG_TYPE_HOST));
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)
- {
- if (sl->unknown)
- {
+ for (sl = p->all_lines; sl; sl = sl->next) {
+ if (sl->unknown) {
if (sl->option)
cfgfile_write_str(f, sl->option, sl->value);
}
}
- _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);
+ 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]);
+ }
+ }
cfg_write(_T("; host-specific"), f);
@@ -815,164 +942,284 @@ 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"));
+ 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"));
+ }
+ 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_str(f, _T("flash_file"), p->flashfile);
+ 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);
p->nr_floppies = 4;
-
- for (i = 0; i < 4; i++)
- {
+ 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)
- {
+ 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_subst_path(p->path_cd, UNEXPANDED, p->cdslots[i].name);
+ TCHAR *s = cfgfile_put_multipath(&p->path_cd, 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)
- {
+ if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr(p->cdslots[i].name, ',') || p->cdslots[i].delayed) {
_tcscat(tmp2, _T(","));
-
- if (p->cdslots[i].delayed)
- {
+ if (p->cdslots[i].delayed) {
_tcscat(tmp2, _T("delay"));
_tcscat(tmp2, _T(":"));
}
-
- if (p->cdslots[i].type != SCSI_UNIT_DEFAULT)
- {
+ if (p->cdslots[i].type != SCSI_UNIT_DEFAULT) {
_tcscat(tmp2, cdmodes[p->cdslots[i].type + 1]);
}
}
-
cfgfile_write_str(f, tmp, tmp2);
}
}
+ 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_str(f, _T("sound_output"), soundmode1[p->produce_sound]);
cfgfile_write_str(f, _T("sound_channels"), stereomode[p->sound_stereo]);
cfgfile_write(f, _T("sound_stereo_separation"), _T("%d"), p->sound_stereo_separation);
cfgfile_write(f, _T("sound_stereo_mixing_delay"), _T("%d"), p->sound_mixed_stereo_delay >= 0 ? p->sound_mixed_stereo_delay : 0);
+ cfgfile_write(f, _T("sound_max_buff"), _T("%d"), p->sound_maxbsiz);
cfgfile_write(f, _T("sound_frequency"), _T("%d"), p->sound_freq);
cfgfile_write_str(f, _T("sound_interpol"), interpolmode[p->sound_interpol]);
cfgfile_write_str(f, _T("sound_filter"), soundfiltermode1[p->sound_filter]);
cfgfile_write_str(f, _T("sound_filter_type"), soundfiltermode2[p->sound_filter_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++)
- {
- struct jport* jp = &p->jports[i];
+ for (i = 0; i < MAX_JPORTS; i++) {
+ struct jport *jp = &p->jports[i];
int v = jp->id;
TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
-
- if (v == JPORT_CUSTOM)
- {
+ if (v == JPORT_CUSTOM) {
_tcscpy(tmp2, _T("custom"));
}
- else if (v == JPORT_NONE)
- {
+ else if (v == JPORT_NONE) {
_tcscpy(tmp2, _T("none"));
}
- else if (v < JSEM_JOYS)
- {
+ else if (v < JSEM_JOYS) {
_stprintf(tmp2, _T("kbd%d"), v + 1);
}
- else if (v < JSEM_MICE)
- {
+ else if (v < JSEM_MICE) {
_stprintf(tmp2, _T("joy%d"), v - JSEM_JOYS);
}
- else
- {
+ else {
_tcscpy(tmp2, _T("mouse"));
if (v - JSEM_MICE > 0)
- _stprintf(tmp2, _T("mouse%d"), v - JSEM_MICE);
+ _stprintf(tmp2, _T("mouse%d"), v - JSEM_MICE);
}
-
- if (i < 2 || jp->id >= 0)
- {
+ if (i < 2 || jp->id >= 0) {
_stprintf(tmp1, _T("joyport%d"), i);
cfgfile_write(f, tmp1, tmp2);
_stprintf(tmp1, _T("joyport%dautofire"), i);
cfgfile_write(f, tmp1, joyaf[jp->autofire]);
-
- if (i < 2 && jp->mode > 0)
- {
+ if (i < 2 && jp->mode > 0) {
_stprintf(tmp1, _T("joyport%dmode"), i);
cfgfile_write(f, tmp1, joyportmodes[jp->mode]);
}
- if (jp->name[0])
- {
+ if (jp->name[0]) {
_stprintf(tmp1, _T("joyportfriendlyname%d"), i);
cfgfile_write(f, tmp1, jp->name);
}
- if (jp->configname[0])
- {
+ if (jp->configname[0]) {
_stprintf(tmp1, _T("joyportname%d"), i);
cfgfile_write(f, tmp1, jp->configname);
}
- if (jp->nokeyboardoverride)
- {
+ if (jp->nokeyboardoverride) {
_stprintf(tmp1, _T("joyport%dkeyboardoverride"), i);
cfgfile_write_bool(f, tmp1, !jp->nokeyboardoverride);
}
}
}
+ 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("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("key_for_menu"), _T("%d"), p->key_for_menu);
- cfgfile_write(f, _T("key_for_quit"), _T("%d"), p->key_for_quit);
- cfgfile_write(f, _T("button_for_menu"), _T("%d"), p->button_for_menu);
- cfgfile_write(f, _T("button_for_quit"), _T("%d"), p->button_for_quit);
+ 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); /* compatibility with old versions */
+ 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);
+ 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);
-#ifdef RASPBERRY
+#ifdef AMIBERRY
cfgfile_write(f, _T("gfx_correct_aspect"), _T("%d"), p->gfx_correct_aspect);
cfgfile_write(f, _T("kbd_led_num"), _T("%d"), p->kbd_led_num);
cfgfile_write(f, _T("kbd_led_scr"), _T("%d"), p->kbd_led_scr);
cfgfile_write(f, _T("scaling_method"), _T("%d"), p->scaling_method);
+ cfgfile_write(f, _T("key_for_menu"), _T("%d"), p->key_for_menu);
+ cfgfile_write(f, _T("key_for_quit"), _T("%d"), p->key_for_quit);
+ cfgfile_write(f, _T("button_for_menu"), _T("%d"), p->button_for_menu);
+ cfgfile_write(f, _T("button_for_quit"), _T("%d"), p->button_for_quit);
#endif
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("fast_copper"), p->fast_copper);
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);
+ 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))
@@ -983,326 +1230,383 @@ void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type)
cfgfile_write(f, _T("chipset"), _T("ecs_denise"));
else
cfgfile_write(f, _T("chipset"), _T("ocs"));
-
if (p->chipset_refreshrate > 0)
cfgfile_write(f, _T("chipset_refreshrate"), _T("%f"), p->chipset_refreshrate);
+ for (int i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) {
+ if (p->cr[i].rate <= 0)
+ continue;
+ struct chipset_refresh *cr = &p->cr[i];
+ cr->index = i;
+ _stprintf(tmp, _T("%f"), cr->rate);
+ TCHAR *s = tmp + _tcslen(tmp);
+ if (cr->label[0] > 0 && i < MAX_CHIPSET_REFRESH)
+ s += _stprintf(s, _T(",t=%s"), cr->label);
+ if (cr->horiz > 0)
+ s += _stprintf(s, _T(",h=%d"), cr->horiz);
+ if (cr->vert > 0)
+ s += _stprintf(s, _T(",v=%d"), cr->vert);
+ if (cr->locked)
+ _tcscat(s, _T(",locked"));
+ if (cr->ntsc > 0)
+ _tcscat(s, _T(",ntsc"));
+ else if (cr->ntsc == 0)
+ _tcscat(s, _T(",pal"));
+ if (cr->lace > 0)
+ _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->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 (i == CHIPSET_REFRESH_PAL)
+ cfgfile_dwrite(f, _T("displaydata_pal"), tmp);
+ else if (i == CHIPSET_REFRESH_NTSC)
+ cfgfile_dwrite(f, _T("displaydata_ntsc"), tmp);
+ else
+ cfgfile_dwrite(f, _T("displaydata"), tmp);
+ }
+
cfgfile_write_str(f, _T("collision_level"), collmode[p->collision_level]);
+ cfgfile_write_str(f, _T("chipset_compatible"), cscompa[p->cs_compatible]);
+ cfgfile_dwrite_str(f, _T("ciaatod"), ciaatodmode[p->cs_ciaatod]);
+ cfgfile_dwrite_str(f, _T("rtc"), rtctype[p->cs_rtc]);
+ //cfgfile_dwrite (f, _T("chipset_rtc_adjust"), _T("%d"), p->cs_rtc_adjust);
+ cfgfile_dwrite_bool(f, _T("ksmirror_e0"), p->cs_ksmirror_e0);
+ cfgfile_dwrite_bool(f, _T("ksmirror_a8"), p->cs_ksmirror_a8);
cfgfile_dwrite_bool(f, _T("cd32cd"), p->cs_cd32cd);
cfgfile_dwrite_bool(f, _T("cd32c2p"), p->cs_cd32c2p);
cfgfile_dwrite_bool(f, _T("cd32nvram"), p->cs_cd32nvram);
+ cfgfile_dwrite_bool(f, _T("cdtvcd"), p->cs_cdtvcd);
+ cfgfile_dwrite_bool(f, _T("cdtvram"), p->cs_cdtvram);
+ cfgfile_dwrite(f, _T("cdtvramcard"), _T("%d"), p->cs_cdtvcard);
+ cfgfile_dwrite_str(f, _T("ide"), p->cs_ide == IDE_A600A1200 ? _T("a600/a1200") : (p->cs_ide == IDE_A4000 ? _T("a4000") : _T("none")));
+ cfgfile_dwrite_bool(f, _T("a1000ram"), p->cs_a1000ram);
+ cfgfile_dwrite(f, _T("fatgary"), _T("%d"), p->cs_fatgaryrev);
+ cfgfile_dwrite(f, _T("ramsey"), _T("%d"), p->cs_ramseyrev);
+ cfgfile_dwrite_bool(f, _T("pcmcia"), p->cs_pcmcia);
+ cfgfile_dwrite_bool(f, _T("scsi_cdtv"), p->cs_cdtvscsi);
+ cfgfile_dwrite_bool(f, _T("scsi_a2091"), p->a2091);
+ cfgfile_dwrite_bool(f, _T("scsi_a4091"), p->a4091);
+ cfgfile_dwrite_bool(f, _T("scsi_a3000"), p->cs_mbdmac == 1);
+ cfgfile_dwrite_bool(f, _T("scsi_a4000t"), p->cs_mbdmac == 2);
+ cfgfile_dwrite_bool(f, _T("bogomem_fast"), p->cs_slowmemisfast);
+ cfgfile_dwrite_bool(f, _T("resetwarning"), p->cs_resetwarning);
+ cfgfile_dwrite_bool(f, _T("denise_noehb"), p->cs_denisenoehb);
+ cfgfile_dwrite_bool(f, _T("agnus_bltbusybug"), p->cs_agnusbltbusybug);
+ cfgfile_dwrite_bool(f, _T("ics_agnus"), p->cs_dipagnus);
+ cfgfile_dwrite_bool(f, _T("cia_todbug"), p->cs_ciatodbug);
+ cfgfile_dwrite(f, _T("chipset_hacks"), _T("0x%x"), p->cs_hacks);
+ cfgfile_dwrite_bool(f, _T("fastmem_autoconfig"), p->fastmem_autoconfig);
cfgfile_write(f, _T("fastmem_size"), _T("%d"), p->fastmem_size / 0x100000);
+ cfgfile_dwrite(f, _T("fastmem2_size"), _T("%d"), p->fastmem2_size / 0x100000);
+ cfgfile_write(f, _T("a3000mem_size"), _T("%d"), p->mbresmem_low_size / 0x100000);
+ cfgfile_write(f, _T("mbresmem_size"), _T("%d"), p->mbresmem_high_size / 0x100000);
cfgfile_write(f, _T("z3mem_size"), _T("%d"), p->z3fastmem_size / 0x100000);
+ cfgfile_dwrite(f, _T("z3mem2_size"), _T("%d"), p->z3fastmem2_size / 0x100000);
cfgfile_write(f, _T("z3mem_start"), _T("0x%x"), p->z3fastmem_start);
cfgfile_write(f, _T("bogomem_size"), _T("%d"), p->bogomem_size / 0x40000);
cfgfile_write(f, _T("gfxcard_size"), _T("%d"), p->rtgmem_size / 0x100000);
cfgfile_write_str(f, _T("gfxcard_type"), rtgtype[p->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])
+ cfgfile_write(f, _T("addmem1"), _T("0x%x,0x%x"), p->custom_memory_addrs[0], p->custom_memory_sizes[0]);
+ if (p->custom_memory_sizes[1])
+ cfgfile_write(f, _T("addmem2"), _T("0x%x,0x%x"), p->custom_memory_addrs[1], p->custom_memory_sizes[1]);
+ }
- /*
- Valid m68k_speed values:
- -1 = fastest / max
- 0 = 7Mhz / real
- 1024 = 14Mhz
- 128 = 25Mhz
- */
- if (p->m68k_speed > 0)
- {
+ if (p->m68k_speed > 0) {
cfgfile_write(f, _T("finegrain_cpu_speed"), _T("%d"), p->m68k_speed);
}
- else
- {
+ 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("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);
+
#ifdef FILESYS
- write_filesys_config(p, UNEXPANDED, p->path_hardfile, f);
+ write_filesys_config(p, f);
+ if (p->filesys_no_uaefsdb)
+ cfgfile_write_bool(f, _T("filesys_no_fsdb"), p->filesys_no_uaefsdb);
cfgfile_dwrite(f, _T("filesys_max_size"), _T("%d"), p->filesys_limit);
cfgfile_dwrite(f, _T("filesys_max_name_length"), _T("%d"), p->filesys_max_name);
+ cfgfile_dwrite(f, _T("filesys_max_file_size"), _T("%d"), p->filesys_max_file_size);
#endif
-
write_inputdevice_config(p, f);
}
-int cfgfile_yesno(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location, bool numbercheck)
+int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, bool numbercheck)
{
if (name != NULL && _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))
+ || strcasecmp(value, _T("true")) == 0 || strcasecmp(value, _T("t")) == 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))
*location = 0;
- else
- {
+ else {
write_log(_T("Option `%s' requires a value of either `yes' or `no' (was '%s').\n"), option, value);
return -1;
}
-
return 1;
}
-
-int cfgfile_yesno(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location)
+int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location)
{
return cfgfile_yesno(option, value, name, location, true);
}
-
-int cfgfile_yesno(const TCHAR* option, const TCHAR* value, const TCHAR* name, bool* location, bool numbercheck)
+int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, bool numbercheck)
{
int val;
int ret = cfgfile_yesno(option, value, name, &val, numbercheck);
-
if (ret == 0)
return 0;
-
if (ret < 0)
*location = false;
else
*location = val != 0;
-
return 1;
}
-
-int cfgfile_yesno(const TCHAR* option, const TCHAR* value, const TCHAR* name, bool* location)
+int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location)
{
return cfgfile_yesno(option, value, name, location, true);
}
-int cfgfile_doubleval(const TCHAR* option, const TCHAR* value, const TCHAR* name, double* location)
+int cfgfile_doubleval(const TCHAR *option, const TCHAR *value, const TCHAR *name, double *location)
{
int base = 10;
- TCHAR* endptr;
-
+ TCHAR *endptr;
if (name != NULL && _tcscmp(option, name) != 0)
return 0;
-
*location = _tcstod(value, &endptr);
return 1;
}
-int cfgfile_floatval(const TCHAR* option, const TCHAR* value, const TCHAR* name, const TCHAR* nameext, float* location)
+int cfgfile_floatval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, float *location)
{
int base = 10;
- TCHAR* endptr;
-
+ TCHAR *endptr;
if (name == NULL)
return 0;
-
- if (nameext)
- {
+ if (nameext) {
TCHAR tmp[MAX_DPATH];
_tcscpy(tmp, name);
_tcscat(tmp, nameext);
if (_tcscmp(tmp, option) != 0)
return 0;
}
- else
- {
+ else {
if (_tcscmp(option, name) != 0)
return 0;
}
-
*location = (float)_tcstod(value, &endptr);
return 1;
}
-
-int cfgfile_floatval(const TCHAR* option, const TCHAR* value, const TCHAR* name, float* location)
+int cfgfile_floatval(const TCHAR *option, const TCHAR *value, const TCHAR *name, float *location)
{
return cfgfile_floatval(option, value, name, NULL, location);
}
-int cfgfile_intval(const TCHAR* option, const TCHAR* value, const TCHAR* name, const TCHAR* nameext, unsigned int* location, int scale)
+int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, unsigned int *location, int scale)
{
int base = 10;
- TCHAR* endptr;
+ TCHAR *endptr;
TCHAR tmp[MAX_DPATH];
if (name == NULL)
return 0;
-
- if (nameext)
- {
+ if (nameext) {
_tcscpy(tmp, name);
_tcscat(tmp, nameext);
if (_tcscmp(tmp, option) != 0)
return 0;
}
- else
- {
+ else {
if (_tcscmp(option, name) != 0)
return 0;
}
-
/* I guess octal isn't popular enough to worry about here... */
if (value[0] == '0' && _totupper(value[1]) == 'X')
- value += 2 , base = 16;
+ value += 2, base = 16;
+ *location = _tcstol(value, &endptr, base) * scale;
- *location = _tcstol (value, &endptr, base) * scale;
-
- if (*endptr != '\0' || *value == '\0')
- {
- if (strcasecmp(value, _T("false")) == 0 || strcasecmp(value, _T("no")) == 0)
- {
+ if (*endptr != '\0' || *value == '\0') {
+ if (strcasecmp(value, _T("false")) == 0 || strcasecmp(value, _T("no")) == 0) {
*location = 0;
return 1;
}
-
- if (strcasecmp(value, _T("true")) == 0 || strcasecmp(value, _T("yes")) == 0)
- {
+ if (strcasecmp(value, _T("true")) == 0 || strcasecmp(value, _T("yes")) == 0) {
*location = 1;
return 1;
}
-
write_log(_T("Option '%s' requires a numeric argument but got '%s'\n"), nameext ? tmp : option, value);
return -1;
}
-
return 1;
}
-int cfgfile_intval(const TCHAR* option, const TCHAR* value, const TCHAR* name, unsigned int* location, int scale)
+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);
}
-
-int cfgfile_intval(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location, int 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);
-
if (!r)
return 0;
-
*location = (int)v;
return r;
}
-
-int cfgfile_intval(const TCHAR* option, const TCHAR* value, const TCHAR* name, const TCHAR* nameext, int* location, int scale)
+int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, int scale)
{
unsigned int v = 0;
int r = cfgfile_intval(option, value, name, nameext, &v, scale);
-
if (!r)
return 0;
-
*location = (int)v;
return r;
}
-int cfgfile_strval(const TCHAR* option, const TCHAR* value, const TCHAR* name, const TCHAR* nameext, int* location, const TCHAR* table[], int more)
+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)
return 0;
-
- if (nameext)
- {
+ if (nameext) {
_tcscpy(tmp, name);
_tcscat(tmp, nameext);
if (_tcscmp(tmp, option) != 0)
return 0;
}
- else
- {
+ else {
if (_tcscmp(option, name) != 0)
return 0;
}
-
val = match_string(table, value);
-
- if (val == -1)
- {
+ if (val == -1) {
if (more)
return 0;
-
- if (!strcasecmp(value, _T("yes")) || !strcasecmp(value, _T("true")))
- {
+ if (!strcasecmp(value, _T("yes")) || !strcasecmp(value, _T("true"))) {
val = 1;
}
- else if (!strcasecmp(value, _T("no")) || !strcasecmp(value, _T("false")))
- {
+ else if (!strcasecmp(value, _T("no")) || !strcasecmp(value, _T("false"))) {
val = 0;
}
- else
- {
+ else {
write_log(_T("Unknown value ('%s') for option '%s'.\n"), value, nameext ? tmp : option);
return -1;
}
}
-
*location = val;
return 1;
}
-
-int cfgfile_strval(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location, const TCHAR* table[], int more)
+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);
}
-int cfgfile_strboolval(const TCHAR* option, const TCHAR* value, const TCHAR* name, bool* location, const TCHAR* table[], int more)
+int cfgfile_strboolval(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, const TCHAR *table[], int more)
{
int locationint;
-
if (!cfgfile_strval(option, value, name, &locationint, table, more))
return 0;
-
*location = locationint != 0;
return 1;
}
-int cfgfile_string(const TCHAR* option, const TCHAR* value, const TCHAR* name, TCHAR* location, int maxsz)
+int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
{
if (_tcscmp(option, name) != 0)
return 0;
-
_tcsncpy(location, value, maxsz - 1);
location[maxsz - 1] = '\0';
return 1;
}
-int cfgfile_string(const TCHAR* option, const TCHAR* value, const TCHAR* name, const TCHAR* nameext, TCHAR* location, int maxsz)
+int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, TCHAR *location, int maxsz)
{
- if (nameext)
- {
+ if (nameext) {
TCHAR tmp[MAX_DPATH];
_tcscpy(tmp, name);
_tcscat(tmp, nameext);
if (_tcscmp(tmp, option) != 0)
return 0;
}
- else
- {
+ else {
if (_tcscmp(option, name) != 0)
return 0;
}
-
_tcsncpy(location, value, maxsz - 1);
location[maxsz - 1] = '\0';
return 1;
}
-static int cfgfile_path(const TCHAR* option, const TCHAR* value, const TCHAR* name, TCHAR* location, int maxsz)
+int cfgfile_path(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz, struct multipath *mp)
{
if (!cfgfile_string(option, value, name, location, maxsz))
return 0;
@@ -1310,21 +1614,55 @@ static int cfgfile_path(const TCHAR* option, const TCHAR* value, const TCHAR* na
TCHAR* s = target_expand_environment(location);
_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_rom(const TCHAR* option, const TCHAR* value, const TCHAR* name, TCHAR* location, int maxsz)
+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;
+}
+
+int cfgfile_rom(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
{
TCHAR id[MAX_DPATH];
-
if (!cfgfile_string(option, value, name, id, sizeof id / sizeof(TCHAR)))
return 0;
-
- TCHAR* p = _tcschr(id, ',');
-
- if (p)
- {
+ TCHAR *p = _tcschr(id, ',');
+ if (p) {
TCHAR *endptr, tmp;
*p = 0;
tmp = id[4];
@@ -1332,35 +1670,31 @@ int cfgfile_rom(const TCHAR* option, const TCHAR* value, const TCHAR* name, TCHA
uae_u32 crc32 = _tcstol(id, &endptr, 16) << 16;
id[4] = tmp;
crc32 |= _tcstol(id + 4, &endptr, 16);
- struct romdata* rd = getromdatabycrc(crc32, true);
- if (rd)
- {
- struct romdata* rd2 = getromdatabyid(rd->id);
- if (rd->group == 0 && rd2 == rd)
- {
+ struct romdata *rd = getromdatabycrc(crc32, true);
+ if (rd) {
+ struct romdata *rd2 = getromdatabyid(rd->id);
+ if (rd->group == 0 && rd2 == rd) {
if (zfile_exists(location))
return 1;
}
if (rd->group && rd2)
rd = rd2;
- struct romlist* rl = getromlistbyromdata(rd);
- if (rl)
- {
+ struct romlist *rl = getromlistbyromdata(rd);
+ if (rl) {
write_log(_T("%s: %s -> %s\n"), name, location, rl->path);
_tcsncpy(location, rl->path, maxsz);
}
}
}
-
return 1;
}
-static int getintval(TCHAR** p, int* result, int delim)
+static int getintval(TCHAR **p, int *result, int delim)
{
- TCHAR* value = *p;
+ TCHAR *value = *p;
int base = 10;
- TCHAR* endptr;
- TCHAR* p2 = _tcschr(*p, delim);
+ TCHAR *endptr;
+ TCHAR *p2 = _tcschr(*p, delim);
if (p2 == 0)
return 0;
@@ -1368,8 +1702,7 @@ static int getintval(TCHAR** p, int* result, int delim)
*p2++ = '\0';
if (value[0] == '0' && _totupper(value[1]) == 'X')
- value += 2 , base = 16;
-
+ value += 2, base = 16;
*result = _tcstol(value, &endptr, base);
*p = p2;
@@ -1379,34 +1712,29 @@ 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)
{
- TCHAR* value = *p;
+ TCHAR *value = *p;
int base = 10;
- TCHAR* endptr;
- TCHAR* p2 = _tcschr(*p, delim);
+ TCHAR *endptr;
+ TCHAR *p2 = _tcschr(*p, delim);
- if (p2 == 0)
- {
+ if (p2 == 0) {
p2 = _tcschr(*p, 0);
- if (p2 == 0)
- {
+ if (p2 == 0) {
*p = 0;
return 0;
}
}
-
if (*p2 != 0)
*p2++ = '\0';
if (value[0] == '0' && _totupper(value[1]) == 'X')
- value += 2 , base = 16;
-
+ value += 2, base = 16;
*result = _tcstol(value, &endptr, base);
*p = p2;
- if (*endptr != '\0' || *value == '\0')
- {
+ if (*endptr != '\0' || *value == '\0') {
*p = 0;
return 0;
}
@@ -1414,25 +1742,24 @@ static int getintval2(TCHAR** p, int* result, int delim)
return 1;
}
-static void set_chipset_mask(struct uae_prefs* p, int val)
+static void set_chipset_mask(struct uae_prefs *p, int val)
{
p->chipset_mask = (val == 0 ? 0
- : val == 1 ? CSMASK_ECS_AGNUS
- : val == 2 ? CSMASK_ECS_DENISE
- : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS
- : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS);
+ : val == 1 ? CSMASK_ECS_AGNUS
+ : val == 2 ? CSMASK_ECS_DENISE
+ : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS
+ : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS);
}
-static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
+static int cfgfile_parse_host(struct uae_prefs *p, TCHAR *option, TCHAR *value)
{
int i, v;
bool vb;
- TCHAR* section = 0;
- TCHAR* tmpp;
+ TCHAR *section = 0;
+ TCHAR *tmpp;
TCHAR tmpbuf[CONFIG_BLEN];
- if (_tcsncmp(option, _T("input."), 6) == 0)
- {
+ if (_tcsncmp(option, _T("input."), 6) == 0) {
read_inputdevice_config(p, option, value);
return 1;
}
@@ -1440,62 +1767,54 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
for (tmpp = option; *tmpp != '\0'; tmpp++)
if (_istupper(*tmpp))
*tmpp = _totlower(*tmpp);
-
tmpp = _tcschr(option, '.');
- if (tmpp)
- {
+ if (tmpp) {
section = option;
option = tmpp + 1;
*tmpp = '\0';
- if (_tcscmp(section, TARGET_NAME) == 0)
- {
+ if (_tcscmp(section, TARGET_NAME) == 0) {
/* We special case the various path options here. */
- 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)))
+ 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))
return 1;
return target_parse_option(p, option, value);
}
return 0;
}
- for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++)
- {
+ 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);
-
- if (!_tcsicmp(option, tmp))
- {
- if (!_tcsicmp(value, _T("autodetect")))
- {
+ if (!_tcsicmp(option, tmp)) {
+ if (!_tcsicmp(value, _T("autodetect"))) {
p->cdslots[i].type = SCSI_UNIT_DEFAULT;
p->cdslots[i].inuse = true;
p->cdslots[i].name[0] = 0;
}
- else
- {
+ else {
p->cdslots[i].delayed = false;
- TCHAR* next = _tcsrchr(value, ',');
+ TCHAR *next = _tcsrchr(value, ',');
int type = SCSI_UNIT_DEFAULT;
int mode = 0;
int unitnum = 0;
-
- for (;;)
- {
+ for (;;) {
if (!next)
break;
-
*next++ = 0;
- TCHAR* next2 = _tcschr(next, ':');
-
+ TCHAR *next2 = _tcschr(next, ':');
if (next2)
*next2++ = 0;
-
int tmpval = 0;
-
- if (!_tcsicmp(next, _T("delay")))
- {
+ if (!_tcsicmp(next, _T("delay"))) {
p->cdslots[i].delayed = true;
next = next2;
if (!next)
@@ -1504,48 +1823,33 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
if (next2)
*next2++ = 0;
}
-
type = match_string(cdmodes, next);
-
if (type < 0)
type = SCSI_UNIT_DEFAULT;
else
type--;
-
next = next2;
-
if (!next)
break;
next2 = _tcschr(next, ':');
-
if (next2)
*next2++ = 0;
-
mode = match_string(cdconmodes, next);
-
if (mode < 0)
mode = 0;
-
next = next2;
-
if (!next)
break;
-
next2 = _tcschr(next, ':');
-
if (next2)
*next2++ = 0;
-
cfgfile_intval(option, next, tmp, &unitnum, 1);
}
-
- if (_tcslen(value) > 0)
- {
- TCHAR* s = cfgfile_subst_path(UNEXPANDED, p->path_cd, value);
+ if (_tcslen(value) > 0) {
+ TCHAR *s = cfgfile_get_multipath(&p->path_cd, NULL, value, false);
_tcsncpy(p->cdslots[i].name, s, sizeof p->cdslots[i].name / sizeof(TCHAR));
xfree(s);
}
-
p->cdslots[i].name[sizeof p->cdslots[i].name - 1] = 0;
p->cdslots[i].inuse = true;
p->cdslots[i].type = type;
@@ -1553,45 +1857,122 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
// disable all following units
i++;
-
- while (i < MAX_TOTAL_SCSI_DEVICES)
- {
+ while (i < MAX_TOTAL_SCSI_DEVICES) {
p->cdslots[i].type = SCSI_UNIT_DISABLED;
i++;
}
-
return 1;
}
}
+ 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_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))
return 1;
-#ifdef RASPBERRY
- if (cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1))
- return 1;
- if (cfgfile_intval(option, value, "kbd_led_num", &p->kbd_led_num, 1))
- return 1;
- if (cfgfile_intval(option, value, "kbd_led_scr", &p->kbd_led_scr, 1))
- return 1;
- if (cfgfile_intval(option, value, "scaling_method", &p->scaling_method, 1))
- return 1;
-#endif
-
- if (cfgfile_string(option, value, _T("config_info"), p->info, sizeof p->info / sizeof(TCHAR))
+ 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))
|| cfgfile_string(option, value, _T("config_description"), p->description, sizeof p->description / sizeof(TCHAR)))
return 1;
- if (cfgfile_yesno(option, value, _T("floppy0wp"), &p->floppyslots[0].forcedwriteprotect)
+ if (cfgfile_yesno(option, value, _T("use_debugger"), &p->start_debugger)
+ || 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;
@@ -1605,127 +1986,249 @@ 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 (cfgfile_intval(option, value, "key_for_menu", &p->key_for_menu, 1))
- return 1;
-
- if (cfgfile_intval(option, value, "key_for_quit", &p->key_for_quit, 1))
- return 1;
-
- if (cfgfile_intval(option, value, "button_for_menu", &p->button_for_menu, 1))
- return 1;
-
- if (cfgfile_intval(option, value, "button_for_quit", &p->button_for_quit, 1))
- return 1;
-
- if (_tcscmp(option, _T("gfx_width_windowed")) == 0)
- {
- if (!_tcscmp(value, _T("native")))
- {
+ 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
- {
+ 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")))
- {
+ 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
- {
+ 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")))
- {
+ 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
- {
+ 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")))
- {
+ 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
- {
+ 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_yesno(option, value, _T("show_leds"), &vb))
- {
- p->leds_on_screen = vb;
+ 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_width")) == 0 || _tcscmp(option, _T("gfx_height")) == 0)
- {
- cfgfile_intval(option, value, _T("gfx_width"), &p->gfx_size.width, 1);
- cfgfile_intval(option, value, _T("gfx_height"), &p->gfx_size.height, 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;
+ return cfgfile_yesno(option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync);
+ }
+ if (_tcscmp(option, _T("gfx_vsync_picasso")) == 0) {
+ if (cfgfile_strval(option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync, vsyncmodes, 0) >= 0)
+ 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)
+ p->leds_on_screen |= STATUSLINE_CHIPSET;
+ else
+ p->leds_on_screen &= ~STATUSLINE_CHIPSET;
+ return 1;
+ }
+ if (cfgfile_yesno(option, value, _T("show_leds_rtg"), &vb)) {
+ if (vb)
+ p->leds_on_screen |= STATUSLINE_RTG;
+ else
+ 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("joyportfriendlyname0")) == 0 || _tcscmp(option, _T("joyportfriendlyname1")) == 0)
- {
+ 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;
+ }
+ 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);
return 1;
}
-
- if (_tcscmp(option, _T("joyportfriendlyname2")) == 0 || _tcscmp(option, _T("joyportfriendlyname3")) == 0)
- {
+ 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);
return 1;
}
-
- if (_tcscmp(option, _T("joyportname0")) == 0 || _tcscmp(option, _T("joyportname1")) == 0)
- {
+ 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);
return 1;
}
-
- if (_tcscmp(option, _T("joyportname2")) == 0 || _tcscmp(option, _T("joyportname3")) == 0)
- {
+ 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);
return 1;
}
-
- if (_tcscmp(option, _T("joyport0")) == 0 || _tcscmp(option, _T("joyport1")) == 0)
- {
+ 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);
return 1;
}
-
- if (_tcscmp(option, _T("joyport2")) == 0 || _tcscmp(option, _T("joyport3")) == 0)
- {
+ 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);
return 1;
}
-
if (cfgfile_strval(option, value, _T("joyport0mode"), &p->jports[0].mode, joyportmodes, 0))
return 1;
if (cfgfile_strval(option, value, _T("joyport1mode"), &p->jports[1].mode, joyportmodes, 0))
@@ -1742,46 +2245,46 @@ 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))
- {
+ if (cfgfile_yesno(option, value, _T("joyport0keyboardoverride"), &vb)) {
p->jports[0].nokeyboardoverride = !vb;
return 1;
}
- if (cfgfile_yesno(option, value, _T("joyport1keyboardoverride"), &vb))
- {
+ if (cfgfile_yesno(option, value, _T("joyport1keyboardoverride"), &vb)) {
p->jports[1].nokeyboardoverride = !vb;
return 1;
}
- if (cfgfile_yesno(option, value, _T("joyport2keyboardoverride"), &vb))
- {
+ if (cfgfile_yesno(option, value, _T("joyport2keyboardoverride"), &vb)) {
p->jports[2].nokeyboardoverride = !vb;
return 1;
}
- if (cfgfile_yesno(option, value, _T("joyport3keyboardoverride"), &vb))
- {
+ if (cfgfile_yesno(option, value, _T("joyport3keyboardoverride"), &vb)) {
p->jports[3].nokeyboardoverride = !vb;
return 1;
}
- if (cfgfile_string(option, value, _T("statefile"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR)))
- {
+ 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))
- {
+ if (zfile_exists(savestate_fname)) {
savestate_state = STATE_DORESTORE;
}
- else
- {
+ else {
int ok = 0;
-
- if (savestate_fname[0])
- {
- for (;;)
- {
- TCHAR* p;
- if (my_existsdir(savestate_fname))
- {
+ if (savestate_fname[0]) {
+ for (;;) {
+ TCHAR *p;
+ if (my_existsdir(savestate_fname)) {
ok = 1;
break;
}
@@ -1793,19 +2296,24 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
*p = 0;
}
}
-
- if (!ok)
- {
- savestate_fname[0] = 0;
+ 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;
}
- if (cfgfile_strval(option, value, _T("sound_channels"), &p->sound_stereo, stereomode, 1))
- {
- if (p->sound_stereo == SND_NONE)
- { /* "mixed stereo" compatibility hack */
+ if (cfgfile_strval(option, value, _T("sound_channels"), &p->sound_stereo, stereomode, 1)) {
+ if (p->sound_stereo == SND_NONE) { /* "mixed stereo" compatibility hack */
p->sound_stereo = SND_STEREO;
p->sound_mixed_stereo_delay = 5;
p->sound_stereo_separation = 7;
@@ -1813,21 +2321,165 @@ static int cfgfile_parse_host(struct uae_prefs* p, TCHAR* option, TCHAR* value)
return 1;
}
- if (cfgfile_string(option, value, _T("config_version"), tmpbuf, sizeof (tmpbuf) / sizeof (TCHAR)))
- {
- TCHAR* tmpp2;
- tmpp = _tcschr (value, '.');
- if (tmpp)
- {
+#ifdef AMIBERRY
+ if (cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1))
+ return 1;
+ if (cfgfile_intval(option, value, "kbd_led_num", &p->kbd_led_num, 1))
+ return 1;
+ if (cfgfile_intval(option, value, "kbd_led_scr", &p->kbd_led_scr, 1))
+ return 1;
+ if (cfgfile_intval(option, value, "scaling_method", &p->scaling_method, 1))
+ return 1;
+ if (cfgfile_intval(option, value, "key_for_menu", &p->key_for_menu, 1))
+ return 1;
+ if (cfgfile_intval(option, value, "key_for_quit", &p->key_for_quit, 1))
+ return 1;
+ if (cfgfile_intval(option, value, "button_for_menu", &p->button_for_menu, 1))
+ return 1;
+ if (cfgfile_intval(option, value, "button_for_quit", &p->button_for_quit, 1))
+ return 1;
+#endif
+
+
+ if (cfgfile_string(option, value, _T("config_version"), tmpbuf, sizeof(tmpbuf) / sizeof(TCHAR))) {
+ TCHAR *tmpp2;
+ tmpp = _tcschr(value, '.');
+ if (tmpp) {
*tmpp++ = 0;
tmpp2 = tmpp;
- p->config_version = _tstol (tmpbuf) << 16;
- tmpp = _tcschr (tmpp, '.');
- if (tmpp)
- {
+ p->config_version = _tstol(tmpbuf) << 16;
+ tmpp = _tcschr(tmpp, '.');
+ if (tmpp) {
*tmpp++ = 0;
- p->config_version |= _tstol (tmpp2) << 8;
- p->config_version |= _tstol (tmpp);
+ p->config_version |= _tstol(tmpp2) << 8;
+ p->config_version |= _tstol(tmpp);
+ }
+ }
+ 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 };
+ 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;
+ else
+ equals++;
+ *next = 0;
+
+ if (rate < 0)
+ rate = _tstof(tmpp);
+ else if (!_tcsnicmp(tmpp, _T("v="), 2))
+ vert = _tstol(equals);
+ else if (!_tcsnicmp(tmpp, _T("h="), 2))
+ 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("nvsync"), 5))
+ vsync = 0;
+ if (!_tcsnicmp(tmpp, _T("vsync"), 4))
+ vsync = 1;
+ if (!_tcsnicmp(tmpp, _T("ntsc"), 4))
+ 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;
+ 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;
+ }
}
}
return 1;
@@ -1836,6 +2488,76 @@ 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)
@@ -1843,53 +2565,44 @@ static struct uaedev_config_data* getuci(struct uae_prefs* p)
return NULL;
}
-struct uaedev_config_data* add_filesys_config(struct uae_prefs* p, int index, struct uaedev_config_info* ci)
+struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, struct uaedev_config_info *ci)
{
- struct uaedev_config_data* uci;
+ struct uaedev_config_data *uci;
int i;
- 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 (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;
}
}
-
- if (ci->type == UAEDEV_CD)
- {
+ if (ci->type == UAEDEV_CD) {
if (ci->controller > HD_CONTROLLER_SCSI6 || ci->controller < HD_CONTROLLER_IDE0)
return NULL;
}
-
- if (index < 0)
- {
- if (ci->controller != HD_CONTROLLER_UAE)
- {
+ if (ci->type == UAEDEV_TAPE) {
+ if (ci->controller != HD_CONTROLLER_UAE && (ci->controller > HD_CONTROLLER_SCSI6 || ci->controller < HD_CONTROLLER_IDE0))
+ return NULL;
+ }
+ if (index < 0) {
+ if (ci->controller != HD_CONTROLLER_UAE) {
int ctrl = ci->controller;
- for (;;)
- {
- for (i = 0; i < p->mountitems; i++)
- {
- if (p->mountconfig[i].ci.controller == ctrl)
- {
+ for (;;) {
+ for (i = 0; i < p->mountitems; i++) {
+ if (p->mountconfig[i].ci.controller == ctrl) {
ctrl++;
if (ctrl == HD_CONTROLLER_IDE3 + 1 || ctrl == HD_CONTROLLER_SCSI6 + 1)
return NULL;
}
}
- if (i == p->mountitems)
- {
+ if (i == p->mountitems) {
ci->controller = ctrl;
break;
}
}
}
- if (ci->type == UAEDEV_CD)
- {
- for (i = 0; i < p->mountitems; i++)
- {
+ if (ci->type == UAEDEV_CD) {
+ for (i = 0; i < p->mountitems; i++) {
if (p->mountconfig[i].ci.type == ci->type)
return NULL;
}
@@ -1898,166 +2611,140 @@ struct uaedev_config_data* add_filesys_config(struct uae_prefs* p, int index, st
uci->configoffset = -1;
uci->unitnum = -1;
}
- else
- {
+ else {
uci = &p->mountconfig[index];
}
-
if (!uci)
return NULL;
- memcpy(&uci->ci, ci, sizeof (struct uaedev_config_info));
+ memcpy(&uci->ci, ci, sizeof(struct uaedev_config_info));
validatedevicename(uci->ci.devname);
validatevolumename(uci->ci.volname);
-
- if (!uci->ci.devname[0] && ci->type != UAEDEV_CD && ci->type != UAEDEV_TAPE)
- {
+ if (!uci->ci.devname[0] && ci->type != UAEDEV_CD && ci->type != UAEDEV_TAPE) {
TCHAR base[32];
TCHAR base2[32];
int num = 0;
-
if (uci->ci.rootdir[0] == 0 && ci->type == UAEDEV_DIR)
- _tcscpy(base, _T("RDH"));
+ _tcscpy(base, _T("RDH"));
else
- _tcscpy(base, _T("DH"));
-
+ _tcscpy(base, _T("DH"));
_tcscpy(base2, base);
-
- for (i = 0; i < p->mountitems; i++)
- {
+ for (i = 0; i < p->mountitems; i++) {
_stprintf(base2, _T("%s%d"), base, num);
-
- if (!_tcsicmp(base2, p->mountconfig[i].ci.devname))
- {
+ if (!_tcsicmp(base2, p->mountconfig[i].ci.devname)) {
num++;
i = -1;
continue;
}
}
-
_tcscpy(uci->ci.devname, base2);
validatedevicename(uci->ci.devname);
}
-
- if (ci->type == UAEDEV_DIR)
- {
- TCHAR* s = filesys_createvolname(uci->ci.volname, uci->ci.rootdir, _T("Harddrive"));
+ if (ci->type == UAEDEV_DIR) {
+ TCHAR *s = filesys_createvolname(uci->ci.volname, uci->ci.rootdir, _T("Harddrive"));
_tcscpy(uci->ci.volname, s);
xfree(s);
}
-
return uci;
}
-static int get_filesys_controller(const TCHAR* hdc)
+static void parse_addmem(struct uae_prefs *p, TCHAR *buf, int num)
+{
+ int size = 0, addr = 0;
+
+ if (!getintval2(&buf, &addr, ','))
+ return;
+ if (!getintval2(&buf, &size, 0))
+ return;
+ if (addr & 0xffff)
+ return;
+ if ((size & 0xffff) || (size & 0xffff0000) == 0)
+ return;
+ p->custom_memory_addrs[num] = addr;
+ p->custom_memory_sizes[num] = size;
+}
+
+static int get_filesys_controller(const TCHAR *hdc)
{
int hdcv = HD_CONTROLLER_UAE;
-
- if (_tcslen(hdc) >= 4 && !_tcsncmp(hdc, _T("ide"), 3))
- {
+ if (_tcslen(hdc) >= 4 && !_tcsncmp(hdc, _T("ide"), 3)) {
hdcv = hdc[3] - '0' + HD_CONTROLLER_IDE0;
if (hdcv < HD_CONTROLLER_IDE0 || hdcv > HD_CONTROLLER_IDE3)
hdcv = 0;
}
-
- if (_tcslen(hdc) >= 5 && !_tcsncmp(hdc, _T("scsi"), 4))
- {
+ if (_tcslen(hdc) >= 5 && !_tcsncmp(hdc, _T("scsi"), 4)) {
hdcv = hdc[4] - '0' + HD_CONTROLLER_SCSI0;
if (hdcv < HD_CONTROLLER_SCSI0 || hdcv > HD_CONTROLLER_SCSI6)
hdcv = 0;
}
-
- if (_tcslen (hdc) >= 6 && !_tcsncmp (hdc, _T("scsram"), 6))
+ if (_tcslen(hdc) >= 6 && !_tcsncmp(hdc, _T("scsram"), 6))
hdcv = HD_CONTROLLER_PCMCIA_SRAM;
-
- if (_tcslen (hdc) >= 5 && !_tcsncmp (hdc, _T("scide"), 6))
+ if (_tcslen(hdc) >= 5 && !_tcsncmp(hdc, _T("scide"), 6))
hdcv = HD_CONTROLLER_PCMCIA_IDE;
-
return hdcv;
}
-static bool parse_geo(const TCHAR* tname, struct uaedev_config_info* uci, struct hardfiledata* hfd, bool empty)
+static bool parse_geo(const TCHAR *tname, struct uaedev_config_info *uci, struct hardfiledata *hfd, bool empty)
{
- struct zfile* f;
+ struct zfile *f;
int found;
TCHAR buf[200];
- f = zfile_fopen(tname, _T("r"));
+ f = zfile_fopen(tname, _T("r"));
if (!f)
return false;
-
found = hfd == NULL && !empty ? 2 : 0;
-
if (found)
- write_log(_T("Geometry file '%s' detected\n"), tname);
-
- while (zfile_fgets(buf, sizeof buf / sizeof(TCHAR), f))
- {
+ 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);
+ TCHAR *sep;
+ my_trim(buf);
if (_tcslen(buf) == 0)
continue;
-
- if (buf[0] == '[' && buf[_tcslen(buf) - 1] == ']')
- {
- if (found > 1)
- {
+ if (buf[0] == '[' && buf[_tcslen(buf) - 1] == ']') {
+ if (found > 1) {
zfile_fclose(f);
return true;
}
-
found = 0;
buf[_tcslen(buf) - 1] = 0;
my_trim(buf + 1);
-
- if (!_tcsicmp(buf + 1, _T("empty")))
- {
+ if (!_tcsicmp(buf + 1, _T("empty"))) {
if (empty)
found = 1;
}
- else if (!_tcsicmp(buf + 1, _T("default")))
- {
+ else if (!_tcsicmp(buf + 1, _T("default"))) {
if (!empty)
found = 1;
}
- else if (hfd)
- {
+ else if (hfd) {
uae_u64 size = _tstoi64(buf + 1);
if (size == hfd->virtsize)
found = 2;
}
-
if (found)
- write_log(_T("Geometry file '%s', entry '%s' detected\n"), tname, buf + 1);
-
+ write_log(_T("Geometry file '%s', entry '%s' detected\n"), tname, buf + 1);
continue;
}
-
if (!found)
continue;
sep = _tcschr(buf, '=');
-
if (!sep)
continue;
-
sep[0] = 0;
- TCHAR* key = my_strdup_trim(buf);
- TCHAR* val = my_strdup_trim(sep + 1);
-
- if (val[0] == '0' && _totupper(val[1]) == 'X')
- {
- TCHAR* endptr;
+ TCHAR *key = my_strdup_trim(buf);
+ TCHAR *val = my_strdup_trim(sep + 1);
+ if (val[0] == '0' && _totupper(val[1]) == 'X') {
+ TCHAR *endptr;
v = _tcstol(val, &endptr, 16);
}
- else
- {
+ else {
v = _tstol(val);
}
-
if (!_tcsicmp(key, _T("surfaces")))
uci->surfaces = v;
if (!_tcsicmp(key, _T("sectorspertrack")) || !_tcsicmp(key, _T("blockspertrack")))
@@ -2096,8 +2783,7 @@ static bool parse_geo(const TCHAR* tname, struct uaedev_config_info* uci, struct
uci->priority = v;
if (!_tcsicmp(key, _T("forceload")))
uci->forceload = v;
- if (!_tcsicmp(key, _T("bootpri")))
- {
+ if (!_tcsicmp(key, _T("bootpri"))) {
if (v < -129)
v = -129;
if (v > 127)
@@ -2105,10 +2791,9 @@ static bool parse_geo(const TCHAR* tname, struct uaedev_config_info* uci, struct
uci->bootpri = v;
}
if (!_tcsicmp(key, _T("filesystem")))
- _tcscpy(uci->filesys, val);
+ _tcscpy(uci->filesys, val);
if (!_tcsicmp(key, _T("device")))
- _tcscpy(uci->devname, val);
-
+ _tcscpy(uci->devname, val);
xfree(val);
xfree(key);
}
@@ -2117,106 +2802,84 @@ static bool parse_geo(const TCHAR* tname, struct uaedev_config_info* uci, struct
return false;
}
-bool get_hd_geometry(struct uaedev_config_info* uci)
+bool get_hd_geometry(struct uaedev_config_info *uci)
{
TCHAR tname[MAX_DPATH];
fetch_configurationpath(tname, sizeof tname / sizeof(TCHAR));
_tcscat(tname, _T("default.geo"));
-
- if (zfile_exists(tname))
- {
+ if (zfile_exists(tname)) {
struct hardfiledata hfd;
memset(&hfd, 0, sizeof hfd);
hfd.ci.readonly = true;
hfd.ci.blocksize = 512;
-
- if (hdf_open(&hfd, uci->rootdir))
- {
+ if (hdf_open(&hfd, uci->rootdir)) {
parse_geo(tname, uci, &hfd, false);
hdf_close(&hfd);
}
- else
- {
+ else {
parse_geo(tname, uci, NULL, true);
}
}
-
- if (uci->rootdir[0])
- {
+ if (uci->rootdir[0]) {
_tcscpy(tname, uci->rootdir);
_tcscat(tname, _T(".geo"));
return parse_geo(tname, uci, NULL, false);
}
-
return false;
}
-static int cfgfile_parse_partial_newfilesys(struct uae_prefs* p, int nr, int type, const TCHAR* value, int unit, bool uaehfentry)
+static int cfgfile_parse_partial_newfilesys(struct uae_prefs *p, int nr, int type, const TCHAR *value, int unit, bool uaehfentry)
{
- TCHAR* tmpp;
+ TCHAR *tmpp;
TCHAR *name = NULL, *path = NULL;
// read only harddrive name
if (!uaehfentry)
return 0;
-
if (type != 1)
return 0;
-
tmpp = getnextentry(&value, ',');
-
if (!tmpp)
return 0;
-
xfree(tmpp);
tmpp = getnextentry(&value, ':');
-
if (!tmpp)
return 0;
-
xfree(tmpp);
name = getnextentry(&value, ':');
-
- if (name && _tcslen(name) > 0)
- {
+ if (name && _tcslen(name) > 0) {
path = getnextentry(&value, ',');
- if (path && _tcslen(path) > 0)
- {
- for (int i = 0; i < MAX_FILESYSTEM_UNITS; i++)
- {
- struct uaedev_config_info* uci = &p->mountconfig[i].ci;
- if (_tcsicmp(uci->rootdir, name) == 0)
- {
+ if (path && _tcslen(path) > 0) {
+ for (int i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+ struct uaedev_config_info *uci = &p->mountconfig[i].ci;
+ if (_tcsicmp(uci->rootdir, name) == 0) {
_tcscat(uci->rootdir, _T(":"));
_tcscat(uci->rootdir, path);
}
}
}
}
-
xfree(path);
xfree(name);
return 1;
}
-static int cfgfile_parse_newfilesys(struct uae_prefs* p, int nr, int type, TCHAR* value, int unit, bool uaehfentry)
+static int cfgfile_parse_newfilesys(struct uae_prefs *p, int nr, int type, TCHAR *value, int unit, bool uaehfentry)
{
struct uaedev_config_info uci;
TCHAR *tmpp = _tcschr(value, ','), *tmpp2;
- TCHAR* str = NULL;
+ TCHAR *str = NULL;
TCHAR devname[MAX_DPATH], volname[MAX_DPATH];
devname[0] = volname[0] = 0;
uci_set_defaults(&uci, false);
config_newfilesystem = 1;
-
if (tmpp == 0)
goto invalid_fs;
*tmpp++ = '\0';
-
if (strcasecmp(value, _T("ro")) == 0)
uci.readonly = true;
else if (strcasecmp(value, _T("rw")) == 0)
@@ -2225,84 +2888,62 @@ static int cfgfile_parse_newfilesys(struct uae_prefs* p, int nr, int type, TCHAR
goto invalid_fs;
value = tmpp;
-
- if (type == 0)
- {
+ if (type == 0) {
uci.type = UAEDEV_DIR;
tmpp = _tcschr(value, ':');
-
if (tmpp == 0)
goto empty_fs;
-
*tmpp++ = 0;
_tcscpy(devname, value);
tmpp2 = tmpp;
tmpp = _tcschr(tmpp, ':');
-
if (tmpp == 0)
goto empty_fs;
-
*tmpp++ = 0;
_tcscpy(volname, tmpp2);
tmpp2 = tmpp;
tmpp = _tcschr(tmpp, ',');
-
if (tmpp == 0)
goto empty_fs;
-
*tmpp++ = 0;
_tcscpy(uci.rootdir, tmpp2);
_tcscpy(uci.volname, volname);
_tcscpy(uci.devname, devname);
-
if (!getintval(&tmpp, &uci.bootpri, 0))
goto empty_fs;
}
- else if (type == 1 || ((type == 2 || type == 3) && uaehfentry))
- {
- tmpp = _tcschr (value, ':');
-
+ else if (type == 1 || ((type == 2 || type == 3) && uaehfentry)) {
+ tmpp = _tcschr(value, ':');
if (tmpp == 0)
goto invalid_fs;
-
*tmpp++ = '\0';
- _tcscpy (devname, value);
+ _tcscpy(devname, value);
tmpp2 = tmpp;
- tmpp = _tcschr (tmpp, ',');
-
+ tmpp = _tcschr(tmpp, ',');
if (tmpp == 0)
goto invalid_fs;
-
*tmpp++ = 0;
- _tcscpy (uci.rootdir, tmpp2);
-
+ _tcscpy(uci.rootdir, tmpp2);
if (uci.rootdir[0] != ':')
get_hd_geometry(&uci);
-
- _tcscpy (uci.devname, devname);
-
- if (! getintval(&tmpp, &uci.sectors, ',')
- || ! getintval(&tmpp, &uci.surfaces, ',')
- || ! getintval(&tmpp, &uci.reserved, ',')
- || ! getintval(&tmpp, &uci.blocksize, ','))
+ _tcscpy(uci.devname, devname);
+ if (!getintval(&tmpp, &uci.sectors, ',')
+ || !getintval(&tmpp, &uci.surfaces, ',')
+ || !getintval(&tmpp, &uci.reserved, ',')
+ || !getintval(&tmpp, &uci.blocksize, ','))
goto invalid_fs;
-
- if (getintval2(&tmpp, &uci.bootpri, ','))
- {
+ if (getintval2(&tmpp, &uci.bootpri, ',')) {
tmpp2 = tmpp;
- tmpp = _tcschr (tmpp, ',');
- if (tmpp != 0)
- {
+ tmpp = _tcschr(tmpp, ',');
+ if (tmpp != 0) {
*tmpp++ = 0;
- _tcscpy (uci.filesys, tmpp2);
- TCHAR* tmpp2 = _tcschr (tmpp, ',');
+ _tcscpy(uci.filesys, tmpp2);
+ TCHAR *tmpp2 = _tcschr(tmpp, ',');
if (tmpp2)
*tmpp2++ = 0;
uci.controller = get_filesys_controller(tmpp);
- if (tmpp2)
- {
- if (getintval2(&tmpp2, &uci.highcyl, ','))
- {
+ if (tmpp2) {
+ if (getintval2(&tmpp2, &uci.highcyl, ',')) {
getintval(&tmpp2, &uci.pcyls, '/');
getintval(&tmpp2, &uci.pheads, '/');
getintval2(&tmpp2, &uci.psecs, '/');
@@ -2310,153 +2951,125 @@ static int cfgfile_parse_newfilesys(struct uae_prefs* p, int nr, int type, TCHAR
}
}
}
-
- if (type == 2)
- {
+ if (type == 2) {
uci.device_emu_unit = unit;
uci.blocksize = 2048;
uci.readonly = true;
uci.type = UAEDEV_CD;
}
- else
- {
+ else if (type == 3) {
+ uci.device_emu_unit = unit;
+ uci.blocksize = 512;
+ uci.type = UAEDEV_TAPE;
+ }
+ else {
uci.type = UAEDEV_HDF;
}
}
- else
- {
+ else {
goto invalid_fs;
}
-
empty_fs:
- if (uci.rootdir[0])
- {
- if (_tcslen(uci.rootdir) > 3 && uci.rootdir[0] == 'H' && uci.rootdir[1] == 'D' && uci.rootdir[2] == '_')
- {
+ if (uci.rootdir[0]) {
+ if (_tcslen(uci.rootdir) > 3 && uci.rootdir[0] == 'H' && uci.rootdir[1] == 'D' && uci.rootdir[2] == '_') {
memmove(uci.rootdir, uci.rootdir + 2, (_tcslen(uci.rootdir + 2) + 1) * sizeof(TCHAR));
uci.rootdir[0] = ':';
}
- str = cfgfile_subst_path(UNEXPANDED, p->path_hardfile, uci.rootdir);
+ str = cfgfile_subst_path_load(UNEXPANDED, &p->path_hardfile, uci.rootdir, false);
_tcscpy(uci.rootdir, str);
}
-
#ifdef FILESYS
add_filesys_config(p, nr, &uci);
#endif
-
xfree(str);
return 1;
invalid_fs:
- write_log (_T("Invalid filesystem/hardfile/cd specification.\n"));
+ write_log(_T("Invalid filesystem/hardfile/cd specification.\n"));
return 1;
}
-static int cfgfile_parse_filesys(struct uae_prefs* p, const TCHAR* option, TCHAR* value)
+static int cfgfile_parse_filesys(struct uae_prefs *p, const TCHAR *option, TCHAR *value)
{
int i;
- for (i = 0; i < MAX_FILESYSTEM_UNITS; i++)
- {
+ for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
TCHAR tmp[100];
_stprintf(tmp, _T("uaehf%d"), i);
-
- if (_tcscmp(option, tmp) == 0)
- {
- for (;;)
- {
- int type = -1;
+ if (_tcscmp(option, tmp) == 0) {
+ for (;;) {
+ int type = -1;
int unit = -1;
- TCHAR* tmpp = _tcschr(value, ',');
-
+ TCHAR *tmpp = _tcschr(value, ',');
if (tmpp == NULL)
return 1;
-
*tmpp++ = 0;
-
- if (_tcsicmp(value, _T("hdf")) == 0)
- {
+ if (_tcsicmp(value, _T("hdf")) == 0) {
type = 1;
cfgfile_parse_partial_newfilesys(p, -1, type, tmpp, unit, true);
return 1;
}
- else if (_tcsnicmp(value, _T("cd"), 2) == 0 && (value[2] == 0 || value[3] == 0))
- {
+ else if (_tcsnicmp(value, _T("cd"), 2) == 0 && (value[2] == 0 || value[3] == 0)) {
unit = 0;
if (value[2] > 0)
unit = value[2] - '0';
- if (unit >= 0 && unit <= MAX_TOTAL_SCSI_DEVICES)
- {
+ if (unit >= 0 && unit <= MAX_TOTAL_SCSI_DEVICES) {
type = 2;
}
}
- else if (_tcsnicmp(value, _T("tape"), 4) == 0 && (value[4] == 0 || value[5] == 0))
- {
+ else if (_tcsnicmp(value, _T("tape"), 4) == 0 && (value[4] == 0 || value[5] == 0)) {
unit = 0;
if (value[4] > 0)
unit = value[4] - '0';
- if (unit >= 0 && unit <= MAX_TOTAL_SCSI_DEVICES)
- {
+ if (unit >= 0 && unit <= MAX_TOTAL_SCSI_DEVICES) {
type = 3;
}
}
- else if (_tcsicmp(value, _T("dir")) != 0)
- {
+ else if (_tcsicmp(value, _T("dir")) != 0) {
type = 0;
- return 1; /* ignore for now */
+ return 1; /* ignore for now */
}
-
if (type >= 0)
cfgfile_parse_newfilesys(p, -1, type, tmpp, unit, true);
return 1;
}
return 1;
}
- else if (!_tcsncmp(option, tmp, _tcslen(tmp)) && option[_tcslen(tmp)] == '_')
- {
- struct uaedev_config_info* uci = &currprefs.mountconfig[i].ci;
-
- if (uci->devname)
- {
- const TCHAR* s = &option[_tcslen(tmp) + 1];
-
- if (!_tcscmp(s, _T("bootpri")))
- {
+ else if (!_tcsncmp(option, tmp, _tcslen(tmp)) && option[_tcslen(tmp)] == '_') {
+ struct uaedev_config_info *uci = &currprefs.mountconfig[i].ci;
+ if (uci->devname) {
+ const TCHAR *s = &option[_tcslen(tmp) + 1];
+ if (!_tcscmp(s, _T("bootpri"))) {
getintval(&value, &uci->bootpri, 0);
}
- else if (!_tcscmp(s, _T("read-only")))
- {
+ else if (!_tcscmp(s, _T("read-only"))) {
cfgfile_yesno(NULL, value, NULL, &uci->readonly);
}
- else if (!_tcscmp(s, _T("volumename")))
- {
+ else if (!_tcscmp(s, _T("volumename"))) {
_tcscpy(uci->volname, value);
}
- else if (!_tcscmp(s, _T("devicename")))
- {
+ else if (!_tcscmp(s, _T("devicename"))) {
_tcscpy(uci->devname, value);
}
- else if (!_tcscmp(s, _T("root")))
- {
+ else if (!_tcscmp(s, _T("root"))) {
_tcscpy(uci->rootdir, value);
}
- else if (!_tcscmp(s, _T("filesys")))
- {
+ else if (!_tcscmp(s, _T("filesys"))) {
_tcscpy(uci->filesys, value);
}
- else if (!_tcscmp(s, _T("controller")))
- {
+ else if (!_tcscmp(s, _T("controller"))) {
uci->controller = get_filesys_controller(value);
}
}
}
}
- if (_tcscmp(option, _T("filesystem")) == 0 || _tcscmp(option, _T("hardfile")) == 0)
+ if (_tcscmp(option, _T("filesystem")) == 0
+ || _tcscmp(option, _T("hardfile")) == 0)
{
struct uaedev_config_info uci;
- TCHAR* tmpp = _tcschr(value, ',');
- TCHAR* str;
+ TCHAR *tmpp = _tcschr(value, ',');
+ TCHAR *str;
bool hdf;
uci_set_defaults(&uci, false);
@@ -2468,28 +3081,28 @@ static int cfgfile_parse_filesys(struct uae_prefs* p, const TCHAR* option, TCHAR
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 || strcasecmp(value, _T("ro")) == 0
+ || strcasecmp(value, _T("readonly")) == 0
+ || strcasecmp(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 || strcasecmp(value, _T("rw")) == 0
+ || strcasecmp(value, _T("readwrite")) == 0
+ || strcasecmp(value, _T("read-write")) == 0)
uci.readonly = false;
else
goto invalid_fs;
- value = tmpp;
- if (_tcscmp(option, _T("filesystem")) == 0)
- {
+ value = tmpp;
+ if (_tcscmp(option, _T("filesystem")) == 0) {
hdf = false;
tmpp = _tcschr(value, ':');
-
if (tmpp == 0)
goto invalid_fs;
*tmpp++ = '\0';
_tcscpy(uci.volname, value);
_tcscpy(uci.rootdir, tmpp);
}
- else
- {
+ else {
hdf = true;
if (!getintval(&value, &uci.sectors, ',')
|| !getintval(&value, &uci.surfaces, ',')
@@ -2498,19 +3111,17 @@ static int cfgfile_parse_filesys(struct uae_prefs* p, const TCHAR* option, TCHAR
goto invalid_fs;
_tcscpy(uci.rootdir, value);
}
-
- str = cfgfile_subst_path(UNEXPANDED, p->path_hardfile, uci.rootdir);
-
+ str = cfgfile_subst_path_load(UNEXPANDED, &p->path_hardfile, uci.rootdir, true);
#ifdef FILESYS
uci.type = hdf ? UAEDEV_HDF : UAEDEV_DIR;
add_filesys_config(p, -1, &uci);
#endif
xfree(str);
return 1;
-
invalid_fs:
write_log(_T("Invalid filesystem/hardfile specification.\n"));
return 1;
+
}
if (_tcscmp(option, _T("filesystem2")) == 0)
@@ -2521,27 +3132,117 @@ static int cfgfile_parse_filesys(struct uae_prefs* p, const TCHAR* option, TCHAR
return 0;
}
-static int cfgfile_parse_hardware(struct uae_prefs* p, const TCHAR* option, TCHAR* value)
+static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHAR *value)
{
int tmpval, dummyint, i;
- TCHAR* section = 0;
+ bool tmpbool, dummybool;
+ TCHAR *section = 0;
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("fast_copper"), &p->fast_copper)
+ || 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("fastmem_autoconfig"), &p->fastmem_autoconfig)
+ || 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("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("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("uae_hide_autoconfig"), &p->uae_hide_autoconfig)
+ || cfgfile_yesno(option, value, _T("uaeserial"), &p->uaeserial))
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("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_intval(option, value, _T("fastmem_size"), &p->fastmem_size, 0x100000)
+ || cfgfile_intval(option, value, _T("fastmem2_size"), &p->fastmem2_size, 0x100000)
+ || 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("z3mem_size"), &p->z3fastmem_size, 0x100000)
+ || cfgfile_intval(option, value, _T("z3mem2_size"), &p->z3fastmem2_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("bogomem_size"), &p->bogomem_size, 0x40000)
|| cfgfile_intval(option, value, _T("gfxcard_size"), &p->rtgmem_size, 0x100000)
@@ -2549,31 +3250,96 @@ static int cfgfile_parse_hardware(struct uae_prefs* p, const TCHAR* option, TCHA
|| 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("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("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))
return 1;
- if (cfgfile_strval(option, value, _T("collision_level"), &p->collision_level, collmode, 0)
- || cfgfile_strval(option, value, _T("waiting_blits"), &p->waiting_blits, waitblits, 0))
+ if (cfgfile_strval(option, value, _T("comp_trustbyte"), &p->comptrustbyte, compmode, 0)
+ || 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_strboolval(option, value, _T("comp_flushmode"), &p->comp_hardflush, flushmode, 0))
return 1;
- 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)))
+ 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)))
return 1;
- for (i = 0; i < 4; i++)
- {
+ if (cfgfile_strval(option, value, _T("chipset_compatible"), &p->cs_compatible, cscompa, 0)) {
+ built_in_chipset_prefs(p);
+ return 1;
+ }
+
+
+ if (cfgfile_strval(option, value, _T("cart_internal"), &p->cart_internal, cartsmode, 0)) {
+ if (p->cart_internal) {
+ struct romdata *rd = getromdatabyid(63);
+ if (rd)
+ _stprintf(p->cartfile, _T(":%s"), rd->configname);
+ }
+ return 1;
+ }
+ if (cfgfile_string(option, value, _T("kickstart_rom"), p->romident, sizeof p->romident / sizeof(TCHAR))) {
+ decode_rom_ident(p->romfile, sizeof p->romfile / sizeof(TCHAR), p->romident, ROMTYPE_ALL_KICK);
+ return 1;
+ }
+ if (cfgfile_string(option, value, _T("kickstart_ext_rom"), p->romextident, sizeof p->romextident / sizeof(TCHAR))) {
+ decode_rom_ident(p->romextfile, sizeof p->romextfile / sizeof(TCHAR), p->romextident, ROMTYPE_ALL_EXT);
+ return 1;
+ }
+ if (cfgfile_string(option, value, _T("a2091_rom"), p->a2091romident, sizeof p->a2091romident / sizeof(TCHAR))) {
+ decode_rom_ident(p->a2091romident, sizeof p->a2091romident / sizeof(TCHAR), p->a2091romident, ROMTYPE_A2091BOOT);
+ return 1;
+ }
+ if (cfgfile_string(option, value, _T("a4091_rom"), p->a4091romident, sizeof p->a4091romident / sizeof(TCHAR))) {
+ decode_rom_ident(p->a4091romident, sizeof p->a4091romident / sizeof(TCHAR), p->a4091romident, ROMTYPE_A4091BOOT);
+ return 1;
+ }
+ if (cfgfile_string(option, value, _T("cart"), p->cartident, sizeof p->cartident / sizeof(TCHAR))) {
+ decode_rom_ident(p->cartfile, sizeof p->cartfile / sizeof(TCHAR), p->cartident, ROMTYPE_ALL_CART);
+ return 1;
+ }
+
+ 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)))
+ if (cfgfile_path(option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR), &p->path_floppy))
return 1;
}
- if (cfgfile_intval(option, value, _T("chipmem_size"), &dummyint, 1))
- {
+ if (cfgfile_intval(option, value, _T("chipmem_size"), &dummyint, 1)) {
if (dummyint < 0)
p->chipmem_size = 0x20000; /* 128k, prototype support */
else if (dummyint == 0)
@@ -2583,110 +3349,93 @@ static int cfgfile_parse_hardware(struct uae_prefs* p, const TCHAR* option, TCHA
return 1;
}
- if (cfgfile_strval(option, value, _T("chipset"), &tmpval, csmode, 0))
- {
+ if (cfgfile_string(option, value, _T("addmem1"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
+ parse_addmem(p, tmpbuf, 0);
+ return 1;
+ }
+ if (cfgfile_string(option, value, _T("addmem2"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
+ parse_addmem(p, tmpbuf, 1);
+ return 1;
+ }
+
+ if (cfgfile_strval(option, value, _T("chipset"), &tmpval, csmode, 0)) {
set_chipset_mask(p, tmpval);
return 1;
}
- if (cfgfile_string(option, value, _T("fpu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR)))
- {
+ 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;
}
- if (cfgfile_string(option, value, _T("cpu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR)))
- {
+ if (cfgfile_string(option, value, _T("cpu_model"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
p->cpu_model = _tstol(tmpbuf);
p->fpu_model = 0;
return 1;
}
/* old-style CPU configuration */
- if (cfgfile_string(option, value, _T("cpu_type"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR)))
- {
+ if (cfgfile_string(option, value, _T("cpu_type"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
p->fpu_model = 0;
p->address_space_24 = 0;
p->cpu_model = 680000;
-
- if (!_tcscmp(tmpbuf, _T("68000")))
- {
+ if (!_tcscmp(tmpbuf, _T("68000"))) {
p->cpu_model = 68000;
}
- else if (!_tcscmp(tmpbuf, _T("68010")))
- {
+ else if (!_tcscmp(tmpbuf, _T("68010"))) {
p->cpu_model = 68010;
}
- else if (!_tcscmp(tmpbuf, _T("68ec020")))
- {
+ else if (!_tcscmp(tmpbuf, _T("68ec020"))) {
p->cpu_model = 68020;
p->address_space_24 = 1;
}
- else if (!_tcscmp(tmpbuf, _T("68020")))
- {
+ else if (!_tcscmp(tmpbuf, _T("68020"))) {
p->cpu_model = 68020;
}
- else if (!_tcscmp(tmpbuf, _T("68ec020/68881")))
- {
+ else if (!_tcscmp(tmpbuf, _T("68ec020/68881"))) {
p->cpu_model = 68020;
p->fpu_model = 68881;
p->address_space_24 = 1;
}
- else if (!_tcscmp(tmpbuf, _T("68020/68881")))
- {
+ else if (!_tcscmp(tmpbuf, _T("68020/68881"))) {
p->cpu_model = 68020;
p->fpu_model = 68881;
}
- else if (!_tcscmp(tmpbuf, _T("68040")))
- {
+ else if (!_tcscmp(tmpbuf, _T("68040"))) {
p->cpu_model = 68040;
p->fpu_model = 68040;
}
-
+ else if (!_tcscmp(tmpbuf, _T("68060"))) {
+ p->cpu_model = 68060;
+ p->fpu_model = 68060;
+ }
return 1;
}
/* Broken earlier versions used to write this out as a string. */
- /*
- Valid Options for finegraincpu_speed:
- real = 7Mhz
- max = Fastest
- */
- if (cfgfile_strval(option, value, _T("finegraincpu_speed"), &p->m68k_speed, speedmode, 1))
- {
+ if (cfgfile_strval(option, value, _T("finegraincpu_speed"), &p->m68k_speed, speedmode, 1)) {
p->m68k_speed--;
return 1;
}
- /*
- Valid Options for cpu_speed:
- real = 7Mhz
- 2 = 14Mhz
- max = Fastest
- */
- if (cfgfile_strval(option, value, _T("cpu_speed"), &p->m68k_speed, speedmode, 1))
- {
+ if (cfgfile_strval(option, value, _T("cpu_speed"), &p->m68k_speed, speedmode, 1)) {
p->m68k_speed--;
return 1;
}
-
- if (cfgfile_intval(option, value, _T("cpu_speed"), &p->m68k_speed, 1))
- {
+ if (cfgfile_intval(option, value, _T("cpu_speed"), &p->m68k_speed, 1)) {
p->m68k_speed *= CYCLE_UNIT;
return 1;
}
-
- /*
- Valid Options for finegrain_cpu_speed:
- 0 = 7Mhz
- 1024 = 14Mhz
- 128 = 25Mhz
- max = Fastest
- */
- if (cfgfile_intval(option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1))
- {
- if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT)
- {
+ 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;
}
@@ -2695,6 +3444,29 @@ static int cfgfile_parse_hardware(struct uae_prefs* p, const TCHAR* option, TCHA
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) {
+ int model = 0;
+ TCHAR *tmpp = _tcschr(value, ',');
+ if (tmpp) {
+ *tmpp++ = 0;
+ TCHAR *tmpp2 = _tcschr(value, ',');
+ if (tmpp2)
+ *tmpp2 = 0;
+ cfgfile_strval(option, value, option, &model, qsmodes, 0);
+ if (model >= 0) {
+ int config = _tstol(tmpp);
+ built_in_prefs(p, model, config, 0, 0);
+ }
+ }
+ return 1;
+ }
+
if (cfgfile_parse_filesys(p, option, value))
return 1;
@@ -2704,142 +3476,119 @@ static int cfgfile_parse_hardware(struct uae_prefs* p, const TCHAR* option, TCHA
static bool createconfigstore(struct uae_prefs*);
static int getconfigstoreline(const TCHAR* option, TCHAR* value);
-static void calcformula(struct uae_prefs* prefs, TCHAR* in)
+static void calcformula(struct uae_prefs *prefs, TCHAR *in)
{
TCHAR out[MAX_DPATH], configvalue[CONFIG_BLEN];
- TCHAR* p = out;
+ TCHAR *p = out;
double val;
int cnt1, cnt2;
static bool updatestore;
if (_tcslen(in) < 2 || in[0] != '[' || in[_tcslen(in) - 1] != ']')
return;
-
if (!configstore || updatestore)
createconfigstore(prefs);
-
updatestore = false;
-
if (!configstore)
return;
-
cnt1 = cnt2 = 0;
-
- for (int i = 1; i < _tcslen(in) - 1; i++)
- {
+ for (int i = 1; i < _tcslen(in) - 1; i++) {
TCHAR c = _totupper(in[i]);
- if (c >= 'A' && c <= 'Z')
- {
- TCHAR* start = &in[i];
-
- while (_istalnum(c) || c == '_' || c == '.')
- {
+ if (c >= 'A' && c <= 'Z') {
+ TCHAR *start = &in[i];
+ while (_istalnum(c) || c == '_' || c == '.') {
i++;
c = in[i];
}
-
TCHAR store = in[i];
in[i] = 0;
//write_log (_T("'%s'\n"), start);
if (!getconfigstoreline(start, configvalue))
return;
-
_tcscpy(p, configvalue);
p += _tcslen(p);
in[i] = store;
i--;
cnt1++;
}
- else
- {
+ else {
cnt2++;
- *p ++ = c;
+ *p++ = c;
}
}
-
*p = 0;
if (cnt1 == 0 && cnt2 == 0)
return;
-
/* single config entry only? */
- if (cnt1 == 1 && cnt2 == 0)
- {
+ if (cnt1 == 1 && cnt2 == 0) {
_tcscpy(in, out);
updatestore = true;
return;
}
-
- if (calc(out, &val))
- {
+ if (calc(out, &val)) {
if (val - (int)val != 0.0f)
- _stprintf(in, _T("%f"), val);
+ _stprintf(in, _T("%f"), val);
else
- _stprintf(in, _T("%d"), (int)val);
-
+ _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, TCHAR *option, TCHAR *value, int type)
{
calcformula(p, value);
+ if (!_tcscmp(option, _T("debug"))) {
+ write_log(_T("CONFIG DEBUG: '%s'\n"), value);
+ return 1;
+ }
if (!_tcscmp(option, _T("config_hardware")))
return 1;
-
if (!_tcscmp(option, _T("config_host")))
return 1;
-
- if (type == 0 || (type & CONFIG_TYPE_HARDWARE))
- {
+ 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 (type == 0 || (type & CONFIG_TYPE_HOST)) {
if (cfgfile_parse_host(p, option, value))
return 1;
}
-
if (type > 0 && (type & (CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST)) != (CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST))
return 1;
-
return 0;
}
-static int isutf8ext(TCHAR* s)
+static int isutf8ext(TCHAR *s)
{
- if (_tcslen(s) > _tcslen(UTF8NAME) && !_tcscmp(s + _tcslen(s) - _tcslen(UTF8NAME), UTF8NAME))
- {
+ if (_tcslen(s) > _tcslen(UTF8NAME) && !_tcscmp(s + _tcslen(s) - _tcslen(UTF8NAME), UTF8NAME)) {
s[_tcslen(s) - _tcslen(UTF8NAME)] = 0;
return 1;
}
return 0;
}
-static int cfgfile_separate_linea(const TCHAR* filename, char* line, TCHAR* line1b, TCHAR* line2b)
+static int cfgfile_separate_linea(const TCHAR *filename, char *line, TCHAR *line1b, TCHAR *line2b)
{
char *line1, *line2;
int i;
line1 = line;
line1 += strspn(line1, "\t \r\n");
-
if (*line1 == ';')
return 0;
-
line2 = strchr(line, '=');
-
- if (!line2)
- {
- TCHAR* s = au(line1);
+ if (!line2) {
+ TCHAR *s = au(line1);
write_log(_T("CFGFILE: '%s', linea was incomplete with only %s\n"), filename, s);
xfree(s);
return 0;
}
-
*line2++ = '\0';
/* Get rid of whitespace. */
@@ -2847,55 +3596,41 @@ static int cfgfile_separate_linea(const TCHAR* filename, char* line, TCHAR* line
while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
|| line2[i - 1] == '\r' || line2[i - 1] == '\n'))
line2[--i] = '\0';
-
line2 += strspn(line2, "\t \r\n");
i = strlen(line);
-
while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
|| line[i - 1] == '\r' || line[i - 1] == '\n'))
line[--i] = '\0';
-
line += strspn(line, "\t \r\n");
-
au_copy(line1b, MAX_DPATH, line);
-
- if (isutf8ext(line1b))
- {
- if (line2[0])
- {
- TCHAR* s = utf8u(line2);
+ if (isutf8ext(line1b)) {
+ if (line2[0]) {
+ TCHAR *s = utf8u(line2);
_tcscpy(line2b, s);
xfree(s);
}
}
- else
- {
+ else {
au_copy(line2b, MAX_DPATH, line2);
}
-
return 1;
}
-static int cfgfile_separate_line(TCHAR* line, TCHAR* line1b, TCHAR* line2b)
+static int cfgfile_separate_line(TCHAR *line, TCHAR *line1b, TCHAR *line2b)
{
TCHAR *line1, *line2;
int i;
line1 = line;
line1 += _tcsspn(line1, _T("\t \r\n"));
-
if (*line1 == ';')
return 0;
-
line2 = _tcschr(line, '=');
-
- if (!line2)
- {
+ if (!line2) {
write_log(_T("CFGFILE: line was incomplete with only %s\n"), line1);
return 0;
}
-
*line2++ = '\0';
/* Get rid of whitespace. */
@@ -2903,27 +3638,21 @@ static int cfgfile_separate_line(TCHAR* line, TCHAR* line1b, TCHAR* line2b)
while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
|| line2[i - 1] == '\r' || line2[i - 1] == '\n'))
line2[--i] = '\0';
-
line2 += _tcsspn(line2, _T("\t \r\n"));
_tcscpy(line2b, line2);
i = _tcslen(line);
-
while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
|| line[i - 1] == '\r' || line[i - 1] == '\n'))
line[--i] = '\0';
-
line += _tcsspn(line, _T("\t \r\n"));
_tcscpy(line1b, line);
- if (line2b[0] == '"' || line2b[0] == '\"')
- {
+ if (line2b[0] == '"' || line2b[0] == '\"') {
TCHAR c = line2b[0];
int i = 0;
memmove(line2b, line2b + 1, (_tcslen(line2b) + 1) * sizeof(TCHAR));
-
while (line2b[i] != 0 && line2b[i] != c)
i++;
-
line2b[i] = 0;
}
@@ -2932,65 +3661,49 @@ static int cfgfile_separate_line(TCHAR* line, TCHAR* line1b, TCHAR* line2b)
return 1;
}
-static int isobsolete(TCHAR* s)
+static int isobsolete(TCHAR *s)
{
int i = 0;
-
- while (obsolete[i])
- {
- if (!strcasecmp(s, obsolete[i]))
- {
+ while (obsolete[i]) {
+ if (!strcasecmp(s, obsolete[i])) {
write_log(_T("obsolete config entry '%s'\n"), s);
return 1;
}
i++;
}
-
if (_tcslen(s) > 2 && !_tcsncmp(s, _T("w."), 2))
return 1;
-
- if (_tcslen(s) >= 10 && !_tcsncmp(s, _T("gfx_opengl"), 10))
- {
+ if (_tcslen(s) >= 10 && !_tcsncmp(s, _T("gfx_opengl"), 10)) {
write_log(_T("obsolete config entry '%s\n"), s);
return 1;
}
-
- if (_tcslen(s) >= 6 && !_tcsncmp(s, _T("gfx_3d"), 6))
- {
+ if (_tcslen(s) >= 6 && !_tcsncmp(s, _T("gfx_3d"), 6)) {
write_log(_T("obsolete config entry '%s\n"), s);
return 1;
}
-
return 0;
}
-static void cfgfile_parse_separated_line(struct uae_prefs* p, TCHAR* line1b, TCHAR* line2b, int type)
+static void cfgfile_parse_separated_line(struct uae_prefs *p, TCHAR *line1b, TCHAR *line2b, int type)
{
TCHAR line3b[CONFIG_BLEN], line4b[CONFIG_BLEN];
- struct strlist* sl;
+ struct strlist *sl;
int ret;
_tcscpy(line3b, line1b);
_tcscpy(line4b, line2b);
ret = cfgfile_parse_option(p, line1b, line2b, type);
-
- if (!isobsolete(line3b))
- {
- for (sl = p->all_lines; sl; sl = sl->next)
- {
+ if (!isobsolete(line3b)) {
+ for (sl = p->all_lines; sl; sl = sl->next) {
if (sl->option && !strcasecmp(line1b, sl->option)) break;
}
-
- if (!sl)
- {
- struct strlist* u = xcalloc(struct strlist, 1);
+ if (!sl) {
+ struct strlist *u = xcalloc(struct strlist, 1);
u->option = my_strdup(line3b);
u->value = my_strdup(line4b);
u->next = p->all_lines;
p->all_lines = u;
-
- if (!ret)
- {
+ if (!ret) {
u->unknown = 1;
write_log(_T("unknown config entry: '%s=%s'\n"), u->option, u->value);
}
@@ -2998,61 +3711,50 @@ static void cfgfile_parse_separated_line(struct uae_prefs* p, TCHAR* line1b, TCH
}
}
-void cfgfile_parse_lines(struct uae_prefs* p, const TCHAR* lines, int type)
+void cfgfile_parse_lines(struct uae_prefs *p, const TCHAR *lines, int type)
{
- TCHAR* buf = my_strdup(lines);
- TCHAR* t = buf;
- for (;;)
- {
+ TCHAR *buf = my_strdup(lines);
+ TCHAR *t = buf;
+ for (;;) {
if (_tcslen(t) == 0)
break;
-
- TCHAR* t2 = _tcschr(t, '\n');
-
+ TCHAR *t2 = _tcschr(t, '\n');
if (t2)
*t2 = 0;
-
cfgfile_parse_line(p, t, type);
-
if (!t2)
break;
-
t = t2 + 1;
}
-
xfree(buf);
}
-void cfgfile_parse_line(struct uae_prefs* p, TCHAR* line, int type)
+void cfgfile_parse_line(struct uae_prefs *p, TCHAR *line, int type)
{
TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
if (!cfgfile_separate_line(line, line1b, line2b))
return;
-
cfgfile_parse_separated_line(p, line1b, line2b, type);
}
-static void subst(TCHAR* p, TCHAR* f, int n)
+static void subst(TCHAR *p, TCHAR *f, int n)
{
- TCHAR* str = cfgfile_subst_path(UNEXPANDED, p, f);
+ TCHAR *str = cfgfile_subst_path(UNEXPANDED, p, f);
_tcsncpy(f, str, n - 1);
f[n - 1] = '\0';
free(str);
}
-static int getconfigstoreline(const TCHAR* option, TCHAR* value)
+static int getconfigstoreline(const TCHAR *option, TCHAR *value)
{
TCHAR tmp[CONFIG_BLEN * 2], tmp2[CONFIG_BLEN * 2];
int idx = 0;
if (!configstore)
return 0;
-
zfile_fseek(configstore, 0, SEEK_SET);
-
- for (;;)
- {
+ for (;;) {
if (!zfile_fgets(tmp, sizeof tmp / sizeof(TCHAR), configstore))
return 0;
if (!cfgfile_separate_line(tmp, tmp2, value))
@@ -3062,15 +3764,13 @@ static int getconfigstoreline(const TCHAR* option, TCHAR* value)
}
}
-static bool createconfigstore(struct uae_prefs* p)
+static bool createconfigstore(struct uae_prefs *p)
{
- uae_u8 zeros[4] = {0};
+ uae_u8 zeros[4] = { 0 };
zfile_fclose(configstore);
configstore = zfile_fopen_empty(NULL, _T("configstore"), 50000);
-
if (!configstore)
return false;
-
zfile_fseek(configstore, 0, SEEK_SET);
uaeconfig++;
cfgfile_save_options(configstore, p, 0);
@@ -3080,7 +3780,7 @@ static bool createconfigstore(struct uae_prefs* p)
return true;
}
-static char* cfg_fgets(char* line, int max, struct zfile* fh)
+static char *cfg_fgets(char *line, int max, struct zfile *fh)
{
#ifdef SINGLEFILE
extern TCHAR singlefile_config[];
@@ -3090,61 +3790,47 @@ static char* cfg_fgets(char* line, int max, struct zfile* fh)
if (fh)
return zfile_fgetsa(line, max, fh);
-
#ifdef SINGLEFILE
if (sfile_ptr == 0) {
sfile_ptr = singlefile_config;
-
if (*sfile_ptr) {
write_log(_T("singlefile config found\n"));
- while (*sfile_ptr++)
- ;
+ while (*sfile_ptr++);
}
}
-
if (*sfile_ptr == 0) {
sfile_ptr = singlefile_config;
return 0;
}
-
p = sfile_ptr;
-
while (*p != 13 && *p != 10 && *p != 0) p++;
-
memset(line, 0, max);
memcpy(line, sfile_ptr, (p - sfile_ptr) * sizeof(TCHAR));
sfile_ptr = p + 1;
-
if (*sfile_ptr == 13)
sfile_ptr++;
-
if (*sfile_ptr == 10)
sfile_ptr++;
-
return line;
#endif
-
return 0;
}
-static int cfgfile_load_2(struct uae_prefs* p, const TCHAR* filename, bool real, int* type)
+static int cfgfile_load_2(struct uae_prefs *p, const TCHAR *filename, bool real, int *type)
{
int i;
- struct zfile* fh;
+ struct zfile *fh;
char linea[CONFIG_BLEN];
TCHAR line[CONFIG_BLEN], line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
- struct strlist* sl;
+ struct strlist *sl;
bool type1 = false, type2 = false;
int askedtype = 0;
- if (type)
- {
+ if (type) {
askedtype = *type;
*type = 0;
}
-
- if (real)
- {
+ if (real) {
p->config_version = 0;
config_newfilesystem = 0;
store_inputdevice_config(p);
@@ -3152,23 +3838,18 @@ static int cfgfile_load_2(struct uae_prefs* p, const TCHAR* filename, bool real,
}
fh = zfile_fopen(filename, _T("r"), ZFD_NORMAL);
-
#ifndef SINGLEFILE
if (!fh)
return 0;
#endif
- while (cfg_fgets(linea, sizeof(linea), fh) != 0)
- {
+ while (cfg_fgets(linea, sizeof(linea), fh) != 0) {
trimwsa(linea);
-
- if (strlen(linea) > 0)
- {
- if (linea[0] == '#' || linea[0] == ';')
- {
- struct strlist* u = xcalloc(struct strlist, 1);
+ if (strlen(linea) > 0) {
+ if (linea[0] == '#' || linea[0] == ';') {
+ struct strlist *u = xcalloc(struct strlist, 1);
u->option = NULL;
- TCHAR* com = au(linea);
+ TCHAR *com = au(linea);
u->value = my_strdup(com);
xfree(com);
u->unknown = 1;
@@ -3176,65 +3857,53 @@ static int cfgfile_load_2(struct uae_prefs* p, const TCHAR* filename, bool real,
p->all_lines = u;
continue;
}
-
if (!cfgfile_separate_linea(filename, linea, line1b, line2b))
continue;
-
type1 = type2 = 0;
-
if (cfgfile_yesno(line1b, line2b, _T("config_hardware"), &type1) ||
- cfgfile_yesno(line1b, line2b, _T("config_host"), &type2))
- {
+ cfgfile_yesno(line1b, line2b, _T("config_host"), &type2)) {
if (type1 && type)
*type |= CONFIG_TYPE_HARDWARE;
-
if (type2 && type)
*type |= CONFIG_TYPE_HOST;
-
continue;
}
-
- if (real)
- {
+ if (real) {
cfgfile_parse_separated_line(p, line1b, line2b, askedtype);
}
-
- else
- {
+ else {
cfgfile_string(line1b, line2b, _T("config_description"), p->description, sizeof p->description / sizeof(TCHAR));
+ cfgfile_path(line1b, line2b, _T("config_hardware_path"), p->config_hardware_path, sizeof p->config_hardware_path / sizeof(TCHAR));
+ cfgfile_path(line1b, line2b, _T("config_host_path"), p->config_host_path, sizeof p->config_host_path / sizeof(TCHAR));
+ cfgfile_string(line1b, line2b, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof(TCHAR));
}
}
}
if (type && *type == 0)
*type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST;
-
zfile_fclose(fh);
if (!real)
return 1;
- for (sl = temp_lines; sl; sl = sl->next)
- {
+ for (sl = temp_lines; sl; sl = sl->next) {
_stprintf(line, _T("%s=%s"), sl->option, sl->value);
cfgfile_parse_line(p, line, 0);
}
for (i = 0; i < 4; i++)
- {
- subst(p->path_floppy, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR));
-
- if (i >= p->nr_floppies)
- p->floppyslots[i].dfxtype = DRV_NONE;
- }
-
- subst(p->path_rom, p->romfile, sizeof p->romfile / sizeof(TCHAR));
- subst(p->path_rom, p->romextfile, sizeof p->romextfile / sizeof(TCHAR));
+ subst(p->path_floppy.path[0], p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR));
+ subst(p->path_rom.path[0], p->romfile, sizeof p->romfile / sizeof(TCHAR));
+ subst(p->path_rom.path[0], p->romextfile, sizeof p->romextfile / sizeof(TCHAR));
+ subst(p->path_rom.path[0], p->romextfile2, sizeof p->romextfile2 / sizeof(TCHAR));
+ subst(p->path_rom.path[0], p->a2091romfile, sizeof p->a2091romfile / sizeof(TCHAR));
+ subst(p->path_rom.path[0], p->a4091romfile, sizeof p->a4091romfile / sizeof(TCHAR));
return 1;
}
-int cfgfile_load(struct uae_prefs* p, const TCHAR* filename, int* type, int ignorelink, int userconfig)
+int cfgfile_load(struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig)
{
int v;
TCHAR tmp[MAX_DPATH];
@@ -3243,28 +3912,54 @@ int cfgfile_load(struct uae_prefs* p, const TCHAR* filename, int* type, int igno
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);
-
- if (!v)
- {
+ if (!v) {
write_log(_T("load failed\n"));
goto end;
}
-
+ //if (userconfig)
+ // target_addtorecent(filename, 0);
+ if (!ignorelink) {
+ if (p->config_hardware_path[0]) {
+ fetch_configurationpath(tmp, sizeof(tmp) / sizeof(TCHAR));
+ _tcsncat(tmp, p->config_hardware_path, sizeof(tmp) / sizeof(TCHAR));
+ type2 = CONFIG_TYPE_HARDWARE;
+ cfgfile_load(p, tmp, &type2, 1, 0);
+ }
+ if (p->config_host_path[0]) {
+ fetch_configurationpath(tmp, sizeof(tmp) / sizeof(TCHAR));
+ _tcsncat(tmp, p->config_host_path, sizeof(tmp) / sizeof(TCHAR));
+ type2 = CONFIG_TYPE_HOST;
+ cfgfile_load(p, tmp, &type2, 1, 0);
+ }
+ }
end:
recursive--;
fixup_prefs(p);
return v;
}
-int cfgfile_save(struct uae_prefs* p, const TCHAR* filename, int type)
+void cfgfile_backup(const TCHAR *path)
{
- struct zfile* fh;
+ TCHAR dpath[MAX_DPATH];
- fh = zfile_fopen(filename, _T("w"), ZFD_NORMAL);
+ fetch_configurationpath(dpath, sizeof(dpath) / sizeof(TCHAR));
+ _tcscat(dpath, _T("configuration.backup"));
+ //bool hidden = my_isfilehidden(dpath);
+ my_unlink(dpath);
+ my_rename(path, dpath);
+ //if (hidden)
+ // my_setfilehidden(dpath, hidden);
+}
+
+int cfgfile_save(struct uae_prefs *p, const TCHAR *filename, int type)
+{
+ struct zfile *fh;
+
+ cfgfile_backup(filename);
+ fh = zfile_fopen(filename, unicode_config ? _T("w, ccs=UTF-8") : _T("w"), ZFD_NORMAL);
if (!fh)
return 0;
@@ -3275,19 +3970,23 @@ int cfgfile_save(struct uae_prefs* p, const TCHAR* filename, int type)
return 1;
}
-int cfgfile_get_description(const TCHAR* filename, TCHAR* description)
+int cfgfile_get_description(const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type)
{
int result = 0;
- struct uae_prefs* p = xmalloc(struct uae_prefs, 1);
- p->description[0] = 0;
+ struct uae_prefs *p = xmalloc(struct uae_prefs, 1);
- if (cfgfile_load_2(p, filename, 0, 0))
- {
+ p->description[0] = 0;
+ p->config_host_path[0] = 0;
+ p->config_hardware_path[0] = 0;
+ if (cfgfile_load_2(p, filename, 0, type)) {
result = 1;
if (description)
- _tcscpy(description, p->description);
+ _tcscpy(description, p->description);
+ if (hostlink)
+ _tcscpy(hostlink, p->config_host_path);
+ if (hardwarelink)
+ _tcscpy(hardwarelink, p->config_hardware_path);
}
-
xfree(p);
return result;
}
@@ -3295,51 +3994,85 @@ int cfgfile_get_description(const TCHAR* filename, TCHAR* description)
int cfgfile_configuration_change(int v)
{
static int mode;
-
if (v >= 0)
mode = v;
-
return mode;
}
-static void parse_sound_spec(struct uae_prefs* p, const TCHAR* spec)
+void cfgfile_show_usage(void)
{
- TCHAR* x0 = my_strdup(spec);
+ 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;
x1 = _tcschr(x0, ':');
- if (x1 != NULL)
- {
+ if (x1 != NULL) {
*x1++ = '\0';
x2 = _tcschr(x1 + 1, ':');
-
- if (x2 != NULL)
- {
+ if (x2 != NULL) {
*x2++ = '\0';
x3 = _tcschr(x2 + 1, ':');
-
- if (x3 != NULL)
- {
+ if (x3 != NULL) {
*x3++ = '\0';
x4 = _tcschr(x3 + 1, ':');
-
- if (x4 != NULL)
- {
+ if (x4 != NULL) {
*x4++ = '\0';
x5 = _tcschr(x4 + 1, ':');
}
}
}
}
-
p->produce_sound = _tstoi(x0);
-
- if (x1)
- {
+ if (x1) {
p->sound_stereo_separation = 0;
-
- if (*x1 == 'S')
- {
+ if (*x1 == 'S') {
p->sound_stereo = SND_STEREO;
p->sound_stereo_separation = 7;
}
@@ -3348,83 +4081,62 @@ static void parse_sound_spec(struct uae_prefs* p, const TCHAR* spec)
else
p->sound_stereo = SND_MONO;
}
-
if (x3)
p->sound_freq = _tstoi(x3);
-
+ if (x4)
+ p->sound_maxbsiz = _tstoi(x4);
free(x0);
}
-static void parse_joy_spec(struct uae_prefs* p, const TCHAR* spec)
+static void parse_joy_spec(struct uae_prefs *p, const TCHAR *spec)
{
int v0 = 2, v1 = 0;
-
if (_tcslen(spec) != 2)
goto bad;
- switch (spec[0])
- {
- case '0': v0 = JSEM_JOYS;
- break;
- case '1': v0 = JSEM_JOYS + 1;
- break;
- case 'M': case 'm': v0 = JSEM_MICE;
- break;
- case 'A': case 'a': v0 = JSEM_KBDLAYOUT;
- break;
- case 'B': case 'b': v0 = JSEM_KBDLAYOUT + 1;
- break;
- case 'C': case 'c': v0 = JSEM_KBDLAYOUT + 2;
- break;
+ switch (spec[0]) {
+ case '0': v0 = JSEM_JOYS; break;
+ case '1': v0 = JSEM_JOYS + 1; break;
+ case 'M': case 'm': v0 = JSEM_MICE; break;
+ case 'A': case 'a': v0 = JSEM_KBDLAYOUT; break;
+ case 'B': case 'b': v0 = JSEM_KBDLAYOUT + 1; break;
+ case 'C': case 'c': v0 = JSEM_KBDLAYOUT + 2; break;
default: goto bad;
}
- switch (spec[1])
- {
- case '0': v1 = JSEM_JOYS;
- break;
- case '1': v1 = JSEM_JOYS + 1;
- break;
- case 'M': case 'm': v1 = JSEM_MICE;
- break;
- case 'A': case 'a': v1 = JSEM_KBDLAYOUT;
- break;
- case 'B': case 'b': v1 = JSEM_KBDLAYOUT + 1;
- break;
- case 'C': case 'c': v1 = JSEM_KBDLAYOUT + 2;
- break;
+ switch (spec[1]) {
+ case '0': v1 = JSEM_JOYS; break;
+ case '1': v1 = JSEM_JOYS + 1; break;
+ case 'M': case 'm': v1 = JSEM_MICE; break;
+ case 'A': case 'a': v1 = JSEM_KBDLAYOUT; break;
+ case 'B': case 'b': v1 = JSEM_KBDLAYOUT + 1; break;
+ case 'C': case 'c': v1 = JSEM_KBDLAYOUT + 2; break;
default: goto bad;
}
-
if (v0 == v1)
goto bad;
-
/* Let's scare Pascal programmers */
if (0)
- 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")
- _T("a, b or c for different keyboard settings.\n"));
+ 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")
+ _T("a, b or c for different keyboard settings.\n"));
p->jports[0].id = v0;
p->jports[1].id = v1;
}
-static void parse_filesys_spec(struct uae_prefs* p, bool readonly, const TCHAR* spec)
+static void parse_filesys_spec(struct uae_prefs *p, bool readonly, const TCHAR *spec)
{
struct uaedev_config_info uci;
TCHAR buf[256];
- TCHAR* s2;
+ TCHAR *s2;
uci_set_defaults(&uci, false);
- _tcsncpy(buf, spec, 255);
- buf[255] = 0;
+ _tcsncpy(buf, spec, 255); buf[255] = 0;
s2 = _tcschr(buf, ':');
-
- if (s2)
- {
+ if (s2) {
*s2++ = '\0';
-
#ifdef __DOS__
{
TCHAR *tmp;
@@ -3433,7 +4145,6 @@ static void parse_filesys_spec(struct uae_prefs* p, bool readonly, const TCHAR*
*tmp = '/';
}
#endif
-
#ifdef FILESYS
_tcscpy(uci.volname, buf);
_tcscpy(uci.rootdir, s2);
@@ -3441,46 +4152,39 @@ static void parse_filesys_spec(struct uae_prefs* p, bool readonly, const TCHAR*
uci.type = UAEDEV_DIR;
add_filesys_config(p, -1, &uci);
#endif
- }
- else
- {
+ }
+ else {
write_log(_T("Usage: [-m | -M] VOLNAME:mount_point\n"));
}
}
-static void parse_hardfile_spec(struct uae_prefs* p, const TCHAR* spec)
+static void parse_hardfile_spec(struct uae_prefs *p, const TCHAR *spec)
{
struct uaedev_config_info uci;
- TCHAR* x0 = my_strdup(spec);
+ TCHAR *x0 = my_strdup(spec);
TCHAR *x1, *x2, *x3, *x4;
uci_set_defaults(&uci, false);
-
x1 = _tcschr(x0, ':');
if (x1 == NULL)
goto argh;
*x1++ = '\0';
-
x2 = _tcschr(x1 + 1, ':');
if (x2 == NULL)
goto argh;
*x2++ = '\0';
-
x3 = _tcschr(x2 + 1, ':');
if (x3 == NULL)
goto argh;
*x3++ = '\0';
-
x4 = _tcschr(x3 + 1, ':');
if (x4 == NULL)
goto argh;
*x4++ = '\0';
-
#ifdef FILESYS
_tcscpy(uci.rootdir, x4);
//add_filesys_config (p, -1, NULL, NULL, x4, 0, 0, _tstoi (x0), _tstoi (x1), _tstoi (x2), _tstoi (x3), 0, 0, 0, 0, 0, 0, 0);
#endif
-
free(x0);
return;
@@ -3490,10 +4194,9 @@ argh:
return;
}
-static void parse_cpu_specs(struct uae_prefs* p, const TCHAR* spec)
+static void parse_cpu_specs(struct uae_prefs *p, const TCHAR *spec)
{
- if (*spec < '0' || *spec > '4')
- {
+ if (*spec < '0' || *spec > '4') {
write_log(_T("CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n"));
return;
}
@@ -3501,136 +4204,150 @@ 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;
-
- while (*spec != '\0')
- {
- switch (*spec)
- {
+ while (*spec != '\0') {
+ switch (*spec) {
case 'a':
if (p->cpu_model < 68020)
- write_log (_T("In 68000/68010 emulation, the address space is always 24 bit.\n"));
+ write_log(_T("In 68000/68010 emulation, the address space is always 24 bit.\n"));
else if (p->cpu_model >= 68040)
- write_log (_T("In 68040/060 emulation, the address space is always 32 bit.\n"));
+ write_log(_T("In 68040/060 emulation, the address space is always 32 bit.\n"));
else
p->address_space_24 = 1;
break;
case 'c':
if (p->cpu_model != 68000)
- write_log (_T("The more compatible CPU emulation is only available for 68000\n")
- _T("emulation, not for 68010 upwards.\n"));
+ write_log(_T("The more compatible CPU emulation is only available for 68000\n")
+ _T("emulation, not for 68010 upwards.\n"));
else
p->cpu_compatible = 1;
break;
default:
- write_log (_T("Bad CPU parameter specified - type \"uae -h\" for help.\n"));
+ write_log(_T("Bad CPU parameter specified - type \"uae -h\" for help.\n"));
break;
}
spec++;
}
}
-static void cmdpath(TCHAR* dst, const TCHAR* src, int maxsz)
+static void cmdpath(TCHAR *dst, const TCHAR *src, int maxsz)
{
- TCHAR* s = target_expand_environment(src);
+ TCHAR *s = target_expand_environment(src);
_tcsncpy(dst, s, maxsz);
dst[maxsz] = 0;
xfree(s);
}
/* Returns the number of args used up (0 or 1). */
-int parse_cmdline_option(struct uae_prefs* p, TCHAR c, const TCHAR* arg)
+int parse_cmdline_option(struct uae_prefs *p, TCHAR c, const TCHAR *arg)
{
- struct strlist* u = xcalloc(struct strlist, 1);
+ struct strlist *u = xcalloc(struct strlist, 1);
const TCHAR arg_required[] = _T("0123rKpImWSAJwNCZUFcblOdHRv");
- if (_tcschr(arg_required, c) && !arg)
- {
- printf(_T("Missing argument for option -%c\n"), c);
- return -1;
+ if (_tcschr(arg_required, c) && !arg) {
+ write_log(_T("Missing argument for option `-%c'!\n"), c);
+ return 0;
}
u->option = xmalloc(TCHAR, 2);
u->option[0] = c;
u->option[1] = 0;
-
- if (arg)
- u->value = my_strdup(arg);
-
+ u->value = my_strdup(arg);
u->next = p->all_lines;
p->all_lines = u;
- switch (c)
- {
- case '0': cmdpath(p->floppyslots[0].df, arg, 255);
- break;
- case '1': cmdpath(p->floppyslots[1].df, arg, 255);
- break;
- case '2': cmdpath(p->floppyslots[2].df, arg, 255);
- break;
- case '3': cmdpath(p->floppyslots[3].df, arg, 255);
- break;
- case 'r': cmdpath(p->romfile, arg, 255);
- break;
- case 'K': cmdpath(p->romextfile, arg, 255);
- break;
- case 'm': case 'M': parse_filesys_spec(p, c == 'M', arg);
- break;
- case 'W': parse_hardfile_spec(p, arg);
- break;
- case 'S': parse_sound_spec(p, arg);
- break;
- case 'R': p->gfx_framerate = _tstoi (arg);
- break;
- case 'J': parse_joy_spec(p, arg);
- break;
- case 'w': p->m68k_speed = _tstoi (arg);
- break;
- case 'G': p->start_gui = 0;
- break;
+ switch (c) {
+ case 'h': usage(); exit(0);
+
+ case '0': cmdpath(p->floppyslots[0].df, arg, 255); break;
+ case '1': cmdpath(p->floppyslots[1].df, arg, 255); break;
+ case '2': cmdpath(p->floppyslots[2].df, arg, 255); break;
+ case '3': cmdpath(p->floppyslots[3].df, arg, 255); break;
+ case 'r': cmdpath(p->romfile, arg, 255); break;
+ case 'K': cmdpath(p->romextfile, arg, 255); break;
+ case 'p': _tcsncpy(p->prtname, arg, 255); p->prtname[255] = 0; break;
+ /* case 'I': _tcsncpy (p->sername, arg, 255); p->sername[255] = 0; currprefs.use_serial = 1; break; */
+ case 'm': case 'M': parse_filesys_spec(p, c == 'M', arg); break;
+ case 'W': parse_hardfile_spec(p, arg); break;
+ case 'S': parse_sound_spec(p, arg); break;
+ case 'R': p->gfx_framerate = _tstoi(arg); break;
+ case 'i': p->illegal_mem = 1; break;
+ case 'J': parse_joy_spec(p, arg); break;
+
+ case 'w': p->m68k_speed = _tstoi(arg); break;
+
+ /* case 'g': p->use_gfxlib = 1; break; */
+ case 'G': p->start_gui = 0; break;
+ case 'D': p->start_debugger = 1; break;
+
case 'n':
- if (_tcschr (arg, 'i') != 0)
+ if (_tcschr(arg, 'i') != 0)
p->immediate_blits = 1;
break;
+
case 'v':
- set_chipset_mask(p, _tstoi (arg));
+ set_chipset_mask(p, _tstoi(arg));
break;
+
case 'C':
parse_cpu_specs(p, arg);
break;
+
case 'Z':
- p->z3fastmem_size = _tstoi (arg) * 0x100000;
+ p->z3fastmem_size = _tstoi(arg) * 0x100000;
break;
+
case 'U':
- p->rtgmem_size = _tstoi (arg) * 0x100000;
+ p->rtgmem_size = _tstoi(arg) * 0x100000;
break;
+
case 'F':
- p->fastmem_size = _tstoi (arg) * 0x100000;
+ p->fastmem_size = _tstoi(arg) * 0x100000;
break;
+
case 'b':
- p->bogomem_size = _tstoi (arg) * 0x40000;
+ p->bogomem_size = _tstoi(arg) * 0x40000;
break;
+
case 'c':
- p->chipmem_size = _tstoi (arg) * 0x80000;
+ p->chipmem_size = _tstoi(arg) * 0x80000;
+ break;
+
+ case 'O': parse_gfx_specs(p, arg); break;
+ case 'd':
+ if (_tcschr(arg, 'S') != NULL || _tcschr(arg, 's')) {
+ write_log(_T(" Serial on demand.\n"));
+ p->serial_demand = 1;
+ }
+ if (_tcschr(arg, 'P') != NULL || _tcschr(arg, 'p')) {
+ write_log(_T(" Parallel on demand.\n"));
+ p->parallel_demand = 1;
+ }
+
+ break;
+
+ case 'H':
+ p->color_mode = _tstoi(arg);
+ if (p->color_mode < 0) {
+ write_log(_T("Bad color mode selected. Using default.\n"));
+ p->color_mode = 0;
+ }
break;
default:
- printf(_T("Unknown option -%c\n"), c);
- return -1;
+ write_log(_T("Unknown option `-%c'!\n"), c);
break;
}
- return !! _tcschr (arg_required, c);
+ return !!_tcschr(arg_required, c);
}
-void cfgfile_addcfgparam(TCHAR* line)
+void cfgfile_addcfgparam(TCHAR *line)
{
- struct strlist* u;
+ struct strlist *u;
TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
- if (!line)
- {
- struct strlist** ps = &temp_lines;
- while (*ps)
- {
- struct strlist* s = *ps;
+ if (!line) {
+ struct strlist **ps = &temp_lines;
+ while (*ps) {
+ struct strlist *s = *ps;
*ps = s->next;
xfree(s->value);
xfree(s->option);
@@ -3639,10 +4356,8 @@ void cfgfile_addcfgparam(TCHAR* line)
temp_lines = 0;
return;
}
-
if (!cfgfile_separate_line(line, line1b, line2b))
return;
-
u = xcalloc(struct strlist, 1);
u->option = my_strdup(line1b);
u->value = my_strdup(line2b);
@@ -3650,64 +4365,48 @@ void cfgfile_addcfgparam(TCHAR* line)
temp_lines = u;
}
-int cmdlineparser(const TCHAR* s, TCHAR* outp[], int max)
+int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max)
{
int j, cnt = 0;
int slash = 0;
int quote = 0;
TCHAR tmp1[MAX_DPATH];
- const TCHAR* prev;
+ const TCHAR *prev;
int doout;
doout = 0;
prev = s;
j = 0;
outp[0] = 0;
-
- while (cnt < max)
- {
+ while (cnt < max) {
TCHAR c = *s++;
-
if (!c)
break;
-
if (c < 32)
continue;
-
if (c == '\\')
slash = 1;
-
- if (!slash && c == '"')
- {
- if (quote)
- {
+ if (!slash && c == '"') {
+ if (quote) {
quote = 0;
doout = 1;
}
- else
- {
+ else {
quote = 1;
j = -1;
}
}
-
if (!quote && c == ' ')
doout = 1;
-
- if (!doout)
- {
- if (j >= 0)
- {
+ if (!doout) {
+ if (j >= 0) {
tmp1[j] = c;
tmp1[j + 1] = 0;
}
j++;
}
-
- if (doout)
- {
- if (_tcslen(tmp1) > 0)
- {
+ if (doout) {
+ if (_tcslen(tmp1) > 0) {
outp[cnt++] = my_strdup(tmp1);
outp[cnt] = 0;
}
@@ -3715,16 +4414,12 @@ int cmdlineparser(const TCHAR* s, TCHAR* outp[], int max)
doout = 0;
j = 0;
}
-
slash = 0;
}
-
- if (j > 0 && cnt < max)
- {
+ if (j > 0 && cnt < max) {
outp[cnt++] = my_strdup(tmp1);
outp[cnt] = 0;
}
-
return cnt;
}
@@ -3735,7 +4430,7 @@ static bool cfgfile_parse_uaelib_option(struct uae_prefs* p, TCHAR* option, TCHA
return false;
}
-int cfgfile_searchconfig(const TCHAR* in, int index, TCHAR* out, int outsize)
+int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize)
{
TCHAR tmp[CONFIG_BLEN];
int j = 0;
@@ -3744,118 +4439,92 @@ int cfgfile_searchconfig(const TCHAR* in, int index, TCHAR* out, int outsize)
uae_u32 err = 0;
bool configsearchfound = false;
- if (in[inlen - 1] == '*')
- {
+ if (in[inlen - 1] == '*') {
joker = 1;
inlen--;
}
-
*out = 0;
if (!configstore)
createconfigstore(&currprefs);
-
if (!configstore)
return 20;
if (index < 0)
zfile_fseek(configstore, 0, SEEK_SET);
- for (;;)
- {
+ for (;;) {
uae_u8 b = 0;
- if (zfile_fread(&b, 1, 1, configstore) != 1)
- {
+ if (zfile_fread(&b, 1, 1, configstore) != 1) {
err = 10;
if (configsearchfound)
err = 0;
goto end;
}
-
if (j >= sizeof(tmp) / sizeof(TCHAR) - 1)
j = sizeof(tmp) / sizeof(TCHAR) - 1;
-
- if (b == 0)
- {
+ if (b == 0) {
err = 10;
if (configsearchfound)
err = 0;
goto end;
}
-
- if (b == '\n')
- {
- if (!_tcsncmp(tmp, in, inlen) && ((inlen > 0 && _tcslen(tmp) > inlen && tmp[inlen] == '=') || (joker)))
- {
- TCHAR* p;
-
+ if (b == '\n') {
+ if (!_tcsncmp(tmp, in, inlen) && ((inlen > 0 && _tcslen(tmp) > inlen && tmp[inlen] == '=') || (joker))) {
+ TCHAR *p;
if (joker)
p = tmp - 1;
else
p = _tcschr(tmp, '=');
-
- if (p)
- {
- for (int i = 0; out && i < outsize - 1; i++)
- {
- TCHAR b = * ++p;
+ if (p) {
+ for (int i = 0; out && i < outsize - 1; i++) {
+ TCHAR b = *++p;
out[i] = b;
out[i + 1] = 0;
if (!b)
break;
}
}
-
err = 0xffffffff;
configsearchfound = true;
goto end;
}
j = 0;
}
- else
- {
+ else {
tmp[j++] = b;
tmp[j] = 0;
}
}
-
end:
return err;
}
-uae_u32 cfgfile_modify(uae_u32 index, TCHAR* parms, uae_u32 size, TCHAR* out, uae_u32 outsize)
+uae_u32 cfgfile_modify(uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize)
{
- TCHAR* p;
- TCHAR* argc[UAELIB_MAX_PARSE];
+ TCHAR *p;
+ TCHAR *argc[UAELIB_MAX_PARSE];
int argv, i;
uae_u32 err;
TCHAR zero = 0;
- static TCHAR* configsearch;
+ static TCHAR *configsearch;
*out = 0;
err = 0;
argv = 0;
p = 0;
-
- if (index != 0xffffffff)
- {
- if (!configstore)
- {
+ if (index != 0xffffffff) {
+ if (!configstore) {
err = 20;
goto end;
}
-
- if (configsearch)
- {
+ if (configsearch) {
err = cfgfile_searchconfig(configsearch, index, out, outsize);
goto end;
}
-
err = 0xffffffff;
-
- for (i = 0; out && i < outsize - 1; i++)
- {
+ for (i = 0; out && i < outsize - 1; i++) {
uae_u8 b = 0;
if (zfile_fread(&b, 1, 1, configstore) != 1)
err = 0;
@@ -3873,16 +4542,13 @@ uae_u32 cfgfile_modify(uae_u32 index, TCHAR* parms, uae_u32 size, TCHAR* out, ua
if (size > 10000)
return 10;
-
argv = cmdlineparser(parms, argc, UAELIB_MAX_PARSE);
- if (argv <= 1 && index == 0xffffffff)
- {
+ if (argv <= 1 && index == 0xffffffff) {
createconfigstore(&currprefs);
xfree(configsearch);
configsearch = NULL;
- if (!configstore)
- {
+ if (!configstore) {
err = 20;
goto end;
}
@@ -3892,29 +4558,27 @@ uae_u32 cfgfile_modify(uae_u32 index, TCHAR* parms, uae_u32 size, TCHAR* out, ua
goto end;
}
- for (i = 0; i < argv; i++)
- {
- if (i + 2 <= argv)
- {
- if (!inputdevice_uaelib(argc[i], argc[i + 1]))
- {
- if (!cfgfile_parse_uaelib_option(&changed_prefs, argc[i], argc[i + 1], 0))
- {
- if (!cfgfile_parse_option(&changed_prefs, argc[i], argc[i + 1], 0))
- {
+ for (i = 0; i < argv; i++) {
+ if (i + 2 <= argv) {
+ if (!_tcsicmp(argc[i], _T("dbg"))) {
+ //debug_parser(argc[i + 1], out, outsize);
+ }
+ else if (!inputdevice_uaelib(argc[i], argc[i + 1])) {
+ if (!cfgfile_parse_uaelib_option(&changed_prefs, argc[i], argc[i + 1], 0)) {
+ if (!cfgfile_parse_option(&changed_prefs, argc[i], argc[i + 1], 0)) {
err = 5;
break;
}
}
}
+ set_config_changed();
set_special(SPCFLAG_MODE_CHANGE);
i++;
}
}
-
end:
for (i = 0; i < argv; i++)
- xfree(argc[i]);
+ xfree(argc[i]);
xfree(p);
return err;
}
@@ -3927,83 +4591,58 @@ uae_u32 cfgfile_uaelib_modify(uae_u32 index, uae_u32 parms, uae_u32 size, uae_u3
if (out)
put_byte(out, 0);
-
- if (size == 0)
- {
+ if (size == 0) {
while (get_byte(parms + size) != 0)
size++;
}
-
parms_p = xmalloc(uae_char, size + 1);
-
- if (!parms_p)
- {
+ if (!parms_p) {
ret = 10;
goto end;
}
-
- if (out)
- {
+ if (out) {
out_p = xmalloc(TCHAR, outsize + 1);
-
- if (!out_p)
- {
+ if (!out_p) {
ret = 10;
goto end;
}
-
out_p[0] = 0;
}
-
p = parms_p;
-
- for (i = 0; i < size; i++)
- {
+ for (i = 0; i < size; i++) {
p[i] = get_byte(parms + i);
-
if (p[i] == 10 || p[i] == 13 || p[i] == 0)
break;
}
-
p[i] = 0;
parms_in = au(parms_p);
ret = cfgfile_modify(index, parms_in, size, out_p, outsize);
xfree(parms_in);
-
- if (out)
- {
+ if (out) {
parms_out = ua(out_p);
p = parms_out;
-
- for (i = 0; i < outsize - 1; i++)
- {
+ for (i = 0; i < outsize - 1; i++) {
uae_u8 b = *p++;
put_byte(out + i, b);
put_byte(out + i + 1, 0);
-
if (!b)
break;
}
}
-
xfree(parms_out);
-
end:
xfree(out_p);
xfree(parms_p);
return ret;
}
-const TCHAR* cfgfile_read_config_value(const TCHAR* option)
+const TCHAR *cfgfile_read_config_value(const TCHAR *option)
{
- struct strlist* sl;
-
- for (sl = currprefs.all_lines; sl; sl = sl->next)
- {
+ struct strlist *sl;
+ for (sl = currprefs.all_lines; sl; sl = sl->next) {
if (sl->option && !strcasecmp(sl->option, option))
return sl->value;
}
-
return NULL;
}
@@ -4015,58 +4654,124 @@ uae_u32 cfgfile_uaelib(int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen)
if (mode)
return 0;
- for (i = 0; i < sizeof(tmp) / sizeof(TCHAR); i++)
- {
+ for (i = 0; i < sizeof(tmp) / sizeof(TCHAR); i++) {
tmp[i] = get_byte(name + i);
if (tmp[i] == 0)
break;
}
-
tmp[sizeof(tmp) / sizeof(TCHAR) - 1] = 0;
-
if (tmp[0] == 0)
return 0;
-
- const TCHAR* value = cfgfile_read_config_value(tmp);
-
- if (value)
- {
- char* s = ua(value);
-
- for (i = 0; i < maxlen; i++)
- {
+ const TCHAR *value = cfgfile_read_config_value(tmp);
+ if (value) {
+ char *s = ua(value);
+ for (i = 0; i < maxlen; i++) {
put_byte(dst + i, s[i]);
if (s[i] == 0)
break;
}
-
xfree(s);
return dst;
}
-
return 0;
}
+uae_u8 *restore_configuration(uae_u8 *src)
+{
+ TCHAR *s = au(reinterpret_cast(src));
+ //write_log (s);
+ xfree(s);
+ src += strlen(reinterpret_cast(src)) + 1;
+ return src;
+}
+
+uae_u8 *save_configuration(int *len, bool fullconfig)
+{
+ int tmpsize = 100000;
+ uae_u8 *dstbak, *dst, *p;
+ int index = -1;
+
+ dstbak = dst = xcalloc(uae_u8, tmpsize);
+ p = dst;
+ for (;;) {
+ TCHAR tmpout[1000];
+ int ret;
+ tmpout[0] = 0;
+ ret = cfgfile_modify(index, _T("*"), 1, tmpout, sizeof(tmpout) / sizeof(TCHAR));
+ index++;
+ if (_tcslen(tmpout) > 0) {
+ char *out;
+ if (!fullconfig && !_tcsncmp(tmpout, _T("input."), 6))
+ continue;
+ //write_log (_T("'%s'\n"), tmpout);
+ out = uutf8(tmpout);
+ strcpy(reinterpret_cast(p), out);
+ xfree(out);
+ strcat(reinterpret_cast(p), "\n");
+ p += strlen(reinterpret_cast(p));
+ if (p - dstbak >= tmpsize - sizeof(tmpout))
+ break;
+ }
+ if (ret >= 0)
+ break;
+ }
+ *len = p - dstbak + 1;
+ return dstbak;
+}
+
+static void default_prefs_mini(struct uae_prefs *p, int type)
+{
+ _tcscpy(p->description, _T("UAE default A500 configuration"));
+
+ p->nr_floppies = 1;
+ p->floppyslots[0].dfxtype = DRV_35_DD;
+ p->floppyslots[1].dfxtype = DRV_NONE;
+ p->cpu_model = 68000;
+ p->address_space_24 = 1;
+ p->chipmem_size = 0x00080000;
+ p->bogomem_size = 0x00080000;
+}
+
#include "sounddep/sound.h"
-void default_prefs(struct uae_prefs* p, int type)
+void default_prefs(struct uae_prefs *p, int type)
{
int i;
- int roms[] = {6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1};
+ int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1 };
TCHAR zero = 0;
- struct zfile* f;
+ struct zfile *f;
reset_inputdevice_config(p);
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->mountitems = 0;
- for (i = 0; i < MOUNT_CONFIG_SIZE; i++)
- {
+ for (i = 0; i < MOUNT_CONFIG_SIZE; i++) {
p->mountconfig[i].configoffset = -1;
p->mountconfig[i].unitnum = -1;
}
@@ -4076,7 +4781,7 @@ void default_prefs(struct uae_prefs* p, int type)
memset(&p->jports[2], 0, sizeof(struct jport));
memset(&p->jports[3], 0, sizeof(struct jport));
p->jports[0].id = JSEM_MICE;
- p->jports[1].id = JSEM_JOYS;
+ p->jports[1].id = JSEM_KBDLAYOUT;
p->jports[2].id = -1;
p->jports[3].id = -1;
@@ -4085,109 +4790,277 @@ 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_interpol = 0;
- p->sound_filter = FILTER_SOUND_OFF;
+ p->sound_maxbsiz = DEFAULT_SOUND_MAXB;
+ p->sound_interpol = 1;
+ p->sound_filter = FILTER_SOUND_EMUL;
p->sound_filter_type = 0;
- p->sound_volume_cd = 20;
+ p->sound_auto = 1;
+ 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 = DEFAULT_JIT_CACHE_SIZE;
+ 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[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 = 1;
- p->gfx_size_fs.width = 640;
- p->gfx_size_fs.height = 480;
+ 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;
-
- p->gfx_size.width = 640;
- p->gfx_size.height = 256;
-
+ 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;
-
-#ifdef RASPBERRY
- p->kbd_led_num = -1; // No status on numlock
- p->kbd_led_scr = -1; // No status on scrollock
- p->scaling_method = -1; //Default is Auto
-#endif
+ 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->immediate_blits = 0;
p->waiting_blits = 0;
- p->chipset_refreshrate = 50;
p->collision_level = 2;
p->leds_on_screen = 0;
- p->fast_copper = 0;
- p->tod_hack = 1;
+ p->leds_on_screen_mask[0] = p->leds_on_screen_mask[1] = (1 << LED_MAX) - 1;
+ 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->cs_compatible = 1;
+ p->cs_rtc = 2;
+ p->cs_df0idhw = 1;
+ p->cs_a1000ram = 0;
+ 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 = false;
+ 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_ciaatod = 0;
+ p->cs_df0idhw = 1;
+ p->cs_slowmemisfast = 0;
+ p->cs_resetwarning = 1;
+ p->cs_ciatodbug = false;
- _tcscpy(p->floppyslots[0].df, _T(""));
- _tcscpy(p->floppyslots[1].df, _T(""));
- _tcscpy(p->floppyslots[2].df, _T(""));
- _tcscpy(p->floppyslots[3].df, _T(""));
+ 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);
+ _tcscpy(p->path_rom.path[0], _T("./"));
+ _tcscpy(p->path_floppy.path[0], _T("./"));
+ _tcscpy(p->path_hardfile.path[0], _T("./"));
+
+ 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->m68k_speed = 0;
- p->cpu_compatible = 0;
+ p->cpu_compatible = 1;
p->address_space_24 = 1;
+ p->cpu_cycle_exact = 0;
+ p->blitter_cycle_exact = 0;
p->chipset_mask = CSMASK_ECS_AGNUS;
+ p->genlock = 0;
p->ntscmode = 0;
p->filesys_limit = 0;
p->filesys_max_name = 107;
+ p->filesys_max_file_size = 0x7fffffff;
p->fastmem_size = 0x00000000;
+ p->fastmem2_size = 0x00000000;
+ p->mbresmem_low_size = 0x00000000;
+ p->mbresmem_high_size = 0x00000000;
p->z3fastmem_size = 0x00000000;
- p->z3fastmem_start = z3_start_adr;
- p->chipmem_size = 0x00100000;
- p->bogomem_size = 0x00000000;
+ p->z3fastmem2_size = 0x00000000;
+ p->z3fastmem_start = 0x10000000;
+ p->chipmem_size = 0x00080000;
+ p->bogomem_size = 0x00080000;
p->rtgmem_size = 0x00000000;
p->rtgmem_type = GFXBOARD_UAE_Z3;
+ p->custom_memory_addrs[0] = 0;
+ p->custom_memory_sizes[0] = 0;
+ p->custom_memory_addrs[1] = 0;
+ p->custom_memory_sizes[1] = 0;
+ p->fastmem_autoconfig = true;
p->nr_floppies = 2;
+ p->floppy_read_only = false;
p->floppyslots[0].dfxtype = DRV_35_DD;
p->floppyslots[1].dfxtype = DRV_35_DD;
p->floppyslots[2].dfxtype = DRV_NONE;
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->socket_emu = 0;
+ p->statecapturebuffersize = 100;
+ p->statecapturerate = 5 * 50;
+ p->inprec_autoplay = true;
+
+#ifdef UAE_MINI
+ default_prefs_mini(p, 0);
+#endif
p->input_tablet = TABLET_OFF;
+ p->tablet_library = false;
+ p->input_magic_mouse = 0;
+ p->input_magic_mouse_cursor = 0;
- p->key_for_menu = SDL_SCANCODE_F12;
+#ifdef AMIBERRY
+ p->kbd_led_num = -1; // No status on numlock
+ p->kbd_led_scr = -1; // No status on scrollock
+ p->scaling_method = -1; //Default is Auto
+ p->key_for_menu = SDLK_F12;
p->key_for_quit = 0;
p->button_for_menu = -1;
p->button_for_quit = -1;
+#endif
inputdevice_default_prefs(p);
+
blkdev_default_prefs(p);
+
+ p->cr_selected = -1;
+ struct chipset_refresh *cr;
+ for (int i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) {
+ cr = &p->cr[i];
+ cr->index = i;
+ cr->rate = -1;
+ }
+ cr = &p->cr[CHIPSET_REFRESH_PAL];
+ cr->index = CHIPSET_REFRESH_PAL;
+ cr->horiz = -1;
+ cr->vert = -1;
+ cr->lace = -1;
+ cr->vsync = -1;
+ cr->framelength = -1;
+ cr->rate = 50.0;
+ cr->ntsc = 0;
+ cr->locked = false;
+ _tcscpy(cr->label, _T("PAL"));
+ cr = &p->cr[CHIPSET_REFRESH_NTSC];
+ cr->index = CHIPSET_REFRESH_NTSC;
+ cr->horiz = -1;
+ cr->vert = -1;
+ cr->lace = -1;
+ cr->vsync = -1;
+ cr->framelength = -1;
+ cr->rate = 60.0;
+ cr->ntsc = 1;
+ cr->locked = false;
+ _tcscpy(cr->label, _T("NTSC"));
+
target_default_options(p, type);
+
zfile_fclose(default_file);
default_file = NULL;
f = zfile_fopen_empty(NULL, _T("configstore"));
-
- if (f)
- {
+ if (f) {
uaeconfig++;
cfgfile_save_options(f, p, 0);
uaeconfig--;
@@ -4196,204 +5069,742 @@ void default_prefs(struct uae_prefs* p, int type)
}
}
-static void buildin_default_prefs_68020(struct uae_prefs* p)
+static void buildin_default_prefs_68020(struct uae_prefs *p)
{
p->cpu_model = 68020;
p->address_space_24 = 1;
- p->cpu_compatible = 0;
+ p->cpu_compatible = 1;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA;
p->chipmem_size = 0x200000;
p->bogomem_size = 0;
+ p->m68k_speed = -1;
}
-int bip_a4000(struct uae_prefs* p, int rom)
+static void buildin_default_host_prefs(struct uae_prefs *p)
{
- int roms[4];
+}
- roms[0] = 15;
- roms[1] = 14;
- roms[2] = 11;
- roms[3] = -1;
+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;
+ p->floppyslots[1].dfxtype = p->nr_floppies >= 2 ? DRV_35_DD : DRV_NONE;
+ p->floppyslots[2].dfxtype = DRV_NONE;
+ p->floppyslots[3].dfxtype = DRV_NONE;
+ p->floppy_speed = 100;
+
+ 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->chipset_mask = CSMASK_ECS_AGNUS;
+ p->immediate_blits = 0;
+ 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->sound_volume_cd = 0;
+ p->clipboard_sharing = false;
+
+ p->chipmem_size = 0x00080000;
+ p->bogomem_size = 0x00080000;
+ p->fastmem_size = 0x00000000;
+ p->mbresmem_low_size = 0x00000000;
+ p->mbresmem_high_size = 0x00000000;
+ p->z3fastmem_size = 0x00000000;
+ p->z3fastmem2_size = 0x00000000;
+ p->z3chipmem_size = 0x00000000;
+ p->rtgmem_size = 0x00000000;
+ p->rtgmem_type = GFXBOARD_UAE_Z3;
+
+ 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 = 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_ciaatod = 0;
+ p->cs_df0idhw = 1;
+ p->cs_resetwarning = 0;
+ 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;
+
+ target_default_options(p, 1);
+}
+
+static void set_68020_compa(struct uae_prefs *p, int compa, int cd32)
+{
+ switch (compa)
+ {
+ case 0:
+ p->blitter_cycle_exact = 1;
+ 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->m68k_speed = 0;
+ break;
+ case 2:
+ p->cpu_compatible = 0;
+ p->m68k_speed = -1;
+ p->address_space_24 = 0;
+ break;
+ case 3:
+ p->cpu_compatible = 0;
+ p->address_space_24 = 0;
+ p->cachesize = 8192;
+ break;
+ }
+}
+
+/* 0: cycle-exact
+* 1: more compatible
+* 2: no more compatible, no 100% sound
+* 3: no more compatible, waiting blits, no 100% sound
+*/
+
+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;
+ case 2:
+ p->cpu_compatible = 0;
+ break;
+ case 3:
+ p->produce_sound = 2;
+ p->cpu_compatible = 0;
+ break;
+ }
+}
+
+static int bip_a3000(struct uae_prefs *p, int config, int compa, int romcheck)
+{
+ int roms[2];
+
+ if (config == 2)
+ roms[0] = 61;
+ else if (config == 1)
+ roms[0] = 71;
+ else
+ roms[0] = 59;
+ roms[1] = -1;
p->bogomem_size = 0;
p->chipmem_size = 0x200000;
p->cpu_model = 68030;
p->fpu_model = 68882;
+ p->fpu_no_unimplemented = true;
+ if (compa == 0)
+ p->mmu_model = 68030;
+ else
+ p->cachesize = 8192;
+ p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
+ p->cpu_compatible = p->address_space_24 = 0;
+ p->m68k_speed = -1;
+ p->immediate_blits = 0;
+ 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);
+ p->cs_ciaatod = p->ntscmode ? 2 : 1;
+ return configure_rom(p, roms, romcheck);
+}
+
+static int bip_a4000(struct uae_prefs *p, int config, int compa, int romcheck)
+{
+ int roms[8];
+
+ roms[0] = 16;
+ roms[1] = 31;
+ roms[2] = 13;
+ roms[3] = 12;
+ roms[4] = -1;
+
+ p->bogomem_size = 0;
+ p->chipmem_size = 0x200000;
+ p->mbresmem_low_size = 8 * 1024 * 1024;
+ p->cpu_model = 68030;
+ p->fpu_model = 68882;
+ if (config > 0) {
+ 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 = 0;
+ p->produce_sound = 2;
p->cachesize = 8192;
-
- p->nr_floppies = 2;
p->floppyslots[0].dfxtype = DRV_35_HD;
p->floppyslots[1].dfxtype = DRV_35_HD;
p->floppy_speed = 0;
-
- return configure_rom(p, roms, 0);
+ p->cpu_idle = 150;
+ p->cs_compatible = CP_A4000;
+ built_in_chipset_prefs(p);
+ p->cs_ciaatod = p->ntscmode ? 2 : 1;
+ return configure_rom(p, roms, romcheck);
}
-int bip_cd32(struct uae_prefs* p, int rom)
+static int bip_a4000t(struct uae_prefs *p, int config, int compa, int romcheck)
+{
+
+ int roms[8];
+
+ roms[0] = 16;
+ roms[1] = 31;
+ roms[2] = 13;
+ roms[3] = -1;
+
+ p->bogomem_size = 0;
+ p->chipmem_size = 0x200000;
+ p->mbresmem_low_size = 8 * 1024 * 1024;
+ p->cpu_model = 68030;
+ p->fpu_model = 68882;
+ if (config > 0) {
+ 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 = 0;
+ 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->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[2];
buildin_default_prefs_68020(p);
- p->m68k_speed = M68K_SPEED_14MHZ_CYCLES;
p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
p->nr_floppies = 0;
p->floppyslots[0].dfxtype = DRV_NONE;
p->floppyslots[1].dfxtype = DRV_NONE;
+ set_68020_compa(p, compa, 1);
+ p->cs_compatible = CP_CD32;
+ built_in_chipset_prefs(p);
fetch_datapath(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR));
_tcscat(p->flashfile, _T("cd32.nvr"));
-
- p->cdslots[0].inuse = true;
- p->cdslots[0].type = SCSI_UNIT_IMAGE;
-
- p->gfx_size.width = 384;
- p->gfx_size.height = 256;
-
roms[0] = 64;
roms[1] = -1;
-
- if (!configure_rom(p, roms, 0))
- {
+ if (!configure_rom(p, roms, 0)) {
roms[0] = 18;
roms[1] = -1;
-
- if (!configure_rom(p, roms, 0))
+ if (!configure_rom(p, roms, romcheck))
return 0;
-
roms[0] = 19;
-
- if (!configure_rom(p, roms, 0))
+ if (!configure_rom(p, roms, romcheck))
+ return 0;
+ }
+ if (config > 0) {
+ roms[0] = 23;
+ if (!configure_rom(p, roms, romcheck))
return 0;
}
-
- // if (config > 0) {
- // roms[0] = 23;
- // if (!configure_rom(p, roms, 0))
- // return 0;
- // }
-
return 1;
}
-int bip_a1200(struct uae_prefs* p, int rom)
+static int bip_a1200(struct uae_prefs *p, int config, int compa, int romcheck)
{
int roms[4];
buildin_default_prefs_68020(p);
-
- if (rom == 310)
- {
- roms[0] = 15;
- roms[1] = 11;
- roms[2] = 31;
- roms[3] = -1;
+ roms[0] = 11;
+ roms[1] = 15;
+ roms[2] = 31;
+ roms[3] = -1;
+ p->cs_rtc = 0;
+ if (config == 1) {
+ p->fastmem_size = 0x400000;
+ p->cs_rtc = 2;
}
- else
- {
- roms[0] = 11;
- roms[1] = 15;
- roms[2] = 31;
- roms[3] = -1;
- }
-
- p->m68k_speed = M68K_SPEED_14MHZ_CYCLES;
-
- p->nr_floppies = 1;
- p->floppyslots[1].dfxtype = DRV_NONE;
-
- return configure_rom(p, roms, 0);
+ set_68020_compa(p, compa, 0);
+ p->cs_compatible = CP_A1200;
+ built_in_chipset_prefs(p);
+ return configure_rom(p, roms, romcheck);
}
-int bip_a500plus(struct uae_prefs* p, int rom)
+static int bip_a600(struct uae_prefs *p, int config, int compa, int romcheck)
{
int roms[4];
- if (rom == 130)
- {
- roms[0] = 6;
- roms[1] = 5;
- roms[2] = 4;
- roms[3] = -1;
- }
- else
- {
- roms[0] = 7;
- roms[1] = 6;
- roms[2] = 5;
- roms[3] = -1;
- }
-
+ roms[0] = 10;
+ roms[1] = 9;
+ roms[2] = 8;
+ roms[3] = -1;
p->bogomem_size = 0;
p->chipmem_size = 0x100000;
+ if (config > 0)
+ p->cs_rtc = 1;
+ if (config == 1)
+ p->chipmem_size = 0x200000;
+ if (config == 2)
+ p->fastmem_size = 0x400000;
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
- p->cpu_compatible = 0;
- p->fast_copper = 0;
- p->nr_floppies = 1;
- p->floppyslots[1].dfxtype = DRV_NONE;
-
- return configure_rom(p, roms, 0);
+ set_68000_compa(p, compa);
+ p->cs_compatible = CP_A600;
+ built_in_chipset_prefs(p);
+ return configure_rom(p, roms, romcheck);
}
-int bip_a500(struct uae_prefs* p, int rom)
+static int bip_a500p(struct uae_prefs *p, int config, int compa, int romcheck)
+{
+ int roms[2];
+
+ roms[0] = 7;
+ roms[1] = -1;
+ p->bogomem_size = 0;
+ p->chipmem_size = 0x100000;
+ if (config > 0)
+ p->cs_rtc = 1;
+ if (config == 1)
+ p->chipmem_size = 0x200000;
+ if (config == 2)
+ p->fastmem_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);
+}
+
+static int bip_a500(struct uae_prefs *p, int config, int compa, int romcheck)
{
int roms[4];
- if (rom == 130)
+ roms[0] = roms[1] = roms[2] = roms[3] = -1;
+ switch (config)
{
+ case 0: // KS 1.3, OCS Agnus, 0.5M Chip + 0.5M Slow
roms[0] = 6;
- roms[1] = 5;
- roms[2] = 4;
- roms[3] = -1;
- }
- else
- {
+ roms[1] = 32;
+ p->chipset_mask = 0;
+ break;
+ case 1: // KS 1.3, ECS Agnus, 0.5M Chip + 0.5M Slow
+ roms[0] = 6;
+ roms[1] = 32;
+ break;
+ case 2: // KS 1.3, ECS Agnus, 1.0M Chip
+ roms[0] = 6;
+ roms[1] = 32;
+ p->bogomem_size = 0;
+ p->chipmem_size = 0x100000;
+ break;
+ case 3: // KS 1.3, OCS Agnus, 0.5M Chip
+ roms[0] = 6;
+ roms[1] = 32;
+ p->bogomem_size = 0;
+ p->chipset_mask = 0;
+ p->cs_rtc = 0;
+ p->floppyslots[1].dfxtype = DRV_NONE;
+ break;
+ case 4: // KS 1.2, OCS Agnus, 0.5M Chip
roms[0] = 5;
roms[1] = 4;
roms[2] = 3;
- roms[3] = -1;
+ p->bogomem_size = 0;
+ p->chipset_mask = 0;
+ p->cs_rtc = 0;
+ p->floppyslots[1].dfxtype = DRV_NONE;
+ break;
+ case 5: // KS 1.2, OCS Agnus, 0.5M Chip + 0.5M Slow
+ roms[0] = 5;
+ roms[1] = 4;
+ roms[2] = 3;
+ p->chipset_mask = 0;
+ break;
}
-
- p->chipmem_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);
+ set_68000_compa(p, compa);
+ p->cs_compatible = CP_A500;
+ built_in_chipset_prefs(p);
+ return configure_rom(p, roms, romcheck);
}
-int bip_a2000(struct uae_prefs* p, int rom)
+static int bip_super(struct uae_prefs *p, int config, int compa, int romcheck)
{
- int roms[4];
+ int roms[8];
- if (rom == 130)
- {
- roms[0] = 6;
- roms[1] = 5;
- roms[2] = 4;
- roms[3] = -1;
- }
- else
- {
- roms[0] = 5;
- roms[1] = 4;
- roms[2] = 3;
- roms[3] = -1;
- }
+ 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);
+}
- p->chipmem_size = 0x00080000;
- p->bogomem_size = 0x00080000;
+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->cpu_compatible = 0;
- p->fast_copper = 0;
- p->nr_floppies = 1;
+ 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;
+}
- return configure_rom(p, roms, 0);
+int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int romcheck)
+{
+ int v = 0;
+
+ buildin_default_prefs(p);
+ switch (model)
+ {
+ case 0:
+ v = bip_a500(p, config, compa, romcheck);
+ break;
+ case 1:
+ v = bip_a500p(p, config, compa, romcheck);
+ break;
+ case 2:
+ 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:
+ v = bip_a4000(p, config, compa, romcheck);
+ break;
+ case 7:
+ v = bip_a4000t(p, config, compa, romcheck);
+ break;
+ case 8:
+ 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)
+ 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;
+ return v;
+}
+
+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;
+
+ 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;
+ break;
+ case CP_CD32: // CD32
+ p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
+ 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)
+ 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
+ p->cs_ide = IDE_A600A1200;
+ p->cs_pcmcia = 1;
+ p->cs_ksmirror_a8 = 1;
+ p->cs_ciaoverlay = 0;
+ if (p->fastmem_size || p->z3fastmem_size)
+ p->cs_rtc = 1;
+ break;
+ case CP_A2000: // A2000
+ p->cs_rtc = 1;
+ 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;
+ break;
+ }
+ return 1;
}
void set_config_changed(void)
@@ -4440,56 +5851,46 @@ TCHAR* get_error_log(void)
return s;
}
-void error_log(const TCHAR* format, ...)
+void error_log(const TCHAR *format, ...)
{
TCHAR buffer[256], *bufp;
int bufsize = 256;
va_list parms;
- if (format == NULL)
- {
- struct strlist** ps = &error_lines;
-
- while (*ps)
- {
- struct strlist* s = *ps;
+ if (format == NULL) {
+ struct strlist **ps = &error_lines;
+ while (*ps) {
+ struct strlist *s = *ps;
*ps = s->next;
xfree(s->value);
xfree(s->option);
xfree(s);
}
-
return;
}
va_start(parms, format);
bufp = buffer;
-
- for (;;)
- {
+ for (;;) {
int count = _vsntprintf(bufp, bufsize - 1, format, parms);
-
- if (count < 0)
- {
+ if (count < 0) {
bufsize *= 10;
if (bufp != buffer)
- xfree(bufp);
+ xfree(bufp);
bufp = xmalloc(TCHAR, bufsize);
continue;
}
-
break;
}
-
bufp[bufsize - 1] = 0;
write_log(_T("%s\n"), bufp);
va_end(parms);
- strlist* u = xcalloc(struct strlist, 1);
+ strlist *u = xcalloc(struct strlist, 1);
u->option = my_strdup(bufp);
u->next = error_lines;
error_lines = u;
if (bufp != buffer)
- xfree(bufp);
+ xfree(bufp);
}
diff --git a/src/custom.cpp b/src/custom.cpp
index 1c482393..9837fcfa 100644
--- a/src/custom.cpp
+++ b/src/custom.cpp
@@ -4377,15 +4377,6 @@ static void update_copper(int until_hpos)
return;
}
- if (currprefs.fast_copper)
- {
- if (eventtab[ev_copper].active)
- {
- eventtab[ev_copper].active = false;
- return;
- }
- }
-
if (cop_state.state == COP_wait && vp < cop_state.vcmp)
{
eventtab[ev_copper].active = false;
@@ -4605,22 +4596,6 @@ static void update_copper(int until_hpos)
if (vp == cop_state.vcmp && hp < cop_state.hcmp)
{
/* Position not reached yet. */
- if (currprefs.fast_copper)
- {
- if ((cop_state.i2 & 0xFE) == 0xFE)
- {
- int wait_finish = cop_state.hcmp - 2;
- /* This will leave c_hpos untouched if it's equal to wait_finish. */
- if (wait_finish < c_hpos)
- return;
- else if (wait_finish <= until_hpos)
- {
- c_hpos = wait_finish;
- }
- else
- c_hpos = until_hpos;
- }
- }
break;
}
@@ -4672,14 +4647,6 @@ out:
cop_state.hpos = c_hpos;
last_copper_hpos = until_hpos;
- if (currprefs.fast_copper)
- {
- /* The test against maxhpos also prevents us from calling predict_copper
- when we are being called from hsync_handler, which would not only be
- stupid, but actively harmful. */
- if ((regs.spcflags & SPCFLAG_COPPER) && (c_hpos + 8 < maxhpos))
- predict_copper();
- }
}
static void compute_spcflag_copper(int hpos)
@@ -4716,14 +4683,7 @@ static void compute_spcflag_copper(int hpos)
copper_enabled_thisline = 1;
- if (currprefs.fast_copper)
- {
- predict_copper();
- if (! eventtab[ev_copper].active)
- set_special(SPCFLAG_COPPER);
- }
- else
- set_special(SPCFLAG_COPPER);
+ set_special(SPCFLAG_COPPER);
}
static void copper_handler()
@@ -6912,7 +6872,6 @@ void check_prefs_changed_custom()
currprefs.immediate_blits = changed_prefs.immediate_blits;
currprefs.waiting_blits = changed_prefs.waiting_blits;
currprefs.collision_level = changed_prefs.collision_level;
- currprefs.fast_copper = changed_prefs.fast_copper;
currprefs.cs_cd32cd = changed_prefs.cs_cd32cd;
currprefs.cs_cd32c2p = changed_prefs.cs_cd32c2p;
currprefs.cs_cd32nvram = changed_prefs.cs_cd32nvram;
diff --git a/src/include/custom.h b/src/include/custom.h
index 6532cf6c..130a644f 100644
--- a/src/include/custom.h
+++ b/src/include/custom.h
@@ -151,6 +151,10 @@ extern unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256];
#define RES_HIRES 1
#define RES_SUPERHIRES 2
#define RES_MAX 2
+#define VRES_NONDOUBLE 0
+#define VRES_DOUBLE 1
+#define VRES_QUAD 2
+#define VRES_MAX 1
/* get resolution from bplcon0 */
STATIC_INLINE int GET_RES_DENISE(uae_u16 con0)
diff --git a/src/include/gfxboard.h b/src/include/gfxboard.h
index 7289c179..7b97d541 100644
--- a/src/include/gfxboard.h
+++ b/src/include/gfxboard.h
@@ -3,4 +3,4 @@ extern bool gfxboard_is_z3 (int);
#define GFXBOARD_UAE_Z2 0
#define GFXBOARD_UAE_Z3 1
-
+#define GFXBOARD_HARDWARE 2
diff --git a/src/include/gui.h b/src/include/gui.h
index d94df1ff..f41ec698 100644
--- a/src/include/gui.h
+++ b/src/include/gui.h
@@ -48,17 +48,20 @@ struct gui_info
bool drive_writing[4]; /* drive is writing */
bool drive_disabled[4]; /* drive is disabled */
bool powerled; /* state of power led */
+ uae_u8 powerled_brightness; /* 0 to 255 */
uae_s8 drive_side; /* floppy side */
uae_s8 hd; /* harddrive */
uae_s8 cd; /* CD */
+ uae_s8 md; /* CD32 or CDTV internal storage */
bool cpu_halted;
- int fps;
+ int fps, idle;
+ int fps_color;
int sndbuf, sndbuf_status;
TCHAR df[4][256]; /* inserted image */
uae_u32 crc32[4]; /* crc32 of image */
};
#define NUM_LEDS (LED_MAX)
-#define VISIBLE_LEDS 6
+#define VISIBLE_LEDS (LED_MAX - 1)
extern struct gui_info gui_data;
@@ -66,7 +69,7 @@ extern void fetch_configurationpath(char *out, int size);
extern void set_configurationpath(char *newpath);
extern void set_rompath(char *newpath);
extern void fetch_rp9path(char *out, int size);
-extern void fetch_savestatepath(char *out, int size);
+extern void fetch_statefilepath(char *out, int size);
extern void fetch_screenshotpath(char *out, int size);
extern void extractFileName(const char * str, char *buffer);
diff --git a/src/include/inputdevice.h b/src/include/inputdevice.h
index 3202b1b7..bc147936 100644
--- a/src/include/inputdevice.h
+++ b/src/include/inputdevice.h
@@ -236,6 +236,7 @@ extern void inputdevice_checkqualifierkeycode (int keyboard, int scancode, int s
extern void inputdevice_setkeytranslation (struct uae_input_device_kbr_default **trans, int **kbmaps);
extern void inputdevice_do_keyboard (int code, int state);
extern int inputdevice_iskeymapped (int keyboard, int scancode);
+extern int inputdevice_synccapslock(int, int*);
extern int inputdevice_get_compatibility_input (struct uae_prefs*, int index, int *typelist, int *inputlist, const int **at);
extern struct inputevent *inputdevice_get_eventinfo (int evt);
extern bool inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out);
diff --git a/src/include/keyboard.h b/src/include/keyboard.h
index ff54e129..cbd789c1 100644
--- a/src/include/keyboard.h
+++ b/src/include/keyboard.h
@@ -7,13 +7,6 @@
*/
#pragma once
-#define KEYCODE_UNK 0
-#define KEYCODE_X11 1
-#define KEYCODE_FBCON 2
-
-extern char keyboard_type;
-extern void init_keyboard();
-
/* First, two dummies */
#define AK_mousestuff 0x100
#define AK_inhibit 0x101
@@ -126,6 +119,7 @@ extern void init_keyboard();
#define AK_BACKQUOTE 0x00
#define AK_MINUS 0x0B
#define AK_EQUAL 0x0C
+
#define AK_RESETWARNING 0x78
#define AK_INIT_POWERUP 0xfd
#define AK_TERM_POWERUP 0xfe
@@ -180,3 +174,5 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT_FILE, AKS_SCREENSHOT_CLIPBOARD,
};
#define AKS_FIRST AKS_ENTERGUI
+
+extern int target_checkcapslock(int, int *);
diff --git a/src/include/options.h b/src/include/options.h
index 364a88dc..e9289152 100644
--- a/src/include/options.h
+++ b/src/include/options.h
@@ -16,6 +16,12 @@
extern long int version;
+#define MAX_PATHS 8
+
+struct multipath {
+ TCHAR path[MAX_PATHS][PATH_MAX];
+};
+
struct strlist
{
struct strlist* next;
@@ -39,6 +45,8 @@ struct strlist
#define MAX_INPUT_SUB_EVENT_ALL 9
#define SPARE_SUB_EVENT 8
+#define INTERNALEVENT_COUNT 1
+
struct uae_input_device
{
TCHAR* name;
@@ -71,6 +79,13 @@ struct jport
#define JPORT_AF_TOGGLE 2
#define JPORT_AF_ALWAYS 3
+#define KBTYPE_AMIGA 0
+#define KBTYPE_PC1 1
+#define KBTYPE_PC2 2
+
+#define MAX_SPARE_DRIVES 20
+#define MAX_CUSTOM_MEMORY_ADDRS 2
+
#define CONFIG_TYPE_HARDWARE 1
#define CONFIG_TYPE_HOST 2
#define CONFIG_BLEN 2560
@@ -79,6 +94,17 @@ struct jport
#define TABLET_MOUSEHACK 1
#define TABLET_REAL 2
+#ifdef WITH_SLIRP
+#define MAX_SLIRP_REDIRS 32
+struct slirp_redir
+{
+ int proto;
+ int srcport;
+ int dstport;
+ unsigned long addr;
+};
+#endif
+
struct cdslot
{
TCHAR name[MAX_DPATH];
@@ -91,13 +117,17 @@ struct floppyslot
{
TCHAR df[MAX_DPATH];
int dfxtype;
+ int dfxclick;
+ TCHAR dfxclickexternal[256];
bool forcedwriteprotect;
};
-struct wh
-{
+#define ASPECTMULT 1024
+#define WH_NATIVE 1
+struct wh {
int x, y;
int width, height;
+ int special;
};
#define MOUNT_CONFIG_SIZE 30
@@ -152,6 +182,103 @@ struct uaedev_config_data
int unitnum; // scsi unit number (if tape currently)
};
+enum {
+ CP_GENERIC = 1, CP_CDTV, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000,
+ CP_A1200, CP_A2000, CP_A3000, CP_A3000T, CP_A4000, CP_A4000T
+};
+
+#define IDE_A600A1200 1
+#define IDE_A4000 2
+
+#define GFX_WINDOW 0
+#define GFX_FULLSCREEN 1
+#define GFX_FULLWINDOW 2
+
+#define AUTOSCALE_NONE 0
+#define AUTOSCALE_STATIC_AUTO 1
+#define AUTOSCALE_STATIC_NOMINAL 2
+#define AUTOSCALE_STATIC_MAX 3
+#define AUTOSCALE_NORMAL 4
+#define AUTOSCALE_RESIZE 5
+#define AUTOSCALE_CENTER 6
+#define AUTOSCALE_MANUAL 7 // use gfx_xcenter_pos and gfx_ycenter_pos
+#define AUTOSCALE_INTEGER 8
+#define AUTOSCALE_INTEGER_AUTOSCALE 9
+
+#define MONITOREMU_NONE 0
+#define MONITOREMU_AUTO 1
+#define MONITOREMU_A2024 2
+#define MONITOREMU_GRAFFITI 3
+
+#define MAX_FILTERSHADERS 4
+
+#define MAX_CHIPSET_REFRESH 10
+#define MAX_CHIPSET_REFRESH_TOTAL (MAX_CHIPSET_REFRESH + 2)
+#define CHIPSET_REFRESH_PAL (MAX_CHIPSET_REFRESH + 0)
+#define CHIPSET_REFRESH_NTSC (MAX_CHIPSET_REFRESH + 1)
+
+struct chipset_refresh
+{
+ int index;
+ bool locked;
+ bool rtg;
+ int horiz;
+ int vert;
+ int lace;
+ int ntsc;
+ int vsync;
+ int framelength;
+ double rate;
+ TCHAR label[16];
+ TCHAR commands[256];
+};
+
+#define APMODE_NATIVE 0
+#define APMODE_RTG 1
+
+struct apmode
+{
+ int gfx_fullscreen;
+ int gfx_display;
+ int gfx_vsync;
+ // 0 = immediate flip
+ // -1 = wait for flip, before frame ends
+ // 1 = wait for flip, after new frame has started
+ int gfx_vflip;
+ // doubleframemode strobo
+ bool gfx_strobo;
+ int gfx_vsyncmode;
+ int gfx_backbuffers;
+ bool gfx_interlaced;
+ int gfx_refreshrate;
+};
+
+#define MAX_LUA_STATES 16
+
+
+struct gfx_filterdata
+{
+ int gfx_filter;
+ TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
+ TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
+ TCHAR gfx_filteroverlay[MAX_DPATH];
+ struct wh gfx_filteroverlay_pos;
+ int gfx_filteroverlay_overscan;
+ int gfx_filter_scanlines;
+ int gfx_filter_scanlineratio;
+ int gfx_filter_scanlinelevel;
+ float gfx_filter_horiz_zoom, gfx_filter_vert_zoom;
+ float gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
+ float gfx_filter_horiz_offset, gfx_filter_vert_offset;
+ int gfx_filter_filtermode;
+ int gfx_filter_bilinear;
+ int gfx_filter_noise, gfx_filter_blur;
+ int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast, gfx_filter_gamma;
+ int gfx_filter_keep_aspect, gfx_filter_aspect;
+ int gfx_filter_autoscale;
+ int gfx_filter_keep_autoscale_aspect;
+};
+
struct uae_prefs
{
struct strlist* all_lines;
@@ -159,9 +286,26 @@ struct uae_prefs
TCHAR description[256];
TCHAR info[256];
int config_version;
+ TCHAR config_hardware_path[MAX_DPATH];
+ TCHAR config_host_path[MAX_DPATH];
+ TCHAR config_window_title[256];
+ bool illegal_mem;
+ bool use_serial;
+ bool serial_demand;
+ bool serial_hwctsrts;
+ bool serial_direct;
+ int serial_stopbits;
+ bool parallel_demand;
+ int parallel_matrix_emulation;
+ bool parallel_postscript_emulation;
+ bool parallel_postscript_detection;
+ int parallel_autoflush_time;
+ TCHAR ghostscript_parameters[256];
+ bool use_gfxlib;
bool socket_emu;
+ bool start_debugger;
bool start_gui;
int produce_sound;
@@ -169,85 +313,244 @@ struct uae_prefs
int sound_stereo_separation;
int sound_mixed_stereo_delay;
int sound_freq;
+ int sound_maxbsiz;
int sound_interpol;
int sound_filter;
int sound_filter_type;
+ int sound_volume;
int sound_volume_cd;
+ bool sound_stereo_swap_paula;
+ bool sound_stereo_swap_ahi;
+ bool sound_auto;
+
+ int sampler_freq;
+ int sampler_buffer;
+ bool sampler_stereo;
+
+ int comptrustbyte;
+ int comptrustword;
+ int comptrustlong;
+ int comptrustnaddr;
+ bool compnf;
+ bool compfpu;
+ bool comp_midopt;
+ bool comp_lowopt;
+ bool fpu_strict;
+
+ bool comp_hardflush;
+ bool comp_constjump;
+ bool comp_oldsegv;
int cachesize;
int optcount[10];
- int gfx_framerate;
+ bool avoid_cmov;
+
+ int gfx_framerate, gfx_autoframerate;
struct wh gfx_size_win;
struct wh gfx_size_fs;
struct wh gfx_size;
+ struct wh gfx_size_win_xtra[6];
+ struct wh gfx_size_fs_xtra[6];
+ bool gfx_autoresolution_vga;
+ int gfx_autoresolution;
+ int gfx_autoresolution_delay;
+ int gfx_autoresolution_minv, gfx_autoresolution_minh;
+ bool gfx_scandoubler;
+ struct apmode gfx_apmode[2];
int gfx_resolution;
+ int gfx_vresolution;
+ int gfx_lores_mode;
+ int gfx_pscanlines, gfx_iscanlines;
+ int gfx_xcenter, gfx_ycenter;
+ int gfx_xcenter_pos, gfx_ycenter_pos;
+ int gfx_xcenter_size, gfx_ycenter_size;
+ int gfx_max_horizontal, gfx_max_vertical;
+ int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma;
+ bool gfx_blackerthanblack;
+ int gfx_api;
+ int color_mode;
+ int gfx_extrawidth;
+ bool lightboost_strobo;
-#ifdef RASPBERRY
- int gfx_correct_aspect;
- int gfx_fullscreen_ratio;
- int kbd_led_num;
- int kbd_led_scr;
- int kbd_led_cap;
- int scaling_method;
-#endif
+ struct gfx_filterdata gf[2];
+
+ float rtg_horiz_zoom_mult;
+ float rtg_vert_zoom_mult;
bool immediate_blits;
int waiting_blits;
unsigned int chipset_mask;
bool ntscmode;
+ bool genlock;
+ int monitoremu;
double chipset_refreshrate;
+ struct chipset_refresh cr[MAX_CHIPSET_REFRESH + 2];
+ int cr_selected;
int collision_level;
int leds_on_screen;
- int fast_copper;
+ int leds_on_screen_mask[2];
+ struct wh osd_pos;
+ int keyboard_leds[3];
+ bool keyboard_leds_in_use;
+ int scsi;
+ bool sana2;
+ bool uaeserial;
+ int catweasel;
+ int cpu_idle;
+ bool cpu_cycle_exact;
+ int cpu_clock_multiplier;
+ int cpu_frequency;
+ bool blitter_cycle_exact;
int floppy_speed;
int floppy_write_length;
+ int floppy_random_bits_min;
+ int floppy_random_bits_max;
+ int floppy_auto_ext2;
bool tod_hack;
+ uae_u32 maprom;
+ bool rom_readwrite;
+ int turbo_emulation;
+ bool headless;
int filesys_limit;
int filesys_max_name;
+ int filesys_max_file_size;
+ int cs_compatible;
+ int cs_ciaatod;
+ int cs_rtc;
+ int cs_rtc_adjust;
+ int cs_rtc_adjust_mode;
+ bool cs_ksmirror_e0;
+ bool cs_ksmirror_a8;
+ bool cs_ciaoverlay;
bool cs_cd32cd;
bool cs_cd32c2p;
bool cs_cd32nvram;
+ bool cs_cdtvcd;
+ bool cs_cdtvram;
+ int cs_cdtvcard;
+ int cs_ide;
+ bool cs_pcmcia;
+ bool cs_a1000ram;
+ int cs_fatgaryrev;
+ int cs_ramseyrev;
+ int cs_agnusrev;
+ int cs_deniserev;
+ int cs_mbdmac;
+ bool cs_cdtvscsi;
+ bool cs_df0idhw;
+ bool cs_slowmemisfast;
+ bool cs_resetwarning;
+ bool cs_denisenoehb;
+ bool cs_dipagnus;
+ bool cs_agnusbltbusybug;
+ bool cs_ciatodbug;
+ int cs_hacks;
TCHAR romfile[MAX_DPATH];
+ TCHAR romident[256];
TCHAR romextfile[MAX_DPATH];
+ uae_u32 romextfile2addr;
+ TCHAR romextfile2[MAX_DPATH];
+ TCHAR romextident[256];
+ TCHAR a2091romfile[MAX_DPATH];
+ TCHAR a2091romident[256];
+ bool a2091;
+ TCHAR a4091romfile[MAX_DPATH];
+ TCHAR a4091romident[256];
+ bool a4091;
TCHAR flashfile[MAX_DPATH];
+ TCHAR rtcfile[MAX_DPATH];
+ TCHAR cartfile[MAX_DPATH];
+ TCHAR cartident[256];
+ int cart_internal;
+ TCHAR pci_devices[256];
+ TCHAR prtname[256];
+ TCHAR sername[256];
+ TCHAR amaxromfile[MAX_DPATH];
+ TCHAR a2065name[MAX_DPATH];
struct cdslot cdslots[MAX_TOTAL_SCSI_DEVICES];
+ TCHAR quitstatefile[MAX_DPATH];
+ TCHAR statefile[MAX_DPATH];
+ TCHAR inprecfile[MAX_DPATH];
+ bool inprec_autoplay;
- TCHAR path_floppy[256];
- TCHAR path_hardfile[256];
- TCHAR path_rom[256];
- TCHAR path_cd[256];
+ struct multipath path_floppy;
+ struct multipath path_hardfile;
+ struct multipath path_rom;
+ struct multipath path_cd;
int m68k_speed;
+ double m68k_speed_throttle;
int cpu_model;
+ int mmu_model;
+ int cpu060_revision;
int fpu_model;
+ int fpu_revision;
bool cpu_compatible;
+ bool int_no_unimplemented;
+ bool fpu_no_unimplemented;
bool address_space_24;
+ bool picasso96_nocustom;
int picasso96_modeflags;
- uae_u32 z3fastmem_size;
+ uae_u32 z3fastmem_size, z3fastmem2_size;
uae_u32 z3fastmem_start;
- uae_u32 fastmem_size;
+ uae_u32 z3chipmem_size;
+ uae_u32 z3chipmem_start;
+ uae_u32 fastmem_size, fastmem2_size;
+ bool fastmem_autoconfig;
uae_u32 chipmem_size;
uae_u32 bogomem_size;
+ uae_u32 mbresmem_low_size;
+ uae_u32 mbresmem_high_size;
uae_u32 rtgmem_size;
+ bool rtg_hardwareinterrupt;
+ bool rtg_hardwaresprite;
int rtgmem_type;
+ bool rtg_more_compatible;
+ uae_u32 custom_memory_addrs[MAX_CUSTOM_MEMORY_ADDRS];
+ uae_u32 custom_memory_sizes[MAX_CUSTOM_MEMORY_ADDRS];
+
+ bool kickshifter;
+ bool filesys_no_uaefsdb;
+ bool filesys_custom_uaefsdb;
+ bool mmkeyboard;
+ int uae_hide;
+ bool clipboard_sharing;
+ bool native_code;
+ bool uae_hide_autoconfig;
+ bool jit_direct_compatible_memory;
int mountitems;
struct uaedev_config_data mountconfig[MOUNT_CONFIG_SIZE];
int nr_floppies;
struct floppyslot floppyslots[4];
+ bool floppy_read_only;
+ TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH];
+ int dfxclickvolume;
+ int dfxclickchannelmask;
+
+ TCHAR luafiles[MAX_LUA_STATES][MAX_DPATH];
/* Target specific options */
+#ifdef AMIBERRY
+ int gfx_correct_aspect;
+ int gfx_fullscreen_ratio;
+ int kbd_led_num;
+ int kbd_led_scr;
+ int kbd_led_cap;
+ int scaling_method;
int amiberry_customControls;
-
int key_for_menu;
int key_for_quit;
int button_for_menu;
int button_for_quit;
+#endif
+
+ int statecapturerate, statecapturebuffersize;
/* input */
@@ -262,11 +565,17 @@ struct uae_prefs
int input_autofire_linecnt;
int input_mouse_speed;
int input_tablet;
+ bool tablet_library;
+ bool input_magic_mouse;
+ int input_magic_mouse_cursor;
int input_keyboard_type;
struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
+ struct uae_input_device internalevent_settings[MAX_INPUT_SETTINGS][INTERNALEVENT_COUNT];
TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256];
+ int dongle;
+ int input_contact_bounce;
};
extern int config_changed;
@@ -274,67 +583,73 @@ extern void config_check_vsync(void);
extern void set_config_changed(void);
/* Contains the filename of .uaerc */
-extern void cfgfile_write(struct zfile*, const TCHAR* option, const TCHAR* format,...);
-extern void cfgfile_dwrite(struct zfile*, const TCHAR* option, const TCHAR* format,...);
-extern void cfgfile_target_write(struct zfile*, const TCHAR* option, const TCHAR* format,...);
-extern void cfgfile_target_dwrite(struct zfile*, const TCHAR* option, const TCHAR* format,...);
+extern TCHAR optionsfile[];
+extern void save_options(struct zfile *, struct uae_prefs *, int);
-extern void cfgfile_write_bool(struct zfile* f, const TCHAR* option, bool b);
-extern void cfgfile_dwrite_bool(struct zfile* f, const TCHAR* option, bool b);
-extern void cfgfile_target_write_bool(struct zfile* f, const TCHAR* option, bool b);
-extern void cfgfile_target_dwrite_bool(struct zfile* f, const TCHAR* option, bool b);
+extern void cfgfile_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
+extern void cfgfile_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
+extern void cfgfile_target_write(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
+extern void cfgfile_target_dwrite(struct zfile *, const TCHAR *option, const TCHAR *format, ...);
-extern void cfgfile_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
-extern void cfgfile_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
-extern void cfgfile_target_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
-extern void cfgfile_target_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
+extern void cfgfile_write_bool(struct zfile *f, const TCHAR *option, bool b);
+extern void cfgfile_dwrite_bool(struct zfile *f, const TCHAR *option, bool b);
+extern void cfgfile_target_write_bool(struct zfile *f, const TCHAR *option, bool b);
+extern void cfgfile_target_dwrite_bool(struct zfile *f, const TCHAR *option, bool b);
-extern struct uaedev_config_data* add_filesys_config(struct uae_prefs* p, int index, struct uaedev_config_info*);
-extern bool get_hd_geometry(struct uaedev_config_info*);
-extern void uci_set_defaults(struct uaedev_config_info* uci, bool rdb);
+extern void cfgfile_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
+extern void cfgfile_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
+extern void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
+extern void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
+
+extern void cfgfile_backup(const TCHAR *path);
+extern struct uaedev_config_data *add_filesys_config(struct uae_prefs *p, int index, struct uaedev_config_info*);
+extern bool get_hd_geometry(struct uaedev_config_info *);
+extern void uci_set_defaults(struct uaedev_config_info *uci, bool rdb);
extern void error_log(const TCHAR*, ...);
-extern TCHAR* get_error_log(void);
+extern TCHAR *get_error_log(void);
extern bool is_error_log(void);
-extern void default_prefs(struct uae_prefs*, int);
-extern void discard_prefs(struct uae_prefs*, int);
-extern int bip_a500(struct uae_prefs* p, int rom);
-extern int bip_a500plus(struct uae_prefs* p, int rom);
-extern int bip_a1200(struct uae_prefs* p, int rom);
-extern int bip_a2000(struct uae_prefs* p, int rom);
-extern int bip_a4000(struct uae_prefs* p, int rom);
-extern int bip_cd32(struct uae_prefs* p, int rom);
+extern void default_prefs(struct uae_prefs *, int);
+extern void discard_prefs(struct uae_prefs *, int);
-int parse_cmdline_option(struct uae_prefs*, TCHAR, const TCHAR*);
+int parse_cmdline_option(struct uae_prefs *, TCHAR, const TCHAR*);
-extern int cfgfile_yesno(const TCHAR* option, const TCHAR* value, const TCHAR* name, bool* location);
-extern int cfgfile_intval(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location, int scale);
-extern int cfgfile_strval(const TCHAR* option, const TCHAR* value, const TCHAR* name, int* location, const TCHAR* table[], int more);
-extern int cfgfile_string(const TCHAR* option, const TCHAR* value, const TCHAR* name, TCHAR* location, int maxsz);
-extern TCHAR* cfgfile_subst_path(const TCHAR* path, const TCHAR* subst, const TCHAR* file);
+extern int cfgfile_yesno(const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location);
+extern int cfgfile_intval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale);
+extern int cfgfile_strval(const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more);
+extern int cfgfile_string(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz);
+extern TCHAR *cfgfile_subst_path(const TCHAR *path, const TCHAR *subst, const TCHAR *file);
-extern TCHAR* target_expand_environment(const TCHAR* path);
-extern int target_parse_option(struct uae_prefs*, const TCHAR* option, const TCHAR* value);
-extern void target_save_options(struct zfile*, struct uae_prefs*);
-extern void target_default_options(struct uae_prefs*, int type);
-extern void target_fixup_options(struct uae_prefs*);
-extern int target_cfgfile_load(struct uae_prefs*, const TCHAR* filename, int type, int isdefault);
-extern void cfgfile_save_options(struct zfile* f, struct uae_prefs* p, int type);
+extern TCHAR *target_expand_environment(const TCHAR *path);
+extern int target_parse_option(struct uae_prefs *, const TCHAR *option, const TCHAR *value);
+extern void target_save_options(struct zfile*, struct uae_prefs *);
+extern void target_default_options(struct uae_prefs *, int type);
+extern void target_fixup_options(struct uae_prefs *);
+extern int target_cfgfile_load(struct uae_prefs *, const TCHAR *filename, int type, int isdefault);
+extern void cfgfile_save_options(struct zfile *f, struct uae_prefs *p, int type);
+extern int target_get_display(const TCHAR*);
+extern const TCHAR *target_get_display_name(int, bool);
-extern int cfgfile_load(struct uae_prefs* p, const TCHAR* filename, int* type, int ignorelink, int userconfig);
-extern int cfgfile_save(struct uae_prefs* p, const TCHAR* filename, int);
-extern void cfgfile_parse_line(struct uae_prefs* p, TCHAR*, int);
-extern int cfgfile_parse_option(struct uae_prefs* p, TCHAR* option, TCHAR* value, int);
-extern int cfgfile_get_description(const TCHAR* filename, TCHAR* description);
+extern int cfgfile_load(struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
+extern int cfgfile_save(struct uae_prefs *p, const TCHAR *filename, int);
+extern void cfgfile_parse_line(struct uae_prefs *p, TCHAR *, int);
+extern void cfgfile_parse_lines(struct uae_prefs *p, const TCHAR *, int);
+extern int cfgfile_parse_option(struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
+extern int cfgfile_get_description(const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type);
+extern void cfgfile_show_usage(void);
+extern int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize);
extern uae_u32 cfgfile_uaelib(int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);
extern uae_u32 cfgfile_uaelib_modify(uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize);
-extern uae_u32 cfgfile_modify(uae_u32 index, TCHAR* parms, uae_u32 size, TCHAR* out, uae_u32 outsize);
-extern void cfgfile_addcfgparam(TCHAR*);
+extern uae_u32 cfgfile_modify(uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
+extern void cfgfile_addcfgparam(TCHAR *);
+extern int built_in_prefs(struct uae_prefs *p, int model, int config, int compa, int romcheck);
+extern int built_in_chipset_prefs(struct uae_prefs *p);
+extern int cmdlineparser(const TCHAR *s, TCHAR *outp[], int max);
extern int cfgfile_configuration_change(int);
-extern void fixup_prefs_dimensions(struct uae_prefs* prefs);
-extern void fixup_prefs(struct uae_prefs* prefs);
-extern void fixup_cpu(struct uae_prefs* prefs);
+extern void fixup_prefs_dimensions(struct uae_prefs *prefs);
+extern void fixup_prefs(struct uae_prefs *prefs);
+extern void fixup_cpu(struct uae_prefs *prefs);
extern void check_prefs_changed_custom(void);
extern void check_prefs_changed_cpu(void);
diff --git a/src/include/uae.h b/src/include/uae.h
index fb73f950..91f6077e 100644
--- a/src/include/uae.h
+++ b/src/include/uae.h
@@ -15,6 +15,7 @@ extern void start_program (void);
extern void leave_program (void);
extern void real_main (int, TCHAR **);
extern void virtualdevice_init (void);
+extern void usage(void);
extern void sleep_millis (int ms);
extern void sleep_millis_main (int ms);
@@ -59,6 +60,8 @@ struct bstring {
extern void fetch_saveimagepath (TCHAR*, int, int);
extern void fetch_datapath (TCHAR *out, int size);
extern void fetch_rompath (TCHAR *out, int size);
-#define uaerand() rand()
+extern uae_u32 uaerand(void);
+extern uae_u32 uaesrand(uae_u32 seed);
+extern uae_u32 uaerandgetseed(void);
#endif //UAE_UAE_H
diff --git a/src/include/xwin.h b/src/include/xwin.h
index 3b3becf9..5409a438 100644
--- a/src/include/xwin.h
+++ b/src/include/xwin.h
@@ -6,6 +6,7 @@
* Copyright 1995-1997 Bernd Schmidt
*/
+#pragma once
#include "machdep/rpt.h"
typedef uae_u32 xcolnr;
@@ -20,7 +21,8 @@ extern uae_u32 p96_rgbx16[65536];
extern int graphics_setup (void);
extern int graphics_init (bool);
extern void graphics_leave (void);
-
+extern void graphics_reset(void);
+extern bool handle_events(void);
extern int handle_msgpump (void);
extern void setup_brkhandler (void);
extern bool vsync_switchmode (int);
@@ -43,6 +45,64 @@ extern void alloc_colors64k (int, int, int, int, int, int, int);
extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt);
extern double getvsyncrate(double hz, int *mult);
+/* The graphics code has a choice whether it wants to use a large buffer
+* for the whole display, or only a small buffer for a single line.
+* If you use a large buffer:
+* - set bufmem to point at it
+* - set linemem to 0
+* - if memcpy within bufmem would be very slow, i.e. because bufmem is
+* in graphics card memory, also set emergmem to point to a buffer
+* that is large enough to hold a single line.
+* - implement flush_line to be a no-op.
+* If you use a single line buffer:
+* - set bufmem and emergmem to 0
+* - set linemem to point at your buffer
+* - implement flush_line to copy a single line to the screen
+*/
+struct vidbuffer
+{
+ /* Function implemented by graphics driver */
+ void(*flush_line) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb, int line_no);
+ void(*flush_block) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb, int first_line, int end_line);
+ void(*flush_screen) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb, int first_line, int end_line);
+ void(*flush_clear_screen) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb);
+ int(*lockscr) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb);
+ void(*unlockscr) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb);
+ uae_u8 *linemem;
+ uae_u8 *emergmem;
+
+ uae_u8 *bufmem, *bufmemend;
+ uae_u8 *realbufmem;
+ uae_u8 *bufmem_allocated;
+ bool bufmem_lockable;
+ int rowbytes; /* Bytes per row in the memory pointed at by bufmem. */
+ int pixbytes; /* Bytes per pixel. */
+ /* size of this buffer */
+ int width_allocated;
+ int height_allocated;
+ /* size of max visible image */
+ int outwidth;
+ int outheight;
+ /* nominal size of image for centering */
+ int inwidth;
+ int inheight;
+ /* same but doublescan multiplier included */
+ int inwidth2;
+ int inheight2;
+ /* use drawbuffer instead */
+ bool nativepositioning;
+ /* tempbuffer in use */
+ bool tempbufferinuse;
+ /* extra width, chipset hpos extra in right border */
+ int extrawidth;
+
+ int xoffset; /* superhires pixels from left edge */
+ int yoffset; /* lines from top edge */
+
+ int inxoffset; /* positive if sync positioning */
+ int inyoffset;
+};
+
extern int max_uae_width, max_uae_height;
struct vidbuf_description
diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp
index bbbd0727..f549867f 100644
--- a/src/inputdevice.cpp
+++ b/src/inputdevice.cpp
@@ -2092,6 +2092,10 @@ void inputdevice_hsync(void)
static int cnt;
cap_check();
+#ifdef CATWEASEL
+ catweasel_hsync();
+#endif
+
for (int i = 0; i < INPUT_QUEUE_SIZE; i++)
{
struct input_queue_struct* iq = &input_queue[i];
@@ -2304,7 +2308,7 @@ void inputdevice_do_keyboard(int code, int state)
{
uae_u8 key = code | (state ? 0x00 : 0x80);
keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1;
- if (record_key((uae_u8)((key << 1) | (key >> 7))))
+ if (record_key(uae_u8((key << 1) | (key >> 7))))
{
}
return;
@@ -5121,6 +5125,29 @@ int inputdevice_iskeymapped(int keyboard, int scancode)
return scancodeused[keyboard][scancode];
}
+int inputdevice_synccapslock(int oldcaps, int *capstable)
+{
+ struct uae_input_device *na = &keyboards[0];
+ int j, i;
+
+ if (!keyboards)
+ return -1;
+ for (j = 0; na->extra[j]; j++) {
+ if (na->extra[j] == INPUTEVENT_KEY_CAPS_LOCK) {
+ for (i = 0; capstable[i]; i += 2) {
+ if (na->extra[j] == capstable[i]) {
+ if (oldcaps != capstable[i + 1]) {
+ oldcaps = capstable[i + 1];
+ inputdevice_translatekeycode(0, capstable[i], oldcaps ? -1 : 0);
+ }
+ return i;
+ }
+ }
+ }
+ }
+ return -1;
+}
+
static void rqualifiers(uae_u64 flags, bool release)
{
uae_u64 mask = ID_FLAG_QUALIFIER1 << 1;
@@ -5238,6 +5265,23 @@ static int inputdevice_translatekeycode_2(int keyboard, int scancode, int keysta
continue;
}
+ // if evt == caps and scan == caps: sync with native caps led
+ if (evt == INPUTEVENT_KEY_CAPS_LOCK) {
+ int v;
+ if (state < 0)
+ state = 1;
+ v = target_checkcapslock(scancode, &state);
+ if (v < 0)
+ continue;
+#ifndef INPUTDEVICE_SIMPLE
+ if (v > 0)
+ toggle = 0;
+#endif
+ }
+ else if (state < 0) {
+ // it was caps lock resync, ignore, not mapped to caps
+ continue;
+ }
#ifndef INPUTDEVICE_SIMPLE
if (!state) {
didcustom |= process_custom_event (na, j, state, qualmask, autofire, k);
diff --git a/src/main.cpp b/src/main.cpp
index 3b0d4e81..4d261584 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -9,6 +9,7 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include
+
#include "options.h"
#include "threaddep/thread.h"
#include "uae.h"
@@ -38,6 +39,7 @@
#ifdef JIT
#include "jit/compemu.h"
#endif
+
#ifdef USE_SDL
#include "SDL.h"
#include
@@ -48,25 +50,52 @@ SDL_Texture* texture;
SDL_DisplayMode sdlMode;
#endif
-#ifdef CAPSLOCK_DEBIAN_WORKAROUND
#include
#include
#include "keyboard.h"
-#endif
long int version = 256 * 65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV;
struct uae_prefs currprefs, changed_prefs;
int config_changed;
-bool no_gui = false;
+bool no_gui = false, quit_to_gui = false;
bool cloanto_rom = false;
bool kickstart_rom = true;
+bool console_emulation = false;
struct gui_info gui_data;
+TCHAR warning_buffer[256];
+
TCHAR optionsfile[256];
+static uae_u32 randseed;
+static int oldhcounter;
+
+uae_u32 uaesrand(uae_u32 seed)
+{
+ oldhcounter = -1;
+ randseed = seed;
+ //randseed = 0x12345678;
+ //write_log (_T("seed=%08x\n"), randseed);
+ return randseed;
+}
+uae_u32 uaerand()
+{
+ if (oldhcounter != hsync_counter) {
+ srand(hsync_counter ^ randseed);
+ oldhcounter = hsync_counter;
+ }
+ uae_u32 r = rand();
+ //write_log (_T("rand=%08x\n"), r);
+ return r;
+}
+uae_u32 uaerandgetseed()
+{
+ return randseed;
+}
+
void my_trim(TCHAR *s)
{
int len;
@@ -105,19 +134,20 @@ void discard_prefs(struct uae_prefs *p, int type)
}
#ifdef FILESYS
filesys_cleanup();
- p->mountitems = 0;
#endif
}
static void fixup_prefs_dim2(struct wh *wh)
{
- if (wh->width < 320) {
- error_log(_T("Width (%d) must be at least 320."), wh->width);
- wh->width = 320;
+ if (wh->special)
+ return;
+ if (wh->width < 160) {
+ error_log(_T("Width (%d) must be at least 128."), wh->width);
+ wh->width = 160;
}
- if (wh->height < 200) {
- error_log(_T("Height (%d) must be at least 200."), wh->height);
- wh->height = 200;
+ if (wh->height < 128) {
+ error_log(_T("Height (%d) must be at least 128."), wh->height);
+ wh->height = 128;
}
if (wh->width > max_uae_width) {
error_log(_T("Width (%d) max is %d."), wh->width, max_uae_width);
@@ -133,15 +163,56 @@ void fixup_prefs_dimensions(struct uae_prefs *prefs)
{
fixup_prefs_dim2(&prefs->gfx_size_fs);
fixup_prefs_dim2(&prefs->gfx_size_win);
+ if (prefs->gfx_apmode[1].gfx_vsync)
+ prefs->gfx_apmode[1].gfx_vsyncmode = 1;
+
+ for (int i = 0; i < 2; i++) {
+ struct apmode *ap = &prefs->gfx_apmode[i];
+ ap->gfx_vflip = 0;
+ ap->gfx_strobo = false;
+ if (ap->gfx_vsync) {
+ if (ap->gfx_vsyncmode) {
+ // low latency vsync: no flip only if no-buffer
+ if (ap->gfx_backbuffers >= 1)
+ ap->gfx_vflip = 1;
+ if (!i && ap->gfx_backbuffers == 2)
+ ap->gfx_vflip = 1;
+ ap->gfx_strobo = prefs->lightboost_strobo;
+ }
+ else {
+ // legacy vsync: always wait for flip
+ ap->gfx_vflip = -1;
+ if (prefs->gfx_api && ap->gfx_backbuffers < 1)
+ ap->gfx_backbuffers = 1;
+ if (ap->gfx_vflip)
+ ap->gfx_strobo = prefs->lightboost_strobo;;
+ }
+ }
+ else {
+ // no vsync: wait if triple bufferirng
+ if (ap->gfx_backbuffers >= 2)
+ ap->gfx_vflip = -1;
+ }
+ if (prefs->gf[i].gfx_filter == 0 && ((prefs->gf[i].gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode))) {
+ prefs->gf[i].gfx_filter = 1;
+ }
+ if (i == 0 && prefs->gf[i].gfx_filter == 0 && prefs->monitoremu) {
+ error_log(_T("A2024 and Graffiti require at least null filter enabled."));
+ prefs->gf[i].gfx_filter = 1;
+ }
+ }
}
void fixup_cpu(struct uae_prefs *p)
{
+ if (p->cpu_frequency == 1000000)
+ p->cpu_frequency = 0;
+
if (p->cpu_model >= 68030 && p->address_space_24) {
error_log(_T("24-bit address space is not supported in 68030/040/060 configurations."));
p->address_space_24 = false;
}
- if (p->cpu_model < 68020 && p->fpu_model && (p->cpu_compatible)) {
+ if (p->cpu_model < 68020 && p->fpu_model && (p->cpu_compatible || p->cpu_cycle_exact)) {
error_log(_T("FPU is not supported in 68000/010 configurations."));
p->fpu_model = 0;
}
@@ -162,15 +233,52 @@ void fixup_cpu(struct uae_prefs *p)
if (p->fpu_model)
p->fpu_model = 68040;
break;
+ case 68060:
+ if (p->fpu_model)
+ p->fpu_model = 68060;
+ break;
+ }
+
+ if (p->cpu_model < 68020 && p->cachesize) {
+ p->cachesize = 0;
+ error_log(_T("JIT requires 68020 or better CPU."));
}
if (p->cpu_model >= 68040 && p->cachesize && p->cpu_compatible)
p->cpu_compatible = false;
+ if (p->cpu_model >= 68040 && p->cpu_cycle_exact) {
+ p->cpu_cycle_exact = false;
+ error_log(_T("68040/060 cycle-exact is not supported."));
+ }
+
+ if ((p->cpu_model < 68030 || p->cachesize) && p->mmu_model) {
+ error_log(_T("MMU emulation requires 68030/040/060 and it is not JIT compatible."));
+ p->mmu_model = 0;
+ }
+
+ if (p->cachesize && p->cpu_cycle_exact) {
+ error_log(_T("JIT and cycle-exact can't be enabled simultaneously."));
+ p->cachesize = 0;
+ }
+ if (p->cachesize && (p->fpu_no_unimplemented || p->int_no_unimplemented)) {
+ error_log(_T("JIT is not compatible with unimplemented CPU/FPU instruction emulation."));
+ p->fpu_no_unimplemented = p->int_no_unimplemented = false;
+ }
+
+ if (p->cpu_cycle_exact && p->m68k_speed < 0)
+ p->m68k_speed = 0;
+
+ if (p->immediate_blits && p->blitter_cycle_exact) {
+ error_log(_T("Cycle-exact and immediate blitter can't be enabled simultaneously.\n"));
+ p->immediate_blits = false;
+ }
if (p->immediate_blits && p->waiting_blits) {
error_log(_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n"));
p->waiting_blits = 0;
}
+ if (p->cpu_cycle_exact)
+ p->cpu_compatible = true;
}
@@ -178,38 +286,38 @@ void fixup_prefs(struct uae_prefs *p)
{
int err = 0;
+ built_in_chipset_prefs(p);
fixup_cpu(p);
if (((p->chipmem_size & (p->chipmem_size - 1)) != 0 && p->chipmem_size != 0x180000)
- || p->chipmem_size < 0x20000
- || p->chipmem_size > 0x800000)
+ || p->chipmem_size < 0x20000
+ || p->chipmem_size > 0x800000)
{
error_log(_T("Unsupported chipmem size %d (0x%x)."), p->chipmem_size, p->chipmem_size);
p->chipmem_size = 0x200000;
err = 1;
}
-
if ((p->fastmem_size & (p->fastmem_size - 1)) != 0
- || (p->fastmem_size != 0 && (p->fastmem_size < 0x100000 || p->fastmem_size > 0x800000)))
+ || (p->fastmem_size != 0 && (p->fastmem_size < 0x100000 || p->fastmem_size > 0x800000)))
{
error_log(_T("Unsupported fastmem size %d (0x%x)."), p->fastmem_size, p->fastmem_size);
p->fastmem_size = 0;
err = 1;
}
- if (p->rtgmem_size > 0x1000000 && p->rtgmem_type == GFXBOARD_UAE_Z3) {
- error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), p->rtgmem_size, p->rtgmem_size, 0x1000000, 0x1000000);
- p->rtgmem_size = 0x1000000;
+ if (p->rtgmem_size > max_z3fastmem && p->rtgmem_type == GFXBOARD_UAE_Z3) {
+ error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), p->rtgmem_size, p->rtgmem_size, max_z3fastmem, max_z3fastmem);
+ p->rtgmem_size = max_z3fastmem;
err = 1;
}
if ((p->rtgmem_size & (p->rtgmem_size - 1)) != 0 || (p->rtgmem_size != 0 && (p->rtgmem_size < 0x100000))) {
error_log(_T("Unsupported graphics card memory size %d (0x%x)."), p->rtgmem_size, p->rtgmem_size);
- if (p->rtgmem_size > 0x1000000)
- p->rtgmem_size = 0x1000000;
+ if (p->rtgmem_size > max_z3fastmem)
+ p->rtgmem_size = max_z3fastmem;
else
p->rtgmem_size = 0;
err = 1;
}
-
+
if (p->z3fastmem_size > max_z3fastmem) {
error_log(_T("Zorro III fastmem size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3fastmem_size, p->z3fastmem_size, max_z3fastmem, max_z3fastmem);
p->z3fastmem_size = max_z3fastmem;
@@ -222,12 +330,36 @@ void fixup_prefs(struct uae_prefs *p)
err = 1;
}
+ if (p->z3fastmem2_size > max_z3fastmem) {
+ error_log(_T("Zorro III fastmem2 size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3fastmem2_size, p->z3fastmem2_size, max_z3fastmem, max_z3fastmem);
+ p->z3fastmem2_size = max_z3fastmem;
+ err = 1;
+ }
+ if ((p->z3fastmem2_size & (p->z3fastmem2_size - 1)) != 0 || (p->z3fastmem2_size != 0 && p->z3fastmem2_size < 0x100000))
+ {
+ error_log(_T("Unsupported Zorro III fastmem2 size %x (%x)."), p->z3fastmem2_size, p->z3fastmem2_size);
+ p->z3fastmem2_size = 0;
+ err = 1;
+ }
+
p->z3fastmem_start &= ~0xffff;
if (p->z3fastmem_start < 0x1000000)
p->z3fastmem_start = 0x1000000;
-
- if (p->address_space_24 && (p->z3fastmem_size != 0)) {
- p->z3fastmem_size = 0;
+
+ if (p->z3chipmem_size > max_z3fastmem) {
+ error_log(_T("Zorro III fake chipmem size %d (0x%x) larger than max reserved %d (0x%x)."), p->z3chipmem_size, p->z3chipmem_size, max_z3fastmem, max_z3fastmem);
+ p->z3chipmem_size = max_z3fastmem;
+ err = 1;
+}
+ if ((p->z3chipmem_size & (p->z3chipmem_size - 1)) != 0 || (p->z3chipmem_size != 0 && p->z3chipmem_size < 0x100000))
+ {
+ error_log(_T("Unsupported Zorro III fake chipmem size %d (0x%x)."), p->z3chipmem_size, p->z3chipmem_size);
+ p->z3chipmem_size = 0;
+ err = 1;
+ }
+
+ if (p->address_space_24 && (p->z3fastmem_size != 0 || p->z3fastmem2_size != 0 || p->z3chipmem_size != 0)) {
+ p->z3fastmem_size = p->z3fastmem2_size = p->z3chipmem_size = 0;
error_log(_T("Can't use a Z3 graphics card or 32-bit memory when using a 24 bit address space."));
}
@@ -237,7 +369,7 @@ void fixup_prefs(struct uae_prefs *p)
err = 1;
}
- if (p->bogomem_size > 0x180000 && ((p->chipset_mask & CSMASK_AGA) || p->cpu_model >= 68020)) {
+ if (p->bogomem_size > 0x180000 && (p->cs_fatgaryrev >= 0 || p->cs_ide || p->cs_ramseyrev >= 0)) {
p->bogomem_size = 0x180000;
error_log(_T("Possible Gayle bogomem conflict fixed."));
}
@@ -246,7 +378,24 @@ void fixup_prefs(struct uae_prefs *p)
p->fastmem_size = 0;
err = 1;
}
+ if (p->mbresmem_low_size > 0x04000000 || (p->mbresmem_low_size & 0xfffff)) {
+ p->mbresmem_low_size = 0;
+ error_log(_T("Unsupported A3000 MB RAM size"));
+ }
+ if (p->mbresmem_high_size > 0x08000000 || (p->mbresmem_high_size & 0xfffff)) {
+ p->mbresmem_high_size = 0;
+ error_log(_T("Unsupported Motherboard RAM size."));
+ }
+ if (p->rtgmem_type >= GFXBOARD_HARDWARE) {
+ /*if (p->rtgmem_size < gfxboard_get_vram_min(p->rtgmem_type))
+ p->rtgmem_size = gfxboard_get_vram_min(p->rtgmem_type);*/
+ if (p->address_space_24 && gfxboard_is_z3(p->rtgmem_type)) {
+ p->rtgmem_type = GFXBOARD_UAE_Z2;
+ p->rtgmem_size = 0;
+ error_log(_T("Z3 RTG and 24-bit address space are not compatible."));
+ }
+ }
if (p->address_space_24 && p->rtgmem_size && p->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log(_T("Z3 RTG and 24bit address space are not compatible."));
p->rtgmem_type = GFXBOARD_UAE_Z2;
@@ -261,14 +410,36 @@ void fixup_prefs(struct uae_prefs *p)
p->produce_sound = 0;
err = 1;
}
+ if (p->comptrustbyte < 0 || p->comptrustbyte > 3) {
+ error_log(_T("Bad value for comptrustbyte parameter: value must be within 0..2."));
+ p->comptrustbyte = 1;
+ err = 1;
+ }
+ if (p->comptrustword < 0 || p->comptrustword > 3) {
+ error_log(_T("Bad value for comptrustword parameter: value must be within 0..2."));
+ p->comptrustword = 1;
+ err = 1;
+ }
+ if (p->comptrustlong < 0 || p->comptrustlong > 3) {
+ error_log(_T("Bad value for comptrustlong parameter: value must be within 0..2."));
+ p->comptrustlong = 1;
+ err = 1;
+ }
+ if (p->comptrustnaddr < 0 || p->comptrustnaddr > 3) {
+ error_log(_T("Bad value for comptrustnaddr parameter: value must be within 0..2."));
+ p->comptrustnaddr = 1;
+ err = 1;
+ }
if (p->cachesize < 0 || p->cachesize > 16384) {
error_log(_T("Bad value for cachesize parameter: value must be within 0..16384."));
p->cachesize = 0;
err = 1;
}
- if (p->z3fastmem_size && (p->address_space_24 || p->cpu_model < 68020)) {
+ if ((p->z3fastmem_size || p->z3fastmem2_size || p->z3chipmem_size) && (p->address_space_24 || p->cpu_model < 68020)) {
error_log(_T("Z3 fast memory can't be used with a 68000/68010 emulation. Turning off Z3 fast memory."));
p->z3fastmem_size = 0;
+ p->z3fastmem2_size = 0;
+ p->z3chipmem_size = 0;
err = 1;
}
if (p->rtgmem_size > 0 && p->rtgmem_type == GFXBOARD_UAE_Z3 && (p->cpu_model < 68020 || p->address_space_24)) {
@@ -276,6 +447,7 @@ void fixup_prefs(struct uae_prefs *p)
p->rtgmem_size = 0;
err = 1;
}
+
#if !defined (BSDSOCKET)
if (p->socket_emu) {
write_log(_T("Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n"));
@@ -293,16 +465,46 @@ void fixup_prefs(struct uae_prefs *p)
p->floppyslots[3].dfxtype = -1;
err = 1;
}
-
if (p->floppy_speed > 0 && p->floppy_speed < 10) {
error_log(_T("Invalid floppy speed."));
p->floppy_speed = 100;
}
+ if (p->input_mouse_speed < 1 || p->input_mouse_speed > 1000) {
+ error_log(_T("Invalid mouse speed."));
+ p->input_mouse_speed = 100;
+ }
if (p->collision_level < 0 || p->collision_level > 3) {
error_log(_T("Invalid collision support level. Using 1."));
p->collision_level = 1;
err = 1;
}
+ if (p->parallel_postscript_emulation)
+ p->parallel_postscript_detection = true;
+ if (p->cs_compatible == 1) {
+ p->cs_fatgaryrev = p->cs_ramseyrev = p->cs_mbdmac = -1;
+ p->cs_ide = 0;
+ if (p->cpu_model >= 68020) {
+ p->cs_fatgaryrev = 0;
+ p->cs_ide = -1;
+ p->cs_ramseyrev = 0x0f;
+ p->cs_mbdmac = 0;
+ }
+ }
+ else if (p->cs_compatible == 0) {
+ if (p->cs_ide == IDE_A4000) {
+ if (p->cs_fatgaryrev < 0)
+ p->cs_fatgaryrev = 0;
+ if (p->cs_ramseyrev < 0)
+ p->cs_ramseyrev = 0x0f;
+ }
+ }
+ /* Can't fit genlock and A2024 or Graffiti at the same time,
+ * also Graffiti uses genlock audio bit as an enable signal
+ */
+ if (p->genlock && p->monitoremu) {
+ error_log(_T("Genlock and A2024 or Graffiti can't be active simultaneously."));
+ p->genlock = false;
+ }
fixup_prefs_dimensions(p);
@@ -313,6 +515,17 @@ void fixup_prefs(struct uae_prefs *p)
p->cpu_model = 68000;
p->fpu_model = 0;
#endif
+#ifndef CPUEMU_0
+ p->cpu_compatible = 1;
+ p->address_space_24 = 1;
+#endif
+#if !defined (CPUEMU_11) && !defined (CPUEMU_13)
+ p->cpu_compatible = 0;
+ p->address_space_24 = 0;
+#endif
+#if !defined (CPUEMU_13)
+ p->cpu_cycle_exact = p->blitter_cycle_exact = false;
+#endif
#ifndef AGA
p->chipset_mask &= ~CSMASK_AGA;
#endif
@@ -324,7 +537,40 @@ void fixup_prefs(struct uae_prefs *p)
#if !defined (BSDSOCKET)
p->socket_emu = 0;
#endif
+#if !defined (SCSIEMU)
+ p->scsi = 0;
+#endif
+#if !defined (SANA2)
+ p->sana2 = false;
+#endif
+#if !defined (UAESERIAL)
+ p->uaeserial = false;
+#endif
+#if defined (CPUEMU_13)
+ if (p->cpu_cycle_exact) {
+ if (p->gfx_framerate > 1) {
+ error_log(_T("Cycle-exact requires disabled frameskip."));
+ p->gfx_framerate = 1;
+ }
+ if (p->cachesize) {
+ error_log(_T("Cycle-exact and JIT can't be active simultaneously."));
+ p->cachesize = 0;
+ }
+ if (p->m68k_speed) {
+ error_log(_T("Adjustable CPU speed is not available in cycle-exact mode."));
+ p->m68k_speed = 0;
+ }
+ }
+#endif
+ if (p->maprom && !p->address_space_24)
+ p->maprom = 0x0f000000;
+ if (((p->maprom & 0xff000000) && p->address_space_24) || p->mbresmem_high_size == 0x08000000) {
+ p->maprom = 0x00e00000;
+ }
+ if (p->tod_hack && p->cs_ciaatod == 0)
+ p->cs_ciaatod = p->ntscmode ? 2 : 1;
+ built_in_chipset_prefs(p);
blkdev_fix_prefs(p);
target_fixup_options(p);
}
@@ -336,6 +582,8 @@ static int default_config;
void uae_reset(int hardreset, int keyboardreset)
{
+ currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0;
+
if (quit_program == 0) {
quit_program = -UAE_RESET;
if (keyboardreset)
@@ -349,7 +597,6 @@ void uae_quit()
{
if (quit_program != -UAE_QUIT) {
quit_program = -UAE_QUIT;
- regs.spcflags |= SPCFLAG_MODE_CHANGE;
}
target_quit();
}
@@ -371,6 +618,10 @@ void uae_restart(int opengui, const TCHAR *cfgfile)
target_restart();
}
+void usage()
+{
+}
+
static void parse_cmdline_2(int argc, TCHAR **argv)
{
int i;
@@ -389,6 +640,40 @@ static void parse_cmdline_2(int argc, TCHAR **argv)
}
}
+static int diskswapper_cb(struct zfile *f, void *vrsd)
+{
+ int *num = static_cast(vrsd);
+ if (*num >= MAX_SPARE_DRIVES)
+ return 1;
+ if (zfile_gettype(f) == ZFILE_DISKIMAGE) {
+ _tcsncpy(currprefs.dfxlist[*num], zfile_getname(f), 255);
+ (*num)++;
+ }
+ return 0;
+}
+
+static void parse_diskswapper(const TCHAR *s)
+{
+ TCHAR *tmp = my_strdup(s);
+ TCHAR *delim = _T(",");
+ TCHAR *p1, *p2;
+ int num = 0;
+
+ p1 = tmp;
+ for (;;) {
+ p2 = strtok(p1, delim);
+ if (!p2)
+ break;
+ p1 = nullptr;
+ if (num >= MAX_SPARE_DRIVES)
+ break;
+ if (!zfile_zopen(p2, diskswapper_cb, &num)) {
+ _tcsncpy(currprefs.dfxlist[num], p2, 255);
+ num++;
+ }
+ }
+ free(tmp);
+}
static TCHAR *parsetext(const TCHAR *s)
{
@@ -417,40 +702,20 @@ static TCHAR *parsetextpath(const TCHAR *s)
return s3;
}
-void print_usage()
-{
- printf("\nUsage:\n");
- printf(" -f Load a configuration file.\n");
- printf(" -config= Load a configuration file.\n");
- printf(" -statefile= Load a save state file.\n");
- printf(" -s = Set the configuration parameter with value.\n");
- printf(" Edit a configuration file in order to know valid parameters and settings.\n");
- printf("\nAdditional options:\n");
- printf(" -0 Set adf for drive 0.\n");
- printf(" -1 Set adf for drive 1.\n");
- printf(" -2 Set adf for drive 2.\n");
- printf(" -3 Set adf for drive 3.\n");
- printf(" -r Set kickstart rom file.\n");
- printf(" -G Start directly into emulation.\n");
- printf(" -c Size of chip memory (in number of 512 KBytes chunks).\n");
- printf(" -F Size of fast memory (in number of 1024 KBytes chunks).\n");
- printf("\nNote:\n");
- printf("Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used.\n");
- printf("File names should be with absolute path.\n");
- printf("\nExample:\n");
- printf("uae4arm -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n");
- printf("It will load A500.uae configuration with the save state named game.\n");
- printf("It will override use_gui to 'no' so that it enters emulation directly.\n");
- exit(1);
-}
-
-
static void parse_cmdline(int argc, TCHAR **argv)
{
int i;
for (i = 1; i < argc; i++) {
- if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
+ if (!_tcsncmp(argv[i], _T("-diskswapper="), 13)) {
+ TCHAR *txt = parsetextpath(argv[i] + 13);
+ parse_diskswapper(txt);
+ xfree(txt);
+ }
+ else if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) {
+ ;
+ }
+ else if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
if (i + 1 < argc)
i++;
}
@@ -467,7 +732,7 @@ static void parse_cmdline(int argc, TCHAR **argv)
xfree(txt);
}
else if (_tcscmp(argv[i], _T("-f")) == 0) {
- /* Check for new-style "-f xxx" argument, where xxx is config-file */
+ /* Check for new-style "-f xxx" argument, where xxx is config-file */
if (i + 1 == argc) {
write_log(_T("Missing argument for '-f' option.\n"));
}
@@ -484,24 +749,29 @@ static void parse_cmdline(int argc, TCHAR **argv)
else
cfgfile_parse_line(&currprefs, argv[++i], 0);
}
+ else if (_tcscmp(argv[i], _T("-h")) == 0 || _tcscmp(argv[i], _T("-help")) == 0) {
+ usage();
+ exit(0);
+ }
+ else if (_tcsncmp(argv[i], _T("-cdimage="), 9) == 0) {
+ TCHAR *txt = parsetextpath(argv[i] + 9);
+ TCHAR *txt2 = xmalloc(TCHAR, _tcslen(txt) + 2);
+ _tcscpy(txt2, txt);
+ if (_tcsrchr(txt2, ',') != NULL)
+ _tcscat(txt2, _T(","));
+ cfgfile_parse_option(&currprefs, _T("cdimage0"), txt2, 0);
+ xfree(txt2);
+ xfree(txt);
+ }
else {
- if (argv[i][0] == '-' && argv[i][1] != '\0' && argv[i][2] == '\0') {
- int ret;
+ if (argv[i][0] == '-' && argv[i][1] != '\0') {
const TCHAR *arg = argv[i] + 2;
int extra_arg = *arg == '\0';
if (extra_arg)
arg = i + 1 < argc ? argv[i + 1] : 0;
- ret = parse_cmdline_option(&currprefs, argv[i][1], arg);
- if (ret == -1)
- print_usage();
- if (ret && extra_arg)
+ if (parse_cmdline_option(&currprefs, argv[i][1], arg) && extra_arg)
i++;
}
- else
- {
- printf("Unknown option %s\n", argv[i]);
- print_usage();
- }
}
}
}
@@ -529,10 +799,24 @@ void reset_all_systems()
#ifdef PICASSO96
picasso_reset();
#endif
+#ifdef SCSIEMU
+ scsi_reset();
+ scsidev_reset();
+ scsidev_start_threads();
+#endif
+#ifdef A2065
+ a2065_reset();
+#endif
+#ifdef SANA2
+ netdev_reset();
+ netdev_start_threads();
+#endif
#ifdef FILESYS
filesys_prepare_reset();
filesys_reset();
#endif
+ //TODO
+ //init_shm();
memory_reset();
#if defined (BSDSOCKET)
bsdlib_reset();
@@ -540,8 +824,17 @@ void reset_all_systems()
#ifdef FILESYS
filesys_start_threads();
hardfile_reset();
+#endif
+#ifdef UAESERIAL
+ uaeserialdev_reset();
+ uaeserialdev_start_threads();
+#endif
+#if defined (PARALLEL_PORT)
+ initparallel();
#endif
native2amiga_reset();
+ //dongle_reset();
+ //sampler_init();
}
/* Okay, this stuff looks strange, but it is here to encourage people who
@@ -557,10 +850,14 @@ void do_start_program()
{
if (quit_program == -UAE_QUIT)
return;
- /* Do a reset on startup. Whether this is elegant is debatable. */
+
+ /* Do a reset on startup. Whether this is elegant is debatable. */
inputdevice_updateconfig(&changed_prefs, &currprefs);
if (quit_program >= 0)
quit_program = UAE_RESET;
+#ifdef WITH_LUA
+ uae_lua_loadall();
+#endif
m68k_go(1);
}
@@ -569,15 +866,30 @@ void do_leave_program()
#ifdef JIT
compiler_exit();
#endif
+ //sampler_free ();
graphics_leave();
inputdevice_close();
DISK_free();
close_sound();
dump_counts();
-#ifdef CD32
+#ifdef SERIAL_PORT
+ serial_exit();
+#endif
+#ifdef CDTV
+ cdtv_free();
+#endif
+#ifdef A2091
+ a2091_free();
+ a3000scsi_free();
+#endif
+#ifdef NCR
+ ncr_free();
+#endif
+ #ifdef CD32
akiko_free();
#endif
- gui_exit();
+ if (!no_gui)
+ gui_exit();
#ifdef USE_SDL
SDL_Quit();
#endif
@@ -592,7 +904,12 @@ void do_leave_program()
bsdlib_reset();
#endif
device_func_reset();
+#ifdef WITH_LUA
+ uae_lua_free();
+#endif
memory_cleanup();
+ //TODO
+ //free_shm();
cfgfile_addcfgparam(nullptr);
machdep_free();
}
@@ -627,6 +944,16 @@ void virtualdevice_init()
uaeres_install();
hardfile_install();
#endif
+#ifdef SCSIEMU
+ scsi_reset();
+ scsidev_install();
+#endif
+#ifdef SANA2
+ netdev_install();
+#endif
+#ifdef UAESERIAL
+ uaeserialdev_install();
+#endif
#ifdef AUTOCONFIG
expansion_init();
emulib_install();
@@ -637,6 +964,12 @@ void virtualdevice_init()
#if defined (BSDSOCKET)
bsdlib_install();
#endif
+#ifdef WITH_UAENATIVE
+ uaenative_install();
+#endif
+#ifdef WITH_TABLETLIBRARY
+ tabletlib_install();
+#endif
}
// In case of error, print the error code and close the application
@@ -650,9 +983,11 @@ void check_error_sdl(bool check, const char* message) {
static int real_main2 (int argc, TCHAR **argv)
{
+ printf("Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas\n");
+
SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengles2");
- 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());
@@ -675,8 +1010,7 @@ static int real_main2 (int argc, TCHAR **argv)
SDL_Log("Could not get information about SDL Mode! SDL_Error: %s\n", SDL_GetError());
}
- keyboard_settrans();
-
+ set_config_changed();
if (restart_config[0]) {
default_prefs(&currprefs, 0);
fixup_prefs(&currprefs);
@@ -713,6 +1047,7 @@ static int real_main2 (int argc, TCHAR **argv)
if (!no_gui) {
int err = gui_init();
currprefs = changed_prefs;
+ set_config_changed();
if (err == -1) {
write_log(_T("Failed to initialize the GUI\n"));
return -1;
@@ -721,25 +1056,32 @@ static int real_main2 (int argc, TCHAR **argv)
return 1;
}
}
- else
- {
- update_display(&currprefs);
- }
memset(&gui_data, 0, sizeof gui_data);
gui_data.cd = -1;
gui_data.hd = -1;
+ gui_data.md = -1;
+#ifdef NATMEM_OFFSET
+ init_shm();
+#endif
+#ifdef WITH_LUA
+ uae_lua_init();
+#endif
#ifdef PICASSO96
picasso_reset();
#endif
fixup_prefs(&currprefs);
+#ifdef RETROPLATFORM
+ rp_fixup_options(&currprefs);
+#endif
changed_prefs = currprefs;
target_run();
/* force sound settings change */
currprefs.produce_sound = 0;
+ //savestate_init();
keybuf_init(); /* Must come after init_joystick */
memory_hardreset(2);
@@ -750,6 +1092,9 @@ static int real_main2 (int argc, TCHAR **argv)
#endif
custom_init(); /* Must come after memory_init */
+#ifdef SERIAL_PORT
+ serial_init();
+#endif
DISK_init();
reset_frame_rate_hack();
@@ -774,14 +1119,17 @@ static int real_main2 (int argc, TCHAR **argv)
void real_main(int argc, TCHAR **argv)
{
restart_program = 1;
+
fetch_configurationpath(restart_config, sizeof(restart_config) / sizeof(TCHAR));
_tcscat(restart_config, OPTIONSFILENAME);
- _tcscat(restart_config, ".uae");
default_config = 1;
while (restart_program) {
+ int ret;
changed_prefs = currprefs;
- real_main2(argc, argv);
+ ret = real_main2(argc, argv);
+ if (ret == 0 && quit_to_gui)
+ restart_program = 1;
leave_program();
quit_program = 0;
}
diff --git a/src/osdep/amiberry.cpp b/src/osdep/amiberry.cpp
index d5541e82..bed84044 100644
--- a/src/osdep/amiberry.cpp
+++ b/src/osdep/amiberry.cpp
@@ -58,12 +58,10 @@ map customControlMap; // No SDLK_LAST. SDL2 migration guide suggests s
char start_path_data[MAX_DPATH];
char currentDir[MAX_DPATH];
-#ifdef CAPSLOCK_DEBIAN_WORKAROUND
#include
#include
unsigned char kbd_led_status;
char kbd_flags;
-#endif
static char config_path[MAX_DPATH];
static char rom_path[MAX_DPATH];
@@ -236,6 +234,10 @@ void target_fixup_options(struct uae_prefs* p)
p->z3fastmem_start = z3_start_adr;
p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8;
+ if (p->gfx_size.width == 0)
+ p->gfx_size.width = 640;
+ if (p->gfx_size.height == 0)
+ p->gfx_size.height == 256;
p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0;
}
@@ -323,7 +325,7 @@ void fetch_rp9path(char* out, int size)
strncpy(out, rp9_path, size);
}
-void fetch_savestatepath(char* out, int size)
+void fetch_statefilepath(char* out, int size)
{
strncpy(out, start_path_data, size);
strncat(out, "/savestates/", size);
@@ -672,6 +674,7 @@ int main(int argc, char* argv[])
alloc_AmigaMem();
RescanROMs();
+ keyboard_settrans();
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
// set capslock state based upon current "real" state
@@ -718,8 +721,7 @@ int handle_msgpump()
SDL_Event rEvent;
int keycode;
int modifier;
- int handled = 0;
- int i;
+ int i, num;
if (delayed_mousebutton)
{
@@ -747,18 +749,8 @@ int handle_msgpump()
break;
case SDL_KEYDOWN:
- // Menu button or key pressed
- if (currprefs.key_for_menu != 0 && rEvent.key.keysym.scancode == currprefs.key_for_menu)
- {
- inputdevice_add_inputcode(AKS_ENTERGUI, 1);
- break;
- }
- if (currprefs.key_for_quit != 0 && rEvent.key.keysym.sym == currprefs.key_for_quit)
- {
- inputdevice_add_inputcode(AKS_QUIT, 1);
- break;
- }
- if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_MENU]))
+
+ if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LGUI] && (keystate[SDL_SCANCODE_RGUI] || keystate[SDL_SCANCODE_APPLICATION]))
{
uae_reset(0, 1);
break;
@@ -766,8 +758,19 @@ int handle_msgpump()
switch (rEvent.key.keysym.scancode)
{
-#ifdef CAPSLOCK_DEBIAN_WORKAROUND
+ case SDL_SCANCODE_NUMLOCKCLEAR:
+ if (currprefs.keyboard_leds[KBLED_NUMLOCKB] > 0)
+ {
+ //oldleds ^= KBLED_NUMLOCKM;
+ //ch = true;
+ }
+ break;
case SDL_SCANCODE_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);
@@ -788,35 +791,13 @@ int handle_msgpump()
ioctl(0, KDSETLED, kbd_led_status);
ioctl(0, KDSKBLED, kbd_flags);
break;
-#endif
- case SDL_SCANCODE_ESCAPE:
- inputdevice_do_keyboard(AK_ESC, 1);
- break;
- case SDL_SCANCODE_LSHIFT: // Shift key
- inputdevice_do_keyboard(AK_LSH, 1);
- break;
- case SDL_SCANCODE_RSHIFT:
- inputdevice_do_keyboard(AK_RSH, 1);
- break;
- case SDL_SCANCODE_RGUI:
- case SDL_SCANCODE_MENU:
- inputdevice_do_keyboard(AK_RAMI, 1);
- break;
- case SDL_SCANCODE_LGUI:
- inputdevice_do_keyboard(AK_LAMI, 1);
- break;
-
- case SDL_SCANCODE_LALT:
- inputdevice_do_keyboard(AK_LALT, 1);
- break;
- case SDL_SCANCODE_RALT:
- inputdevice_do_keyboard(AK_RALT, 1);
- break;
-
- case SDL_SCANCODE_LCTRL:
- case SDL_SCANCODE_RCTRL:
- inputdevice_do_keyboard(AK_CTRL, 1);
+ case SDL_SCANCODE_SCROLLLOCK:
+ if (currprefs.keyboard_leds[KBLED_SCROLLLOCKB] > 0)
+ {
+ //oldleds ^= KBLED_SCROLLLOCKM;
+ //ch = true;
+ }
break;
default:
@@ -836,23 +817,7 @@ int handle_msgpump()
break;
}
}
- else
- modifier = rEvent.key.keysym.mod;
-
- keycode = translate_amiberry_keys(rEvent.key.keysym.sym, &modifier);
- if(keycode)
- {
- if(modifier == KMOD_SHIFT)
- inputdevice_do_keyboard(AK_LSH, 1);
- else
- inputdevice_do_keyboard(AK_LSH, 0);
-
- inputdevice_do_keyboard(keycode, 1);
- }
- else
- {
- inputdevice_translatekeycode(0, rEvent.key.keysym.sym, 1);
- }
+ translate_amiberry_keys(rEvent.key.keysym.sym, 1);
break;
}
break;
@@ -860,36 +825,6 @@ int handle_msgpump()
case SDL_KEYUP:
switch (rEvent.key.keysym.scancode)
{
- case SDL_SCANCODE_ESCAPE:
- inputdevice_do_keyboard(AK_ESC, 0);
- break;
- case SDL_SCANCODE_LSHIFT: // Shift key
- inputdevice_do_keyboard(AK_LSH, 0);
- break;
- case SDL_SCANCODE_RSHIFT:
- inputdevice_do_keyboard(AK_RSH, 0);
- break;
-
- case SDL_SCANCODE_RGUI:
- case SDL_SCANCODE_MENU:
- inputdevice_do_keyboard(AK_RAMI, 0);
- break;
- case SDL_SCANCODE_LGUI:
- inputdevice_do_keyboard(AK_LAMI, 0);
- break;
-
- case SDL_SCANCODE_LALT:
- inputdevice_do_keyboard(AK_LALT, 0);
- break;
- case SDL_SCANCODE_RALT:
- inputdevice_do_keyboard(AK_RALT, 0);
- break;
-
- case SDL_SCANCODE_LCTRL:
- case SDL_SCANCODE_RCTRL:
- inputdevice_do_keyboard(AK_CTRL, 0);
- break;
-
default:
if (currprefs.amiberry_customControls)
{
@@ -908,18 +843,7 @@ int handle_msgpump()
}
}
- modifier = rEvent.key.keysym.mod;
- keycode = translate_amiberry_keys(rEvent.key.keysym.sym, &modifier);
- if(keycode)
- {
- inputdevice_do_keyboard(keycode, 0);
- if(modifier == KMOD_SHIFT)
- inputdevice_do_keyboard(AK_LSH, 0);
- }
- else
- {
- inputdevice_translatekeycode(0, rEvent.key.keysym.sym, 0);
- }
+ translate_amiberry_keys(rEvent.key.keysym.sym, 0);
break;
}
break;
diff --git a/src/osdep/amiberry_gfx.cpp b/src/osdep/amiberry_gfx.cpp
index d324cf67..d444b88f 100644
--- a/src/osdep/amiberry_gfx.cpp
+++ b/src/osdep/amiberry_gfx.cpp
@@ -108,9 +108,9 @@ static void open_screen(struct uae_prefs* p)
else
#endif
{
- p->gfx_resolution = p->gfx_size.width > 600 ? 1 : 0;
- width = p->gfx_size.width;
- height = p->gfx_size.height;
+ p->gfx_resolution = p->gfx_size.width ? (p->gfx_size.width > 600 ? 1 : 0) : 1;
+ width = p->gfx_size.width ? p->gfx_size.width : 640;
+ height = p->gfx_size.height ? p->gfx_size.height : 256;
if (p->scaling_method == -1)
{
@@ -288,6 +288,20 @@ static int init_colors()
return 1;
}
+int target_get_display(const TCHAR *name)
+{
+ return 0;
+}
+
+const TCHAR *target_get_display_name(int num, bool friendlyname)
+{
+ if (num <= 0)
+ return NULL;
+ if (friendlyname)
+ return "Raspberry Pi display";
+ return "0";
+}
+
/*
* Find the colour depth of the display
*/
diff --git a/src/osdep/amiberry_gui.cpp b/src/osdep/amiberry_gui.cpp
index 626e7316..06599be0 100644
--- a/src/osdep/amiberry_gui.cpp
+++ b/src/osdep/amiberry_gui.cpp
@@ -371,7 +371,7 @@ void ReadConfigFileList()
strcat(tmp->FullPath, files[i].c_str());
strncpy(tmp->Name, files[i].c_str(), MAX_DPATH);
removeFileExtension(tmp->Name);
- cfgfile_get_description(tmp->FullPath, tmp->Description);
+ cfgfile_get_description(tmp->FullPath, tmp->Description, nullptr, nullptr, nullptr);
tmp->BuildInID = BUILDINID_NONE;
ConfigFilesList.push_back(tmp);
}
@@ -511,7 +511,7 @@ int gui_update()
{
char tmp[MAX_PATH];
- fetch_savestatepath(savestate_fname, MAX_DPATH);
+ fetch_statefilepath(savestate_fname, MAX_DPATH);
fetch_screenshotpath(screenshot_filename, MAX_DPATH);
if (strlen(currprefs.floppyslots[0].df) > 0)
diff --git a/src/osdep/amiberry_input.cpp b/src/osdep/amiberry_input.cpp
index 28b583f8..747e2aa0 100644
--- a/src/osdep/amiberry_input.cpp
+++ b/src/osdep/amiberry_input.cpp
@@ -129,8 +129,6 @@ static void read_mouse()
if (!mouseBut2viaCustom)
setmousebuttonstate(1, 1, keystate[VK_B]); // B button -> right mouse
}
-
- // Nubs as mouse handled in handle_msgpump()
}
@@ -441,42 +439,42 @@ static void read_joystick()
// First handle fake joystick from pandora...
if (currprefs.jports[joyid].id == JSEM_JOYS)
{
- const Uint8* keystate = SDL_GetKeyboardState(nullptr);
+ //const Uint8* keystate = SDL_GetKeyboardState(nullptr);
- if (!keystate[VK_R])
- { // Right shoulder + dPad -> cursor keys
- int axis = (keystate[VK_LEFT] ? -32767 : (keystate[VK_RIGHT] ? 32767 : 0));
- if (!joyXviaCustom)
- setjoystickstate(0, 0, axis, 32767);
- axis = (keystate[VK_UP] ? -32767 : (keystate[VK_DOWN] ? 32767 : 0));
- if (!joyYviaCustom)
- setjoystickstate(0, 1, axis, 32767);
- }
- if (!joyButXviaCustom[0])
- setjoybuttonstate(0, 0, keystate[VK_X]);
- if (!joyButXviaCustom[1])
- setjoybuttonstate(0, 1, keystate[VK_B]);
- if (!joyButXviaCustom[2])
- setjoybuttonstate(0, 2, keystate[VK_A]);
- if (!joyButXviaCustom[3])
- setjoybuttonstate(0, 3, keystate[VK_Y]);
+ //if (!keystate[VK_R])
+ //{ // Right shoulder + dPad -> cursor keys
+ // int axis = (keystate[VK_LEFT] ? -32767 : (keystate[VK_RIGHT] ? 32767 : 0));
+ // if (!joyXviaCustom)
+ // setjoystickstate(0, 0, axis, 32767);
+ // axis = (keystate[VK_UP] ? -32767 : (keystate[VK_DOWN] ? 32767 : 0));
+ // if (!joyYviaCustom)
+ // setjoystickstate(0, 1, axis, 32767);
+ //}
+ //if (!joyButXviaCustom[0])
+ // setjoybuttonstate(0, 0, keystate[VK_X]);
+ //if (!joyButXviaCustom[1])
+ // setjoybuttonstate(0, 1, keystate[VK_B]);
+ //if (!joyButXviaCustom[2])
+ // setjoybuttonstate(0, 2, keystate[VK_A]);
+ //if (!joyButXviaCustom[3])
+ // setjoybuttonstate(0, 3, keystate[VK_Y]);
- int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
- if (keystate[SDL_SCANCODE_LALT])
- { // Pandora Start button
- if (keystate[VK_L]) // Left shoulder
- cd32_rwd = 1;
- else if (keystate[VK_R]) // Right shoulder
- cd32_ffw = 1;
- else
- cd32_start = 1;
- }
- if (!joyButXviaCustom[6])
- setjoybuttonstate(0, 6, cd32_start);
- if (!joyButXviaCustom[5])
- setjoybuttonstate(0, 5, cd32_ffw);
- if (!joyButXviaCustom[4])
- setjoybuttonstate(0, 4, cd32_rwd);
+ //int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
+ //if (keystate[SDL_SCANCODE_LALT])
+ //{ // Pandora Start button
+ // if (keystate[VK_L]) // Left shoulder
+ // cd32_rwd = 1;
+ // else if (keystate[VK_R]) // Right shoulder
+ // cd32_ffw = 1;
+ // else
+ // cd32_start = 1;
+ //}
+ //if (!joyButXviaCustom[6])
+ // setjoybuttonstate(0, 6, cd32_start);
+ //if (!joyButXviaCustom[5])
+ // setjoybuttonstate(0, 5, cd32_ffw);
+ //if (!joyButXviaCustom[4])
+ // setjoybuttonstate(0, 4, cd32_rwd);
}
else if (jsem_isjoy(joyid, &currprefs) != -1)
{
diff --git a/src/osdep/amiberry_rp9.cpp b/src/osdep/amiberry_rp9.cpp
index 01a41976..e1f3c43b 100644
--- a/src/osdep/amiberry_rp9.cpp
+++ b/src/osdep/amiberry_rp9.cpp
@@ -22,7 +22,7 @@
#define MAX_MANIFEST_ENTRY 256
static char rp9tmp_path[MAX_DPATH];
-static std::vector lstTmpRP9Files;
+static vector lstTmpRP9Files;
static int add_HDF_DHnum = 0;
static bool clip_no_hires = false;
@@ -89,50 +89,44 @@ static void set_default_system(struct uae_prefs *p, const char *system, int rom)
default_prefs(p, 0);
del_tmpFiles();
- if(strcmp(system, "a-500") == 0)
- bip_a500(p, rom);
- else if(strcmp(system, "a-500plus") == 0)
- bip_a500plus(p, rom);
- else if(strcmp(system, "a-1200") == 0)
- bip_a1200(p, rom);
- else if(strcmp(system, "a-2000") == 0)
- bip_a2000(p, rom);
- else if(strcmp(system, "a-4000") == 0)
- bip_a4000(p, rom);
+ if (strcmp(system, "a-500") == 0)
+ built_in_prefs(p, 0, 1, 0, rom);
+ else if (strcmp(system, "a-1200") == 0)
+ built_in_prefs(p, 0, 1, 0, rom);
}
static void parse_compatibility(struct uae_prefs *p, xmlNode *node)
{
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) {
- if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("compatibility")) == 0) {
+ if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("compatibility")) == 0) {
xmlChar *content = xmlNodeGetContent(curr_node);
if(content != NULL) {
- if(strcmp((const char *) content, "flexible-blitter-immediate") == 0)
+ if(strcmp(reinterpret_cast(content), "flexible-blitter-immediate") == 0)
p->immediate_blits = 1;
- else if(strcmp((const char *) content, "turbo-floppy") == 0)
+ else if(strcmp(reinterpret_cast(content), "turbo-floppy") == 0)
p->floppy_speed = 400;
- else if(strcmp((const char *) content, "flexible-sprite-collisions-spritesplayfield") == 0)
+ else if(strcmp(reinterpret_cast(content), "flexible-sprite-collisions-spritesplayfield") == 0)
p->collision_level = 2;
- else if(strcmp((const char *) content, "flexible-sprite-collisions-spritesonly") == 0)
+ else if(strcmp(reinterpret_cast(content), "flexible-sprite-collisions-spritesonly") == 0)
p->collision_level = 1;
- else if(strcmp((const char *) content, "flexible-sound") == 0)
+ else if(strcmp(reinterpret_cast(content), "flexible-sound") == 0)
p->produce_sound = 2;
- else if(strcmp((const char *) content, "flexible-maxhorizontal-nohires") == 0)
+ else if(strcmp(reinterpret_cast(content), "flexible-maxhorizontal-nohires") == 0)
clip_no_hires = true;
- else if(strcmp((const char *) content, "jit") == 0)
+ else if(strcmp(reinterpret_cast(content), "jit") == 0)
{
p->cachesize = 8192;
- p->address_space_24 = 0;
+ p->address_space_24 = false;
}
- else if(strcmp((const char *) content, "flexible-cpu-cycles") == 0)
- p->cpu_compatible = 0;
- else if(strcmp((const char *) content, "flexible-maxhorizontal-nosuperhires") == 0)
+ else if(strcmp(reinterpret_cast(content), "flexible-cpu-cycles") == 0)
+ p->cpu_compatible = false;
+ else if(strcmp(reinterpret_cast(content), "flexible-maxhorizontal-nosuperhires") == 0)
; /* nothing to change */
- else if(strcmp((const char *) content, "flexible-maxvertical-nointerlace") == 0)
+ else if(strcmp(reinterpret_cast(content), "flexible-maxvertical-nointerlace") == 0)
; /* nothing to change */
else
- printf("rp9: unknown compatibility: %s\n", content);
+ printf("rp9: unknown compatibility: %p\n", content);
xmlFree(content);
}
}
@@ -143,18 +137,18 @@ static void parse_compatibility(struct uae_prefs *p, xmlNode *node)
static void parse_ram(struct uae_prefs *p, xmlNode *node)
{
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) {
- if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("ram")) == 0) {
+ if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("ram")) == 0) {
xmlChar *content = xmlNodeGetContent(curr_node);
if(content != NULL) {
- xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
+ xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type"));
if(attr != NULL)
{
- int size = atoi((const char *)content);
- if(strcmp((const char *) attr, "fast") == 0)
+ int size = atoi(reinterpret_cast(content));
+ if(strcmp(reinterpret_cast(attr), "fast") == 0)
p->fastmem_size = size;
- else if(strcmp((const char *) attr, "z3") == 0)
+ else if(strcmp(reinterpret_cast(attr), "z3") == 0)
p->z3fastmem_size = size;
- else if(strcmp((const char *) attr, "chip") == 0)
+ else if(strcmp(reinterpret_cast(attr), "chip") == 0)
p->chipmem_size = size;
xmlFree(attr);
}
@@ -172,24 +166,24 @@ static void parse_clip(struct uae_prefs *p, xmlNode *node)
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next)
{
- if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("clip")) == 0)
+ if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("clip")) == 0)
{
- xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("left"));
+ xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("left"));
if(attr != NULL)
{
- left = atoi((const char *)attr);
+ left = atoi(reinterpret_cast(attr));
xmlFree(attr);
}
- attr = xmlGetProp(curr_node, (const xmlChar *) _T("top"));
+ attr = xmlGetProp(curr_node, reinterpret_cast("top"));
if(attr != NULL)
{
- top = atoi((const char *)attr) / 2;
+ top = atoi(reinterpret_cast(attr)) / 2;
xmlFree(attr);
}
- attr = xmlGetProp(curr_node, (const xmlChar *) _T("width"));
+ attr = xmlGetProp(curr_node, reinterpret_cast("width"));
if(attr != NULL)
{
- width = atoi((const char *)attr);
+ width = atoi(reinterpret_cast(attr));
if(p->chipset_mask & CSMASK_AGA && clip_no_hires == false)
width = width / 2; // Use Hires in AGA mode
else
@@ -208,10 +202,10 @@ static void parse_clip(struct uae_prefs *p, xmlNode *node)
p->gfx_size.width = 768;
xmlFree(attr);
}
- attr = xmlGetProp(curr_node, (const xmlChar *) _T("height"));
+ attr = xmlGetProp(curr_node, reinterpret_cast("height"));
if(attr != NULL)
{
- height = atoi((const char *)attr) / 2;
+ height = atoi(reinterpret_cast(attr)) / 2;
if(height <= 200)
p->gfx_size.height = 200;
else if(height <= 216)
@@ -236,30 +230,30 @@ static void parse_peripheral(struct uae_prefs *p, xmlNode *node)
{
for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next)
{
- if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("peripheral")) == 0)
+ if (curr_node->type == XML_ELEMENT_NODE && strcmp(reinterpret_cast(curr_node->name), _T("peripheral")) == 0)
{
xmlChar *content = xmlNodeGetContent(curr_node);
if(content != NULL)
{
- if(strcmp((const char *)content, "floppy") == 0)
+ if(strcmp(reinterpret_cast(content), "floppy") == 0)
{
int type = DRV_35_DD;
int unit = -1;
- xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
+ xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type"));
if(attr != NULL)
{
- if(strcmp((const char *) attr, "dd") == 0)
+ if(strcmp(reinterpret_cast(attr), "dd") == 0)
type = DRV_35_DD;
else
type = DRV_35_HD;
xmlFree(attr);
}
- attr = xmlGetProp(curr_node, (const xmlChar *) _T("unit"));
+ attr = xmlGetProp(curr_node, reinterpret_cast("unit"));
if(attr != NULL)
{
- unit = atoi((const char *) attr);
+ unit = atoi(reinterpret_cast(attr));
xmlFree(attr);
}
@@ -270,46 +264,46 @@ static void parse_peripheral(struct uae_prefs *p, xmlNode *node)
p->floppyslots[unit].dfxtype = type;
}
}
- else if(strcmp((const char *)content, "a-501") == 0)
+ else if(strcmp(reinterpret_cast(content), "a-501") == 0)
p->bogomem_size = 0x00080000;
- else if(strcmp((const char *)content, "cpu") == 0)
+ else if(strcmp(reinterpret_cast(content), "cpu") == 0)
{
- xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
+ xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type"));
if(attr != NULL)
{
- p->cpu_model = atoi((const char *) attr);
+ p->cpu_model = atoi(reinterpret_cast(attr));
if(p->cpu_model > 68020)
p->address_space_24 = 0;
if(p->cpu_model == 68040)
p->fpu_model = 68040;
xmlFree(attr);
}
- attr = xmlGetProp(curr_node, (const xmlChar *) _T("speed"));
+ attr = xmlGetProp(curr_node, reinterpret_cast("speed"));
if(attr != NULL)
{
- if(strcmp((const char *) attr, "max") == 0)
+ if(strcmp(reinterpret_cast(attr), "max") == 0)
p->m68k_speed = -1;
xmlFree(attr);
}
}
- else if(strcmp((const char *)content, "fpu") == 0)
+ else if(strcmp(reinterpret_cast(content), "fpu") == 0)
{
- xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));
+ xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("type"));
if(attr != NULL)
{
- if(strcmp((const char *) attr, "68881") == 0)
+ if(strcmp(reinterpret_cast(attr), "68881") == 0)
p->fpu_model = 68881;
- else if(strcmp((const char *) attr, "68882") == 0)
+ else if(strcmp(reinterpret_cast(attr), "68882") == 0)
p->fpu_model = 68882;
xmlFree(attr);
}
}
- else if(strcmp((const char *)content, "jit") == 0)
+ else if(strcmp(reinterpret_cast(content), "jit") == 0)
{
- xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("memory"));
+ xmlChar *attr = xmlGetProp(curr_node, reinterpret_cast("memory"));
if(attr != NULL)
{
- p->cachesize = atoi((const char *) attr) / 1024;
+ p->cachesize = atoi(reinterpret_cast(attr)) / 1024;
xmlFree(attr);
}
}
diff --git a/src/osdep/gui/PanelChipset.cpp b/src/osdep/gui/PanelChipset.cpp
index 574fdaa7..7b472098 100644
--- a/src/osdep/gui/PanelChipset.cpp
+++ b/src/osdep/gui/PanelChipset.cpp
@@ -25,8 +25,6 @@ static gcn::Window* grpBlitter;
static gcn::UaeRadioButton* optBlitNormal;
static gcn::UaeRadioButton* optBlitImmed;
static gcn::UaeRadioButton* optBlitWait;
-static gcn::Window* grpCopper;
-static gcn::UaeCheckBox* chkFastCopper;
static gcn::Window* grpCollisionLevel;
static gcn::UaeRadioButton* optCollNone;
static gcn::UaeRadioButton* optCollSprites;
@@ -74,18 +72,6 @@ public:
static NTSCButtonActionListener* ntscButtonActionListener;
-class FastCopperActionListener : public gcn::ActionListener
-{
-public:
- void action(const gcn::ActionEvent& actionEvent) override
- {
- changed_prefs.fast_copper = chkFastCopper->isSelected();
- }
-};
-
-static FastCopperActionListener* fastCopperActionListener;
-
-
class BlitterButtonActionListener : public gcn::ActionListener
{
public:
@@ -175,20 +161,6 @@ void InitPanelChipset(const struct _ConfigCategory& category)
category.panel->add(grpBlitter);
- fastCopperActionListener = new FastCopperActionListener();
-
- chkFastCopper = new gcn::UaeCheckBox("Fast copper");
- chkFastCopper->addActionListener(fastCopperActionListener);
-
- grpCopper = new gcn::Window("Copper");
- grpCopper->setPosition(grpBlitter->getX() + grpBlitter->getWidth() + DISTANCE_NEXT_X, DISTANCE_BORDER);
- grpCopper->add(chkFastCopper, 5, 10);
- grpCopper->setMovable(false);
- grpCopper->setSize(120, 55);
- grpCopper->setBaseColor(gui_baseCol);
-
- category.panel->add(grpCopper);
-
collisionButtonActionListener = new CollisionButtonActionListener();
optCollNone = new gcn::UaeRadioButton("None", "radioccollisiongroup");
@@ -239,10 +211,6 @@ void ExitPanelChipset()
delete grpBlitter;
delete blitterButtonActionListener;
- delete chkFastCopper;
- delete grpCopper;
- delete fastCopperActionListener;
-
delete optCollNone;
delete optCollSprites;
delete optCollPlayfield;
@@ -272,9 +240,7 @@ void RefreshPanelChipset()
else
optBlitNormal->setSelected(true);
- chkFastCopper->setSelected(changed_prefs.fast_copper);
-
- if (changed_prefs.collision_level == 0)
+ if (changed_prefs.collision_level == 0)
optCollNone->setSelected(true);
else if (changed_prefs.collision_level == 1)
optCollSprites->setSelected(true);
diff --git a/src/osdep/gui/PanelConfig.cpp b/src/osdep/gui/PanelConfig.cpp
index 1214144c..9727703d 100644
--- a/src/osdep/gui/PanelConfig.cpp
+++ b/src/osdep/gui/PanelConfig.cpp
@@ -52,15 +52,15 @@ void load_buildin_config(int id)
switch (id)
{
case BUILDINID_A500:
- bip_a500(&changed_prefs, -1);
+ built_in_prefs(&changed_prefs, 0, 1, 0, 0);
break;
case BUILDINID_A1200:
- bip_a1200(&changed_prefs, -1);
+ built_in_prefs(&changed_prefs, 4, 0, 0, 0);
break;
case BUILDINID_CD32:
- bip_cd32(&changed_prefs, -1);
+ built_in_prefs(&changed_prefs, 8, 0, 0, 0);
break;
}
}
diff --git a/src/osdep/keyboard.cpp b/src/osdep/keyboard.cpp
deleted file mode 100644
index dd5ad1fe..00000000
--- a/src/osdep/keyboard.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-#include "sysconfig.h"
-#include "sysdeps.h"
-#include "config.h"
-#include "options.h"
-#include "inputdevice.h"
-#include "keyboard.h"
-#include "keybuf.h"
-#include "gui.h"
-#include "SDL.h"
-
-char keyboard_type = 0;
-
-static struct uae_input_device_kbr_default keytrans_amiga[] = {
-
- { 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 },
- { 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_F11, INPUTEVENT_KEY_F11},
- { SDLK_F12, INPUTEVENT_KEY_F12},
-
- { SDLK_a, INPUTEVENT_KEY_A },
- { SDLK_b, INPUTEVENT_KEY_B },
- { SDLK_c, INPUTEVENT_KEY_C },
- { SDLK_d, INPUTEVENT_KEY_D },
- { SDLK_e, INPUTEVENT_KEY_E },
- { SDLK_f, INPUTEVENT_KEY_F },
- { SDLK_g, INPUTEVENT_KEY_G },
- { SDLK_h, INPUTEVENT_KEY_H },
- { SDLK_i, INPUTEVENT_KEY_I },
- { SDLK_j, INPUTEVENT_KEY_J },
- { SDLK_k, INPUTEVENT_KEY_K },
- { SDLK_l, INPUTEVENT_KEY_L },
- { SDLK_m, INPUTEVENT_KEY_M },
- { SDLK_n, INPUTEVENT_KEY_N },
- { SDLK_o, INPUTEVENT_KEY_O },
- { SDLK_p, INPUTEVENT_KEY_P },
- { SDLK_q, INPUTEVENT_KEY_Q },
- { SDLK_r, INPUTEVENT_KEY_R },
- { SDLK_s, INPUTEVENT_KEY_S },
- { SDLK_t, INPUTEVENT_KEY_T },
- { SDLK_u, INPUTEVENT_KEY_U },
- { SDLK_v, INPUTEVENT_KEY_V },
- { SDLK_w, INPUTEVENT_KEY_W },
- { SDLK_x, INPUTEVENT_KEY_X },
- { SDLK_y, INPUTEVENT_KEY_Y },
- { SDLK_z, INPUTEVENT_KEY_Z },
-
- { SDLK_0, INPUTEVENT_KEY_0 },
- { SDLK_1, INPUTEVENT_KEY_1 },
- { SDLK_2, INPUTEVENT_KEY_2 },
- { SDLK_3, INPUTEVENT_KEY_3 },
- { SDLK_4, INPUTEVENT_KEY_4 },
- { SDLK_5, INPUTEVENT_KEY_5 },
- { SDLK_6, INPUTEVENT_KEY_6 },
- { SDLK_7, INPUTEVENT_KEY_7 },
- { SDLK_8, INPUTEVENT_KEY_8 },
- { SDLK_9, INPUTEVENT_KEY_9 },
-
- { SDLK_CAPSLOCK, INPUTEVENT_KEY_CAPS_LOCK },
- { SDLK_BACKSPACE, INPUTEVENT_KEY_BACKSPACE },
- { SDLK_TAB, INPUTEVENT_KEY_TAB },
- { SDLK_RETURN, INPUTEVENT_KEY_RETURN },
- { VK_ESCAPE, INPUTEVENT_KEY_ESC },
- { SDLK_SPACE, INPUTEVENT_KEY_SPACE },
- { SDLK_QUOTE, INPUTEVENT_KEY_SINGLEQUOTE },
- { SDLK_COMMA, INPUTEVENT_KEY_COMMA },
- { SDLK_MINUS, INPUTEVENT_KEY_SUB },
- { SDLK_PERIOD, INPUTEVENT_KEY_PERIOD },
- { SDLK_SLASH, INPUTEVENT_KEY_DIV },
-
- { SDLK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
- { SDLK_EQUALS, INPUTEVENT_KEY_EQUALS },
- { SDLK_LEFTBRACKET, INPUTEVENT_KEY_LEFTBRACKET },
- { SDLK_BACKSLASH, INPUTEVENT_KEY_BACKSLASH },
- { SDLK_RIGHTBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
- { SDLK_BACKQUOTE, INPUTEVENT_KEY_BACKQUOTE },
- { SDLK_DELETE, INPUTEVENT_KEY_DEL },
-
- {SDLK_LSHIFT, INPUTEVENT_KEY_SHIFT_LEFT },
- {SDLK_RSHIFT, INPUTEVENT_KEY_SHIFT_RIGHT},
- {SDLK_LCTRL, INPUTEVENT_KEY_CTRL},
- {SDLK_RCTRL, INPUTEVENT_KEY_CTRL},
- {SDLK_LALT, INPUTEVENT_KEY_ALT_LEFT},
- {SDLK_RALT, INPUTEVENT_KEY_ALT_RIGHT},
-
-// { 94 - 8, INPUTEVENT_KEY_LTGT },
-
- { SDLK_KP_DIVIDE, INPUTEVENT_KEY_NP_DIV },
- { SDLK_KP_MULTIPLY, INPUTEVENT_KEY_NP_MUL },
- { SDLK_KP_MINUS, INPUTEVENT_KEY_NP_SUB },
- { SDLK_KP_7, INPUTEVENT_KEY_NP_7 },
- { SDLK_KP_8, INPUTEVENT_KEY_NP_8 },
- { SDLK_KP_9, INPUTEVENT_KEY_NP_9 },
- { SDLK_KP_PLUS, INPUTEVENT_KEY_NP_ADD },
- { SDLK_KP_4, INPUTEVENT_KEY_NP_4 },
- { SDLK_KP_5, INPUTEVENT_KEY_NP_5 },
- { SDLK_KP_6, INPUTEVENT_KEY_NP_6 },
- { SDLK_KP_1, INPUTEVENT_KEY_NP_1 },
- { SDLK_KP_2, INPUTEVENT_KEY_NP_2 },
- { SDLK_KP_3, INPUTEVENT_KEY_NP_3 },
- { SDLK_KP_ENTER, INPUTEVENT_KEY_ENTER }, // The ENT from keypad..
- { SDLK_KP_0, INPUTEVENT_KEY_NP_0 },
- { SDLK_KP_PERIOD, INPUTEVENT_KEY_PERIOD },
-
- { SDLK_UP, INPUTEVENT_KEY_CURSOR_UP },
- { SDLK_LEFT, INPUTEVENT_KEY_CURSOR_LEFT },
- { SDLK_DOWN, INPUTEVENT_KEY_CURSOR_DOWN },
- { SDLK_RIGHT, INPUTEVENT_KEY_CURSOR_RIGHT },
-
- { SDLK_HOME, INPUTEVENT_KEY_NP_LPAREN }, // Map home to left parent (as fsuae)
- { SDLK_PAGEUP, INPUTEVENT_KEY_NP_RPAREN }, // Map pageup to right parent (as fsuae)
- { SDLK_END, INPUTEVENT_KEY_HELP }, // Help mapped to End key (as fsuae)
- { SDLK_DELETE, INPUTEVENT_KEY_DEL },
-
- { SDLK_LGUI, INPUTEVENT_KEY_AMIGA_LEFT }, // Left amiga mapped to left Windows
- { SDLK_RGUI, INPUTEVENT_KEY_AMIGA_RIGHT }, // Right amiga mapped to right windows key.
- { SDLK_MENU, INPUTEVENT_KEY_AMIGA_RIGHT }, // Right amiga mapped to Menu key.
- { -1, 0 }
-};
-
-static struct uae_input_device_kbr_default *keytrans[] =
-{
- keytrans_amiga,
- keytrans_amiga,
- keytrans_amiga
-};
-
-static int kb_none[] = { -1 };
-static int *kbmaps[] = { kb_none, kb_none, kb_none, kb_none, kb_none,
- kb_none, kb_none, kb_none, kb_none, kb_none
- };
-
-void keyboard_settrans ()
-{
- keyboard_type = KEYCODE_UNK;
- inputdevice_setkeytranslation (keytrans, kbmaps);
-}
-
-int translate_amiberry_keys(int symbol, int *modifier)
-{
- switch(symbol)
- {
- case VK_UP:
- *modifier = KMOD_NONE;
- return AK_UP;
-
- case VK_DOWN:
- *modifier = KMOD_NONE;
- return AK_DN;
-
- case VK_LEFT:
- *modifier = KMOD_NONE;
- return AK_LF;
-
- case VK_RIGHT:
- *modifier = KMOD_NONE;
- return AK_RT;
-
- case SDLK_F1:
- *modifier = KMOD_NONE;
- return AK_F1;
-
- case SDLK_F2:
- *modifier = KMOD_NONE;
- return AK_F2;
-
- case SDLK_F3:
- *modifier = KMOD_NONE;
- return AK_F3;
-
- case SDLK_F4:
- *modifier = KMOD_NONE;
- return AK_F4;
-
- case SDLK_F5:
- *modifier = KMOD_NONE;
- return AK_F5;
-
- case SDLK_F6:
- *modifier = KMOD_NONE;
- return AK_F6;
-
- case SDLK_F7:
- *modifier = KMOD_NONE;
- return AK_F7;
-
- case SDLK_F8:
- *modifier = KMOD_NONE;
- return AK_F8;
-
- case SDLK_F9:
- *modifier = KMOD_NONE;
- return AK_F9;
-
- case SDLK_F10:
- *modifier = KMOD_NONE;
- return AK_F10;
-
- case SDLK_EXCLAIM:
- *modifier = KMOD_SHIFT;
- return AK_1;
-
- case SDLK_QUOTEDBL:
- *modifier = KMOD_SHIFT;
- return AK_QUOTE;
-
- case SDLK_HASH:
- *modifier = KMOD_SHIFT;
- return AK_3;
-
- case SDLK_DOLLAR:
- *modifier = KMOD_SHIFT;
- return AK_4;
-
- case SDLK_AMPERSAND:
- *modifier = KMOD_SHIFT;
- return AK_7;
-
- case SDLK_LEFTPAREN:
- *modifier = KMOD_SHIFT;
- return AK_9;
-
- case SDLK_RIGHTPAREN:
- *modifier = KMOD_SHIFT;
- return AK_0;
-
- case SDLK_ASTERISK:
- *modifier = KMOD_SHIFT;
- return AK_8;
-
- case SDLK_PLUS:
- *modifier = KMOD_SHIFT;
- return AK_EQUAL;
-
- case SDLK_COLON:
- *modifier = KMOD_SHIFT;
- return AK_SEMICOLON;
-
- case SDLK_QUESTION:
- *modifier = KMOD_SHIFT;
- return AK_SLASH;
-
- case SDLK_AT:
- *modifier = KMOD_SHIFT;
- return AK_2;
-
- case SDLK_CARET:
- *modifier = KMOD_SHIFT;
- return AK_6;
-
- case SDLK_UNDERSCORE:
- *modifier = KMOD_SHIFT;
- return AK_MINUS;
-
- case 124: // code for '|'
- *modifier = KMOD_SHIFT;
- return AK_BACKSLASH;
-
- case SDLK_2:
- if(*modifier == KMOD_LSHIFT) // '{'
- {
- *modifier = KMOD_SHIFT;
- return AK_LBRACKET;
- }
- break;
-
- case SDLK_3:
- if(*modifier == KMOD_LSHIFT) // '}'
- {
- *modifier = KMOD_SHIFT;
- return AK_RBRACKET;
- }
- break;
-
- case SDLK_4:
- if(*modifier == KMOD_LSHIFT) // '~'
- {
- *modifier = KMOD_SHIFT;
- return AK_BACKQUOTE;
- }
- break;
-
- case SDLK_9:
- if(*modifier == KMOD_LSHIFT) // '['
- {
- *modifier = KMOD_NONE;
- return AK_LBRACKET;
- }
- break;
-
- case SDLK_0:
- if(*modifier == KMOD_LSHIFT) // ']'
- {
- *modifier = KMOD_NONE;
- return AK_RBRACKET;
- }
- break;
- }
- return 0;
-}
diff --git a/src/osdep/keyboard_amiberry.cpp b/src/osdep/keyboard_amiberry.cpp
new file mode 100644
index 00000000..64025771
--- /dev/null
+++ b/src/osdep/keyboard_amiberry.cpp
@@ -0,0 +1,620 @@
+#include "sysconfig.h"
+#include "sysdeps.h"
+#include "config.h"
+#include "options.h"
+#include "inputdevice.h"
+#include "keyboard.h"
+#include "keybuf.h"
+#include "gui.h"
+#include "SDL.h"
+
+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_F5, INPUTEVENT_KEY_F5, 0, INPUTEVENT_SPC_STATERESTOREDIALOG, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_STATESAVEDIALOG, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
+ { 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 },
+ { SDLK_4, INPUTEVENT_KEY_4 },
+ { SDLK_5, INPUTEVENT_KEY_5 },
+ { SDLK_6, INPUTEVENT_KEY_6 },
+ { SDLK_7, INPUTEVENT_KEY_7 },
+ { SDLK_8, INPUTEVENT_KEY_8 },
+ { SDLK_9, INPUTEVENT_KEY_9 },
+ { SDLK_0, INPUTEVENT_KEY_0 },
+
+ { SDLK_TAB, INPUTEVENT_KEY_TAB },
+
+ { SDLK_a, INPUTEVENT_KEY_A },
+ { SDLK_b, INPUTEVENT_KEY_B },
+ { SDLK_c, INPUTEVENT_KEY_C },
+ { SDLK_d, INPUTEVENT_KEY_D },
+ { SDLK_e, INPUTEVENT_KEY_E },
+ { SDLK_f, INPUTEVENT_KEY_F },
+ { SDLK_g, INPUTEVENT_KEY_G },
+ { SDLK_h, INPUTEVENT_KEY_H },
+ { SDLK_i, INPUTEVENT_KEY_I },
+ { SDLK_j, INPUTEVENT_KEY_J },
+ { SDLK_k, INPUTEVENT_KEY_K },
+ { SDLK_l, INPUTEVENT_KEY_L },
+ { SDLK_m, INPUTEVENT_KEY_M },
+ { SDLK_n, INPUTEVENT_KEY_N },
+ { SDLK_o, INPUTEVENT_KEY_O },
+ { SDLK_p, INPUTEVENT_KEY_P },
+ { SDLK_q, INPUTEVENT_KEY_Q },
+ { SDLK_r, INPUTEVENT_KEY_R },
+ { SDLK_s, INPUTEVENT_KEY_S },
+ { SDLK_t, INPUTEVENT_KEY_T },
+ { SDLK_u, INPUTEVENT_KEY_U },
+ { SDLK_v, INPUTEVENT_KEY_V },
+ { SDLK_w, INPUTEVENT_KEY_W },
+ { SDLK_x, INPUTEVENT_KEY_X },
+ { SDLK_y, INPUTEVENT_KEY_Y },
+ { SDLK_z, INPUTEVENT_KEY_Z },
+
+ { SDLK_CAPSLOCK, INPUTEVENT_KEY_CAPS_LOCK, ID_FLAG_TOGGLE },
+
+ { SDLK_KP_1, INPUTEVENT_KEY_NP_1 },
+ { SDLK_KP_2, INPUTEVENT_KEY_NP_2 },
+ { SDLK_KP_3, INPUTEVENT_KEY_NP_3 },
+ { SDLK_KP_4, INPUTEVENT_KEY_NP_4 },
+ { SDLK_KP_5, INPUTEVENT_KEY_NP_5 },
+ { SDLK_KP_6, INPUTEVENT_KEY_NP_6 },
+ { SDLK_KP_7, INPUTEVENT_KEY_NP_7 },
+ { SDLK_KP_8, INPUTEVENT_KEY_NP_8 },
+ { 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, INPUTEVENT_SPC_STATEREWIND, ID_FLAG_QUALIFIER_SPECIAL },
+ { SDLK_KP_ENTER, INPUTEVENT_KEY_ENTER }, // The ENT from keypad..
+
+ { SDLK_MINUS, INPUTEVENT_KEY_SUB },
+ { SDLK_EQUALS, INPUTEVENT_KEY_EQUALS },
+ { SDLK_BACKSPACE, INPUTEVENT_KEY_BACKSPACE },
+ { SDLK_RETURN, INPUTEVENT_KEY_RETURN },
+ { SDLK_SPACE, INPUTEVENT_KEY_SPACE },
+
+ { SDLK_LSHIFT, INPUTEVENT_KEY_SHIFT_LEFT, 0, INPUTEVENT_SPC_QUALIFIER_SHIFT },
+ { SDLK_LCTRL, INPUTEVENT_KEY_CTRL, 0, INPUTEVENT_SPC_QUALIFIER_CONTROL },
+ { SDLK_LGUI, INPUTEVENT_KEY_AMIGA_LEFT, 0, INPUTEVENT_SPC_QUALIFIER_WIN },
+ { SDLK_LALT, INPUTEVENT_KEY_ALT_LEFT, 0, INPUTEVENT_SPC_QUALIFIER_ALT },
+ { SDLK_RALT, INPUTEVENT_KEY_ALT_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_ALT },
+ { SDLK_RGUI, INPUTEVENT_KEY_AMIGA_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_WIN },
+ { SDLK_MENU, INPUTEVENT_KEY_AMIGA_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_WIN },
+ { SDLK_RCTRL, INPUTEVENT_KEY_CTRL, 0, INPUTEVENT_SPC_QUALIFIER_CONTROL },
+ { SDLK_RSHIFT, INPUTEVENT_KEY_SHIFT_RIGHT, 0, INPUTEVENT_SPC_QUALIFIER_SHIFT },
+
+ { SDLK_UP, INPUTEVENT_KEY_CURSOR_UP },
+ { SDLK_DOWN, INPUTEVENT_KEY_CURSOR_DOWN },
+ { SDLK_LEFT, INPUTEVENT_KEY_CURSOR_LEFT },
+ { SDLK_RIGHT, INPUTEVENT_KEY_CURSOR_RIGHT },
+
+ { SDLK_INSERT, INPUTEVENT_KEY_AMIGA_LEFT },
+ { SDLK_DELETE, INPUTEVENT_KEY_DEL },
+ { SDLK_HOME, INPUTEVENT_KEY_AMIGA_RIGHT },
+ { SDLK_PAGEDOWN, INPUTEVENT_KEY_HELP },
+ { SDLK_PAGEUP, INPUTEVENT_SPC_FREEZEBUTTON },
+
+ { SDLK_LEFTBRACKET, INPUTEVENT_KEY_LEFTBRACKET },
+ { SDLK_RIGHTBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
+ { SDLK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
+ { SDLK_QUOTE, INPUTEVENT_KEY_SINGLEQUOTE },
+ { SDLK_BACKQUOTE, INPUTEVENT_KEY_BACKQUOTE },
+ { SDLK_BACKSLASH, INPUTEVENT_KEY_BACKSLASH },
+ { 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_END, INPUTEVENT_SPC_QUALIFIER_SPECIAL },
+ {SDLK_PAUSE, INPUTEVENT_SPC_PAUSE, 0, INPUTEVENT_SPC_WARP, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_IRQ7, ID_FLAG_QUALIFIER_SPECIAL | ID_FLAG_QUALIFIER_SHIFT },
+
+ {SDLK_F12, INPUTEVENT_SPC_ENTERGUI, 0, INPUTEVENT_SPC_ENTERDEBUGGER, ID_FLAG_QUALIFIER_SPECIAL, INPUTEVENT_SPC_ENTERDEBUGGER, ID_FLAG_QUALIFIER_SHIFT, INPUTEVENT_SPC_TOGGLEDEFAULTSCREEN, ID_FLAG_QUALIFIER_CONTROL },
+
+ {SDLK_AUDIOSTOP, INPUTEVENT_KEY_CDTV_STOP },
+ {SDLK_AUDIOPLAY, INPUTEVENT_KEY_CDTV_PLAYPAUSE },
+ {SDLK_AUDIOPREV, INPUTEVENT_KEY_CDTV_PREV },
+ {SDLK_AUDIONEXT, INPUTEVENT_KEY_CDTV_NEXT },
+
+ { -1, 0 }
+};
+
+static struct uae_input_device_kbr_default keytrans_pc1[] = {
+
+ { SDLK_ESCAPE, INPUTEVENT_KEY_ESC },
+
+ { 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 },
+ { 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_F11, INPUTEVENT_KEY_F11 },
+ { SDLK_F12, INPUTEVENT_KEY_F12 },
+
+ { SDLK_1, INPUTEVENT_KEY_1 },
+ { SDLK_2, INPUTEVENT_KEY_2 },
+ { SDLK_3, INPUTEVENT_KEY_3 },
+ { SDLK_4, INPUTEVENT_KEY_4 },
+ { SDLK_5, INPUTEVENT_KEY_5 },
+ { SDLK_6, INPUTEVENT_KEY_6 },
+ { SDLK_7, INPUTEVENT_KEY_7 },
+ { SDLK_8, INPUTEVENT_KEY_8 },
+ { SDLK_9, INPUTEVENT_KEY_9 },
+ { SDLK_0, INPUTEVENT_KEY_0 },
+
+ { SDLK_TAB, INPUTEVENT_KEY_TAB },
+
+ { SDLK_a, INPUTEVENT_KEY_A },
+ { SDLK_b, INPUTEVENT_KEY_B },
+ { SDLK_c, INPUTEVENT_KEY_C },
+ { SDLK_d, INPUTEVENT_KEY_D },
+ { SDLK_e, INPUTEVENT_KEY_E },
+ { SDLK_f, INPUTEVENT_KEY_F },
+ { SDLK_g, INPUTEVENT_KEY_G },
+ { SDLK_h, INPUTEVENT_KEY_H },
+ { SDLK_i, INPUTEVENT_KEY_I },
+ { SDLK_j, INPUTEVENT_KEY_J },
+ { SDLK_k, INPUTEVENT_KEY_K },
+ { SDLK_l, INPUTEVENT_KEY_L },
+ { SDLK_m, INPUTEVENT_KEY_M },
+ { SDLK_n, INPUTEVENT_KEY_N },
+ { SDLK_o, INPUTEVENT_KEY_O },
+ { SDLK_p, INPUTEVENT_KEY_P },
+ { SDLK_q, INPUTEVENT_KEY_Q },
+ { SDLK_r, INPUTEVENT_KEY_R },
+ { SDLK_s, INPUTEVENT_KEY_S },
+ { SDLK_t, INPUTEVENT_KEY_T },
+ { SDLK_u, INPUTEVENT_KEY_U },
+ { SDLK_v, INPUTEVENT_KEY_V },
+ { SDLK_w, INPUTEVENT_KEY_W },
+ { SDLK_x, INPUTEVENT_KEY_X },
+ { SDLK_y, INPUTEVENT_KEY_Y },
+ { SDLK_z, INPUTEVENT_KEY_Z },
+
+ { SDLK_CAPSLOCK, INPUTEVENT_KEY_CAPS_LOCK, ID_FLAG_TOGGLE },
+
+ { SDLK_KP_1, INPUTEVENT_KEY_NP_1 },
+ { SDLK_KP_2, INPUTEVENT_KEY_NP_2 },
+ { SDLK_KP_3, INPUTEVENT_KEY_NP_3 },
+ { SDLK_KP_4, INPUTEVENT_KEY_NP_4 },
+ { SDLK_KP_5, INPUTEVENT_KEY_NP_5 },
+ { SDLK_KP_6, INPUTEVENT_KEY_NP_6 },
+ { SDLK_KP_7, INPUTEVENT_KEY_NP_7 },
+ { SDLK_KP_8, INPUTEVENT_KEY_NP_8 },
+ { SDLK_KP_9, INPUTEVENT_KEY_NP_9 },
+ { SDLK_KP_0, INPUTEVENT_KEY_NP_0 },
+ { SDLK_KP_PERIOD, INPUTEVENT_KEY_NP_PERIOD },
+ { 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 },
+
+ { SDLK_MINUS, INPUTEVENT_KEY_SUB },
+ { SDLK_EQUALS, INPUTEVENT_KEY_EQUALS },
+ { SDLK_BACKSPACE, INPUTEVENT_KEY_BACKSPACE },
+ { SDLK_RETURN, INPUTEVENT_KEY_RETURN },
+ { SDLK_SPACE, INPUTEVENT_KEY_SPACE },
+
+ { SDLK_LSHIFT, INPUTEVENT_KEY_SHIFT_LEFT },
+ { SDLK_LCTRL, INPUTEVENT_KEY_CTRL },
+ { SDLK_LGUI, INPUTEVENT_KEY_AMIGA_LEFT },
+ { SDLK_LALT, INPUTEVENT_KEY_ALT_LEFT },
+ { SDLK_RALT, INPUTEVENT_KEY_ALT_RIGHT },
+ { SDLK_RGUI, INPUTEVENT_KEY_AMIGA_RIGHT },
+ { SDLK_MENU, INPUTEVENT_KEY_APPS },
+ { SDLK_RCTRL, INPUTEVENT_KEY_CTRL },
+ { SDLK_RSHIFT, INPUTEVENT_KEY_SHIFT_RIGHT },
+
+ { SDLK_UP, INPUTEVENT_KEY_CURSOR_UP },
+ { SDLK_DOWN, INPUTEVENT_KEY_CURSOR_DOWN },
+ { SDLK_LEFT, INPUTEVENT_KEY_CURSOR_LEFT },
+ { SDLK_RIGHT, INPUTEVENT_KEY_CURSOR_RIGHT },
+
+ { SDLK_LEFTBRACKET, INPUTEVENT_KEY_LEFTBRACKET },
+ { SDLK_RIGHTBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
+ { SDLK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
+ { SDLK_QUOTE, INPUTEVENT_KEY_SINGLEQUOTE },
+ { SDLK_BACKQUOTE, INPUTEVENT_KEY_BACKQUOTE },
+ { SDLK_BACKSLASH, INPUTEVENT_KEY_2B },
+ { SDLK_COMMA, INPUTEVENT_KEY_COMMA },
+ { SDLK_PERIOD, INPUTEVENT_KEY_PERIOD },
+ { SDLK_SLASH, INPUTEVENT_KEY_DIV },
+
+ { SDLK_INSERT, INPUTEVENT_KEY_INSERT },
+ { SDLK_DELETE, INPUTEVENT_KEY_DEL },
+ { SDLK_HOME, INPUTEVENT_KEY_HOME },
+ { SDLK_END, INPUTEVENT_KEY_END },
+ { SDLK_PAGEUP, INPUTEVENT_KEY_PAGEUP },
+ { SDLK_PAGEDOWN, INPUTEVENT_KEY_PAGEDOWN },
+ { SDLK_SCROLLLOCK, INPUTEVENT_KEY_HELP },
+ { SDLK_SYSREQ, INPUTEVENT_KEY_SYSRQ },
+
+ { SDLK_AUDIOSTOP, INPUTEVENT_KEY_CDTV_STOP },
+ { SDLK_AUDIOPLAY, INPUTEVENT_KEY_CDTV_PLAYPAUSE },
+ { SDLK_AUDIOPREV, INPUTEVENT_KEY_CDTV_PREV },
+ { SDLK_AUDIONEXT, INPUTEVENT_KEY_CDTV_NEXT },
+
+ { -1, 0 }
+};
+static struct uae_input_device_kbr_default *keytrans[] =
+{
+ keytrans_amiga,
+ keytrans_pc1,
+ keytrans_pc1
+};
+
+static int kb_np[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, -1, SDLK_KP_0, SDLK_KP_5, -1, SDLK_KP_DECIMAL, -1, SDLK_KP_ENTER, -1, -1 };
+static int kb_ck[] = { SDLK_LEFT, -1, SDLK_RIGHT, -1, SDLK_UP, -1, SDLK_DOWN, -1, SDLK_RCTRL, SDLK_RALT, -1, SDLK_RSHIFT, -1, -1 };
+static int kb_se[] = { SDLK_a, -1, SDLK_d, -1, SDLK_w, -1, SDLK_s, -1, SDLK_LALT, -1, SDLK_LSHIFT, -1, -1 };
+static int kb_np3[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, -1, SDLK_KP_0, SDLK_KP_5, -1, SDLK_KP_DECIMAL, -1, SDLK_KP_ENTER, -1, -1 };
+static int kb_ck3[] = { SDLK_LEFT, -1, SDLK_RIGHT, -1, SDLK_UP, -1, SDLK_DOWN, -1, SDLK_RCTRL, -1, SDLK_RSHIFT, -1, SDLK_RALT, -1, -1 };
+static int kb_se3[] = { SDLK_a, -1, SDLK_d, -1, SDLK_w, -1, SDLK_s, -1, SDLK_LALT, -1, SDLK_LSHIFT, -1, SDLK_LCTRL, -1, -1 };
+
+static int kb_cd32_np[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, -1, SDLK_KP_0, SDLK_KP_5, SDLK_KP_1, -1, SDLK_KP_DECIMAL, SDLK_KP_3, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, SDLK_KP_DIVIDE, -1, SDLK_KP_MINUS, -1, SDLK_KP_MULTIPLY, -1, -1 };
+static int kb_cd32_ck[] = { SDLK_LEFT, -1, SDLK_RIGHT, -1, SDLK_UP, -1, SDLK_DOWN, -1, SDLK_RCTRL, -1, SDLK_RALT, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, SDLK_KP_DIVIDE, -1, SDLK_KP_MINUS, -1, SDLK_KP_MULTIPLY, -1, -1 };
+static int kb_cd32_se[] = { SDLK_a, -1, SDLK_d, -1, SDLK_w, -1, SDLK_s, -1, -1, SDLK_LALT, -1, SDLK_LSHIFT, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, SDLK_KP_DIVIDE, -1, SDLK_KP_MINUS, -1, SDLK_KP_MULTIPLY, -1, -1 };
+
+static int kb_cdtv[] = { SDLK_KP_1, -1, SDLK_KP_3, -1, SDLK_KP_7, -1, SDLK_KP_9, -1, -1 };
+
+static int kb_xa1[] = { SDLK_KP_4, -1, SDLK_KP_6, -1, SDLK_KP_8, -1, SDLK_KP_2, SDLK_KP_5, -1, SDLK_LCTRL, -1, SDLK_LALT, -1, SDLK_SPACE, -1, -1 };
+static int kb_xa2[] = { SDLK_d, -1, SDLK_g, -1, SDLK_r, -1, SDLK_f, -1, SDLK_a, -1, SDLK_s, -1, SDLK_q, -1 };
+static int kb_arcadia[] = { SDLK_F2, -1, SDLK_1, -1, SDLK_2, -1, SDLK_5, -1, SDLK_6, -1, -1 };
+static int kb_arcadiaxa[] = { SDLK_1, -1, SDLK_2, -1, SDLK_3, -1, SDLK_4, -1, SDLK_6, -1, SDLK_LEFTBRACKET, SDLK_LSHIFT, -1, SDLK_RIGHTBRACKET, -1, SDLK_c, -1, SDLK_5, -1, SDLK_z, -1, SDLK_x, -1, -1 };
+
+static int *kbmaps[] = {
+ kb_np, kb_ck, kb_se, kb_np3, kb_ck3, kb_se3,
+ kb_cd32_np, kb_cd32_ck, kb_cd32_se,
+ kb_xa1, kb_xa2, kb_arcadia, kb_arcadiaxa, kb_cdtv
+};
+
+static bool specialpressed()
+{
+ return (input_getqualifiers() & ID_FLAG_QUALIFIER_SPECIAL) != 0;
+}
+static bool shiftpressed()
+{
+ return (input_getqualifiers() & ID_FLAG_QUALIFIER_SHIFT) != 0;
+}
+static bool altpressed()
+{
+ return (input_getqualifiers() & ID_FLAG_QUALIFIER_ALT) != 0;
+}
+static bool ctrlpressed()
+{
+ return (input_getqualifiers() & ID_FLAG_QUALIFIER_CONTROL) != 0;
+}
+
+static int capslockstate;
+static int host_capslockstate, host_numlockstate, host_scrolllockstate;
+
+int getcapslockstate()
+{
+ return capslockstate;
+}
+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);
+}
+
+static const int np[] = {
+ SDLK_KP_0, 0, SDLK_KP_PERIOD, 0, SDLK_KP_1, 1, SDLK_KP_2, 2,
+ SDLK_KP_3, 3, SDLK_KP_4, 4, SDLK_KP_5, 5, SDLK_KP_6, 6, SDLK_KP_7, 7,
+ SDLK_KP_8, 8, SDLK_KP_9, 9, -1 };
+
+void translate_amiberry_keys(int scancode, int newstate)
+{
+ int code = 0;
+ int scancode_new;
+ bool amode = currprefs.input_keyboard_type == 0;
+ bool special = false;
+ static int swapperdrive = 0;
+
+ scancode_new = scancode;
+
+ if (newstate) {
+ int defaultguikey = SDLK_F12;
+ if (currprefs.key_for_menu >= 0) {
+ if (scancode_new == defaultguikey && currprefs.key_for_menu != scancode_new) {
+ scancode = 0;
+ if (specialpressed() && ctrlpressed() && shiftpressed() && altpressed())
+ inputdevice_add_inputcode(AKS_ENTERGUI, 1);
+ }
+ else if (scancode_new == currprefs.key_for_menu) {
+ inputdevice_add_inputcode(AKS_ENTERGUI, 1);
+ scancode = 0;
+ }
+ }
+ else if (!specialpressed() && !ctrlpressed() && !shiftpressed() && !altpressed() && scancode_new == defaultguikey) {
+ inputdevice_add_inputcode(AKS_ENTERGUI, 1);
+ scancode = 0;
+ }
+ if (currprefs.key_for_quit != 0 && scancode_new == currprefs.key_for_quit)
+ {
+ inputdevice_add_inputcode(AKS_QUIT, 1);
+ scancode = 0;
+ }
+ }
+
+ if (newstate && code == 0 && amode) {
+
+ switch (scancode)
+ {
+ case SDLK_1:
+ case SDLK_2:
+ case SDLK_3:
+ case SDLK_4:
+ case SDLK_5:
+ case SDLK_6:
+ case SDLK_7:
+ case SDLK_8:
+ case SDLK_9:
+ case SDLK_0:
+ if (specialpressed()) {
+ int num = scancode - SDLK_1;
+ if (shiftpressed())
+ num += 10;
+ if (ctrlpressed()) {
+ swapperdrive = num;
+ if (swapperdrive > 3)
+ swapperdrive = 0;
+ }
+ else {
+ int i;
+ for (i = 0; i < 4; i++) {
+ if (!_tcscmp(currprefs.floppyslots[i].df, currprefs.dfxlist[num]))
+ changed_prefs.floppyslots[i].df[0] = 0;
+ }
+ _tcscpy(changed_prefs.floppyslots[swapperdrive].df, currprefs.dfxlist[num]);
+ set_config_changed();
+ }
+ special = true;
+ }
+ break;
+ case SDLK_KP_0:
+ case SDLK_KP_1:
+ case SDLK_KP_2:
+ case SDLK_KP_3:
+ case SDLK_KP_4:
+ case SDLK_KP_5:
+ case SDLK_KP_6:
+ case SDLK_KP_7:
+ case SDLK_KP_8:
+ case SDLK_KP_9:
+ case SDLK_KP_PERIOD:
+ if (specialpressed()) {
+ int i = 0, v = -1;
+ while (np[i] >= 0) {
+ v = np[i + 1];
+ if (np[i] == scancode)
+ break;
+ i += 2;
+ }
+ if (v >= 0)
+ code = AKS_STATESAVEQUICK + v * 2 + ((shiftpressed() || ctrlpressed()) ? 0 : 1);
+ special = true;
+ }
+ break;
+ }
+ }
+
+ if (code) {
+ inputdevice_add_inputcode(code, 1);
+ return;
+ }
+
+ scancode = scancode_new;
+ if (!specialpressed() && newstate) {
+ if (scancode == SDLK_CAPSLOCK) {
+ host_capslockstate = host_capslockstate ? 0 : 1;
+ capslockstate = host_capslockstate;
+ }
+ if (scancode == SDLK_NUMLOCKCLEAR) {
+ host_numlockstate = host_numlockstate ? 0 : 1;
+ capslockstate = host_numlockstate;
+ }
+ if (scancode == SDLK_SCROLLLOCK) {
+ host_scrolllockstate = host_scrolllockstate ? 0 : 1;
+ capslockstate = host_scrolllockstate;
+ }
+ }
+
+ int translatedScancode = scancode;
+ switch (scancode)
+ {
+ case VK_UP:
+ translatedScancode = AK_UP;
+ break;
+ case VK_DOWN:
+ translatedScancode = AK_DN;
+ break;
+ case VK_LEFT:
+ translatedScancode = AK_LF;
+ break;
+ case VK_RIGHT:
+ translatedScancode = AK_RT;
+ break;
+ case SDLK_F1:
+ translatedScancode = AK_F1;
+ break;
+ case SDLK_F2:
+ translatedScancode = AK_F2;
+ break;
+ case SDLK_F3:
+ translatedScancode = AK_F3;
+ break;
+ case SDLK_F4:
+ translatedScancode = AK_F4;
+ break;
+ case SDLK_F5:
+ translatedScancode = AK_F5;
+ break;
+ case SDLK_F6:
+ translatedScancode = AK_F6;
+ break;
+ case SDLK_F7:
+ translatedScancode = AK_F7;
+ break;
+ case SDLK_F8:
+ translatedScancode = AK_F8;
+ break;
+ case SDLK_F9:
+ translatedScancode = AK_F9;
+ break;
+ case SDLK_F10:
+ translatedScancode = AK_F10;
+ break;
+ case SDLK_LSHIFT:
+ translatedScancode = AK_LSH;
+ break;
+ case SDLK_RSHIFT:
+ translatedScancode = AK_RSH;
+ break;
+ case SDLK_RGUI:
+ case SDLK_APPLICATION:
+ translatedScancode = AK_RAMI;
+ break;
+ case SDLK_LGUI:
+ translatedScancode = AK_LAMI;
+ break;
+ case SDLK_LALT:
+ translatedScancode = AK_LALT;
+ break;
+ case SDLK_RALT:
+ translatedScancode = AK_RALT;
+ break;
+ case SDLK_LCTRL:
+ case SDLK_RCTRL:
+ translatedScancode = AK_CTRL;
+ break;
+ case SDLK_PAGEDOWN:
+ translatedScancode = AK_HELP;
+ break;
+ case SDLK_KP_0:
+ translatedScancode = AK_NP0;
+ break;
+ case SDLK_KP_1:
+ translatedScancode = AK_NP1;
+ break;
+ case SDLK_KP_2:
+ translatedScancode = AK_NP2;
+ break;
+ case SDLK_KP_3:
+ translatedScancode = AK_NP3;
+ break;
+ case SDLK_KP_4:
+ translatedScancode = AK_NP4;
+ break;
+ case SDLK_KP_5:
+ translatedScancode = AK_NP5;
+ break;
+ case SDLK_KP_6:
+ translatedScancode = AK_NP6;
+ break;
+ case SDLK_KP_7:
+ translatedScancode = AK_NP7;
+ break;
+ case SDLK_KP_8:
+ translatedScancode = AK_NP8;
+ break;
+ case SDLK_KP_9:
+ translatedScancode = AK_NP9;
+ break;
+ case SDLK_KP_ENTER:
+ translatedScancode = AK_ENT;
+ break;
+ case SDLK_KP_DIVIDE:
+ translatedScancode = AK_NPDIV;
+ break;
+ case SDLK_KP_MULTIPLY:
+ translatedScancode = AK_NPMUL;
+ break;
+ case SDLK_KP_MINUS:
+ translatedScancode = AK_NPSUB;
+ break;
+ case SDLK_KP_PLUS:
+ translatedScancode = AK_NPADD;
+ break;
+ case SDLK_KP_PERIOD:
+ translatedScancode = AK_NPDEL;
+ break;
+ }
+
+ if (special) {
+ inputdevice_checkqualifierkeycode(0, translatedScancode, newstate);
+ return;
+ }
+
+ if (translatedScancode != scancode)
+ inputdevice_do_keyboard(translatedScancode, newstate);
+ else
+ inputdevice_translatekeycode(0, translatedScancode, newstate);
+}
+
+void keyboard_settrans()
+{
+ inputdevice_setkeytranslation(keytrans, kbmaps);
+}
+
+int target_checkcapslock(int scancode, int *state)
+{
+ if (scancode != SDLK_CAPSLOCK && scancode != SDLK_NUMLOCKCLEAR && scancode != SDLK_SCROLLLOCK)
+ return 0;
+ if (*state == 0)
+ return -1;
+ if (scancode == SDLK_CAPSLOCK)
+ *state = host_capslockstate;
+ if (scancode == SDLK_NUMLOCKCLEAR)
+ *state = host_numlockstate;
+ if (scancode == SDLK_SCROLLLOCK)
+ *state = host_scrolllockstate;
+ return 1;
+}
\ No newline at end of file
diff --git a/src/osdep/target.h b/src/osdep/target.h
index 7f8bf3a5..e2534464 100644
--- a/src/osdep/target.h
+++ b/src/osdep/target.h
@@ -31,7 +31,7 @@ void graphics_subshutdown();
void amiberry_stop_sound();
void keyboard_settrans();
-int translate_amiberry_keys(int symbol, int *modifier);
+void translate_amiberry_keys(int, int);
void SimulateMouseOrJoy(int code, int keypressed);
#define REMAP_MOUSEBUTTON_LEFT -1
diff --git a/src/rommgr.cpp b/src/rommgr.cpp
index 91c57316..8a68c505 100644
--- a/src/rommgr.cpp
+++ b/src/rommgr.cpp
@@ -665,7 +665,7 @@ int load_keyring (struct uae_prefs *p, const TCHAR *path)
break;
case 1:
if (p) {
- _tcscpy (tmp, p->path_rom);
+ _tcscpy(tmp, p->path_rom.path[0]);
_tcscat (tmp, _T("rom.key"));
}
break;
diff --git a/src/savestate.cpp b/src/savestate.cpp
index 9658c11c..3fa5ba16 100644
--- a/src/savestate.cpp
+++ b/src/savestate.cpp
@@ -211,8 +211,9 @@ TCHAR* restore_string_func(uae_u8** dstp)
TCHAR* restore_path_func(uae_u8** dstp, int type)
{
- TCHAR* newpath;
- TCHAR* s;
+ TCHAR *newpath;
+ TCHAR *s;
+ TCHAR *out = NULL;
TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
s = restore_string_func(dstp);
@@ -222,28 +223,27 @@ TCHAR* restore_path_func(uae_u8** dstp, int type)
return s;
if (type == SAVESTATE_PATH_HD)
return s;
- getfilepart(tmp, sizeof tmp / sizeof (TCHAR), s);
- if (zfile_exists(tmp))
- {
- xfree (s);
+ getfilepart(tmp, sizeof tmp / sizeof(TCHAR), s);
+ if (zfile_exists(tmp)) {
+ xfree(s);
return my_strdup(tmp);
}
- newpath = nullptr;
- if (type == SAVESTATE_PATH_FLOPPY)
- newpath = currprefs.path_floppy;
- else if (type == SAVESTATE_PATH_VDIR || type == SAVESTATE_PATH_HDF)
- newpath = currprefs.path_hardfile;
- else if (type == SAVESTATE_PATH_CD)
- newpath = currprefs.path_cd;
- if (newpath != nullptr && newpath[0] != 0)
- {
- _tcscpy (tmp2, newpath);
+ for (int i = 0; i < MAX_PATHS; i++) {
+ newpath = NULL;
+ if (type == SAVESTATE_PATH_FLOPPY)
+ newpath = currprefs.path_floppy.path[i];
+ else if (type == SAVESTATE_PATH_VDIR || type == SAVESTATE_PATH_HDF)
+ newpath = currprefs.path_hardfile.path[i];
+ else if (type == SAVESTATE_PATH_CD)
+ newpath = currprefs.path_cd.path[i];
+ if (newpath == NULL || newpath[0] == 0)
+ break;
+ _tcscpy(tmp2, newpath);
fixtrailing(tmp2);
- _tcscat (tmp2, tmp);
- if (zfile_exists(tmp2))
- {
- xfree (s);
+ _tcscat(tmp2, tmp);
+ if (zfile_exists(tmp2)) {
+ xfree(s);
return my_strdup(tmp2);
}
}
diff --git a/src/sounddep/sound.h b/src/sounddep/sound.h
index a674f3fb..ba642a12 100644
--- a/src/sounddep/sound.h
+++ b/src/sounddep/sound.h
@@ -46,6 +46,17 @@ STATIC_INLINE void clear_sound_buffers (void)
#define PUT_SOUND_WORD(b) do { *sndbufpt = b; sndbufpt = sndbufpt + 1; } while (0)
#define PUT_SOUND_WORD_STEREO(l,r) do { *((uae_u32 *)sndbufpt) = (r << 16) | (l & 0xffff); sndbufpt = sndbufpt + 2; } while (0)
+#define PUT_SOUND_WORD_LEFT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[0]); PUT_SOUND_WORD(b); } while (0)
+#define PUT_SOUND_WORD_RIGHT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[1]); PUT_SOUND_WORD(b); } while (0)
+#define PUT_SOUND_WORD_LEFT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[2]); PUT_SOUND_WORD(b); } while (0)
+#define PUT_SOUND_WORD_RIGHT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[3]); PUT_SOUND_WORD(b); } while (0)
+
+#define PUT_SOUND_WORD_MONO(b) PUT_SOUND_WORD_LEFT(b)
+#define SOUND16_BASE_VAL 0
+#define SOUND8_BASE_VAL 128
+
+#define DEFAULT_SOUND_MAXB 16384
+#define DEFAULT_SOUND_MINB 16384
#define DEFAULT_SOUND_BITS 16
#define DEFAULT_SOUND_FREQ 44100
#define HAVE_STEREO_SUPPORT