Previous 199869 Revisions Next

r29429 Tuesday 8th April, 2014 at 00:07:03 UTC by Nathan Woods
Merge
[/branches/new_menus/src/emu/ui]menu.c swlist.c swlist.h

branches/new_menus/src/emu/ui/menu.c
r29428r29429
10381038
10391039UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container, UINT32 state)
10401040{
1041<<<<<<< HEAD
10421041   // if we have no menus stacked up, we have to have something
10431042   assert(menu_stack != NULL);
1044=======
1045   // if we have no menus stacked up, start with the main menu
1046   if (menu_stack == NULL)
1047      stack_push(auto_alloc_clear(machine, ui_menu_main(machine, container)));
1048>>>>>>> b8b662877e2b80cf9607b7d23a72942cf61c2032
10491043
10501044   // update the menu state
10511045   if (menu_stack != NULL)
branches/new_menus/src/emu/ui/swlist.c
r29428r29429
357357   }
358358}
359359
360<<<<<<< HEAD
361=======
362
363/***************************************************************************
364    SOFTWARE MENU - list of available software lists - i.e. cartridges,
365    floppies
366***************************************************************************/
367
368//-------------------------------------------------
369//  ctor
370//-------------------------------------------------
371
372ui_menu_software::ui_menu_software(running_machine &machine, render_container *container, const char *interface, software_list_device **result)
373   : ui_menu(machine, container)
374{
375   m_interface = interface;
376   m_result = result;
377}
378
379
380//-------------------------------------------------
381//  dtor
382//-------------------------------------------------
383
384ui_menu_software::~ui_menu_software()
385{
386}
387
388
389//-------------------------------------------------
390//  populate
391//-------------------------------------------------
392
393void ui_menu_software::populate()
394{
395   bool have_compatible = false;
396
397   // Add original software lists for this system
398   software_list_device_iterator iter(machine().config().root_device());
399   for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next())
400      if (swlistdev->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
401         if (swlistdev->first_software_info() != NULL && m_interface != NULL)
402         {
403            bool found = false;
404            for (const software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next())
405               if (swinfo->first_part()->matches_interface(m_interface))
406                  found = true;
407            if (found)
408               item_append(swlistdev->description(), NULL, 0, (void *)swlistdev);
409         }
410
411   // add compatible software lists for this system
412   for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next())
413      if (swlistdev->list_type() == SOFTWARE_LIST_COMPATIBLE_SYSTEM)
414         if (swlistdev->first_software_info() != NULL && m_interface != NULL)
415         {
416            bool found = false;
417            for (const software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next())
418               if (swinfo->first_part()->matches_interface(m_interface))
419                  found = true;
420            if (found)
421            {
422               if (!have_compatible)
423                  item_append("[compatible lists]", NULL, MENU_FLAG_DISABLE, NULL);
424               item_append(swlistdev->description(), NULL, 0, (void *)swlistdev);
425            }
426            have_compatible = true;
427         }
428}
429
430
431//-------------------------------------------------
432//  handle
433//-------------------------------------------------
434
435void ui_menu_software::handle()
436{
437   // process the menu
438   const ui_menu_event *event = process(0);
439
440   if (event != NULL && event->iptkey == IPT_UI_SELECT) {
441      //      ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container, (software_list_config *)event->itemref, image)));
442      *m_result = (software_list_device *)event->itemref;
443      ui_menu::stack_pop(machine());
444   }
445}
446>>>>>>> b8b662877e2b80cf9607b7d23a72942cf61c2032
branches/new_menus/src/emu/ui/swlist.h
r29428r29429
6868};
6969
7070
71<<<<<<< HEAD
72=======
73// ======================> ui_menu_software
7471
75class ui_menu_software : public ui_menu {
76public:
77   ui_menu_software(running_machine &machine, render_container *container, const char *interface, software_list_device **result);
78   virtual ~ui_menu_software();
79   virtual void populate();
80   virtual void handle();
81
82private:
83   const char *                    m_interface;
84   software_list_device **         m_result;
85};
86>>>>>>> b8b662877e2b80cf9607b7d23a72942cf61c2032
87
8872#endif  /* __UI_SWLIST_H__ */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team