]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2600b8
authorToni Wilen <twilen@winuae.net>
Sat, 23 Feb 2013 15:11:20 +0000 (17:11 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 23 Feb 2013 15:11:20 +0000 (17:11 +0200)
29 files changed:
a2091.cpp
blkdev.cpp
cfgfile.cpp
custom.cpp
disk.cpp
filesys.cpp
fpp.cpp
gayle.cpp
hardfile.cpp
include/autoconf.h
include/blkdev.h
include/disk.h
include/fsdb.h
include/memory.h
include/options.h
include/scsi.h
memory.cpp
newcpu.cpp
od-win32/direct3d.cpp
od-win32/fsdb_mywin32.cpp
od-win32/hardfile_win32.cpp
od-win32/rp.cpp
od-win32/rp.h
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
od-win32/winuaechangelog.txt
scsi.cpp

index cfcda1b9291abe3bd130627ebd15586a2d2f922e..ec403804897e352847608c0a12f43d26393771fa 100644 (file)
--- a/a2091.cpp
+++ b/a2091.cpp
@@ -290,7 +290,7 @@ static void doscsistatus (uae_u8 status)
 {
        wdregs[WD_SCSI_STATUS] = status;
        auxstatus |= ASR_INT;
-#if WD33C93_DEBUG > 0
+#if WD33C93_DEBUG > 1
        write_log (_T("%s STATUS=%02X\n"), WD33C93, status);
 #endif
        if (currprefs.cs_cdtvscsi) {
@@ -911,9 +911,10 @@ void wdscsi_put (uae_u8 d)
                write_log (_T("%s in use\n"), WD33C93);
        }
        if (sasr == WD_COMMAND_PHASE) {
-#if WD33C93_DEBUG > 0
+#if WD33C93_DEBUG > 1
                write_log (_T("%s PHASE=%02X\n"), WD33C93, d);
 #endif
+               ;
        } else if (sasr == WD_DATA) {
 #if WD33C93_DEBUG_PIO
                write_log (_T("%s WD_DATA WRITE %02x %d/%d\n"), WD33C93, d, scsi->offset, scsi->data_len);
@@ -1663,7 +1664,7 @@ int add_scsi_cd (int ch, int unitnum)
 {
        device_func_init (0);
        freescsi (scsis[ch]);
-       scsis[ch] = scsi_alloc_cd (ch, unitnum);
+       scsis[ch] = scsi_alloc_cd (ch, unitnum, false);
        return scsis[ch] ? 1 : 0;
 }
 
index a64b7d3616ef7690c39f8ce285a55be1c54dcddf..a1e491942d454c1778333fa097b41683ceaf210b 100644 (file)
@@ -1147,7 +1147,7 @@ static int scsi_read_cd (int unitnum, uae_u8 *cmd, uae_u8 *data, struct device_i
 }
 
 int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
-       uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len)
+       uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len, bool atapi)
 {
        uae_u64 len, offset;
        int lr = 0, ls = 0;
@@ -1194,8 +1194,10 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                r[1] |= 0x80; // removable
                r[2] = 2; /* supports SCSI-2 */
                r[3] = 2; /* response data format */
+               if (atapi)
+                       r[3] |= 3 << 5; // atapi transport version
                r[4] = 32; /* additional length */
-               r[7] = 0x20; /* 16 bit bus */
+               r[7] = 0;
                scsi_len = lr = len < 36 ? (uae_u32)len : 36;
                r[2] = 2;
                r[3] = 2;
@@ -1249,6 +1251,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
        case 0x1a: /* MODE SENSE(6) */
        {
                uae_u8 *p;
+               int maxlen;
                bool pcodeloop = false;
                bool sense10 = cmdbuf[0] == 0x5a;
                int psize, totalsize, bdsize;
@@ -1262,6 +1265,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                p = r;
                if (sense10) {
                        totalsize = 8 - 2;
+                       maxlen = (cmdbuf[7] << 8) | cmdbuf[8];
                        p[2] = 0;
                        p[3] = 0;
                        p[4] = 0;
@@ -1271,6 +1275,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                        p += 8;
                } else {
                        totalsize = 4 - 1;
+                       maxlen = cmdbuf[4];
                        p[1] = 0;
                        p[2] = 0;
                        p[3] = 0;
@@ -1298,6 +1303,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                                p[2] = 0x20;
                                p[3] = 0;
                                psize = 4;
+#if 0
                        } else if (pcode == 3) {
                                if (nodisk (&di))
                                        goto nodisk;
@@ -1321,6 +1327,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                                wl(p + 13, di.cylinders);
                                ww(p + 20, 0);
                                psize = p[1];
+#endif
                        } else if (pcode == 14) { // CD audio control
                                uae_u32 vol = sys_command_cd_volume (unitnum, 0xffff, 0xffff);
                                p[0] = 0x0e;
@@ -1334,6 +1341,25 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                                p[10] = 2;
                                p[11] = pc == 0 ? (vol >> (16 + 7)) & 0xff : 0xff;
                                psize = p[1];
+                       } else if (pcode == 0x2a) {  // cd/dvd capabilities
+                               p[0] = 0x2a;
+                               p[1] = 0x18;
+                               p[2] = 1; // | 0x10 | 0x20; // read: CD-R/DVD-ROM/DVD-R
+                               p[3] = 0; // write: nothing
+                               p[4] = 0x40 | 0x20 | 0x10 | 0x01;
+                               p[5] = 0x08 | 0x04 | 0x02 | 0x01;
+                               p[6] = (1 << 5) | 0x10; // type = tray, eject supported
+                               p[7] = 3; // separate channel mute and volume
+                               p[8] = 2; p[9] = 0;
+                               p[10] = 0xff; p[11] = 0xff; // number of volume levels
+                               p[12] = 4; p[13] = 0; // "1M buffer"
+                               p[14] = 2; p[15] = 0;
+                               p[16] = 0;
+                               p[17] = 0;
+                               p[18] = p[19] = 0;
+                               p[20] = p[21] = 0;
+                               p[22] = p[23] = 0;
+                               psize = p[1];
                        } else {
                                if (!pcodeloop)
                                        goto err;
@@ -1360,6 +1386,8 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                        r[0] = totalsize & 0xff;
                }
                scsi_len = lr = totalsize + 1;
+               if (scsi_len > maxlen)
+                       scsi_len = maxlen;
        }
        break;
        case 0x01: /* REZERO UNIT */
@@ -1375,7 +1403,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                        int cyl, cylsec, head, tracksec;
                        if (nodisk (&di))
                                goto nodisk;
-                       uae_u32 blocks = di.sectorspertrack * di.cylinders * di.trackspercylinder;
+                       uae_u32 blocks = di.sectorspertrack * di.cylinders * di.trackspercylinder - 1;
                        cyl = di.cylinders;
                        head = 1;
                        cylsec = tracksec = di.trackspercylinder;
@@ -1862,7 +1890,7 @@ static int execscsicmd_direct (int unitnum, struct amigascsi *as)
        if (as->sense_len > 32)
                as->sense_len = 32;
 
-       as->status = scsi_cd_emulate (unitnum, cmd, as->cmd_len, scsi_datap, &datalen, replydata, &replylen, as->sensedata, &senselen);
+       as->status = scsi_cd_emulate (unitnum, cmd, as->cmd_len, scsi_datap, &datalen, replydata, &replylen, as->sensedata, &senselen, false);
 
        as->cmdactual = as->status != 0 ? 0 : as->cmd_len; /* fake scsi_CmdActual */
        if (as->status) {
index 9b3197536fb4211a0277f39d8ed7147e30fa23d0..0fbfd02c3093ff7830b0a3b5bdf7ff376029efd1 100644 (file)
@@ -701,11 +701,14 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
                cfgfile_write_path (f, &p->path_rom, _T("amax_rom_file"), p->amaxromfile);
 
        cfgfile_write_bool (f, _T("kickshifter"), p->kickshifter);
+       cfgfile_write_bool (f, _T("ks_write_enabled"), p->rom_readwrite);
 
        p->nr_floppies = 4;
        for (i = 0; i < 4; i++) {
                _stprintf (tmp, _T("floppy%d"), i);
                cfgfile_write_path (f, &p->path_floppy, tmp, p->floppyslots[i].df);
+               _stprintf (tmp, _T("floppy%dwp"), i);
+               cfgfile_dwrite_bool (f, tmp, p->floppyslots[i].forcedwriteprotect);
                _stprintf (tmp, _T("floppy%dtype"), i);
                cfgfile_dwrite (f, tmp, _T("%d"), p->floppyslots[i].dfxtype);
                _stprintf (tmp, _T("floppy%dsound"), i);
@@ -905,10 +908,14 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        for (int i = 0; i <MAX_FILTERSHADERS; i++) {
                if (p->gfx_filtershader[i][0])
                        cfgfile_write (f, _T("gfx_filter_pre"), _T("D3D:%s"), p->gfx_filtershader[i]);
+               if (p->gfx_filtermask[i][0])
+                       cfgfile_write_str (f, _T("gfx_filtermask_pre"), p->gfx_filtermask[i]);
        }
        for (int i = 0; i <MAX_FILTERSHADERS; i++) {
                if (p->gfx_filtershader[i + MAX_FILTERSHADERS][0])
                        cfgfile_write (f, _T("gfx_filter_post"), _T("D3D:%s"), p->gfx_filtershader[i + MAX_FILTERSHADERS]);
+               if (p->gfx_filtermask[i + MAX_FILTERSHADERS][0])
+                       cfgfile_write_str (f, _T("gfx_filtermask_post"), p->gfx_filtermask[i + MAX_FILTERSHADERS]);
        }
        if (p->gfx_filtershader[0][0] && p->gfx_api) {
                cfgfile_dwrite (f, _T("gfx_filter"), _T("D3D:%s"), p->gfx_filtershader[0]);
@@ -951,7 +958,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_dwrite (f, _T("gfx_luminance"), _T("%d"), p->gfx_luminance);
        cfgfile_dwrite (f, _T("gfx_contrast"), _T("%d"), p->gfx_contrast);
        cfgfile_dwrite (f, _T("gfx_gamma"), _T("%d"), p->gfx_gamma);
-       cfgfile_dwrite_str (f, _T("gfx_filter_mask"), p->gfx_filtermask);
+       cfgfile_dwrite_str (f, _T("gfx_filter_mask"), p->gfx_filtermask[2 * MAX_FILTERSHADERS - 1]);
        if (p->gfx_filteroverlay[0]) {
                cfgfile_dwrite (f, _T("gfx_filter_overlay"), _T("%s%s"),
                        p->gfx_filteroverlay, _tcschr (p->gfx_filteroverlay, ',') ? _T(",") : _T(""));
@@ -1615,7 +1622,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_intval (option, value, _T("gfx_gamma"), &p->gfx_gamma, 1)
                || cfgfile_intval (option, value, _T("gfx_filter_keep_autoscale_aspect"), &p->gfx_filter_keep_autoscale_aspect, 1)
                || cfgfile_intval (option, value, _T("gfx_horizontal_tweak"), &p->gfx_extrawidth, 1)
-               || cfgfile_string (option, value, _T("gfx_filter_mask"), p->gfx_filtermask, sizeof p->gfx_filtermask / sizeof (TCHAR))
+               || cfgfile_string (option, value, _T("gfx_filter_mask"), p->gfx_filtermask[2 * MAX_FILTERSHADERS - 1], sizeof p->gfx_filtermask[2 * MAX_FILTERSHADERS - 1] / sizeof (TCHAR))
                || cfgfile_intval (option, value, _T("filesys_max_size"), &p->filesys_limit, 1)
 
                || cfgfile_floatval (option, value, _T("rtg_vert_zoom_multf"), &p->rtg_vert_zoom_mult)
@@ -1639,6 +1646,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                return 1;
 
        if (cfgfile_yesno (option, value, _T("use_debugger"), &p->start_debugger)
+               || cfgfile_yesno (option, value, _T("floppy0wp"), &p->floppyslots[0].forcedwriteprotect)
+               || cfgfile_yesno (option, value, _T("floppy1wp"), &p->floppyslots[1].forcedwriteprotect)
+               || cfgfile_yesno (option, value, _T("floppy2wp"), &p->floppyslots[2].forcedwriteprotect)
+               || cfgfile_yesno (option, value, _T("floppy3wp"), &p->floppyslots[3].forcedwriteprotect)
                || cfgfile_yesno (option, value, _T("sampler_stereo"), &p->sampler_stereo)
                || cfgfile_yesno (option, value, _T("sound_auto"), &p->sound_auto)
                || cfgfile_yesno (option, value, _T("sound_stereo_swap_paula"), &p->sound_stereo_swap_paula)
@@ -2902,6 +2913,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
                || cfgfile_yesno (option, value, _T("synchronize_clock"), &p->tod_hack)
 
                || cfgfile_yesno (option, value, _T("kickshifter"), &p->kickshifter)
+               || cfgfile_yesno (option, value, _T("ks_write_enabled"), &p->rom_readwrite)
                || cfgfile_yesno (option, value, _T("ntsc"), &p->ntscmode)
                || cfgfile_yesno (option, value, _T("sana2"), &p->sana2)
                || cfgfile_yesno (option, value, _T("genlock"), &p->genlock)
@@ -4630,8 +4642,8 @@ void default_prefs (struct uae_prefs *p, int type)
        p->gfx_filter = 0;
        for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) {
                p->gfx_filtershader[i][0] = 0;
+               p->gfx_filtermask[i][0] = 0;
        }
-       p->gfx_filtermask[0] = 0;
        p->gfx_filter_horiz_zoom_mult = 1.0;
        p->gfx_filter_vert_zoom_mult = 1.0;
        p->gfx_filter_bilinear = 0;
index 0a594e97666d21051535c13cc08c7fb5cf4fbf48..220d2b33dd9cad3c244d72b8967a0d1b23a8fd86 100644 (file)
@@ -640,10 +640,12 @@ STATIC_INLINE int GET_PLANES_LIMIT (uae_u16 bc0)
        return real_bitplane_number[fetchmode][res][planes];
 }
 
+#define HARD_DDF_LIMITS_DISABLED ((beamcon0 & 0x80) || (bplcon0 & 0x40))
 /* The HRM says 0xD8, but that can't work... */
-#define HARD_DDF_STOP ((beamcon0 & 0x80) ? 0xff : 0xd4)
+#define HARD_DDF_STOP (HARD_DDF_LIMITS_DISABLED ? 0xff : 0xd4)
 #define HARD_DDF_START_REAL 0x18
-#define HARD_DDF_START ((beamcon0 & 0x80) ? 0x10 : 0x18)
+/* Programmed rates or superhires (!) disable normal DMA limits */
+#define HARD_DDF_START (HARD_DDF_LIMITS_DISABLED ? 0x04 : 0x18)
 
 static void add_modulos (void)
 {
index b9c2d9e1f46bdec8307c6a1c68afebc7aff28ef5..37f9680bb2e9de289a2e3b2a76edc16796c73f36 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -161,6 +161,7 @@ typedef struct {
        int motordelay; /* dskrdy needs some clock cycles before it changes after switching off motor */
        bool state;
        bool wrprot;
+       bool forcedwrprot;
        uae_u16 bigmfmbuf[0x4000 * DDHDMULT];
        uae_u16 tracktiming[0x4000 * DDHDMULT];
        int multi_revolution;
@@ -187,6 +188,7 @@ typedef struct {
        int idbit;
        unsigned long drive_id; /* drive id to be reported */
        TCHAR newname[256]; /* storage space for new filename during eject delay */
+       bool newnamewriteprotected;
        uae_u32 crc32;
 #ifdef FDI2RAW
        FDI *fdi;
@@ -621,7 +623,7 @@ static void drive_image_free (drive *drv)
        drv->writediskfile = 0;
 }
 
-static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake);
+static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake, bool writeprotected);
 
 static void reset_drive_gui (int num)
 {
@@ -683,7 +685,8 @@ static void reset_drive (int num)
        drive_settype_id (drv);
        _tcscpy (currprefs.floppyslots[num].df, changed_prefs.floppyslots[num].df);
        drv->newname[0] = 0;
-       if (!drive_insert (drv, &currprefs, num, currprefs.floppyslots[num].df, false))
+       drv->newnamewriteprotected = false;
+       if (!drive_insert (drv, &currprefs, num, currprefs.floppyslots[num].df, false, false))
                disk_eject (num);
 }
 
@@ -925,7 +928,7 @@ static bool diskfile_iswriteprotect (struct uae_prefs *p, const TCHAR *fname, in
        return wrprot1;
 }
 
-static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake)
+static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake, bool forcedwriteprotect)
 {
        uae_u8 buffer[2 + 2 + 4 + 4];
        trackid *tid;
@@ -935,6 +938,9 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
 
        drive_image_free (drv);
        DISK_validate_filename (p, fname, 1, &drv->wrprot, &drv->crc32, &drv->diskfile);
+       drv->forcedwrprot = forcedwriteprotect;
+       if (drv->forcedwrprot)
+               drv->wrprot = true;
        drv->ddhd = 1;
        drv->num_secs = 0;
        drv->hard_num_cyls = p->floppyslots[dnum].dfxtype == DRV_525_SD ? 40 : 80;
@@ -966,9 +972,12 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
 
        _tcsncpy (currprefs.floppyslots[dnum].df, fname, 255);
        currprefs.floppyslots[dnum].df[255] = 0;
+       currprefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect;
        _tcsncpy (changed_prefs.floppyslots[dnum].df, fname, 255);
        changed_prefs.floppyslots[dnum].df[255] = 0;
+       changed_prefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect;
        _tcscpy (drv->newname, fname);
+       drv->newnamewriteprotected = forcedwriteprotect;
        gui_filename (dnum, fname);
 
        memset (buffer, 0, sizeof buffer);
@@ -982,7 +991,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
 
        if (drv->catweasel) {
 
-               drv->wrprot = 1;
+               drv->wrprot = true;
                drv->filetype = ADF_CATWEASEL;
                drv->num_tracks = 80;
                drv->ddhd = 1;
@@ -990,7 +999,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
 #ifdef CAPS
        } else if (strncmp ((char*)buffer, "CAPS", 4) == 0) {
 
-               drv->wrprot = 1;
+               drv->wrprot = true;
                if (!caps_loadimage (drv->diskfile, drv - floppy, &num_tracks)) {
                        zfile_fclose (drv->diskfile);
                        drv->diskfile = 0;
@@ -1002,7 +1011,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
 #ifdef FDI2RAW
        } else if (drv->fdi = fdi2raw_header (drv->diskfile)) {
 
-               drv->wrprot = 1;
+               drv->wrprot = true;
                drv->num_tracks = fdi2raw_get_last_track (drv->fdi);
                drv->num_secs = fdi2raw_get_num_sector (drv->fdi);
                drv->filetype = ADF_FDI;
@@ -1019,7 +1028,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
                int offs = 160 * 4 + 8;
                int i;
 
-               drv->wrprot = 1;
+               drv->wrprot = true;
                drv->filetype = ADF_EXT1;
                drv->num_tracks = 160;
                drv->num_secs = 11;
@@ -1282,7 +1291,7 @@ static int drive_writeprotected (drive * drv)
        if (drv->catweasel)
                return 1;
 #endif
-       return currprefs.floppy_read_only || drv->wrprot || drv->diskfile == NULL;
+       return currprefs.floppy_read_only || drv->wrprot || drv->forcedwrprot || drv->diskfile == NULL;
 }
 
 static int drive_running (drive * drv)
@@ -2498,18 +2507,20 @@ TCHAR *DISK_history_get (int idx, int type)
        return dfxhistory[type][idx];
 }
 
-static void disk_insert_2 (int num, const TCHAR *name, int forced)
+static void disk_insert_2 (int num, const TCHAR *name, bool forced, bool forcedwriteprotect)
 {
        drive *drv = floppy + num;
 
        if (forced) {
-               drive_insert (drv, &currprefs, num, name, false);
+               drive_insert (drv, &currprefs, num, name, false, forcedwriteprotect);
                return;
        }
        if (!_tcscmp (currprefs.floppyslots[num].df, name))
                return;
        _tcscpy (drv->newname, name);
+       drv->newnamewriteprotected = forcedwriteprotect;
        _tcscpy (currprefs.floppyslots[num].df, name);
+       currprefs.floppyslots[num].forcedwriteprotect = forcedwriteprotect;
        DISK_history_add (name, -1, HISTORY_FLOPPY, 0);
        if (name[0] == 0) {
                disk_eject (num);
@@ -2525,15 +2536,22 @@ static void disk_insert_2 (int num, const TCHAR *name, int forced)
        }
 }
 
+void disk_insert (int num, const TCHAR *name, bool forcedwriteprotect)
+{
+       config_changed = 1;
+       target_addtorecent (name, 0);
+       disk_insert_2 (num, name, 0, forcedwriteprotect);
+}
+
 void disk_insert (int num, const TCHAR *name)
 {
        config_changed = 1;
        target_addtorecent (name, 0);
-       disk_insert_2 (num, name, 0);
+       disk_insert_2 (num, name, 0, false);
 }
-void disk_insert_force (int num, const TCHAR *name, bool writeprotected)
+void disk_insert_force (int num, const TCHAR *name, bool forcedwriteprotect)
 {
-       disk_insert_2 (num, name, 1);
+       disk_insert_2 (num, name, 1, forcedwriteprotect);
 }
 
 static void DISK_check_change (void)
@@ -2558,7 +2576,7 @@ void DISK_vsync (void)
        for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) {
                drive *drv = floppy + i;
                if (drv->dskchange_time == 0 && _tcscmp (currprefs.floppyslots[i].df, changed_prefs.floppyslots[i].df))
-                       disk_insert (i, changed_prefs.floppyslots[i].df);
+                       disk_insert (i, changed_prefs.floppyslots[i].df, changed_prefs.floppyslots[i].forcedwriteprotect);
                if (drv->dskready_down_time > 0)
                        drv->dskready_down_time--;
                /* emulate drive motor turn on time */
@@ -2571,7 +2589,7 @@ void DISK_vsync (void)
                if (drv->dskchange_time > 0) {
                        drv->dskchange_time--;
                        if (drv->dskchange_time == 0) {
-                               drive_insert (drv, &currprefs, i, drv->newname, false);
+                               drive_insert (drv, &currprefs, i, drv->newname, false, drv->newnamewriteprotected);
                                if (disk_debug_logging > 0)
                                        write_log (_T("delayed insert, drive %d, image '%s'\n"), i, drv->newname);
                                update_drive_gui (i, false);
@@ -3614,7 +3632,7 @@ void DISK_init (void)
                drive *drv = &floppy[dr];
                /* reset all drive types to 3.5 DD */
                drive_settype_id (drv);
-               if (!drive_insert (drv, &currprefs, dr, currprefs.floppyslots[dr].df, false))
+               if (!drive_insert (drv, &currprefs, dr, currprefs.floppyslots[dr].df, false, currprefs.floppyslots[dr].forcedwriteprotect))
                        disk_eject (dr);
        }
        if (disk_empty (0))
@@ -3654,7 +3672,7 @@ int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32)
        oldside = side;
        drv->cyl = 0;
        side = 0;
-       if (!drive_insert (drv, p, num, p->floppyslots[num].df, true) || !drv->diskfile) {
+       if (!drive_insert (drv, p, num, p->floppyslots[num].df, true, true) || !drv->diskfile) {
                drv->cyl = oldcyl;
                side = oldside;
                return 1;
@@ -3837,16 +3855,16 @@ uae_u8 *restore_disk (int num,uae_u8 *src)
                        *currprefs.floppyslots[num].df = *changed_prefs.floppyslots[num].df = 0;
                        drv->dskchange = false;
                } else if (newis) {
-                       drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false);
+                       drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false, false);
                        if (drive_empty (floppy + num)) {
                                if (newis && old[0]) {
                                        _tcscpy (changed_prefs.floppyslots[num].df, old);
-                                       drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false);
+                                       drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df, false, false);
                                        if (drive_empty (floppy + num))
                                                drv->dskchange = true;
                                } else {
                                        drv->dskchange_time = -1;
-                                       }
+                               }
                        }
                }
        }
