summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine.cpp
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2016-10-10 17:14:17 -0400
committer GitHub <noreply@github.com>2016-10-10 17:14:17 -0400
commita3d568c1ba182c44a7ce03ed05ce6f9cadd73d2e (patch)
tree57c593c9f0cdebb8cf99d2f64e3f11db191ab075 /src/emu/machine.cpp
parent705e72d5165a9a3dac866d6333c2805b54373e63 (diff)
parent0d2d4cab4fdfa14d2ef65f2245e82ca4a5c8f2fd (diff)
Merge pull request #1495 from ajrhacker/dirtc
Soft resets no longer turn back clocks on devices
Diffstat (limited to 'src/emu/machine.cpp')
-rw-r--r--src/emu/machine.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index 5e8c5f478d1..adce482a19c 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -79,6 +79,7 @@
#include "unzip.h"
#include "debug/debugvw.h"
#include "debug/debugcpu.h"
+#include "dirtc.h"
#include "image.h"
#include "network.h"
#include "ui/uimain.h"
@@ -267,7 +268,6 @@ void running_machine::start()
else if (options().autosave() && (m_system.flags & MACHINE_SUPPORTS_SAVE) != 0)
schedule_load("auto");
-
manager().update_machine();
}
@@ -300,7 +300,7 @@ int running_machine::run(bool quiet)
// then finish setting up our local machine
start();
- // load the configuration settings and NVRAM
+ // load the configuration settings
m_configuration->load_settings();
// disallow save state registrations starting here.
@@ -308,7 +308,12 @@ int running_machine::run(bool quiet)
// devices with timers.
m_save.allow_registration(false);
+ // load the NVRAM
nvram_load();
+
+ // set the time on RTCs (this may overwrite parts of NVRAM)
+ set_rtc_datetime(system_time(m_base_time));
+
sound().ui_mute(false);
if (!quiet)
sound().start_recording();
@@ -796,6 +801,19 @@ void running_machine::current_datetime(system_time &systime)
//-------------------------------------------------
+// set_rtc_datetime - set the current time on
+// battery-backed RTCs
+//-------------------------------------------------
+
+void running_machine::set_rtc_datetime(const system_time &systime)
+{
+ for (device_rtc_interface &rtc : rtc_interface_iterator(root_device()))
+ if (rtc.has_battery())
+ rtc.set_current_time(systime);
+}
+
+
+//-------------------------------------------------
// rand - standardized random numbers
//-------------------------------------------------
@@ -1171,6 +1189,11 @@ system_time::system_time()
set(0);
}
+system_time::system_time(time_t t)
+{
+ set(t);
+}
+
//-------------------------------------------------
// set - fills out a system_time structure