]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
uaehf.device HD_SCSICMD didn't set scsi_SenseActual and io_Actual.
authorToni Wilen <twilen@winuae.net>
Wed, 1 Aug 2018 09:59:17 +0000 (12:59 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 1 Aug 2018 09:59:17 +0000 (12:59 +0300)
hardfile.cpp

index 49c0300ae476aa3131d7d30e6a37a7db4e3a625f..26b38cf783e145f465ebbd9b624ad8a563f8c5d4 100644 (file)
@@ -2297,10 +2297,14 @@ static int handle_scsi (TrapContext *ctx, uae_u8 *iobuf, uaecptr request, struct
                scsi_log (_T("\n"));
        }
        if (scsi_sense) {
-               trap_put_bytes(ctx, sd->sense, scsi_sense, sd->sense_len < scsi_sense_len ? sd->sense_len : scsi_sense_len);
+               int slen = sd->sense_len < scsi_sense_len ? sd->sense_len : scsi_sense_len;
+               trap_put_bytes(ctx, sd->sense, scsi_sense, slen);
                if (scsi_sense_len > sd->sense_len) {
                        trap_set_bytes(ctx, scsi_sense + sd->sense_len, 0, scsi_sense_len - sd->sense_len);
                }
+               put_word_host(scsicmd + 28, slen); /* scsi_SenseActual */
+       } else {
+               put_word_host(scsicmd + 28, 0);
        }
        if (sd->data_len < 0) {
                put_long_host(scsicmd + 8, 0); /* scsi_Actual */
@@ -2814,6 +2818,7 @@ static uae_u32 hardfile_do_io (TrapContext *ctx, struct hardfiledata *hfd, struc
                } else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */
                        error = handle_scsi(ctx, iobuf, request, hfd, hfpd->sd, true);
                }
+               actual = 30; // sizeof(struct SCSICmd)
                break;
 #endif