@@ -3889,7 +3907,7 @@ uae_u8 *save_disk (int num, int *len, uae_u8 *dstptr, bool usepath)
        else
                dstbak = dst = xmalloc (uae_u8, 2 + 1 + 1 + 1 + 1 + 4 + 4 + 256);
        save_u32 (drv->drive_id);           /* drive type ID */
-       save_u8 ((drv->motoroff ? 0 : 1) | ((disabled & (1 << num)) ? 2 : 0) | (drv->idbit ? 4 : 0) | (drv->dskchange ? 8 : 0) | (side ? 16 : 0));
+       save_u8 ((drv->motoroff ? 0 : 1) | ((disabled & (1 << num)) ? 2 : 0) | (drv->idbit ? 4 : 0) | (drv->dskchange ? 8 : 0) | (side ? 16 : 0) | (drv->wrprot ? 32 : 0));
        save_u8 (drv->cyl);                             /* cylinder */
        save_u8 (drv->dskready);            /* dskready */
        save_u8 (drv->drive_id_scnt);   /* id mode position */
index 0012a291a85fd553f9dd48cbce0ef6405e9b54b5..e307e267b2166a93476d08acbf422221428e7620 100644 (file)
@@ -529,6 +529,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci)
        bool emptydrive = false;
        bool iscd;
        struct uaedev_config_info c;
