From: Toni Wilen Date: Tue, 1 Aug 2017 19:08:22 +0000 (+0300) Subject: Use current rom image path instead of replacing it with first found item if current... X-Git-Tag: 3600~138 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6989b529396ff8075dcdb94218cca7a1272c0a14;p=francis%2Fwinuae.git Use current rom image path instead of replacing it with first found item if current path is later in list. --- diff --git a/cfgfile.cpp b/cfgfile.cpp index fee61aa0..f235a532 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -3867,16 +3867,25 @@ static void decode_rom_ident (TCHAR *romfile, int maxlen, const TCHAR *ident, in 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); + if (rl[i]->path && !_tcscmp(rl[i]->path, romfile)) { + xfree(rl); + round = 0; goto end; } } + if (!rl[i]) { + 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); } }