Previous 15994 Revisions Next

r8410 Wednesday 7th July, 2010 at 03:34:19 UTC by Miodrag Milanović
- Added MDRV_SOFTWARE_LIST_COMPATIBLE_ADD for adding compatible software lists (for documentation purposes)
- 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
[src/emu]clifront.c info.c softlist.c softlist.h uiimage.c uimenu.c
[src/mess/drivers]gb.c

src/emu/uimenu.c
r8409r8410
15391539
15401540      /* add file manager menu */
15411541      ui_menu_item_append(menu, "File Manager", NULL, 0, (void*)ui_image_menu_file_manager);
1542
1543      /* add software menu */
1544      ui_menu_item_append(menu, "Software", NULL, 0, (void*)ui_image_menu_software);
1545     
15461542   #ifdef MESS
15471543      /* add MESS-specific menus */
15481544      ui_mess_main_menu_populate(machine, menu);
src/emu/uiimage.c
r8409r8410
5555{
5656   SELECTOR_ENTRY_TYPE_EMPTY,
5757   SELECTOR_ENTRY_TYPE_CREATE,
58   SELECTOR_ENTRY_TYPE_SOFTWARE_LIST,
5859   SELECTOR_ENTRY_TYPE_DRIVE,
5960   SELECTOR_ENTRY_TYPE_DIRECTORY,
6061   SELECTOR_ENTRY_TYPE_FILE
r8409r8410
644645         text = "[create]";
645646         break;
646647
648      case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
649         text = "[software list]";
650         break;
651
647652      case SELECTOR_ENTRY_TYPE_DRIVE:
648653         text = entry->basename;
649654         subtext = "[DRIVE]";
r8409r8410
698703      append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_CREATE, NULL, NULL);
699704   }
700705
706   /* add the "[software list]" entry */
707   append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, NULL, NULL);
708
701709   /* add the drives */
702710   i = 0;
703711   while((volume_name = osd_get_volume_name(i))!=NULL)
r8409r8410
808816               child_menustate->manager_menustate = menustate->manager_menustate;
809817               ui_menu_stack_push(child_menu);
810818               break;
811
819            case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
820               child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_image_menu_software, menustate->manager_menustate->selected_device);
821               ui_menu_stack_push(child_menu);
822               break;
812823            case SELECTOR_ENTRY_TYPE_DRIVE:
813824            case SELECTOR_ENTRY_TYPE_DIRECTORY:
814825               /* drive/directory - first check the path */
src/emu/clifront.c
r8409r8410
801801
802802            for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ )
803803            {
804               if ( swlist->list_name[i] && *swlist->list_name[i] )
804               if ( swlist->list_name[i] && *swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM))
805805                  nr_lists++;
806806            }
807807         }
r8409r8410
862862
863863            for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ )
864864            {
865               if ( swlist->list_name[i] && *swlist->list_name[i] )
865               if ( swlist->list_name[i] && *swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM))
866866               {
867867                  software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL );
868868
src/emu/softlist.c
r8409r8410
13121312struct _software_menu_state
13131313{
13141314   char *list_name;   /* currently selected list */
1315   device_image_interface* image;
13151316};
13161317
13171318/* state of a software entry */
r8409r8410
13241325
13251326
13261327/* populate a specific list */
1327static void ui_mess_menu_populate_software_entries(running_machine *machine, ui_menu *menu, char *list_name)
1328static void ui_mess_menu_populate_software_entries(running_machine *machine, ui_menu *menu, char *list_name, device_image_interface* image)
13281329{
13291330   software_list *list = software_list_open(mame_options(), list_name, FALSE, NULL);
1330
1331   const char *interface = image->image_config().image_interface();
13311332   if (list)
13321333   {
13331334      for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
r8409r8410
13371338
13381339         software_part *part = software_find_part(swinfo, NULL, NULL);
13391340         entry->interface = ui_menu_pool_strdup(menu, part->interface_);
1340
1341         ui_menu_item_append(menu, swinfo->shortname, swinfo->longname, 0, entry);
1341         if (strcmp(interface,part->interface_)==0) {
1342            ui_menu_item_append(menu, swinfo->shortname, swinfo->longname, 0, entry);
1343         }
13421344      }
13431345
13441346      software_list_close(list);
r8409r8410
13501352   const ui_menu_event *event;
13511353   software_menu_state *sw_state = (software_menu_state *)state;
13521354
1353   if (!ui_menu_populated(menu))
1354      ui_mess_menu_populate_software_entries(machine, menu, sw_state->list_name);
1355   if (!ui_menu_populated(menu)) {
1356      if (sw_state->list_name) {
1357         ui_mess_menu_populate_software_entries(machine, menu, sw_state->list_name,sw_state->image);
1358      }
1359   }
13551360
13561361   /* process the menu */
13571362   event = ui_menu_process(machine, menu, 0);
13581363
13591364   if (event != NULL && event->iptkey == IPT_UI_SELECT && event->itemref != NULL)
13601365   {
1361      device_image_interface *image = NULL;
1362      device_image_interface *sel_image = NULL;
1366      device_image_interface *sel_image = sw_state->image;
13631367      software_entry_state *entry = (software_entry_state *) event->itemref;
1364
1365      /* search for a device with the right interface */
1366      for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image))
1367      {     
1368         const char *interface = image->image_config().image_interface();
1369
1370         if (interface != NULL)
1371         {
1372            if (!strcmp(interface, entry->interface))
1373            {
1374               sel_image = image;
1375               break;
1376            }
1377         }
1378      }
1379
13801368      if (sel_image != NULL)
13811369         sel_image->load(entry->short_name);
13821370      else
r8409r8410
13851373}
13861374
13871375/* list of available software lists - i.e. cartridges, floppies */
1388static void ui_mess_menu_populate_software_list(running_machine *machine, ui_menu *menu)
1376static void ui_mess_menu_populate_software_list(running_machine *machine, ui_menu *menu, device_image_interface* image)
13891377{
1378   bool haveCompatible = FALSE;
1379   const char *interface = image->image_config().image_interface();
1380   
13901381   for (const device_config *dev = machine->config->devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
13911382   {
13921383      software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config();
13931384
13941385      for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++)
13951386      {
1396         if (swlist->list_name[i])
1387         if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM))
13971388         {
13981389            software_list *list = software_list_open(mame_options(), swlist->list_name[i], FALSE, NULL);
13991390
14001391            if (list)
14011392            {
1402               /* todo: fix this */
1393               bool found = FALSE;
14031394               for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
14041395               {
1396                  software_part *part = software_find_part(swinfo, NULL, NULL);
1397                  if (strcmp(interface,part->interface_)==0) {
1398                     found = TRUE;
1399                  }
1400               }               
1401               if (found) {
1402                  ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]);
14051403               }
14061404
1407               ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]);
1405               software_list_close(list);
1406            }
1407         }
1408      }
1409   }
1410   
1411   for (const device_config *dev = machine->config->devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
1412   {
1413      software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config();
14081414
1415      for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++)
1416      {
1417         if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_COMPATIBLE_SYSTEM))
1418         {
1419            software_list *list = software_list_open(mame_options(), swlist->list_name[i], FALSE, NULL);
1420
1421            if (list)
1422            {
1423               bool found = FALSE;
1424               for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
1425               {
1426                  software_part *part = software_find_part(swinfo, NULL, NULL);
1427                  if (strcmp(interface,part->interface_)==0) {
1428                     found = TRUE;
1429                  }
1430               }               
1431               if (found) {
1432                  if (!haveCompatible) {
1433                     ui_menu_item_append(menu, "[compatible lists]", NULL, 0, NULL);
1434                  }
1435                  ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]);
1436               }
1437
1438               haveCompatible = TRUE;
14091439               software_list_close(list);
14101440            }
14111441         }
14121442      }
14131443   }
1444   
14141445}
14151446
14161447void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *parameter, void *state)
14171448{
14181449   const ui_menu_event *event;
1419
1450   device_image_interface* image = (device_image_interface*)parameter;
14201451   if (!ui_menu_populated(menu))
1421      ui_mess_menu_populate_software_list(machine, menu);
1452      ui_mess_menu_populate_software_list(machine, menu, image);
14221453
14231454   /* process the menu */
14241455   event = ui_menu_process(machine, menu, 0);
r8409r8410
14281459      ui_menu *child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_mess_menu_software_list, NULL);
14291460      software_menu_state *child_menustate = (software_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
14301461      child_menustate->list_name = (char *)event->itemref;
1462      child_menustate->image = image;
14311463      ui_menu_stack_push(child_menu);
14321464   }
14331465}
src/emu/softlist.h
r8409r8410
8787struct _software_list_config
8888{
8989   char *list_name[SOFTWARE_LIST_CONFIG_SIZE];
90   UINT32 list_type;
9091};
9192
9293
9394#define DEVINFO_STR_SWLIST_0   (DEVINFO_STR_DEVICE_SPECIFIC+0)
9495#define DEVINFO_STR_SWLIST_MAX   (DEVINFO_STR_SWLIST_0 + SOFTWARE_LIST_CONFIG_SIZE - 1)
9596
97#define SOFTWARE_LIST_ORIGINAL_SYSTEM      0
98#define SOFTWARE_LIST_COMPATIBLE_SYSTEM      1
9699
97#define MDRV_SOFTWARE_LIST_CONFIG(_idx,_list)                        \
98   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(software_list_config, list_name, _idx, _list)
100#define MDRV_SOFTWARE_LIST_CONFIG(_idx,_list,_list_type)                        \
101   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(software_list_config, list_name, _idx, _list)   \
102   MDRV_DEVICE_CONFIG_DATA32(software_list_config, list_type, _list_type)
99103
100104#define MDRV_SOFTWARE_LIST_ADD( _tag, _list )                              \
101105   MDRV_DEVICE_ADD( _tag, SOFTWARE_LIST, 0 )            \
102   MDRV_SOFTWARE_LIST_CONFIG(0,_list)
106   MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_ORIGINAL_SYSTEM)
103107
104108
109#define MDRV_SOFTWARE_LIST_COMPATIBLE_ADD( _tag, _list )                              \
110   MDRV_DEVICE_ADD( _tag, SOFTWARE_LIST, 0 )            \
111   MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_COMPATIBLE_SYSTEM)
112
113
105114#define MDRV_SOFTWARE_LIST_MODIFY( _tag, _list )                           \
106115   MDRV_DEVICE_MODIFY( _tag )                        \
107   MDRV_SOFTWARE_LIST_CONFIG(0,_list)
116   MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_ORIGINAL_SYSTEM)
108117
118#define MDRV_SOFTWARE_LIST_COMPATIBLE_MODIFY( _tag, _list )                           \
119   MDRV_DEVICE_MODIFY( _tag )                        \
120   MDRV_SOFTWARE_LIST_CONFIG(0,_list, SOFTWARE_LIST_COMPATIBLE_SYSTEM)
109121
110122#endif
src/emu/info.c
r8409r8410
929929
930930      for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ )
931931      {
932         if ( swlist->list_name[i] )
932         if ( swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM))
933933         {
934934            fprintf(out, "\t\t<softwarelist name=\"%s\" />\n", swlist->list_name[i] );
935935         }
src/mess/drivers/gb.c
r8409r8410
653653   MDRV_CARTSLOT_START(gb_cart)
654654   MDRV_CARTSLOT_LOAD(gb_cart)
655655   MDRV_SOFTWARE_LIST_ADD("mainlist","gbcolor")
656   MDRV_SOFTWARE_LIST_ADD("gameboy","gameboy")
656   MDRV_SOFTWARE_LIST_COMPATIBLE_ADD("gameboy","gameboy")
657657MACHINE_DRIVER_END
658658
659659static MACHINE_DRIVER_START( megaduck )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team