+       TCHAR newrootdir[MAX_DPATH];
 
        memcpy (&c, ci, sizeof (struct uaedev_config_info));
 
@@ -545,6 +546,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci)
                }
        }
 
+       my_resolveshortcut (c.rootdir, MAX_DPATH);
        iscd = nr >= cd_unit_offset && nr < cd_unit_offset + cd_unit_number;
 
        for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
@@ -1431,7 +1433,7 @@ static void setsystime_vblank (void)
        }
 }
 
-int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags)
+int filesys_insert (int nr, const TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags)
 {
        UnitInfo *ui;
        Unit *u;
diff --git a/fpp.cpp b/fpp.cpp
index 233fd2504274381243d16ec5e879f56ba2449f05..bec59ff3b65b0127a0edc30e305463c62306628f 100644 (file)
--- a/fpp.cpp
+++ b/fpp.cpp
@@ -228,6 +228,7 @@ static void fpu_op_illg2 (uae_u16 opcode, uae_u32 ea, uaecptr oldpc)
 #endif
                        return;
        }
+       m68k_setpc (oldpc);
        op_illg (opcode);
 }
 
@@ -245,6 +246,16 @@ static bool fault_if_no_fpu (uae_u16 opcode, uaecptr ea, uaecptr oldpc)
        return false;
 }
 
+static bool fault_if_no_6888x (uae_u16 opcode, uaecptr oldpc)
+{
+       if (currprefs.cpu_model < 68040 && currprefs.fpu_model <= 0) {
+               m68k_setpc (oldpc);
+               op_illg (opcode);
+               return true;
+       }
+       return false;
+}
+
 static         void fpu_noinst (uae_u16 opcode, uaecptr pc)
 {
        write_log (_T("Unknown FPU instruction %04X %08X\n"), opcode, pc);
@@ -887,6 +898,8 @@ void fpuop_dbcc (uae_u32 opcode, uae_u16 extra)
        if (!isinrom ())
                write_log (_T("fdbcc_opp at %08lx\n"), m68k_getpc ());
 #endif
+       if (fault_if_no_6888x (opcode, pc - 4))
+               return;
 
        disp = (uae_s32) (uae_s16) x_next_iword ();
        if (fault_if_no_fpu (opcode, pc + disp, pc))
@@ -991,6 +1004,9 @@ void fpuop_save (uae_u32 opcode)
                write_log (_T("fsave_opp at %08lx\n"), m68k_getpc ());
 #endif
 
+       if (fault_if_no_6888x (opcode, pc))
+               return;
+
        if (get_fp_ad (opcode, &ad) == 0) {
                fpu_op_illg (opcode, pc);
                return;
@@ -1098,6 +1114,9 @@ void fpuop_restore (uae_u32 opcode)
                write_log (_T("frestore_opp at %08lx\n"), m68k_getpc ());
 #endif
 
+       if (fault_if_no_6888x (opcode, pc))
+               return;
+
        if (get_fp_ad (opcode, &ad) == 0) {
                fpu_op_illg (opcode, pc);
                return;
@@ -1336,6 +1355,8 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra)
        if (!isinrom ())
                write_log (_T("FPP %04lx %04x at %08lx\n"), opcode & 0xffff, extra, pc);
 #endif
+       if (fault_if_no_6888x (opcode, pc))
+               return;
 
        switch ((extra >> 13) & 0x7)
        {
index cfbb68be731d6529fab7e6acc8e5e4299486e738..cabe12345aef3dfa384e7057c35a0559afccd117 100644 (file)
--- a/gayle.cpp
+++ b/gayle.cpp
@@ -209,7 +209,7 @@ struct ide_hdf
        int packet_data_size;
        int packet_data_offset;
        int packet_transfer_size;
-       struct scsi_data scsi;
+       struct scsi_data *scsi;
 };
 
 #define TOTAL_IDE 3
@@ -777,7 +777,8 @@ static bool atapi_set_size (struct ide_hdf *ide)
                ide->packet_transfer_size = 12;
        }
        ide->regs.ide_status = IDE_STATUS_DRQ;
-       write_log (_T("ATAPI data transfer %d/%d bytes\n"), ide->packet_transfer_size, ide->data_size);
+       if (IDE_LOG > 1)
+               write_log (_T("ATAPI data transfer %d/%d bytes\n"), ide->packet_transfer_size, ide->data_size);
        return false;
 }
 
