From: Toni Wilen Date: Sun, 16 Oct 2022 10:49:30 +0000 (+0300) Subject: Reconfigure floppybridge config fully when changed on the fly. X-Git-Tag: 41000~116 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=1b6944d02865afbbd4854534c068dd6d8a688c31;p=francis%2Fwinuae.git Reconfigure floppybridge config fully when changed on the fly. --- diff --git a/disk.cpp b/disk.cpp index 8a0b3c66..13a4e878 100644 --- a/disk.cpp +++ b/disk.cpp @@ -3284,6 +3284,24 @@ void disk_insert_force (int num, const TCHAR *name, bool forcedwriteprotect) disk_insert_2 (num, name, 1, forcedwriteprotect); } +static void floppybridge_getsetprofile(int i) +{ + if (currprefs.floppyslots[i].dfxsubtype == 0 || currprefs.floppyslots[i].dfxsubtypeid[0] == 0) { + int sub = currprefs.floppyslots[i].dfxsubtype; + if (sub == 0) { + sub = 1; + } + if (sub - 1 < bridgeprofiles.size()) { + int nsub = sub - 1; + TCHAR tmp[32]; + _stprintf(tmp, _T("%d:%s"), bridgeprofiles.at(nsub).profileID, bridgeprofiles.at(nsub).name); + currprefs.floppyslots[i].dfxsubtype = changed_prefs.floppyslots[i].dfxsubtype = sub; + _tcscpy(changed_prefs.floppyslots[i].dfxsubtypeid, tmp); + _tcscpy(currprefs.floppyslots[i].dfxsubtypeid, changed_prefs.floppyslots[i].dfxsubtypeid); + } + } +} + static void DISK_check_change (void) { if (currprefs.floppy_speed != changed_prefs.floppy_speed) @@ -3300,11 +3318,16 @@ static void DISK_check_change (void) */ setdskchangetime(drv, 2 * 50 * 312); } - if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype) { + if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype || + currprefs.floppyslots[i].dfxsubtype != changed_prefs.floppyslots[i].dfxsubtype) { int old = currprefs.floppyslots[i].dfxtype; currprefs.floppyslots[i].dfxtype = changed_prefs.floppyslots[i].dfxtype; + currprefs.floppyslots[i].dfxsubtype = changed_prefs.floppyslots[i].dfxsubtype; + _tcscpy(currprefs.floppyslots[i].dfxsubtypeid, changed_prefs.floppyslots[i].dfxsubtypeid); + _tcscpy(currprefs.floppyslots[i].dfxprofile, changed_prefs.floppyslots[i].dfxprofile); #ifdef FLOPPYBRIDGE if (old >= DRV_FB || currprefs.floppyslots[i].dfxtype >= DRV_FB) { + floppybridge_getsetprofile(i); floppybridge_init(&currprefs); } #endif