summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/machine.cpp')
-rw-r--r--src/emu/machine.cpp147
1 files changed, 82 insertions, 65 deletions
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index a80a9c1aa74..5119dec397c 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -2,69 +2,69 @@
// copyright-holders:Aaron Giles
/***************************************************************************
- machine.c
+ machine.c
- Controls execution of the core MAME system.
+ Controls execution of the core MAME system.
****************************************************************************
- Since there has been confusion in the past over the order of
- initialization and other such things, here it is, all spelled out
- as of January, 2008:
-
- main()
- - does platform-specific init
- - calls mame_execute() [mame.c]
-
- mame_execute() [mame.c]
- - calls mame_validitychecks() [validity.c] to perform validity checks on all compiled drivers
- - begins resource tracking (level 1)
- - calls create_machine [mame.c] to initialize the running_machine structure
- - calls init_machine() [mame.c]
-
- init_machine() [mame.c]
- - calls fileio_init() [fileio.c] to initialize file I/O info
- - calls config_init() [config.c] to initialize configuration system
- - calls input_init() [input.c] to initialize the input system
- - calls output_init() [output.c] to initialize the output system
- - calls state_init() [state.c] to initialize save state system
- - calls state_save_allow_registration() [state.c] to allow registrations
- - calls palette_init() [palette.c] to initialize palette system
- - calls render_init() [render.c] to initialize the rendering system
- - calls ui_init() [ui.c] to initialize the user interface
- - calls generic_machine_init() [machine/generic.c] to initialize generic machine structures
- - calls timer_init() [timer.c] to reset the timer system
- - calls osd_init() [osdepend.h] to do platform-specific initialization
- - calls input_port_init() [inptport.c] to set up the input ports
- - calls rom_init() [romload.c] to load the game's ROMs
- - calls memory_init() [memory.c] to process the game's memory maps
- - calls the driver's DRIVER_INIT callback
- - calls device_list_start() [devintrf.c] to start any devices
- - calls video_init() [video.c] to start the video system
- - calls tilemap_init() [tilemap.c] to start the tilemap system
- - calls crosshair_init() [crsshair.c] to configure the crosshairs
- - calls sound_init() [sound.c] to start the audio system
- - calls debugger_init() [debugger.c] to set up the debugger
- - calls the driver's MACHINE_START, SOUND_START, and VIDEO_START callbacks
- - calls cheat_init() [cheat.c] to initialize the cheat system
- - calls image_init() [image.c] to initialize the image system
-
- - calls config_load_settings() [config.c] to load the configuration file
- - calls nvram_load [machine/generic.c] to load NVRAM
- - calls ui_display_startup_screens() [ui.c] to display the startup screens
- - begins resource tracking (level 2)
- - calls soft_reset() [mame.c] to reset all systems
-
- -------------------( at this point, we're up and running )----------------------
-
- - calls scheduler->timeslice() [schedule.c] over and over until we exit
- - ends resource tracking (level 2), freeing all auto_mallocs and timers
- - calls the nvram_save() [machine/generic.c] to save NVRAM
- - calls config_save_settings() [config.c] to save the game's configuration
- - calls all registered exit routines [mame.c]
- - ends resource tracking (level 1), freeing all auto_mallocs and timers
-
- - exits the program
+ Since there has been confusion in the past over the order of
+ initialization and other such things, here it is, all spelled out
+ as of January, 2008:
+
+ main()
+ - does platform-specific init
+ - calls mame_execute() [mame.c]
+
+ mame_execute() [mame.c]
+ - calls mame_validitychecks() [validity.c] to perform validity checks on all compiled drivers
+ - begins resource tracking (level 1)
+ - calls create_machine [mame.c] to initialize the running_machine structure
+ - calls init_machine() [mame.c]
+
+ init_machine() [mame.c]
+ - calls fileio_init() [fileio.c] to initialize file I/O info
+ - calls config_init() [config.c] to initialize configuration system
+ - calls input_init() [input.c] to initialize the input system
+ - calls output_init() [output.c] to initialize the output system
+ - calls state_init() [state.c] to initialize save state system
+ - calls state_save_allow_registration() [state.c] to allow registrations
+ - calls palette_init() [palette.c] to initialize palette system
+ - calls render_init() [render.c] to initialize the rendering system
+ - calls ui_init() [ui.c] to initialize the user interface
+ - calls generic_machine_init() [machine/generic.c] to initialize generic machine structures
+ - calls timer_init() [timer.c] to reset the timer system
+ - calls osd_init() [osdepend.h] to do platform-specific initialization
+ - calls input_port_init() [inptport.c] to set up the input ports
+ - calls rom_init() [romload.c] to load the game's ROMs
+ - calls memory_init() [memory.c] to process the game's memory maps
+ - calls the driver's DRIVER_INIT callback
+ - calls device_list_start() [devintrf.c] to start any devices
+ - calls video_init() [video.c] to start the video system
+ - calls tilemap_init() [tilemap.c] to start the tilemap system
+ - calls crosshair_init() [crsshair.c] to configure the crosshairs
+ - calls sound_init() [sound.c] to start the audio system
+ - calls debugger_init() [debugger.c] to set up the debugger
+ - calls the driver's MACHINE_START, SOUND_START, and VIDEO_START callbacks
+ - calls cheat_init() [cheat.c] to initialize the cheat system
+ - calls image_init() [image.c] to initialize the image system
+
+ - calls config_load_settings() [config.c] to load the configuration file
+ - calls nvram_load [machine/generic.c] to load NVRAM
+ - calls ui_display_startup_screens() [ui.c] to display the startup screens
+ - begins resource tracking (level 2)
+ - calls soft_reset() [mame.c] to reset all systems
+
+ -------------------( at this point, we're up and running )----------------------
+
+ - calls scheduler->timeslice() [schedule.c] over and over until we exit
+ - ends resource tracking (level 2), freeing all auto_mallocs and timers
+ - calls the nvram_save() [machine/generic.c] to save NVRAM
+ - calls config_save_settings() [config.c] to save the game's configuration
+ - calls all registered exit routines [mame.c]
+ - ends resource tracking (level 1), freeing all auto_mallocs and timers
+
+ - exits the program
***************************************************************************/
@@ -78,6 +78,8 @@
#include "uiinput.h"
#include "crsshair.h"
#include "unzip.h"
+#include "ui/datfile.h"
+#include "ui/inifile.h"
#include "debug/debugvw.h"
#include "image.h"
#include "luaengine.h"
@@ -186,7 +188,10 @@ const char *running_machine::describe_context()
{
cpu_device *cpu = dynamic_cast<cpu_device *>(&executing->device());
if (cpu != nullptr)
- strprintf(m_context, "'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM).logaddrchars(), cpu->is_octal()));
+ {
+ address_space &prg = cpu->space(AS_PROGRAM);
+ strprintf(m_context, "'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), prg.logaddrchars(), prg.is_octal()));
+ }
}
else
m_context.assign("(no context)");
@@ -232,6 +237,10 @@ void running_machine::start()
// create the video manager
m_video = std::make_unique<video_manager>(*this);
m_ui = std::make_unique<ui_manager>(*this);
+ m_ui->init();
+
+ // start the inifile manager
+ m_inifile = std::make_unique<inifile_manager>(*this);
// initialize the base time (needed for doing record/playback)
::time(&m_base_time);
@@ -305,6 +314,12 @@ void running_machine::start()
// allocate autoboot timer
m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this));
+ // start datfile manager
+ m_datfile = std::make_unique<datfile_manager>(*this);
+
+ // start favorite manager
+ m_favorite = std::make_unique<favorite_manager>(*this);
+
manager().update_machine();
}
@@ -372,8 +387,10 @@ int running_machine::run(bool firstrun)
// execute CPUs if not paused
if (!m_paused)
+ {
m_scheduler.timeslice();
-
+ manager().lua()->periodic_check();
+ }
// otherwise, just pump video updates through
else
m_video->frame_update();
@@ -1309,12 +1326,12 @@ void system_time::full_time::set(struct tm &t)
{
second = t.tm_sec;
minute = t.tm_min;
- hour = t.tm_hour;
- mday = t.tm_mday;
+ hour = t.tm_hour;
+ mday = t.tm_mday;
month = t.tm_mon;
- year = t.tm_year + 1900;
+ year = t.tm_year + 1900;
weekday = t.tm_wday;
- day = t.tm_yday;
+ day = t.tm_yday;
is_dst = t.tm_isdst;
}