Esempio n. 1
0
static int update_freq(void)
{
	int i, max, maxsum;
	int cpu = 0, bus = 0;

	for (i = 0, max = 0, maxsum = -1; i < freqs_cnt; ++i) {
		if (maxsum < freqs[i].cpu + freqs[i].bus) {
			maxsum = freqs[i].cpu + freqs[i].bus;
			max = i;
		}
	}

	if (maxsum > 0) {
		cpu = freqs[max].cpu;
		bus = freqs[max].bus;
	}

	cpu = max(cpu, freq_list[config.freqs[0]][0]);
	cpu = min(333, cpu);
	bus = max(bus, freq_list[config.freqs[0]][1]);
	bus = min(166, bus);

//  dbg_printf(d, "%s: should set cpu/bus to %d/%d", __func__, cpu, bus);

	if (scePowerGetCpuClockFrequency() != cpu || scePowerGetBusClockFrequency() != bus) {
		power_set_clock(cpu, bus);
		{
//          dbg_printf(d, "%s: cpu: %d, bus: %d", __func__, scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency());
		}
	}

	return 0;
}
Esempio n. 2
0
// Get CPU/BUS Speed
static int lua_getCpu(lua_State *L)
{
    int argc = lua_gettop(L);
    
    if(argc != 0)
        return luaL_error(L, "Argument error: System.getCpuSpeed takes no argument.");
    
    u32 cpu = scePowerGetCpuClockFrequency();
    lua_pushnumber(L,cpu);
    
    return 1;
}
Esempio n. 3
0
int testFrequencies()
{
    int result = 1;
    scePowerSetClockFrequency(333, 333, 166);

    printf("scePowerGetCpuClockFrequency = 333...");
    int cpu = scePowerGetCpuClockFrequency();
    if (cpu < 332 ||cpu > 334) {
        result = error();
    } else {
        ok();
    }

    return result;

}
Esempio n. 4
0
void CSystem::GetSystemInfo()
{
    /**BATTERY*/
    /**PERCENTUALE CARICA DELLA BATTERIA*/
    BatteryLifePerc = L"Battery charge percentage: ";
    BatteryLifePerc += scePowerGetBatteryLifePercent();
    BatteryLifePerc += L"%";


    /**PERCENTUALE CARICA DELLA BATTERIA*/
    BatteryLifeTime = L"Battery Life Time: ";
    BatteryLifeTime += scePowerGetBatteryLifeTime() / 3600;
    BatteryLifeTime += L"m";


    /**TEMPERATURA DELLA BATTERIA*/
    BatteryTemp = L"Temperature of the battery: ";
    BatteryTemp += scePowerGetBatteryTemp();
    BatteryTemp += L"deg C";


    /**EXTERNAL POWER*/
    IsPowerOnline = scePowerIsPowerOnline() ? L"External Power: Yes" : L"External Power: No ";

    /**BATTERY PRESENT*/
    IsBatteryExist = scePowerIsBatteryExist() ? L"Battery Present: Yes" : L"Battery Present: No ";

    /**FREEMEMORY*/
    FreeMemory = L"Free Memory: ";
    FreeMemory += __freemem();

    /**CPU BUS*/
    CpuClock = L"CPU: ";
    CpuClock += scePowerGetCpuClockFrequency();
    CpuClock += " MHZ";

    BusClock = L"BUS: ";
    BusClock += scePowerGetBusClockFrequency();
    BusClock += " MHZ";


}
Esempio n. 5
0
//*************************************************************************************
//
//*************************************************************************************
static bool	Initialize()
{
	strcpy(gDaedalusExePath, DAEDALUS_PSP_PATH( "" ));

	printf( "Cpu was: %dMHz, Bus: %dMHz\n", scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency() );
	if (scePowerSetClockFrequency(333, 333, 166) != 0)
	{
		printf( "Could not set CPU to 333MHz\n" );
	}
	printf( "Cpu now: %dMHz, Bus: %dMHz\n", scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency() );

	// Set up our Kernel Home button
	//ToDo: This doesn't work properly for Vita, there's no longer a "home" button available
	InitHomeButton();

	// If (o) is pressed during boot the Emulator will use 32bit
	// else use default 16bit color mode
	SceCtrlData pad;
	sceCtrlPeekBufferPositive(&pad, 1);
	if( pad.Buttons & PSP_CTRL_CIRCLE ) g32bitColorMode = true;
	else g32bitColorMode = false;

	// Check for unsupported FW >=4.01 (We use M33 SDK 4.01)
	// Otherwise PSP model can't be detected correctly
	DaedalusFWCheck();

	// Initiate MediaEngine
	//Note: Media Engine is not available for Vita
	bool bMeStarted = InitialiseJobManager();

// Disable for profiling
//	srand(time(0));

	//Set the debug output to default
	if( g32bitColorMode ) pspDebugScreenInit();
	else pspDebugScreenInitEx( NULL , GU_PSM_5650, 1); //Sets debug output to 16bit mode

// This Breaks gdb, better disable it in debug build
//
#ifndef DAEDALUS_DEBUG_CONSOLE
	initExceptionHandler();
#endif

	_DisableFPUExceptions();

	//Init Panic button thread
	SetupPanic();

	// Init volatile memory
	VolatileMemInit();

#ifdef DAEDALUS_CALLBACKS
	//Set up callback for our thread
	SetupCallbacks();
#endif

	//Set up the DveMgr (TV Display) and Detect PSP Slim /3K/ Go
	if ( kuKernelGetModel() > PSP_MODEL_STANDARD )
	{
		// Can't use extra memory if ME isn't available
		if( bMeStarted )
			PSP_IS_SLIM = true;

		HAVE_DVE = CModule::Load("dvemgr.prx");
		if (HAVE_DVE >= 0)
			PSP_TV_CABLE = pspDveMgrCheckVideoOut();
		if (PSP_TV_CABLE == 1)
			PSP_TV_LACED = 1; // composite cable => interlaced
		else if( PSP_TV_CABLE == 0 )
			CModule::Unload( HAVE_DVE );	// Stop and unload dvemgr.prx since if no video cable is connected
	}

	HAVE_DVE = (HAVE_DVE < 0) ? 0 : 1; // 0 == no dvemgr, 1 == dvemgr

    sceCtrlSetSamplingCycle(0);
    sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);

	// Init the savegame directory
	strcpy( g_DaedalusConfig.mSaveDir, DAEDALUS_PSP_PATH( "SaveGames/" ) );

	if (!System_Init())
		return false;

	return true;
}
Esempio n. 6
0
void PSPInit()
{
	psp_org_cpu_clock = scePowerGetCpuClockFrequency();
	psp_org_bus_clock = scePowerGetBusClockFrequency();
}
/*
====================
Host_Init
====================
*/
void Host_Init (quakeparms_t *parms)
{
	#if defined(_WIN32) && defined(GLQUAKE)
	FILE *fp = fopen("opengl32.dll","r");
	if (fp) {
		// exists
		fclose(fp);
		Sys_Error ("OpenGL32.dll found in Quake folder.  You must delete this file from your Quake folder to run this engine.");
	}
	#endif // Windows only

	if (standard_quake)
		minimum_memory = MINIMUM_MEMORY;
	else
		minimum_memory = MINIMUM_MEMORY_LEVELPAK;

	if (COM_CheckParm ("-minmemory"))
		parms->memsize = minimum_memory;

	host_parms = *parms;

	if (parms->memsize < minimum_memory)
		Sys_Error ("Only %4.1f megs of memory available, can't execute game and memsize = %i and minimum memory is %i", parms->memsize / (float)0x100000, parms->memsize, minimum_memory);

	com_argc = parms->argc;
	com_argv = parms->argv;
#ifdef SUPPORTS_CHEATFREE
	// JPG 3.00 - moved this here
#if defined(_WIN32)
	srand(time(NULL) ^ _getpid());
#else
	srand(time(NULL) ^ getpid());
#endif
#endif

	Memory_Init (parms->membase, parms->memsize);
	Cbuf_Init ();
	Cmd_Init ();
	Cvar_Init ();
	V_Init ();
	Chase_Init ();
	Host_InitVCR (parms);
	COM_Init (parms->basedir);
	Host_InitLocal ();

	W_LoadWadFile ("gfx.wad");
	Key_Init ();

	Con_Init ();
	M_Init ();
	PR_Init ();
	Mod_Init ();
#ifdef PROQUAKE_EXTENSION
	Security_Init ();	// JPG 3.20 - cheat free
#endif
	NET_Init ();
	SV_Init ();
#ifdef PROQUAKE_EXTENSION
	IPLog_Init ();	// JPG 1.05 - ip address logging

	Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
#endif
#ifdef PSP_SYSTEM_STATS
	Con_Printf ("Insomnia ProQuake Engine v 4.71 Rev4\n"); //(EBOOT: "__TIME__" "__DATE__")\n");

	int currentCPU = scePowerGetCpuClockFrequency();
	int currentVRAM = sceGeEdramGetSize();
    int currentVRAMADD = sceGeEdramGetAddr();
	int currentRAMAVAIL = sceKernelTotalFreeMemSize();

#ifdef NORMAL_MODEL
	Con_Printf ("PSP Normal 32MB RAM Mode \n");
#endif
#ifdef SLIM_MODEL
	Con_Printf ("PSP Slim 64MB RAM Mode \n");
#endif

	Con_Printf ("%4.1f megabyte heap \n",parms->memsize/ (1024*1024.0));
	Con_Printf ("%4.1f PSP application heap \n",1.0f*PSP_HEAP_SIZE_MB);
	Con_Printf ("%d VRAM \n",currentVRAM);
    Con_Printf ("%d VRAM Address \n",currentVRAMADD);
    Con_Printf ("%d Current Total RAM \n",currentRAMAVAIL);

	Con_Printf ("CPU Speed %d MHz\n", currentCPU);
	Con_Printf ("%s \n", com_gamedir);

	
	
	R_InitTextures ();		// needed even for dedicated servers
#else
	Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
#endif

	if (cls.state != ca_dedicated)
	{
		host_basepal = (byte *)COM_LoadHunkFile ("gfx/palette.lmp");
		if (!host_basepal)
			Sys_Error ("Couldn't load gfx/palette.lmp");
		host_colormap = (byte *)COM_LoadHunkFile ("gfx/colormap.lmp");
		if (!host_colormap)
			Sys_Error ("Couldn't load gfx/colormap.lmp");

#ifndef _WIN32 // on non win32, mouse comes before video for security reasons
		IN_Init ();
#endif
		VID_Init (host_basepal);

        Draw_Init ();
		SCR_Init ();
		R_Init ();
#ifndef	_WIN32
	// on Win32, sound initialization has to come before video initialization, so we
	// can put up a popup if the sound hardware is in use
		S_Init ();
#else

#ifdef	GLQUAKE
	// FIXME: doesn't use the new one-window approach yet
		S_Init ();
#endif

#endif	// _WIN32
		CDAudio_Init ();
		Sbar_Init ();
		CL_Init ();
#ifdef _WIN32 // on non win32, mouse comes before video for security reasons
		IN_Init ();
#endif

#ifdef _WIN32
		// Baker: 3.99m to get sys info
		// must be AFTER video init stuff
		Sys_InfoInit();  // We don't care about dedicated servers for this

		// Baker 3.76 - Autoplay demo

		if (com_argc >= 2)
		{
			char *infile = com_argv[1];

			if (infile[0] && infile[0] != '-' && infile[0] != '+') {
				char tmp[1024] = {0}, *ext = COM_FileExtension(infile);

				if (!strncasecmp(ext, "dem", sizeof("dem")))
					snprintf(tmp, sizeof(tmp), "playdemo \"%s\"\n", infile);

				if (tmp[0])
				{
					nostartdemos = true;
					Cbuf_AddText(tmp);
				}
			}
		}
#endif


	}

	Cbuf_InsertText ("exec quake.rc\n");

#ifdef PROQUAKE_EXTENSION
	// Baker 3.80x: this is a hack

	if (!isDedicated) {

		Cbuf_AddText ("\nsavefov\n");
		Cbuf_AddText ("savesensitivity\n");
	}
#endif
	Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
	host_hunklevel = Hunk_LowMark ();

	host_initialized = true;

	Con_Printf ("Host Initialized\n");
	Sys_Printf ("========Quake Initialized=========\n");
}