From 164d021fef25f89fe089c80aaa922719f5f6f142 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 21 Feb 2023 18:18:10 +0200 Subject: [PATCH] Make sure initial disk position is not negative (new random number generator can generate full 32-bit values compared to old one) --- disk.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/disk.cpp b/disk.cpp index 9b3a5732..201ff08e 100644 --- a/disk.cpp +++ b/disk.cpp @@ -1402,6 +1402,7 @@ static int drive_insert (drive *drv, struct uae_prefs *p, int dnum, const TCHAR drv->useturbo = 0; drv->mfmpos = uaerand(); drv->mfmpos |= (uaerand() << 16); + drv->mfmpos &= 0xffffff; drv->mfmpos %= drv->tracklen; drv->prevtracklen = 0; @@ -1708,6 +1709,7 @@ static int drive_insert (drive *drv, struct uae_prefs *p, int dnum, const TCHAR drive_fill_bigbuf (drv, 1); drv->mfmpos = uaerand (); drv->mfmpos |= (uaerand () << 16); + drv->mfmpos &= 0xffffff; drv->mfmpos %= drv->tracklen; drv->prevtracklen = 0; if (!fake) { -- 2.47.3