@@ -800,29 +801,29 @@ static void atapi_packet (void)
 
 static void do_packet_command (struct ide_hdf *ide)
 {
-       memcpy (ide->scsi.cmd, ide->secbuf, 12);
-       ide->scsi.cmd_len = 12;
+       memcpy (ide->scsi->cmd, ide->secbuf, 12);
+       ide->scsi->cmd_len = 12;
        if (IDE_LOG > 0) {
-               uae_u8 *c = ide->scsi.cmd;
+               uae_u8 *c = ide->scsi->cmd;
                write_log (_T("ATASCSI %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x\n"),
                        c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[12]);
        }
        ide->direction = 0;
-       scsi_emulate_analyze (&ide->scsi);
-       if (ide->scsi.direction <= 0) {
+       scsi_emulate_analyze (ide->scsi);
+       if (ide->scsi->direction <= 0) {
                // data in
-               ide->scsi.data_len = SECBUF_SIZE;
-               scsi_emulate_cmd (&ide->scsi);
-               ide->data_size = ide->scsi.data_len;
+               ide->scsi->data_len = SECBUF_SIZE;
+               scsi_emulate_cmd (ide->scsi);
+               ide->data_size = ide->scsi->data_len;
                ide->regs.ide_status = 0;
-               if (ide->scsi.status) {
+               if (ide->scsi->status) {
                        // error
                        ide->regs.ide_status = ATAPI_STATUS_CHK;
-                       ide->regs.ide_error = ide->scsi.status << 4;
+                       ide->regs.ide_error = ide->scsi->status << 4;
                        atapi_data_done ();
-               } else if (ide->scsi.data_len) {
+               } else if (ide->scsi->data_len) {
                        // data in
-                       memcpy (ide->secbuf, ide->scsi.buffer, ide->scsi.data_len);
+                       memcpy (ide->secbuf, ide->scsi->buffer, ide->scsi->data_len);
                        ide->regs.ide_nsector = ATAPI_IO;
                } else {
                        // no data
@@ -832,7 +833,7 @@ static void do_packet_command (struct ide_hdf *ide)
                // data out
                ide->direction = 1;
                ide->regs.ide_nsector = 0;
-               ide->data_size = ide->scsi.data_len;
+               ide->data_size = ide->scsi->data_len;
        }
        ide->packet_state = 2; // data phase
        atapi_set_size (ide);
@@ -849,9 +850,9 @@ static void do_process_packet_command (struct ide_hdf *ide)
                        atapi_set_size (ide);
                } else {
                        if (atapi_set_size (ide)) {
-                               memcpy (&ide->scsi.buffer, ide->secbuf, ide->data_size);
-                               ide->scsi.data_len = ide->data_size;
-                               scsi_emulate_cmd (&ide->scsi);
+                               memcpy (&ide->scsi->buffer, ide->secbuf, ide->data_size);
+                               ide->scsi->data_len = ide->data_size;
+                               scsi_emulate_cmd (ide->scsi);
                                if (IDE_LOG > 1)
                                        write_log (_T("IDE%d ATAPI write finished, %d bytes\n"), ide->num, ide->data_size);
                        }
@@ -1830,15 +1831,15 @@ static struct ide_hdf *add_ide_unit (int ch, struct uaedev_config_info *ci)
                memcpy (&ide->hdhfd.hfd.ci, ci, sizeof (struct uaedev_config_info));
        if (ci->cd_emu_unit >= 0) {
                device_func_init (0);
-               ide->cd_unit_num = ci->cd_emu_unit;
-               if (!sys_command_open (ide->cd_unit_num)) {
+               ide->scsi = scsi_alloc_cd (ch, ci->cd_emu_unit, true);
+               if (!ide->scsi) {
                        write_log (_T("IDE: CD EMU unit %d failed to open\n"), ide->cd_unit_num);
                        return NULL;
                }
+               ide->cd_unit_num = ci->cd_emu_unit;
                ide->atapi = true;
                ide->blocksize = 512;
                gui_flicker_led (LED_CD, ch, -1);
-               ide->scsi.cd_emu_unit = ide->cd_unit_num;
 
                write_log (_T("IDE%d CD %d\n"), ch, ide->cd_unit_num);
 
@@ -2515,13 +2516,13 @@ void gayle_map_pcmcia (void)
        if (currprefs.cs_pcmcia == 0)
                return;
        if (pcmcia_card == 0 || (gayle_cs & GAYLE_CS_DIS)) {
-               map_banks (&dummy_bank, 0xa0, 8, 0);
+               map_banks_cond (&dummy_bank, 0xa0, 8, 0);
                if (currprefs.chipmem_size <= 4 * 1024 * 1024 && getz2endaddr () <= 4 * 1024 * 1024)
-                       map_banks (&dummy_bank, PCMCIA_COMMON_START >> 16, PCMCIA_COMMON_SIZE >> 16, 0);
+                       map_banks_cond (&dummy_bank, PCMCIA_COMMON_START >> 16, PCMCIA_COMMON_SIZE >> 16, 0);
        } else {
-               map_banks (&gayle_attr_bank, 0xa0, 8, 0);
+               map_banks_cond (&gayle_attr_bank, 0xa0, 8, 0);
                if (currprefs.chipmem_size <= 4 * 1024 * 1024 && getz2endaddr () <= 4 * 1024 * 1024)
-                       map_banks (&gayle_common_bank, PCMCIA_COMMON_START >> 16, PCMCIA_COMMON_SIZE >> 16, 0);
+                       map_banks_cond (&gayle_common_bank, PCMCIA_COMMON_START >> 16, PCMCIA_COMMON_SIZE >> 16, 0);
        }
 }
 
@@ -2537,8 +2538,8 @@ void gayle_free_units (void)
        for (i = 0; i < TOTAL_IDE * 2; i++) {
                struct ide_hdf *ide = idedrive[i];
                if (ide) {
-                       if (ide->cd_unit_num >= 0) {
-                               sys_command_close (ide->cd_unit_num);
+                       if (ide->scsi) {
+                               scsi_free (ide->scsi);
                        } else {
                                hdf_hd_close (&ide->hdhfd);
                        }
index faac154eabc01d4e00825b88cef5919417472a24..676247128b85e818eabb0bdf46c54acddbbea791 100644 (file)
@@ -1250,7 +1250,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
                        p = r;
                        p[0] = 4 - 1;
                        p[1] = 0;
-                       p[2] = 0;
+                       p[2] = (hfd->ci.readonly || hfd->dangerous) ? 0x80 : 0x00;
                        p[3] = 0;
                        p += 4;
                        if (!dbd) {
@@ -1421,7 +1421,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
                s[0] = 0x70;
                s[2] = 0; /* NO SENSE */
                s[12] = 0x1c; /* DEFECT LIST NOT FOUND */
-               ls = 12;
+               ls = 0x12;
                break;
        case 0x1b: /* START/STOP UNIT */
                scsi_len = 0;
@@ -1431,14 +1431,14 @@ readprot:
                s[0] = 0x70;
                s[2] = 7; /* DATA PROTECT */
                s[12] = 0x27; /* WRITE PROTECTED */
-               ls = 12;
+               ls = 0x12;
                break;
 nodisk:
                status = 2; /* CHECK CONDITION */
                s[0] = 0x70;
                s[2] = 2; /* NOT READY */
                s[12] = 0x3A; /* MEDIUM NOT PRESENT */
-               ls = 12;
+               ls = 0x12;
                break;
 
        default:
@@ -1450,7 +1450,7 @@ errreq:
                s[0] = 0x70;
                s[2] = 5; /* ILLEGAL REQUEST */
                s[12] = 0x24; /* ILLEGAL FIELD IN CDB */
-               ls = 12;
+               ls = 0x12;
                break;
 miscompare:
                lr = -1;
@@ -1458,7 +1458,7 @@ miscompare:
                s[0] = 0x70;
                s[2] = 5; /* ILLEGAL REQUEST */
                s[12] = 0x1d; /* MISCOMPARE DURING VERIFY OPERATION */
-               ls = 12;
+               ls = 0x12;
                break;
        }
        *data_len = scsi_len;
index 6162786d335eda7374b35d332226e77e098e7909..6f3fbefe551cd197ac0b8e6ca86da838b82b290c 100644 (file)
@@ -66,7 +66,7 @@ extern int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to);
 extern TCHAR *validatedevicename (TCHAR *s);
 extern TCHAR *validatevolumename (TCHAR *s);
 
-int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags);
+int filesys_insert (int nr, const TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags);
 int filesys_eject (int nr);
 int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_data *uci);
 
index a3d72927780579456c5f0399a3f3c7030cece77c..7536137802f0379c7b342a1296da22c860932055 100644 (file)
@@ -183,7 +183,7 @@ extern void scsi_log_before (uae_u8 *cdb, int cdblen, uae_u8 *data, int datalen)
 extern void scsi_log_after (uae_u8 *data, int datalen, uae_u8 *sense, int senselen);
 
 extern int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
-       uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len);
+       uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len, bool atapi);
 
 extern void blkdev_vsync (void);
 
index 0f06b70368b624c4ad77aa34ecc5fc524613f8d9..f3273e1606ad337e20b34ab3fc6aafcafd00f0db 100644 (file)
@@ -19,7 +19,8 @@ extern uae_u8 DISK_status (void);
 extern void disk_eject (int num);
 extern int disk_empty (int num);
 extern void disk_insert (int num, const TCHAR *name);
-extern void disk_insert_force (int num, const TCHAR *name, bool writeprotected);
+extern void disk_insert (int num, const TCHAR *name, bool forcedwriteprotect);
+extern void disk_insert_force (int num, const TCHAR *name, bool forcedwriteprotect);
 extern void DISK_vsync (void);
 extern int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf);
 extern void DISK_handler (uae_u32);
index 528e30ad9aea96f71867998b5965150b5366d311..4160ff4045f7cf023a774bb71102f87a3edb417f 100644 (file)
@@ -156,6 +156,7 @@ extern FILE *my_opentext (const TCHAR*);
 extern bool my_stat (const TCHAR *name, struct mystat *ms);
 extern bool my_utime (const TCHAR *name, struct mytimeval *tv);
 extern bool my_chmod (const TCHAR *name, uae_u32 mode);
+extern bool my_resolveshortcut(TCHAR *linkfile, int size);
 
 extern char *custom_fsdb_search_dir (const char *dirname, TCHAR *rel);
 extern a_inode *custom_fsdb_lookup_aino_aname (a_inode *base, const TCHAR *aname);
index 1542097e60fb36f03078083b85751f457bf5c652..0b15b54c109cac0983741c58f9d449a518f095a4 100644 (file)
@@ -173,6 +173,7 @@ extern uae_u8 *baseaddr[MEMORY_BANKS];
 extern void memory_init (void);
 extern void memory_cleanup (void);
 extern void map_banks (addrbank *bank, int first, int count, int realsize);
+extern void map_banks_cond (addrbank *bank, int first, int count, int realsize);
 extern void map_overlay (int chip);
 extern void memory_hardreset (int);
 extern void memory_clear (void);
index 038ab7c09560528c25a4dc7f8a0b03b5b01ae97d..87980e59238a067e5ae0656bf4ac41bdd2ae240a 100644 (file)
@@ -98,6 +98,7 @@ struct floppyslot
        int dfxtype;
        int dfxclick;
        TCHAR dfxclickexternal[256];
+       bool forcedwriteprotect;
 };
 
 #define WH_NATIVE 1
@@ -317,7 +318,7 @@ struct uae_prefs {
 
        int gfx_filter;
        TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS][MAX_DPATH];
-       TCHAR gfx_filtermask[MAX_DPATH];
+       TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS][MAX_DPATH];
        TCHAR gfx_filteroverlay[MAX_DPATH];
        struct wh gfx_filteroverlay_pos;
        int gfx_filteroverlay_overscan;
@@ -369,6 +370,7 @@ struct uae_prefs {
        int floppy_auto_ext2;
        bool tod_hack;
        uae_u32 maprom;
+       bool rom_readwrite;
        int turbo_emulation;
        bool headless;
        int filesys_limit;
index 29b61c0ed5cda92576be5bd579caf7dbd93643ae..f09d44ecdb4764ea640b20aeb6cca8c7aacf6839 100644 (file)
@@ -14,16 +14,18 @@ struct scsi_data
     int reply_len;
     int direction;
        uae_u8 message[1];
+       int blocksize;
 
     int offset;
     uae_u8 buffer[SCSI_DATA_BUFFER_SIZE];
     struct hd_hardfiledata *hfd;
     int nativescsiunit;
        int cd_emu_unit;
+       bool atapi;
 };
 
 extern struct scsi_data *scsi_alloc_hd(int, struct hd_hardfiledata*);
-extern struct scsi_data *scsi_alloc_cd(int, int);
+extern struct scsi_data *scsi_alloc_cd(int, int, bool);
 extern struct scsi_data *scsi_alloc_native(int, int);
 extern void scsi_free(struct scsi_data*);
 extern void scsi_reset(void);
index 8c2d6e6db835eff4040804b354a3f2967e5bb32a..093cd3142643ab91f8ebbdcb89e52216f4e277ed 100644 (file)
@@ -35,6 +35,7 @@
 
 bool canbang;
 int candirect = -1;
+static bool rom_write_enabled;
 #ifdef JIT
 /* Set by each memory handler that does not simply access real memory. */
 int special_mem;
@@ -968,7 +969,15 @@ static void REGPARAM2 kickmem_lput (uaecptr addr, uae_u32 b)
 #ifdef JIT
        special_mem |= S_WRITE;
 #endif
