check for success before making media change
This commit is contained in:
parent
d2b8a8c637
commit
5827f15137
4 changed files with 12 additions and 8 deletions
|
@ -394,7 +394,8 @@ static void parse_boot(struct uae_prefs* p, xmlNode* node)
|
|||
if (uci)
|
||||
{
|
||||
const auto hfd = get_hardfile_data(uci->configoffset);
|
||||
hardfile_media_change(hfd, &ci, true, false);
|
||||
if(hfd)
|
||||
hardfile_media_change(hfd, &ci, true, false);
|
||||
}
|
||||
}
|
||||
xmlFree(content);
|
||||
|
@ -506,7 +507,8 @@ static void extract_media(struct uae_prefs* p, unzFile uz, xmlNode* node)
|
|||
if (uci)
|
||||
{
|
||||
const auto hfd = get_hardfile_data(uci->configoffset);
|
||||
hardfile_media_change(hfd, &ci, true, false);
|
||||
if(hfd)
|
||||
hardfile_media_change(hfd, &ci, true, false);
|
||||
}
|
||||
}
|
||||
lstTmpRP9Files.emplace_back(target_file);
|
||||
|
|
|
@ -446,14 +446,14 @@ bool CreateFilesysHardfile()
|
|||
ci.controller_type = 0;
|
||||
ci.controller_type_unit = 0;
|
||||
ci.controller_unit = 0;
|
||||
ci.controller_media_type = 0;
|
||||
ci.unit_feature_level = 1;
|
||||
ci.readonly = false;
|
||||
auto* const uci = add_filesys_config(&changed_prefs, -1, &ci);
|
||||
if (uci)
|
||||
{
|
||||
auto* const hfd = get_hardfile_data(uci->configoffset);
|
||||
hardfile_media_change(hfd, &ci, true, false);
|
||||
if (hfd)
|
||||
hardfile_media_change(hfd, &ci, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -630,7 +630,6 @@ bool EditFilesysHardfile(const int unit_no)
|
|||
ci.controller_type = controller[cboController->getSelected()].type;
|
||||
ci.controller_type_unit = 0;
|
||||
ci.controller_unit = cboUnit->getSelected();
|
||||
ci.controller_media_type = 0;
|
||||
ci.unit_feature_level = 1;
|
||||
ci.unit_special_flags = 0;
|
||||
ci.readonly = !chkReadWrite->isSelected();
|
||||
|
@ -644,7 +643,7 @@ bool EditFilesysHardfile(const int unit_no)
|
|||
uci = add_filesys_config(&changed_prefs, unit_no, &ci);
|
||||
if (uci)
|
||||
{
|
||||
const auto hfd = get_hardfile_data(uci->configoffset);
|
||||
auto* const hfd = get_hardfile_data(uci->configoffset);
|
||||
if (hfd)
|
||||
hardfile_media_change(hfd, &ci, true, false);
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ bool EditFilesysVirtual(const int unit_no)
|
|||
const auto bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
|
||||
extract_path(const_cast<char *>(txtPath->getText().c_str()), current_dir);
|
||||
|
||||
uci_set_defaults(&ci, true);
|
||||
uci_set_defaults(&ci, false);
|
||||
strncpy(ci.devname, const_cast<char *>(txtDevice->getText().c_str()), MAX_DPATH);
|
||||
strncpy(ci.volname, const_cast<char *>(txtVolume->getText().c_str()), MAX_DPATH);
|
||||
strncpy(ci.rootdir, const_cast<char *>(txtPath->getText().c_str()), MAX_DPATH);
|
||||
|
@ -447,7 +447,10 @@ bool EditFilesysVirtual(const int unit_no)
|
|||
uci = add_filesys_config(&changed_prefs, unit_no, &ci);
|
||||
if (uci)
|
||||
{
|
||||
filesys_media_change (ci.rootdir, 1, uci);
|
||||
if (uci->ci.rootdir[0])
|
||||
filesys_media_change(uci->ci.rootdir, unit_no, uci);
|
||||
else if (uci->configoffset >= 0)
|
||||
filesys_eject(uci->configoffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue