diff options
| author | 2026-02-27 03:02:32 +1100 | |
|---|---|---|
| committer | 2026-02-27 03:02:32 +1100 | |
| commit | 76a0dde560bd73cf59889d48dde7ce23fe1a0762 (patch) | |
| tree | 092a1548ef2bbec102125b9786b0fb09594fb4cb /src | |
| parent | 11a2f0605b1582e8d2a10ba2c916e58538615863 (diff) | |
emu/diimage.cpp: Notify on changing preset images.
ui/filemngr.cpp, ui/prscntrl.cpp: Fixed some cosmetic issues.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/diimage.cpp | 18 | ||||
| -rw-r--r-- | src/frontend/mame/ui/filemngr.cpp | 47 | ||||
| -rw-r--r-- | src/frontend/mame/ui/imgcntrl.h | 2 | ||||
| -rw-r--r-- | src/frontend/mame/ui/prscntrl.cpp | 9 |
4 files changed, 43 insertions, 33 deletions
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 59d1523a6b1..16cc0b0800a 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -226,18 +226,27 @@ chd_file *device_image_interface::current_preset_image_chd() const void device_image_interface::switch_preset_image(int id) { - for (unsigned int i = 0; i != m_preset_images.size(); i++) + for (unsigned i = 0; i != m_preset_images.size(); i++) + { if (m_preset_images[i]) { - if(!id) + if (!id) { - call_unload(); + if (is_loaded() || loaded_through_softlist()) + { + call_unload(); + clear(); + m_media_change_notifier(media_change_event::UNLOADED); + } m_current_region = i; - call_load(); + auto const err = call_load(); + if (!err.first) + m_media_change_notifier(media_change_event::LOADED); break; } id--; } + } return; } @@ -1095,7 +1104,6 @@ void device_image_interface::unload() { if (is_loaded() || loaded_through_softlist()) { - m_sequence_counter++; call_unload(); clear(); m_media_change_notifier(media_change_event::UNLOADED); diff --git a/src/frontend/mame/ui/filemngr.cpp b/src/frontend/mame/ui/filemngr.cpp index abbe2e29a8b..2d6f87afba5 100644 --- a/src/frontend/mame/ui/filemngr.cpp +++ b/src/frontend/mame/ui/filemngr.cpp @@ -115,32 +115,24 @@ void menu_file_manager::fill_image_line(device_image_interface &img, std::string // get the image type/id instance = string_format("%s (%s)", img.instance_name(), img.brief_instance_name()); - // get the base name - if (img.basename()) + if (!img.basename()) { - filename.assign(img.basename()); - - // if the image has been loaded through softlist, also show the loaded part - if (img.loaded_through_softlist()) - { - const software_part *tmp = img.part_entry(); - if (!tmp->name().empty()) - { - filename.append(" ("); - filename.append(tmp->name()); - // also check if this part has a specific part_id (e.g. "Map Disc", "Bonus Disc", etc.), and in case display it - if (img.get_feature("part_id") != nullptr) - { - filename.append(": "); - filename.append(img.get_feature("part_id")); - } - filename.append(")"); - } - } + filename = "---"; + } + else if (!img.loaded_through_softlist()) + { + filename = img.basename(); } else { - filename.assign("---"); + // if the image has been loaded through softlist, also show the loaded part + // also check if this part has a specific part_id (e.g. "Map Disc", "Bonus Disc", etc.) + software_part const *const part = img.part_entry(); + auto const partid = img.get_feature("part_id"); + if (partid) + filename = string_format(_("%1$s (%2$s: %3$s)"), img.basename(), part->name(), partid); + else + filename = string_format(_("%1$s (%2$s)"), img.basename(), part->name()); } } @@ -232,7 +224,7 @@ bool menu_file_manager::handle(event const *ev) if (ev) { - if ((uintptr_t)ev->itemref == 1) + if (uintptr_t(ev->itemref) == 1) { if (m_selected_device) { @@ -268,6 +260,15 @@ bool menu_file_manager::handle(event const *ev) } } } + else + { + auto const selected = get_selection_ref(); + if (selected && (uintptr_t(selected) != 1) && (selected != m_selected_device)) + { + m_selected_device = (device_image_interface *)selected; + result = true; + } + } return result; } diff --git a/src/frontend/mame/ui/imgcntrl.h b/src/frontend/mame/ui/imgcntrl.h index c41f6a25993..44d9b66b8e1 100644 --- a/src/frontend/mame/ui/imgcntrl.h +++ b/src/frontend/mame/ui/imgcntrl.h @@ -19,8 +19,6 @@ namespace ui { -// ======================> menu_control_device_image - class menu_control_device_image : public menu { public: diff --git a/src/frontend/mame/ui/prscntrl.cpp b/src/frontend/mame/ui/prscntrl.cpp index 1d5d2fb4f81..39d3cd3fab4 100644 --- a/src/frontend/mame/ui/prscntrl.cpp +++ b/src/frontend/mame/ui/prscntrl.cpp @@ -27,6 +27,7 @@ menu_control_device_preset::menu_control_device_preset(mame_ui_manager &mui, ren : menu(mui, container) , m_image(image) { + set_heading(string_format(_("[root%1$s] %2$s"), image.device().tag(), image.instance_name())); } @@ -46,8 +47,9 @@ menu_control_device_preset::~menu_control_device_preset() void menu_control_device_preset::populate() { auto presets = m_image.preset_images_list(); - for(uintptr_t i = 0; i != uintptr_t(presets.size()); i++) + for (uintptr_t i = 0; i != uintptr_t(presets.size()); i++) item_append(presets[i], 0, reinterpret_cast<void *>(i)); + item_append(menu_item_type::SEPARATOR); set_selection(reinterpret_cast<void *>(uintptr_t(m_image.current_preset_image_id()))); } @@ -58,8 +60,9 @@ void menu_control_device_preset::populate() bool menu_control_device_preset::handle(event const *ev) { - if (ev && (ev->iptkey == IPT_UI_SELECT)) { - int id = reinterpret_cast<uintptr_t>(ev->itemref); + if (ev && (ev->iptkey == IPT_UI_SELECT)) + { + int const id = reinterpret_cast<uintptr_t>(ev->itemref); m_image.switch_preset_image(id); stack_pop(); } |
