summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMat M <mathew1800@gmail.com>2016-07-19 23:09:43 -0400
committerGitHub <noreply@github.com>2016-07-19 23:09:43 -0400
commit3fbd781cb8ee319a99658366bc823035d30d0e49 (patch)
tree0ae25e854be407dd7291a5e67808caa27657f964 /Source
parent7b9e17b72d70860cc81ae4530d56b4675a747dec (diff)
parent80ac4a359d81935371ed3b31c129dd13d9c9af5c (diff)
Merge pull request #4033 from RisingFog/configurable_rtc
Disable changing Custom RTC when game is running
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/HW/EXI_DeviceIPL.cpp10
-rw-r--r--Source/Core/Core/HW/SystemTimers.cpp14
-rw-r--r--Source/Core/Core/HW/SystemTimers.h2
-rw-r--r--Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp14
4 files changed, 23 insertions, 17 deletions
diff --git a/Source/Core/Core/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/HW/EXI_DeviceIPL.cpp
index c4e5b3834d..25266f9498 100644
--- a/Source/Core/Core/HW/EXI_DeviceIPL.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceIPL.cpp
@@ -421,18 +421,10 @@ u32 CEXIIPL::GetGCTime()
// let's keep time moving forward, regardless of what it starts at
ltime += CoreTiming::GetTicks() / SystemTimers::GetTicksPerSecond();
}
- else if (SConfig::GetInstance().bEnableCustomRTC)
- {
- _assert_(!Core::g_want_determinism);
- ltime = SConfig::GetInstance().m_customRTCValue;
-
- // let's keep time moving forward, regardless of what it starts at
- ltime += Common::Timer::GetLocalTimeSinceJan1970() - SystemTimers::GetLocalTimeOnBoot();
- }
else
{
_assert_(!Core::g_want_determinism);
- ltime = Common::Timer::GetLocalTimeSinceJan1970();
+ ltime = Common::Timer::GetLocalTimeSinceJan1970() - SystemTimers::GetLocalTimeRTCOffset();
}
return ((u32)ltime - cJanuary2000);
diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp
index f387df4fb2..6736d191b7 100644
--- a/Source/Core/Core/HW/SystemTimers.cpp
+++ b/Source/Core/Core/HW/SystemTimers.cpp
@@ -84,7 +84,7 @@ static int s_audio_dma_period;
static int s_ipc_hle_period;
// Custom RTC
-static u64 s_localtime_on_boot;
+static s64 s_localtime_rtc_offset = 0;
u32 GetTicksPerSecond()
{
@@ -160,9 +160,9 @@ u64 GetFakeTimeBase()
((CoreTiming::GetTicks() - CoreTiming::GetFakeTBStartTicks()) / TIMER_RATIO);
}
-u64 GetLocalTimeOnBoot()
+s64 GetLocalTimeRTCOffset()
{
- return s_localtime_on_boot;
+ return s_localtime_rtc_offset;
}
static void PatchEngineCallback(u64 userdata, s64 cyclesLate)
@@ -228,7 +228,11 @@ void Init()
Common::Timer::IncreaseResolution();
// store and convert localtime at boot to timebase ticks
- s_localtime_on_boot = Common::Timer::GetLocalTimeSinceJan1970();
+ if (SConfig::GetInstance().bEnableCustomRTC)
+ {
+ s_localtime_rtc_offset =
+ Common::Timer::GetLocalTimeSinceJan1970() - SConfig::GetInstance().m_customRTCValue;
+ }
CoreTiming::SetFakeTBStartValue((u64)(s_cpu_core_clock / TIMER_RATIO) *
(u64)CEXIIPL::GetGCTime());
CoreTiming::SetFakeTBStartTicks(CoreTiming::GetTicks());
@@ -258,7 +262,7 @@ void Init()
void Shutdown()
{
Common::Timer::RestoreResolution();
- s_localtime_on_boot = 0;
+ s_localtime_rtc_offset = 0;
}
} // namespace
diff --git a/Source/Core/Core/HW/SystemTimers.h b/Source/Core/Core/HW/SystemTimers.h
index 9f56d1da99..ba060993d0 100644
--- a/Source/Core/Core/HW/SystemTimers.h
+++ b/Source/Core/Core/HW/SystemTimers.h
@@ -45,5 +45,5 @@ u32 GetFakeDecrementer();
void TimeBaseSet();
u64 GetFakeTimeBase();
// Custom RTC
-u64 GetLocalTimeOnBoot();
+s64 GetLocalTimeRTCOffset();
}
diff --git a/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp b/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp
index 40bb89ce12..b24f81036a 100644
--- a/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp
+++ b/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp
@@ -15,6 +15,7 @@
#include <wx/timectrl.h>
#include "Core/ConfigManager.h"
+#include "Core/Core.h"
#include "DolphinWX/Config/AdvancedConfigPane.h"
AdvancedConfigPane::AdvancedConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
@@ -186,8 +187,17 @@ void AdvancedConfigPane::LoadCustomRTC()
else
m_custom_rtc_date_picker->SetRange(wxDateTime(1, wxDateTime::Jan, 2000),
wxDateTime(31, wxDateTime::Dec, 2099));
- m_custom_rtc_date_picker->Enable(custom_rtc_enabled);
- m_custom_rtc_time_picker->Enable(custom_rtc_enabled);
+ if (Core::IsRunning())
+ {
+ m_custom_rtc_checkbox->Enable(false);
+ m_custom_rtc_date_picker->Enable(false);
+ m_custom_rtc_time_picker->Enable(false);
+ }
+ else
+ {
+ m_custom_rtc_date_picker->Enable(custom_rtc_enabled);
+ m_custom_rtc_time_picker->Enable(custom_rtc_enabled);
+ }
}
void AdvancedConfigPane::UpdateCustomRTC(time_t date, time_t time)