mirror of
https://github.com/akuker/RASCSI.git
synced 2025-01-10 17:30:47 +00:00
Names of removable media drives must be constant and not contain the capacity
This commit is contained in:
parent
1755c7e2f8
commit
93f980fd60
@ -82,7 +82,7 @@ Device *DeviceFactory::CreateDevice(PbDeviceType& type, const string& filename,
|
||||
device = new SCSIHD_NEC();
|
||||
((Disk *)device)->SetVendor("NEC");
|
||||
} else {
|
||||
device = new SCSIHD();
|
||||
device = new SCSIHD(false);
|
||||
device->SetProtectable(true);
|
||||
((Disk *)device)->SetSectorSizes(sector_sizes_scsi);
|
||||
}
|
||||
@ -94,6 +94,7 @@ Device *DeviceFactory::CreateDevice(PbDeviceType& type, const string& filename,
|
||||
device->SetRemovable(true);
|
||||
device->SetLockable(true);
|
||||
device->SetProtectable(true);
|
||||
device->SetProduct("SCSI HD (REM.)");
|
||||
((Disk *)device)->SetSectorSizes(sector_sizes_scsi);
|
||||
break;
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <sstream>
|
||||
#include "../rascsi.h"
|
||||
|
||||
#define DEFAULT_PRODUCT "SCSI HD"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// SCSI Hard Disk
|
||||
@ -32,7 +34,6 @@
|
||||
//---------------------------------------------------------------------------
|
||||
SCSIHD::SCSIHD(bool removable) : Disk(removable ? "SCRM" : "SCHD")
|
||||
{
|
||||
SetRemovable(removable);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -86,20 +87,22 @@ void SCSIHD::Open(const Filepath& path)
|
||||
throw io_exception("File size must not exceed 2 TB");
|
||||
}
|
||||
|
||||
// Set the default product name based on the drive capacity
|
||||
int capacity;
|
||||
string unit;
|
||||
if (GetBlockCount() >> 11 >= 1) {
|
||||
capacity = GetBlockCount() >> 11;
|
||||
unit = "MB";
|
||||
// For non-removable media drives set the default product name based on the drive capacity
|
||||
if (!IsRemovable()) {
|
||||
int capacity;
|
||||
string unit;
|
||||
if (GetBlockCount() >> 11 >= 1) {
|
||||
capacity = GetBlockCount() >> 11;
|
||||
unit = "MB";
|
||||
}
|
||||
else {
|
||||
capacity = GetBlockCount() >> 1;
|
||||
unit = "KB";
|
||||
}
|
||||
stringstream product;
|
||||
product << DEFAULT_PRODUCT << " " << capacity << " " << unit;
|
||||
SetProduct(product.str(), false);
|
||||
}
|
||||
else {
|
||||
capacity = GetBlockCount() >> 1;
|
||||
unit = "KB";
|
||||
}
|
||||
stringstream product;
|
||||
product << DEFAULT_PRODUCT << " " << capacity << " " << unit;
|
||||
SetProduct(product.str(), false);
|
||||
|
||||
Disk::Open(path);
|
||||
FileSupport::SetPath(path);
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include "disk.h"
|
||||
#include "filepath.h"
|
||||
|
||||
#define DEFAULT_PRODUCT "SCSI HD"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// SCSI Hard Disk
|
||||
@ -30,7 +28,7 @@ class SCSIHD : public Disk, public FileSupport
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
SCSIHD(bool = false); // Constructor
|
||||
SCSIHD(bool); // Constructor
|
||||
void Reset(); // Reset
|
||||
void Open(const Filepath& path); // Open
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
// Constructor
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
SCSIHD_NEC::SCSIHD_NEC() : SCSIHD()
|
||||
SCSIHD_NEC::SCSIHD_NEC() : SCSIHD(false)
|
||||
{
|
||||
// Work initialization
|
||||
cylinders = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user