Merge pull request #2235 from thedax/master

User controllable CPU speed option
This commit is contained in:
Henrik Rydgård 2013-06-26 14:57:40 -07:00
commit e440fa606e
4 changed files with 45 additions and 8 deletions

View File

@ -85,6 +85,7 @@ void Config::Load(const char *iniFileName)
#endif
//FastMemory Default set back to True when solve UNIMPL _sceAtracGetContextAddress making game crash
cpu->Get("FastMemory", &bFastMemory, false);
cpu->Get("CPUSpeed", &iLockedCPUSpeed, false);
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
graphics->Get("ShowFPSCounter", &iShowFPSCounter, false);
@ -204,6 +205,7 @@ void Config::Save()
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Set("Jit", bJit);
cpu->Set("FastMemory", bFastMemory);
cpu->Set("CPUSpeed", iLockedCPUSpeed);
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
graphics->Set("ShowFPSCounter", iShowFPSCounter);

View File

@ -52,6 +52,7 @@ public:
bool bIgnoreBadMemAccess;
bool bFastMemory;
bool bJit;
int iLockedCPUSpeed;
bool bAutoSaveSymbolMap;
std::string sReportHost;
std::vector<std::string> recentIsos;

View File

@ -22,6 +22,7 @@
#include "scePower.h"
#include "sceKernelThread.h"
#include "Core/Config.h"
const int PSP_POWER_ERROR_TAKEN_SLOT = 0x80000020;
const int PSP_POWER_ERROR_SLOTS_FULL = 0x80000022;
@ -52,6 +53,12 @@ static int busFreq = 111;
void __PowerInit() {
memset(powerCbSlots, 0, sizeof(powerCbSlots));
volatileMemLocked = false;
if(g_Config.iLockedCPUSpeed > 0) {
CoreTiming::SetClockFrequencyMHz(g_Config.iLockedCPUSpeed);
pllFreq = g_Config.iLockedCPUSpeed;
busFreq = g_Config.iLockedCPUSpeed / 2;
}
}
void __PowerDoState(PointerWrap &p) {
@ -226,22 +233,37 @@ int sceKernelVolatileMemLock(int type, int paddr, int psize) {
u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) {
CoreTiming::SetClockFrequencyMHz(cpufreq);
pllFreq = pllfreq;
busFreq = busfreq;
INFO_LOG(HLE,"scePowerSetClockFrequency(%i,%i,%i)", pllfreq, cpufreq, busfreq);
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);
}
else {
CoreTiming::SetClockFrequencyMHz(cpufreq);
pllFreq = pllfreq;
busFreq = busfreq;
INFO_LOG(HLE,"scePowerSetClockFrequency(%i,%i,%i)", pllfreq, cpufreq, busfreq);
}
return 0;
}
u32 scePowerSetCpuClockFrequency(u32 cpufreq) {
CoreTiming::SetClockFrequencyMHz(cpufreq);
DEBUG_LOG(HLE,"scePowerSetCpuClockFrequency(%i)", cpufreq);
if(g_Config.iLockedCPUSpeed > 0) {
DEBUG_LOG(HLE,"scePowerSetCpuClockFrequency(%i): locked by user config at %i", cpufreq, g_Config.iLockedCPUSpeed);
}
else {
CoreTiming::SetClockFrequencyMHz(cpufreq);
DEBUG_LOG(HLE,"scePowerSetCpuClockFrequency(%i)", cpufreq);
}
return 0;
}
u32 scePowerSetBusClockFrequency(u32 busfreq) {
busFreq = busfreq;
DEBUG_LOG(HLE,"scePowerSetBusClockFrequency(%i)", busfreq);
if(g_Config.iLockedCPUSpeed > 0) {
DEBUG_LOG(HLE,"scePowerSetBusClockFrequency(%i): locked by user config at %i", busfreq, busFreq);
}
else {
busFreq = busfreq;
DEBUG_LOG(HLE,"scePowerSetBusClockFrequency(%i)", busfreq);
}
return 0;
}

View File

@ -1189,6 +1189,18 @@ void SystemScreen::render() {
if (g_Config.bJit)
UICheckBox(GEN_ID, x, y += stride, s->T("Fast Memory", "Fast Memory (unstable)"), ALIGN_TOPLEFT, &g_Config.bFastMemory);
bool LockCPUSpeed = g_Config.iLockedCPUSpeed != 0;
UICheckBox(GEN_ID, x, y += stride, s->T("Lock PSP CPU Speed"), ALIGN_TOPLEFT, &LockCPUSpeed);
if(LockCPUSpeed) {
if(g_Config.iLockedCPUSpeed <= 0)
g_Config.iLockedCPUSpeed = 222;
char showCPUSpeed[256];
sprintf(showCPUSpeed, "%s %d", s->T("Locked CPU Speed: "), g_Config.iLockedCPUSpeed);
ui_draw2d.DrawText(UBUNTU24, showCPUSpeed, x + 60, (y += stride) - 5, 0xFFFFFFFF, ALIGN_LEFT);
}
else {
g_Config.iLockedCPUSpeed = 0;
}
//UICheckBox(GEN_ID, x, y += stride, s->T("Daylight Savings"), ALIGN_TOPLEFT, &g_Config.bDayLightSavings);
const char *buttonPreferenceTitle;