]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Reconfigure floppybridge config fully when changed on the fly.
authorToni Wilen <twilen@winuae.net>
Sun, 16 Oct 2022 10:49:30 +0000 (13:49 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 16 Oct 2022 10:49:30 +0000 (13:49 +0300)
disk.cpp

index 8a0b3c66cb625729aaab89e6088640dd767499bc..13a4e878f92a234948508c55437492c0676928ba 100644 (file)
--- 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