trunk/src/emu/ui/dirmenu.cpp
| r253619 | r253620 | |
| 16 | 16 | #include "ui/utils.h" |
| 17 | 17 | #include "ui/optsmenu.h" |
| 18 | 18 | |
| 19 | static enum |
| 20 | { |
| 21 | ADDING = 1, |
| 22 | CHANGE |
| 23 | }; |
| 24 | |
| 19 | 25 | struct folders_entry |
| 20 | 26 | { |
| 21 | 27 | const char *name; |
| 22 | 28 | const char *option; |
| 29 | const int action; |
| 23 | 30 | }; |
| 24 | 31 | |
| 25 | | static const folders_entry s_folders_entry[] = |
| 32 | static const folders_entry s_folders[] = |
| 26 | 33 | { |
| 27 | | { "ROMs", OPTION_MEDIAPATH }, |
| 28 | | { "UI", OPTION_UI_PATH }, |
| 29 | | { "Samples", OPTION_SAMPLEPATH }, |
| 30 | | { "DATs", OPTION_HISTORY_PATH }, |
| 31 | | { "INIs", OPTION_INIPATH }, |
| 32 | | { "Extra INIs", OPTION_EXTRAINI_PATH }, |
| 33 | | { "Icons", OPTION_ICONS_PATH }, |
| 34 | | { "Cheats", OPTION_CHEATPATH }, |
| 35 | | { "Snapshots", OPTION_SNAPSHOT_DIRECTORY }, |
| 36 | | { "Cabinets", OPTION_CABINETS_PATH }, |
| 37 | | { "Flyers", OPTION_FLYERS_PATH }, |
| 38 | | { "Titles", OPTION_TITLES_PATH }, |
| 39 | | { "Ends", OPTION_ENDS_PATH }, |
| 40 | | { "PCBs", OPTION_PCBS_PATH }, |
| 41 | | { "Marquees", OPTION_MARQUEES_PATH }, |
| 42 | | { "Controls Panels", OPTION_CPANELS_PATH }, |
| 43 | | { "Crosshairs", OPTION_CROSSHAIRPATH }, |
| 44 | | { "Artworks", OPTION_ARTPATH }, |
| 45 | | { "Bosses", OPTION_BOSSES_PATH }, |
| 46 | | { "Artworks Preview", OPTION_ARTPREV_PATH }, |
| 47 | | { "Select", OPTION_SELECT_PATH }, |
| 48 | | { "GameOver", OPTION_GAMEOVER_PATH }, |
| 49 | | { "HowTo", OPTION_HOWTO_PATH }, |
| 50 | | { "Logos", OPTION_LOGOS_PATH }, |
| 51 | | { "Scores", OPTION_SCORES_PATH }, |
| 52 | | { "Versus", OPTION_VERSUS_PATH }, |
| 53 | | { nullptr } |
| 34 | { __("ROMs"), OPTION_MEDIAPATH, ADDING }, |
| 35 | { __("UI"), OPTION_UI_PATH, CHANGE }, |
| 36 | { __("Language"), OPTION_LANGUAGEPATH, CHANGE }, |
| 37 | { __("Samples"), OPTION_SAMPLEPATH, ADDING }, |
| 38 | { __("DATs"), OPTION_HISTORY_PATH, CHANGE }, |
| 39 | { __("INIs"), OPTION_INIPATH, ADDING }, |
| 40 | { __("Extra INIs"), OPTION_EXTRAINI_PATH, CHANGE }, |
| 41 | { __("Icons"), OPTION_ICONS_PATH, ADDING }, |
| 42 | { __("Cheats"), OPTION_CHEATPATH, ADDING }, |
| 43 | { __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY, ADDING }, |
| 44 | { __("Cabinets"), OPTION_CABINETS_PATH, ADDING }, |
| 45 | { __("Flyers"), OPTION_FLYERS_PATH, ADDING }, |
| 46 | { __("Titles"), OPTION_TITLES_PATH, ADDING }, |
| 47 | { __("Ends"), OPTION_ENDS_PATH, ADDING }, |
| 48 | { __("PCBs"), OPTION_PCBS_PATH, ADDING }, |
| 49 | { __("Marquees"), OPTION_MARQUEES_PATH, ADDING }, |
| 50 | { __("Controls Panels"), OPTION_CPANELS_PATH, ADDING }, |
| 51 | { __("Crosshairs"), OPTION_CROSSHAIRPATH, ADDING }, |
| 52 | { __("Artworks"), OPTION_ARTPATH, ADDING }, |
| 53 | { __("Bosses"), OPTION_BOSSES_PATH, ADDING }, |
| 54 | { __("Artworks Preview"), OPTION_ARTPREV_PATH, ADDING }, |
| 55 | { __("Select"), OPTION_SELECT_PATH, ADDING }, |
| 56 | { __("GameOver"), OPTION_GAMEOVER_PATH, ADDING }, |
| 57 | { __("HowTo"), OPTION_HOWTO_PATH, ADDING }, |
| 58 | { __("Logos"), OPTION_LOGOS_PATH, ADDING }, |
| 59 | { __("Scores"), OPTION_SCORES_PATH, ADDING }, |
| 60 | { __("Versus"), OPTION_VERSUS_PATH, ADDING }, |
| 54 | 61 | }; |
| 55 | 62 | |
| 63 | |
| 56 | 64 | /************************************************** |
| 57 | | MENU ADD FOLDER |
| 65 | MENU DIRECTORY |
| 58 | 66 | **************************************************/ |
| 59 | 67 | //------------------------------------------------- |
| 60 | 68 | // ctor / dtor |
| 61 | 69 | //------------------------------------------------- |
| 62 | 70 | |
| 63 | | ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref, bool _change) : ui_menu(machine, container) |
| 71 | ui_menu_directory::ui_menu_directory(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 64 | 72 | { |
| 65 | | m_ref = ref - 1; |
| 66 | | m_change = _change; |
| 73 | } |
| 74 | |
| 75 | ui_menu_directory::~ui_menu_directory() |
| 76 | { |
| 77 | save_ui_options(machine()); |
| 78 | ui_globals::reset = true; |
| 79 | } |
| 80 | |
| 81 | //------------------------------------------------- |
| 82 | // handle |
| 83 | //------------------------------------------------- |
| 84 | |
| 85 | void ui_menu_directory::handle() |
| 86 | { |
| 87 | // process the menu |
| 88 | const ui_menu_event *m_event = process(0); |
| 89 | |
| 90 | if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) |
| 91 | ui_menu::stack_push(global_alloc_clear<ui_menu_display_actual>(machine(), container, selected)); |
| 92 | } |
| 93 | |
| 94 | //------------------------------------------------- |
| 95 | // populate |
| 96 | //------------------------------------------------- |
| 97 | |
| 98 | void ui_menu_directory::populate() |
| 99 | { |
| 100 | |
| 101 | for (auto & elem : s_folders) |
| 102 | item_append(_(elem.name), nullptr, 0, (void *)(FPTR)elem.action); |
| 103 | |
| 104 | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
| 105 | customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; |
| 106 | } |
| 107 | |
| 108 | //------------------------------------------------- |
| 109 | // perform our special rendering |
| 110 | //------------------------------------------------- |
| 111 | |
| 112 | void ui_menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 113 | { |
| 114 | float width; |
| 115 | ui_manager &mui = machine().ui(); |
| 116 | |
| 117 | // get the size of the text |
| 118 | mui.draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 119 | DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 120 | width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; |
| 121 | float maxwidth = MAX(width, origx2 - origx1); |
| 122 | |
| 123 | // compute our bounds |
| 124 | float x1 = 0.5f - 0.5f * maxwidth; |
| 125 | float x2 = x1 + maxwidth; |
| 126 | float y1 = origy1 - top; |
| 127 | float y2 = origy1 - UI_BOX_TB_BORDER; |
| 128 | |
| 129 | // draw a box |
| 130 | mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); |
| 131 | |
| 132 | // take off the borders |
| 133 | x1 += UI_BOX_LR_BORDER; |
| 134 | x2 -= UI_BOX_LR_BORDER; |
| 135 | y1 += UI_BOX_TB_BORDER; |
| 136 | |
| 137 | // draw the text within it |
| 138 | mui.draw_text_full(container, _("Folders Setup"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 139 | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 140 | } |
| 141 | |
| 142 | /************************************************** |
| 143 | MENU DISPLAY PATH |
| 144 | **************************************************/ |
| 145 | //------------------------------------------------- |
| 146 | // ctor / dtor |
| 147 | //------------------------------------------------- |
| 148 | |
| 149 | ui_menu_display_actual::ui_menu_display_actual(running_machine &machine, render_container *container, int ref) |
| 150 | : ui_menu(machine, container), m_ref(ref) |
| 151 | { |
| 152 | } |
| 153 | |
| 154 | ui_menu_display_actual::~ui_menu_display_actual() |
| 155 | { |
| 156 | } |
| 157 | |
| 158 | //------------------------------------------------- |
| 159 | // handle |
| 160 | //------------------------------------------------- |
| 161 | |
| 162 | void ui_menu_display_actual::handle() |
| 163 | { |
| 164 | // process the menu |
| 165 | const ui_menu_event *m_event = process(0); |
| 166 | if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) |
| 167 | switch ((FPTR)m_event->itemref) |
| 168 | { |
| 169 | case REMOVE: |
| 170 | ui_menu::stack_push(global_alloc_clear<ui_menu_remove_folder>(machine(), container, m_ref)); |
| 171 | break; |
| 172 | |
| 173 | case ADD_CHANGE: |
| 174 | ui_menu::stack_push(global_alloc_clear<ui_menu_add_change_folder>(machine(), container, m_ref)); |
| 175 | break; |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | //------------------------------------------------- |
| 180 | // populate |
| 181 | //------------------------------------------------- |
| 182 | |
| 183 | void ui_menu_display_actual::populate() |
| 184 | { |
| 185 | m_tempbuf.assign(_("Current ")).append(_(s_folders[m_ref].name)).append(_(" Folders")); |
| 186 | if (machine().ui().options().exists(s_folders[m_ref].option)) { |
| 187 | m_searchpath.assign(machine().ui().options().value(s_folders[m_ref].option)); |
| 188 | } |
| 189 | else { |
| 190 | m_searchpath.assign(machine().options().value(s_folders[m_ref].option)); |
| 191 | } |
| 192 | path_iterator path(m_searchpath.c_str()); |
| 193 | std::string curpath; |
| 194 | m_folders.clear(); |
| 195 | while (path.next(curpath, nullptr)) |
| 196 | m_folders.push_back(curpath); |
| 197 | |
| 198 | item_append((s_folders[m_ref].action == CHANGE) ? _("Change Folder") : _("Add Folder"), nullptr, 0, (void *)ADD_CHANGE); |
| 199 | |
| 200 | if (m_folders.size() > 1) |
| 201 | item_append(_("Remove Folder"), nullptr, 0, (void *)REMOVE); |
| 202 | |
| 203 | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
| 204 | customtop = (m_folders.size() + 1) * machine().ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; |
| 205 | } |
| 206 | |
| 207 | //------------------------------------------------- |
| 208 | // perform our special rendering |
| 209 | //------------------------------------------------- |
| 210 | |
| 211 | void ui_menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 212 | { |
| 213 | float width, maxwidth = origx2 - origx1; |
| 214 | ui_manager &mui = machine().ui(); |
| 215 | float lineh = mui.get_line_height(); |
| 216 | |
| 217 | for (auto & elem : m_folders) |
| 218 | { |
| 219 | mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 220 | width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; |
| 221 | maxwidth = MAX(maxwidth, width); |
| 222 | } |
| 223 | |
| 224 | // get the size of the text |
| 225 | mui.draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 226 | width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; |
| 227 | maxwidth = MAX(width, maxwidth); |
| 228 | |
| 229 | // compute our bounds |
| 230 | float x1 = 0.5f - 0.5f * maxwidth; |
| 231 | float x2 = x1 + maxwidth; |
| 232 | float y1 = origy1 - top; |
| 233 | float y2 = y1 + lineh + 2.0f * UI_BOX_TB_BORDER; |
| 234 | |
| 235 | // draw a box |
| 236 | mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); |
| 237 | |
| 238 | // take off the borders |
| 239 | x1 += UI_BOX_LR_BORDER; |
| 240 | x2 -= UI_BOX_LR_BORDER; |
| 241 | y1 += UI_BOX_TB_BORDER; |
| 242 | |
| 243 | // draw the text within it |
| 244 | mui.draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 245 | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 246 | |
| 247 | // compute our bounds |
| 248 | x1 = 0.5f - 0.5f * maxwidth; |
| 249 | x2 = x1 + maxwidth; |
| 250 | y1 = y2 + 2.0f * UI_BOX_TB_BORDER; |
| 251 | y2 = origy1 - UI_BOX_TB_BORDER; |
| 252 | |
| 253 | // draw a box |
| 254 | mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); |
| 255 | |
| 256 | // take off the borders |
| 257 | x1 += UI_BOX_LR_BORDER; |
| 258 | x2 -= UI_BOX_LR_BORDER; |
| 259 | y1 += UI_BOX_TB_BORDER; |
| 260 | |
| 261 | // draw the text within it |
| 262 | for (auto & elem : m_folders) |
| 263 | { |
| 264 | mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_TRUNCATE, |
| 265 | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 266 | y1 += lineh; |
| 267 | } |
| 268 | |
| 269 | } |
| 270 | |
| 271 | /************************************************** |
| 272 | MENU ADD FOLDER |
| 273 | **************************************************/ |
| 274 | //------------------------------------------------- |
| 275 | // ctor / dtor |
| 276 | //------------------------------------------------- |
| 277 | |
| 278 | ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) |
| 279 | { |
| 280 | m_ref = ref; |
| 281 | m_change = (s_folders[ref].action == CHANGE); |
| 67 | 282 | m_search[0] = '\0'; |
| 68 | 283 | |
| 69 | 284 | // configure the starting path |
| r253619 | r253620 | |
| 71 | 286 | osd_get_full_path(&dst, "."); |
| 72 | 287 | m_current_path = dst; |
| 73 | 288 | osd_free(dst); |
| 289 | |
| 290 | std::string searchpath; |
| 291 | if (machine.ui().options().exists(s_folders[m_ref].option)) |
| 292 | { |
| 293 | searchpath = machine.ui().options().value(s_folders[m_ref].option); |
| 294 | } |
| 295 | else |
| 296 | { |
| 297 | searchpath = machine.options().value(s_folders[m_ref].option); |
| 298 | } |
| 299 | |
| 300 | path_iterator path(searchpath.c_str()); |
| 301 | std::string curpath; |
| 302 | while (path.next(curpath, nullptr)) |
| 303 | m_folders.push_back(curpath); |
| 304 | |
| 74 | 305 | } |
| 75 | 306 | |
| 76 | 307 | ui_menu_add_change_folder::~ui_menu_add_change_folder() |
| r253619 | r253620 | |
| 144 | 375 | std::string error_string; |
| 145 | 376 | if (m_change) |
| 146 | 377 | { |
| 147 | | if (machine().ui().options().exists(s_folders_entry[m_ref].option)) |
| 378 | if (machine().ui().options().exists(s_folders[m_ref].option)) |
| 148 | 379 | { |
| 149 | | machine().ui().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 380 | machine().ui().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 150 | 381 | } |
| 151 | | else { |
| 152 | | if (strcmp(machine().options().value(s_folders_entry[m_ref].option), m_current_path.c_str()) != 0) |
| 382 | else |
| 383 | { |
| 384 | if (strcmp(machine().options().value(s_folders[m_ref].option), m_current_path.c_str()) != 0) |
| 153 | 385 | { |
| 154 | | machine().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 155 | | machine().options().mark_changed(s_folders_entry[m_ref].option); |
| 386 | machine().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 387 | machine().options().mark_changed(s_folders[m_ref].option); |
| 156 | 388 | } |
| 157 | 389 | } |
| 158 | 390 | machine().datfile().reset_run(); |
| 159 | 391 | } |
| 160 | 392 | else |
| 161 | 393 | { |
| 394 | m_folders.push_back(m_current_path); |
| 162 | 395 | std::string tmppath; |
| 163 | | if (machine().ui().options().exists(s_folders_entry[m_ref].option)) { |
| 164 | | tmppath.assign(machine().ui().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); |
| 396 | for (int x = 0; x < m_folders.size(); ++x) |
| 397 | { |
| 398 | tmppath.append(m_folders[x]); |
| 399 | if (x != m_folders.size() - 1) |
| 400 | tmppath.append(";"); |
| 165 | 401 | } |
| 166 | | else { |
| 167 | | tmppath.assign(machine().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); |
| 168 | | } |
| 169 | | |
| 170 | | if (machine().ui().options().exists(s_folders_entry[m_ref].option)) |
| 402 | |
| 403 | if (machine().ui().options().exists(s_folders[m_ref].option)) |
| 171 | 404 | { |
| 172 | | machine().ui().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 405 | machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 173 | 406 | } |
| 174 | | else { |
| 175 | | if (strcmp(machine().options().value(s_folders_entry[m_ref].option), tmppath.c_str()) != 0) |
| 407 | else |
| 408 | { |
| 409 | if (strcmp(machine().options().value(s_folders[m_ref].option), tmppath.c_str()) != 0) |
| 176 | 410 | { |
| 177 | | machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 178 | | machine().options().mark_changed(s_folders_entry[m_ref].option); |
| 411 | machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 412 | machine().options().mark_changed(s_folders[m_ref].option); |
| 179 | 413 | } |
| 180 | 414 | } |
| 181 | 415 | } |
| r253619 | r253620 | |
| 279 | 513 | ui_manager &mui = machine().ui(); |
| 280 | 514 | std::string tempbuf[2]; |
| 281 | 515 | tempbuf[0] = (m_change) ? _("Change)") : _("Add"); |
| 282 | | tempbuf[0].append(" ").append(s_folders_entry[m_ref].name).append(_(" Folder - Search: ")).append(m_search).append("_"); |
| 516 | tempbuf[0].append(" ").append(_(s_folders[m_ref].name)).append(_(" Folder - Search: ")).append(m_search).append("_"); |
| 283 | 517 | tempbuf[1] = m_current_path; |
| 284 | 518 | |
| 285 | 519 | // get the size of the text |
| 286 | | for (auto & elem: tempbuf) |
| 520 | for (auto & elem : tempbuf) |
| 287 | 521 | { |
| 288 | 522 | mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, |
| 289 | | DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 523 | DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 290 | 524 | width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; |
| 291 | 525 | maxwidth = MAX(width, maxwidth); |
| 292 | 526 | } |
| r253619 | r253620 | |
| 342 | 576 | } |
| 343 | 577 | |
| 344 | 578 | /************************************************** |
| 345 | | MENU DIRECTORY |
| 579 | MENU REMOVE FOLDER |
| 346 | 580 | **************************************************/ |
| 347 | 581 | //------------------------------------------------- |
| 348 | 582 | // ctor / dtor |
| 349 | 583 | //------------------------------------------------- |
| 350 | 584 | |
| 351 | | ui_menu_directory::ui_menu_directory(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 585 | ui_menu_remove_folder::ui_menu_remove_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) |
| 352 | 586 | { |
| 353 | | } |
| 354 | | |
| 355 | | ui_menu_directory::~ui_menu_directory() |
| 356 | | { |
| 357 | | save_ui_options(machine()); |
| 358 | | ui_globals::reset = true; |
| 359 | | } |
| 360 | | |
| 361 | | //------------------------------------------------- |
| 362 | | // handle |
| 363 | | //------------------------------------------------- |
| 364 | | |
| 365 | | void ui_menu_directory::handle() |
| 366 | | { |
| 367 | | // process the menu |
| 368 | | const ui_menu_event *m_event = process(0); |
| 369 | | |
| 370 | | if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) |
| 371 | | { |
| 372 | | int ref = (FPTR)m_event->itemref; |
| 373 | | bool change = (ref == HISTORY_FOLDERS || ref == EXTRAINI_FOLDERS || ref == UI_FOLDERS); |
| 374 | | ui_menu::stack_push(global_alloc_clear<ui_menu_display_actual>(machine(), container, ref, change)); |
| 375 | | } |
| 376 | | } |
| 377 | | |
| 378 | | //------------------------------------------------- |
| 379 | | // populate |
| 380 | | //------------------------------------------------- |
| 381 | | |
| 382 | | void ui_menu_directory::populate() |
| 383 | | { |
| 384 | | item_append("Roms", nullptr, 0, (void *)(FPTR)ROM_FOLDERS); |
| 385 | | item_append("UI", nullptr, 0, (void *)(FPTR)UI_FOLDERS); |
| 386 | | item_append("Samples", nullptr, 0, (void *)(FPTR)SAMPLE_FOLDERS); |
| 387 | | item_append("INIs", nullptr, 0, (void *)(FPTR)INI_FOLDERS); |
| 388 | | item_append("Artwork", nullptr, 0, (void *)(FPTR)ARTWORK_FOLDERS); |
| 389 | | item_append("DATs (History, Mameinfo, etc...)", nullptr, 0, (void *)(FPTR)HISTORY_FOLDERS); |
| 390 | | item_append("Extra INI (Category, etc...)", nullptr, 0, (void *)(FPTR)EXTRAINI_FOLDERS); |
| 391 | | item_append("Icons", nullptr, 0, (void *)(FPTR)ICON_FOLDERS); |
| 392 | | item_append("Cheats", nullptr, 0, (void *)(FPTR)CHEAT_FOLDERS); |
| 393 | | item_append("Snapshots", nullptr, 0, (void *)(FPTR)SNAPSHOT_FOLDERS); |
| 394 | | item_append("Cabinets", nullptr, 0, (void *)(FPTR)CABINET_FOLDERS); |
| 395 | | item_append("Flyers", nullptr, 0, (void *)(FPTR)FLYER_FOLDERS); |
| 396 | | item_append("Titles", nullptr, 0, (void *)(FPTR)TITLE_FOLDERS); |
| 397 | | item_append("Ends", nullptr, 0, (void *)(FPTR)ENDS_FOLDERS); |
| 398 | | item_append("PCBs", nullptr, 0, (void *)(FPTR)PCB_FOLDERS); |
| 399 | | item_append("Marquees", nullptr, 0, (void *)(FPTR)MARQUEES_FOLDERS); |
| 400 | | item_append("Control Panels", nullptr, 0, (void *)(FPTR)CPANEL_FOLDERS); |
| 401 | | item_append("Bosses", nullptr, 0, (void *)(FPTR)BOSSES_FOLDERS); |
| 402 | | item_append("Versus", nullptr, 0, (void *)(FPTR)VERSUS_FOLDERS); |
| 403 | | item_append("Game Over", nullptr, 0, (void *)(FPTR)GAMEOVER_FOLDERS); |
| 404 | | item_append("How To", nullptr, 0, (void *)(FPTR)HOWTO_FOLDERS); |
| 405 | | item_append("Select", nullptr, 0, (void *)(FPTR)SELECT_FOLDERS); |
| 406 | | item_append("Artwork Preview", nullptr, 0, (void *)(FPTR)ARTPREV_FOLDERS); |
| 407 | | item_append("Scores", nullptr, 0, (void *)(FPTR)SCORES_FOLDERS); |
| 408 | | item_append("Logos", nullptr, 0, (void *)(FPTR)LOGO_FOLDERS); |
| 409 | | item_append("Crosshairs", nullptr, 0, (void *)(FPTR)CROSSHAIR_FOLDERS); |
| 410 | | |
| 411 | | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
| 412 | | customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; |
| 413 | | } |
| 414 | | |
| 415 | | //------------------------------------------------- |
| 416 | | // perform our special rendering |
| 417 | | //------------------------------------------------- |
| 418 | | |
| 419 | | void ui_menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 420 | | { |
| 421 | | float width; |
| 422 | | ui_manager &mui = machine().ui(); |
| 423 | | |
| 424 | | // get the size of the text |
| 425 | | mui.draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 426 | | DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 427 | | width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; |
| 428 | | float maxwidth = MAX(width, origx2 - origx1); |
| 429 | | |
| 430 | | // compute our bounds |
| 431 | | float x1 = 0.5f - 0.5f * maxwidth; |
| 432 | | float x2 = x1 + maxwidth; |
| 433 | | float y1 = origy1 - top; |
| 434 | | float y2 = origy1 - UI_BOX_TB_BORDER; |
| 435 | | |
| 436 | | // draw a box |
| 437 | | mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); |
| 438 | | |
| 439 | | // take off the borders |
| 440 | | x1 += UI_BOX_LR_BORDER; |
| 441 | | x2 -= UI_BOX_LR_BORDER; |
| 442 | | y1 += UI_BOX_TB_BORDER; |
| 443 | | |
| 444 | | // draw the text within it |
| 445 | | mui.draw_text_full(container, _("Folders Setup"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 446 | | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 447 | | } |
| 448 | | |
| 449 | | /************************************************** |
| 450 | | MENU DISPLAY PATH |
| 451 | | **************************************************/ |
| 452 | | //------------------------------------------------- |
| 453 | | // ctor / dtor |
| 454 | | //------------------------------------------------- |
| 455 | | |
| 456 | | ui_menu_display_actual::ui_menu_display_actual(running_machine &machine, render_container *container, int ref, bool _change) : ui_menu(machine, container) |
| 457 | | { |
| 458 | 587 | m_ref = ref; |
| 459 | | m_change = _change; |
| 460 | | } |
| 588 | if (machine.ui().options().exists(s_folders[m_ref].option)) |
| 589 | m_searchpath.assign(machine.ui().options().value(s_folders[m_ref].option)); |
| 590 | else |
| 591 | m_searchpath.assign(machine.options().value(s_folders[m_ref].option)); |
| 461 | 592 | |
| 462 | | ui_menu_display_actual::~ui_menu_display_actual() |
| 463 | | { |
| 464 | | } |
| 465 | | |
| 466 | | //------------------------------------------------- |
| 467 | | // handle |
| 468 | | //------------------------------------------------- |
| 469 | | |
| 470 | | void ui_menu_display_actual::handle() |
| 471 | | { |
| 472 | | // process the menu |
| 473 | | const ui_menu_event *m_event = process(0); |
| 474 | | if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) |
| 475 | | switch ((FPTR)m_event->itemref) |
| 476 | | { |
| 477 | | case REMOVE_FOLDER: |
| 478 | | ui_menu::stack_push(global_alloc_clear<ui_menu_remove_folder>(machine(), container, m_ref)); |
| 479 | | break; |
| 480 | | |
| 481 | | case ADD_FOLDER: |
| 482 | | case CHANGE_FOLDER: |
| 483 | | ui_menu::stack_push(global_alloc_clear<ui_menu_add_change_folder>(machine(), container, m_ref, m_change)); |
| 484 | | break; |
| 485 | | } |
| 486 | | } |
| 487 | | |
| 488 | | //------------------------------------------------- |
| 489 | | // populate |
| 490 | | //------------------------------------------------- |
| 491 | | |
| 492 | | void ui_menu_display_actual::populate() |
| 493 | | { |
| 494 | | m_tempbuf.assign(_("Current ")).append(s_folders_entry[m_ref - 1].name).append(_(" Folders")); |
| 495 | | if (machine().ui().options().exists(s_folders_entry[m_ref - 1].option)) { |
| 496 | | m_searchpath.assign(machine().ui().options().value(s_folders_entry[m_ref - 1].option)); |
| 497 | | } |
| 498 | | else { |
| 499 | | m_searchpath.assign(machine().options().value(s_folders_entry[m_ref - 1].option)); |
| 500 | | } |
| 501 | 593 | path_iterator path(m_searchpath.c_str()); |
| 502 | 594 | std::string curpath; |
| 503 | | m_folders.clear(); |
| 504 | 595 | while (path.next(curpath, nullptr)) |
| 505 | 596 | m_folders.push_back(curpath); |
| 506 | | |
| 507 | | if (m_change) |
| 508 | | item_append(_("Change Folder"), nullptr, 0, (void *)CHANGE_FOLDER); |
| 509 | | else |
| 510 | | item_append(_("Add Folder"), nullptr, 0, (void *)ADD_FOLDER); |
| 511 | | |
| 512 | | if (m_folders.size() > 1) |
| 513 | | item_append(_("Remove Folder"), nullptr, 0, (void *)REMOVE_FOLDER); |
| 514 | | |
| 515 | | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
| 516 | | customtop = (m_folders.size() + 1) * machine().ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; |
| 517 | 597 | } |
| 518 | 598 | |
| 519 | | //------------------------------------------------- |
| 520 | | // perform our special rendering |
| 521 | | //------------------------------------------------- |
| 522 | | |
| 523 | | void ui_menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) |
| 524 | | { |
| 525 | | float width, maxwidth = origx2 - origx1; |
| 526 | | ui_manager &mui = machine().ui(); |
| 527 | | float lineh = mui.get_line_height(); |
| 528 | | |
| 529 | | for (auto & elem : m_folders) |
| 530 | | { |
| 531 | | mui.draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 532 | | width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; |
| 533 | | maxwidth = MAX(maxwidth, width); |
| 534 | | } |
| 535 | | |
| 536 | | // get the size of the text |
| 537 | | mui.draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
| 538 | | width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; |
| 539 | | maxwidth = MAX(width, maxwidth); |
| 540 | | |
| 541 | | // compute our bounds |
| 542 | | float x1 = 0.5f - 0.5f * maxwidth; |
| 543 | | float x2 = x1 + maxwidth; |
| 544 | | float y1 = origy1 - top; |
| 545 | | float y2 = y1 + lineh + 2.0f * UI_BOX_TB_BORDER; |
| 546 | | |
| 547 | | // draw a box |
| 548 | | mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR); |
| 549 | | |
| 550 | | // take off the borders |
| 551 | | x1 += UI_BOX_LR_BORDER; |
| 552 | | x2 -= UI_BOX_LR_BORDER; |
| 553 | | y1 += UI_BOX_TB_BORDER; |
| 554 | | |
| 555 | | // draw the text within it |
| 556 | | mui.draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, |
| 557 | | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 558 | | |
| 559 | | // compute our bounds |
| 560 | | x1 = 0.5f - 0.5f * maxwidth; |
| 561 | | x2 = x1 + maxwidth; |
| 562 | | y1 = y2 + 2.0f * UI_BOX_TB_BORDER; |
| 563 | | y2 = origy1 - UI_BOX_TB_BORDER; |
| 564 | | |
| 565 | | // draw a box |
| 566 | | mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); |
| 567 | | |
| 568 | | // take off the borders |
| 569 | | x1 += UI_BOX_LR_BORDER; |
| 570 | | x2 -= UI_BOX_LR_BORDER; |
| 571 | | y1 += UI_BOX_TB_BORDER; |
| 572 | | |
| 573 | | // draw the text within it |
| 574 | | for (auto & elem : m_folders) |
| 575 | | { |
| 576 | | mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_LEFT, WRAP_TRUNCATE, |
| 577 | | DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); |
| 578 | | y1 += lineh; |
| 579 | | } |
| 580 | | |
| 581 | | } |
| 582 | | |
| 583 | | /************************************************** |
| 584 | | MENU REMOVE FOLDER |
| 585 | | **************************************************/ |
| 586 | | //------------------------------------------------- |
| 587 | | // ctor / dtor |
| 588 | | //------------------------------------------------- |
| 589 | | |
| 590 | | ui_menu_remove_folder::ui_menu_remove_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) |
| 591 | | { |
| 592 | | m_ref = ref - 1; |
| 593 | | if (machine.ui().options().exists(s_folders_entry[m_ref].option)) { |
| 594 | | m_searchpath.assign(machine.ui().options().value(s_folders_entry[m_ref].option)); |
| 595 | | } |
| 596 | | else { |
| 597 | | m_searchpath.assign(machine.options().value(s_folders_entry[m_ref].option)); |
| 598 | | } |
| 599 | | |
| 600 | | } |
| 601 | | |
| 602 | 599 | ui_menu_remove_folder::~ui_menu_remove_folder() |
| 603 | 600 | { |
| 604 | 601 | } |
| r253619 | r253620 | |
| 613 | 610 | const ui_menu_event *m_event = process(0); |
| 614 | 611 | if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT) |
| 615 | 612 | { |
| 616 | | int index = (FPTR)m_event->itemref - 1; |
| 617 | | std::string tmppath; |
| 618 | | for (size_t i = 0; i < item.size() - 2; i++) |
| 619 | | if (i != index) |
| 620 | | tmppath.append(item[i].text).append(";"); |
| 613 | std::string tmppath, error_string; |
| 614 | for (int x = 0; x < m_folders.size(); ++x) |
| 615 | { |
| 616 | if (x != selected) |
| 617 | tmppath.append(m_folders[x]); |
| 618 | if (x < m_folders.size() - 1) |
| 619 | tmppath.append(";"); |
| 620 | } |
| 621 | 621 | |
| 622 | | tmppath.substr(0, tmppath.size() - 1); |
| 623 | | std::string error_string; |
| 624 | | if (machine().ui().options().exists(s_folders_entry[m_ref].option)) |
| 622 | if (machine().ui().options().exists(s_folders[m_ref].option)) |
| 625 | 623 | { |
| 626 | | machine().ui().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 624 | machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 627 | 625 | } |
| 628 | | else { |
| 629 | | if (strcmp(machine().options().value(s_folders_entry[m_ref].option),tmppath.c_str())!=0) |
| 626 | else |
| 627 | { |
| 628 | if (strcmp(machine().options().value(s_folders[m_ref].option),tmppath.c_str())!=0) |
| 630 | 629 | { |
| 631 | | machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 632 | | machine().options().mark_changed(s_folders_entry[m_ref].option); |
| 630 | machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); |
| 631 | machine().options().mark_changed(s_folders[m_ref].option); |
| 633 | 632 | } |
| 634 | 633 | } |
| 635 | 634 | |
| r253619 | r253620 | |
| 644 | 643 | |
| 645 | 644 | void ui_menu_remove_folder::populate() |
| 646 | 645 | { |
| 647 | | path_iterator path(m_searchpath.c_str()); |
| 648 | | std::string curpath; |
| 649 | 646 | int folders_count = 0; |
| 647 | for (auto & elem : m_folders) |
| 648 | item_append(elem.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); |
| 650 | 649 | |
| 651 | | while (path.next(curpath, nullptr)) |
| 652 | | item_append(curpath.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); |
| 653 | | |
| 654 | 650 | item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); |
| 655 | 651 | |
| 656 | 652 | customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; |
| r253619 | r253620 | |
| 664 | 660 | { |
| 665 | 661 | float width; |
| 666 | 662 | ui_manager &mui = machine().ui(); |
| 667 | | std::string tempbuf = std::string(_("Remove ")).append(s_folders_entry[m_ref].name).append(_(" Folder")); |
| 663 | std::string tempbuf = std::string(_("Remove ")).append(_(s_folders[m_ref].name)).append(_(" Folder")); |
| 668 | 664 | |
| 669 | 665 | // get the size of the text |
| 670 | 666 | mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); |
trunk/src/emu/ui/ui.cpp
| r253619 | r253620 | |
| 412 | 412 | if (show_mandatory_fileman && machine().image().mandatory_scan(messagebox_text).length() > 0) |
| 413 | 413 | { |
| 414 | 414 | std::string warning; |
| 415 | | warning.assign("This driver requires images to be loaded in the following device(s): ").append(messagebox_text.substr(0, messagebox_text.length() - 2)); |
| 415 | warning.assign(_("This driver requires images to be loaded in the following device(s): ")).append(messagebox_text.substr(0, messagebox_text.length() - 2)); |
| 416 | 416 | ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.c_str()); |
| 417 | 417 | } |
| 418 | 418 | break; |
| r253619 | r253620 | |
| 1059 | 1059 | |
| 1060 | 1060 | std::string &ui_manager::disclaimer_string(std::string &str) |
| 1061 | 1061 | { |
| 1062 | | str.assign("Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n"); |
| 1063 | | strcatprintf(str, "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine().system().description); |
| 1064 | | str.append("Otherwise, type OK or move the joystick left then right to continue"); |
| 1062 | str.assign(_("Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n")); |
| 1063 | strcatprintf(str, _("IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n"), machine().system().description); |
| 1064 | str.append(_("Otherwise, type OK or move the joystick left then right to continue")); |
| 1065 | 1065 | return str; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| r253619 | r253620 | |
| 1096 | 1096 | // add a warning if any ROMs were loaded with warnings |
| 1097 | 1097 | if (machine().rom_load().warnings() > 0) |
| 1098 | 1098 | { |
| 1099 | | str.append("One or more ROMs/CHDs for this machine are incorrect. The machine may not run correctly.\n"); |
| 1099 | str.append(_("One or more ROMs/CHDs for this machine are incorrect. The machine may not run correctly.\n")); |
| 1100 | 1100 | if (machine().system().flags & WARNING_FLAGS) |
| 1101 | 1101 | str.append("\n"); |
| 1102 | 1102 | } |
| r253619 | r253620 | |
| 1109 | 1109 | // if we have at least one warning flag, print the general header |
| 1110 | 1110 | if ((machine().system().flags & WARNING_FLAGS) || machine().rom_load().knownbad() > 0) |
| 1111 | 1111 | { |
| 1112 | | str.append("There are known problems with this machine\n\n"); |
| 1112 | str.append(_("There are known problems with this machine\n\n")); |
| 1113 | 1113 | |
| 1114 | 1114 | // add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP |
| 1115 | 1115 | if (machine().rom_load().knownbad() > 0) { |
| 1116 | | str.append("One or more ROMs/CHDs for this machine have not been correctly dumped.\n"); |
| 1116 | str.append(_("One or more ROMs/CHDs for this machine have not been correctly dumped.\n")); |
| 1117 | 1117 | } |
| 1118 | 1118 | // add one line per warning flag |
| 1119 | 1119 | if (machine().system().flags & MACHINE_IMPERFECT_KEYBOARD) |
| 1120 | | str.append("The keyboard emulation may not be 100% accurate.\n"); |
| 1120 | str.append(_("The keyboard emulation may not be 100% accurate.\n")); |
| 1121 | 1121 | if (machine().system().flags & MACHINE_IMPERFECT_COLORS) |
| 1122 | | str.append("The colors aren't 100% accurate.\n"); |
| 1122 | str.append(_("The colors aren't 100% accurate.\n")); |
| 1123 | 1123 | if (machine().system().flags & MACHINE_WRONG_COLORS) |
| 1124 | | str.append("The colors are completely wrong.\n"); |
| 1124 | str.append(_("The colors are completely wrong.\n")); |
| 1125 | 1125 | if (machine().system().flags & MACHINE_IMPERFECT_GRAPHICS) |
| 1126 | | str.append("The video emulation isn't 100% accurate.\n"); |
| 1126 | str.append(_("The video emulation isn't 100% accurate.\n")); |
| 1127 | 1127 | if (machine().system().flags & MACHINE_IMPERFECT_SOUND) |
| 1128 | | str.append("The sound emulation isn't 100% accurate.\n"); |
| 1128 | str.append(_("The sound emulation isn't 100% accurate.\n")); |
| 1129 | 1129 | if (machine().system().flags & MACHINE_NO_SOUND) { |
| 1130 | | str.append("The machine lacks sound.\n"); |
| 1130 | str.append(_("The machine lacks sound.\n")); |
| 1131 | 1131 | } |
| 1132 | 1132 | if (machine().system().flags & MACHINE_NO_COCKTAIL) |
| 1133 | | str.append("Screen flipping in cocktail mode is not supported.\n"); |
| 1133 | str.append(_("Screen flipping in cocktail mode is not supported.\n")); |
| 1134 | 1134 | |
| 1135 | 1135 | // check if external artwork is present before displaying this warning? |
| 1136 | 1136 | if (machine().system().flags & MACHINE_REQUIRES_ARTWORK) { |
| 1137 | | str.append("The machine requires external artwork files\n"); |
| 1137 | str.append(_("The machine requires external artwork files\n")); |
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | 1140 | if (machine().system().flags & MACHINE_IS_INCOMPLETE ) |
| 1141 | 1141 | { |
| 1142 | | str.append("This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n"); |
| 1142 | str.append(_("This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n")); |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | if (machine().system().flags & MACHINE_NO_SOUND_HW ) |
| 1146 | 1146 | { |
| 1147 | | str.append("This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n"); |
| 1147 | str.append(_("This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n")); |
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | // if there's a NOT WORKING, UNEMULATED PROTECTION or GAME MECHANICAL warning, make it stronger |
| r253619 | r253620 | |
| 1152 | 1152 | { |
| 1153 | 1153 | // add the strings for these warnings |
| 1154 | 1154 | if (machine().system().flags & MACHINE_UNEMULATED_PROTECTION) { |
| 1155 | | str.append("The machine has protection which isn't fully emulated.\n"); |
| 1155 | str.append(_("The machine has protection which isn't fully emulated.\n")); |
| 1156 | 1156 | } |
| 1157 | 1157 | if (machine().system().flags & MACHINE_NOT_WORKING) { |
| 1158 | | str.append("\nTHIS MACHINE DOESN'T WORK. The emulation for this machine is not yet complete. " |
| 1159 | | "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n"); |
| 1158 | str.append(_("\nTHIS MACHINE DOESN'T WORK. The emulation for this machine is not yet complete. " |
| 1159 | "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n")); |
| 1160 | 1160 | } |
| 1161 | 1161 | if (machine().system().flags & MACHINE_MECHANICAL) { |
| 1162 | | str.append("\nCertain elements of this machine cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " |
| 1163 | | "It is not possible to fully play this machine.\n"); |
| 1162 | str.append(_("\nCertain elements of this machine cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " |
| 1163 | "It is not possible to fully play this machine.\n")); |
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | 1166 | // find the parent of this driver |
| r253619 | r253620 | |
| 1178 | 1178 | { |
| 1179 | 1179 | // this one works, add a header and display the name of the clone |
| 1180 | 1180 | if (!foundworking) { |
| 1181 | | str.append("\n\nThere are working clones of this machine: "); |
| 1181 | str.append(_("\n\nThere are working clones of this machine: ")); |
| 1182 | 1182 | } |
| 1183 | 1183 | else |
| 1184 | 1184 | str.append(", "); |
| r253619 | r253620 | |
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | // add the 'press OK' string |
| 1195 | | str.append("\n\nType OK or move the joystick left then right to continue"); |
| 1195 | str.append(_("\n\nType OK or move the joystick left then right to continue")); |
| 1196 | 1196 | return str; |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| r253619 | r253620 | |
| 1251 | 1251 | |
| 1252 | 1252 | // append the Sound: string |
| 1253 | 1253 | if (!found_sound) |
| 1254 | | str.append("\nSound:\n"); |
| 1254 | str.append(_("\nSound:\n")); |
| 1255 | 1255 | found_sound = true; |
| 1256 | 1256 | |
| 1257 | 1257 | // count how many identical sound chips we have |
| r253619 | r253620 | |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | 1281 | // display screen information |
| 1282 | | str.append("\nVideo:\n"); |
| 1282 | str.append(_("\nVideo:\n")); |
| 1283 | 1283 | screen_device_iterator scriter(machine().root_device()); |
| 1284 | 1284 | int scrcount = scriter.count(); |
| 1285 | 1285 | if (scrcount == 0) |
| 1286 | | str.append("None\n"); |
| 1286 | str.append(_("None\n")); |
| 1287 | 1287 | else |
| 1288 | 1288 | { |
| 1289 | 1289 | for (screen_device *screen = scriter.first(); screen != nullptr; screen = scriter.next()) |
| r253619 | r253620 | |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | if (screen->screen_type() == SCREEN_TYPE_VECTOR) |
| 1298 | | str.append("Vector\n"); |
| 1298 | str.append(_("Vector\n")); |
| 1299 | 1299 | else |
| 1300 | 1300 | { |
| 1301 | 1301 | const rectangle &visarea = screen->visible_area(); |
| r253619 | r253620 | |
| 1587 | 1587 | if (machine.ui_active()) |
| 1588 | 1588 | { |
| 1589 | 1589 | machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", |
| 1590 | | "Keyboard Emulation Status", |
| 1590 | _("Keyboard Emulation Status"), |
| 1591 | 1591 | "-------------------------", |
| 1592 | | "Mode: PARTIAL Emulation", |
| 1593 | | "UI: Enabled", |
| 1592 | _("Mode: PARTIAL Emulation"), |
| 1593 | _("UI: Enabled"), |
| 1594 | 1594 | "-------------------------", |
| 1595 | | "**Use ScrLock to toggle**"); |
| 1595 | _("**Use ScrLock to toggle**")); |
| 1596 | 1596 | } |
| 1597 | 1597 | else |
| 1598 | 1598 | { |
| 1599 | 1599 | machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", |
| 1600 | | "Keyboard Emulation Status", |
| 1600 | _("Keyboard Emulation Status"), |
| 1601 | 1601 | "-------------------------", |
| 1602 | | "Mode: FULL Emulation", |
| 1603 | | "UI: Disabled", |
| 1602 | _("Mode: FULL Emulation"), |
| 1603 | _("UI: Disabled"), |
| 1604 | 1604 | "-------------------------", |
| 1605 | | "**Use ScrLock to toggle**"); |
| 1605 | _("**Use ScrLock to toggle**")); |
| 1606 | 1606 | } |
| 1607 | 1607 | } |
| 1608 | 1608 | } |
| r253619 | r253620 | |
| 1746 | 1746 | { |
| 1747 | 1747 | if (!machine.options().cheat()) |
| 1748 | 1748 | { |
| 1749 | | machine.popmessage("Autofire can't be enabled"); |
| 1749 | machine.popmessage(_("Autofire can't be enabled")); |
| 1750 | 1750 | } |
| 1751 | 1751 | else |
| 1752 | 1752 | { |
| 1753 | 1753 | bool autofire_toggle = machine.ioport().get_autofire_toggle(); |
| 1754 | 1754 | machine.ioport().set_autofire_toggle(!autofire_toggle); |
| 1755 | | machine.popmessage("Autofire %s", autofire_toggle ? "Enabled" : "Disabled"); |
| 1755 | machine.popmessage("Autofire %s", autofire_toggle ? _("Enabled") : _("Disabled")); |
| 1756 | 1756 | } |
| 1757 | 1757 | } |
| 1758 | 1758 | |
| r253619 | r253620 | |
| 1785 | 1785 | |
| 1786 | 1786 | // okay, we're waiting for a key to select a slot; display a message |
| 1787 | 1787 | if (state == LOADSAVE_SAVE) |
| 1788 | | machine.ui().draw_message_window(container, "Select position to save to"); |
| 1788 | machine.ui().draw_message_window(container, _("Select position to save to")); |
| 1789 | 1789 | else |
| 1790 | | machine.ui().draw_message_window(container, "Select position to load from"); |
| 1790 | machine.ui().draw_message_window(container, _("Select position to load from")); |
| 1791 | 1791 | |
| 1792 | 1792 | // if load/save state sequence is still being pressed, do not read the filename yet |
| 1793 | 1793 | if (machine.ui().m_load_save_hold) { |
| r253619 | r253620 | |
| 1811 | 1811 | { |
| 1812 | 1812 | // display a popup indicating things were cancelled |
| 1813 | 1813 | if (state == LOADSAVE_SAVE) |
| 1814 | | machine.popmessage("Save cancelled"); |
| 1814 | machine.popmessage(_("Save cancelled")); |
| 1815 | 1815 | else |
| 1816 | | machine.popmessage("Load cancelled"); |
| 1816 | machine.popmessage(_("Load cancelled")); |
| 1817 | 1817 | |
| 1818 | 1818 | // reset the state |
| 1819 | 1819 | machine.resume(); |
| r253619 | r253620 | |
| 1856 | 1856 | // display a popup indicating that the save will proceed |
| 1857 | 1857 | if (state == LOADSAVE_SAVE) |
| 1858 | 1858 | { |
| 1859 | | machine.popmessage("Save to position %s", filename); |
| 1859 | machine.popmessage(_("Save to position %s"), filename); |
| 1860 | 1860 | machine.schedule_save(filename); |
| 1861 | 1861 | } |
| 1862 | 1862 | else |
| 1863 | 1863 | { |
| 1864 | | machine.popmessage("Load from position %s", filename); |
| 1864 | machine.popmessage(_("Load from position %s"), filename); |
| 1865 | 1865 | machine.schedule_load(filename); |
| 1866 | 1866 | } |
| 1867 | 1867 | |
| r253619 | r253620 | |
| 1901 | 1901 | std::string ui_cancel_text = machine.input().seq_name(machine.ioport().type_seq(IPT_UI_CANCEL, 0, SEQ_TYPE_STANDARD)); |
| 1902 | 1902 | |
| 1903 | 1903 | // assemble the quit message |
| 1904 | | std::string quit_message = strformat("Are you sure you want to quit?\n\n" |
| 1904 | std::string quit_message = strformat(_("Are you sure you want to quit?\n\n" |
| 1905 | 1905 | "Press ''%s'' to quit,\n" |
| 1906 | | "Press ''%s'' to return to emulation.", |
| 1906 | "Press ''%s'' to return to emulation."), |
| 1907 | 1907 | ui_select_text.c_str(), |
| 1908 | 1908 | ui_cancel_text.c_str()); |
| 1909 | 1909 | |
| r253619 | r253620 | |
| 1977 | 1977 | int item; |
| 1978 | 1978 | |
| 1979 | 1979 | // add overall volume |
| 1980 | | *tailptr = slider_alloc(machine, "Master Volume", -32, 0, 0, 1, slider_volume, nullptr); |
| 1980 | *tailptr = slider_alloc(machine, _("Master Volume"), -32, 0, 0, 1, slider_volume, nullptr); |
| 1981 | 1981 | tailptr = &(*tailptr)->next; |
| 1982 | 1982 | |
| 1983 | 1983 | // add per-channel volume |
| r253619 | r253620 | |
| 1988 | 1988 | INT32 defval = 1000; |
| 1989 | 1989 | |
| 1990 | 1990 | str.assign(info.stream->input_name(info.inputnum)); |
| 1991 | | str.append(" Volume"); |
| 1991 | str.append(_(" Volume")); |
| 1992 | 1992 | *tailptr = slider_alloc(machine, str.c_str(), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); |
| 1993 | 1993 | tailptr = &(*tailptr)->next; |
| 1994 | 1994 | } |
| r253619 | r253620 | |
| 2091 | 2091 | if (screen->screen_type() == SCREEN_TYPE_VECTOR) |
| 2092 | 2092 | { |
| 2093 | 2093 | // add vector control |
| 2094 | | *tailptr = slider_alloc(machine, "Vector Flicker", 0, 0, 1000, 10, slider_flicker, nullptr); |
| 2094 | *tailptr = slider_alloc(machine, _("Vector Flicker"), 0, 0, 1000, 10, slider_flicker, nullptr); |
| 2095 | 2095 | tailptr = &(*tailptr)->next; |
| 2096 | | *tailptr = slider_alloc(machine, "Beam Width Minimum", 1, 100, 1000, 1, slider_beam_width_min, nullptr); |
| 2096 | *tailptr = slider_alloc(machine, _("Beam Width Minimum"), 1, 100, 1000, 1, slider_beam_width_min, nullptr); |
| 2097 | 2097 | tailptr = &(*tailptr)->next; |
| 2098 | | *tailptr = slider_alloc(machine, "Beam Width Maximum", 1, 100, 1000, 1, slider_beam_width_max, nullptr); |
| 2098 | *tailptr = slider_alloc(machine, _("Beam Width Maximum"), 1, 100, 1000, 1, slider_beam_width_max, nullptr); |
| 2099 | 2099 | tailptr = &(*tailptr)->next; |
| 2100 | | *tailptr = slider_alloc(machine, "Beam Intensity Weight", -1000, 0, 1000, 10, slider_beam_intensity_weight, nullptr); |
| 2100 | *tailptr = slider_alloc(machine, _("Beam Intensity Weight"), -1000, 0, 1000, 10, slider_beam_intensity_weight, nullptr); |
| 2101 | 2101 | tailptr = &(*tailptr)->next; |
| 2102 | 2102 | break; |
| 2103 | 2103 | } |
| r253619 | r253620 | |
| 2537 | 2537 | static char descbuf[256]; |
| 2538 | 2538 | |
| 2539 | 2539 | if (scrcount > 1) |
| 2540 | | sprintf(descbuf, "Screen '%s'", screen.tag()); |
| 2540 | sprintf(descbuf, _("Screen '%s'"), screen.tag()); |
| 2541 | 2541 | else |
| 2542 | | strcpy(descbuf, "Screen"); |
| 2542 | strcpy(descbuf, _("Screen")); |
| 2543 | 2543 | |
| 2544 | 2544 | return descbuf; |
| 2545 | 2545 | } |
| r253619 | r253620 | |
| 2557 | 2557 | if (newval != SLIDER_NOCHANGE) |
| 2558 | 2558 | field->set_crosshair_scale(float(newval) * 0.001); |
| 2559 | 2559 | if (str != nullptr) |
| 2560 | | strprintf(*str,"%s %s %1.3f", "Crosshair Scale", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); |
| 2560 | strprintf(*str,"%s %s %1.3f", _("Crosshair Scale"), (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); |
| 2561 | 2561 | return floor(field->crosshair_scale() * 1000.0f + 0.5f); |
| 2562 | 2562 | } |
| 2563 | 2563 | #endif |
| r253619 | r253620 | |
| 2576 | 2576 | if (newval != SLIDER_NOCHANGE) |
| 2577 | 2577 | field->set_crosshair_offset(float(newval) * 0.001f); |
| 2578 | 2578 | if (str != nullptr) |
| 2579 | | strprintf(*str,"%s %s %1.3f", "Crosshair Offset", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); |
| 2579 | strprintf(*str,"%s %s %1.3f", _("Crosshair Offset"), (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); |
| 2580 | 2580 | return field->crosshair_offset(); |
| 2581 | 2581 | } |
| 2582 | 2582 | #endif |