-       if (a1000_kickstart_mode) {
+       if (currprefs.rom_readwrite && rom_write_enabled) {
+               addr &= kickmem_mask;
+               m = (uae_u32 *)(kickmemory + addr);
+               do_put_mem_long (m, b);
+               if (addr == 524288-4) {
+                       rom_write_enabled = false;
+                       write_log (_T("ROM write disabled\n"));
+               }
+       } else if (a1000_kickstart_mode) {
                if (addr >= 0xfc0000) {
                        addr &= kickmem_mask;
                        m = (uae_u32 *)(kickmemory + addr);
@@ -987,7 +996,11 @@ static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
 #ifdef JIT
        special_mem |= S_WRITE;
 #endif
-       if (a1000_kickstart_mode) {
+       if (currprefs.rom_readwrite && rom_write_enabled) {
+               addr &= kickmem_mask;
+               m = (uae_u16 *)(kickmemory + addr);
+               do_put_mem_word (m, b);
+       } else if (a1000_kickstart_mode) {
                if (addr >= 0xfc0000) {
                        addr &= kickmem_mask;
                        m = (uae_u16 *)(kickmemory + addr);
@@ -1005,7 +1018,10 @@ static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
 #ifdef JIT
        special_mem |= S_WRITE;
 #endif
-       if (a1000_kickstart_mode) {
+       if (currprefs.rom_readwrite && rom_write_enabled) {
+               addr &= kickmem_mask;
+               kickmemory[addr] = b;
+       } else if (a1000_kickstart_mode) {
                if (addr >= 0xfc0000) {
                        addr &= kickmem_mask;
                        kickmemory[addr] = b;
@@ -2471,6 +2487,7 @@ void memory_reset (void)
                memcpy (currprefs.romfile, changed_prefs.romfile, sizeof currprefs.romfile);
                memcpy (currprefs.romextfile, changed_prefs.romextfile, sizeof currprefs.romextfile);
                need_hardreset = true;
+               rom_write_enabled = true;
                mapped_free (extendedkickmemory);
                extendedkickmemory = 0;
                extendedkickmem_size = 0;
@@ -2669,17 +2686,6 @@ void memory_reset (void)
                }
        }
 
-       if (currprefs.custom_memory_sizes[0]) {
-               map_banks (&custmem1_bank,
-                       currprefs.custom_memory_addrs[0] >> 16,
-                       currprefs.custom_memory_sizes[0] >> 16, 0);
-       }
-       if (currprefs.custom_memory_sizes[1]) {
-               map_banks (&custmem2_bank,
-                       currprefs.custom_memory_addrs[1] >> 16,
-                       currprefs.custom_memory_sizes[1] >> 16, 0);
-       }
-
 #ifdef ARCADIA
        if (is_arcadia_rom (currprefs.romextfile) == ARCADIA_BIOS) {
                if (_tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
@@ -2702,6 +2708,19 @@ void memory_reset (void)
        }
 #endif
 #endif
+
+       if (currprefs.custom_memory_sizes[0]) {
+               map_banks (&custmem1_bank,
+                       currprefs.custom_memory_addrs[0] >> 16,
+                       currprefs.custom_memory_sizes[0] >> 16, 0);
+       }
+       if (currprefs.custom_memory_sizes[1]) {
+               map_banks (&custmem2_bank,
+                       currprefs.custom_memory_addrs[1] >> 16,
+                       currprefs.custom_memory_sizes[1] >> 16, 0);
+       }
+
+
        if (mem_hardreset) {
                memory_clear ();
        }
@@ -2796,6 +2815,24 @@ void memory_hardreset (int mode)
                mem_hardreset = mode + 1;
 }
 
+// do not map if it conflicts with custom banks
+void map_banks_cond (addrbank *bank, int start, int size, int realsize)
+{
+       for (int i = 0; i < MAX_CUSTOM_MEMORY_ADDRS; i++) {
+               int cstart = currprefs.custom_memory_addrs[i] >> 16;
+               if (!cstart)
+                       continue;
+               int csize = currprefs.custom_memory_sizes[i] >> 16;
+               if (!csize)
+                       continue;
+               if (start <= cstart && start + size >= cstart)
+                       return;
+               if (cstart <= start && (cstart + size >= start || start + size > cstart))
+                       return;
+       }
+       map_banks (bank, start, size, realsize);
+}
+
 void map_banks (addrbank *bank, int start, int size, int realsize)
 {
        int bnr, old;
@@ -2803,8 +2840,6 @@ void map_banks (addrbank *bank, int start, int size, int realsize)
        addrbank *orgbank = bank;
        uae_u32 realstart = start;
 
-       //write_log (_T("MAP_BANK %04X0000 %d %s\n"), start, size, bank->name);
-
        old = debug_bankchange (-1);
        flush_icache (0, 3); /* Sure don't want to keep any old mappings around! */
 #ifdef NATMEM_OFFSET
index 282f9e268fec27d03ecace6c4315288a3f15a611..0982b810497d5abeab95d0c92c05b72bde692fd4 100644 (file)
@@ -5191,7 +5191,6 @@ void m68k_disasm_ea (uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, ua
        if (!buf)
                return;
        m68k_disasm_2 (buf, (MAX_LINEWIDTH + 1) * cnt, addr, nextpc, cnt, seaddr, deaddr, 1);
-       console_out_f (_T("%s"), buf);
        xfree (buf);
 }
 void m68k_disasm (uaecptr addr, uaecptr *nextpc, int cnt)
index aee19192771d9a0f32763e21b452d76cb6506d7c..a090a3f193139d5ca4d473725e5e670267f63f18 100644 (file)
@@ -49,7 +49,9 @@ static bool showoverlay = true;
 
 #define SHADERTYPE_BEFORE 1
 #define SHADERTYPE_AFTER 2
-#define SHADERTYPE_POST 3
+#define SHADERTYPE_MASK_BEFORE 3
+#define SHADERTYPE_MASK_AFTER 4
+#define SHADERTYPE_POST 10
 
 struct shaderdata
 {
@@ -76,6 +78,9 @@ struct shaderdata
        D3DXHANDLE m_SourceTextureEffectHandle;
        D3DXHANDLE m_WorkingTexture1EffectHandle;
        D3DXHANDLE m_WorkingTexture2EffectHandle;
+       // Masks
+       LPDIRECT3DTEXTURE9 masktexture;
+       int masktexture_w, masktexture_h;
 };
 static LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture;
 static LPDIRECT3DTEXTURE9 lpPostTempTexture;
@@ -94,9 +99,8 @@ static D3DDISPLAYMODEEX modeex;
 static IDirect3DDevice9 *d3ddev;
 static IDirect3DDevice9Ex *d3ddevex;
 static D3DSURFACE_DESC dsdbb;
-static LPDIRECT3DTEXTURE9 texture, sltexture, ledtexture, masktexture, mask2texture, blanktexture;
+static LPDIRECT3DTEXTURE9 texture, sltexture, ledtexture, mask2texture, blanktexture;
 static IDirect3DQuery9 *query;
-static int masktexture_w, masktexture_h;
 static float mask2texture_w, mask2texture_h, mask2texture_ww, mask2texture_wh;
 static float mask2texture_wwx, mask2texture_hhx, mask2texture_minusx, mask2texture_minusy;
 static float mask2texture_multx, mask2texture_multy, mask2texture_offsetw;
@@ -1257,8 +1261,6 @@ static int createledtexture (void)
 
 static int createsltexture (void)
 {
-       if (masktexture)
-               return 0;
        sltexture = createtext (required_sl_texture_w, required_sl_texture_h, t_depth < 32 ? D3DFMT_A4R4G4B4 : D3DFMT_A8R8G8B8);
        if (!sltexture)
                return 0;
@@ -1530,7 +1532,7 @@ end:
        return 0;
 }
 
-static int createmasktexture (const TCHAR *filename)
+static int createmasktexture (const TCHAR *filename, struct shaderdata *sd)
 {
        struct zfile *zf;
        int size;
@@ -1573,8 +1575,8 @@ static int createmasktexture (const TCHAR *filename)
                write_log (_T("%s: mask image texture GetLevelDesc() failed: %s\n"), D3DHEAD, D3D_ErrorString (hr));
                goto end;
        }
-       masktexture_w = dinfo.Width;
-       masktexture_h = dinfo.Height;
+       sd->masktexture_w = dinfo.Width;
+       sd->masktexture_h = dinfo.Height;
 #if 0
        if (txdesc.Width == masktexture_w && txdesc.Height == masktexture_h && psEnabled) {
                // texture size == image size, no need to tile it (Wrap sampler does the rest)
@@ -1588,23 +1590,23 @@ static int createmasktexture (const TCHAR *filename)
        } else {
 #endif
                // both must be divisible by mask size
-               maskwidth = ((window_w + masktexture_w - 1) / masktexture_w) * masktexture_w;
-               maskheight = ((window_h + masktexture_h - 1) / masktexture_h) * masktexture_h;
+               maskwidth = ((window_w + sd->masktexture_w - 1) / sd->masktexture_w) * sd->masktexture_w;
+               maskheight = ((window_h + sd->masktexture_h - 1) / sd->masktexture_h) * sd->masktexture_h;
 #if 0
        }
 #endif
        if (tx) {
-               masktexture = createtext (maskwidth, maskheight, D3DFMT_X8R8G8B8);
+               sd->masktexture = createtext (maskwidth, maskheight, D3DFMT_X8R8G8B8);
                if (FAILED (hr)) {
                        write_log (_T("%s: mask texture creation failed: %s\n"), D3DHEAD, D3D_ErrorString (hr));
                        goto end;
                }
-               hr = masktexture->GetLevelDesc (0, &maskdesc);
+               hr = sd->masktexture->GetLevelDesc (0, &maskdesc);
                if (FAILED (hr)) {
                        write_log (_T("%s: mask texture GetLevelDesc() failed: %s\n"), D3DHEAD, D3D_ErrorString (hr));
                        goto end;
                }
-               if (SUCCEEDED (hr = masktexture->LockRect (0, &lock, NULL, 0))) {
+               if (SUCCEEDED (hr = sd->masktexture->LockRect (0, &lock, NULL, 0))) {
                        if (SUCCEEDED (hr = tx->LockRect (0, &slock, NULL, 0))) {
                                int x, y, sx, sy;
                                uae_u32 *sptr, *ptr;
@@ -1629,21 +1631,21 @@ static int createmasktexture (const TCHAR *filename)
                                }
                                tx->UnlockRect (0);
                        }
-                       masktexture->UnlockRect (0);
+                       sd->masktexture->UnlockRect (0);
                }
                tx->Release ();
-               masktexture_w = maskdesc.Width;
-               masktexture_h = maskdesc.Height;
+               sd->masktexture_w = maskdesc.Width;
+               sd->masktexture_h = maskdesc.Height;
        }
-       write_log (_T("%s: mask %d*%d (%d*%d) %d*%d ('%s') texture allocated\n"), D3DHEAD, masktexture_w, masktexture_h, txdesc.Width, txdesc.Height, maskdesc.Width, maskdesc.Height, filename);
-       maskmult_x = (float)window_w / masktexture_w;
-       maskmult_y = (float)window_h / masktexture_h;
+       write_log (_T("%s: mask %d*%d (%d*%d) %d*%d ('%s') texture allocated\n"), D3DHEAD, sd->masktexture_w, sd->masktexture_h, txdesc.Width, txdesc.Height, maskdesc.Width, maskdesc.Height, filename);
+       maskmult_x = (float)window_w / sd->masktexture_w;
+       maskmult_y = (float)window_h / sd->masktexture_h;
 
        return 1;
 end:
-       if (masktexture)
-               masktexture->Release ();
-       masktexture = NULL;
+       if (sd->masktexture)
+               sd->masktexture->Release ();
+       sd->masktexture = NULL;
        if (tx)
                tx->Release ();
        return 0;
@@ -1933,10 +1935,6 @@ static void invalidatedeviceobjects (void)
                sltexture->Release ();
                sltexture = NULL;
        }
-       if (masktexture) {
-               masktexture->Release ();
-               masktexture = NULL;
-       }
        if (mask2texture) {
                mask2texture->Release ();
                mask2texture = NULL;
@@ -1954,6 +1952,10 @@ static void invalidatedeviceobjects (void)
                        shaders[i].pEffect->Release ();
                        shaders[i].pEffect = NULL;
                }
+               if (shaders[i].masktexture) {
+                       shaders[i].masktexture->Release ();
+                       shaders[i].masktexture = NULL;
+               }
                memset (&shaders[i], 0, sizeof (struct shaderdata));
        }
        if (d3ddev)
@@ -2006,6 +2008,10 @@ static int restoredeviceobjects (void)
                                        break;
                                }
                        }
+                       if (currprefs.gfx_filtermask[i][0]) {
+                               struct shaderdata *s = allocshaderslot (SHADERTYPE_MASK_BEFORE);
+                               createmasktexture (currprefs.gfx_filtermask[i], s);
+                       }
                }
                for (int i = 0; i < MAX_FILTERSHADERS; i++) {
                        if (currprefs.gfx_filtershader[i + MAX_FILTERSHADERS][0]) {
@@ -2015,12 +2021,15 @@ static int restoredeviceobjects (void)
                                        break;
                                }
                        }
+                       if (currprefs.gfx_filtermask[i + MAX_FILTERSHADERS][0]) {
+                               struct shaderdata *s = allocshaderslot (SHADERTYPE_MASK_AFTER);
+                               createmasktexture (currprefs.gfx_filtermask[i + MAX_FILTERSHADERS], s);
+                       }
                }
                if (currprefs.gfx_filter_scanlines > 0) {
                        createsltexture ();
                        createscanlines (1);
                }
-               createmasktexture (currprefs.gfx_filtermask);
                break;
        }
        if (wasshader && !shaderon)
@@ -2744,11 +2753,14 @@ static void D3D_render2 (void)
                struct shaderdata *s = &shaders[SHADER_POST];
                LPD3DXEFFECT postEffect = s->pEffect;
                int after = -1;
+               LPDIRECT3DTEXTURE9 masktexture = NULL;
 
                for (int i = 0; i < MAX_SHADERS; i++) {
                        struct shaderdata *s = &shaders[i];
                        if (s->type == SHADERTYPE_AFTER)
                                after = i;
+                       if (s->masktexture)
+                               masktexture = s->masktexture;
                }
 
                setupscenecoords ();
index c60f90a1944e6004b9ac17fe84a741bf1f543804..2d30002112ec334a425e35343072651163224ee4 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <windows.h>
 #include <sys/timeb.h>
+#include <Shobjidl.h>
+#include <ShlGuid.h>
 
 bool my_isfilehidden (const TCHAR *path)
 {
@@ -759,4 +761,69 @@ bool my_utime (const TCHAR *name, struct mytimeval *tv)
        return false;
 }
 
+// http://msdn.microsoft.com/en-us/library/aa969393.aspx
+bool my_resolveshortcut(TCHAR *linkfile, int size) 
+{ 
+       bool ok = false;
+    HRESULT hres; 
+    IShellLink* psl; 
+    WCHAR szGotPath[MAX_PATH]; 
+    WCHAR szDescription[MAX_PATH]; 
+    WIN32_FIND_DATA wfd; 
+       const TCHAR *ext = _tcsrchr (linkfile, '.');
+       if (!ext || _tcsicmp (ext, _T("lnk")) == 0)
+               return false;
 
+    // Get a pointer to the IShellLink interface. It is assumed that CoInitialize
+    // has already been called. 
+    hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl); 
+    if (SUCCEEDED(hres)) 
+    { 
+        IPersistFile* ppf;
+        // Get a pointer to the IPersistFile interface. 
+        hres = psl->QueryInterface(IID_IPersistFile, (void**)&ppf); 
+        
+        if (SUCCEEDED(hres)) 
+        { 
+            // Add code here to check return value from MultiByteWideChar 
+            // for success.
+            // Load the shortcut. 
+            hres = ppf->Load(linkfile, STGM_READ); 
+            
+            if (SUCCEEDED(hres)) 
+            { 
+                // Resolve the link. 
+                hres = psl->Resolve(NULL, SLR_NO_UI); 
+
+                if (SUCCEEDED(hres)) 
+                { 
+                    // Get the path to the link target. 
+                    hres = psl->GetPath(szGotPath, MAX_PATH, (WIN32_FIND_DATA*)&wfd, SLGP_SHORTPATH); 
+
+                    if (SUCCEEDED(hres)) 
+                    { 
+                        // Get the description of the target. 
+                        hres = psl->GetDescription(szDescription, MAX_PATH); 
+
+                        if (SUCCEEDED(hres)) 
+                        {
+                                                       _tcsncpy (linkfile, szGotPath, size);
+                                                       linkfile[size - 1] = 0;
+                            ok = SUCCEEDED(hres);
+                        }
+                    }
+                } 
+            } 
+
+            // Release the pointer to the IPersistFile interface. 
+            ppf->Release(); 
+        } 
+
+        // Release the pointer to the IShellLink interface. 
+        psl->Release(); 
+    } 
+    return ok; 
+}
index 971328c9eb32d090c8befefa50bf6f7fd0b0ed0a..1cd6f8b36c9ca45b7296d50db6c8c8e756c5fc77 100644 (file)
@@ -446,6 +446,18 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname)
                                FILE_SHARE_READ | (hfd->ci.readonly ? 0 : FILE_SHARE_WRITE),
                                NULL, OPEN_EXISTING, flags, NULL);
                        hfd->handle->h = h;
