shelves/new_menus/src/emu/ui/swlist.c
| r29297 | r29298 | |
| 30 | 30 | // ctor |
| 31 | 31 | //------------------------------------------------- |
| 32 | 32 | |
| 33 | | ui_menu_software_parts::ui_menu_software_parts(running_machine &machine, render_container *container, const software_list_device *swlist, const software_list *swl, const software_info *info, device_image_interface *image) |
| 34 | | : ui_menu(machine, container) |
| 33 | ui_menu_software_parts::ui_menu_software_parts(running_machine &machine, render_container *container, device_image_interface *image, software_list_device *swlist, software_info *info, const char *interface, software_part **part) |
| 34 | : ui_menu(machine, container) |
| 35 | 35 | { |
| 36 | m_image = image; |
| 36 | 37 | m_swlist = swlist; |
| 37 | | m_software_list = swl; |
| 38 | 38 | m_info = info; |
| 39 | | m_image = image; |
| 39 | m_interface = interface; |
| 40 | m_selected_part = part; |
| 40 | 41 | } |
| 41 | 42 | |
| 42 | 43 | |
| 43 | 44 | //------------------------------------------------- |
| 44 | | // dtor |
| 45 | | //------------------------------------------------- |
| 46 | | |
| 47 | | ui_menu_software_parts::~ui_menu_software_parts() |
| 48 | | { |
| 49 | | } |
| 50 | | |
| 51 | | |
| 52 | | //------------------------------------------------- |
| 53 | 45 | // populate |
| 54 | 46 | //------------------------------------------------- |
| 55 | 47 | |
| r29297 | r29298 | |
| 57 | 49 | { |
| 58 | 50 | for (const software_part *swpart = m_info->first_part(); swpart != NULL; swpart = swpart->next()) |
| 59 | 51 | { |
| 60 | | if (swpart->matches_interface(NULL)) // FIXME |
| 52 | if (swpart->matches_interface(m_interface)) |
| 61 | 53 | { |
| 62 | 54 | software_part_menu_entry *entry = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry)); |
| 63 | 55 | // check if the available parts have specific part_id to be displayed (e.g. "Map Disc", "Bonus Disc", etc.) |
| r29297 | r29298 | |
| 79 | 71 | |
| 80 | 72 | void ui_menu_software_parts::handle() |
| 81 | 73 | { |
| 82 | | #if 0 |
| 83 | 74 | // process the menu |
| 84 | 75 | const ui_menu_event *event = process(0); |
| 85 | 76 | |
| r29297 | r29298 | |
| 90 | 81 | |
| 91 | 82 | // load the image |
| 92 | 83 | astring image_name; |
| 93 | | image_name.printf("%s:%s:%s", m_swlist->list_name(), m_info->shortname, entry->part->name); |
| 84 | image_name.printf("%s:%s:%s", m_swlist->list_name(), m_info->shortname(), entry->part->name()); |
| 94 | 85 | m_image->load(image_name); |
| 95 | 86 | |
| 96 | 87 | // and exit |
| 97 | 88 | ui_menu::stack_pop(machine()); |
| 98 | 89 | } |
| 99 | | #endif |
| 100 | 90 | } |
| 101 | 91 | |
| 102 | 92 | |
| r29297 | r29298 | |
| 108 | 98 | // ctor |
| 109 | 99 | //------------------------------------------------- |
| 110 | 100 | |
| 111 | | ui_menu_software_list::ui_menu_software_list(running_machine &machine, render_container *container, const software_list_device *swlist, device_image_interface *image) |
| 112 | | : ui_menu(machine, container) |
| 101 | ui_menu_software_list::ui_menu_software_list(running_machine &machine, render_container *container, device_image_interface *image, software_list_device *swlist, const char *interface, astring &result) |
| 102 | : ui_menu(machine, container), m_result(result) |
| 113 | 103 | { |
| 114 | | m_swlist = swlist; |
| 115 | 104 | m_image = image; |
| 105 | m_swlist = swlist; |
| 106 | m_interface = interface; |
| 116 | 107 | m_entrylist = NULL; |
| 117 | 108 | m_ordered_by_shortname = true; |
| 118 | 109 | } |
| r29297 | r29298 | |
| 133 | 124 | |
| 134 | 125 | void ui_menu_software_list::select_entry(entry_info *entry) |
| 135 | 126 | { |
| 136 | | // TEMPORARILY DISABLING |
| 137 | | #if 0 |
| 138 | | const struct software_list *swl; |
| 139 | | const software_info *swi; |
| 140 | | const software_part *swp; |
| 127 | software_info *swi; |
| 128 | software_part *swp; |
| 141 | 129 | |
| 142 | | swl = software_list_open(machine().options(), m_swlist->list_name(), false, NULL); |
| 143 | | swi = software_list_find(swl, entry->short_name, NULL); |
| 130 | swi = m_swlist->find(entry->short_name); |
| 144 | 131 | |
| 145 | | if (swinfo_has_multiple_parts(swi, m_image->image_interface())) |
| 132 | if (swi->has_multiple_parts(m_interface)) |
| 146 | 133 | { |
| 147 | 134 | // multi part software; need to spawn another menu |
| 148 | | ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_parts(machine(), container, m_swlist, swl, swi, m_image))); |
| 135 | ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_parts(machine(), container, m_image, m_swlist, swi, m_interface, &swp))); |
| 149 | 136 | } |
| 150 | 137 | else |
| 151 | 138 | { |
| 152 | 139 | // single part software; just get the part |
| 153 | | swp = software_find_part(swi, NULL, NULL); |
| 140 | swp = swi->first_part(); |
| 154 | 141 | |
| 155 | 142 | // and load it |
| 156 | 143 | astring image_name; |
| 157 | | image_name.printf("%s:%s:%s", m_swlist->list_name(), swi->shortname, swp->name); |
| 144 | image_name.printf("%s:%s:%s", m_swlist->list_name(), swi->shortname(), swp->name()); |
| 158 | 145 | m_image->load(image_name); |
| 159 | | |
| 160 | | // and dispose of the list |
| 161 | | software_list_close(swl); |
| 162 | 146 | } |
| 163 | | #endif |
| 164 | 147 | } |
| 165 | 148 | |
| 166 | 149 | //------------------------------------------------- |
| r29297 | r29298 | |
| 208 | 191 | ui_menu_software_list::entry_info *ui_menu_software_list::append_software_entry(const software_info *swinfo) |
| 209 | 192 | { |
| 210 | 193 | entry_info *entry = NULL; |
| 211 | | #if 0 |
| 212 | 194 | entry_info **entryptr; |
| 213 | 195 | bool entry_updated = FALSE; |
| 214 | 196 | |
| r29297 | r29298 | |
| 240 | 222 | entry->next = *entryptr; |
| 241 | 223 | *entryptr = entry; |
| 242 | 224 | } |
| 243 | | #endif |
| 225 | |
| 244 | 226 | return entry; |
| 245 | 227 | } |
| 246 | 228 | |
| r29297 | r29298 | |
| 251 | 233 | |
| 252 | 234 | void ui_menu_software_list::populate() |
| 253 | 235 | { |
| 254 | | #if 0 |
| 255 | 236 | // build up the list of entries for the menu |
| 256 | 237 | for (const software_info *swinfo = m_swlist->first_software_info(); swinfo != NULL; swinfo = swinfo->next()) |
| 257 | 238 | append_software_entry(swinfo); |
| r29297 | r29298 | |
| 262 | 243 | // append all of the menu entries |
| 263 | 244 | for (entry_info *entry = m_entrylist; entry != NULL; entry = entry->next) |
| 264 | 245 | item_append(entry->short_name, entry->long_name, 0, entry); |
| 265 | | #endif |
| 266 | 246 | } |
| 267 | 247 | |
| 268 | 248 | |
shelves/new_menus/src/emu/ui/swlist.h
| r29297 | r29298 | |
| 19 | 19 | class ui_menu_software_parts : public ui_menu { |
| 20 | 20 | public: |
| 21 | 21 | enum { T_ENTRY, T_FMGR }; |
| 22 | | ui_menu_software_parts(running_machine &machine, render_container *container, const software_list_device *swlist, const software_list *swl, const software_info *info, device_image_interface *image); |
| 23 | | virtual ~ui_menu_software_parts(); |
| 22 | ui_menu_software_parts(running_machine &machine, render_container *container, device_image_interface *image, software_list_device *swlist, software_info *info, const char *interface, software_part **part); |
| 24 | 23 | virtual void populate(); |
| 25 | 24 | virtual void handle(); |
| 26 | 25 | |
| r29297 | r29298 | |
| 31 | 30 | }; |
| 32 | 31 | |
| 33 | 32 | // variables |
| 34 | | const software_list_device * m_swlist; |
| 35 | | const software_list * m_software_list; |
| 36 | | const software_info * m_info; |
| 37 | | device_image_interface * m_image; |
| 33 | device_image_interface *m_image; |
| 34 | software_list_device * m_swlist; |
| 35 | software_info * m_info; |
| 36 | const char * m_interface; |
| 37 | software_part ** m_selected_part; |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | 40 | |
| r29297 | r29298 | |
| 42 | 42 | |
| 43 | 43 | class ui_menu_software_list : public ui_menu { |
| 44 | 44 | public: |
| 45 | | ui_menu_software_list(running_machine &machine, render_container *container, const software_list_device *swlist, device_image_interface *image); |
| 45 | ui_menu_software_list(running_machine &machine, render_container *container, device_image_interface *image, software_list_device *swlist, const char *interface, astring &result); |
| 46 | 46 | virtual ~ui_menu_software_list(); |
| 47 | 47 | virtual void populate(); |
| 48 | 48 | virtual void handle(); |
| r29297 | r29298 | |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | 58 | // variables |
| 59 | | const software_list_device * m_swlist; // currently selected list |
| 60 | 59 | device_image_interface * m_image; |
| 60 | software_list_device * m_swlist; // currently selected list |
| 61 | const char * m_interface; |
| 62 | astring & m_result; |
| 61 | 63 | entry_info * m_entrylist; |
| 62 | 64 | char m_filename_buffer[1024]; |
| 63 | 65 | bool m_ordered_by_shortname; |
shelves/new_menus/src/emu/ui/emenubar.c
| r29297 | r29298 | |
| 242 | 242 | // first do "original system" softlists, then do compatible ones |
| 243 | 243 | for (int typenum = 0; typenum < ARRAY_LENGTH(types); typenum++) |
| 244 | 244 | { |
| 245 | | for (const software_list_device *swlist = softlist_iter.first(); swlist != NULL; swlist = softlist_iter.next()) |
| 245 | for (software_list_device *swlist = softlist_iter.first(); swlist != NULL; swlist = softlist_iter.next()) |
| 246 | 246 | { |
| 247 | 247 | if ((swlist->list_type() == types[typenum]) && is_softlist_relevant(swlist, image->image_interface(), description)) |
| 248 | 248 | { |
| r29297 | r29298 | |
| 505 | 505 | // is_softlist_relevant |
| 506 | 506 | //------------------------------------------------- |
| 507 | 507 | |
| 508 | | bool ui_emu_menubar::is_softlist_relevant(const software_list_device *swlist, const char *interface, astring &list_description) |
| 508 | bool ui_emu_menubar::is_softlist_relevant(software_list_device *swlist, const char *interface, astring &list_description) |
| 509 | 509 | { |
| 510 | 510 | bool result = false; |
| 511 | 511 | |
| 512 | | #if 0 |
| 513 | | const software_list *list = software_list_open(machine().options(), swlist->list_name(), false, NULL); |
| 514 | | if (list != NULL) |
| 512 | for (software_info *swinfo = swlist->first_software_info(); swinfo != NULL; swinfo = swinfo->next()) |
| 515 | 513 | { |
| 516 | | for (const software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo)) |
| 514 | software_part *part = swinfo->find_part(NULL, NULL); |
| 515 | if (part->matches_interface(interface)) |
| 517 | 516 | { |
| 518 | | const software_part *part = software_find_part(swinfo, NULL, NULL); |
| 519 | | if (softlist_contain_interface(interface, part->interface_)) |
| 520 | | { |
| 521 | | list_description.printf("%s...", list->description); |
| 522 | | result = true; |
| 523 | | break; |
| 524 | | } |
| 517 | list_description.printf("%s...", swlist->description()); |
| 518 | result = true; |
| 519 | break; |
| 525 | 520 | } |
| 526 | | software_list_close(list); |
| 527 | 521 | } |
| 528 | | #endif |
| 522 | |
| 529 | 523 | return result; |
| 530 | 524 | } |
| 531 | 525 | |
| r29297 | r29298 | |
| 558 | 552 | // select_from_software_list |
| 559 | 553 | //------------------------------------------------- |
| 560 | 554 | |
| 561 | | void ui_emu_menubar::select_from_software_list(device_image_interface *image, const software_list_device *swlist) |
| 555 | void ui_emu_menubar::select_from_software_list(device_image_interface *image, software_list_device *swlist) |
| 562 | 556 | { |
| 563 | | ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container(), swlist, image))); |
| 557 | astring result; |
| 558 | ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container(), image, swlist, NULL, result))); |
| 564 | 559 | } |
| 565 | 560 | |
| 566 | 561 | |