CoreTiming: wrap into class
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/hle/service/ptm/ptm.h"
|
||||
@ -53,9 +54,9 @@ Handler::Handler() {
|
||||
init_time = GetInitTime();
|
||||
|
||||
using namespace std::placeholders;
|
||||
update_time_event = CoreTiming::RegisterEvent(
|
||||
update_time_event = Core::System::GetInstance().CoreTiming().RegisterEvent(
|
||||
"SharedPage::UpdateTimeCallback", std::bind(&Handler::UpdateTimeCallback, this, _1, _2));
|
||||
CoreTiming::ScheduleEvent(0, update_time_event);
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(0, update_time_event);
|
||||
|
||||
float slidestate =
|
||||
Settings::values.toggle_3d ? (float_le)Settings::values.factor_3d / 100 : 0.0f;
|
||||
@ -65,8 +66,8 @@ Handler::Handler() {
|
||||
/// Gets system time in 3DS format. The epoch is Jan 1900, and the unit is millisecond.
|
||||
u64 Handler::GetSystemTime() const {
|
||||
std::chrono::milliseconds now =
|
||||
init_time +
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(CoreTiming::GetGlobalTimeUs());
|
||||
init_time + std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
Core::System::GetInstance().CoreTiming().GetGlobalTimeUs());
|
||||
|
||||
// 3DS system does't allow user to set a time before Jan 1 2000,
|
||||
// so we use it as an auxiliary epoch to calculate the console time.
|
||||
@ -97,14 +98,15 @@ void Handler::UpdateTimeCallback(u64 userdata, int cycles_late) {
|
||||
shared_page.date_time_counter % 2 ? shared_page.date_time_0 : shared_page.date_time_1;
|
||||
|
||||
date_time.date_time = GetSystemTime();
|
||||
date_time.update_tick = CoreTiming::GetTicks();
|
||||
date_time.update_tick = Core::System::GetInstance().CoreTiming().GetTicks();
|
||||
date_time.tick_to_second_coefficient = BASE_CLOCK_RATE_ARM11;
|
||||
date_time.tick_offset = 0;
|
||||
|
||||
++shared_page.date_time_counter;
|
||||
|
||||
// system time is updated hourly
|
||||
CoreTiming::ScheduleEvent(msToCycles(60 * 60 * 1000) - cycles_late, update_time_event);
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(msToCycles(60 * 60 * 1000) - cycles_late,
|
||||
update_time_event);
|
||||
}
|
||||
|
||||
void Handler::SetMacAddress(const MacAddress& addr) {
|
||||
|
Reference in New Issue
Block a user