Autoboot command support added [Ben Geeves,Miodrag Milanovic]

This commit is contained in:
Miodrag Milanovic 2013-05-06 17:14:13 +00:00
parent d340c15ba0
commit 715ac716d5
4 changed files with 24 additions and 1 deletions

View File

@ -195,6 +195,8 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_RAMSIZE ";ram", NULL, OPTION_STRING, "size of RAM (if supported by driver)" },
{ OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" },
{ OPTION_UI_MOUSE, "0", OPTION_BOOLEAN, "display ui mouse cursor" },
{ OPTION_AUTOBOOT_COMMAND ";ab", NULL, OPTION_STRING, "command to execute after machine boot" },
{ OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" },
{ NULL }
};

View File

@ -199,6 +199,8 @@ enum
#define OPTION_CONFIRM_QUIT "confirm_quit"
#define OPTION_UI_MOUSE "ui_mouse"
#define OPTION_AUTOBOOT_COMMAND "autoboot_command"
#define OPTION_AUTOBOOT_DELAY "autoboot_delay"
//**************************************************************************
// TYPE DEFINITIONS
@ -352,6 +354,9 @@ public:
bool confirm_quit() const { return bool_value(OPTION_CONFIRM_QUIT); }
bool ui_mouse() const { return bool_value(OPTION_UI_MOUSE); }
const char *autoboot_command() const { return value(OPTION_AUTOBOOT_COMMAND); }
int autoboot_delay() const { return int_value(OPTION_AUTOBOOT_DELAY); }
// device-specific options
const char *device_option(device_image_interface &image);

View File

@ -232,6 +232,13 @@ const char *running_machine::describe_context()
return m_context;
}
TIMER_CALLBACK_MEMBER(running_machine::autoboot_callback)
{
if (strlen(options().autoboot_command())!=0) {
ioport().natkeyboard().post_utf8(options().autoboot_command());
ioport().natkeyboard().post_utf8("\r");
}
}
//-------------------------------------------------
// start - initialize the emulated machine
@ -322,6 +329,9 @@ void running_machine::start()
// set up the cheat engine
m_cheat = auto_alloc(*this, cheat_manager(*this));
/* allocate a timer */
m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this));
// disallow save state registrations starting here
m_save.allow_registration(false);
}
@ -839,8 +849,11 @@ void running_machine::soft_reset(void *ptr, INT32 param)
// call all registered reset callbacks
call_notifiers(MACHINE_NOTIFY_RESET);
// setup autoboot if needed
m_autoboot_timer->adjust(attotime(options().autoboot_delay(),0),0);
// now we're running
m_current_phase = MACHINE_PHASE_RUNNING;
m_current_phase = MACHINE_PHASE_RUNNING;
}

View File

@ -329,6 +329,8 @@ private:
void stop_all_devices();
void presave_all_devices();
void postload_all_devices();
TIMER_CALLBACK_MEMBER(autoboot_callback);
// internal state
const machine_config & m_config; // reference to the constructed machine_config
@ -415,6 +417,7 @@ private:
memory_manager m_memory; // memory manager
ioport_manager m_ioport; // I/O port manager
device_scheduler m_scheduler; // scheduler object
emu_timer *m_autoboot_timer; // autoboot timer
};