mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-09-27 19:54:46 +00:00
Floppy disk write protection
This commit is contained in:
parent
edd3979647
commit
80a4864a92
@ -131,7 +131,7 @@ uint8_t MacSuperDrive::status(uint8_t addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MacSuperDrive::insert_disk(std::string& img_path)
|
int MacSuperDrive::insert_disk(std::string& img_path, bool write_flag = 0)
|
||||||
{
|
{
|
||||||
if (this->has_disk) {
|
if (this->has_disk) {
|
||||||
LOG_F(ERROR, "Superdrive: drive is not empty!");
|
LOG_F(ERROR, "Superdrive: drive is not empty!");
|
||||||
@ -150,7 +150,7 @@ int MacSuperDrive::insert_disk(std::string& img_path)
|
|||||||
this->img_conv->get_raw_disk_data(this->disk_data.get());
|
this->img_conv->get_raw_disk_data(this->disk_data.get());
|
||||||
|
|
||||||
// disk is write-enabled by default
|
// disk is write-enabled by default
|
||||||
this->wr_protect = 0;
|
this->wr_protect = write_flag;
|
||||||
|
|
||||||
// everything is set up, let's say we got a disk
|
// everything is set up, let's say we got a disk
|
||||||
this->has_disk = 1;
|
this->has_disk = 1;
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
void command(uint8_t addr, uint8_t value);
|
void command(uint8_t addr, uint8_t value);
|
||||||
uint8_t status(uint8_t addr);
|
uint8_t status(uint8_t addr);
|
||||||
int insert_disk(std::string& img_path);
|
int insert_disk(std::string& img_path, bool write_flag);
|
||||||
double get_current_track_delay();
|
double get_current_track_delay();
|
||||||
double get_sector_delay();
|
double get_sector_delay();
|
||||||
void init_track_search(int pos);
|
void init_track_search(int pos);
|
||||||
|
@ -80,6 +80,8 @@ static const PropMap GossamerSettings = {
|
|||||||
new StrProperty("")},
|
new StrProperty("")},
|
||||||
{"fdd_img",
|
{"fdd_img",
|
||||||
new StrProperty("")},
|
new StrProperty("")},
|
||||||
|
{"fdd_wr_prot",
|
||||||
|
new StrProperty("")},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Monitors supported by the PDM on-board video. */
|
/** Monitors supported by the PDM on-board video. */
|
||||||
@ -99,6 +101,8 @@ static const PropMap PDMSettings = {
|
|||||||
new StrProperty("HiRes12-14in", PDMBuiltinMonitorIDs)},
|
new StrProperty("HiRes12-14in", PDMBuiltinMonitorIDs)},
|
||||||
{"fdd_img",
|
{"fdd_img",
|
||||||
new StrProperty("")},
|
new StrProperty("")},
|
||||||
|
{"fdd_wr_prot",
|
||||||
|
new StrProperty("")},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const map<string, string> PropHelp = {
|
static const map<string, string> PropHelp = {
|
||||||
@ -107,6 +111,7 @@ static const map<string, string> PropHelp = {
|
|||||||
{"rambank3_size", "specifies RAM bank 3 size in MB"},
|
{"rambank3_size", "specifies RAM bank 3 size in MB"},
|
||||||
{"gfxmem_size", "specifies video memory size in MB"},
|
{"gfxmem_size", "specifies video memory size in MB"},
|
||||||
{"fdd_img", "specifies path to floppy disk image"},
|
{"fdd_img", "specifies path to floppy disk image"},
|
||||||
|
{"fdd_wr_prot", "toggles floppy disks write protection"},
|
||||||
{"mon_id", "specifies which monitor to emulate"},
|
{"mon_id", "specifies which monitor to emulate"},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,7 +110,8 @@ int create_gossamer(std::string& id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for a floppy image to be inserted into the virtual superdrive */
|
/* check for a floppy image to be inserted into the virtual superdrive */
|
||||||
std::string fdd_path = GET_STR_PROP("fdd_img");
|
std::string fdd_path = GET_STR_PROP("fdd_img");
|
||||||
|
std::string fd_write_prot = GET_STR_PROP("fdd_wr_prot");
|
||||||
if (!fdd_path.empty()) {
|
if (!fdd_path.empty()) {
|
||||||
open_floppy_image(fdd_path);
|
open_floppy_image(fdd_path);
|
||||||
}
|
}
|
||||||
|
@ -99,12 +99,22 @@ int create_pdm(std::string& id) {
|
|||||||
|
|
||||||
// if a floppy image was given "insert" it into the virtual superdrive
|
// 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_image_path = GET_STR_PROP("fdd_img");
|
||||||
|
std::string fd_write_prot = GET_STR_PROP("fdd_wr_prot");
|
||||||
if (!fd_image_path.empty()) {
|
if (!fd_image_path.empty()) {
|
||||||
using namespace MacSuperdrive;
|
using namespace MacSuperdrive;
|
||||||
|
|
||||||
MacSuperDrive* fdd = dynamic_cast<MacSuperDrive*>
|
MacSuperDrive* fdd = dynamic_cast<MacSuperDrive*>
|
||||||
(gMachineObj->get_comp_by_name("Superdrive"));
|
(gMachineObj->get_comp_by_name("Superdrive"));
|
||||||
fdd->insert_disk(fd_image_path);
|
|
||||||
|
bool write_flag = false;
|
||||||
|
|
||||||
|
if (!fd_write_prot.empty()) {
|
||||||
|
if (fd_write_prot.compare("on") == 0) {
|
||||||
|
write_flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fdd->insert_disk(fd_image_path, write_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_F(INFO, "Initialization completed.\n");
|
LOG_F(INFO, "Initialization completed.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user