Previous 199869 Revisions Next

r22686 Monday 6th May, 2013 at 17:14:13 UTC by Miodrag Milanović
Autoboot command support added [Ben Geeves,Miodrag Milanovic]
[src/emu]emuopts.c emuopts.h machine.c machine.h

trunk/src/emu/emuopts.c
r22685r22686
195195   { OPTION_RAMSIZE ";ram",                             NULL,        OPTION_STRING,     "size of RAM (if supported by driver)" },
196196   { OPTION_CONFIRM_QUIT,                               "0",         OPTION_BOOLEAN,    "display confirm quit screen on exit" },
197197   { OPTION_UI_MOUSE,                                   "0",         OPTION_BOOLEAN,    "display ui mouse cursor" },
198   { OPTION_AUTOBOOT_COMMAND ";ab",                     NULL,        OPTION_STRING,     "command to execute after machine boot" },
199   { OPTION_AUTOBOOT_DELAY,                             "2",         OPTION_INTEGER,    "timer delay in sec to trigger command execution on autoboot" },
198200   { NULL }
199201};
200202
trunk/src/emu/emuopts.h
r22685r22686
199199#define OPTION_CONFIRM_QUIT         "confirm_quit"
200200#define OPTION_UI_MOUSE             "ui_mouse"
201201
202#define OPTION_AUTOBOOT_COMMAND      "autoboot_command"
203#define OPTION_AUTOBOOT_DELAY      "autoboot_delay"
202204
203205//**************************************************************************
204206//  TYPE DEFINITIONS
r22685r22686
352354
353355   bool confirm_quit() const { return bool_value(OPTION_CONFIRM_QUIT); }
354356   bool ui_mouse() const { return bool_value(OPTION_UI_MOUSE); }
357   
358   const char *autoboot_command() const { return value(OPTION_AUTOBOOT_COMMAND); }
359   int autoboot_delay() const { return int_value(OPTION_AUTOBOOT_DELAY); }
355360
356361   // device-specific options
357362   const char *device_option(device_image_interface &image);
trunk/src/emu/machine.c
r22685r22686
232232   return m_context;
233233}
234234
235TIMER_CALLBACK_MEMBER(running_machine::autoboot_callback)
236{
237   if (strlen(options().autoboot_command())!=0) {
238      ioport().natkeyboard().post_utf8(options().autoboot_command());
239      ioport().natkeyboard().post_utf8("\r");   
240   }
241}
235242
236243//-------------------------------------------------
237244//  start - initialize the emulated machine
r22685r22686
322329   // set up the cheat engine
323330   m_cheat = auto_alloc(*this, cheat_manager(*this));
324331
332   /* allocate a timer */
333   m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this));
334
325335   // disallow save state registrations starting here
326336   m_save.allow_registration(false);
327337}
r22685r22686
839849   // call all registered reset callbacks
840850   call_notifiers(MACHINE_NOTIFY_RESET);
841851
852   // setup autoboot if needed
853   m_autoboot_timer->adjust(attotime(options().autoboot_delay(),0),0);
854   
842855   // now we're running
843   m_current_phase = MACHINE_PHASE_RUNNING;
856   m_current_phase = MACHINE_PHASE_RUNNING;   
844857}
845858
846859
trunk/src/emu/machine.h
r22685r22686
329329   void stop_all_devices();
330330   void presave_all_devices();
331331   void postload_all_devices();
332   
333   TIMER_CALLBACK_MEMBER(autoboot_callback);
332334
333335   // internal state
334336   const machine_config &  m_config;               // reference to the constructed machine_config
r22685r22686
415417   memory_manager          m_memory;               // memory manager
416418   ioport_manager          m_ioport;               // I/O port manager
417419   device_scheduler        m_scheduler;            // scheduler object
420   emu_timer              *m_autoboot_timer;      // autoboot timer
418421};
419422
420423

Previous 199869 Revisions Next


© 1997-2024 The MAME Team