Пример #1
0
int main_thread(SceSize args, void *argp)
{
	SceUID block_id;
	void *vram;

	block_id = sceKernelAllocPartitionMemory(4, "debugmenu", PSP_SMEM_Low, 512*272*2, NULL);
	if(block_id < 0)
	{
		Kprintf("Error could not allocate memory buffer 0x%08X\n", block_id);
		goto error;
	}
	 
	vram = (void*) (0xA0000000 | (unsigned int) sceKernelGetBlockHeadAddr(block_id));
	g_eventflag = sceKernelCreateEventFlag("DebugMenuEvent", 0, 0, NULL);
	if(g_eventflag < 0)
	{
		Kprintf("Could not create event flag %08X\n", g_eventflag);
		goto error;
	}

	//sceCtrlRegisterButtonCallback(0, PSP_CTRL_HOME, button_callback, NULL);
	sceCtrlRegisterButtonCallback(3, TRIGGER, button_callback, NULL);
	while(1)
	{
		unsigned int bits;
		if(sceKernelWaitEventFlag(g_eventflag, START_MENU,
					PSP_EVENT_WAITOR | PSP_EVENT_WAITCLEAR, &bits, NULL) < 0)
		{
			break;
		}
		sceCtrlSetButtonMasks(0xFFFF, 1);  // Mask lower 16bits
		sceCtrlSetButtonMasks(0x10000, 2); // Always return HOME key
		sceDisplaySetFrameBufferInternal(0, vram, 512, 0, 1);
		pspDebugScreenInitEx(vram, 0, 0);
		do_menu();
		sceDisplaySetFrameBufferInternal(0, 0, 512, 0, 1);
		sceCtrlSetButtonMasks(0x10000, 0); // Unset HOME key
		sceCtrlSetButtonMasks(0xFFFF, 0);  // Unset mask
		sceKernelClearEventFlag(g_eventflag, ~START_MENU);
	}

error:
	sceKernelExitDeleteThread(0);

	return 0;
}
Пример #2
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;
}
Пример #3
0
LoadingWindow_PSP::LoadingWindow_PSP()
{
	pspDebugScreenInitEx( NULL, PSP_DISPLAY_PIXEL_FORMAT_4444, 1 );
	pspDebugScreenEnableBackColor( 0 );
	text[0] = '\0';
}