From b98f54de7b25d49bb73c63863e90dad770f10b67 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Fri, 14 Jan 2011 22:07:07 +0000 Subject: [PATCH] Improved the way software names are displayed by the Internal File Manager when loading from software list and fixed wrong displayed name when loading with shortname:part. No whatsnew needed (being MESS-specific) --- src/emu/devimage.c | 7 +++++++ src/emu/diimage.h | 1 + src/emu/uiimage.c | 23 ++++++++++++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/emu/devimage.c b/src/emu/devimage.c index 5ecc3e961c5..afc62292b21 100644 --- a/src/emu/devimage.c +++ b/src/emu/devimage.c @@ -431,12 +431,19 @@ bool legacy_image_device_base::load_internal(const char *path, bool is_create, i /* record the filename */ m_err = set_image_filename(path); + if (m_err) goto done; /* Check if there's a software list defined for this device and use that if we're not creating an image */ if (!filename_has_period) + { softload = load_software_part( this, path, &m_software_info_ptr, &m_software_part_ptr, &m_full_software_name ); + // if we had launched from softlist with a specified part, e.g. "shortname:part" + // we would have recorded the wrong name, so record it again based on software_info + if (m_software_info_ptr->shortname != NULL) + m_err = set_image_filename(m_software_info_ptr->shortname); + } if (is_create || filename_has_period) { diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 7bb3e60a91d..6c2c54ee2aa 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -253,6 +253,7 @@ public: const char* extrainfo() { return m_extrainfo; } const software_info *software_entry() { return m_software_info_ptr; } + const software_part *part_entry() { return m_software_part_ptr; } virtual void set_working_directory(const char *working_directory) { m_working_directory = working_directory; } virtual const char * working_directory(); diff --git a/src/emu/uiimage.c b/src/emu/uiimage.c index 497f25fa6f4..d90228e32fd 100644 --- a/src/emu/uiimage.c +++ b/src/emu/uiimage.c @@ -903,7 +903,7 @@ static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, { char buffer[2048]; device_image_interface *image = NULL; - const char *entry_basename; + astring tmp_name; /* cycle through all devices for this system */ for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) @@ -914,10 +914,27 @@ static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, image->image_config().devconfig().name()); /* get the base name */ - entry_basename = image->basename(); + if (image->basename() != NULL) + { + tmp_name.cpy(image->basename()); + + /* the image has been loaded through softlist, also show the loaded part */ + if (image->part_entry() != NULL) + { + const software_part *tmp = image->part_entry(); + if (tmp->name != NULL) + { + tmp_name.cat(" ("); + tmp_name.cat(tmp->name); + tmp_name.cat(")"); + } + } + } + else + tmp_name.cpy("---"); /* record the menu item */ - ui_menu_item_append(menu, buffer, (entry_basename != NULL) ? entry_basename : "---", 0, (void *) image); + ui_menu_item_append(menu, buffer, tmp_name.cstr(), 0, (void *) image); } /* set up custom render proc */