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)

This commit is contained in:
Fabio Priuli 2011-01-14 22:07:07 +00:00
parent 4265c169b0
commit b98f54de7b
3 changed files with 28 additions and 3 deletions

View File

@ -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)
{

View File

@ -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();

View File

@ -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 */