From: Toni Wilen Date: Sat, 8 Oct 2022 12:15:28 +0000 (+0300) Subject: Manual config file floppybridge setting X-Git-Tag: 41000~120 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=359f4d0638b77166f7eae1d592ceba6c4fa17bea;p=francis%2Fwinuae.git Manual config file floppybridge setting --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 4c6019dd..7bd8565a 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -2019,6 +2019,10 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) _stprintf(tmp, _T("floppy%dsubtypeid"), i); cfgfile_dwrite_escape(f, tmp, _T("%s"), p->floppyslots[i].dfxsubtypeid); } + if (p->floppyslots[i].dfxprofile[0]) { + _stprintf(tmp, _T("floppy%dprofile"), i); + cfgfile_dwrite_escape(f, tmp, _T("%s"), p->floppyslots[i].dfxprofile); + } } _stprintf (tmp, _T("floppy%dsound"), i); cfgfile_dwrite (f, tmp, _T("%d"), p->floppyslots[i].dfxclick); @@ -6050,6 +6054,10 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH if (cfgfile_string_escape(option, value, tmpbuf, p->floppyslots[i].dfxsubtypeid, sizeof p->floppyslots[i].dfxsubtypeid / sizeof(TCHAR))) { return 1; } + _stprintf(tmpbuf, _T("floppy%dprofile"), i); + if (cfgfile_string_escape(option, value, tmpbuf, p->floppyslots[i].dfxprofile, sizeof p->floppyslots[i].dfxprofile / sizeof(TCHAR))) { + return 1; + } } if (cfgfile_intval (option, value, _T("chipmem_size"), &dummyint, 1)) { diff --git a/disk.cpp b/disk.cpp index 682d952e..8a0b3c66 100644 --- a/disk.cpp +++ b/disk.cpp @@ -5015,24 +5015,31 @@ static void floppybridge_init2(struct uae_prefs *p) bridge_type[dr] = type; FloppyBridgeAPI *bridge = NULL; int id = _tstol(p->floppyslots[dr].dfxsubtypeid); - const TCHAR *name = _tcschr(p->floppyslots[dr].dfxsubtypeid, ':'); - if (name) { - name++; - for (int i = 0; i < bridgeprofiles.size(); i++) { - FloppyBridgeAPI::FloppyBridgeProfileInformation fbpi = bridgeprofiles.at(i); - if (fbpi.profileID == id && !_tcscmp(fbpi.name, name)) { - bridge = FloppyBridgeAPI::createDriverFromProfileID(id); - break; - } - } - if (!bridge) { + if (p->floppyslots[dr].dfxprofile[0]) { + char *a = ua(p->floppyslots[dr].dfxprofile); + bridge = FloppyBridgeAPI::createDriverFromString(a); + xfree(a); + } + if (!bridge) { + const TCHAR *name = _tcschr(p->floppyslots[dr].dfxsubtypeid, ':'); + if (name) { + name++; for (int i = 0; i < bridgeprofiles.size(); i++) { FloppyBridgeAPI::FloppyBridgeProfileInformation fbpi = bridgeprofiles.at(i); - if (!_tcscmp(fbpi.name, name)) { - bridge = FloppyBridgeAPI::createDriverFromProfileID(fbpi.profileID); + if (fbpi.profileID == id && !_tcscmp(fbpi.name, name)) { + bridge = FloppyBridgeAPI::createDriverFromProfileID(id); break; } } + if (!bridge) { + for (int i = 0; i < bridgeprofiles.size(); i++) { + FloppyBridgeAPI::FloppyBridgeProfileInformation fbpi = bridgeprofiles.at(i); + if (!_tcscmp(fbpi.name, name)) { + bridge = FloppyBridgeAPI::createDriverFromProfileID(fbpi.profileID); + break; + } + } + } } } if (!bridge) { diff --git a/include/options.h b/include/options.h index 05fe3e10..a009b053 100644 --- a/include/options.h +++ b/include/options.h @@ -163,6 +163,7 @@ struct floppyslot int dfxtype; int dfxsubtype; TCHAR dfxsubtypeid[32]; + TCHAR dfxprofile[32]; int dfxclick; TCHAR dfxclickexternal[256]; bool forcedwriteprotect;