Esempio n. 1
0
Psp2Ui::Psp2Ui(int width, int height) :
	BaseUi() {
	
	starttick = sceKernelGetProcessTimeWide() / 1000;
	frame = 0;
	zoom_state = 0;
	in_use_shader = 0;
	touch_x_start = -1;
	trigger_state = false;
	set_shader = true;
	vita2d_init();
	vita2d_set_vblank_wait(0);
	shaders[0] = vita2d_create_shader((SceGxmProgram*) opaque_v, (SceGxmProgram*) texture_f);
	shaders[1] = vita2d_create_shader((SceGxmProgram*) sharp_bilinear_v, (SceGxmProgram*) sharp_bilinear_f);
	shaders[2] = vita2d_create_shader((SceGxmProgram*) lcd3x_v, (SceGxmProgram*) lcd3x_f);
	shaders[3] = vita2d_create_shader((SceGxmProgram*) xbr_2x_fast_v, (SceGxmProgram*) xbr_2x_fast_f);
	gpu_texture = vita2d_create_empty_texture_format(
												width, height,
												SCE_GXM_TEXTURE_FORMAT_A8B8G8R8);
	vita2d_texture_set_alloc_memblock_type(SCE_KERNEL_MEMBLOCK_TYPE_USER_RW);
	current_display_mode.width = width;
	current_display_mode.height = height;
	current_display_mode.bpp = 32;
	const DynamicFormat format(
		32,
		0x000000FF,
		0x0000FF00,
		0x00FF0000,
		0xFF000000,
		PF::Alpha);
	main_texture = vita2d_create_empty_texture_format(
												width, height,
												SCE_GXM_TEXTURE_FORMAT_A8B8G8R8);
	next_texture = vita2d_create_empty_texture_format(
												width, height,
												SCE_GXM_TEXTURE_FORMAT_A8B8G8R8);
	Bitmap::SetFormat(Bitmap::ChooseFormat(format));
	main_surface = Bitmap::Create(vita2d_texture_get_datap(main_texture),width, height, vita2d_texture_get_stride(main_texture), format);
	
	#ifdef SUPPORT_AUDIO
		audio_.reset(new Psp2Audio());
	#endif
	
	scePowerSetArmClockFrequency(444);
	scePowerSetBusClockFrequency(222);
	scePowerSetGpuClockFrequency(222);
	scePowerSetGpuXbarClockFrequency(222);
	
	sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
	sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
	
	GPU_Mutex = sceKernelCreateSema("GPU Mutex", 0, 1, 1, NULL);
	GPU_Cleanup_Mutex = sceKernelCreateSema("GPU Cleanup Mutex", 0, 1, 1, NULL);
	GPU_Thread = sceKernelCreateThread("GPU Thread", &renderThread, 0x10000100, 0x10000, 0, 0, NULL);
	sceKernelStartThread(GPU_Thread, sizeof(GPU_Thread), &GPU_Thread);
	
}
Esempio n. 2
0
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;
}
Esempio n. 3
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);
	}

}
Esempio n. 4
0
//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);
	}	
}
Esempio n. 5
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;
}
Esempio n. 6
0
void PSPFin()
{
	scePowerSetCpuClockFrequency(psp_org_cpu_clock);
	scePowerSetBusClockFrequency(psp_org_bus_clock);
}