+                       if (h == INVALID_HANDLE_VALUE && !hfd->ci.readonly) {
+                               DWORD err = GetLastError ();
+                               if (err == ERROR_WRITE_PROTECT || err == ERROR_SHARING_VIOLATION) {
+                                       h = CreateFile (udi->device_path,
+                                               GENERIC_READ,
+                                               FILE_SHARE_READ,
+                                               NULL, OPEN_EXISTING, flags, NULL);
+                                       if (h != INVALID_HANDLE_VALUE)
+                                               hfd->ci.readonly = true;
+                               }
+                       }
+
                        if (h == INVALID_HANDLE_VALUE)
                                goto end;
                        if (!DeviceIoControl (h, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &r, NULL))
@@ -513,6 +525,16 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname)
                }
                h = CreateFile (name, GENERIC_READ | (hfd->ci.readonly ? 0 : GENERIC_WRITE), hfd->ci.readonly ? FILE_SHARE_READ : 0, NULL,
                        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
+               if (h == INVALID_HANDLE_VALUE && !hfd->ci.readonly) {
+                       DWORD err = GetLastError ();
+                       if (err == ERROR_WRITE_PROTECT || err == ERROR_SHARING_VIOLATION) {
+                               h = CreateFile (name, GENERIC_READ, FILE_SHARE_READ, NULL,
+                                       OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
+                               if (h != INVALID_HANDLE_VALUE)
+                                       hfd->ci.readonly = true;
+                       }
+               }
+               
                hfd->handle->h = h;
                i = _tcslen (name) - 1;
                while (i >= 0) {
index efcc7b4140c9001124ea1aa16b4427d544b12dbf..f3c3672e2245531ca346e86f93d4845c970c9089 100644 (file)
@@ -60,6 +60,7 @@ static int gameportmask[MAX_JPORTS];
 static DWORD storeflags;
 static int screenmode_request;
 static HWND guestwindow;
+static int hwndset_delay;
 
 static int cando (void)
 {
@@ -886,12 +887,12 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                write_log(_T("%dx%d %dx%d %dx%d %08x HM=%.1f VM=%.1f\n"),
                        sm->lClipLeft, sm->lClipTop, sm->lClipWidth, sm->lClipHeight, sm->lTargetWidth, sm->lTargetHeight, sm->dwClipFlags, hmult, vmult);
                if (WIN32GFX_IsPicassoScreen ()) {
-                       write_log (_T("RTG WW=%d WH=%d FW=%d FH=%d HM=%d VM=%d\n"),
+                       write_log (_T("RTG WW=%d WH=%d FW=%d FH=%d HM=%.1f VM=%.1f\n"),
                                p->gfx_size_win.width, p->gfx_size_win.height,
                                p->gfx_size_fs.width, p->gfx_size_fs.height,
                                p->rtg_horiz_zoom_mult, p->rtg_vert_zoom_mult);
                } else {
-                       write_log (_T("WW=%d WH=%d FW=%d FH=%d HM=%d VM=%d XP=%d YP=%d XS=%d YS=%d AS=%d AR=%d,%d\n"),
+                       write_log (_T("WW=%d WH=%d FW=%d FH=%d HM=%.1f VM=%.1f XP=%d YP=%d XS=%d YS=%d AS=%d AR=%d,%d\n"),
                                p->gfx_size_win.width, p->gfx_size_win.height,
                                p->gfx_size_fs.width, p->gfx_size_fs.height,
                                p->gfx_filter_horiz_zoom_mult, p->gfx_filter_vert_zoom_mult,
@@ -980,7 +981,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM
                                if (n == NULL || n[0] == 0)
                                        disk_eject (num);
                                else
-                                       disk_insert (num, n);
+                                       disk_insert (num, n, (dc->dwFlags & RP_DEVICEFLAGS_RW_READWRITE) == 0);
                                ok = TRUE;
                                break;
                        case RP_DEVICECATEGORY_INPUTPORT:
@@ -1366,6 +1367,7 @@ static void rp_device_change (int dev, int num, int mode, bool readonly, const T
        dc.btDeviceCategory = dev;
        dc.btDeviceNumber = num;
        dc.dwInputDevice = mode;
+       dc.dwFlags = readonly ? RP_DEVICEFLAGS_RW_READONLY : RP_DEVICEFLAGS_RW_READWRITE;
        if (content)
                _tcscpy (dc.szContent, content);
        if (log_rp & 1)
@@ -1622,12 +1624,18 @@ void rp_turbo_floppy (int active)
        RPSendMessagex (RP_IPC_TO_HOST_TURBO, RP_TURBO_FLOPPY, active ? RP_TURBO_FLOPPY : 0, NULL, 0, &guestinfo, NULL);
 }
 
+void rp_set_hwnd_delayed (void)
+{
+       hwndset_delay = 4;
+}
+
 void rp_set_hwnd (HWND hWnd)
 {
        struct RPScreenMode sm = { 0 };
 
        if (!initialized)
                return;
+       hwndset_delay = 0;
        guestwindow = hWnd;
        get_screenmode (&sm, &currprefs);
        if (hWnd != NULL)
@@ -1678,6 +1686,12 @@ void rp_vsync (void)
 
        if (!initialized)
                return;
+       if (hwndset_delay > 0) {
+               hwndset_delay--;
+               if (hwndset_delay == 0)
+                       rp_set_hwnd (hAmigaWnd);
+       }
+
        if (screenmode_request) {
                screenmode_request--;
                if (screenmode_request == 0) {
index a148ce3bda36ea8fb79927a10094f48bdaf81f26..2a3c495a2ba1190d3c3cd094d24ee638848c660f 100644 (file)
@@ -10,6 +10,7 @@ extern void rp_mouse_magic (int);
 extern void rp_turbo_cpu (int);
 extern void rp_turbo_floppy (int);
 extern void rp_set_hwnd (HWND);
+extern void rp_set_hwnd_delayed (void);
 extern void rp_set_enabledisable (int);
 extern int rp_checkesc (int, int, int);
 extern int rp_isactive (void);
index 01b1abb9dfaf64176fd642728c46d31e8eed4220..67d13cd1af786778226ec7cf80ac374654f37800 100644 (file)
@@ -4927,7 +4927,7 @@ static int parseargs (const TCHAR *argx, const TCHAR *np, const TCHAR *np2)
                return 1;
        }
        if (!_tcscmp (arg, _T("rplog"))) {
-               log_rp = 1;
+               log_rp = 3;
                return 1;
        }
        if (!_tcscmp (arg, _T("nomultidisplay"))) {
@@ -6022,6 +6022,7 @@ void fpux_restore (int *v)
 #endif
 }
 
+
 typedef BOOL (CALLBACK* CHANGEWINDOWMESSAGEFILTER)(UINT, DWORD);
 
 
index 12d7473b1f51d63088e52fdc904d99851d24d578..4ffe540849ccbc076248d377f8f9cc7724c31b11 100644 (file)
 #define LANG_DLL 1
 
 #if WINUAEPUBLICBETA
-#define WINUAEBETA _T("7")
+#define WINUAEBETA _T("8")
 #else
 #define WINUAEBETA _T("")
 #endif
-#define WINUAEDATE MAKEBD(2013, 2, 9)
+#define WINUAEDATE MAKEBD(2013, 2, 23)
 #define WINUAEEXTRA _T("")
 //#define WINUAEEXTRA _T("AmiKit Preview")
 #define WINUAEREV _T("")
index 42ba4ad7b33fb2919330f1848b800ffb18a45e3d..314f6a3ae3484cada4686319568ba1afb18bb494 100644 (file)
@@ -1713,10 +1713,10 @@ int check_prefs_changed_gfx (void)
 
        for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) {
                c |= _tcscmp (currprefs.gfx_filtershader[i], changed_prefs.gfx_filtershader[i]) ? (2|8) : 0;
+               c |= _tcscmp (currprefs.gfx_filtermask[i], changed_prefs.gfx_filtermask[i]) ? (2|8) : 0;
        }
 
        c |= currprefs.gfx_filter != changed_prefs.gfx_filter ? (2|8) : 0;
-       c |= _tcscmp (currprefs.gfx_filtermask, changed_prefs.gfx_filtermask) ? (2|8) : 0;
        c |= _tcscmp (currprefs.gfx_filteroverlay, changed_prefs.gfx_filteroverlay) ? (2|8) : 0;
        c |= currprefs.gfx_filter_filtermode != changed_prefs.gfx_filter_filtermode ? (2|8) : 0;
        c |= currprefs.gfx_filter_bilinear != changed_prefs.gfx_filter_bilinear ? (2|8) : 0;
@@ -1802,9 +1802,9 @@ int check_prefs_changed_gfx (void)
 
                for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) {
                        _tcscpy (currprefs.gfx_filtershader[i], changed_prefs.gfx_filtershader[i]);
+                       _tcscpy (currprefs.gfx_filtermask[i], changed_prefs.gfx_filtermask[i]);
                }
                currprefs.gfx_filter = changed_prefs.gfx_filter;
-               _tcscpy (currprefs.gfx_filtermask, changed_prefs.gfx_filtermask);
                _tcscpy (currprefs.gfx_filteroverlay, changed_prefs.gfx_filteroverlay);
                currprefs.gfx_filter_filtermode = changed_prefs.gfx_filter_filtermode;
                currprefs.gfx_filter_bilinear = changed_prefs.gfx_filter_bilinear;
@@ -4106,6 +4106,9 @@ static BOOL doInit (void)
 
        screen_is_initialized = 1;
        picasso_refresh ();
+#ifdef RETROPLATFORM
+       rp_set_hwnd_delayed ();
+#endif
 
        if (isfullscreen () > 0)
                setmouseactive (-1);
@@ -4137,6 +4140,9 @@ bool target_graphics_buffer_update (void)
        oldtex_h = h;
        oldtex_rtg = screen_is_picasso;
 
+       if (!w || !h)
+               return false;
+
        write_log (_T("Buffer size (%d*%d) %s\n"), w, h, screen_is_picasso ? _T("RTG") : _T("Native"));
 
        S2X_free ();
index bc6cba8b9cd561745e2d77de9181e372f523ebd0..db529d7d93ec7311830200f387ac3a99f6a6e11b 100644 (file)
@@ -9211,6 +9211,42 @@ static struct fsvdlg_vals current_fsvdlg;
 static struct hfdlg_vals current_hfdlg;
 static int archivehd;
 
+static void hardfile_testrdb (struct hfdlg_vals *hdf)
+{
+       uae_u8 id[512];
+       int i;
+       struct hardfiledata hfd;
+
+       memset (id, 0, sizeof id);
+       memset (&hfd, 0, sizeof hfd);
+       hfd.ci.readonly = true;
+       hfd.ci.blocksize = 512;
+       if (hdf_open (&hfd, current_hfdlg.ci.rootdir)) {
+               for (i = 0; i < 16; i++) {
+                       hdf_read_rdb (&hfd, id, i * 512, 512);
+                       if (i == 0 && !memcmp (id + 2, "CIS", 3)) {
+                               hdf->ci.controller = HD_CONTROLLER_PCMCIA_SRAM;
+                               break;
+                       }
+                       if (!memcmp (id, "RDSK\0\0\0", 7) || !memcmp (id, "DRKS\0\0", 6) || (id[0] == 0x53 && id[1] == 0x10 && id[2] == 0x9b && id[3] == 0x13 && id[4] == 0 && id[5] == 0)) {
+                               // RDSK or ADIDE "encoded" RDSK
+                               int blocksize = (id[16] << 24)  | (id[17] << 16) | (id[18] << 8) | (id[19] << 0);
+                               hdf->ci.cyls = hdf->ci.highcyl = hdf->forcedcylinders = 0;
+                               hdf->ci.sectors = 0;
+                               hdf->ci.surfaces = 0;
+                               hdf->ci.reserved = 0;
+                               hdf->ci.filesys[0] = 0;
+                               hdf->ci.bootpri = 0;
+                               hdf->ci.devname[0] = 0;
+                               if (blocksize >= 512)
+                                       hdf->ci.blocksize = blocksize;
+                               break;
+                       }
+               }
+               hdf_close (&hfd);
+       }
+}
+
 static void default_fsvdlg (struct fsvdlg_vals *f)
 {
        memset (f, 0, sizeof (struct fsvdlg_vals));
@@ -9225,6 +9261,12 @@ static void default_hfdlg (struct hfdlg_vals *f, bool rdb)
        f->ci.type = UAEDEV_HDF;
        f->ci.controller = ctrl;
 }
+static void default_rdb_hfdlg (struct hfdlg_vals *f, const TCHAR *filename)
+{
+       default_hfdlg (f, true);
+       _tcscpy (current_hfdlg.ci.rootdir, filename);
+       hardfile_testrdb (f);
+}
 
 static void volumeselectfile (HWND hDlg)
 {
@@ -9368,15 +9410,18 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
        return FALSE;
 }
 
-STATIC_INLINE int is_hdf_rdb (void)
+STATIC_INLINE bool is_hdf_rdb (void)
 {
        return current_hfdlg.ci.sectors == 0 && current_hfdlg.ci.surfaces == 0 && current_hfdlg.ci.reserved == 0;
 }
 
 static void sethardfile (HWND hDlg)
 {
-       int rdb = is_hdf_rdb ();
+       bool rdb = is_hdf_rdb ();
+       bool disables = !rdb || (rdb && current_hfdlg.ci.controller == HD_CONTROLLER_UAE);
 
+       if (!disables)
+               current_hfdlg.ci.bootpri = 0;
        SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.ci.rootdir);
        SetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys);
        SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.ci.devname);
@@ -9389,8 +9434,11 @@ static void sethardfile (HWND hDlg)
        CheckDlgButton (hDlg, IDC_HDF_AUTOBOOT, ISAUTOBOOT(&current_hfdlg.ci));
        CheckDlgButton (hDlg, IDC_HDF_DONOTMOUNT, !ISAUTOMOUNT(&current_hfdlg.ci));
        ew (hDlg, IDC_HDF_RDB, !rdb);
-       ew (hDlg, IDC_HDF_AUTOBOOT, TRUE);
-       ew (hDlg, IDC_HDF_DONOTMOUNT, TRUE);
+       ew (hDlg, IDC_HDF_AUTOBOOT, disables);
+       ew (hDlg, IDC_HDF_DONOTMOUNT, disables);
+       hide (hDlg, IDC_HDF_AUTOBOOT, !disables);
+       hide (hDlg, IDC_HDF_DONOTMOUNT, !disables);
+       hide (hDlg, IDC_HARDFILE_BOOTPRI, !disables);
        SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.ci.controller, 0);
 }
 
@@ -9450,41 +9498,6 @@ static void sethfdostype (HWND hDlg, int idx)
        }
 }
 
-static void hardfile_testrdb (HWND hDlg, struct hfdlg_vals *hdf)
-{
-       uae_u8 id[512];
-       int i;
-       struct hardfiledata hfd;
-
-       memset (id, 0, sizeof id);
-       memset (&hfd, 0, sizeof hfd);
-       hfd.ci.readonly = true;
-       hfd.ci.blocksize = 512;
-       if (hdf_open (&hfd, current_hfdlg.ci.rootdir)) {
-               for (i = 0; i < 16; i++) {
-                       hdf_read_rdb (&hfd, id, i * 512, 512);
-                       if (i == 0 && !memcmp (id + 2, "CIS", 3)) {
-                               hdf->ci.controller = HD_CONTROLLER_PCMCIA_SRAM;
-                               break;
-                       }
-                       if (!memcmp (id, "RDSK\0\0\0", 7) || !memcmp (id, "DRKS\0\0", 6) || (id[0] == 0x53 && id[1] == 0x10 && id[2] == 0x9b && id[3] == 0x13 && id[4] == 0 && id[5] == 0)) {
-                               // RDSK or ADIDE "encoded" RDSK
-                               hdf->ci.cyls = hdf->ci.highcyl = hdf->forcedcylinders = 0;
-                               hdf->ci.sectors = 0;
-                               hdf->ci.surfaces = 0;
-                               hdf->ci.reserved = 0;
-                               hdf->ci.filesys[0] = 0;
-                               hdf->ci.bootpri = 0;
-                               hdf->ci.devname[0] = 0;
-                               break;
-                       }
-               }
-               hdf_close (&hfd);
-       }
-       sethardfile (hDlg);
-}
-
-
 static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
 {
        static uae_u64 bsize;
@@ -9496,11 +9509,12 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
        bsize = 0;
        if (force) {
                bool open = false;
+               int blocksize = 512;
                struct hardfiledata hfd;
                memset (id, 0, sizeof id);
                memset (&hfd, 0, sizeof hfd);
                hfd.ci.readonly = true;
-               hfd.ci.blocksize = 512;
+               hfd.ci.blocksize = blocksize;
                current_hfdlg.size = 0;
                current_hfdlg.dostype = 0;
                if (hdf_open (&hfd, current_hfdlg.ci.rootdir)) {
@@ -9509,8 +9523,10 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
                                hdf_read (&hfd, id, i * 512, 512);
                                bsize = hfd.virtsize;
                                current_hfdlg.size = hfd.virtsize;
-                               if (!memcmp (id, "RDSK", 4))
+                               if (!memcmp (id, "RDSK", 4)) {
+                                       int blocksize = (id[16] << 24)  | (id[17] << 16) | (id[18] << 8) | (id[19] << 0);
                                        break;
+                               }
                        }
                        if (i == 16) {
                                hdf_read (&hfd, id, 0, 512);
@@ -9520,16 +9536,19 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
                if (defaults) {
                        if (hfd.flags & HFD_FLAGS_REALDRIVE) {
                                if (current_hfdlg.ci.controller >= HD_CONTROLLER_IDE0 && current_hfdlg.ci.controller <= HD_CONTROLLER_IDE3) {
-                                       getchspgeometry (bsize, &current_hfdlg.ci.highcyl, &current_hfdlg.ci.surfaces, &current_hfdlg.ci.sectors, true);
+                                       getchspgeometry (bsize, &current_hfdlg.ci.pcyls, &current_hfdlg.ci.pheads, &current_hfdlg.ci.psecs, true);
                                        if (current_hfdlg.forcedcylinders == 0)
-                                               current_hfdlg.forcedcylinders = current_hfdlg.ci.highcyl;
+                                               current_hfdlg.forcedcylinders = current_hfdlg.ci.pcyls;
                                } else {
-                                       getchspgeometry (bsize, &current_hfdlg.ci.highcyl, &current_hfdlg.ci.surfaces, &current_hfdlg.ci.sectors, false);
+                                       getchspgeometry (bsize, &current_hfdlg.ci.pcyls, &current_hfdlg.ci.pheads, &current_hfdlg.ci.psecs, false);
                                }
                        } else if (current_hfdlg.ci.blocksize * current_hfdlg.ci.sectors * current_hfdlg.ci.surfaces) {
                                getchsgeometry_hdf (open ? &hfd : NULL, bsize, &current_hfdlg.ci.cyls, &current_hfdlg.ci.surfaces, &current_hfdlg.ci.sectors);
                                current_hfdlg.original = 0;
                        }
+                       if (blocksize > 512) {
+                               hfd.ci.blocksize = blocksize;
+                       }
                }
                hdf_close (&hfd);
        }
@@ -9583,7 +9602,7 @@ static void hardfileselecthdf (HWND hDlg, TCHAR *newpath)
        GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.ci.rootdir, sizeof current_hfdlg.ci.rootdir / sizeof (TCHAR));
        fullpath (current_hfdlg.ci.rootdir, sizeof current_hfdlg.ci.rootdir / sizeof (TCHAR));
        inithardfile (hDlg);
-       hardfile_testrdb (hDlg, &current_hfdlg);
+       hardfile_testrdb (&current_hfdlg);
        updatehdfinfo (hDlg, true, true);
        get_hd_geometry (&current_hfdlg.ci);
        updatehdfinfo (hDlg, false, false);
@@ -9731,14 +9750,6 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                        break;
                case IDC_SELECTOR:
                        {
-#if 0
-                               uae_u64 oldsize = current_hfdlg.size;
-                               int sectors = current_hfdlg.sectors;
-                               int reserved = current_hfdlg.reserved;
-                               int surfaces = current_hfdlg.surfaces;
-                               int cylinders = current_hfdlg.cylinders;
-                               int forcedcylinders = current_hfdlg.forcedcylinders;
-#endif
                                _tcscpy (fs, current_hfdlg.ci.filesys);
                                _tcscpy (dev, current_hfdlg.ci.devname);
                                bool rw = current_hfdlg.ci.readonly;
@@ -9751,16 +9762,6 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                                current_hfdlg.ci.bootpri = bootpri;
                                current_hfdlg.ci.readonly = rw;
                                hardfileselecthdf (hDlg, NULL);
-#if 0
-                               if (oldsize > 0 && oldsize == current_hfdlg.size) {
-                                       current_hfdlg.sectors = sectors;
-                                       current_hfdlg.reserved = reserved;
-                                       current_hfdlg.surfaces = surfaces;
-                                       current_hfdlg.cylinders = cylinders;
-                                       current_hfdlg.forcedcylinders = forcedcylinders;
-                                       updatehdfinfo (hDlg, true, false);
-                               }
-#endif
                        }
                        break;
                case IDC_FILESYS_SELECTOR:
@@ -9768,16 +9769,6 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                        GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof (TCHAR));
                        break;
                case IDOK:
-#if 0
-                       if (_tcslen (current_hfdlg.ci.rootdir) == 0) {
-                               TCHAR szMessage[MAX_DPATH];
-                               TCHAR szTitle[MAX_DPATH];
-                               WIN32GUI_LoadUIString (IDS_MUSTSELECTFILE, szMessage, MAX_DPATH);
-                               WIN32GUI_LoadUIString (IDS_SETTINGSERROR, szTitle, MAX_DPATH);
-                               MessageBox (hDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
-                               break;
-                       }
-#endif
                        EndDialog (hDlg, 1);
                        break;
                case IDCANCEL:
@@ -9818,17 +9809,26 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                case IDC_SECTORS:
                        v = current_hfdlg.ci.sectors;
                        current_hfdlg.ci.sectors = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE);
-                       if (v != current_hfdlg.ci.sectors)
+                       if (v != current_hfdlg.ci.sectors) {
                                updatehdfinfo (hDlg, true, false);
+                               ew (hDlg, IDC_HDF_RDB, !is_hdf_rdb ());
+                       }
                        break;
                case IDC_RESERVED:
+                       v = current_hfdlg.ci.reserved;
                        current_hfdlg.ci.reserved = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE);
+                       if (v != current_hfdlg.ci.reserved) {
+                               updatehdfinfo (hDlg, true, false);
+                               ew (hDlg, IDC_HDF_RDB, !is_hdf_rdb ());
+                       }
                        break;
                case IDC_HEADS:
                        v = current_hfdlg.ci.surfaces;
                        current_hfdlg.ci.surfaces  = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE);
