mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
X64 Clock: Reduce accuracy to be less or equal to guest accuracy.
This commit is contained in:
parent
7b18174eef
commit
534466754f
3 changed files with 10 additions and 1 deletions
|
@ -62,7 +62,8 @@ u64 NativeClock::GetRTSC() {
|
||||||
}
|
}
|
||||||
accumulated_ticks += diff;
|
accumulated_ticks += diff;
|
||||||
rtsc_serialize.unlock();
|
rtsc_serialize.unlock();
|
||||||
return accumulated_ticks;
|
/// The clock cannot be more precise than the guest timer, remove the lower bits
|
||||||
|
return accumulated_ticks & inaccuracy_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeClock::Pause(bool is_paused) {
|
void NativeClock::Pause(bool is_paused) {
|
||||||
|
|
|
@ -31,6 +31,11 @@ public:
|
||||||
private:
|
private:
|
||||||
u64 GetRTSC();
|
u64 GetRTSC();
|
||||||
|
|
||||||
|
/// value used to reduce the native clocks accuracy as some apss rely on
|
||||||
|
/// undefined behavior where the level of accuracy in the clock shouldn't
|
||||||
|
/// be higher.
|
||||||
|
static constexpr u64 inaccuracy_mask = ~(0x100 - 1);
|
||||||
|
|
||||||
SpinLock rtsc_serialize{};
|
SpinLock rtsc_serialize{};
|
||||||
u64 last_measure{};
|
u64 last_measure{};
|
||||||
u64 accumulated_ticks{};
|
u64 accumulated_ticks{};
|
||||||
|
|
|
@ -184,6 +184,9 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable&
|
||||||
config.enable_fast_dispatch = false;
|
config.enable_fast_dispatch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CNTPCT uses wall clock.
|
||||||
|
config.wall_clock_cntpct = true;
|
||||||
|
|
||||||
return std::make_shared<Dynarmic::A64::Jit>(config);
|
return std::make_shared<Dynarmic::A64::Jit>(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue