static int lua_setReg(lua_State *L) { if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected."); if (scePowerGetCpuClockFrequencyInt() != 222){ scePowerSetCpuClockFrequency(222); scePowerSetBusClockFrequency(111); } return 0; }
void cpu_clock_set_minimum() { //if (current_speed.cpu<120) current_speed.cpu=120; //if (current_speed.ram<222) current_speed.ram=222; //if (current_speed.bus<60) current_speed.bus=60; if ( current_speed.cpu > 222 ) scePowerSetClockFrequency(current_speed.cpu, current_speed.ram, current_speed.bus); else { scePowerSetClockFrequency(222,222,111); scePowerSetCpuClockFrequency(current_speed.cpu); scePowerSetBusClockFrequency(current_speed.bus); } }
//add by cooleyes 2006/12/19 void cpu_clock_set_cpu_speed( int cpu ) { if ( cpu >= 333 ) { current_speed.cpu = 333; current_speed.ram = 333; current_speed.bus = 166; } else if ( cpu >= 266 ) { current_speed.cpu = 266; current_speed.ram = 266; current_speed.bus = 133; } else if ( cpu >= 222 ) { current_speed.cpu = 222; current_speed.ram = 222; current_speed.bus = 111; } else if ( cpu >= 133 ) { current_speed.cpu = 133; current_speed.ram = 222; current_speed.bus = 66; } else if ( cpu >= 120 ){ current_speed.cpu = 120; current_speed.ram = 222; current_speed.bus = 60; } else { current_speed.cpu = 66; current_speed.ram = 222; current_speed.bus = 33; } if ( current_speed.cpu > 222 ) scePowerSetClockFrequency(current_speed.cpu, current_speed.ram, current_speed.bus); else { scePowerSetClockFrequency(222,222,111); scePowerSetCpuClockFrequency(current_speed.cpu); scePowerSetBusClockFrequency(current_speed.bus); } }
int main(int argc, char *argv[]) { SceCtrlData pad; int oldButtons = 0; #define SECOND 1000000 #define REPEAT_START (1 * SECOND) #define REPEAT_DELAY (SECOND / 5) struct timeval repeatStart; struct timeval repeatDelay; repeatStart.tv_sec = 0; repeatStart.tv_usec = 0; repeatDelay.tv_sec = 0; repeatDelay.tv_usec = 0; logFd = sceIoOpen("compilerPerf.log", PSP_O_WRONLY | PSP_O_CREAT, 0777); pspDebugScreenInit(); pspDebugScreenPrintf("Press Cross to start the Performance Test\n"); pspDebugScreenPrintf("Press Circle to change the CPU Clock\n"); while(!done) { sceCtrlReadBufferPositive(&pad, 1); int buttonDown = (oldButtons ^ pad.Buttons) & pad.Buttons; if (pad.Buttons == oldButtons) { struct timeval now; gettimeofday(&now, NULL); if (repeatStart.tv_sec == 0) { repeatStart.tv_sec = now.tv_sec; repeatStart.tv_usec = now.tv_usec; repeatDelay.tv_sec = 0; repeatDelay.tv_usec = 0; } else { long usec = (now.tv_sec - repeatStart.tv_sec) * SECOND; usec += (now.tv_usec - repeatStart.tv_usec); if (usec >= REPEAT_START) { if (repeatDelay.tv_sec != 0) { usec = (now.tv_sec - repeatDelay.tv_sec) * SECOND; usec += (now.tv_usec - repeatDelay.tv_usec); if (usec >= REPEAT_DELAY) { repeatDelay.tv_sec = 0; } } if (repeatDelay.tv_sec == 0) { buttonDown = pad.Buttons; repeatDelay.tv_sec = now.tv_sec; repeatDelay.tv_usec = now.tv_usec; } } } } else { repeatStart.tv_sec = 0; } if (buttonDown & PSP_CTRL_CROSS) { runTest(); } if (buttonDown & PSP_CTRL_CIRCLE) { cpuFreq += 111; if (cpuFreq > 333) { cpuFreq = 111; } int result = scePowerSetCpuClockFrequency(cpuFreq); if (result == 0) { pspDebugScreenPrintf("CPU Clock set to %d MHz\n", cpuFreq); } else { pspDebugScreenPrintf("Could not set CPU Clock set to %d MHz\n", cpuFreq); } } if (buttonDown & PSP_CTRL_TRIANGLE) { done = 1; } oldButtons = pad.Buttons; } sceGuTerm(); sceIoClose(logFd); sceKernelExitGame(); return 0; }
int ReadSettings(ONScripterLabel *pOns, const char *file) { FILE *fp; char key[256]; char value[256]; int rt; //FILE *fp2; #if defined(PSP) int value_int; putenv("SDL_ASPECT_RATIO=4:3"); #endif fp = fopen(file,"rt"); //fp2 = fopen("setting.log","wb"); if (!fp) return -1; while (!feof(fp)) { rt = fscanf(fp, "%[^=\n]=%[^=\n]\n", key, value); if (rt==0 || rt==EOF) break; //fprintf(fp2, "KEY=%s, VALUE=%s\n", key, value); if (!stricmp(key, "FONT")) { pOns->setFontFile(value); } else if (!stricmp(key, "registry")) { pOns->setRegistryFile(value); } else if (!stricmp(key, "dll")) { pOns->setDLLFile(value); } else if (!stricmp(key, "root")) { pOns->setArchivePath(value); } else if (!stricmp(key, "fullscreen")) { if (!stricmp(value, "yes")) pOns->setFullscreenMode(); else if (!stricmp(value, "no")) pOns->setWindowMode(); } #if defined(PSP) if (!stricmp(key, "RESOLUTION")) { value_int = atoi(value); if (value_int > 0 && value_int <= 360) os_screen_width=value_int; } else if (!stricmp(key, "SCREENSIZE")) { if (!stricmp(value,"NORMAL")) { putenv("SDL_ASPECT_RATIO=4:3"); } else if (!stricmp(value,"FULL")) { putenv("SDL_ASPECT_RATIO="); } } else if (!stricmp(key, "CPUCLOCK")) { value_int = atoi(value); if (value_int > 0 && value_int <= 333) scePowerSetCpuClockFrequency(value_int); } else if (!stricmp(key, "BUSCLOCK")) { value_int = atoi(value); if (value_int > 0 && value_int <= 167) scePowerSetBusClockFrequency(value_int); } else if (!stricmp(key, "LMB_ONCE")) { MapButton(SDLK_SPACE, value); } else if (!stricmp(key, "LMB")) { MapButton(SDLK_RETURN, value); } else if (!stricmp(key, "RMB")) { MapButton(SDLK_ESCAPE, value); } else if (!stricmp(key, "CURSOR_PREV")) { MapButton(SDLK_UP ,value); } else if (!stricmp(key, "CURSOR_NEXT")) { MapButton(SDLK_DOWN, value); } else if (!stricmp(key, "SKIP")) { MapButton(SDLK_s, value); } else if (!stricmp(key, "PAGEFLIP")) { MapButton(SDLK_o, value); } else if (!stricmp(key, "MEM_UP")) { MapButton(SDLK_LEFT, value); } else if (!stricmp(key, "MEM_DOWN")) { MapButton(SDLK_RIGHT, value); } else if (!stricmp(key, "SKIPMODE")) { MapButton(SDLK_s, value); } else if (!stricmp(key, "AUTOMODE")) { MapButton(SDLK_a, value); } else if (!stricmp(key, "SPEED")) { MapButton(SDLK_0, value); } else if (!stricmp(key, "NONE")) { MapButton(SDLK_UNKNOWN, value); } #endif } fclose(fp); //fclose(fp2); return 0; }
void PSPFin() { scePowerSetCpuClockFrequency(psp_org_cpu_clock); scePowerSetBusClockFrequency(psp_org_bus_clock); }