branches/new_menus/src/emu/ui/swlist.c
| r29428 | r29429 | |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 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 | | |
| 372 | | ui_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 | | |
| 384 | | ui_menu_software::~ui_menu_software() |
| 385 | | { |
| 386 | | } |
| 387 | | |
| 388 | | |
| 389 | | //------------------------------------------------- |
| 390 | | // populate |
| 391 | | //------------------------------------------------- |
| 392 | | |
| 393 | | void 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 | | |
| 435 | | void 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 |