From 66751f86bde56ba4e416f982b0d87156934638e0 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 30 Sep 2017 20:12:27 +0300 Subject: [PATCH] 3600b5 --- cfgfile.cpp | 216 ++++++++++++++++++++--------------- include/statusline.h | 1 + od-win32/win32.cpp | 27 ++++- od-win32/win32.h | 4 +- od-win32/win32gui.cpp | 9 +- od-win32/winuaechangelog.txt | 21 ++++ 6 files changed, 178 insertions(+), 100 deletions(-) diff --git a/cfgfile.cpp b/cfgfile.cpp index 46312501..bbf33241 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -343,6 +343,72 @@ static const TCHAR *obsolete[] = { #define UNEXPANDED _T("$(FILE_PATH)") + +static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos, TCHAR separator, bool min) +{ + bool quoted = false; + TCHAR *s2 = xmalloc(TCHAR, _tcslen(s) + 1); + TCHAR *p = s2; + if (s[0] == '\"') { + s++; + quoted = true; + } + int i; + for (i = 0; s[i]; i++) { + TCHAR c = s[i]; + if (quoted && c == '\"') { + i++; + break; + } + if (c == separator) { + i++; + break; + } + if (c == '\\' && !min) { + char v = 0; + TCHAR c2; + c = s[i + 1]; + switch (c) + { + case 'X': + case 'x': + c2 = _totupper(s[i + 2]); + v = ((c2 >= 'A') ? c2 - 'A' : c2 - '0') << 4; + c2 = _totupper(s[i + 3]); + v |= (c2 >= 'A') ? c2 - 'A' : c2 - '0'; + *p++ = c2; + i += 2; + break; + case 'r': + *p++ = '\r'; + break; + case '\n': + *p++ = '\n'; + break; + default: + *p++ = c; + break; + } + i++; + } + else { + *p++ = c; + } + } + *p = 0; + if (endpos) + *endpos = &s[i]; + return s2; +} +static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos) +{ + return cfgfile_unescape(s, endpos, 0, false); +} +static TCHAR *cfgfile_unescape_min(const TCHAR *s) +{ + return cfgfile_unescape(s, NULL, 0, true); +} + static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool checkequals) { TCHAR buf[MAX_DPATH]; @@ -363,8 +429,15 @@ static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool c *tmpp2++ = 0; } if (!strcasecmp(p, option)) { - if (checkequals && tmpp2) + if (checkequals && tmpp2) { + if (tmpp2[0] == '"') { + TCHAR *n = cfgfile_unescape_min(tmpp2); + _tcscpy(tmpp2, n); + xfree(n); + return tmpp2; + } return tmpp2; + } return p; } p = tmpp; @@ -486,66 +559,6 @@ static TCHAR *cfgfile_escape_min(const TCHAR *s) return my_strdup(s); } -static TCHAR *cfgfile_unescape (const TCHAR *s, const TCHAR **endpos, TCHAR separator) -{ - bool quoted = false; - TCHAR *s2 = xmalloc (TCHAR, _tcslen (s) + 1); - TCHAR *p = s2; - if (s[0] == '\"') { - s++; - quoted = true; - } - int i; - for (i = 0; s[i]; i++) { - TCHAR c = s[i]; - if (quoted && c == '\"') { - i++; - break; - } - if (c == separator) { - i++; - break; - } - if (c == '\\') { - char v = 0; - TCHAR c2; - c = s[i + 1]; - switch (c) - { - case 'X': - case 'x': - c2 = _totupper (s[i + 2]); - v = ((c2 >= 'A') ? c2 - 'A' : c2 - '0') << 4; - c2 = _totupper (s[i + 3]); - v |= (c2 >= 'A') ? c2 - 'A' : c2 - '0'; - *p++ = c2; - i += 2; - break; - case 'r': - *p++ = '\r'; - break; - case '\n': - *p++ = '\n'; - break; - default: - *p++ = c; - break; - } - i++; - } else { - *p++ = c; - } - } - *p = 0; - if (endpos) - *endpos = &s[i]; - return s2; -} -static TCHAR *cfgfile_unescape (const TCHAR *s, const TCHAR **endpos) -{ - return cfgfile_unescape (s, endpos, 0); -} - static TCHAR *getnextentry (const TCHAR **valuep, const TCHAR separator) { TCHAR *s; @@ -560,7 +573,7 @@ static TCHAR *getnextentry (const TCHAR **valuep, const TCHAR separator) value++; *valuep = value; } else { - s = cfgfile_unescape (value, valuep, separator); + s = cfgfile_unescape (value, valuep, separator, false); } return s; } @@ -904,6 +917,34 @@ static void cfgfile_dwrite_path (struct zfile *f, struct multipath *mp, const TC xfree (s); } +static void cfgfile_adjust_path(TCHAR *path, int maxsz, struct multipath *mp) +{ + if (path[0] == 0) + return; + TCHAR *s = target_expand_environment(path, NULL, 0); + _tcsncpy(path, s, maxsz - 1); + path[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 && (path[0] != '/' && path[0] != '\\' && !_tcschr(path, ':'))) { + TCHAR np[MAX_DPATH]; + _tcscpy(np, mp->path[i]); + fixtrailing(np); + _tcscat(np, s); + fullpath(np, sizeof np / sizeof(TCHAR)); + if (zfile_exists(np)) { + _tcsncpy(path, np, maxsz - 1); + path[maxsz - 1] = 0; + break; + } + } + } + } else { + fullpath(path, maxsz); + } + xfree(s); +} + static void write_filesys_config (struct uae_prefs *p, struct zfile *f) { TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH], tmp3[MAX_DPATH], hdcs[MAX_DPATH]; @@ -976,7 +1017,10 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f) zfile_fputs (f, tmp2); #endif } else if (ci->type == UAEDEV_HDF || ci->type == UAEDEV_CD || ci->type == UAEDEV_TAPE) { - TCHAR *sfilesys = cfgfile_escape_min(ci->filesys); + TCHAR filesyspath[MAX_DPATH]; + _tcscpy(filesyspath, ci->filesys); + cfgfile_adjust_path(filesyspath, MAX_DPATH, NULL); + TCHAR *sfilesys = cfgfile_escape_min(filesyspath); TCHAR *sgeometry = cfgfile_escape(ci->geometry, NULL, true); _stprintf (tmp, _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"), ci->readonly ? _T("ro") : _T("rw"), @@ -1200,13 +1244,17 @@ static void cfgfile_write_rom_settings(const struct expansionboardsettings *ebs, bitcnt += eb->bitshift; if (eb->type == EXPANSIONBOARD_STRING) { if (settingstring) { + TCHAR tmp[MAX_DPATH]; const TCHAR *p = settingstring; for (int i = 0; i < sstr; i++) { p += _tcslen(p) + 1; } if (buf[0]) _tcscat(buf, _T(",")); - _stprintf(buf, _T("%s=%s"), eb->configname, p); + TCHAR *cs = cfgfile_escape_min(p); + _stprintf(tmp, _T("%s=%s"), eb->configname, cs); + _tcscat(buf, tmp); + xfree(cs); sstr++; } } else if (eb->type == EXPANSIONBOARD_MULTI) { @@ -1313,7 +1361,7 @@ static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, st _tcscat(buf2, _T(",")); _tcscat(buf2, tmp); } - if (br->roms[i].device_settings && ert->settings) { + if ((br->roms[i].device_settings || br->roms[i].configtext[0]) && ert->settings) { cfgfile_write_rom_settings(ert->settings, buf2, br->roms[i].device_settings, br->roms[i].configtext); } if (is_custom_romboard(br)) { @@ -2081,7 +2129,6 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) 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("cd32cubo"), p->cs_cd32cubo); cfgfile_dwrite(f, _T("cd32nvram_size"), _T("%d"), p->cs_cd32nvram_size / 1024); cfgfile_dwrite_bool(f, _T("cdtvcd"), p->cs_cdtvcd); cfgfile_dwrite_bool(f, _T("cdtv-cr"), p->cs_cdtvcr); @@ -2534,31 +2581,11 @@ static int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR return 1; } - static int cfgfile_path (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz, struct multipath *mp) { if (!cfgfile_string (option, value, name, location, maxsz)) return 0; - TCHAR *s = target_expand_environment (location, NULL, 0); - _tcsncpy (location, s, maxsz - 1); - location[maxsz - 1] = 0; - if (mp) { - for (int i = 0; i < MAX_PATHS; i++) { - if (mp->path[i][0] && _tcscmp (mp->path[i], _T(".\\")) != 0 && _tcscmp (mp->path[i], _T("./")) != 0 && (location[0] != '/' && location[0] != '\\' && !_tcschr(location, ':'))) { - TCHAR np[MAX_DPATH]; - _tcscpy (np, mp->path[i]); - fixtrailing (np); - _tcscat (np, s); - fullpath (np, sizeof np / sizeof (TCHAR)); - if (zfile_exists (np)) { - _tcsncpy (location, np, maxsz - 1); - location[maxsz - 1] = 0; - break; - } - } - } - } - xfree (s); + cfgfile_adjust_path(location, maxsz, mp); return 1; } @@ -4395,7 +4422,7 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHA // quoted special case if (tmpp2[0] == '\"') { const TCHAR *end; - TCHAR *n = cfgfile_unescape (tmpp2, &end, 0); + TCHAR *n = cfgfile_unescape (tmpp2, &end, 0, false); if (!n) goto invalid_fs; _tcscpy (uci.rootdir, n); @@ -4423,7 +4450,7 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHA // quoted special case if (tmpp2[0] == '\"') { const TCHAR *end; - TCHAR *n = cfgfile_unescape (tmpp2, &end, 0); + TCHAR *n = cfgfile_unescape (tmpp2, &end, 0, false); if (!n) goto invalid_fs; _tcscpy (uci.rootdir, n); @@ -4452,7 +4479,7 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHA // quoted special case if (tmpp2[0] == '\"') { const TCHAR *end; - TCHAR *n = cfgfile_unescape (tmpp2, &end, 0); + TCHAR *n = cfgfile_unescape (tmpp2, &end, 0, false); if (!n) goto invalid_fs; _tcscpy (uci.filesys, n); @@ -4482,7 +4509,7 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, int type, TCHA } if (tmpp2[0]) { if (tmpp2[0] == '\"') { - n = cfgfile_unescape (tmpp2, &end, 0); + n = cfgfile_unescape (tmpp2, &end, 0, false); if (!n) goto invalid_fs; _tcscpy(uci.geometry, n); @@ -4962,7 +4989,6 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || 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("cd32cubo"), &p->cs_cd32cubo) || cfgfile_yesno(option, value, _T("cdtvcd"), &p->cs_cdtvcd) || cfgfile_yesno(option, value, _T("cdtv-cr"), &p->cs_cdtvcr) || cfgfile_yesno(option, value, _T("cdtvram"), &p->cs_cdtvram) @@ -7097,7 +7123,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type) p->cs_agnusrev = -1; p->cs_deniserev = -1; p->cs_mbdmac = 0; - p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = p->cs_cd32cubo = false; + p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = false; p->cs_cd32nvram_size = 1024; p->cs_cdtvcd = p->cs_cdtvram = false; p->cs_cdtvcard = 0; @@ -7377,7 +7403,7 @@ static void buildin_default_prefs (struct uae_prefs *p) p->cs_agnusrev = -1; p->cs_deniserev = -1; p->cs_mbdmac = 0; - p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = p->cs_cd32cubo = false; + p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = p->cs_cd32fmv = false; p->cs_cdtvcd = p->cs_cdtvram = p->cs_cdtvcard = false; p->cs_ide = 0; p->cs_pcmcia = 0; @@ -7742,7 +7768,7 @@ static int bip_cd32 (struct uae_prefs *p, int config, int compa, int romcheck) if (!configure_rom (p, roms, romcheck)) return 0; } else if (config > 1) { - p->cs_cd32cubo = true; + addbcromtype(p, ROMTYPE_CUBO, true, NULL, 0); } return 1; } diff --git a/include/statusline.h b/include/statusline.h index cebe4b74..8b554b5a 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -35,6 +35,7 @@ extern void statusline_getpos(int *x, int *y, int width, int height, int hx, int #define STATUSTYPE_DISPLAY 2 #define STATUSTYPE_INPUT 3 #define STATUSTYPE_CD 4 +#define STATUSTYPE_OTHER 5 extern bool createstatusline(void); extern void deletestatusline(void); diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 45ae3587..3b976c95 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -113,7 +113,7 @@ const static GUID GUID_DEVINTERFACE_MOUSE = { 0x378de44c, 0x56ef, 0x11d1, extern int harddrive_dangerous, do_rdbdump; extern int no_rawinput, no_directinput, no_windowsmouse; extern int force_directsound; -extern int log_a2065, a2065_promiscuous; +extern int log_a2065, a2065_promiscuous, log_ethernet; extern int rawinput_enabled_hid, rawinput_log; extern int log_filesys; extern int forcedframelatency; @@ -5581,6 +5581,7 @@ extern int log_cd32; extern int scanline_adjust; extern int log_ld; extern int logitech_lcd; +extern uae_s64 max_avi_size; extern DWORD_PTR cpu_affinity, cpu_paffinity; static DWORD_PTR original_affinity = -1; @@ -5598,6 +5599,21 @@ static int getval (const TCHAR *s) return 0; return v; } + +static uae_s64 getval64(const TCHAR *s) +{ + int base = 10; + uae_s64 v; + TCHAR *endptr; + + if (s[0] == '0' && _totupper(s[1]) == 'X') + s += 2, base = 16; + v = _wcstoui64(s, &endptr, base); + if (*endptr != '\0' || *s == '\0') + return 0; + return v; +} + #if 0 static float getvalf (const TCHAR *s) { @@ -5928,6 +5944,15 @@ static int parseargs (const TCHAR *argx, const TCHAR *np, const TCHAR *np2) } #endif + if (!_tcscmp(arg, _T("max_avi_size"))) { + max_avi_size = getval64(np); + return 2; + } + + if (!_tcscmp(arg, _T("ethlog"))) { + log_ethernet = getval(np); + return 2; + } if (!_tcscmp(arg, _T("scanlineadjust"))) { scanline_adjust = getval(np); return 2; diff --git a/od-win32/win32.h b/od-win32/win32.h index c9458f63..ce4e76a8 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("4") +#define WINUAEBETA _T("5") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2017, 9, 10) +#define WINUAEDATE MAKEBD(2017, 9, 30) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index ee1aebc9..1c15da0a 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -8939,7 +8939,6 @@ static struct expansionrom_gui accelerator_gui_item; static void reset_expansionrom_gui(HWND hDlg, struct expansionrom_gui *eg, DWORD itemselector, DWORD selector, DWORD checkbox, DWORD stringbox) { eg->expansionrom_gui_settings = NULL; - eg->expansionrom_gui_item = 0; eg->expansionrom_gui_ebs = NULL; eg->expansionrom_gui_string[0] = 0; hide(hDlg, itemselector, 1); @@ -8956,7 +8955,8 @@ static void create_expansionrom_gui(HWND hDlg, struct expansionrom_gui *eg, cons static int recursive; const struct expansionboardsettings *eb; if (eg->expansionrom_gui_ebs != ebs) { - eg->expansionrom_gui_item = 0; + if (eg->expansionrom_gui_ebs) + eg->expansionrom_gui_item = 0; reset = true; } eg->expansionrom_gui_ebs = ebs; @@ -8979,11 +8979,16 @@ static void create_expansionrom_gui(HWND hDlg, struct expansionrom_gui *eg, cons return; recursive++; +retry: int item = eg->expansionrom_gui_item; hide(hDlg, itemselector, 0); int bitcnt = 0; for (int i = 0; i < item; i++) { const struct expansionboardsettings *eb = &ebs[i]; + if (eb->name == NULL) { + eg->expansionrom_gui_item = 0; + goto retry; + } if (eb->type == EXPANSIONBOARD_STRING) { ; } else if (eb->type == EXPANSIONBOARD_MULTI) { diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index a0460670..0b5d04e2 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -4,6 +4,27 @@ JIT Direct current rules are less complex now. It automatically switches off onl - RTG VRAM is outside of reserved natmem space. Workaround: Move RTG in earlier position using Hardware info GUI panel. Note that in 64-bit version RTG VRAM must be inside of reserved natmem space. (Outside = error message and return back to GUI) +Beta 5: + +- Do not fallback to standard D3D9 from D3D9Ex if -nod3dshader command line is used, removed also other now mostly useless fallbacks. +- Reduce CPU Idle when DMA operation is active (directory filesystem/UAE HDF or true DMA SCSI controller). +- If Wait for blitter was enabled, blit used all available cycles and statefile was saved when blit was active: CPU state was saved before PC was increased. Restoring statefile would incorrectly restart the blit. +- Action Replay III CIA read/write internal NMI triggers need small delay (NMI must be delayed until following instruction completes). Fixes Virus Test "Boot" option hang. +- 341b2 mouse/joystick button release when input is uncaptured didn't fully set the new state. +- Include "JIT direct switched off: reason" message in error log. +- Relative path mode ignored Filesys path. +- Host FPU mode: set host FPU round to nearest mode temporarily (if needed) before calling any native C-library trigonometric functions, other rounding modes can return (very) wrong results. +- AVI recording file splitting (2G limit) flushed sound buffers causing random sound glitches. Added -max_avi_size -command line parameter to set split size. + +Cubo CD32 updates: + +- Cubo is now an expansion device under custom controllers, DIP switches and hardware feature enable/disable settings are also in expansion config. Cubo config needs to be made from scratch. +- NVRAM (Only in some later models) emulated, saved with CD32 nvram file. (1024 byte CD32 NVRAM + 2048 bytes Cubo + 16 byte Cubo RTC) +- PIC protection emulated (not used by all games), added configurable Cubo PIC language string (2 characters) and game specific security key string (4 characters). +- RTC (Only in some later models) emulated. Saved at the end of CD32 NVRAM file (16 bytes), games use unused timer registers as non-volatile data storage. + +- TODO: emulate different hardware variants. (different coin counter bits etc.. Information needed!) Current emulation supports latest (Odeon Twister 1/2?) version, only coin and ticket dispenser ("hopper" and "suzo" in service menu) are not implemented. + Beta 4: - If DirectDraw mode surface allocation fails, retry it with smaller size. -- 2.47.3