trunk/src/emu/image.c
| r242966 | r242967 | |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | } |
| 240 | 241 | |
| 242 | /*------------------------------------------------- |
| 243 | image_mandatory_scan - search for devices which |
| 244 | need an image to be loaded |
| 245 | -------------------------------------------------*/ |
| 246 | |
| 247 | astring &image_mandatory_scan(running_machine &machine, astring &mandatory) |
| 248 | { |
| 249 | mandatory.reset(); |
| 250 | // make sure that any required image has a mounted file |
| 251 | image_interface_iterator iter(machine.root_device()); |
| 241 | 252 | for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) |
| 242 | 253 | { |
| 243 | | /* is an image specified for this image */ |
| 244 | | image_name = image->filename(); |
| 245 | | |
| 246 | | if (!((image_name != NULL) && (image_name[0] != '\0'))) |
| 247 | | { |
| 248 | | /* no image... must this device be loaded? */ |
| 249 | | if (image->must_be_loaded()) |
| 250 | | { |
| 251 | | fatalerror_exitcode(machine, MAMERR_DEVICE, "Driver requires that device \"%s\" must have an image to load", image->instance_name()); |
| 252 | | } |
| 253 | | } |
| 254 | if (image->filename() == NULL && image->must_be_loaded()) |
| 255 | mandatory.cat("\"").cat(image->instance_name()).cat("\", "); |
| 254 | 256 | } |
| 257 | return mandatory; |
| 255 | 258 | } |
| 256 | 259 | |
| 257 | 260 | /*------------------------------------------------- |
trunk/src/emu/ui/filemngr.c
| r242966 | r242967 | |
| 20 | 20 | #include "ui/swlist.h" |
| 21 | 21 | #include "ui/filemngr.h" |
| 22 | 22 | #include "ui/filesel.h" |
| 23 | #include "ui/miscmenu.h" |
| 23 | 24 | |
| 24 | 25 | |
| 25 | 26 | /*************************************************************************** |
| r242966 | r242967 | |
| 30 | 31 | // ctor |
| 31 | 32 | //------------------------------------------------- |
| 32 | 33 | |
| 33 | | ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 34 | ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings) : ui_menu(machine, container) |
| 34 | 35 | { |
| 36 | // This warning string is used when accessing from the force_file_manager call, i.e. |
| 37 | // when the file manager is loaded top front in the case of mandatory image devices |
| 38 | if (warnings) |
| 39 | m_warnings.cpy(warnings); |
| 40 | else |
| 41 | m_warnings.reset(); |
| 35 | 42 | } |
| 36 | 43 | |
| 37 | 44 | |
| r242966 | r242967 | |
| 101 | 108 | bool first_entry = true; |
| 102 | 109 | astring prev_owner; |
| 103 | 110 | |
| 111 | if (m_warnings) |
| 112 | { |
| 113 | item_append(m_warnings, NULL, MENU_FLAG_DISABLE, NULL); |
| 114 | item_append("", NULL, MENU_FLAG_DISABLE, NULL); |
| 115 | } |
| 116 | |
| 104 | 117 | // cycle through all devices for this system |
| 105 | 118 | device_iterator iter(machine().root_device()); |
| 106 | 119 | tagmap_t<UINT8> devtags; |
| r242966 | r242967 | |
| 172 | 185 | } |
| 173 | 186 | } |
| 174 | 187 | } |
| 188 | |
| 189 | // force file manager menu |
| 190 | void ui_menu_file_manager::force_file_manager(running_machine &machine, render_container *container, const char *warnings) |
| 191 | { |
| 192 | // reset the menu stack |
| 193 | ui_menu::stack_reset(machine); |
| 194 | |
| 195 | // add the quit entry followed by the game select entry |
| 196 | ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container)); |
| 197 | quit->set_special_main_menu(true); |
| 198 | ui_menu::stack_push(quit); |
| 199 | ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_file_manager(machine, container, warnings))); |
| 200 | |
| 201 | // force the menus on |
| 202 | machine.ui().show_menu(); |
| 203 | |
| 204 | // make sure MAME is paused |
| 205 | machine.pause(); |
| 206 | } |
trunk/src/emu/ui/filemngr.h
| r242966 | r242967 | |
| 20 | 20 | astring current_file; |
| 21 | 21 | device_image_interface *selected_device; |
| 22 | 22 | |
| 23 | | ui_menu_file_manager(running_machine &machine, render_container *container); |
| 23 | static void force_file_manager(running_machine &machine, render_container *container, const char *warnings); |
| 24 | |
| 25 | ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings); |
| 24 | 26 | virtual ~ui_menu_file_manager(); |
| 25 | 27 | virtual void populate(); |
| 26 | 28 | virtual void handle(); |
| 27 | 29 | virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2); |
| 28 | 30 | |
| 29 | 31 | void fill_image_line(device_image_interface *img, astring &instance, astring &filename); |
| 32 | |
| 33 | private: |
| 34 | astring m_warnings; |
| 30 | 35 | }; |
| 31 | 36 | |
| 32 | 37 | #endif /* __UI_FILEMNGR_H__ */ |
trunk/src/emu/ui/ui.c
| r242966 | r242967 | |
| 20 | 20 | #include "uiinput.h" |
| 21 | 21 | #include "ui/mainmenu.h" |
| 22 | 22 | #include "ui/miscmenu.h" |
| 23 | #include "ui/filemngr.h" |
| 23 | 24 | #include "ui/viewgfx.h" |
| 24 | 25 | #include "imagedev/cassette.h" |
| 25 | 26 | #include <ctype.h> |
| r242966 | r242967 | |
| 306 | 307 | |
| 307 | 308 | void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer) |
| 308 | 309 | { |
| 309 | | const int maxstate = 3; |
| 310 | const int maxstate = 4; |
| 310 | 311 | int str = machine().options().seconds_to_run(); |
| 311 | 312 | bool show_gameinfo = !machine().options().skip_gameinfo(); |
| 312 | 313 | bool show_warnings = true; |
| r242966 | r242967 | |
| 352 | 353 | if (show_gameinfo && game_info_astring(messagebox_text).len() > 0) |
| 353 | 354 | set_handler(handler_messagebox_anykey, 0); |
| 354 | 355 | break; |
| 356 | |
| 357 | case 3: |
| 358 | if (image_mandatory_scan(machine(), messagebox_text).len() > 0) |
| 359 | { |
| 360 | astring warning; |
| 361 | warning.cpy("This driver requires images to be loaded in the following device(s): ").cat(messagebox_text.substr(0, messagebox_text.len() - 2)); |
| 362 | ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.cstr()); |
| 363 | } |
| 364 | break; |
| 355 | 365 | } |
| 356 | 366 | |
| 357 | 367 | // clear the input memory |