]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Restore mfmpos after checking disk details
authorToni Wilen <twilen@winuae.net>
Sat, 25 Feb 2023 15:20:58 +0000 (17:20 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 25 Feb 2023 15:20:58 +0000 (17:20 +0200)
disk.cpp

index 22470d49259ece9cdb3849fcbfe872b4cee14253..6a6686f55dcf6273cd11369ff0eb5258d3a5b63a 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -5297,7 +5297,7 @@ void DISK_reset (void)
        setamax ();
 }
 
-static void load_track (int num, int cyl, int side, int *sectable)
+static void load_track (int num, int cyl, int dside, int *sectable)
 {
        int oldcyl, oldside, drvsec;
 
@@ -5306,7 +5306,7 @@ static void load_track (int num, int cyl, int side, int *sectable)
        oldcyl = drv->cyl;
        oldside = side;
        drv->cyl = cyl;
-       side = 0;
+       side = dside;
        drv->buffered_cyl = -1;
        drive_fill_bigbuf (drv, -1);
        decode_buffer (drv, drv->bigmfmbuf, drv->cyl, 11, drv->ddhd, drv->filetype, &drvsec, sectable, 1);
@@ -5491,8 +5491,8 @@ int DISK_examine_image(struct uae_prefs *p, int num, struct diskinfo *di, bool d
        drive *drv = &floppy[num];
        uae_u32 dos, crc, crc2;
        int wasdelayed = drv->dskchange_time;
-       int sectable[MAX_SECTORS];
-       int oldcyl, oldside;
+       int sectable[MAX_SECTORS] = { 0 };
+       int oldcyl, oldside, mfmpos;
        uae_u32 v = 0;
        bool fb = DISK_isfloppybridge(p, num);
 
@@ -5509,6 +5509,7 @@ int DISK_examine_image(struct uae_prefs *p, int num, struct diskinfo *di, bool d
        di->unreadable = true;
        oldcyl = drv->cyl;
        oldside = side;
+       mfmpos = drv->mfmpos;
        drv->cyl = 0;
        side = 0;
        if (!drive_insert (drv, p, num, p->floppyslots[num].df, true, true) || (!drv->diskfile && !drv->bridge)) {
@@ -5595,13 +5596,13 @@ end:
        }
 end2:
        load_track(num, oldcyl, oldside, sectable);
-       drive_image_free (drv);
        if (wasdelayed > 1) {
                drive_eject (drv);
                currprefs.floppyslots[num].df[0] = 0;
                drv->dskchange_time = wasdelayed;
                disk_insert (num, drv->newname);
        }
+       drv->mfmpos = mfmpos;
        return ret;
 }