OSDN Git Service

[General] Merge Upstream 2018-12-18.
[csp-qt/common_source_project-fm7.git] / source / src / vm / scsi_hdd.cpp
index 2c18972..faf03bd 100644 (file)
@@ -123,6 +123,14 @@ uint32_t SCSI_HDD::max_logical_block_addr()
 
 bool SCSI_HDD::read_buffer(int length)
 {
+       if(!(command[0] == SCSI_CMD_READ6 || command[0] == SCSI_CMD_READ10 || command[0] == SCSI_CMD_READ12)) {
+               for(int i = 0; i < length; i++) {
+                       buffer->write(0);
+                       position++;
+               }
+               set_sense_code(SCSI_SENSE_NOSENSE);
+               return true;
+       }
        HARDDISK *unit = disk[get_logical_unit_number()];
        
        if(!(unit != NULL && unit->mounted())) {
@@ -149,6 +157,14 @@ bool SCSI_HDD::read_buffer(int length)
 
 bool SCSI_HDD::write_buffer(int length)
 {
+       if(!(command[0] == SCSI_CMD_WRITE6 || command[0] == SCSI_CMD_WRITE10 || command[0] == SCSI_CMD_WRITE12)) {
+               for(int i = 0; i < length; i++) {
+                       buffer->read();
+                       position++;
+               }
+               set_sense_code(SCSI_SENSE_NOSENSE);
+               return true;
+       }
        HARDDISK *unit = disk[get_logical_unit_number()];
        
        if(!(unit != NULL && unit->mounted())) {
@@ -192,11 +208,8 @@ bool SCSI_HDD::process_state(FILEIO* state_fio, bool loading)
                }
        }
        */
-       state_fio->StateBuffer(image_path, sizeof(image_path), 1);
-//     state_fio->StateBuffer(sector_size, sizeof(sector_size), 1);
-       for(int i = 0; i < (sizeof(sector_size) / sizeof(int)); i++) {
-               state_fio->StateInt32(sector_size[i]);
-       }
+       state_fio->StateArray(&image_path[0][0], sizeof(image_path), 1);
+       state_fio->StateArray(sector_size, sizeof(sector_size), 1);
        return SCSI_DEV::process_state(state_fio, loading);
 }