Switch fdd_wr_prot to BinProperty.

This commit is contained in:
Maxim Poliakovski 2022-07-19 23:48:17 +02:00
parent 65512dc434
commit b9fb0b9c5f
4 changed files with 9 additions and 15 deletions

View File

@ -131,7 +131,7 @@ uint8_t MacSuperDrive::status(uint8_t addr)
}
}
int MacSuperDrive::insert_disk(std::string& img_path, bool write_flag = 0)
int MacSuperDrive::insert_disk(std::string& img_path, int write_flag = 0)
{
if (this->has_disk) {
LOG_F(ERROR, "Superdrive: drive is not empty!");

View File

@ -86,7 +86,7 @@ public:
void command(uint8_t addr, uint8_t value);
uint8_t status(uint8_t addr);
int insert_disk(std::string& img_path, bool write_flag);
int insert_disk(std::string& img_path, int write_flag);
double get_current_track_delay();
double get_sector_delay();
void init_track_search(int pos);

View File

@ -64,17 +64,9 @@ int Swim3Ctrl::device_postinit()
// if a floppy image was given "insert" it into the virtual superdrive
std::string fd_image_path = GET_STR_PROP("fdd_img");
std::string fd_write_prot = GET_STR_PROP("fdd_wr_prot");
int fd_write_prot = GET_BIN_PROP("fdd_wr_prot");
if (!fd_image_path.empty()) {
bool write_flag = false;
if (!fd_write_prot.empty()) {
if ((fd_write_prot.compare("ON") == 0) || (fd_write_prot.compare("on") == 0)) {
write_flag = true;
}
}
this->int_drive->insert_disk(fd_image_path, write_flag);
this->int_drive->insert_disk(fd_image_path, fd_write_prot);
}
return 0;
@ -343,13 +335,11 @@ void Swim3Ctrl::stop_disk_access()
this->access_timer_id = 0;
}
static const vector<string> WriteToggle = {"ON", "on", "OFF", "off"};
static const PropMap Swim3_Properties = {
{"fdd_img",
new StrProperty("")},
{"fdd_wr_prot",
new StrProperty("OFF", WriteToggle)}
new BinProperty(0)},
};
static const DeviceDescription Swim3_Descriptor = {

View File

@ -192,6 +192,10 @@ void MachineFactory::print_settings(PropMap& prop_map)
cout << dynamic_cast<StrProperty*>(p.second)->get_valid_values_as_str()
<< endl;
break;
case PROP_TYPE_BINARY:
cout << dynamic_cast<BinProperty*>(p.second)->get_valid_values_as_str()
<< endl;
break;
default:
break;
}