mirror of
https://github.com/holub/mame
synced 2025-05-11 16:48:52 +03:00
- 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
This commit is contained in:
parent
4d9a17ee08
commit
16f14bc5f9
@ -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 );
|
||||
|
||||
|
@ -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] );
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user