From 224a9426db99bdfcbc7e206db9e6539afb2b3b93 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Wed, 9 May 2018 02:45:56 -0400 Subject: [PATCH] Fix the Wii epoch and make the IPL.CB 0 by default It was off by about 8 years because it was actually the same as the GC epoch, however, the reason it worked all this time was because the default RTC counter bias of the Wii was not 0, but a value that is about 8 years in seconds. This broke custom RTC as a custom RTC of the gc epoch was underflowing b ecause the wii epoch was thought to be much later. --- Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp | 4 +--- Source/Core/Core/HW/EXI/EXI_DeviceIPL.h | 7 ++----- Source/Core/Core/SysConf.cpp | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp index 79a5a8027b..cda6a3eccb 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp @@ -237,9 +237,7 @@ void CEXIIPL::SetCS(int _iCS) void CEXIIPL::UpdateRTC() { - u32 epoch = - (SConfig::GetInstance().bWii || SConfig::GetInstance().m_is_mios) ? WII_EPOCH : GC_EPOCH; - u32 rtc = Common::swap32(GetEmulatedTime(epoch)); + u32 rtc = Common::swap32(GetEmulatedTime(GC_EPOCH)); std::memcpy(m_RTC, &rtc, sizeof(u32)); } diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h index ea2d7093e2..d1c7404f8e 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h @@ -22,11 +22,8 @@ public: bool IsPresent() const override; void DoState(PointerWrap& p) override; - static constexpr u32 UNIX_EPOCH = 0; // 1970-01-01 00:00:00 - static constexpr u32 GC_EPOCH = 0x386D4380; // 2000-01-01 00:00:00 - static constexpr u32 WII_EPOCH = 0x477E5826; // 2008-01-04 16:00:38 - // The Wii epoch is suspiciously random, and the Wii was even - // released before it, but apparently it works anyway? + static constexpr u32 UNIX_EPOCH = 0; // 1970-01-01 00:00:00 + static constexpr u32 GC_EPOCH = 0x386D4380; // 2000-01-01 00:00:00 static u32 GetEmulatedTime(u32 epoch); static u64 NetPlay_GetEmulatedTime(); diff --git a/Source/Core/Core/SysConf.cpp b/Source/Core/Core/SysConf.cpp index 6efb18a729..1e7435a0f7 100644 --- a/Source/Core/Core/SysConf.cpp +++ b/Source/Core/Core/SysConf.cpp @@ -286,7 +286,7 @@ void SysConf::InsertDefaultEntries() ipl_pc[2] = 0x14; AddEntry({Entry::Type::SmallArray, "IPL.PC", std::move(ipl_pc)}); - AddEntry({Entry::Type::Long, "IPL.CB", {0x0f, 0x11, 0x14, 0xa6}}); + AddEntry({Entry::Type::Long, "IPL.CB", {0x00, 0x00, 0x00, 0x00}}); AddEntry({Entry::Type::Byte, "IPL.AR", {1}}); AddEntry({Entry::Type::Byte, "IPL.SSV", {1}});