diff options
author | 2023-03-30 20:23:35 -0400 | |
---|---|---|
committer | 2023-03-30 20:40:34 -0400 | |
commit | 6f7e4141ea14acaaf9cb973c66788fabb3457023 (patch) | |
tree | b7d89cfdacecbe34257c15c199a85b0a806850db /src/osd | |
parent | 7579c2f89dbcd509e4083bd578d2864d342caad4 (diff) |
API change for device_image_interface
- Remove the seterror method for recording error messages and conditions. Condition codes have been made return values for call_load, call_create and various related callbacks. Error messages (which many devices weren't generating) are now displayed through osd_printf_error.
- Eliminate the image_init_result and image_verify_result pass/fail enumeration types. Update many functions that were returning these enumerations or simply bools to return std::error_condition instead. In some cases, this type is now passed down from internal parsing/loading functions which were already returning it. In various other cases, the former default UNSPECIFIED has been used as a catchall for I/O errors; anticipated future refactorings should make these error returns more specific.
- Expand the image_error categories to include INVALIDLENGTH, NOSOFTWARE and BADSOFTWARE. The first is largely self-explanatory. The second is generated by the core to indicate failure to find software items in lists. The third is provided for devices to indicate semantic errors in software list entries.
- Change the return type of floppy_image_device::identify to a pair so the potential error condition can be passed along to the UI without storing it in a member variable.
- Move device_image_interface::message down into snapshot_image_device and change its implementation to use string_format instead of printf.
- Correct a typo in the shortname of the generic snapshot device.
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/modules/debugger/debugimgui.cpp | 6 | ||||
-rw-r--r-- | src/osd/modules/debugger/qt/mainwindow.cpp | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 2368352c6f3..a6f4554f75a 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -995,18 +995,18 @@ void debug_imgui::mount_image() void debug_imgui::create_image() { - image_init_result res; + std::error_condition res; auto *fd = dynamic_cast<floppy_image_device *>(m_dialog_image); if(fd != nullptr) { res = fd->create(m_path,nullptr,nullptr); - if(res == image_init_result::PASS) + if(!res) fd->setup_write(m_typelist.at(m_format_sel).format); } else res = m_dialog_image->create(m_path,nullptr,nullptr); - if(res == image_init_result::PASS) + if(!res) ImGui::CloseCurrentPopup(); // TODO: add a messagebox to display on an error } diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index 92be2c04b31..f707804537d 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -375,9 +375,10 @@ void MainWindow::mountImage(bool changedTo) QDir::currentPath(), tr("All files (*.*)")); - if (img->load(filename.toUtf8().data()) != image_init_result::PASS) + std::error_condition err = img->load(filename.toUtf8().data()); + if (err) { - m_machine.debugger().console().printf("Image could not be mounted.\n"); + m_machine.debugger().console().printf("Image could not be mounted: %s\n", err.message()); return; } |