mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-11 21:30:05 +00:00
hle: Stub some service calls used by the home menu. (#6675)
This commit is contained in:
parent
26e3f96983
commit
662bb9ba77
22 changed files with 187 additions and 22 deletions
|
@ -87,8 +87,7 @@ Handler::Handler(Core::Timing& timing) : timing(timing) {
|
|||
shared_page.sliderstate_3d = static_cast<float_le>(slidestate);
|
||||
}
|
||||
|
||||
/// Gets system time in 3DS format. The epoch is Jan 1900, and the unit is millisecond.
|
||||
u64 Handler::GetSystemTime() const {
|
||||
u64 Handler::GetSystemTimeSince2000() const {
|
||||
std::chrono::milliseconds now =
|
||||
init_time + std::chrono::duration_cast<std::chrono::milliseconds>(timing.GetGlobalTimeUs());
|
||||
|
||||
|
@ -104,23 +103,25 @@ u64 Handler::GetSystemTime() const {
|
|||
epoch_tm.tm_isdst = 0;
|
||||
s64 epoch = std::mktime(&epoch_tm) * 1000;
|
||||
|
||||
// 3DS console time uses Jan 1 1900 as internal epoch,
|
||||
// so we use the milliseconds between 1900 and 2000 as base console time
|
||||
u64 console_time = 3155673600000ULL;
|
||||
|
||||
// Only when system time is after 2000, we set it as 3DS system time
|
||||
if (now.count() > epoch) {
|
||||
console_time += (now.count() - epoch);
|
||||
return now.count() - epoch;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return console_time;
|
||||
u64 Handler::GetSystemTimeSince1900() const {
|
||||
// 3DS console time uses Jan 1 1900 as internal epoch,
|
||||
// so we use the milliseconds between 1900 and 2000 as base console time
|
||||
return 3155673600000ULL + GetSystemTimeSince2000();
|
||||
}
|
||||
|
||||
void Handler::UpdateTimeCallback(std::uintptr_t user_data, int cycles_late) {
|
||||
DateTime& date_time =
|
||||
shared_page.date_time_counter % 2 ? shared_page.date_time_0 : shared_page.date_time_1;
|
||||
|
||||
date_time.date_time = GetSystemTime();
|
||||
date_time.date_time = GetSystemTimeSince1900();
|
||||
date_time.update_tick = timing.GetTicks();
|
||||
date_time.tick_to_second_coefficient = BASE_CLOCK_RATE_ARM11;
|
||||
date_time.tick_offset = 0;
|
||||
|
|
|
@ -110,8 +110,13 @@ public:
|
|||
return sizeof(shared_page);
|
||||
}
|
||||
|
||||
/// Gets the system time in milliseconds since the year 2000.
|
||||
u64 GetSystemTimeSince2000() const;
|
||||
|
||||
/// Gets the system time in milliseconds since the year 1900.
|
||||
u64 GetSystemTimeSince1900() const;
|
||||
|
||||
private:
|
||||
u64 GetSystemTime() const;
|
||||
void UpdateTimeCallback(std::uintptr_t user_data, int cycles_late);
|
||||
Core::Timing& timing;
|
||||
Core::TimingEventType* update_time_event;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue