diff --git a/src/emu/ui/datfile.cpp b/src/emu/ui/datfile.cpp index 799cdaf3823..08415084cf9 100644 --- a/src/emu/ui/datfile.cpp +++ b/src/emu/ui/datfile.cpp @@ -31,6 +31,7 @@ static std::string TAG_MESSINFO_R("# MESSINFO.DAT"); static std::string TAG_SYSINFO_R("# This file was generated on"); static std::string TAG_STORY_R("# version"); static std::string TAG_COMMAND_SEPARATOR("-----------------------------------------------"); +static std::string TAG_GAMEINIT_R("# GAMEINIT.DAT"); //------------------------------------------------- // Statics @@ -41,6 +42,7 @@ datfile_manager::dataindex datfile_manager::m_messidx; datfile_manager::dataindex datfile_manager::m_cmdidx; datfile_manager::dataindex datfile_manager::m_sysidx; datfile_manager::dataindex datfile_manager::m_storyidx; +datfile_manager::dataindex datfile_manager::m_ginitidx; datfile_manager::drvindex datfile_manager::m_drvidx; datfile_manager::drvindex datfile_manager::m_messdrvidx; datfile_manager::drvindex datfile_manager::m_menuidx; @@ -50,6 +52,7 @@ std::string datfile_manager::m_mame_rev; std::string datfile_manager::m_mess_rev; std::string datfile_manager::m_sysinfo_rev; std::string datfile_manager::m_story_rev; +std::string datfile_manager::m_ginit_rev; bool datfile_manager::first_run = true; //------------------------------------------------- @@ -95,6 +98,12 @@ datfile_manager::datfile_manager(running_machine &machine) : m_machine(machine) init_history(); parseclose(); } + + if (parseopen("gameinit.dat")) + { + init_gameinit(); + parseclose(); + } } } @@ -131,6 +140,18 @@ void datfile_manager::init_history() osd_printf_verbose("Rev = %s\n", m_history_rev.c_str()); } +//------------------------------------------------- +// initialize gameinit.dat index +//------------------------------------------------- +void datfile_manager::init_gameinit() +{ + int swcount = 0; + drvindex tmp; + int count = index_mame_mess_info(m_ginitidx, tmp, swcount); + osd_printf_verbose("Gameinit.dat games found = %i\n", count); + osd_printf_verbose("Rev = %s\n", m_ginit_rev.c_str()); +} + //------------------------------------------------- // initialize mameinfo.dat index //------------------------------------------------- @@ -250,6 +271,11 @@ void datfile_manager::load_data_info(const game_driver *drv, std::string &buffer tag = TAG_STORY; index_idx = m_storyidx; break; + case UI_GINIT_LOAD: + filename = "gameinit.dat"; + tag = TAG_MAME; + index_idx = m_ginitidx; + break; } if (parseopen(filename.c_str())) @@ -261,7 +287,7 @@ void datfile_manager::load_data_info(const game_driver *drv, std::string &buffer load_driver_text(drv, buffer, driver_idx, TAG_DRIVER); // cleanup mameinfo and sysinfo double line spacing - if (tag == TAG_MAME || type == UI_SYSINFO_LOAD) + if ((tag == TAG_MAME && type != UI_GINIT_LOAD) || type == UI_SYSINFO_LOAD) strreplace(buffer, "\n\n", "\n"); parseclose(); @@ -354,6 +380,7 @@ int datfile_manager::index_mame_mess_info(dataindex &index, drvindex &index_drv, size_t foundtag; size_t t_mame = TAG_MAMEINFO_R.size(); size_t t_mess = TAG_MESSINFO_R.size(); + size_t t_ginit = TAG_GAMEINIT_R.size(); size_t t_info = TAG_INFO.size(); char rbuf[64 * 1024]; @@ -371,6 +398,11 @@ int datfile_manager::index_mame_mess_info(dataindex &index, drvindex &index_drv, size_t found = readbuf.find(" ", foundtag + t_mess + 1); m_mess_rev = readbuf.substr(foundtag + t_mess + 1, found - t_mess - foundtag); } + else if (m_ginit_rev.empty() && readbuf.compare(0, t_ginit, TAG_GAMEINIT_R) == 0) + { + size_t found = readbuf.find(" ", t_ginit + 1); + m_ginit_rev = readbuf.substr(t_ginit + 1, found - t_ginit); + } else if (readbuf.compare(0, t_info, TAG_INFO) == 0) { // TAG_INFO @@ -423,8 +455,6 @@ int datfile_manager::index_datafile(dataindex &index, int &swcount) } else if (m_story_rev.empty() && readbuf.compare(0, t_story, TAG_STORY_R) == 0) m_story_rev = readbuf.substr(t_story + 1); - - // TAG_INFO identifies the driver else if (readbuf.compare(0, t_info, TAG_INFO) == 0) { int curpoint = t_info + 1; diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h index fa5f527a635..27bb8094704 100644 --- a/src/emu/ui/datfile.h +++ b/src/emu/ui/datfile.h @@ -37,6 +37,7 @@ public: std::string rev_messinfo() const { return m_mess_rev; } std::string rev_sysinfo() const { return m_sysinfo_rev; } std::string rev_storyinfo() const { return m_story_rev; } + std::string rev_ginitinfo() const { return m_ginit_rev; } bool has_history(const game_driver *driver) { return (m_histidx.find(driver) != m_histidx.end()); } bool has_mameinfo(const game_driver *driver) { return (m_mameidx.find(driver) != m_mameidx.end()); } @@ -44,12 +45,13 @@ public: bool has_command(const game_driver *driver) { return (m_cmdidx.find(driver) != m_cmdidx.end()); } bool has_sysinfo(const game_driver *driver) { return (m_sysidx.find(driver) != m_sysidx.end()); } bool has_story(const game_driver *driver) { return (m_storyidx.find(driver) != m_storyidx.end()); } + bool has_gameinit(const game_driver *driver) { return (m_ginitidx.find(driver) != m_ginitidx.end()); } bool has_software(std::string &softlist, std::string &softname, std::string &parentname); bool has_data(const game_driver *a = nullptr) { const game_driver *d = (a != nullptr) ? a : &machine().system(); - return (has_history(d) || has_mameinfo(d) || has_messinfo(d) || has_command(d) || has_sysinfo(d) || has_story(d)); + return (has_history(d) || has_mameinfo(d) || has_messinfo(d) || has_command(d) || has_sysinfo(d) || has_story(d) || has_gameinit(d)); } private: using drvindex = std::unordered_map; @@ -57,7 +59,7 @@ private: using swindex = std::unordered_map; // global index - static dataindex m_histidx, m_mameidx, m_messidx, m_cmdidx, m_sysidx, m_storyidx; + static dataindex m_histidx, m_mameidx, m_messidx, m_cmdidx, m_sysidx, m_storyidx, m_ginitidx; static drvindex m_drvidx, m_messdrvidx, m_menuidx; static swindex m_swindex; @@ -68,6 +70,7 @@ private: void init_command(); void init_sysinfo(); void init_storyinfo(); + void init_gameinit(); // file open/close/seek bool parseopen(const char *filename); @@ -84,7 +87,7 @@ private: // internal state running_machine &m_machine; // reference to our machine std::string m_fullpath; - static std::string m_history_rev, m_mame_rev, m_mess_rev, m_sysinfo_rev, m_story_rev; + static std::string m_history_rev, m_mame_rev, m_mess_rev, m_sysinfo_rev, m_story_rev, m_ginit_rev; FILE *fp = nullptr; static bool first_run; }; diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index c623c8d1f2c..3a39ecf3254 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -290,6 +290,8 @@ void ui_menu_dats_view::init_items() m_items_list.emplace_back(_("Sysinfo"), UI_SYSINFO_LOAD, datfile.rev_sysinfo()); if (datfile.has_story(m_driver)) m_items_list.emplace_back(_("Mamescore"), UI_STORY_LOAD, datfile.rev_storyinfo()); + if (datfile.has_gameinit(m_driver)) + m_items_list.emplace_back(_("Gameinit"), UI_GINIT_LOAD, datfile.rev_ginitinfo()); if (datfile.has_command(m_driver)) m_items_list.emplace_back(_("Command"), UI_COMMAND_LOAD, ""); } diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 5adb32543dd..00a9013f544 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -2137,8 +2137,7 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) mui.draw_textured_box(container, x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); } - - if (bgcolor == UI_MOUSEOVER_BG_COLOR) + else if (bgcolor == UI_MOUSEOVER_BG_COLOR) container->add_rect(x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); @@ -2159,13 +2158,13 @@ std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2 ui_manager &mui = machine().ui(); float line_height = mui.get_line_height(); std::string snaptext, searchstr; - get_title_search(snaptext, searchstr); - float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; - - // apply title to right panel float title_size = 0.0f; float txt_lenght = 0.0f; + float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; + get_title_search(snaptext, searchstr); + + // apply title to right panel for (int x = FIRST_VIEW; x < LAST_VIEW; x++) { mui.draw_text_full(container, _(arts_info[x].title), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, @@ -2174,14 +2173,8 @@ std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2 title_size = MAX(txt_lenght, title_size); } - rgb_t fgcolor = UI_TEXT_COLOR; - rgb_t bgcolor = UI_TEXT_BG_COLOR; - if (m_focus == focused_menu::rightbottom) - { - fgcolor = rgb_t(0xff, 0xff, 0xff, 0x00); - bgcolor = rgb_t(0xff, 0xff, 0xff, 0xff); - } - + rgb_t fgcolor = (m_focus == focused_menu::rightbottom) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR; + rgb_t bgcolor = (m_focus == focused_menu::rightbottom) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; float middle = origx2 - origx1; // check size @@ -2233,11 +2226,15 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software int m_valid = 0; for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) + { if (t_bitmap[x]->valid()) + { m_valid++; + } + } float space_x = (y2 - y1) * container->manager().ui_aspect(); - float total = (m_valid * space_x) + ((m_valid - 1) * 0.01f); + float total = (m_valid * space_x) + ((m_valid - 1) * 0.001f); x1 = ((x2 - x1) * 0.5f) - (total / 2); x2 = x1 + space_x; @@ -2255,7 +2252,7 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software } container->add_quad(x1, y1, x2, y2, color, t_texture[z], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); - x1 += space_x + ((z < UI_TOOLBAR_BUTTONS - 1) ? 0.01f : 0.0f); + x1 += space_x + ((z < UI_TOOLBAR_BUTTONS - 1) ? 0.001f : 0.0f); x2 = x1 + space_x; } } @@ -2288,13 +2285,11 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float int screen_width = machine().render().ui_target().width(); int screen_height = machine().render().ui_target().height(); - int rot = machine().render().ui_target().orientation(); - if (rot == ROT90 || rot == ROT270) + if (machine().render().ui_target().orientation() & ORIENTATION_SWAP_XY) std::swap(screen_height, screen_width); int panel_width_pixel = panel_width * screen_width; int panel_height_pixel = panel_height * screen_height; - float ratio = 0.0f; // Calculate resize ratios for resizing float ratioW = (float)panel_width_pixel / tmp_bitmap->width(); @@ -2309,7 +2304,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float // smaller ratio will ensure that the image fits in the view dest_yPixel = tmp_bitmap->width() * 0.75f; ratioH = (float)panel_height_pixel / dest_yPixel; - ratio = MIN(ratioW, ratioH); + float ratio = MIN(ratioW, ratioH); dest_xPixel = tmp_bitmap->width() * ratio; dest_yPixel *= ratio; } @@ -2317,7 +2312,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float else if (ratioW < 1 || ratioH < 1 || (machine().ui().options().enlarge_snaps() && !no_available)) { // smaller ratio will ensure that the image fits in the view - ratio = MIN(ratioW, ratioH); + float ratio = MIN(ratioW, ratioH); dest_xPixel = tmp_bitmap->width() * ratio; dest_yPixel = tmp_bitmap->height() * ratio; } @@ -2455,8 +2450,7 @@ void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) int screen_width = machine().render().ui_target().width(); int screen_height = machine().render().ui_target().height(); - int rot = machine().render().ui_target().orientation(); - if (rot == ROT90 || rot == ROT270) + if (machine().render().ui_target().orientation() & ORIENTATION_SWAP_XY) std::swap(screen_height, screen_width); int panel_width_pixel = panel_width * screen_width; @@ -2500,12 +2494,9 @@ void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) icons_texture[linenum]->set_bitmap(*icons_bitmap[linenum], icons_bitmap[linenum]->cliprect(), TEXFORMAT_ARGB32); } - else { - if (icons_bitmap[linenum] != nullptr) - { - icons_bitmap[linenum]->reset(); - } - } + else if (icons_bitmap[linenum] != nullptr) + icons_bitmap[linenum]->reset(); + auto_free(machine(), tmp); } diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index d7b6c5ad961..349c59a605c 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -40,7 +40,8 @@ static const char *dats_info[] = { __("Mameinfo"), __("Sysinfo"), __("Messinfo"), - __("Command"), + __("Command"), + __("Gameinit"), __("Mamescore") }; std::vector ui_menu_select_game::m_sortedlist; @@ -582,9 +583,9 @@ void ui_menu_select_game::populate() { UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; item_append(_("Configure Options"), nullptr, flags_ui, (void *)(FPTR)CONF_OPTS); - item_append(_("Configure Machine"), nullptr, flags_ui, (void *)(FPTR)CONF_MACHINE); +// item_append(_("Configure Machine"), nullptr, flags_ui, (void *)(FPTR)CONF_MACHINE); TODO item_append(_("Plugins"), nullptr, flags_ui, (void *)(FPTR)CONF_PLUGINS); - skip_main_items = 3; + skip_main_items = 2; } else skip_main_items = 0; @@ -1004,14 +1005,14 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) // special case for configure options if ((FPTR)driver == CONF_OPTS) ui_menu::stack_push(global_alloc_clear(machine(), container)); - // special case for configure machine + /* special case for configure machine TODO else if ((FPTR)driver == CONF_MACHINE) { if (m_prev_selected != nullptr) ui_menu::stack_push(global_alloc_clear(machine(), container, (const game_driver *)m_prev_selected)); else return; - } + } */ // special case for configure plugins else if ((FPTR)driver == CONF_PLUGINS) { @@ -1074,7 +1075,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) // special case for configure options if ((FPTR)ui_swinfo == CONF_OPTS) ui_menu::stack_push(global_alloc_clear(machine(), container)); - // special case for configure machine + /* special case for configure machine TODO else if ((FPTR)ui_swinfo == CONF_MACHINE) { if (m_prev_selected != nullptr) @@ -1085,7 +1086,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) } else return; - } + } */ // special case for configure plugins else if ((FPTR)ui_swinfo == CONF_PLUGINS) { diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index dd302ebf8bc..b0eff04a609 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -40,7 +40,7 @@ private: enum { CONF_OPTS = 1, - CONF_MACHINE, +// CONF_MACHINE, CONF_PLUGINS, }; diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index d6087131285..a8737fb2e6b 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -95,6 +95,7 @@ enum UI_SYSINFO_LOAD, UI_MESSINFO_LOAD, UI_COMMAND_LOAD, + UI_GINIT_LOAD, UI_STORY_LOAD, UI_LAST_LOAD = UI_STORY_LOAD };