Merge pull request #4007 from RisingFog/configurable_rtc
Add Configurable RTC options
This commit is contained in:
commit
e32af8e0fe
10 files changed
+148
-5
No files matched your search
@@ -275,6 +275,8 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
||||
core->Set("GFXBackend", m_strVideoBackend);
|
||||
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
|
||||
core->Set("PerfMapDir", m_perfDir);
|
||||
core->Set("EnableCustomRTC", bEnableCustomRTC);
|
||||
core->Set("CustomRTCValue", m_customRTCValue);
|
||||
}
|
||||
|
||||
void SConfig::SaveMovieSettings(IniFile& ini)
|
||||
@@ -553,6 +555,9 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
||||
core->Get("GFXBackend", &m_strVideoBackend, "");
|
||||
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
|
||||
core->Get("PerfMapDir", &m_perfDir, "");
|
||||
core->Get("EnableCustomRTC", &bEnableCustomRTC, false);
|
||||
// Default to seconds between 1.1.1970 and 1.1.2000
|
||||
core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
|
||||
}
|
||||
|
||||
void SConfig::LoadMovieSettings(IniFile& ini)
|
||||
|
||||
@@ -139,6 +139,10 @@ struct SConfig : NonCopyable
|
||||
// Fifo Player related settings
|
||||
bool bLoopFifoReplay;
|
||||
|
||||
// Custom RTC
|
||||
bool bEnableCustomRTC;
|
||||
u32 m_customRTCValue;
|
||||
|
||||
enum EBootBS2
|
||||
{
|
||||
BOOT_DEFAULT,
|
||||
|
||||
@@ -421,6 +421,14 @@ 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);
|
||||
|
||||
@@ -83,6 +83,9 @@ static int s_audio_dma_period;
|
||||
// we can just increase this number.
|
||||
static int s_ipc_hle_period;
|
||||
|
||||
// Custom RTC
|
||||
static u64 s_localtime_on_boot;
|
||||
|
||||
u32 GetTicksPerSecond()
|
||||
{
|
||||
return s_cpu_core_clock;
|
||||
@@ -157,6 +160,11 @@ u64 GetFakeTimeBase()
|
||||
((CoreTiming::GetTicks() - CoreTiming::GetFakeTBStartTicks()) / TIMER_RATIO);
|
||||
}
|
||||
|
||||
u64 GetLocalTimeOnBoot()
|
||||
{
|
||||
return s_localtime_on_boot;
|
||||
}
|
||||
|
||||
static void PatchEngineCallback(u64 userdata, s64 cyclesLate)
|
||||
{
|
||||
// Patch mem and run the Action Replay
|
||||
@@ -220,6 +228,7 @@ void Init()
|
||||
|
||||
Common::Timer::IncreaseResolution();
|
||||
// store and convert localtime at boot to timebase ticks
|
||||
s_localtime_on_boot = Common::Timer::GetLocalTimeSinceJan1970();
|
||||
CoreTiming::SetFakeTBStartValue((u64)(s_cpu_core_clock / TIMER_RATIO) *
|
||||
(u64)CEXIIPL::GetGCTime());
|
||||
CoreTiming::SetFakeTBStartTicks(CoreTiming::GetTicks());
|
||||
@@ -249,6 +258,7 @@ void Init()
|
||||
void Shutdown()
|
||||
{
|
||||
Common::Timer::RestoreResolution();
|
||||
s_localtime_on_boot = 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -44,4 +44,6 @@ u32 GetFakeDecrementer();
|
||||
|
||||
void TimeBaseSet();
|
||||
u64 GetFakeTimeBase();
|
||||
// Custom RTC
|
||||
u64 GetLocalTimeOnBoot();
|
||||
}
|
||||
@@ -518,6 +518,10 @@ bool BeginRecordingInput(int controllers)
|
||||
s_bNetPlay = true;
|
||||
s_recordingStartTime = CEXIIPL::NetPlay_GetGCTime();
|
||||
}
|
||||
else if (SConfig::GetInstance().bEnableCustomRTC)
|
||||
{
|
||||
s_recordingStartTime = SConfig::GetInstance().m_customRTCValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_recordingStartTime = Common::Timer::GetLocalTimeSinceJan1970();
|
||||
|
||||
@@ -792,7 +792,10 @@ bool NetPlayServer::StartGame()
|
||||
// no change, just update with clients
|
||||
AdjustPadBufferSize(m_target_buffer_size);
|
||||
|
||||
g_netplay_initial_gctime = Common::Timer::GetLocalTimeSinceJan1970();
|
||||
if (SConfig::GetInstance().bEnableCustomRTC)
|
||||
g_netplay_initial_gctime = SConfig::GetInstance().m_customRTCValue;
|
||||
else
|
||||
g_netplay_initial_gctime = Common::Timer::GetLocalTimeSinceJan1970();
|
||||
|
||||
// tell clients to start game
|
||||
auto spac = std::make_unique<sf::Packet>();
|
||||
|
||||
Reference in new issue
Block a user