Previous 15994 Revisions Next

r13675 Thursday 22nd December, 2011 at 13:02:31 UTC by Miodrag Milanović
Finished filtering support and added example ng_aes but not yet in hash/neogeo.xml (no whatsnew)
[src/emu]uiswlist.c uiswlist.h
[src/mess/drivers]ng_aes.c

src/emu/uiswlist.c
r13674r13675
126126   return result;
127127}
128128
129bool ui_menu_software_list::if_compatible(const char *compatibility, const char *filter)
130{
131   if ((compatibility==NULL) || (filter==NULL)) return TRUE;
132   astring comp = astring(compatibility,",");
133   char *filt = core_strdup(filter);
134   char *token = strtok(filt,",");
135   while (token!= NULL)
136   {
137      if (comp.find(0,astring(token,","))!=-1) return TRUE;
138      token = strtok (NULL, ",");
139   }
140   return FALSE;
141}
142
129143/* populate a specific list */
130144
131ui_menu_software_entry_info *ui_menu_software_list::append_software_entry(software_info *swinfo, char *list_name, device_image_interface* image)
145ui_menu_software_entry_info *ui_menu_software_list::append_software_entry(software_info *swinfo, device_image_interface* image)
132146{
133147   ui_menu_software_entry_info *entry = NULL;
134148   ui_menu_software_entry_info **entryptr;
r13674r13675
138152   // check if at least one of the parts has the correct interface and add a menu entry only in this case
139153   for (software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
140154   {
141      if (strcmp(interface, swpart->interface_) == 0)
155      const char *compatibility = software_part_get_feature(swpart, "compatibility");
156      if ((strcmp(interface, swpart->interface_) == 0) && if_compatible(compatibility, swlist->filter))
142157      {
143158         entry_updated = TRUE;
144159         // allocate a new entry
r13674r13675
147162
148163         entry->short_name = pool_strdup(swinfo->shortname);
149164         entry->long_name = pool_strdup(swinfo->longname);
150         entry->list_name = list_name;
165         entry->list_name = swlist->list_name;
151166         entry->image = image;
152167         entry->interface = pool_strdup(swpart->interface_);
153168         break;
r13674r13675
170185   return entry;
171186}
172187
173ui_menu_software_list::ui_menu_software_list(running_machine &machine, render_container *container, char *_list_name, device_image_interface *_image) : ui_menu(machine, container)
188ui_menu_software_list::ui_menu_software_list(running_machine &machine, render_container *container, software_list_config *_swlist, device_image_interface *_image) : ui_menu(machine, container)
174189{
175   list_name = _list_name;
190   swlist = _swlist;
176191   image = _image;
177192   entrylist = NULL;
178193   ordered_by_shortname = true;
r13674r13675
184199
185200void ui_menu_software_list::populate()
186201{
187   software_list *list = software_list_open(machine().options(), list_name, false, NULL);
202   software_list *list = software_list_open(machine().options(), swlist->list_name, false, NULL);
188203
189204   // build up the list of entries for the menu
190205   if (list)
191206   {
192207      for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
193         append_software_entry(swinfo, list_name, image);
208         append_software_entry(swinfo, image);
194209
195210      software_list_close(list);
196211   }
r13674r13675
241256      else if (event->iptkey == IPT_UI_SELECT)
242257      {
243258         ui_menu_software_entry_info *entry = (ui_menu_software_entry_info *) event->itemref;
244         software_list *tmp_list = software_list_open(machine().options(), list_name, false, NULL);
259         software_list *tmp_list = software_list_open(machine().options(), swlist->list_name, false, NULL);
245260         software_info *tmp_info = software_list_find(tmp_list, entry->short_name, NULL);
246261
247262         // if the selected software has multiple parts that can be loaded, open the submenu
r13674r13675
384399               }
385400            }
386401            if (found) {
387               item_append(list->description, NULL, 0, swlist->list_name);
402               item_append(list->description, NULL, 0, swlist);
388403            }
389404
390405            software_list_close(list);
r13674r13675
415430               if (!haveCompatible) {
416431                  item_append("[compatible lists]", NULL, MENU_FLAG_DISABLE, NULL);
417432               }
418               item_append(list->description, NULL, 0, swlist->list_name);
433               item_append(list->description, NULL, 0, swlist);
419434            }
420435
421436            haveCompatible = true;
r13674r13675
436451   const ui_menu_event *event = process(0);
437452
438453   if (event != NULL && event->iptkey == IPT_UI_SELECT)
439      ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container, (char *)event->itemref, image)));
454      ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container, (software_list_config *)event->itemref, image)));
440455}
src/emu/uiswlist.h
r13674r13675
4040
4141class ui_menu_software_list : public ui_menu {
4242public:
43   ui_menu_software_list(running_machine &machine, render_container *container, char *list_name, device_image_interface *image);
43   ui_menu_software_list(running_machine &machine, render_container *container, software_list_config *swlist, device_image_interface *image);
4444   virtual ~ui_menu_software_list();
4545   virtual void populate();
4646   virtual void handle();
4747
4848private:
49   char *list_name;   /* currently selected list */
49   software_list_config *swlist;   /* currently selected list */
5050   device_image_interface *image;
5151   ui_menu_software_entry_info *entrylist;
5252   char filename_buffer[1024];
5353   bool ordered_by_shortname;
5454
5555   int compare_entries(const ui_menu_software_entry_info *e1, const ui_menu_software_entry_info *e2, bool shortname);
56   ui_menu_software_entry_info *append_software_entry(software_info *swinfo, char *list_name, device_image_interface* image);
56   ui_menu_software_entry_info *append_software_entry(software_info *swinfo, device_image_interface* image);
5757   bool swinfo_has_multiple_parts(software_info *swinfo, const char *interface);
58   bool if_compatible(const char *compatibility, const char *filter);
5859};
5960
6061class ui_menu_software : public ui_menu {
src/mess/drivers/ng_aes.c
r13674r13675
16661666   MCFG_CARTSLOT_MANDATORY
16671667
16681668   MCFG_SOFTWARE_LIST_ADD("cart_list","neogeo")
1669   MCFG_SOFTWARE_LIST_FILTER("cart_list","AES")
16691670MACHINE_CONFIG_END
16701671
16711672static MACHINE_CONFIG_DERIVED( neocd, neogeo )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team