trunk/src/emu/ui/custmenu.cpp
| r253179 | r253180 | |
| 272 | 272 | void ui_menu_custom_filter::save_custom_filters() |
| 273 | 273 | { |
| 274 | 274 | // attempt to open the output file |
| 275 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 275 | emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 276 | 276 | if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) |
| 277 | 277 | { |
| 278 | 278 | // generate custom filters info |
| r253179 | r253180 | |
| 338 | 338 | if (m_event->iptkey == IPT_UI_SELECT) |
| 339 | 339 | { |
| 340 | 340 | sw_custfltr::numother++; |
| 341 | | sw_custfltr::other[sw_custfltr::numother] = MEWUI_SW_UNAVAILABLE + 1; |
| 341 | sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1; |
| 342 | 342 | m_added = true; |
| 343 | 343 | } |
| 344 | 344 | break; |
| r253179 | r253180 | |
| 346 | 346 | case REMOVE_FILTER: |
| 347 | 347 | if (m_event->iptkey == IPT_UI_SELECT) |
| 348 | 348 | { |
| 349 | | sw_custfltr::other[sw_custfltr::numother] = MEWUI_SW_UNAVAILABLE + 1; |
| 349 | sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1; |
| 350 | 350 | sw_custfltr::numother--; |
| 351 | 351 | changed = true; |
| 352 | 352 | } |
| r253179 | r253180 | |
| 356 | 356 | if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER) |
| 357 | 357 | { |
| 358 | 358 | int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER); |
| 359 | | if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > MEWUI_SW_UNAVAILABLE + 1) |
| 359 | if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > UI_SW_UNAVAILABLE + 1) |
| 360 | 360 | { |
| 361 | 361 | sw_custfltr::other[pos]--; |
| 362 | 362 | changed = true; |
| 363 | 363 | } |
| 364 | | else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < MEWUI_SW_LAST - 1) |
| 364 | else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < UI_SW_LAST - 1) |
| 365 | 365 | { |
| 366 | 366 | sw_custfltr::other[pos]++; |
| 367 | 367 | changed = true; |
| r253179 | r253180 | |
| 371 | 371 | size_t total = sw_filters::length; |
| 372 | 372 | std::vector<std::string> s_sel(total); |
| 373 | 373 | for (size_t index = 0; index < total; ++index) |
| 374 | | if (index <= MEWUI_SW_UNAVAILABLE|| index == MEWUI_SW_CUSTOM) |
| 374 | if (index <= UI_SW_UNAVAILABLE|| index == UI_SW_CUSTOM) |
| 375 | 375 | s_sel[index] = "_skip_"; |
| 376 | 376 | else |
| 377 | 377 | s_sel[index] = sw_filters::text[index]; |
| r253179 | r253180 | |
| 473 | 473 | void ui_menu_swcustom_filter::populate() |
| 474 | 474 | { |
| 475 | 475 | // add main filter |
| 476 | | UINT32 arrow_flags = get_arrow_flags((int)MEWUI_SW_ALL, (int)MEWUI_SW_UNAVAILABLE, sw_custfltr::main); |
| 476 | UINT32 arrow_flags = get_arrow_flags((int)UI_SW_ALL, (int)UI_SW_UNAVAILABLE, sw_custfltr::main); |
| 477 | 477 | item_append("Main filter", sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER); |
| 478 | 478 | |
| 479 | 479 | // add other filters |
| r253179 | r253180 | |
| 482 | 482 | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
| 483 | 483 | |
| 484 | 484 | // add filter items |
| 485 | | arrow_flags = get_arrow_flags((int)MEWUI_SW_UNAVAILABLE + 1, (int)MEWUI_SW_LAST - 1, sw_custfltr::other[x]); |
| 485 | arrow_flags = get_arrow_flags((int)UI_SW_UNAVAILABLE + 1, (int)UI_SW_LAST - 1, sw_custfltr::other[x]); |
| 486 | 486 | item_append("Other filter", sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x)); |
| 487 | 487 | |
| 488 | 488 | if (m_added) |
| 489 | 489 | selected = item.size() - 2; |
| 490 | 490 | |
| 491 | 491 | // add publisher subitem |
| 492 | | if (sw_custfltr::other[x] == MEWUI_SW_PUBLISHERS && m_filter.publisher.ui.size() > 0) |
| 492 | if (sw_custfltr::other[x] == UI_SW_PUBLISHERS && m_filter.publisher.ui.size() > 0) |
| 493 | 493 | { |
| 494 | 494 | arrow_flags = get_arrow_flags(0, m_filter.publisher.ui.size() - 1, sw_custfltr::mnfct[x]); |
| 495 | 495 | std::string fbuff("^!Publisher"); |
| r253179 | r253180 | |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | // add year subitem |
| 501 | | else if (sw_custfltr::other[x] == MEWUI_SW_YEARS && m_filter.year.ui.size() > 0) |
| 501 | else if (sw_custfltr::other[x] == UI_SW_YEARS && m_filter.year.ui.size() > 0) |
| 502 | 502 | { |
| 503 | 503 | arrow_flags = get_arrow_flags(0, m_filter.year.ui.size() - 1, sw_custfltr::year[x]); |
| 504 | 504 | std::string fbuff("^!Year"); |
| r253179 | r253180 | |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | // add year subitem |
| 510 | | else if (sw_custfltr::other[x] == MEWUI_SW_LIST && m_filter.swlist.name.size() > 0) |
| 510 | else if (sw_custfltr::other[x] == UI_SW_LIST && m_filter.swlist.name.size() > 0) |
| 511 | 511 | { |
| 512 | 512 | arrow_flags = get_arrow_flags(0, m_filter.swlist.name.size() - 1, sw_custfltr::list[x]); |
| 513 | 513 | std::string fbuff("^!Software List"); |
| r253179 | r253180 | |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | // add device type subitem |
| 519 | | else if (sw_custfltr::other[x] == MEWUI_SW_TYPE && m_filter.type.ui.size() > 0) |
| 519 | else if (sw_custfltr::other[x] == UI_SW_TYPE && m_filter.type.ui.size() > 0) |
| 520 | 520 | { |
| 521 | 521 | arrow_flags = get_arrow_flags(0, m_filter.type.ui.size() - 1, sw_custfltr::type[x]); |
| 522 | 522 | std::string fbuff("^!Device type"); |
| r253179 | r253180 | |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | // add region subitem |
| 528 | | else if (sw_custfltr::other[x] == MEWUI_SW_REGION && m_filter.region.ui.size() > 0) |
| 528 | else if (sw_custfltr::other[x] == UI_SW_REGION && m_filter.region.ui.size() > 0) |
| 529 | 529 | { |
| 530 | 530 | arrow_flags = get_arrow_flags(0, m_filter.region.ui.size() - 1, sw_custfltr::region[x]); |
| 531 | 531 | std::string fbuff("^!Region"); |
| r253179 | r253180 | |
| 587 | 587 | void ui_menu_swcustom_filter::save_sw_custom_filters() |
| 588 | 588 | { |
| 589 | 589 | // attempt to open the output file |
| 590 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 590 | emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 591 | 591 | if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) |
| 592 | 592 | { |
| 593 | 593 | // generate custom filters info |
| r253179 | r253180 | |
| 598 | 598 | for (int x = 1; x <= sw_custfltr::numother; x++) |
| 599 | 599 | { |
| 600 | 600 | cinfo.append("Other filter = ").append(sw_filters::text[sw_custfltr::other[x]]).append("\n"); |
| 601 | | if (sw_custfltr::other[x] == MEWUI_SW_PUBLISHERS) |
| 601 | if (sw_custfltr::other[x] == UI_SW_PUBLISHERS) |
| 602 | 602 | cinfo.append(" Manufacturer filter = ").append(m_filter.publisher.ui[sw_custfltr::mnfct[x]]).append("\n"); |
| 603 | | else if (sw_custfltr::other[x] == MEWUI_SW_LIST) |
| 603 | else if (sw_custfltr::other[x] == UI_SW_LIST) |
| 604 | 604 | cinfo.append(" Software List filter = ").append(m_filter.swlist.name[sw_custfltr::list[x]]).append("\n"); |
| 605 | | else if (sw_custfltr::other[x] == MEWUI_SW_YEARS) |
| 605 | else if (sw_custfltr::other[x] == UI_SW_YEARS) |
| 606 | 606 | cinfo.append(" Year filter = ").append(m_filter.year.ui[sw_custfltr::year[x]]).append("\n"); |
| 607 | | else if (sw_custfltr::other[x] == MEWUI_SW_TYPE) |
| 607 | else if (sw_custfltr::other[x] == UI_SW_TYPE) |
| 608 | 608 | cinfo.append(" Type filter = ").append(m_filter.type.ui[sw_custfltr::type[x]]).append("\n"); |
| 609 | | else if (sw_custfltr::other[x] == MEWUI_SW_REGION) |
| 609 | else if (sw_custfltr::other[x] == UI_SW_REGION) |
| 610 | 610 | cinfo.append(" Region filter = ").append(m_filter.region.ui[sw_custfltr::region[x]]).append("\n"); |
| 611 | 611 | } |
| 612 | 612 | file.puts(cinfo.c_str()); |
trunk/src/emu/ui/datmenu.cpp
| r253179 | r253180 | |
| 161 | 161 | std::string first_part(tempbuf.substr(0, first_dspace)); |
| 162 | 162 | std::string last_part(tempbuf.substr(first_dspace)); |
| 163 | 163 | strtrimspace(last_part); |
| 164 | | item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_MEWUI_HISTORY, nullptr); |
| 164 | item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_UI_HISTORY, nullptr); |
| 165 | 165 | } |
| 166 | 166 | else |
| 167 | | item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); |
| 167 | item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); |
| 168 | 168 | } |
| 169 | 169 | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
| 170 | 170 | } |
| r253179 | r253180 | |
| 302 | 302 | for (int r = 0; r < total_lines; r++) |
| 303 | 303 | { |
| 304 | 304 | std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); |
| 305 | | item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); |
| 305 | item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | else |
| r253179 | r253180 | |
| 410 | 410 | machine().pause(); |
| 411 | 411 | switch (m_flags) |
| 412 | 412 | { |
| 413 | | case MEWUI_HISTORY_LOAD: |
| 413 | case UI_HISTORY_LOAD: |
| 414 | 414 | if (!get_data(m_driver, m_flags)) |
| 415 | 415 | item_append("No available History for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); |
| 416 | 416 | break; |
| 417 | 417 | |
| 418 | | case MEWUI_MAMEINFO_LOAD: |
| 418 | case UI_MAMEINFO_LOAD: |
| 419 | 419 | if (!get_data(m_driver, m_flags)) |
| 420 | 420 | item_append("No available MameInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); |
| 421 | 421 | break; |
| 422 | 422 | |
| 423 | | case MEWUI_MESSINFO_LOAD: |
| 423 | case UI_MESSINFO_LOAD: |
| 424 | 424 | if (!get_data(m_driver, m_flags)) |
| 425 | 425 | item_append("No available MessInfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); |
| 426 | 426 | break; |
| 427 | 427 | |
| 428 | | case MEWUI_STORY_LOAD: |
| 429 | | if (!get_data(m_driver, MEWUI_STORY_LOAD)) |
| 428 | case UI_STORY_LOAD: |
| 429 | if (!get_data(m_driver, UI_STORY_LOAD)) |
| 430 | 430 | item_append("No available Mamescore for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); |
| 431 | 431 | break; |
| 432 | 432 | |
| 433 | | case MEWUI_SYSINFO_LOAD: |
| 434 | | if (!get_data(m_driver, MEWUI_SYSINFO_LOAD)) |
| 433 | case UI_SYSINFO_LOAD: |
| 434 | if (!get_data(m_driver, UI_SYSINFO_LOAD)) |
| 435 | 435 | item_append("No available Sysinfo for this machine.", nullptr, MENU_FLAG_DISABLE, nullptr); |
| 436 | 436 | break; |
| 437 | 437 | } |
| r253179 | r253180 | |
| 454 | 454 | |
| 455 | 455 | switch (m_flags) |
| 456 | 456 | { |
| 457 | | case MEWUI_HISTORY_LOAD: |
| 457 | case UI_HISTORY_LOAD: |
| 458 | 458 | tempbuf.assign("History - Game / System: ").append(m_driver->description); |
| 459 | 459 | revision.assign("History.dat Revision: ").append(datfile.rev_history()); |
| 460 | 460 | break; |
| 461 | 461 | |
| 462 | | case MEWUI_MESSINFO_LOAD: |
| 462 | case UI_MESSINFO_LOAD: |
| 463 | 463 | tempbuf.assign("MessInfo - System: ").append(m_driver->description); |
| 464 | 464 | revision.assign("Messinfo.dat Revision: ").append(datfile.rev_messinfo()); |
| 465 | 465 | break; |
| 466 | 466 | |
| 467 | | case MEWUI_MAMEINFO_LOAD: |
| 467 | case UI_MAMEINFO_LOAD: |
| 468 | 468 | tempbuf.assign("MameInfo - Game: ").append(m_driver->description); |
| 469 | 469 | revision.assign("Mameinfo.dat Revision: ").append(datfile.rev_mameinfo()); |
| 470 | 470 | break; |
| 471 | 471 | |
| 472 | | case MEWUI_SYSINFO_LOAD: |
| 472 | case UI_SYSINFO_LOAD: |
| 473 | 473 | tempbuf.assign("Sysinfo - System: ").append(m_driver->description); |
| 474 | 474 | revision.assign("Sysinfo.dat Revision: ").append(datfile.rev_sysinfo()); |
| 475 | 475 | break; |
| 476 | 476 | |
| 477 | | case MEWUI_STORY_LOAD: |
| 477 | case UI_STORY_LOAD: |
| 478 | 478 | tempbuf.assign("MAMESCORE - Game: ").append(m_driver->description); |
| 479 | 479 | revision.assign("Story.dat Revision: ").append(machine().datfile().rev_storyinfo()); |
| 480 | 480 | break; |
| r253179 | r253180 | |
| 552 | 552 | { |
| 553 | 553 | std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); |
| 554 | 554 | // special case for mamescore |
| 555 | | if (flags == MEWUI_STORY_LOAD) |
| 555 | if (flags == UI_STORY_LOAD) |
| 556 | 556 | { |
| 557 | 557 | size_t last_underscore = tempbuf.find_last_of('_'); |
| 558 | 558 | if (last_underscore != std::string::npos) |
| r253179 | r253180 | |
| 560 | 560 | std::string last_part(tempbuf.substr(last_underscore + 1)); |
| 561 | 561 | int primary = tempbuf.find("___"); |
| 562 | 562 | std::string first_part(tempbuf.substr(0, primary)); |
| 563 | | item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_MEWUI_HISTORY, nullptr); |
| 563 | item_append(first_part.c_str(), last_part.c_str(), MENU_FLAG_UI_HISTORY, nullptr); |
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | else |
| 567 | | item_append(tempbuf.c_str(), nullptr, MENU_FLAG_MEWUI_HISTORY, nullptr); |
| 567 | item_append(tempbuf.c_str(), nullptr, MENU_FLAG_UI_HISTORY, nullptr); |
| 568 | 568 | } |
| 569 | 569 | return true; |
| 570 | 570 | } |
trunk/src/emu/ui/menu.cpp
| r253179 | r253180 | |
| 76 | 76 | render_texture *ui_menu::hilight_main_texture; |
| 77 | 77 | render_texture *ui_menu::bgrnd_texture; |
| 78 | 78 | render_texture *ui_menu::star_texture; |
| 79 | | render_texture *ui_menu::toolbar_texture[MEWUI_TOOLBAR_BUTTONS]; |
| 80 | | render_texture *ui_menu::sw_toolbar_texture[MEWUI_TOOLBAR_BUTTONS]; |
| 79 | render_texture *ui_menu::toolbar_texture[UI_TOOLBAR_BUTTONS]; |
| 80 | render_texture *ui_menu::sw_toolbar_texture[UI_TOOLBAR_BUTTONS]; |
| 81 | 81 | render_texture *ui_menu::icons_texture[MAX_ICONS_RENDER]; |
| 82 | 82 | std::unique_ptr<bitmap_argb32> ui_menu::snapx_bitmap; |
| 83 | 83 | std::unique_ptr<bitmap_argb32> ui_menu::no_avail_bitmap; |
| r253179 | r253180 | |
| 85 | 85 | std::unique_ptr<bitmap_argb32> ui_menu::bgrnd_bitmap; |
| 86 | 86 | bitmap_argb32 *ui_menu::icons_bitmap[MAX_ICONS_RENDER]; |
| 87 | 87 | std::unique_ptr<bitmap_rgb32> ui_menu::hilight_main_bitmap; |
| 88 | | bitmap_argb32 *ui_menu::toolbar_bitmap[MEWUI_TOOLBAR_BUTTONS]; |
| 89 | | bitmap_argb32 *ui_menu::sw_toolbar_bitmap[MEWUI_TOOLBAR_BUTTONS]; |
| 88 | bitmap_argb32 *ui_menu::toolbar_bitmap[UI_TOOLBAR_BUTTONS]; |
| 89 | bitmap_argb32 *ui_menu::sw_toolbar_bitmap[UI_TOOLBAR_BUTTONS]; |
| 90 | 90 | |
| 91 | 91 | /*************************************************************************** |
| 92 | 92 | INLINE FUNCTIONS |
| r253179 | r253180 | |
| 149 | 149 | // create a texture for arrow icons |
| 150 | 150 | arrow_texture = machine.render().texture_alloc(render_triangle); |
| 151 | 151 | |
| 152 | | // initialize mewui |
| 153 | | init_mewui(machine); |
| 152 | // initialize ui |
| 153 | init_ui(machine); |
| 154 | 154 | |
| 155 | 155 | // add an exit callback to free memory |
| 156 | 156 | machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_menu::exit), &machine)); |
| r253179 | r253180 | |
| 179 | 179 | for (auto & elem : icons_texture) |
| 180 | 180 | mre.texture_free(elem); |
| 181 | 181 | |
| 182 | | for (int i = 0; i < MEWUI_TOOLBAR_BUTTONS; i++) |
| 182 | for (int i = 0; i < UI_TOOLBAR_BUTTONS; i++) |
| 183 | 183 | { |
| 184 | 184 | mre.texture_free(sw_toolbar_texture[i]); |
| 185 | 185 | mre.texture_free(toolbar_texture[i]); |
| r253179 | r253180 | |
| 336 | 336 | // draw the menu |
| 337 | 337 | if (item.size() > 1 && (item[0].flags & MENU_FLAG_MULTILINE) != 0) |
| 338 | 338 | draw_text_box(); |
| 339 | | else if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) |
| 339 | else if ((item[0].flags & MENU_FLAG_UI ) != 0 || (item[0].flags & MENU_FLAG_UI_SWLIST ) != 0) |
| 340 | 340 | draw_select_game(flags & UI_MENU_PROCESS_NOINPUT); |
| 341 | | else if ((item[0].flags & MENU_FLAG_MEWUI_PALETTE ) != 0) |
| 341 | else if ((item[0].flags & MENU_FLAG_UI_PALETTE ) != 0) |
| 342 | 342 | draw_palette_menu(); |
| 343 | 343 | else |
| 344 | 344 | draw(flags & UI_MENU_PROCESS_CUSTOM_ONLY, flags & UI_MENU_PROCESS_NOIMAGE, flags & UI_MENU_PROCESS_NOINPUT); |
| r253179 | r253180 | |
| 347 | 347 | if (!(flags & UI_MENU_PROCESS_NOKEYS) && !(flags & UI_MENU_PROCESS_NOINPUT)) |
| 348 | 348 | { |
| 349 | 349 | // read events |
| 350 | | if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) |
| 350 | if ((item[0].flags & MENU_FLAG_UI ) != 0 || (item[0].flags & MENU_FLAG_UI_SWLIST ) != 0) |
| 351 | 351 | handle_main_events(flags); |
| 352 | 352 | else |
| 353 | 353 | handle_events(flags); |
| r253179 | r253180 | |
| 355 | 355 | // handle the keys if we don't already have an menu_event |
| 356 | 356 | if (menu_event.iptkey == IPT_INVALID) |
| 357 | 357 | { |
| 358 | | if ((item[0].flags & MENU_FLAG_MEWUI ) != 0 || (item[0].flags & MENU_FLAG_MEWUI_SWLIST ) != 0) |
| 358 | if ((item[0].flags & MENU_FLAG_UI ) != 0 || (item[0].flags & MENU_FLAG_UI_SWLIST ) != 0) |
| 359 | 359 | handle_main_keys(flags); |
| 360 | 360 | else |
| 361 | 361 | handle_keys(flags); |
| r253179 | r253180 | |
| 463 | 463 | int itemnum, linenum; |
| 464 | 464 | bool mouse_hit, mouse_button; |
| 465 | 465 | float mouse_x = -1, mouse_y = -1; |
| 466 | | bool history_flag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); |
| 466 | bool history_flag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); |
| 467 | 467 | |
| 468 | 468 | if (machine().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) |
| 469 | 469 | container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| r253179 | r253180 | |
| 575 | 575 | |
| 576 | 576 | // set the hover if this is our item |
| 577 | 577 | if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable() |
| 578 | | && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) |
| 578 | && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) |
| 579 | 579 | hover = itemnum; |
| 580 | 580 | |
| 581 | 581 | // if we're selected, draw with a different background |
| 582 | | if (itemnum == selected && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) |
| 582 | if (itemnum == selected && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) |
| 583 | 583 | { |
| 584 | 584 | fgcolor = UI_SELECTED_COLOR; |
| 585 | 585 | bgcolor = UI_SELECTED_BG_COLOR; |
| r253179 | r253180 | |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | // else if the mouse is over this item, draw with a different background |
| 591 | | else if (itemnum == hover && (((pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) || (linenum == 0 && top_line != 0) |
| 591 | else if (itemnum == hover && (((pitem.flags & MENU_FLAG_UI_HISTORY) == 0) || (linenum == 0 && top_line != 0) |
| 592 | 592 | || (linenum == visible_lines - 1 && itemnum != item.size() - 1))) |
| 593 | 593 | { |
| 594 | 594 | fgcolor = UI_MOUSEOVER_COLOR; |
| r253179 | r253180 | |
| 634 | 634 | container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 635 | 635 | |
| 636 | 636 | // draw the subitem left-justified |
| 637 | | else if (pitem.subtext == nullptr && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) != 0) |
| 637 | else if (pitem.subtext == nullptr && (pitem.flags & MENU_FLAG_UI_HISTORY) != 0) |
| 638 | 638 | machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, |
| 639 | 639 | JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); |
| 640 | 640 | |
| r253179 | r253180 | |
| 820 | 820 | { |
| 821 | 821 | int stop = FALSE; |
| 822 | 822 | ui_event local_menu_event; |
| 823 | | bool historyflag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); |
| 823 | bool historyflag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); |
| 824 | 824 | |
| 825 | 825 | // loop while we have interesting events |
| 826 | 826 | while (!stop && machine().ui_input().pop_event(&local_menu_event)) |
| r253179 | r253180 | |
| 917 | 917 | // bail if no items |
| 918 | 918 | if (item.empty()) |
| 919 | 919 | return; |
| 920 | | bool historyflag = ((item[0].flags & MENU_FLAG_MEWUI_HISTORY) != 0); |
| 920 | bool historyflag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); |
| 921 | 921 | |
| 922 | 922 | |
| 923 | 923 | // if we hit select, return TRUE or pop the stack, depending on the item |
| r253179 | r253180 | |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | //------------------------------------------------- |
| 1260 | | // init - initialize the mewui menu system |
| 1260 | // init - initialize the ui menu system |
| 1261 | 1261 | //------------------------------------------------- |
| 1262 | 1262 | |
| 1263 | | void ui_menu::init_mewui(running_machine &machine) |
| 1263 | void ui_menu::init_ui(running_machine &machine) |
| 1264 | 1264 | { |
| 1265 | 1265 | render_manager &mrender = machine.render(); |
| 1266 | 1266 | // create a texture for hilighting items in main menu |
| r253179 | r253180 | |
| 1323 | 1323 | bgrnd_bitmap->reset(); |
| 1324 | 1324 | |
| 1325 | 1325 | // create a texture for toolbar |
| 1326 | | for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) |
| 1326 | for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) |
| 1327 | 1327 | { |
| 1328 | 1328 | toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); |
| 1329 | 1329 | toolbar_texture[x] = mrender.texture_alloc(); |
| r253179 | r253180 | |
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | 1338 | // create a texture for toolbar |
| 1339 | | for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) |
| 1339 | for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) |
| 1340 | 1340 | { |
| 1341 | 1341 | sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); |
| 1342 | 1342 | sw_toolbar_texture[x] = mrender.texture_alloc(); |
| r253179 | r253180 | |
| 1367 | 1367 | float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER; |
| 1368 | 1368 | float primary_left = (1.0f - visible_width) * 0.5f; |
| 1369 | 1369 | float primary_width = visible_width; |
| 1370 | | bool is_swlist = ((item[0].flags & MENU_FLAG_MEWUI_SWLIST) != 0); |
| 1371 | | bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); |
| 1370 | bool is_swlist = ((item[0].flags & MENU_FLAG_UI_SWLIST) != 0); |
| 1371 | bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); |
| 1372 | 1372 | ui_manager &mui = machine().ui(); |
| 1373 | 1373 | |
| 1374 | 1374 | // draw background image if available |
| r253179 | r253180 | |
| 2139 | 2139 | bitmap_argb32 **t_bitmap = (software) ? sw_toolbar_bitmap : toolbar_bitmap; |
| 2140 | 2140 | |
| 2141 | 2141 | int m_valid = 0; |
| 2142 | | for (int x = 0; x < MEWUI_TOOLBAR_BUTTONS; ++x) |
| 2142 | for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) |
| 2143 | 2143 | if (t_bitmap[x]->valid()) |
| 2144 | 2144 | m_valid++; |
| 2145 | 2145 | |
| r253179 | r253180 | |
| 2148 | 2148 | h_len = (h_len % 2 == 0) ? h_len : h_len - 1; |
| 2149 | 2149 | x1 = (x1 + x2) * 0.5f - x_pixel * (m_valid * ((h_len / 2) + 2)); |
| 2150 | 2150 | |
| 2151 | | for (int z = 0; z < MEWUI_TOOLBAR_BUTTONS; ++z) |
| 2151 | for (int z = 0; z < UI_TOOLBAR_BUTTONS; ++z) |
| 2152 | 2152 | { |
| 2153 | 2153 | if (t_bitmap[z]->valid()) |
| 2154 | 2154 | { |
| r253179 | r253180 | |
| 2543 | 2543 | hover = itemnum; |
| 2544 | 2544 | |
| 2545 | 2545 | // if we're selected, draw with a different background |
| 2546 | | if (itemnum == selected && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) |
| 2546 | if (itemnum == selected && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) |
| 2547 | 2547 | { |
| 2548 | 2548 | fgcolor = UI_SELECTED_COLOR; |
| 2549 | 2549 | bgcolor = UI_SELECTED_BG_COLOR; |
| 2550 | 2550 | } |
| 2551 | 2551 | |
| 2552 | 2552 | // else if the mouse is over this item, draw with a different background |
| 2553 | | else if (itemnum == hover && (pitem.flags & MENU_FLAG_MEWUI_HISTORY) == 0) |
| 2553 | else if (itemnum == hover && (pitem.flags & MENU_FLAG_UI_HISTORY) == 0) |
| 2554 | 2554 | { |
| 2555 | 2555 | fgcolor = UI_MOUSEOVER_COLOR; |
| 2556 | 2556 | bgcolor = UI_MOUSEOVER_BG_COLOR; |
trunk/src/emu/ui/selgame.cpp
| r253179 | r253180 | |
| 4 | 4 | |
| 5 | 5 | ui/selgame.cpp |
| 6 | 6 | |
| 7 | | Main MEWUI menu. |
| 7 | Main UI menu. |
| 8 | 8 | |
| 9 | 9 | *********************************************************************/ |
| 10 | 10 | |
| r253179 | r253180 | |
| 32 | 32 | #include "softlist.h" |
| 33 | 33 | #include <algorithm> |
| 34 | 34 | |
| 35 | | extern const char MEWUI_VERSION_TAG[]; |
| 35 | extern const char UI_VERSION_TAG[]; |
| 36 | 36 | |
| 37 | 37 | static bool first_start = true; |
| 38 | 38 | static const char *dats_info[] = { "General Info", "History", "Mameinfo", "Sysinfo", "Messinfo", "Command", "Mamescore" }; |
| r253179 | r253180 | |
| 170 | 170 | moptions.set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); |
| 171 | 171 | |
| 172 | 172 | ui_globals::curimage_view = FIRST_VIEW; |
| 173 | | ui_globals::curdats_view = MEWUI_FIRST_LOAD; |
| 173 | ui_globals::curdats_view = UI_FIRST_LOAD; |
| 174 | 174 | ui_globals::switch_image = false; |
| 175 | 175 | ui_globals::default_image = true; |
| 176 | 176 | ui_globals::panels_status = moptions.hide_panels(); |
| r253179 | r253180 | |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // Infos |
| 272 | | else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view > MEWUI_FIRST_LOAD) |
| 272 | else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view > UI_FIRST_LOAD) |
| 273 | 273 | { |
| 274 | 274 | ui_globals::curdats_view--; |
| 275 | 275 | topline_datsview = 0; |
| r253179 | r253180 | |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // Infos |
| 291 | | else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view < MEWUI_LAST_LOAD) |
| 291 | else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view < UI_LAST_LOAD) |
| 292 | 292 | { |
| 293 | 293 | ui_globals::curdats_view++; |
| 294 | 294 | topline_datsview = 0; |
| r253179 | r253180 | |
| 331 | 331 | { |
| 332 | 332 | const game_driver *driver = (const game_driver *)m_event->itemref; |
| 333 | 333 | if ((FPTR)driver > 2) |
| 334 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_HISTORY_LOAD, driver)); |
| 334 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_HISTORY_LOAD, driver)); |
| 335 | 335 | } |
| 336 | 336 | else |
| 337 | 337 | { |
| r253179 | r253180 | |
| 339 | 339 | if ((FPTR)swinfo > 2) |
| 340 | 340 | { |
| 341 | 341 | if (swinfo->startempty == 1) |
| 342 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_HISTORY_LOAD, swinfo->driver)); |
| 342 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_HISTORY_LOAD, swinfo->driver)); |
| 343 | 343 | else |
| 344 | 344 | ui_menu::stack_push(global_alloc_clear<ui_menu_history_sw>(machine(), container, swinfo)); |
| 345 | 345 | } |
| r253179 | r253180 | |
| 355 | 355 | if ((FPTR)driver > 2) |
| 356 | 356 | { |
| 357 | 357 | if ((driver->flags & MACHINE_TYPE_ARCADE) != 0) |
| 358 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_MAMEINFO_LOAD, driver)); |
| 358 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_MAMEINFO_LOAD, driver)); |
| 359 | 359 | else |
| 360 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_MESSINFO_LOAD, driver)); |
| 360 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_MESSINFO_LOAD, driver)); |
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | else |
| r253179 | r253180 | |
| 366 | 366 | if ((FPTR)swinfo > 2 && swinfo->startempty == 1) |
| 367 | 367 | { |
| 368 | 368 | if ((swinfo->driver->flags & MACHINE_TYPE_ARCADE) != 0) |
| 369 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_MAMEINFO_LOAD, swinfo->driver)); |
| 369 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_MAMEINFO_LOAD, swinfo->driver)); |
| 370 | 370 | else |
| 371 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_MESSINFO_LOAD, swinfo->driver)); |
| 371 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_MESSINFO_LOAD, swinfo->driver)); |
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | } |
| r253179 | r253180 | |
| 380 | 380 | { |
| 381 | 381 | const game_driver *driver = (const game_driver *)m_event->itemref; |
| 382 | 382 | if ((FPTR)driver > 2) |
| 383 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_STORY_LOAD, driver)); |
| 383 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_STORY_LOAD, driver)); |
| 384 | 384 | } |
| 385 | 385 | else |
| 386 | 386 | { |
| 387 | 387 | ui_software_info *swinfo = (ui_software_info *)m_event->itemref; |
| 388 | 388 | if ((FPTR)swinfo > 2 && swinfo->startempty == 1) |
| 389 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_STORY_LOAD, swinfo->driver)); |
| 389 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_STORY_LOAD, swinfo->driver)); |
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
| r253179 | r253180 | |
| 397 | 397 | { |
| 398 | 398 | const game_driver *driver = (const game_driver *)m_event->itemref; |
| 399 | 399 | if ((FPTR)driver > 2) |
| 400 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_SYSINFO_LOAD, driver)); |
| 400 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_SYSINFO_LOAD, driver)); |
| 401 | 401 | } |
| 402 | 402 | else |
| 403 | 403 | { |
| 404 | 404 | ui_software_info *swinfo = (ui_software_info *)m_event->itemref; |
| 405 | 405 | if ((FPTR)swinfo > 2 && swinfo->startempty == 1) |
| 406 | | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, MEWUI_SYSINFO_LOAD, swinfo->driver)); |
| 406 | ui_menu::stack_push(global_alloc_clear<ui_menu_dats>(machine(), container, UI_SYSINFO_LOAD, swinfo->driver)); |
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | |
| r253179 | r253180 | |
| 597 | 597 | // iterate over entries |
| 598 | 598 | for (size_t curitem = 0; curitem < m_displaylist.size(); ++curitem) |
| 599 | 599 | { |
| 600 | | UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; |
| 600 | UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; |
| 601 | 601 | |
| 602 | 602 | if (old_item_selected == -1 && !reselect_last::driver.empty() && m_displaylist[curitem]->name == reselect_last::driver) |
| 603 | 603 | old_item_selected = curitem; |
| r253179 | r253180 | |
| 610 | 610 | cloneof = false; |
| 611 | 611 | } |
| 612 | 612 | if (cloneof) |
| 613 | | flags_mewui |= MENU_FLAG_INVERT; |
| 613 | flags_ui |= MENU_FLAG_INVERT; |
| 614 | 614 | |
| 615 | | item_append(m_displaylist[curitem]->description, nullptr, flags_mewui, (void *)m_displaylist[curitem]); |
| 615 | item_append(m_displaylist[curitem]->description, nullptr, flags_ui, (void *)m_displaylist[curitem]); |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | } |
| r253179 | r253180 | |
| 624 | 624 | // iterate over entries |
| 625 | 625 | for (auto & mfavorite : machine().favorite().m_list) |
| 626 | 626 | { |
| 627 | | UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_MEWUI_FAVORITE; |
| 627 | UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_UI_FAVORITE; |
| 628 | 628 | if (mfavorite.startempty == 1) |
| 629 | 629 | { |
| 630 | 630 | if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) |
| r253179 | r253180 | |
| 638 | 638 | cloneof = false; |
| 639 | 639 | } |
| 640 | 640 | if (cloneof) |
| 641 | | flags_mewui |= MENU_FLAG_INVERT; |
| 641 | flags_ui |= MENU_FLAG_INVERT; |
| 642 | 642 | |
| 643 | | item_append(mfavorite.longname.c_str(), nullptr, flags_mewui, (void *)&mfavorite); |
| 643 | item_append(mfavorite.longname.c_str(), nullptr, flags_ui, (void *)&mfavorite); |
| 644 | 644 | } |
| 645 | 645 | else |
| 646 | 646 | { |
| 647 | 647 | if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) |
| 648 | 648 | old_item_selected = curitem; |
| 649 | 649 | item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(), |
| 650 | | mfavorite.parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), (void *)&mfavorite); |
| 650 | mfavorite.parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)&mfavorite); |
| 651 | 651 | } |
| 652 | 652 | curitem++; |
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // add special items |
| 657 | | item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_MEWUI, nullptr); |
| 658 | | item_append("Configure Options", nullptr, MENU_FLAG_MEWUI, (void *)(FPTR)1); |
| 659 | | item_append("Configure Directories", nullptr, MENU_FLAG_MEWUI, (void *)(FPTR)2); |
| 657 | item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_UI, nullptr); |
| 658 | item_append("Configure Options", nullptr, MENU_FLAG_UI, (void *)(FPTR)1); |
| 659 | item_append("Configure Directories", nullptr, MENU_FLAG_UI, (void *)(FPTR)2); |
| 660 | 660 | |
| 661 | 661 | // configure the custom rendering |
| 662 | 662 | customtop = 3.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; |
| r253179 | r253180 | |
| 1024 | 1024 | |
| 1025 | 1025 | std::vector<s_bios> biosname; |
| 1026 | 1026 | if (!machine().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) |
| 1027 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_bios_selection>(machine(), container, biosname, (void *)driver, false, false)); |
| 1027 | ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)driver, false, false)); |
| 1028 | 1028 | else |
| 1029 | 1029 | { |
| 1030 | 1030 | reselect_last::driver = driver->name; |
| r253179 | r253180 | |
| 1074 | 1074 | { |
| 1075 | 1075 | std::vector<s_bios> biosname; |
| 1076 | 1076 | if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) |
| 1077 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo->driver, false, false)); |
| 1077 | ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo->driver, false, false)); |
| 1078 | 1078 | else |
| 1079 | 1079 | { |
| 1080 | 1080 | reselect_last::driver = ui_swinfo->driver->name; |
| r253179 | r253180 | |
| 1108 | 1108 | std::vector<s_bios> biosname; |
| 1109 | 1109 | if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) |
| 1110 | 1110 | { |
| 1111 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo, true, false)); |
| 1111 | ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo, true, false)); |
| 1112 | 1112 | return; |
| 1113 | 1113 | } |
| 1114 | 1114 | else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) |
| r253179 | r253180 | |
| 1124 | 1124 | parts.emplace(swpart->name(), menu_part_name); |
| 1125 | 1125 | } |
| 1126 | 1126 | } |
| 1127 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_software_parts>(machine(), container, parts, ui_swinfo)); |
| 1127 | ui_menu::stack_push(global_alloc_clear<ui_software_parts>(machine(), container, parts, ui_swinfo)); |
| 1128 | 1128 | return; |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| r253179 | r253180 | |
| 1471 | 1471 | } |
| 1472 | 1472 | |
| 1473 | 1473 | (index < VISIBLE_GAMES_IN_SEARCH) ? m_searchlist[index] = nullptr : m_searchlist[VISIBLE_GAMES_IN_SEARCH] = nullptr; |
| 1474 | | UINT32 flags_mewui = MENU_FLAG_MEWUI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; |
| 1474 | UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; |
| 1475 | 1475 | for (int curitem = 0; m_searchlist[curitem]; ++curitem) |
| 1476 | 1476 | { |
| 1477 | 1477 | bool cloneof = strcmp(m_searchlist[curitem]->parent, "0"); |
| r253179 | r253180 | |
| 1481 | 1481 | if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) |
| 1482 | 1482 | cloneof = false; |
| 1483 | 1483 | } |
| 1484 | | item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), |
| 1484 | item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_ui : (MENU_FLAG_INVERT | flags_ui), |
| 1485 | 1485 | (void *)m_searchlist[curitem]); |
| 1486 | 1486 | } |
| 1487 | 1487 | } |
| r253179 | r253180 | |
| 1569 | 1569 | void ui_menu_select_game::inkey_export() |
| 1570 | 1570 | { |
| 1571 | 1571 | std::string filename("exported"); |
| 1572 | | emu_file infile(machine().options().mewui_path(), OPEN_FLAG_READ); |
| 1572 | emu_file infile(machine().options().ui_path(), OPEN_FLAG_READ); |
| 1573 | 1573 | if (infile.open(filename.c_str(), ".xml") == FILERR_NONE) |
| 1574 | 1574 | for (int seq = 0; ; ++seq) |
| 1575 | 1575 | { |
| r253179 | r253180 | |
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | // attempt to open the output file |
| 1586 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1586 | emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1587 | 1587 | if (file.open(filename.c_str(), ".xml") == FILERR_NONE) |
| 1588 | 1588 | { |
| 1589 | 1589 | FILE *pfile; |
| r253179 | r253180 | |
| 1614 | 1614 | info_xml_creator creator(drivlist); |
| 1615 | 1615 | creator.output(pfile, false); |
| 1616 | 1616 | fclose(pfile); |
| 1617 | | machine().popmessage("%s.xml saved under mewui folder.", filename.c_str()); |
| 1617 | machine().popmessage("%s.xml saved under ui folder.", filename.c_str()); |
| 1618 | 1618 | } |
| 1619 | 1619 | } |
| 1620 | 1620 | |
| r253179 | r253180 | |
| 1625 | 1625 | void ui_menu_select_game::save_cache_info() |
| 1626 | 1626 | { |
| 1627 | 1627 | // attempt to open the output file |
| 1628 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1628 | emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1629 | 1629 | |
| 1630 | 1630 | if (file.open("info_", emulator_info::get_configname(), ".ini") == FILERR_NONE) |
| 1631 | 1631 | { |
| 1632 | 1632 | m_sortedlist.clear(); |
| 1633 | 1633 | |
| 1634 | 1634 | // generate header |
| 1635 | | std::string buffer = std::string("#\n").append(MEWUI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); |
| 1635 | std::string buffer = std::string("#\n").append(UI_VERSION_TAG).append(bare_build_version).append("\n#\n\n"); |
| 1636 | 1636 | |
| 1637 | 1637 | // generate full list |
| 1638 | 1638 | for (int x = 0; x < driver_list::total(); ++x) |
| r253179 | r253180 | |
| 1716 | 1716 | driver_cache.resize(driver_list::total() + 1); |
| 1717 | 1717 | |
| 1718 | 1718 | // try to load driver cache |
| 1719 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); |
| 1719 | emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); |
| 1720 | 1720 | if (file.open("info_", emulator_info::get_configname(), ".ini") != FILERR_NONE) |
| 1721 | 1721 | { |
| 1722 | 1722 | save_cache_info(); |
| r253179 | r253180 | |
| 1728 | 1728 | file.gets(rbuf, MAX_CHAR_INFO); |
| 1729 | 1729 | file.gets(rbuf, MAX_CHAR_INFO); |
| 1730 | 1730 | readbuf = chartrimcarriage(rbuf); |
| 1731 | | std::string a_rev = std::string(MEWUI_VERSION_TAG).append(bare_build_version); |
| 1731 | std::string a_rev = std::string(UI_VERSION_TAG).append(bare_build_version); |
| 1732 | 1732 | |
| 1733 | 1733 | // version not matching ? save and exit |
| 1734 | 1734 | if (a_rev != readbuf) |
| r253179 | r253180 | |
| 1788 | 1788 | bool ui_menu_select_game::load_available_machines() |
| 1789 | 1789 | { |
| 1790 | 1790 | // try to load available drivers from file |
| 1791 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); |
| 1791 | emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); |
| 1792 | 1792 | if (file.open(emulator_info::get_configname(), "_avail.ini") != FILERR_NONE) |
| 1793 | 1793 | return false; |
| 1794 | 1794 | |
| r253179 | r253180 | |
| 1797 | 1797 | file.gets(rbuf, MAX_CHAR_INFO); |
| 1798 | 1798 | file.gets(rbuf, MAX_CHAR_INFO); |
| 1799 | 1799 | readbuf = chartrimcarriage(rbuf); |
| 1800 | | std::string a_rev = std::string(MEWUI_VERSION_TAG).append(bare_build_version); |
| 1800 | std::string a_rev = std::string(UI_VERSION_TAG).append(bare_build_version); |
| 1801 | 1801 | |
| 1802 | 1802 | // version not matching ? exit |
| 1803 | 1803 | if (a_rev != readbuf) |
| r253179 | r253180 | |
| 1840 | 1840 | void ui_menu_select_game::load_custom_filters() |
| 1841 | 1841 | { |
| 1842 | 1842 | // attempt to open the output file |
| 1843 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); |
| 1843 | emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); |
| 1844 | 1844 | if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == FILERR_NONE) |
| 1845 | 1845 | { |
| 1846 | 1846 | char buffer[MAX_CHAR_INFO]; |
| r253179 | r253180 | |
| 2069 | 2069 | float text_size = machine().options().infos_size(); |
| 2070 | 2070 | const game_driver *driver = nullptr; |
| 2071 | 2071 | ui_software_info *soft = nullptr; |
| 2072 | | bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); |
| 2072 | bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); |
| 2073 | 2073 | static ui_software_info *oldsoft = nullptr; |
| 2074 | 2074 | static const game_driver *olddriver = nullptr; |
| 2075 | 2075 | static int oldview = -1; |
| r253179 | r253180 | |
| 2099 | 2099 | float oy1 = origy1 + line_height; |
| 2100 | 2100 | |
| 2101 | 2101 | // MAMESCORE? Full size text |
| 2102 | | if (ui_globals::curdats_view == MEWUI_STORY_LOAD) |
| 2102 | if (ui_globals::curdats_view == UI_STORY_LOAD) |
| 2103 | 2103 | text_size = 1.0f; |
| 2104 | 2104 | |
| 2105 | 2105 | std::string snaptext(dats_info[ui_globals::curdats_view]); |
| r253179 | r253180 | |
| 2108 | 2108 | float title_size = 0.0f; |
| 2109 | 2109 | float txt_lenght = 0.0f; |
| 2110 | 2110 | |
| 2111 | | for (int x = MEWUI_FIRST_LOAD; x < MEWUI_LAST_LOAD; ++x) |
| 2111 | for (int x = UI_FIRST_LOAD; x < UI_LAST_LOAD; ++x) |
| 2112 | 2112 | { |
| 2113 | 2113 | mui.draw_text_full(container, dats_info[x], origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, |
| 2114 | 2114 | WRAP_TRUNCATE, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr); |
| r253179 | r253180 | |
| 2119 | 2119 | mui.draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, |
| 2120 | 2120 | WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 2121 | 2121 | |
| 2122 | | draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, MEWUI_FIRST_LOAD, MEWUI_LAST_LOAD, title_size); |
| 2122 | draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, UI_FIRST_LOAD, UI_LAST_LOAD, title_size); |
| 2123 | 2123 | |
| 2124 | 2124 | if (driver != olddriver || ui_globals::curdats_view != oldview) |
| 2125 | 2125 | { |
| r253179 | r253180 | |
| 2130 | 2130 | totallines = 0; |
| 2131 | 2131 | std::vector<std::string> m_item; |
| 2132 | 2132 | |
| 2133 | | if (ui_globals::curdats_view == MEWUI_GENERAL_LOAD) |
| 2133 | if (ui_globals::curdats_view == UI_GENERAL_LOAD) |
| 2134 | 2134 | general_info(driver, buffer); |
| 2135 | | else if (ui_globals::curdats_view != MEWUI_COMMAND_LOAD) |
| 2135 | else if (ui_globals::curdats_view != UI_COMMAND_LOAD) |
| 2136 | 2136 | machine().datfile().load_data_info(driver, buffer, ui_globals::curdats_view); |
| 2137 | 2137 | else |
| 2138 | 2138 | machine().datfile().command_sub_menu(driver, m_item); |
| 2139 | 2139 | |
| 2140 | | if (!m_item.empty() && ui_globals::curdats_view == MEWUI_COMMAND_LOAD) |
| 2140 | if (!m_item.empty() && ui_globals::curdats_view == UI_COMMAND_LOAD) |
| 2141 | 2141 | { |
| 2142 | 2142 | for (size_t x = 0; x < m_item.size(); ++x) |
| 2143 | 2143 | { |
| r253179 | r253180 | |
| 2157 | 2157 | WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 2158 | 2158 | return; |
| 2159 | 2159 | } |
| 2160 | | else if (ui_globals::curdats_view != MEWUI_STORY_LOAD && ui_globals::curdats_view != MEWUI_COMMAND_LOAD) |
| 2160 | else if (ui_globals::curdats_view != UI_STORY_LOAD && ui_globals::curdats_view != UI_COMMAND_LOAD) |
| 2161 | 2161 | mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); |
| 2162 | 2162 | else |
| 2163 | 2163 | mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), totallines, xstart, xend, text_size); |
| r253179 | r253180 | |
| 2183 | 2183 | else if (r == r_visible_lines - 1 && itemline != totallines - 1) |
| 2184 | 2184 | info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width); |
| 2185 | 2185 | // special case for mamescore |
| 2186 | | else if (ui_globals::curdats_view == MEWUI_STORY_LOAD) |
| 2186 | else if (ui_globals::curdats_view == UI_STORY_LOAD) |
| 2187 | 2187 | { |
| 2188 | 2188 | // check size |
| 2189 | 2189 | float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); |
| r253179 | r253180 | |
| 2213 | 2213 | } |
| 2214 | 2214 | |
| 2215 | 2215 | // special case for command |
| 2216 | | else if (ui_globals::curdats_view == MEWUI_COMMAND_LOAD || ui_globals::curdats_view == MEWUI_GENERAL_LOAD) |
| 2216 | else if (ui_globals::curdats_view == UI_COMMAND_LOAD || ui_globals::curdats_view == UI_GENERAL_LOAD) |
| 2217 | 2217 | { |
| 2218 | 2218 | // check size |
| 2219 | 2219 | float textlen = mui.get_string_width_ex(tempbuf.c_str(), text_size); |
| 2220 | 2220 | float tmp_size = (textlen > sc) ? text_size * (sc / textlen) : text_size; |
| 2221 | 2221 | |
| 2222 | | int first_dspace = (ui_globals::curdats_view == MEWUI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); |
| 2222 | int first_dspace = (ui_globals::curdats_view == UI_COMMAND_LOAD) ? tempbuf.find(" ") : tempbuf.find(":"); |
| 2223 | 2223 | if (first_dspace > 0) |
| 2224 | 2224 | { |
| 2225 | 2225 | float effective_width = origx2 - origx1 - gutter_width; |
| r253179 | r253180 | |
| 2290 | 2290 | if (ui_globals::cur_sw_dats_view == 0) |
| 2291 | 2291 | { |
| 2292 | 2292 | if (soft->startempty == 1) |
| 2293 | | machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); |
| 2293 | machine().datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); |
| 2294 | 2294 | else |
| 2295 | 2295 | machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); |
| 2296 | 2296 | } |
| r253179 | r253180 | |
| 2385 | 2385 | { |
| 2386 | 2386 | ui_manager &mui = machine().ui(); |
| 2387 | 2387 | float line_height = mui.get_line_height(); |
| 2388 | | bool is_favorites = ((item[0].flags & MENU_FLAG_MEWUI_FAVORITE) != 0); |
| 2388 | bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); |
| 2389 | 2389 | static ui_software_info *oldsoft = nullptr; |
| 2390 | 2390 | static const game_driver *olddriver = nullptr; |
| 2391 | 2391 | const game_driver *driver = nullptr; |
trunk/src/emu/ui/selsoft.cpp
| r253179 | r253180 | |
| 4 | 4 | |
| 5 | 5 | ui/selsoft.cpp |
| 6 | 6 | |
| 7 | | MEWUI softwares menu. |
| 7 | UI softwares menu. |
| 8 | 8 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| r253179 | r253180 | |
| 134 | 134 | |
| 135 | 135 | ui_globals::curimage_view = SNAPSHOT_VIEW; |
| 136 | 136 | ui_globals::switch_image = true; |
| 137 | | ui_globals::cur_sw_dats_view = MEWUI_FIRST_LOAD; |
| 137 | ui_globals::cur_sw_dats_view = UI_FIRST_LOAD; |
| 138 | 138 | |
| 139 | 139 | std::string error_string; |
| 140 | 140 | machine.options().set_value(OPTION_SOFTWARENAME, "", OPTION_PRIORITY_CMDLINE, error_string); |
| r253179 | r253180 | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // handle UI_UP_FILTER |
| 225 | | else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > MEWUI_SW_FIRST) |
| 225 | else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > UI_SW_FIRST) |
| 226 | 226 | { |
| 227 | 227 | l_sw_hover = sw_filters::actual - 1; |
| 228 | 228 | check_filter = true; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // handle UI_DOWN_FILTER |
| 232 | | else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < MEWUI_SW_LAST) |
| 232 | else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < UI_SW_LAST) |
| 233 | 233 | { |
| 234 | 234 | l_sw_hover = sw_filters::actual + 1; |
| 235 | 235 | check_filter = true; |
| r253179 | r253180 | |
| 289 | 289 | check_filter = true; |
| 290 | 290 | |
| 291 | 291 | // handle UI_UP_FILTER |
| 292 | | else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > MEWUI_SW_FIRST) |
| 292 | else if (m_event->iptkey == IPT_UI_UP_FILTER && sw_filters::actual > UI_SW_FIRST) |
| 293 | 293 | { |
| 294 | 294 | l_sw_hover = sw_filters::actual - 1; |
| 295 | 295 | check_filter = true; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // handle UI_DOWN_FILTER |
| 299 | | else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < MEWUI_SW_LAST) |
| 299 | else if (m_event->iptkey == IPT_UI_DOWN_FILTER && sw_filters::actual < UI_SW_LAST) |
| 300 | 300 | { |
| 301 | 301 | l_sw_hover = sw_filters::actual + 1; |
| 302 | 302 | check_filter = true; |
| r253179 | r253180 | |
| 317 | 317 | |
| 318 | 318 | switch (l_sw_hover) |
| 319 | 319 | { |
| 320 | | case MEWUI_SW_REGION: |
| 320 | case UI_SW_REGION: |
| 321 | 321 | ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.region.ui, |
| 322 | 322 | m_filter.region.actual, SELECTOR_SOFTWARE, l_sw_hover)); |
| 323 | 323 | break; |
| 324 | | case MEWUI_SW_YEARS: |
| 324 | case UI_SW_YEARS: |
| 325 | 325 | ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.year.ui, |
| 326 | 326 | m_filter.year.actual, SELECTOR_SOFTWARE, l_sw_hover)); |
| 327 | 327 | break; |
| 328 | | case MEWUI_SW_LIST: |
| 328 | case UI_SW_LIST: |
| 329 | 329 | ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.swlist.description, |
| 330 | 330 | m_filter.swlist.actual, SELECTOR_SOFTWARE, l_sw_hover)); |
| 331 | 331 | break; |
| 332 | | case MEWUI_SW_TYPE: |
| 332 | case UI_SW_TYPE: |
| 333 | 333 | ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.type.ui, |
| 334 | 334 | m_filter.type.actual, SELECTOR_SOFTWARE, l_sw_hover)); |
| 335 | 335 | break; |
| 336 | | case MEWUI_SW_PUBLISHERS: |
| 336 | case UI_SW_PUBLISHERS: |
| 337 | 337 | ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.publisher.ui, |
| 338 | 338 | m_filter.publisher.actual, SELECTOR_SOFTWARE, l_sw_hover)); |
| 339 | 339 | break; |
| 340 | | case MEWUI_SW_CUSTOM: |
| 340 | case UI_SW_CUSTOM: |
| 341 | 341 | sw_filters::actual = l_sw_hover; |
| 342 | 342 | ui_menu::stack_push(global_alloc_clear<ui_menu_swcustom_filter>(machine(), container, m_driver, m_filter)); |
| 343 | 343 | break; |
| r253179 | r253180 | |
| 355 | 355 | |
| 356 | 356 | void ui_menu_select_software::populate() |
| 357 | 357 | { |
| 358 | | UINT32 flags_mewui = MENU_FLAG_MEWUI_SWLIST | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; |
| 358 | UINT32 flags_ui = MENU_FLAG_UI_SWLIST | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; |
| 359 | 359 | m_has_empty_start = true; |
| 360 | 360 | int old_software = -1; |
| 361 | 361 | |
| r253179 | r253180 | |
| 374 | 374 | { |
| 375 | 375 | // if the device can be loaded empty, add an item |
| 376 | 376 | if (m_has_empty_start) |
| 377 | | item_append("[Start empty]", nullptr, flags_mewui, (void *)&m_swinfo[0]); |
| 377 | item_append("[Start empty]", nullptr, flags_ui, (void *)&m_swinfo[0]); |
| 378 | 378 | |
| 379 | 379 | m_displaylist.clear(); |
| 380 | 380 | m_tmp.clear(); |
| 381 | 381 | |
| 382 | 382 | switch (sw_filters::actual) |
| 383 | 383 | { |
| 384 | | case MEWUI_SW_PUBLISHERS: |
| 384 | case UI_SW_PUBLISHERS: |
| 385 | 385 | build_list(m_tmp, m_filter.publisher.ui[m_filter.publisher.actual].c_str()); |
| 386 | 386 | break; |
| 387 | 387 | |
| 388 | | case MEWUI_SW_LIST: |
| 388 | case UI_SW_LIST: |
| 389 | 389 | build_list(m_tmp, m_filter.swlist.name[m_filter.swlist.actual].c_str()); |
| 390 | 390 | break; |
| 391 | 391 | |
| 392 | | case MEWUI_SW_YEARS: |
| 392 | case UI_SW_YEARS: |
| 393 | 393 | build_list(m_tmp, m_filter.year.ui[m_filter.year.actual].c_str()); |
| 394 | 394 | break; |
| 395 | 395 | |
| 396 | | case MEWUI_SW_TYPE: |
| 396 | case UI_SW_TYPE: |
| 397 | 397 | build_list(m_tmp, m_filter.type.ui[m_filter.type.actual].c_str()); |
| 398 | 398 | break; |
| 399 | 399 | |
| 400 | | case MEWUI_SW_REGION: |
| 400 | case UI_SW_REGION: |
| 401 | 401 | build_list(m_tmp, m_filter.region.ui[m_filter.region.actual].c_str()); |
| 402 | 402 | break; |
| 403 | 403 | |
| 404 | | case MEWUI_SW_CUSTOM: |
| 404 | case UI_SW_CUSTOM: |
| 405 | 405 | build_custom(); |
| 406 | 406 | break; |
| 407 | 407 | |
| r253179 | r253180 | |
| 421 | 421 | old_software = m_has_empty_start ? curitem + 1 : curitem; |
| 422 | 422 | |
| 423 | 423 | item_append(m_displaylist[curitem]->longname.c_str(), m_displaylist[curitem]->devicetype.c_str(), |
| 424 | | m_displaylist[curitem]->parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), (void *)m_displaylist[curitem]); |
| 424 | m_displaylist[curitem]->parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)m_displaylist[curitem]); |
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | |
| r253179 | r253180 | |
| 431 | 431 | |
| 432 | 432 | for (int curitem = 0; m_searchlist[curitem] != nullptr; ++curitem) |
| 433 | 433 | item_append(m_searchlist[curitem]->longname.c_str(), m_searchlist[curitem]->devicetype.c_str(), |
| 434 | | m_searchlist[curitem]->parentname.empty() ? flags_mewui : (MENU_FLAG_INVERT | flags_mewui), |
| 434 | m_searchlist[curitem]->parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), |
| 435 | 435 | (void *)m_searchlist[curitem]); |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | | item_append(MENU_SEPARATOR_ITEM, nullptr, flags_mewui, nullptr); |
| 438 | item_append(MENU_SEPARATOR_ITEM, nullptr, flags_ui, nullptr); |
| 439 | 439 | |
| 440 | 440 | // configure the custom rendering |
| 441 | 441 | customtop = 4.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; |
| r253179 | r253180 | |
| 614 | 614 | strprintf(tempbuf[0], "MAME %s ( %d / %d softwares )", bare_build_version, vis_item, (int)m_swinfo.size() - 1); |
| 615 | 615 | tempbuf[1].assign("Driver: \"").append(m_driver->description).append("\" software list "); |
| 616 | 616 | |
| 617 | | if (sw_filters::actual == MEWUI_SW_REGION && m_filter.region.ui.size() != 0) |
| 617 | if (sw_filters::actual == UI_SW_REGION && m_filter.region.ui.size() != 0) |
| 618 | 618 | filtered.assign("Region: ").append(m_filter.region.ui[m_filter.region.actual]).append(" - "); |
| 619 | | else if (sw_filters::actual == MEWUI_SW_PUBLISHERS) |
| 619 | else if (sw_filters::actual == UI_SW_PUBLISHERS) |
| 620 | 620 | filtered.assign("Publisher: ").append(m_filter.publisher.ui[m_filter.publisher.actual]).append(" - "); |
| 621 | | else if (sw_filters::actual == MEWUI_SW_YEARS) |
| 621 | else if (sw_filters::actual == UI_SW_YEARS) |
| 622 | 622 | filtered.assign("Year: ").append(m_filter.year.ui[m_filter.year.actual]).append(" - "); |
| 623 | | else if (sw_filters::actual == MEWUI_SW_LIST) |
| 623 | else if (sw_filters::actual == UI_SW_LIST) |
| 624 | 624 | filtered.assign("Software List: ").append(m_filter.swlist.description[m_filter.swlist.actual]).append(" - "); |
| 625 | | else if (sw_filters::actual == MEWUI_SW_TYPE) |
| 625 | else if (sw_filters::actual == UI_SW_TYPE) |
| 626 | 626 | filtered.assign("Device type: ").append(m_filter.type.ui[m_filter.type.actual]).append(" - "); |
| 627 | 627 | |
| 628 | 628 | tempbuf[2].assign(filtered).append("Search: ").append(m_search).append("_"); |
| r253179 | r253180 | |
| 823 | 823 | { |
| 824 | 824 | std::vector<s_bios> biosname; |
| 825 | 825 | if (has_multiple_bios(ui_swinfo->driver, biosname) && !mopt.skip_bios_menu()) |
| 826 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); |
| 826 | ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); |
| 827 | 827 | else |
| 828 | 828 | { |
| 829 | 829 | reselect_last::driver = ui_swinfo->driver->name; |
| r253179 | r253180 | |
| 852 | 852 | std::vector<s_bios> biosname; |
| 853 | 853 | if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) |
| 854 | 854 | { |
| 855 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo, true, false)); |
| 855 | ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo, true, false)); |
| 856 | 856 | return; |
| 857 | 857 | } |
| 858 | 858 | else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) |
| r253179 | r253180 | |
| 868 | 868 | parts.emplace(swpart->name(), menu_part_name); |
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_software_parts>(machine(), container, parts, ui_swinfo)); |
| 871 | ui_menu::stack_push(global_alloc_clear<ui_software_parts>(machine(), container, parts, ui_swinfo)); |
| 872 | 872 | return; |
| 873 | 873 | } |
| 874 | 874 | std::string error_string; |
| r253179 | r253180 | |
| 925 | 925 | void ui_menu_select_software::load_sw_custom_filters() |
| 926 | 926 | { |
| 927 | 927 | // attempt to open the output file |
| 928 | | emu_file file(machine().options().mewui_path(), OPEN_FLAG_READ); |
| 928 | emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); |
| 929 | 929 | if (file.open("custom_", m_driver->name, "_filter.ini") == FILERR_NONE) |
| 930 | 930 | { |
| 931 | 931 | char buffer[MAX_CHAR_INFO]; |
| r253179 | r253180 | |
| 955 | 955 | if (!strncmp(cb, sw_filters::text[y], strlen(sw_filters::text[y]))) |
| 956 | 956 | { |
| 957 | 957 | sw_custfltr::other[x] = y; |
| 958 | | if (y == MEWUI_SW_PUBLISHERS) |
| 958 | if (y == UI_SW_PUBLISHERS) |
| 959 | 959 | { |
| 960 | 960 | file.gets(buffer, MAX_CHAR_INFO); |
| 961 | 961 | char *ab = strchr(buffer, '=') + 2; |
| r253179 | r253180 | |
| 963 | 963 | if (!strncmp(ab, m_filter.publisher.ui[z].c_str(), m_filter.publisher.ui[z].length())) |
| 964 | 964 | sw_custfltr::mnfct[x] = z; |
| 965 | 965 | } |
| 966 | | else if (y == MEWUI_SW_YEARS) |
| 966 | else if (y == UI_SW_YEARS) |
| 967 | 967 | { |
| 968 | 968 | file.gets(buffer, MAX_CHAR_INFO); |
| 969 | 969 | char *db = strchr(buffer, '=') + 2; |
| r253179 | r253180 | |
| 971 | 971 | if (!strncmp(db, m_filter.year.ui[z].c_str(), m_filter.year.ui[z].length())) |
| 972 | 972 | sw_custfltr::year[x] = z; |
| 973 | 973 | } |
| 974 | | else if (y == MEWUI_SW_LIST) |
| 974 | else if (y == UI_SW_LIST) |
| 975 | 975 | { |
| 976 | 976 | file.gets(buffer, MAX_CHAR_INFO); |
| 977 | 977 | char *gb = strchr(buffer, '=') + 2; |
| r253179 | r253180 | |
| 979 | 979 | if (!strncmp(gb, m_filter.swlist.name[z].c_str(), m_filter.swlist.name[z].length())) |
| 980 | 980 | sw_custfltr::list[x] = z; |
| 981 | 981 | } |
| 982 | | else if (y == MEWUI_SW_TYPE) |
| 982 | else if (y == UI_SW_TYPE) |
| 983 | 983 | { |
| 984 | 984 | file.gets(buffer, MAX_CHAR_INFO); |
| 985 | 985 | char *fb = strchr(buffer, '=') + 2; |
| r253179 | r253180 | |
| 987 | 987 | if (!strncmp(fb, m_filter.type.ui[z].c_str(), m_filter.type.ui[z].length())) |
| 988 | 988 | sw_custfltr::type[x] = z; |
| 989 | 989 | } |
| 990 | | else if (y == MEWUI_SW_REGION) |
| 990 | else if (y == UI_SW_REGION) |
| 991 | 991 | { |
| 992 | 992 | file.gets(buffer, MAX_CHAR_INFO); |
| 993 | 993 | char *eb = strchr(buffer, '=') + 2; |
| r253179 | r253180 | |
| 1097 | 1097 | { |
| 1098 | 1098 | switch (filter) |
| 1099 | 1099 | { |
| 1100 | | case MEWUI_SW_PARENTS: |
| 1100 | case UI_SW_PARENTS: |
| 1101 | 1101 | if (s_driver->parentname.empty()) |
| 1102 | 1102 | m_displaylist.push_back(s_driver); |
| 1103 | 1103 | break; |
| 1104 | 1104 | |
| 1105 | | case MEWUI_SW_CLONES: |
| 1105 | case UI_SW_CLONES: |
| 1106 | 1106 | if (!s_driver->parentname.empty()) |
| 1107 | 1107 | m_displaylist.push_back(s_driver); |
| 1108 | 1108 | break; |
| 1109 | 1109 | |
| 1110 | | case MEWUI_SW_AVAILABLE: |
| 1110 | case UI_SW_AVAILABLE: |
| 1111 | 1111 | if (s_driver->available) |
| 1112 | 1112 | m_displaylist.push_back(s_driver); |
| 1113 | 1113 | break; |
| 1114 | 1114 | |
| 1115 | | case MEWUI_SW_UNAVAILABLE: |
| 1115 | case UI_SW_UNAVAILABLE: |
| 1116 | 1116 | if (!s_driver->available) |
| 1117 | 1117 | m_displaylist.push_back(s_driver); |
| 1118 | 1118 | break; |
| 1119 | 1119 | |
| 1120 | | case MEWUI_SW_SUPPORTED: |
| 1120 | case UI_SW_SUPPORTED: |
| 1121 | 1121 | if (s_driver->supported == SOFTWARE_SUPPORTED_YES) |
| 1122 | 1122 | m_displaylist.push_back(s_driver); |
| 1123 | 1123 | break; |
| 1124 | 1124 | |
| 1125 | | case MEWUI_SW_PARTIAL_SUPPORTED: |
| 1125 | case UI_SW_PARTIAL_SUPPORTED: |
| 1126 | 1126 | if (s_driver->supported == SOFTWARE_SUPPORTED_PARTIAL) |
| 1127 | 1127 | m_displaylist.push_back(s_driver); |
| 1128 | 1128 | break; |
| 1129 | 1129 | |
| 1130 | | case MEWUI_SW_UNSUPPORTED: |
| 1130 | case UI_SW_UNSUPPORTED: |
| 1131 | 1131 | if (s_driver->supported == SOFTWARE_SUPPORTED_NO) |
| 1132 | 1132 | m_displaylist.push_back(s_driver); |
| 1133 | 1133 | break; |
| 1134 | 1134 | |
| 1135 | | case MEWUI_SW_REGION: |
| 1135 | case UI_SW_REGION: |
| 1136 | 1136 | { |
| 1137 | 1137 | std::string name = m_filter.region.getname(s_driver->longname); |
| 1138 | 1138 | |
| r253179 | r253180 | |
| 1141 | 1141 | break; |
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | | case MEWUI_SW_PUBLISHERS: |
| 1144 | case UI_SW_PUBLISHERS: |
| 1145 | 1145 | { |
| 1146 | 1146 | std::string name = m_filter.publisher.getname(s_driver->publisher); |
| 1147 | 1147 | |
| r253179 | r253180 | |
| 1150 | 1150 | break; |
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | | case MEWUI_SW_YEARS: |
| 1153 | case UI_SW_YEARS: |
| 1154 | 1154 | if(s_driver->year == filter_text) |
| 1155 | 1155 | m_displaylist.push_back(s_driver); |
| 1156 | 1156 | break; |
| 1157 | 1157 | |
| 1158 | | case MEWUI_SW_LIST: |
| 1158 | case UI_SW_LIST: |
| 1159 | 1159 | if(s_driver->listname == filter_text) |
| 1160 | 1160 | m_displaylist.push_back(s_driver); |
| 1161 | 1161 | break; |
| 1162 | 1162 | |
| 1163 | | case MEWUI_SW_TYPE: |
| 1163 | case UI_SW_TYPE: |
| 1164 | 1164 | if(s_driver->devicetype == filter_text) |
| 1165 | 1165 | m_displaylist.push_back(s_driver); |
| 1166 | 1166 | break; |
| r253179 | r253180 | |
| 1228 | 1228 | |
| 1229 | 1229 | switch (filter) |
| 1230 | 1230 | { |
| 1231 | | case MEWUI_SW_YEARS: |
| 1231 | case UI_SW_YEARS: |
| 1232 | 1232 | build_list(s_drivers, m_filter.year.ui[sw_custfltr::year[count]].c_str(), filter); |
| 1233 | 1233 | break; |
| 1234 | | case MEWUI_SW_LIST: |
| 1234 | case UI_SW_LIST: |
| 1235 | 1235 | build_list(s_drivers, m_filter.swlist.name[sw_custfltr::list[count]].c_str(), filter); |
| 1236 | 1236 | break; |
| 1237 | | case MEWUI_SW_TYPE: |
| 1237 | case UI_SW_TYPE: |
| 1238 | 1238 | build_list(s_drivers, m_filter.type.ui[sw_custfltr::type[count]].c_str(), filter); |
| 1239 | 1239 | break; |
| 1240 | | case MEWUI_SW_PUBLISHERS: |
| 1240 | case UI_SW_PUBLISHERS: |
| 1241 | 1241 | build_list(s_drivers, m_filter.publisher.ui[sw_custfltr::mnfct[count]].c_str(), filter); |
| 1242 | 1242 | break; |
| 1243 | | case MEWUI_SW_REGION: |
| 1243 | case UI_SW_REGION: |
| 1244 | 1244 | build_list(s_drivers, m_filter.region.ui[sw_custfltr::region[count]].c_str(), filter); |
| 1245 | 1245 | break; |
| 1246 | 1246 | default: |
| r253179 | r253180 | |
| 1326 | 1326 | container->add_rect(x1, y1, x2, y1 + line_height, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); |
| 1327 | 1327 | |
| 1328 | 1328 | float x1t = x1 + text_sign; |
| 1329 | | if (afilter == MEWUI_SW_CUSTOM) |
| 1329 | if (afilter == UI_SW_CUSTOM) |
| 1330 | 1330 | { |
| 1331 | 1331 | if (filter == sw_custfltr::main) |
| 1332 | 1332 | { |
| r253179 | r253180 | |
| 1464 | 1464 | if (ui_globals::cur_sw_dats_view == 0) |
| 1465 | 1465 | { |
| 1466 | 1466 | if (soft->startempty == 1) |
| 1467 | | machine().datfile().load_data_info(soft->driver, buffer, MEWUI_HISTORY_LOAD); |
| 1467 | machine().datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); |
| 1468 | 1468 | else |
| 1469 | 1469 | machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); |
| 1470 | 1470 | } |
| r253179 | r253180 | |
| 1746 | 1746 | // ctor |
| 1747 | 1747 | //------------------------------------------------- |
| 1748 | 1748 | |
| 1749 | | ui_mewui_software_parts::ui_mewui_software_parts(running_machine &machine, render_container *container, std::unordered_map<std::string, std::string> parts, ui_software_info *ui_info) : ui_menu(machine, container) |
| 1749 | ui_software_parts::ui_software_parts(running_machine &machine, render_container *container, std::unordered_map<std::string, std::string> parts, ui_software_info *ui_info) : ui_menu(machine, container) |
| 1750 | 1750 | { |
| 1751 | 1751 | m_parts = parts; |
| 1752 | 1752 | m_uiinfo = ui_info; |
| r253179 | r253180 | |
| 1756 | 1756 | // dtor |
| 1757 | 1757 | //------------------------------------------------- |
| 1758 | 1758 | |
| 1759 | | ui_mewui_software_parts::~ui_mewui_software_parts() |
| 1759 | ui_software_parts::~ui_software_parts() |
| 1760 | 1760 | { |
| 1761 | 1761 | } |
| 1762 | 1762 | |
| r253179 | r253180 | |
| 1764 | 1764 | // populate |
| 1765 | 1765 | //------------------------------------------------- |
| 1766 | 1766 | |
| 1767 | | void ui_mewui_software_parts::populate() |
| 1767 | void ui_software_parts::populate() |
| 1768 | 1768 | { |
| 1769 | 1769 | for (auto & elem : m_parts) |
| 1770 | 1770 | item_append(elem.first.c_str(), elem.second.c_str(), 0, (void *)&elem); |
| r253179 | r253180 | |
| 1777 | 1777 | // handle |
| 1778 | 1778 | //------------------------------------------------- |
| 1779 | 1779 | |
| 1780 | | void ui_mewui_software_parts::handle() |
| 1780 | void ui_software_parts::handle() |
| 1781 | 1781 | { |
| 1782 | 1782 | // process the menu |
| 1783 | 1783 | const ui_menu_event *event = process(0); |
| r253179 | r253180 | |
| 1807 | 1807 | // perform our special rendering |
| 1808 | 1808 | //------------------------------------------------- |
| 1809 | 1809 | |
| 1810 | | void ui_mewui_software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 1810 | void ui_software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 1811 | 1811 | { |
| 1812 | 1812 | float width; |
| 1813 | 1813 | ui_manager &mui = machine().ui(); |
| r253179 | r253180 | |
| 1839 | 1839 | // ctor |
| 1840 | 1840 | //------------------------------------------------- |
| 1841 | 1841 | |
| 1842 | | ui_mewui_bios_selection::ui_mewui_bios_selection(running_machine &machine, render_container *container, std::vector<s_bios> biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container) |
| 1842 | ui_bios_selection::ui_bios_selection(running_machine &machine, render_container *container, std::vector<s_bios> biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container) |
| 1843 | 1843 | { |
| 1844 | 1844 | m_bios = biosname; |
| 1845 | 1845 | m_driver = _driver; |
| r253179 | r253180 | |
| 1851 | 1851 | // dtor |
| 1852 | 1852 | //------------------------------------------------- |
| 1853 | 1853 | |
| 1854 | | ui_mewui_bios_selection::~ui_mewui_bios_selection() |
| 1854 | ui_bios_selection::~ui_bios_selection() |
| 1855 | 1855 | { |
| 1856 | 1856 | } |
| 1857 | 1857 | |
| r253179 | r253180 | |
| 1859 | 1859 | // populate |
| 1860 | 1860 | //------------------------------------------------- |
| 1861 | 1861 | |
| 1862 | | void ui_mewui_bios_selection::populate() |
| 1862 | void ui_bios_selection::populate() |
| 1863 | 1863 | { |
| 1864 | 1864 | for (auto & elem : m_bios) |
| 1865 | 1865 | item_append(elem.name.c_str(), nullptr, 0, (void *)&elem.name); |
| r253179 | r253180 | |
| 1872 | 1872 | // handle |
| 1873 | 1873 | //------------------------------------------------- |
| 1874 | 1874 | |
| 1875 | | void ui_mewui_bios_selection::handle() |
| 1875 | void ui_bios_selection::handle() |
| 1876 | 1876 | { |
| 1877 | 1877 | // process the menu |
| 1878 | 1878 | const ui_menu_event *event = process(0); |
| r253179 | r253180 | |
| 1922 | 1922 | parts.emplace(swpart->name(), menu_part_name); |
| 1923 | 1923 | } |
| 1924 | 1924 | } |
| 1925 | | ui_menu::stack_push(global_alloc_clear<ui_mewui_software_parts>(machine(), container, parts, ui_swinfo)); |
| 1925 | ui_menu::stack_push(global_alloc_clear<ui_software_parts>(machine(), container, parts, ui_swinfo)); |
| 1926 | 1926 | return; |
| 1927 | 1927 | } |
| 1928 | 1928 | std::string error_string; |
| r253179 | r253180 | |
| 1945 | 1945 | // perform our special rendering |
| 1946 | 1946 | //------------------------------------------------- |
| 1947 | 1947 | |
| 1948 | | void ui_mewui_bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 1948 | void ui_bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 1949 | 1949 | { |
| 1950 | 1950 | float width; |
| 1951 | 1951 | ui_manager &mui = machine().ui(); |