Add CPU Clock Frequency slider
This slider affects the number of cycles that the guest cpu emulation reports that have passed since the last time slice. This option scales the result returned by a percentage that the user selects. In some games underclocking the CPU can give a major speedup. Exposing this as an option will give users something to toy with for performance, while also potentially enhancing games that experience lag on the real console
This commit is contained in:
parent
55ec7031cc
commit
276d56ca9b
15 changed files with 204 additions and 84 deletions
|
@ -20,14 +20,20 @@ bool Timing::Event::operator<(const Timing::Event& right) const {
|
|||
return std::tie(time, fifo_order) < std::tie(right.time, right.fifo_order);
|
||||
}
|
||||
|
||||
Timing::Timing(std::size_t num_cores) {
|
||||
Timing::Timing(std::size_t num_cores, u32 cpu_clock_percentage) {
|
||||
timers.resize(num_cores);
|
||||
for (std::size_t i = 0; i < num_cores; ++i) {
|
||||
timers[i] = std::make_shared<Timer>();
|
||||
timers[i] = std::make_shared<Timer>(100.0 / cpu_clock_percentage);
|
||||
}
|
||||
current_timer = timers[0];
|
||||
}
|
||||
|
||||
void Timing::UpdateClockSpeed(u32 cpu_clock_percentage) {
|
||||
for (auto& timer : timers) {
|
||||
timer->cpu_clock_scale = 100.0 / cpu_clock_percentage;
|
||||
}
|
||||
}
|
||||
|
||||
TimingEventType* Timing::RegisterEvent(const std::string& name, TimedCallback callback) {
|
||||
// check for existing type with same name.
|
||||
// we want event type names to remain unique so that we can use them for serialization.
|
||||
|
@ -117,6 +123,8 @@ std::shared_ptr<Timing::Timer> Timing::GetTimer(std::size_t cpu_id) {
|
|||
return timers[cpu_id];
|
||||
}
|
||||
|
||||
Timing::Timer::Timer(double cpu_clock_scale_) : cpu_clock_scale(cpu_clock_scale_) {}
|
||||
|
||||
Timing::Timer::~Timer() {
|
||||
MoveEvents();
|
||||
}
|
||||
|
@ -130,7 +138,7 @@ u64 Timing::Timer::GetTicks() const {
|
|||
}
|
||||
|
||||
void Timing::Timer::AddTicks(u64 ticks) {
|
||||
downcount -= ticks;
|
||||
downcount -= static_cast<u64>(ticks * cpu_clock_scale);
|
||||
}
|
||||
|
||||
u64 Timing::Timer::GetIdleTicks() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue