Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspiofilemgr.h>
#include <string.h>
#include "pspDecrypt.h"
#define printf pspDebugScreenPrintf
/* Define the module info section */
PSP_MODULE_INFO("template", 0, 1, 1);
/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(1000*1024);
int PspUnpack(u8* inBuf, u8* outBuf)
{
	int prx_com,prx_upk,prx_dec;
	char buf[200*1024];
	char c_buf[128*1024];
	
	if(!(prx_com = sceIoOpen("ms0:/PRX/testprx.prx",  PSP_O_RDONLY, 0777))) {
        printf("Cannot open the source prx\n");
	}
	
	if(!(prx_upk = sceIoOpen("ms0:/PRX/testprx_upk.prx", PSP_O_WRONLY|PSP_O_CREAT, 0777))) {
        printf("Cannot create the unpacked prx\n");
	}
		  
	int mod = pspSdkLoadStartModule("pspdecrypt.prx", PSP_MEMORY_PARTITION_KERNEL);
	if (mod < 0)
	{
		printf("Cannot load pspdecrypt module");
	}
	
	printf("Prx decompression phase 1 - Bytecopyng\n");
	
	int prxsize = sceIoRead(prx_com,buf,1000000000);
	int destsize = prxsize - 336;
	
	sceIoLseek(prx_com,0x150, PSP_SEEK_SET);
	sceIoRead(prx_com,buf,1000000000);
	
	memset(&buf,0,sizeof(buf));
		
	printf("Prx size = %ikb(%ib)\n",prxsize / 1024,prxsize);
	
	int decPrxSize = pspDecompress((u8*)buf,(u8*)c_buf,sizeof(c_buf));
		
	sceIoWrite(prx_upk,c_buf,decPrxSize);
	
	sceIoClose(prx_com);
	sceIoClose(prx_upk);
	
	sceKernelDelayThread(10000000);
	sceKernelExitGame();
	
	return 0;
}
int main(int argc, char *argv[])
{
	pspDebugScreenInit();
	pspDebugScreenPrintf("Prx unpacker & decrypter\nCode : Murderc0de\n\n");
	
	PspUnpack(10,10);
	return 0;
}
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspiofilemgr.h>
#include <string.h>
#include "pspDecrypt.h"
#define printf pspDebugScreenPrintf
/* Define the module info section */
PSP_MODULE_INFO("template", 0, 1, 1);
/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(1000*1024);
int PspUnpack(u8* inBuf, u8* outBuf)
{
	int prx_com,prx_upk,prx_dec;
	char buf[200*1024];
	char c_buf[128*1024];
	
	if(!(prx_com = sceIoOpen("ms0:/PRX/testprx.prx",  PSP_O_RDONLY, 0777))) {
        printf("Cannot open the source prx\n");
	}
	
	if(!(prx_upk = sceIoOpen("ms0:/PRX/testprx_upk.prx", PSP_O_WRONLY|PSP_O_CREAT, 0777))) {
        printf("Cannot create the unpacked prx\n");
	}
		  
	int mod = pspSdkLoadStartModule("pspdecrypt.prx", PSP_MEMORY_PARTITION_KERNEL);
	if (mod < 0)
	{
		printf("Cannot load pspdecrypt module");
	}
	
	printf("Prx decompression phase 1 - Bytecopyng\n");
	
	int prxsize = sceIoRead(prx_com,buf,1000000000);
	int destsize = prxsize - 336;
	
	sceIoLseek(prx_com,0x150, PSP_SEEK_SET);
	sceIoRead(prx_com,buf,1000000000);
	
	memset(&buf,0,sizeof(buf));
		
	printf("Prx size = %ikb(%ib)\n",prxsize / 1024,prxsize);
	
	int decPrxSize = pspDecompress((u8*)buf,(u8*)c_buf,sizeof(c_buf));
		
	sceIoWrite(prx_upk,c_buf,decPrxSize);
	
	sceIoClose(prx_com);
	sceIoClose(prx_upk);
	
	sceKernelDelayThread(10000000);
	sceKernelExitGame();
	
	return 0;
}
int main(int argc, char *argv[])
{
	pspDebugScreenInit();
	pspDebugScreenPrintf("Prx unpacker & decrypter\nCode : Murderc0de\n\n");
	
	PspUnpack(10,10);
	return 0;
}

