forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Prx decryption kill me...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
*mUrDeRc0dE*



Joined: 16 Jun 2008
Posts: 13
Location: IDSTORAGE

PostPosted: Sat Sep 06, 2008 7:04 pm    Post subject: Prx decryption kill me... Reply with quote

Code:
#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;
}


i used this code for unpacking prx (delete bytes above 0x150) and then decompress the prx with pspDecompress function, but the psp crashes. I tryed to use static u8* buffers but the psp crashes. I tryed the zlib but the psp crashes...
_________________
Source code is for noobs...
Back to top
View user's profile Send private message
homemister



Joined: 24 Mar 2008
Posts: 25

PostPosted: Sat Sep 06, 2008 7:31 pm    Post subject: Reply with quote

Quote:
PSP_HEAP_SIZE_KB(1000*1024);

Your heep size is too big
try PSP_HEAP_SIZE_KB(10*1024);
That is 10Mb, you had 1Gb
Back to top
View user's profile Send private message
*mUrDeRc0dE*



Joined: 16 Jun 2008
Posts: 13
Location: IDSTORAGE

PostPosted: Sat Sep 06, 2008 8:51 pm    Post subject: Reply with quote

no, the heap isn't the problem...the psp crash
_________________
Source code is for noobs...
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sat Sep 06, 2008 8:59 pm    Post subject: Reply with quote

why is the code posted 2 times? or do you really have that in your source code??
by the way, setting the heap to 1gb...is not a problem? :P

and i dont agree with you when you say source code is for noobs, we all learn from reading source codes not only from reading books.
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat Sep 06, 2008 9:29 pm    Post subject: Reply with quote

I've never studied a programming language to school, but I've try to learn C with the online tutorial and read a source code can halp you to understand some things, so I don't think that source code is for noobs!
Back to top
View user's profile Send private message
FreePlay



Joined: 04 Jan 2006
Posts: 71
Location: Schenectady, New York, USA

PostPosted: Sun Sep 07, 2008 2:29 am    Post subject: Reply with quote

*mUrDeRc0dE* wrote:
no, the heap isn't the problem...the psp crash
Yes, the heap IS the problem. You're requesting 1024000 *KB* of space.
Back to top
View user's profile Send private message
Actarus



Joined: 19 May 2008
Posts: 33

PostPosted: Sun Sep 07, 2008 2:32 am    Post subject: Reply with quote

Where is the module pspdecrypt.prx?
_________________
Sam PSP Emulator
:)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group