mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Compat: Enforce "RequireDefaultCPUClock" by disabling overclocking for these games
Instead of just warning. Fixes #12811
This commit is contained in:
parent
8dab823936
commit
b22e27a537
@ -16,14 +16,17 @@
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Compatibility.h"
|
||||
|
||||
#include "Core/HLE/scePower.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
@ -63,6 +66,10 @@ static int RealbusFreq = 111000000;
|
||||
static int pllFreq = 222000000;
|
||||
static int busFreq = 111000000;
|
||||
|
||||
int GetLockedCPUSpeedMhz() {
|
||||
return PSP_CoreParameter().compat.flags().RequireDefaultCPUClock ? 0 : g_Config.iLockedCPUSpeed;
|
||||
}
|
||||
|
||||
// The CPU mhz can only be a multiple of the PLL divided by 511.
|
||||
int PowerCpuMhzToHz(int desired, int pllHz) {
|
||||
double maxfreq = desired * 1000000.0;
|
||||
@ -115,10 +122,10 @@ void __PowerInit() {
|
||||
volatileMemLocked = false;
|
||||
volatileWaitingThreads.clear();
|
||||
|
||||
if (g_Config.iLockedCPUSpeed > 0) {
|
||||
pllFreq = PowerPllMhzToHz(g_Config.iLockedCPUSpeed);
|
||||
if (GetLockedCPUSpeedMhz() > 0) {
|
||||
pllFreq = PowerPllMhzToHz(GetLockedCPUSpeedMhz());
|
||||
busFreq = PowerBusMhzToHz(pllFreq / 2000000);
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(g_Config.iLockedCPUSpeed, pllFreq));
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(GetLockedCPUSpeedMhz(), pllFreq));
|
||||
} else {
|
||||
pllFreq = PowerPllMhzToHz(222);
|
||||
busFreq = PowerBusMhzToHz(111);
|
||||
@ -144,10 +151,10 @@ void __PowerDoState(PointerWrap &p) {
|
||||
RealpllFreq = PowerPllMhzToHz(222);
|
||||
RealbusFreq = PowerBusMhzToHz(111);
|
||||
}
|
||||
if (g_Config.iLockedCPUSpeed > 0) {
|
||||
pllFreq = PowerPllMhzToHz(g_Config.iLockedCPUSpeed);
|
||||
if (GetLockedCPUSpeedMhz() > 0) {
|
||||
pllFreq = PowerPllMhzToHz(GetLockedCPUSpeedMhz());
|
||||
busFreq = PowerBusMhzToHz(pllFreq / 2000000);
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(g_Config.iLockedCPUSpeed, pllFreq));
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(GetLockedCPUSpeedMhz(), pllFreq));
|
||||
} else {
|
||||
pllFreq = RealpllFreq;
|
||||
busFreq = RealbusFreq;
|
||||
@ -443,8 +450,8 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) {
|
||||
return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid bus frequency");
|
||||
}
|
||||
// TODO: More restrictions.
|
||||
if (g_Config.iLockedCPUSpeed > 0) {
|
||||
INFO_LOG(HLE, "scePowerSetClockFrequency(%i,%i,%i): locked by user config at %i, %i, %i", pllfreq, cpufreq, busfreq, g_Config.iLockedCPUSpeed, g_Config.iLockedCPUSpeed, busFreq);
|
||||
if (GetLockedCPUSpeedMhz() > 0) {
|
||||
INFO_LOG(HLE, "scePowerSetClockFrequency(%i,%i,%i): locked by user config at %i, %i, %i", pllfreq, cpufreq, busfreq, GetLockedCPUSpeedMhz(), GetLockedCPUSpeedMhz(), busFreq);
|
||||
} else {
|
||||
INFO_LOG(HLE, "scePowerSetClockFrequency(%i,%i,%i)", pllfreq, cpufreq, busfreq);
|
||||
}
|
||||
@ -455,7 +462,7 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) {
|
||||
|
||||
RealpllFreq = PowerPllMhzToHz(pllfreq);
|
||||
RealbusFreq = PowerBusMhzToHz(RealpllFreq / 2000000);
|
||||
if (g_Config.iLockedCPUSpeed <= 0) {
|
||||
if (GetLockedCPUSpeedMhz() <= 0) {
|
||||
pllFreq = RealpllFreq;
|
||||
busFreq = RealbusFreq;
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq));
|
||||
@ -471,7 +478,7 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) {
|
||||
|
||||
return hleDelayResult(0, "scepower set clockFrequency", usec);
|
||||
}
|
||||
if (g_Config.iLockedCPUSpeed <= 0)
|
||||
if (GetLockedCPUSpeedMhz() <= 0)
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq));
|
||||
return 0;
|
||||
}
|
||||
@ -480,8 +487,8 @@ static u32 scePowerSetCpuClockFrequency(u32 cpufreq) {
|
||||
if (cpufreq == 0 || cpufreq > 333) {
|
||||
return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid frequency");
|
||||
}
|
||||
if (g_Config.iLockedCPUSpeed > 0) {
|
||||
return hleLogDebug(SCEMISC, 0, "locked by user config at %i", g_Config.iLockedCPUSpeed);
|
||||
if (GetLockedCPUSpeedMhz() > 0) {
|
||||
return hleLogDebug(SCEMISC, 0, "locked by user config at %i", GetLockedCPUSpeedMhz());
|
||||
}
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq));
|
||||
return hleLogSuccessI(SCEMISC, 0);
|
||||
@ -491,8 +498,8 @@ static u32 scePowerSetBusClockFrequency(u32 busfreq) {
|
||||
if (busfreq == 0 || busfreq > 111) {
|
||||
return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid frequency");
|
||||
}
|
||||
if (g_Config.iLockedCPUSpeed > 0) {
|
||||
return hleLogDebug(SCEMISC, 0, "locked by user config at %i", g_Config.iLockedCPUSpeed / 2);
|
||||
if (GetLockedCPUSpeedMhz() > 0) {
|
||||
return hleLogDebug(SCEMISC, 0, "locked by user config at %i", GetLockedCPUSpeedMhz() / 2);
|
||||
}
|
||||
|
||||
// The value passed is validated, but then doesn't seem to matter for the result.
|
||||
|
@ -27,3 +27,6 @@ void Register_sceSuspendForUser();
|
||||
|
||||
int KernelVolatileMemLock(int type, u32 paddr, u32 psize);
|
||||
int KernelVolatileMemUnlock(int type);
|
||||
|
||||
// Returns 0 for default.
|
||||
int GetLockedCPUSpeedMhz();
|
||||
|
@ -16,6 +16,7 @@
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include <deque>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
@ -37,6 +38,10 @@ extern "C" {
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/System/OSD.h"
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/Net/HTTPClient.h"
|
||||
#include "Common/Net/Resolve.h"
|
||||
#include "Common/Net/URL.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Config.h"
|
||||
@ -44,18 +49,15 @@ extern "C" {
|
||||
#include "Core/Loaders.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/FileSystems/BlockDevices.h"
|
||||
#include "Core/FileSystems/MetaFileSystem.h"
|
||||
#include "Core/HLE/Plugins.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/scePower.h"
|
||||
#include "Core/HW/Display.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "Common/Net/HTTPClient.h"
|
||||
#include "Common/Net/Resolve.h"
|
||||
#include "Common/Net/URL.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
|
||||
namespace Reporting
|
||||
{
|
||||
@ -584,7 +586,7 @@ namespace Reporting
|
||||
// Disabled when using certain hacks, because they make for poor reports.
|
||||
if (CheatsInEffect() || HLEPlugins::HasEnabled())
|
||||
return false;
|
||||
if (g_Config.iLockedCPUSpeed != 0)
|
||||
if (GetLockedCPUSpeedMhz() != 0)
|
||||
return false;
|
||||
if (g_Config.uJitDisableFlags != 0)
|
||||
return false;
|
||||
|
@ -72,6 +72,7 @@ using namespace std::placeholders;
|
||||
#include "Core/RetroAchievements.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/HLE/scePower.h"
|
||||
#include "Core/HLE/__sceAudio.h"
|
||||
#include "Core/HLE/proAdhoc.h"
|
||||
#include "Core/HLE/Plugins.h"
|
||||
@ -1366,7 +1367,7 @@ Invalid / Unknown (%d)
|
||||
"Locked CPU freq: %d MHz\n"
|
||||
"Cheats: %s, Plugins: %s\n",
|
||||
CPUCoreAsString(g_Config.iCpuCore), g_Config.uJitDisableFlags,
|
||||
g_Config.iLockedCPUSpeed,
|
||||
GetLockedCPUSpeedMhz(),
|
||||
CheatsInEffect() ? "Y" : "N", HLEPlugins::HasEnabled() ? "Y" : "N");
|
||||
|
||||
ctx->Draw()->DrawTextShadow(ubuntu24, statbuf, x, y, 0xFFFFFFFF);
|
||||
|
Loading…
Reference in New Issue
Block a user