void running_machine::start() { // initialize basic can't-fail systems here config_init(*this); m_input = auto_alloc(*this, input_manager(*this)); output_init(*this); palette_init(*this); m_render = auto_alloc(*this, render_manager(*this)); generic_machine_init(*this); generic_sound_init(*this); // allocate a soft_reset timer m_soft_reset_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::soft_reset), this)); // init the osd layer m_osd.init(*this); // create the video manager m_video = auto_alloc(*this, video_manager(*this)); ui_init(*this); // initialize the base time (needed for doing record/playback) ::time(&m_base_time); // initialize the input system and input ports for the game // this must be done before memory_init in order to allow specifying // callbacks based on input port tags time_t newbase = input_port_init(*this); if (newbase != 0) m_base_time = newbase; // intialize UI input ui_input_init(*this); // initialize the streams engine before the sound devices start m_sound = auto_alloc(*this, sound_manager(*this)); // first load ROMs, then populate memory, and finally initialize CPUs // these operations must proceed in this order rom_init(*this); memory_init(*this); watchdog_init(*this); // must happen after memory_init because this relies on generic.spriteram generic_video_init(*this); // allocate the gfx elements prior to device initialization gfx_init(*this); // initialize natural keyboard support inputx_init(*this); // initialize image devices image_init(*this); tilemap_init(*this); crosshair_init(*this); // initialize the debugger if ((debug_flags & DEBUG_FLAG_ENABLED) != 0) debugger_init(*this); // call the game driver's init function // this is where decryption is done and memory maps are altered // so this location in the init order is important ui_set_startup_text(*this, "Initializing...", true); // start up the devices const_cast<device_list &>(devicelist()).start_all(); // if we're coming in with a savegame request, process it now const char *savegame = options().state(); if (savegame[0] != 0) schedule_load(savegame); // if we're in autosave mode, schedule a load else if (options().autosave() && (m_system.flags & GAME_SUPPORTS_SAVE) != 0) schedule_load("auto"); // set up the cheat engine m_cheat = auto_alloc(*this, cheat_manager(*this)); // disallow save state registrations starting here m_save.allow_registration(false); }
void running_machine::start() { // initialize basic can't-fail systems here config_init(*this); m_input = auto_alloc(*this, input_manager(*this)); output_init(*this); palette_init(*this); m_render = auto_alloc(*this, render_manager(*this)); generic_machine_init(*this); // allocate a soft_reset timer m_soft_reset_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::soft_reset), this)); // init the osd layer m_osd.init(*this); // create the video manager m_video = auto_alloc(*this, video_manager(*this)); ui_init(*this); // initialize the base time (needed for doing record/playback) ::time(&m_base_time); // initialize the input system and input ports for the game // this must be done before memory_init in order to allow specifying // callbacks based on input port tags time_t newbase = m_ioport.initialize(); if (newbase != 0) m_base_time = newbase; // intialize UI input ui_input_init(*this); // initialize the streams engine before the sound devices start m_sound = auto_alloc(*this, sound_manager(*this)); // first load ROMs, then populate memory, and finally initialize CPUs // these operations must proceed in this order rom_init(*this); m_memory.initialize(); // initialize the watchdog m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this)); if (config().m_watchdog_vblank_count != 0 && primary_screen != NULL) primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this)); save().save_item(NAME(m_watchdog_enabled)); save().save_item(NAME(m_watchdog_counter)); // allocate the gfx elements prior to device initialization gfx_init(*this); // initialize image devices image_init(*this); m_tilemap = auto_alloc(*this, tilemap_manager(*this)); crosshair_init(*this); network_init(*this); // initialize the debugger if ((debug_flags & DEBUG_FLAG_ENABLED) != 0) debugger_init(*this); // call the game driver's init function // this is where decryption is done and memory maps are altered // so this location in the init order is important ui_set_startup_text(*this, "Initializing...", true); // register callbacks for the devices, then start them add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(running_machine::reset_all_devices), this)); add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(running_machine::stop_all_devices), this)); save().register_presave(save_prepost_delegate(FUNC(running_machine::presave_all_devices), this)); start_all_devices(); save().register_postload(save_prepost_delegate(FUNC(running_machine::postload_all_devices), this)); // if we're coming in with a savegame request, process it now const char *savegame = options().state(); if (savegame[0] != 0) schedule_load(savegame); // if we're in autosave mode, schedule a load else if (options().autosave() && (m_system.flags & GAME_SUPPORTS_SAVE) != 0) schedule_load("auto"); // set up the cheat engine m_cheat = auto_alloc(*this, cheat_manager(*this)); // allocate autoboot timer m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this)); // initialize lua m_lua_engine.initialize(); // disallow save state registrations starting here m_save.allow_registration(false); }