Previous 199869 Revisions Next

r34455 Sunday 18th January, 2015 at 11:10:51 UTC by Fabio Priuli
ui: stop the game selector reporting systems with no roms as
missing files. [Fabio Priuli]

ui: when launching systems with mandatory carts, either from
command line or from the game selector, prompt the user with
the file manager menu so that he can mount a game where
needed, instead of killing emulation with an error. [Fabio Priuli]

out of whatsnew: it is now finally possible to launch nes and
snes and a2600 (and a few more) from the internal system
selector! also MESS doesn't error out anymore if you launch
such systems with no carts mounted from command line.

in short: emulation finally behaves as users typically expect!
[src/emu]image.c image.h
[src/emu/ui]filemngr.c filemngr.h imgcntrl.c mainmenu.c selgame.c ui.c

trunk/src/emu/image.c
r242966r242967
237237         }
238238      }
239239   }
240}
240241
242/*-------------------------------------------------
243 image_mandatory_scan - search for devices which
244 need an image to be loaded
245 -------------------------------------------------*/
246
247astring &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());
241252   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
242253   {
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("\", ");
254256   }
257   return mandatory;
255258}
256259
257260/*-------------------------------------------------
trunk/src/emu/image.h
r242966r242967
2020
2121void image_init(running_machine &machine);
2222void image_postdevice_init(running_machine &machine);
23astring &image_mandatory_scan(running_machine &machine, astring &mandatory);
2324
2425extern struct io_procs image_ioprocs;
2526
trunk/src/emu/ui/filemngr.c
r242966r242967
2020#include "ui/swlist.h"
2121#include "ui/filemngr.h"
2222#include "ui/filesel.h"
23#include "ui/miscmenu.h"
2324
2425
2526/***************************************************************************
r242966r242967
3031//  ctor
3132//-------------------------------------------------
3233
33ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container) : ui_menu(machine, container)
34ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings) : ui_menu(machine, container)
3435{
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();
3542}
3643
3744
r242966r242967
101108   bool first_entry = true;
102109   astring prev_owner;
103110
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     
104117   // cycle through all devices for this system
105118   device_iterator iter(machine().root_device());
106119   tagmap_t<UINT8> devtags;
r242966r242967
172185      }
173186   }
174187}
188
189// force file manager menu
190void 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
r242966r242967
2020   astring current_file;
2121   device_image_interface *selected_device;
2222
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);
2426   virtual ~ui_menu_file_manager();
2527   virtual void populate();
2628   virtual void handle();
2729   virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
2830
2931   void fill_image_line(device_image_interface *img, astring &instance, astring &filename);
32
33private:
34   astring m_warnings;
3035};
3136
3237#endif  /* __UI_FILEMNGR_H__ */
trunk/src/emu/ui/imgcntrl.c
r242966r242967
217217      {
218218         swp = swi->first_part();
219219         load_software_part();
220         ui_menu::stack_pop(machine());
221220      }
222221      break;
223222
r242966r242967
225224      switch(submenu_result) {
226225      case ui_menu_software_parts::T_ENTRY: {
227226         load_software_part();
228         ui_menu::stack_pop(machine());
229227         break;
230228      }
231229
trunk/src/emu/ui/mainmenu.c
r242966r242967
183183         break;
184184
185185      case IMAGE_MENU_FILE_MANAGER:
186         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
186         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container, NULL)));
187187         break;
188188
189189      case TAPE_CONTROL:
trunk/src/emu/ui/selgame.c
r242966r242967
157157      media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST);
158158
159159      // if everything looks good, schedule the new driver
160      if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE)
160      if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
161161      {
162162         machine().manager().schedule_new_driver(*driver);
163163         machine().schedule_hard_reset();
trunk/src/emu/ui/ui.c
r242966r242967
2020#include "uiinput.h"
2121#include "ui/mainmenu.h"
2222#include "ui/miscmenu.h"
23#include "ui/filemngr.h"
2324#include "ui/viewgfx.h"
2425#include "imagedev/cassette.h"
2526#include <ctype.h>
r242966r242967
306307
307308void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer)
308309{
309   const int maxstate = 3;
310   const int maxstate = 4;
310311   int str = machine().options().seconds_to_run();
311312   bool show_gameinfo = !machine().options().skip_gameinfo();
312313   bool show_warnings = true;
r242966r242967
352353            if (show_gameinfo && game_info_astring(messagebox_text).len() > 0)
353354               set_handler(handler_messagebox_anykey, 0);
354355            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;
355365      }
356366
357367      // clear the input memory


Previous 199869 Revisions Next


© 1997-2024 The MAME Team