early-access version 1465

This commit is contained in:
pineappleEA
2021-02-16 00:42:49 +01:00
parent fc7f8c8663
commit b8666b8fd1
5 changed files with 98 additions and 64 deletions

View File

@@ -2,6 +2,9 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <cstdint>
#include "common/uint128.h"
#include "common/wall_clock.h"
#ifdef ARCHITECTURE_x86_64
@@ -17,7 +20,9 @@ using base_time_point = std::chrono::time_point<base_timer>;
class StandardWallClock final : public WallClock {
public:
explicit StandardWallClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequency_)
: WallClock(emulated_cpu_frequency_, emulated_clock_frequency_, false) {
: WallClock(emulated_cpu_frequency_, emulated_clock_frequency_, false),
emulated_clock_factor{GetFixedPoint64Factor(emulated_clock_frequency, 1000000000)},
emulated_cpu_factor{GetFixedPoint64Factor(emulated_cpu_frequency, 1000000000)} {
start_time = base_timer::now();
}
@@ -40,11 +45,11 @@ public:
}
u64 GetClockCycles() override {
return GetTimeNS().count() * (emulated_clock_frequency / 1000) / 1000000;
return MultiplyHigh(GetTimeNS().count(), emulated_clock_factor);
}
u64 GetCPUCycles() override {
return GetTimeNS().count() * (emulated_cpu_frequency / 1000) / 1000000;
return MultiplyHigh(GetTimeNS().count(), emulated_cpu_factor);
}
void Pause([[maybe_unused]] bool is_paused) override {
@@ -53,6 +58,8 @@ public:
private:
base_time_point start_time;
const u64 emulated_clock_factor;
const u64 emulated_cpu_factor;
};
#ifdef ARCHITECTURE_x86_64