trunk/src/emu/emuopts.h
| r253196 | r253197 | |
| 13 | 13 | #ifndef __EMUOPTS_H__ |
| 14 | 14 | #define __EMUOPTS_H__ |
| 15 | 15 | |
| 16 | | #include "ui/moptions.h" |
| 16 | #include "options.h" |
| 17 | 17 | |
| 18 | | |
| 19 | 18 | //************************************************************************** |
| 20 | 19 | // CONSTANTS |
| 21 | 20 | //************************************************************************** |
| r253196 | r253197 | |
| 27 | 26 | OPTION_PRIORITY_CMDLINE = OPTION_PRIORITY_HIGH, |
| 28 | 27 | |
| 29 | 28 | // INI-based options are NORMAL priority, in increasing order: |
| 30 | | OPTION_PRIORITY_MAME_INI = OPTION_PRIORITY_NORMAL, |
| 29 | OPTION_PRIORITY_INI = OPTION_PRIORITY_NORMAL, |
| 30 | OPTION_PRIORITY_MAME_INI, |
| 31 | 31 | OPTION_PRIORITY_DEBUG_INI, |
| 32 | 32 | OPTION_PRIORITY_ORIENTATION_INI, |
| 33 | 33 | OPTION_PRIORITY_SYSTYPE_INI, |
| r253196 | r253197 | |
| 35 | 35 | OPTION_PRIORITY_SOURCE_INI, |
| 36 | 36 | OPTION_PRIORITY_GPARENT_INI, |
| 37 | 37 | OPTION_PRIORITY_PARENT_INI, |
| 38 | | OPTION_PRIORITY_DRIVER_INI, |
| 39 | | OPTION_PRIORITY_INI |
| 38 | OPTION_PRIORITY_DRIVER_INI |
| 40 | 39 | }; |
| 41 | 40 | |
| 42 | 41 | // core options |
| r253196 | r253197 | |
| 202 | 201 | class software_part; |
| 203 | 202 | |
| 204 | 203 | |
| 205 | | class emu_options : public ui_options |
| 204 | class emu_options : public core_options |
| 206 | 205 | { |
| 207 | 206 | static const UINT32 OPTION_FLAG_DEVICE = 0x80000000; |
| 208 | 207 | |
trunk/src/emu/ui/custui.cpp
| r253196 | r253197 | |
| 140 | 140 | |
| 141 | 141 | ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 142 | 142 | { |
| 143 | | emu_options &moptions = machine.options(); |
| 143 | ui_options &moptions = machine.ui().options(); |
| 144 | 144 | #ifdef UI_WINDOWS |
| 145 | 145 | |
| 146 | | std::string name(moptions.ui_font()); |
| 146 | std::string name(machine.options().ui_font()); |
| 147 | 147 | list(); |
| 148 | 148 | |
| 149 | 149 | m_bold = (strreplace(name, "[B]", "") + strreplace(name, "[b]", "") > 0); |
| r253196 | r253197 | |
| 163 | 163 | m_info_size = moptions.infos_size(); |
| 164 | 164 | m_font_size = moptions.font_rows(); |
| 165 | 165 | |
| 166 | | for (emu_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next()) |
| 166 | for (ui_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next()) |
| 167 | 167 | { |
| 168 | 168 | const char *name = f_entry->name(); |
| 169 | 169 | if (name && strlen(name) && !strcmp(OPTION_INFOS_SIZE, f_entry->name())) |
| r253196 | r253197 | |
| 225 | 225 | ui_menu_font_ui::~ui_menu_font_ui() |
| 226 | 226 | { |
| 227 | 227 | std::string error_string; |
| 228 | | emu_options &moptions = machine().options(); |
| 228 | ui_options &moptions = machine().ui().options(); |
| 229 | 229 | |
| 230 | 230 | #ifdef UI_WINDOWS |
| 231 | 231 | std::string name(m_fonts[m_actual]); |
| r253196 | r253197 | |
| 655 | 655 | |
| 656 | 656 | void ui_menu_colors_ui::restore_colors() |
| 657 | 657 | { |
| 658 | | emu_options options; |
| 658 | ui_options options; |
| 659 | 659 | for (int index = 1; index < MUI_RESTORE; index++) |
| 660 | 660 | m_color_table[index].color = rgb_t((UINT32)strtoul(options.value(m_color_table[index].option), nullptr, 16)); |
| 661 | 661 | } |
trunk/src/emu/ui/inifile.cpp
| r253196 | r253197 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | #include "emu.h" |
| 12 | #include "ui/ui.h" |
| 12 | 13 | #include "ui/inifile.h" |
| 13 | 14 | #include "softlist.h" |
| 14 | 15 | #include "drivenum.h" |
| r253196 | r253197 | |
| 38 | 39 | void inifile_manager::directory_scan() |
| 39 | 40 | { |
| 40 | 41 | // open extra INIs folder |
| 41 | | file_enumerator path(machine().options().extraini_path()); |
| 42 | file_enumerator path(machine().ui().options().extraini_path()); |
| 42 | 43 | const osd_directory_entry *dir; |
| 43 | 44 | |
| 44 | 45 | // loop into folder's file |
| r253196 | r253197 | |
| 149 | 150 | // MAME core file parsing functions fail in recognizing UNICODE chars in UTF-8 without BOM, |
| 150 | 151 | // so it's better and faster use standard C fileio functions. |
| 151 | 152 | |
| 152 | | emu_file file(machine().options().extraini_path(), OPEN_FLAG_READ); |
| 153 | emu_file file(machine().ui().options().extraini_path(), OPEN_FLAG_READ); |
| 153 | 154 | if (file.open(filename) != FILERR_NONE) |
| 154 | 155 | return false; |
| 155 | 156 | |
| r253196 | r253197 | |
| 357 | 358 | |
| 358 | 359 | void favorite_manager::parse_favorite() |
| 359 | 360 | { |
| 360 | | emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); |
| 361 | emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); |
| 361 | 362 | if (file.open(favorite_filename) == FILERR_NONE) |
| 362 | 363 | { |
| 363 | 364 | char readbuf[1024]; |
| r253196 | r253197 | |
| 416 | 417 | void favorite_manager::save_favorite_games() |
| 417 | 418 | { |
| 418 | 419 | // attempt to open the output file |
| 419 | | emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 420 | emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 420 | 421 | if (file.open(favorite_filename) == FILERR_NONE) |
| 421 | 422 | { |
| 422 | 423 | if (m_list.empty()) |
trunk/src/emu/ui/mainmenu.cpp
| r253196 | r253197 | |
| 137 | 137 | item_append("Cheat", nullptr, 0, (void *)CHEAT); |
| 138 | 138 | |
| 139 | 139 | /* add history menu */ |
| 140 | | if (machine().options().enabled_dats()) |
| 140 | if (machine().ui().options().enabled_dats()) |
| 141 | 141 | item_append("History Info", nullptr, 0, (void *)HISTORY); |
| 142 | 142 | |
| 143 | 143 | // add software history menu |
| 144 | | if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().options().enabled_dats()) |
| 144 | if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().ui().options().enabled_dats()) |
| 145 | 145 | { |
| 146 | 146 | image_interface_iterator iter(machine().root_device()); |
| 147 | 147 | for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) |
| r253196 | r253197 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /* add mameinfo / messinfo menu */ |
| 159 | | if (machine().options().enabled_dats()) |
| 159 | if (machine().ui().options().enabled_dats()) |
| 160 | 160 | { |
| 161 | 161 | if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0) |
| 162 | 162 | item_append("MameInfo", nullptr, 0, (void *)MAMEINFO); |
| r253196 | r253197 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /* add sysinfo menu */ |
| 168 | | if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().options().enabled_dats()) |
| 168 | if ((machine().system().flags & MACHINE_TYPE_ARCADE) == 0 && machine().ui().options().enabled_dats()) |
| 169 | 169 | item_append("SysInfo", nullptr, 0, (void *)SYSINFO); |
| 170 | 170 | |
| 171 | 171 | /* add command list menu */ |
| 172 | | if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().options().enabled_dats()) |
| 172 | if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().ui().options().enabled_dats()) |
| 173 | 173 | item_append("Commands Info", nullptr, 0, (void *)COMMAND); |
| 174 | 174 | |
| 175 | 175 | /* add story menu */ |
| 176 | | if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().options().enabled_dats()) |
| 176 | if ((machine().system().flags & MACHINE_TYPE_ARCADE) != 0 && machine().ui().options().enabled_dats()) |
| 177 | 177 | item_append("Mamescores", nullptr, 0, (void *)STORYINFO); |
| 178 | 178 | |
| 179 | 179 | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
trunk/src/emu/ui/menu.cpp
| r253196 | r253197 | |
| 465 | 465 | float mouse_x = -1, mouse_y = -1; |
| 466 | 466 | bool history_flag = ((item[0].flags & MENU_FLAG_UI_HISTORY) != 0); |
| 467 | 467 | |
| 468 | | if (machine().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) |
| 468 | if (machine().ui().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)); |
| 470 | 470 | |
| 471 | 471 | // compute the width and height of the full menu |
| r253196 | r253197 | |
| 1305 | 1305 | bgrnd_bitmap = std::make_unique<bitmap_argb32>(0, 0); |
| 1306 | 1306 | bgrnd_texture = mrender.texture_alloc(render_texture::hq_scale); |
| 1307 | 1307 | |
| 1308 | | emu_options &mopt = machine.options(); |
| 1308 | ui_options &mopt = machine.ui().options(); |
| 1309 | 1309 | if (mopt.use_background_image() && &machine.system() == &GAME_NAME(___empty)) |
| 1310 | 1310 | { |
| 1311 | 1311 | emu_file backgroundfile(".", OPEN_FLAG_READ); |
| r253196 | r253197 | |
| 1372 | 1372 | ui_manager &mui = machine().ui(); |
| 1373 | 1373 | |
| 1374 | 1374 | // draw background image if available |
| 1375 | | if (machine().options().use_background_image() && bgrnd_bitmap->valid()) |
| 1375 | if (machine().ui().options().use_background_image() && bgrnd_bitmap->valid()) |
| 1376 | 1376 | container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 1377 | 1377 | |
| 1378 | 1378 | hover = item.size() + 1; |
| r253196 | r253197 | |
| 2207 | 2207 | int dest_yPixel = tmp_bitmap->height(); |
| 2208 | 2208 | |
| 2209 | 2209 | // force 4:3 ratio min |
| 2210 | | if (machine().options().forced_4x3_snapshot() && ratioI < 0.75f && ui_globals::curimage_view == SNAPSHOT_VIEW) |
| 2210 | if (machine().ui().options().forced_4x3_snapshot() && ratioI < 0.75f && ui_globals::curimage_view == SNAPSHOT_VIEW) |
| 2211 | 2211 | { |
| 2212 | 2212 | // smaller ratio will ensure that the image fits in the view |
| 2213 | 2213 | dest_yPixel = tmp_bitmap->width() * 0.75f; |
| r253196 | r253197 | |
| 2217 | 2217 | dest_yPixel *= ratio; |
| 2218 | 2218 | } |
| 2219 | 2219 | // resize the bitmap if necessary |
| 2220 | | else if (ratioW < 1 || ratioH < 1 || (machine().options().enlarge_snaps() && !no_available)) |
| 2220 | else if (ratioW < 1 || ratioH < 1 || (machine().ui().options().enlarge_snaps() && !no_available)) |
| 2221 | 2221 | { |
| 2222 | 2222 | // smaller ratio will ensure that the image fits in the view |
| 2223 | 2223 | ratio = MIN(ratioW, ratioH); |
| r253196 | r253197 | |
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | // get search path |
| 2339 | | path_iterator path(machine().options().icons_directory()); |
| 2339 | path_iterator path(machine().ui().options().icons_directory()); |
| 2340 | 2340 | std::string curpath; |
| 2341 | | std::string searchstr(machine().options().icons_directory()); |
| 2341 | std::string searchstr(machine().ui().options().icons_directory()); |
| 2342 | 2342 | |
| 2343 | 2343 | // iterate over path and add path for zipped formats |
| 2344 | 2344 | while (path.next(curpath)) |
| r253196 | r253197 | |
| 2446 | 2446 | float gutter_width = lr_arrow_width * 1.3f; |
| 2447 | 2447 | int itemnum, linenum; |
| 2448 | 2448 | |
| 2449 | | if (machine().options().use_background_image() && machine().options().system() == nullptr && bgrnd_bitmap->valid()) |
| 2449 | if (machine().ui().options().use_background_image() && machine().options().system() == nullptr && bgrnd_bitmap->valid()) |
| 2450 | 2450 | container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 2451 | 2451 | |
| 2452 | 2452 | // compute the width and height of the full menu |
trunk/src/emu/ui/selgame.cpp
| r253196 | r253197 | |
| 108 | 108 | ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container) |
| 109 | 109 | { |
| 110 | 110 | std::string error_string, last_filter, sub_filter; |
| 111 | | emu_options &moptions = machine.options(); |
| 111 | ui_options &moptions = machine.ui().options(); |
| 112 | 112 | |
| 113 | 113 | // load drivers cache |
| 114 | 114 | load_cache_info(); |
| r253196 | r253197 | |
| 185 | 185 | std::string error_string, last_driver; |
| 186 | 186 | const game_driver *driver = nullptr; |
| 187 | 187 | ui_software_info *swinfo = nullptr; |
| 188 | | emu_options &mopt = machine().options(); |
| 188 | ui_options &mopt = machine().ui().options(); |
| 189 | 189 | if (main_filters::actual == FILTER_FAVORITE_GAME) |
| 190 | 190 | swinfo = (selected >= 0 && selected < item.size()) ? (ui_software_info *)item[selected].ref : nullptr; |
| 191 | 191 | else |
| r253196 | r253197 | |
| 208 | 208 | mopt.set_value(OPTION_LAST_USED_FILTER, filter.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 209 | 209 | mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 210 | 210 | mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); |
| 211 | | save_game_options(machine()); |
| 211 | save_ui_options(machine()); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | //------------------------------------------------- |
| r253196 | r253197 | |
| 218 | 218 | void ui_menu_select_game::handle() |
| 219 | 219 | { |
| 220 | 220 | bool check_filter = false; |
| 221 | | bool enabled_dats = machine().options().enabled_dats(); |
| 221 | bool enabled_dats = machine().ui().options().enabled_dats(); |
| 222 | 222 | |
| 223 | 223 | // if i have to load datfile, performe an hard reset |
| 224 | 224 | if (ui_globals::reset) |
| r253196 | r253197 | |
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | std::vector<s_bios> biosname; |
| 1026 | | if (!machine().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) |
| 1026 | if (!machine().ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) |
| 1027 | 1027 | ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)driver, false, false)); |
| 1028 | 1028 | else |
| 1029 | 1029 | { |
| r253196 | r253197 | |
| 1051 | 1051 | void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) |
| 1052 | 1052 | { |
| 1053 | 1053 | ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; |
| 1054 | | emu_options &mopt = machine().options(); |
| 1054 | ui_options &mopt = machine().ui().options(); |
| 1055 | 1055 | |
| 1056 | 1056 | // special case for configure options |
| 1057 | 1057 | if ((FPTR)ui_swinfo == 1) |
| r253196 | r253197 | |
| 1064 | 1064 | else if (ui_swinfo->startempty == 1) |
| 1065 | 1065 | { |
| 1066 | 1066 | // audit the game first to see if we're going to work |
| 1067 | | driver_enumerator enumerator(mopt, *ui_swinfo->driver); |
| 1067 | driver_enumerator enumerator(machine().options(), *ui_swinfo->driver); |
| 1068 | 1068 | enumerator.next(); |
| 1069 | 1069 | media_auditor auditor(enumerator); |
| 1070 | 1070 | media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); |
| r253196 | r253197 | |
| 1097 | 1097 | else |
| 1098 | 1098 | { |
| 1099 | 1099 | // first validate |
| 1100 | | driver_enumerator drv(mopt, *ui_swinfo->driver); |
| 1100 | driver_enumerator drv(machine().options(), *ui_swinfo->driver); |
| 1101 | 1101 | media_auditor auditor(drv); |
| 1102 | 1102 | drv.next(); |
| 1103 | 1103 | software_list_device *swlist = software_list_device::find_by_name(drv.config(), ui_swinfo->listname.c_str()); |
| r253196 | r253197 | |
| 1541 | 1541 | strcatprintf(buffer, "Requires CHD: %s\n", (driver_cache[idx].b_chd ? "Yes" : "No")); |
| 1542 | 1542 | |
| 1543 | 1543 | // audit the game first to see if we're going to work |
| 1544 | | if (machine().options().info_audit()) |
| 1544 | if (machine().ui().options().info_audit()) |
| 1545 | 1545 | { |
| 1546 | 1546 | driver_enumerator enumerator(machine().options(), *driver); |
| 1547 | 1547 | enumerator.next(); |
| r253196 | r253197 | |
| 1569 | 1569 | void ui_menu_select_game::inkey_export() |
| 1570 | 1570 | { |
| 1571 | 1571 | std::string filename("exported"); |
| 1572 | | emu_file infile(machine().options().ui_path(), OPEN_FLAG_READ); |
| 1572 | emu_file infile(machine().ui().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 | { |
| r253196 | r253197 | |
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | // attempt to open the output file |
| 1586 | | emu_file file(machine().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1586 | emu_file file(machine().ui().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; |
| r253196 | r253197 | |
| 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().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1628 | emu_file file(machine().ui().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 | { |
| r253196 | r253197 | |
| 1716 | 1716 | driver_cache.resize(driver_list::total() + 1); |
| 1717 | 1717 | |
| 1718 | 1718 | // try to load driver cache |
| 1719 | | emu_file file(machine().options().ui_path(), OPEN_FLAG_READ); |
| 1719 | emu_file file(machine().ui().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(); |
| r253196 | r253197 | |
| 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().ui_path(), OPEN_FLAG_READ); |
| 1791 | emu_file file(machine().ui().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 | |
| r253196 | r253197 | |
| 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().ui_path(), OPEN_FLAG_READ); |
| 1843 | emu_file file(machine().ui().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]; |
| r253196 | r253197 | |
| 2066 | 2066 | static std::string buffer; |
| 2067 | 2067 | std::vector<int> xstart; |
| 2068 | 2068 | std::vector<int> xend; |
| 2069 | | float text_size = machine().options().infos_size(); |
| 2069 | float text_size = machine().ui().options().infos_size(); |
| 2070 | 2070 | const game_driver *driver = nullptr; |
| 2071 | 2071 | ui_software_info *soft = nullptr; |
| 2072 | 2072 | bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); |
trunk/src/emu/ui/selsoft.cpp
| r253196 | r253197 | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // handle UI_HISTORY |
| 216 | | else if (m_event->iptkey == IPT_UI_HISTORY && machine().options().enabled_dats()) |
| 216 | else if (m_event->iptkey == IPT_UI_HISTORY && machine().ui().options().enabled_dats()) |
| 217 | 217 | { |
| 218 | 218 | ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; |
| 219 | 219 | |
| r253196 | r253197 | |
| 817 | 817 | void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) |
| 818 | 818 | { |
| 819 | 819 | ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; |
| 820 | | emu_options &mopt = machine().options(); |
| 820 | ui_options &mopt = machine().ui().options(); |
| 821 | 821 | |
| 822 | 822 | if (ui_swinfo->startempty == 1) |
| 823 | 823 | { |
| r253196 | r253197 | |
| 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().ui_path(), OPEN_FLAG_READ); |
| 928 | emu_file file(machine().ui().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]; |
| r253196 | r253197 | |
| 1417 | 1417 | static std::string buffer; |
| 1418 | 1418 | std::vector<int> xstart; |
| 1419 | 1419 | std::vector<int> xend; |
| 1420 | | float text_size = machine().options().infos_size(); |
| 1420 | float text_size = machine().ui().options().infos_size(); |
| 1421 | 1421 | ui_software_info *soft = ((FPTR)selectedref > 2) ? (ui_software_info *)selectedref : nullptr; |
| 1422 | 1422 | static ui_software_info *oldsoft = nullptr; |
| 1423 | 1423 | static int old_sw_view = -1; |
| r253196 | r253197 | |
| 1876 | 1876 | { |
| 1877 | 1877 | // process the menu |
| 1878 | 1878 | const ui_menu_event *event = process(0); |
| 1879 | | emu_options &moptions = machine().options(); |
| 1879 | ui_options &moptions = machine().ui().options(); |
| 1880 | 1880 | if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr) |
| 1881 | 1881 | for (auto & elem : m_bios) |
| 1882 | 1882 | if ((void*)&elem.name == event->itemref) |
| r253196 | r253197 | |
| 1905 | 1905 | ui_software_info *ui_swinfo = (ui_software_info *)m_driver; |
| 1906 | 1906 | std::string error; |
| 1907 | 1907 | machine().options().set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error); |
| 1908 | | driver_enumerator drivlist(moptions, *ui_swinfo->driver); |
| 1908 | driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); |
| 1909 | 1909 | drivlist.next(); |
| 1910 | 1910 | software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); |
| 1911 | 1911 | software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); |
trunk/src/emu/ui/ui.cpp
| r253196 | r253197 | |
| 160 | 160 | ***************************************************************************/ |
| 161 | 161 | |
| 162 | 162 | //------------------------------------------------- |
| 163 | // load ui options |
| 164 | //------------------------------------------------- |
| 165 | |
| 166 | static void load_ui_options(running_machine &machine) |
| 167 | { |
| 168 | // parse the file |
| 169 | std::string error; |
| 170 | // attempt to open the output file |
| 171 | emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); |
| 172 | if (file.open("ui.ini") == FILERR_NONE) |
| 173 | { |
| 174 | bool result = machine.ui().options().parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); |
| 175 | if (!result) |
| 176 | osd_printf_error("**Error to load ui.ini**"); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | //------------------------------------------------- |
| 163 | 181 | // is_breakable_char - is a given unicode |
| 164 | 182 | // character a possible line break? |
| 165 | 183 | //------------------------------------------------- |
| r253196 | r253197 | |
| 248 | 266 | ui_manager::ui_manager(running_machine &machine) |
| 249 | 267 | : m_machine(machine) |
| 250 | 268 | { |
| 269 | } |
| 270 | |
| 271 | void ui_manager::init() |
| 272 | { |
| 273 | load_ui_options(machine()); |
| 251 | 274 | // initialize the other UI bits |
| 252 | | ui_menu::init(machine); |
| 253 | | ui_gfx_init(machine); |
| 275 | ui_menu::init(machine()); |
| 276 | ui_gfx_init(machine()); |
| 254 | 277 | |
| 255 | 278 | // reset instance variables |
| 256 | 279 | m_font = nullptr; |
| r253196 | r253197 | |
| 265 | 288 | m_mouse_arrow_texture = nullptr; |
| 266 | 289 | m_load_save_hold = false; |
| 267 | 290 | |
| 268 | | get_font_rows(&machine); |
| 269 | | decode_ui_color(0, &machine); |
| 291 | get_font_rows(&machine()); |
| 292 | decode_ui_color(0, &machine()); |
| 270 | 293 | |
| 271 | 294 | // more initialization |
| 272 | 295 | set_handler(handler_messagebox, 0); |
| 273 | 296 | m_non_char_keys_down = std::make_unique<UINT8[]>((ARRAY_LENGTH(non_char_keys) + 7) / 8); |
| 274 | | m_mouse_show = machine.system().flags & MACHINE_CLICKABLE_ARTWORK ? true : false; |
| 297 | m_mouse_show = machine().system().flags & MACHINE_CLICKABLE_ARTWORK ? true : false; |
| 275 | 298 | |
| 276 | 299 | // request a callback upon exiting |
| 277 | | machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_manager::exit), this)); |
| 300 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_manager::exit), this)); |
| 278 | 301 | |
| 279 | 302 | // retrieve options |
| 280 | | m_use_natural_keyboard = machine.options().natural_keyboard(); |
| 281 | | bitmap_argb32 *ui_mouse_bitmap = auto_alloc(machine, bitmap_argb32(32, 32)); |
| 303 | m_use_natural_keyboard = machine().options().natural_keyboard(); |
| 304 | bitmap_argb32 *ui_mouse_bitmap = auto_alloc(machine(), bitmap_argb32(32, 32)); |
| 282 | 305 | UINT32 *dst = &ui_mouse_bitmap->pix32(0); |
| 283 | 306 | memcpy(dst,mouse_bitmap,32*32*sizeof(UINT32)); |
| 284 | | m_mouse_arrow_texture = machine.render().texture_alloc(); |
| 307 | m_mouse_arrow_texture = machine().render().texture_alloc(); |
| 285 | 308 | m_mouse_arrow_texture->set_bitmap(*ui_mouse_bitmap, ui_mouse_bitmap->cliprect(), TEXFORMAT_ARGB32); |
| 286 | 309 | } |
| 287 | 310 | |
| r253196 | r253197 | |
| 2729 | 2752 | static rgb_t color[ARRAY_LENGTH(s_color_list)]; |
| 2730 | 2753 | |
| 2731 | 2754 | if (machine != nullptr) { |
| 2732 | | emu_options option; |
| 2755 | ui_options option; |
| 2733 | 2756 | for (int x = 0; x < ARRAY_LENGTH(s_color_list); x++) { |
| 2734 | 2757 | const char *o_default = option.value(s_color_list[x]); |
| 2735 | | const char *s_option = machine->options().value(s_color_list[x]); |
| 2758 | const char *s_option = machine->ui().options().value(s_color_list[x]); |
| 2736 | 2759 | int len = strlen(s_option); |
| 2737 | 2760 | if (len != 8) |
| 2738 | 2761 | color[x] = rgb_t((UINT32)strtoul(o_default, nullptr, 16)); |
| r253196 | r253197 | |
| 2751 | 2774 | { |
| 2752 | 2775 | static int value; |
| 2753 | 2776 | |
| 2754 | | return ((machine != nullptr) ? value = machine->options().font_rows() : value); |
| 2777 | return ((machine != nullptr) ? value = machine->ui().options().font_rows() : value); |
| 2755 | 2778 | } |