-                       if (v != current_hfdlg.ci.surfaces)
+                       if (v != current_hfdlg.ci.surfaces) {
                                updatehdfinfo (hDlg, true, false);
+                               ew (hDlg, IDC_HDF_RDB, !is_hdf_rdb ());
+                       }
                        break;
                case IDC_BLOCKSIZE:
                        v = current_hfdlg.ci.blocksize;
@@ -9851,8 +9851,10 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                        break;
                case IDC_HDF_CONTROLLER:
                        posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0);
-                       if (posn != CB_ERR)
+                       if (posn != CB_ERR) {
                                current_hfdlg.ci.controller = posn;
+                               sethardfile (hDlg);
+                       }
                        break;
                case IDC_PATH_NAME:
                        GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR));
@@ -10154,6 +10156,7 @@ static int harddiskdlg_button (HWND hDlg, WPARAM wParam)
 
        case IDC_NEW_HD:
                memset (&current_hfdlg, 0, sizeof (current_hfdlg));
+               current_hfdlg.ci.type = UAEDEV_HDF;
                if (hdf_init_target () == 0) {
                        TCHAR tmp[MAX_DPATH];
                        WIN32GUI_LoadUIString (IDS_NOHARDDRIVES, tmp, sizeof (tmp) / sizeof (TCHAR));
@@ -13744,7 +13747,7 @@ static void values_to_hw3ddlg (HWND hDlg)
                                !_tcsicmp (ext, _T(".bmp"))))
                        {
                                SendDlgItemMessage (hDlg, IDC_FILTEROVERLAY, CB_ADDSTRING, 0, (LPARAM)wfd.cFileName);
-                               if (!_tcsicmp (wfd.cFileName, overlaytype == 0 ? workprefs.gfx_filteroverlay : workprefs.gfx_filtermask))
+                               if (!_tcsicmp (wfd.cFileName, overlaytype == 0 ? workprefs.gfx_filteroverlay : workprefs.gfx_filtermask[0]))
                                        SendDlgItemMessage (hDlg, IDC_FILTEROVERLAY, CB_SETCURSEL, j, 0);
                                j++;
 
@@ -14036,7 +14039,7 @@ static void filter_handle (HWND hDlg)
        }
 
        int overlaytype = SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_GETCURSEL, 0, 0L);
