diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index 0c5cb52f99..0431cb2736 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -61,10 +61,15 @@ static s64 idledCycles; static s64 lastGlobalTimeTicks; static s64 lastGlobalTimeUs; -void SetClockFrequencyHz(int cpuHz) { +bool SetClockFrequencyHz(int cpuHz) { if (cpuHz <= 0) { // Paranoid check, protecting against division by zero and similar nonsense. - return; + return true; // encourage logging + } + + if (cpuHz == CPU_HZ) { + // Already at the correct frequency. Bail, false means we'll log at a lower level. + return false; } // When the mhz changes, we keep track of what "time" it was before hand. @@ -76,6 +81,7 @@ void SetClockFrequencyHz(int cpuHz) { // TODO: Rescale times of scheduled events? __AudioCPUMHzChange(); + return true; } int GetClockFrequencyHz() { diff --git a/Core/CoreTiming.h b/Core/CoreTiming.h index 995738b82a..11226f3b03 100644 --- a/Core/CoreTiming.h +++ b/Core/CoreTiming.h @@ -126,7 +126,7 @@ namespace CoreTiming { void DoState(PointerWrap &p); - void SetClockFrequencyHz(int cpuHz); + bool SetClockFrequencyHz(int cpuHz); // Return false if the frequency was already set. int GetClockFrequencyHz(); // TODO: Add accessors? diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index 3d42b0335c..5fb64ec4d4 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -442,12 +442,6 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) { if (busfreq == 0 || busfreq > 166) { return hleLogWarning(Log::sceMisc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid bus frequency"); } - // TODO: More restrictions. - if (GetLockedCPUSpeedMhz() > 0) { - INFO_LOG(Log::HLE, "scePowerSetClockFrequency(%i,%i,%i): locked by user config at %i, %i, %i", pllfreq, cpufreq, busfreq, GetLockedCPUSpeedMhz(), GetLockedCPUSpeedMhz(), busFreq); - } else { - INFO_LOG(Log::HLE, "scePowerSetClockFrequency(%i,%i,%i)", pllfreq, cpufreq, busfreq); - } // Only reschedules when the stepped PLL frequency changes. // It seems like the busfreq parameter has no effect (but can cause errors.) if (RealpllFreq != PowerPllMhzToHz(pllfreq)) { @@ -471,8 +465,15 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) { return hleDelayResult(hleNoLog(0), "scepower set clockFrequency", usec); } - if (GetLockedCPUSpeedMhz() <= 0) - CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq)); + if (GetLockedCPUSpeedMhz() <= 0) { + if (CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq))) { + return hleLogInfo(Log::HLE, 0); + } else { + return hleLogDebug(Log::HLE, 0); + } + } else { + return hleLogInfo(Log::HLE, 0, "locked by user config at %i, %i, %i", GetLockedCPUSpeedMhz(), GetLockedCPUSpeedMhz(), busFreq); + } return hleNoLog(0); }