diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2010-07-06 14:27:51 +0000 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2010-07-06 14:27:51 +0000 |
commit | 16f14bc5f9192c523e7f1d7bb47e77cb8a2e82ee (patch) | |
tree | d1fcbcc62beb1520d5f468775e0eb516822d0be6 | |
parent | 4d9a17ee08327b44238d0393f2fc4162d4db6159 (diff) |
- Added MDRV_SOFTWARE_LIST_COMPATIBLE_ADD for adding compatible software lists (for documentation purposes) [Miodrag Milanovic]
- listsoftware option now return only original software lists
- UI is updated to enable mounting software items per device, it will display only items from list that are for specific device
- Separate compatible software lists in UI
-rw-r--r-- | src/emu/clifront.c | 4 | ||||
-rw-r--r-- | src/emu/info.c | 2 | ||||
-rw-r--r-- | src/emu/romload.c | 3 | ||||
-rw-r--r-- | src/emu/softlist.c | 98 | ||||
-rw-r--r-- | src/emu/softlist.h | 20 | ||||
-rw-r--r-- | src/emu/uiimage.c | 13 | ||||
-rw-r--r-- | src/emu/uimenu.c | 4 |
7 files changed, 98 insertions, 46 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 6a732170104..88c588dc74c 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -801,7 +801,7 @@ static int info_listsoftware(core_options *options, const char *gamename) for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ ) { - if ( swlist->list_name[i] && *swlist->list_name[i] ) + if ( swlist->list_name[i] && *swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) nr_lists++; } } @@ -862,7 +862,7 @@ static int info_listsoftware(core_options *options, const char *gamename) for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ ) { - if ( swlist->list_name[i] && *swlist->list_name[i] ) + if ( swlist->list_name[i] && *swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) { software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL ); diff --git a/src/emu/info.c b/src/emu/info.c index 911288231cf..5dc149f1edd 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -927,7 +927,7 @@ static void print_game_software_list(FILE *out, const game_driver *game, const m for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ ) { - if ( swlist->list_name[i] ) + if ( swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) { fprintf(out, "\t\t<softwarelist name=\"%s\" />\n", swlist->list_name[i] ); } diff --git a/src/emu/romload.c b/src/emu/romload.c index ef5f71c6623..bdad2e7eae0 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -1292,7 +1292,8 @@ void load_software_part_region(running_device *device, char *swlist, char *swnam const region_info *memregion = romdata->machine->region(regiontag); if (memregion != NULL) { - regionflags = normalize_flags_for_device(romdata->machine, regionflags, regiontag); + if (romdata->machine->device(regiontag) != NULL) + regionflags = normalize_flags_for_device(romdata->machine, regionflags, regiontag); /* clear old region (todo: should be moved to an image unload function) */ romdata->machine->region_free(memregion->name()); diff --git a/src/emu/softlist.c b/src/emu/softlist.c index c0669264ce1..b2b12755897 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -1313,6 +1313,7 @@ typedef struct _software_menu_state software_menu_state; struct _software_menu_state { char *list_name; /* currently selected list */ + device_image_interface* image; }; /* state of a software entry */ @@ -1325,10 +1326,10 @@ struct _software_entry_state /* populate a specific list */ -static void ui_mess_menu_populate_software_entries(running_machine *machine, ui_menu *menu, char *list_name) +static void ui_mess_menu_populate_software_entries(running_machine *machine, ui_menu *menu, char *list_name, device_image_interface* image) { software_list *list = software_list_open(machine->options(), list_name, FALSE, NULL); - + const char *interface = image->image_config().image_interface(); if (list) { for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo)) @@ -1338,8 +1339,9 @@ static void ui_mess_menu_populate_software_entries(running_machine *machine, ui_ software_part *part = software_find_part(swinfo, NULL, NULL); entry->interface = ui_menu_pool_strdup(menu, part->interface_); - - ui_menu_item_append(menu, swinfo->shortname, swinfo->longname, 0, entry); + if (strcmp(interface,part->interface_)==0) { + ui_menu_item_append(menu, swinfo->shortname, swinfo->longname, 0, entry); + } } software_list_close(list); @@ -1351,75 +1353,104 @@ void ui_mess_menu_software_list(running_machine *machine, ui_menu *menu, void *p const ui_menu_event *event; software_menu_state *sw_state = (software_menu_state *)state; - if (!ui_menu_populated(menu)) - ui_mess_menu_populate_software_entries(machine, menu, sw_state->list_name); + if (!ui_menu_populated(menu)) { + if (sw_state->list_name) { + ui_mess_menu_populate_software_entries(machine, menu, sw_state->list_name,sw_state->image); + } + } /* process the menu */ event = ui_menu_process(machine, menu, 0); if (event != NULL && event->iptkey == IPT_UI_SELECT && event->itemref != NULL) { - device_image_interface *image = NULL; - device_image_interface *sel_image = NULL; + device_image_interface *image = sw_state->image; software_entry_state *entry = (software_entry_state *) event->itemref; - - /* search for a device with the right interface */ - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) - { - const char *interface = image->image_config().image_interface(); - - if (interface != NULL) - { - if (!strcmp(interface, entry->interface)) - { - sel_image = image; - break; - } - } - } - - if (sel_image != NULL) - sel_image->load(entry->short_name); + if (image != NULL) + image->load(entry->short_name); else popmessage("No matching device found for interface '%s'!", entry->interface); } } /* list of available software lists - i.e. cartridges, floppies */ -static void ui_mess_menu_populate_software_list(running_machine *machine, ui_menu *menu) +static void ui_mess_menu_populate_software_list(running_machine *machine, ui_menu *menu, device_image_interface* image) { + bool haveCompatible = FALSE; + const char *interface = image->image_config().image_interface(); + for (const device_config *dev = machine->config->m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) { software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config(); for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++) { - if (swlist->list_name[i]) + if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) { - software_list *list = software_list_open(machine->options(), swlist->list_name[i], FALSE, NULL); + software_list *list = software_list_open(mame_options(), swlist->list_name[i], FALSE, NULL); if (list) { - /* todo: fix this */ + bool found = FALSE; for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo)) { + software_part *part = software_find_part(swinfo, NULL, NULL); + if (strcmp(interface,part->interface_)==0) { + found = TRUE; + } + } + if (found) { + ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]); } - ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]); + software_list_close(list); + } + } + } + } + + for (const device_config *dev = machine->config->m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) + { + software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config(); + + for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++) + { + if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_COMPATIBLE_SYSTEM)) + { + software_list *list = software_list_open(mame_options(), swlist->list_name[i], FALSE, NULL); + if (list) + { + bool found = FALSE; + for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo)) + { + software_part *part = software_find_part(swinfo, NULL, NULL); + if (strcmp(interface,part->interface_)==0) { + found = TRUE; + } + } + if (found) { + if (!haveCompatible) { + ui_menu_item_append(menu, "[compatible lists]", NULL, 0, NULL); + } + ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]); + } + + haveCompatible = TRUE; software_list_close(list); } } } } + } void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *event; - + device_image_interface* image = (device_image_interface*)parameter; if (!ui_menu_populated(menu)) - ui_mess_menu_populate_software_list(machine, menu); + ui_mess_menu_populate_software_list(machine, menu, image); /* process the menu */ event = ui_menu_process(machine, menu, 0); @@ -1429,6 +1460,7 @@ void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *param ui_menu *child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_mess_menu_software_list, NULL); software_menu_state *child_menustate = (software_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate->list_name = (char *)event->itemref; + child_menustate->image = image; ui_menu_stack_push(child_menu); } } diff --git a/src/emu/softlist.h b/src/emu/softlist.h index 8c7f3b4bee0..adf2cdda21a 100644 --- a/src/emu/softlist.h +++ b/src/emu/softlist.h @@ -87,24 +87,36 @@ typedef struct _software_list_config software_list_config; struct _software_list_config { char *list_name[SOFTWARE_LIST_CONFIG_SIZE]; + UINT32 list_type; }; #define DEVINFO_STR_SWLIST_0 (DEVINFO_STR_DEVICE_SPECIFIC+0) #define DEVINFO_STR_SWLIST_MAX (DEVINFO_STR_SWLIST_0 + SOFTWARE_LIST_CONFIG_SIZE - 1) +#define SOFTWARE_LIST_ORIGINAL_SYSTEM 0 +#define SOFTWARE_LIST_COMPATIBLE_SYSTEM 1 -#define MDRV_SOFTWARE_LIST_CONFIG(_idx,_list) \ - MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(software_list_config, list_name, _idx, _list) +#define MDRV_SOFTWARE_LIST_CONFIG(_idx,_list,_list_type) \ + MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(software_list_config, list_name, _idx, _list) \ + MDRV_DEVICE_CONFIG_DATA32(software_list_config, list_type, _list_type) #define MDRV_SOFTWARE_LIST_ADD( _tag, _list ) \ MDRV_DEVICE_ADD( _tag, SOFTWARE_LIST, 0 ) \ - MDRV_SOFTWARE_LIST_CONFIG(0,_list) + MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_ORIGINAL_SYSTEM) + + +#define MDRV_SOFTWARE_LIST_COMPATIBLE_ADD( _tag, _list ) \ + MDRV_DEVICE_ADD( _tag, SOFTWARE_LIST, 0 ) \ + MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_COMPATIBLE_SYSTEM) #define MDRV_SOFTWARE_LIST_MODIFY( _tag, _list ) \ MDRV_DEVICE_MODIFY( _tag ) \ - MDRV_SOFTWARE_LIST_CONFIG(0,_list) + MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_ORIGINAL_SYSTEM) +#define MDRV_SOFTWARE_LIST_COMPATIBLE_MODIFY( _tag, _list ) \ + MDRV_DEVICE_MODIFY( _tag ) \ + MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_COMPATIBLE_SYSTEM) #endif diff --git a/src/emu/uiimage.c b/src/emu/uiimage.c index 14559c6e8b1..65be909daad 100644 --- a/src/emu/uiimage.c +++ b/src/emu/uiimage.c @@ -55,6 +55,7 @@ enum _file_selector_entry_type { SELECTOR_ENTRY_TYPE_EMPTY, SELECTOR_ENTRY_TYPE_CREATE, + SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, SELECTOR_ENTRY_TYPE_DRIVE, SELECTOR_ENTRY_TYPE_DIRECTORY, SELECTOR_ENTRY_TYPE_FILE @@ -644,6 +645,10 @@ static void append_file_selector_entry_menu_item(ui_menu *menu, const file_selec text = "[create]"; break; + case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST: + text = "[software list]"; + break; + case SELECTOR_ENTRY_TYPE_DRIVE: text = entry->basename; subtext = "[DRIVE]"; @@ -698,6 +703,9 @@ static file_error menu_file_selector_populate(running_machine *machine, ui_menu append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_CREATE, NULL, NULL); } + /* add the "[software list]" entry */ + append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, NULL, NULL); + /* add the drives */ i = 0; while((volume_name = osd_get_volume_name(i))!=NULL) @@ -808,7 +816,10 @@ static void menu_file_selector(running_machine *machine, ui_menu *menu, void *pa child_menustate->manager_menustate = menustate->manager_menustate; ui_menu_stack_push(child_menu); break; - + case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST: + child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_image_menu_software, menustate->manager_menustate->selected_device); + ui_menu_stack_push(child_menu); + break; case SELECTOR_ENTRY_TYPE_DRIVE: case SELECTOR_ENTRY_TYPE_DIRECTORY: /* drive/directory - first check the path */ diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index 7a6ecf0ac12..9e46dd8bd9d 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -1544,10 +1544,6 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st /* add file manager menu */ ui_menu_item_append(menu, "File Manager", NULL, 0, (void*)ui_image_menu_file_manager); - - /* add software menu */ - ui_menu_item_append(menu, "Software", NULL, 0, (void*)ui_image_menu_software); - #ifdef MESS /* add MESS-specific menus */ ui_mess_main_menu_populate(machine, menu); |