-       TCHAR *filterptr = overlaytype == 0 ? workprefs.gfx_filteroverlay : workprefs.gfx_filtermask;
+       TCHAR *filterptr = overlaytype == 0 ? workprefs.gfx_filteroverlay : workprefs.gfx_filtermask[0];
        item = SendDlgItemMessage (hDlg, IDC_FILTEROVERLAY, CB_GETCURSEL, 0, 0L);
        if (item != CB_ERR) {
                TCHAR tmp[MAX_DPATH];
@@ -15284,6 +15287,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
                int mask;
 
                DragQueryFile (hd, i, file, sizeof (file) / sizeof (TCHAR));
+               my_resolveshortcut (file, sizeof file / sizeof (TCHAR));
                filepart = _tcsrchr (file, '/');
                if (!filepart)
                        filepart = _tcsrchr (file, '\\');
@@ -15388,8 +15392,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
                        }
                        break;
                case ZFILE_HDFRDB:
-                       default_hfdlg (&current_hfdlg, true);
-                       _tcscpy (current_hfdlg.ci.rootdir, file);
+                       default_rdb_hfdlg (&current_hfdlg, file);
                        add_filesys_config (&workprefs, -1, &current_hfdlg.ci);
                        break;
                case ZFILE_NVR:
index bdab471cf14f08d60f22dbc4b6358b67196de044..90257d8b121a6336c68ad06171455be75ac6e2fb 100644 (file)
@@ -1,6 +1,24 @@
 
 - restore only single input target to default.
 
+Beta 8:
+
+- CD SCSI emulation: implemented mode sense CD/DVD page code 0x2A. Used to detect drive capabilities, for example
+  if it can read or write CD-R, DVD-ROM or DVD-R and so on.
+- SCSI emulation MODE SENSE didn't limit returned amount of bytes to allocation length field.
+- BPLCON0 SuperHires bit disables normal DDFSTRT/DDFSTOP limits. (Why?)
+- Resolve shortcut path if mounting shortcut (.lnk) as a harddrive.
+- If inserting RDB hardfile using GUI: get device's blocksize from RDB block size field.
+- Attempted write to SCSI or IDE CD (using normal SCSI Write command) crashed. 
+- Return WP bit set in SCSI Mode Sense result if SCSI HD is write protected.
+- Add harddrive option set wrong parameters, drive was added as non-RDB partition hardfile (some earlier beta).
+- Hardfiles and harddrives: attempt to mount as read-only before failing if read-write access is not allowed.
+- Hide bootpri/bootable/donotmount boxes in GUI when selected RDB mode/controller combination does not support them.
+- Added support for write protected disk images even if physical file is write-enabled. Config file
+  only, floppyXwp=true
+- 68020/030 no-FPU F-line exceptions didn't work correctly, broke in previous 68040+ FPU disabled exception
+  updates.
+
 Beta 7:
 
 - In JIT mode format 2 stack frames had wrong address field contents, this also broke 68060 unimplemented integer
index 473e09ab2049f8e912a88c34f7b1101ec4fb6c18..3fe6ceadadc029af8fe5f789859cb0e9a2ee838c 100644 (file)
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -54,13 +54,13 @@ void scsi_emulate_analyze (struct scsi_data *sd)
        switch (sd->cmd[0])
        {
        case 0x0a:
-               data_len = sd->cmd[4] * sd->hfd->hfd.ci.blocksize;
+               data_len = sd->cmd[4] * sd->blocksize;
        break;
        case 0x2a:
-               data_len = ((sd->cmd[7] << 8) | (sd->cmd[8] << 0)) * (uae_s64)sd->hfd->hfd.ci.blocksize;
+               data_len = ((sd->cmd[7] << 8) | (sd->cmd[8] << 0)) * (uae_s64)sd->blocksize;
        break;
        case 0xaa:
-               data_len = ((sd->cmd[6] << 24) | (sd->cmd[7] << 16) | (sd->cmd[8] << 8) | (sd->cmd[9] << 0)) * (uae_s64)sd->hfd->hfd.ci.blocksize;
+               data_len = ((sd->cmd[6] << 24) | (sd->cmd[7] << 16) | (sd->cmd[8] << 8) | (sd->cmd[9] << 0)) * (uae_s64)sd->blocksize;
        break;
        }
        sd->cmd_len = cmd_len;
@@ -98,7 +98,7 @@ void scsi_emulate_cmd(struct scsi_data *sd)
                        memcpy (sd->buffer, sd->sense, sd->sense_len > len ? len : sd->sense_len);
                        sd->data_len = len;
                } else {
-                       sd->status = scsi_cd_emulate(sd->cd_emu_unit, sd->cmd, sd->cmd_len, sd->buffer, &sd->data_len, sd->reply, &sd->reply_len, sd->sense, &sd->sense_len);
+                       sd->status = scsi_cd_emulate(sd->cd_emu_unit, sd->cmd, sd->cmd_len, sd->buffer, &sd->data_len, sd->reply, &sd->reply_len, sd->sense, &sd->sense_len, sd->atapi);
                        if (sd->status == 0) {
                                if (sd->reply_len > 0) {
                                        memset(sd->buffer, 0, 256);
@@ -154,10 +154,11 @@ struct scsi_data *scsi_alloc_hd(int id, struct hd_hardfiledata *hfd)
        sd->id = id;
        sd->nativescsiunit = -1;
        sd->cd_emu_unit = -1;
+       sd->blocksize = hfd->hfd.ci.blocksize;
        return sd;
 }
 
-struct scsi_data *scsi_alloc_cd(int id, int unitnum)
+struct scsi_data *scsi_alloc_cd(int id, int unitnum, bool atapi)
 {
        struct scsi_data *sd;
        if (!sys_command_open (unitnum)) {
@@ -168,6 +169,8 @@ struct scsi_data *scsi_alloc_cd(int id, int unitnum)
        sd->id = id;
        sd->cd_emu_unit = unitnum;
        sd->nativescsiunit = -1;
+       sd->atapi = atapi;
+       sd->blocksize = 2048;
        return sd;
 }
 
@@ -182,6 +185,7 @@ struct scsi_data *scsi_alloc_native(int id, int nativeunit)
        sd->id = id;
        sd->nativescsiunit = nativeunit;
        sd->cd_emu_unit = -1;
+       sd->blocksize = 2048;
        return sd;
 }