summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author etabeta78 <etabeta78@users.noreply.github.com>2015-01-12 22:46:22 +0100
committer etabeta78 <etabeta78@users.noreply.github.com>2015-01-12 22:46:22 +0100
commitd40ca7e90181c83658bf1737c982167d17c97596 (patch)
tree4f1c28f843755c45fa041561fd392ae2fd8be618
parente0f73c58aed6d664eb26c9bd2f5572992278bfc9 (diff)
ui: simplified Image Information code and made it fully display for
systems with many image devices. [Fabio Priuli] out of whatsnew: compare old and new with a system like smssdisp to see what the "fully display" refers to ;-)
-rw-r--r--src/emu/ui/imginfo.c150
-rw-r--r--src/emu/ui/imginfo.h2
2 files changed, 35 insertions, 117 deletions
diff --git a/src/emu/ui/imginfo.c b/src/emu/ui/imginfo.c
index 9fc80b82a07..68eac3b6cc3 100644
--- a/src/emu/ui/imginfo.c
+++ b/src/emu/ui/imginfo.c
@@ -42,9 +42,12 @@ ui_menu_image_info::~ui_menu_image_info()
void ui_menu_image_info::populate()
{
- astring tempstring;
- image_info_astring(machine(), tempstring);
- item_append(tempstring, NULL, MENU_FLAG_MULTILINE, NULL);
+ item_append(machine().system().description, NULL, MENU_FLAG_DISABLE, NULL);
+ item_append("", NULL, MENU_FLAG_DISABLE, NULL);
+
+ image_interface_iterator iter(machine().root_device());
+ for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
+ image_info(image);
}
@@ -60,129 +63,44 @@ void ui_menu_image_info::handle()
//-------------------------------------------------
-// stripspace
+// image_info - display image info for a specific
+// image interface device
//-------------------------------------------------
-static char *stripspace(const char *src)
+void ui_menu_image_info::image_info(device_image_interface *image)
{
- static char buff[512];
- if( src )
+ if (image->exists())
{
- char *dst;
- while( *src && isspace(*src) )
- src++;
- strcpy(buff, src);
- dst = buff + strlen(buff);
- while( dst >= buff && isspace(*--dst) )
- *dst = '\0';
- return buff;
- }
- return NULL;
-}
-
-
-//-------------------------------------------------
-// strip_extension
-//-------------------------------------------------
-
-static char *strip_extension(const char *filename)
-{
- char *newname;
- char *c;
-
- // NULL begets NULL
- if (!filename)
- return NULL;
+ // display device type and filename
+ item_append(image->brief_instance_name(), image->basename(), 0, NULL);
- // allocate space for it
- newname = (char *) malloc(strlen(filename) + 1);
- if (!newname)
- return NULL;
-
- // copy in the name
- strcpy(newname, filename);
-
- // search backward for a period, failing if we hit a slash or a colon
- for (c = newname + strlen(newname) - 1; c >= newname; c--)
- {
- // if we hit a period, NULL terminate and break
- if (*c == '.')
+ // if image has been loaded through softlist, let's add some more info
+ if (image->software_entry())
{
- *c = 0;
- break;
- }
-
- // if we hit a slash or colon just stop
- if (*c == '\\' || *c == '/' || *c == ':')
- break;
- }
-
- return newname;
-}
+ astring string;
-
-//-------------------------------------------------
-// image_info_astring - populate an allocated
-// string with the image info text
-//-------------------------------------------------
-
-void ui_menu_image_info::image_info_astring(running_machine &machine, astring &string)
-{
- string.printf("%s\n\n", machine.system().description);
-
-#if 0
- if (mess_ram_size > 0)
- {
- char buf2[RAM_STRING_BUFLEN];
- string.catprintf("RAM: %s\n\n", ram_string(buf2, mess_ram_size));
- }
-#endif
-
- image_interface_iterator iter(machine.root_device());
- for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
- {
- const char *name = image->filename();
- if (name != NULL)
- {
- const char *base_filename;
- const char *info;
- char *base_filename_noextension;
-
- base_filename = image->basename();
- base_filename_noextension = strip_extension(base_filename);
-
- // display device type and filename
- string.catprintf("%s: %s\n", image->device().name(), base_filename);
-
- // display long filename, if present and doesn't correspond to name
- info = image->longname();
- if (info && (!base_filename_noextension || core_stricmp(info, base_filename_noextension)))
- string.catprintf("%s\n", info);
-
- // display manufacturer, if available
- info = image->manufacturer();
- if (info != NULL)
- {
- string.catprintf("%s", info);
- info = stripspace(image->year());
- if (info && *info)
- string.catprintf(", %s", info);
- string.catprintf("\n");
- }
+ // display long filename
+ item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL);
+
+ // display manufacturer and year
+ string.catprintf("%s, %s", image->manufacturer(), image->year());
+ item_append(string, "", MENU_FLAG_DISABLE, NULL);
// display supported information, if available
- switch(image->supported()) {
- case SOFTWARE_SUPPORTED_NO : string.catprintf("Not supported\n"); break;
- case SOFTWARE_SUPPORTED_PARTIAL : string.catprintf("Partially supported\n"); break;
- default : break;
+ switch (image->supported())
+ {
+ case SOFTWARE_SUPPORTED_NO:
+ item_append("Not supported", "", MENU_FLAG_DISABLE, NULL);
+ break;
+ case SOFTWARE_SUPPORTED_PARTIAL:
+ item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL);
+ break;
+ default:
+ break;
}
-
- if (base_filename_noextension != NULL)
- free(base_filename_noextension);
- }
- else
- {
- string.catprintf("%s: ---\n", image->device().name());
}
}
+ else
+ item_append(image->brief_instance_name(), "[empty]", 0, NULL);
+ item_append("", NULL, MENU_FLAG_DISABLE, NULL);
}
diff --git a/src/emu/ui/imginfo.h b/src/emu/ui/imginfo.h
index bfa5001a278..fe2ca484eba 100644
--- a/src/emu/ui/imginfo.h
+++ b/src/emu/ui/imginfo.h
@@ -23,7 +23,7 @@ public:
virtual void handle();
private:
- void image_info_astring(running_machine &machine, astring &string);
+ void image_info(device_image_interface *image);
};
#endif // __UI_IMGINFO_H__