Exemple #1
0
int sub_16389()
{
	volatile int *hwAddress = (int*)0xbfc00700;
	*hwAddress = -1;
	int* meTable = (int*)0xbfc00600;
	meTable[0] = 399;//copy sceKernelGetMEeDramSaveSize() bytes on me main memory to sceKernelGetMEeDramSaveAddr() then halt me
	meTable[2] = sceKernelGetMEeDramSaveAddr();
	meTable[3] = sceKernelGetMEeDramSaveSize();
	meTable[4] = 0;
	meTable[5] = 0;
	meTable[6] = 0;
	meTable[7] = 0;
	meTable[8] = 0;
	meTable[9] = 0;
	sceDdrFlush(5);
	sceSysregInterruptToOther();
	while (*hwAddress != -2)
	    ;
	sceDdrFlush(8);
	sceSysregMeResetEnable();
	sceSysregMeBusClockDisable();
	*(int*)0xbfc00718 = *(int*)0xbc100070 & 4;
	sceKernelClearEventFlag(meRpc.event, 0);
	return 0;
}
Exemple #2
0
void KillME(volatile struct me_struct *mei, int devkitVersion)
{
	unsigned int k1;

	k1 = pspSdkSetK1(0);

	if (mei == 0)
	{
		pspSdkSetK1(k1);
		return;
	}

	mei->init = 0;
	if (devkitVersion == 0x03070110){
		sceSysregVmeResetEnable371();	
		sceSysregAvcResetEnable371();	
		sceSysregMeResetEnable371();
		sceSysregMeBusClockDisable371();
	}
	else{
		sceSysregVmeResetEnable();	
		sceSysregAvcResetEnable();	
		sceSysregMeResetEnable();	
		sceSysregMeBusClockDisable();
	}

	pspSdkSetK1(k1);
}
Exemple #3
0
int InitME(volatile struct me_struct *mei, int devkitVersion)
{
	unsigned int k1;

	k1 = pspSdkSetK1(0);

	if (mei == 0)
	{
   		pspSdkSetK1(k1);
   		return -1;
	}

	// initialize the MediaEngine Instance
	mei->start = 0;
	mei->done = 1;
	mei->func = 0;
	mei->param = 0;
	mei->result = 0;
	mei->precache_len = 0;
	mei->precache_addr = 0;
	mei->postcache_len = 0;
	mei->postcache_addr = 0;
	mei->signals = 0;
	mei->init = 1;

	// start the MediaEngine
	
	memcpy((void *)0xbfc00040, me_stub, (int)(me_stub_end - me_stub));
	_sw((unsigned int)me_loop,  0xbfc00600);	// k0
	_sw((unsigned int)mei, 0xbfc00604);			// a0
	sceKernelDcacheWritebackAll();
	if (devkitVersion < 0x03070110)
	{
		sceSysregMeResetEnable();
		sceSysregMeBusClockEnable();
		sceSysregMeResetDisable();
	}
	else
	{
		sceSysregMeResetEnable371();
		sceSysregMeBusClockEnable371();
		sceSysregMeResetDisable371();
	}
	//Find SceMeRpc and disable it(causes indefinate wait when handling events, like suspend)
	PspSysEventHandler *handlers = sceKernelReferSysEventHandler();
	while (handlers != NULL){
		if (strcmp(handlers->name, "SceMeRpc") == 0){
			handler = handlers;
			sceKernelUnregisterSysEventHandler(handler);
			break;
		}
		handlers = handlers->next;
	}

	pspSdkSetK1(k1);

	return 0;
}
Exemple #4
0
int InitME(volatile struct me_struct *mei, int devkitVersion)
{
	unsigned int k1;

	k1 = pspSdkSetK1(0);

	if (mei == 0)
	{
   		pspSdkSetK1(k1);
   		return -1;
	}

	// initialize the MediaEngine Instance
	mei->start = 0;
	mei->done = 1;
	mei->func = 0;
	mei->param = 0;
	mei->result = 0;
	mei->precache_len = 0;
	mei->precache_addr = 0;
	mei->postcache_len = 0;
	mei->postcache_addr = 0;
	mei->signals = 0;
	mei->init = 1;

	// start the MediaEngine
	memcpy((void *)0xbfc00040, me_stub, (int)(me_stub_end - me_stub));
	_sw((unsigned int)me_loop,  0xbfc00600);	// k0
	_sw((unsigned int)mei, 0xbfc00604);			// a0
	sceKernelDcacheWritebackAll();
	if (devkitVersion < 0x03070110)
	{
		sceSysregMeResetEnable();
		sceSysregMeBusClockEnable();
		sceSysregMeResetDisable();
	}
	else
	{
		sceSysregMeResetEnable371();
		sceSysregMeBusClockEnable371();
		sceSysregMeResetDisable371();
	}

	pspSdkSetK1(k1);

	return 0;
}
Exemple #5
0
int main(int argc, char *argv[])
{
	SceCtrlData ctl;

	pspDebugScreenInit();

	sceCtrlSetSamplingCycle(0);
	sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);

	/* Copy our small program into the ME reset vector */
	memcpy((void *)0xbfc00040, me_run, (int)(me_end - me_run));
	sceKernelDcacheWritebackInvalidateAll();

	sceSysregMeResetEnable();
	sceSysregMeBusClockEnable();
	sceSysregMeResetDisable();
	sceSysregVmeResetDisable(); 

	while(1)
	{
		volatile u32 *count = (u32*) 0xBFC00060;

		pspDebugScreenSetXY(0, 0);
		pspDebugScreenPrintf("ME Basic Example, press Home to exit\n");
		sceKernelDcacheWritebackInvalidateAll();
		pspDebugScreenPrintf("ME Counter: %08x\n", *count);
		sceCtrlReadBufferPositive(&ctl, 1);
		if(ctl.Buttons & PSP_CTRL_HOME)
		{
			sceKernelExitGame();
		}

		sceDisplayWaitVblankStart();
	}

	return 0;
}