cfgfile_save_options (configstore, p, 0);
uaeconfig--;
zfile_fwrite (zeros, 1, sizeof zeros, configstore);
+ zfile_truncate(configstore, zfile_ftell(configstore));
zfile_fseek (configstore, 0, SEEK_SET);
return true;
}
if (!configstore)
return 20;
- if (index < 0)
+ if (index < 0) {
+ index = 0;
zfile_fseek(configstore, 0, SEEK_SET);
+ } else {
+ // if seek position==0: configstore was reset, always start from the beginning.
+ if (zfile_ftell(configstore) > 0)
+ index = 0;
+ }
tmp[0] = 0;
for (;;) {
}
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;
- out[i] = b;
- out[i + 1] = 0;
- if (!b)
- break;
+ if (index <= 0) {
+ 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;
+ out[i] = b;
+ out[i + 1] = 0;
+ if (!b)
+ break;
+ }
}
+ err = 0xffffffff;
+ configsearchfound = true;
+ goto end;
+ } else {
+ index--;
}
- err = 0xffffffff;
- configsearchfound = true;
- goto end;
}
j = 0;
} else {
void config_check_vsync (void)
{
if (config_changed) {
-#ifdef WITH_LUA
+#if 0
if (config_changed == 1) {
createconfigstore (&currprefs);
uae_lua_run_handler ("on_uae_config_changed");
bool noquot = false;
bool first = true;
int adddelay = 0;
+ bool maybe_config_changed = false;
if (custom == NULL) {
return 0;
if (first) {
first = false;
if (!append)
- set_config_changed ();
+ maybe_config_changed = true;
}
if (!_tcsicmp (p, _T("no_config_check"))) {
config_changed = 0;
+ maybe_config_changed = false;
} else if (!_tcsicmp (p, _T("do_config_check"))) {
set_config_changed ();
} else if (!_tcsnicmp(p, _T("shellexec "), 10)) {
break;
p = nextp;
}
+ if (maybe_config_changed)
+ set_config_changed();
xfree (buf);
return 0;
}