PSAR Dumper 2.0 (PRX 2.0 format decrypted)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Anissian
Posts: 16
Joined: Fri Jan 26, 2007 8:40 pm

Post by Anissian »

I thought this could be an appropriate thread for requesting clarification about psardumper (as of v03). Apologies if this are answered elsewhere, I have not been able to find them:

Until now, I thought that when requesting a demangle or a decrypt by using the "g_mangleProc" or the "semaphore2" proc
FindProc("sceMemlmd", "semaphore", 0x4c537c72) the actual "data" needs to be prepended by a header that contains the "code" (initial seed), the size of the data and, as first u32, the lenght of this header in 32-bit words, as in:

Code: Select all

int Scramble(u32 *buf, u32 size, u32 code)
{
	buf[0] = 5;
	buf[1] = buf[2] = 0;
	buf[3] = code;
	buf[4] = size;

	if &#40;g_mangleProc&#40;buf, size+0x14, buf, size+0x14, 7&#41; < 0&#41;
	&#123;
		return -1;
	&#125;

	return 0;
&#125;
but in Encrypt, 4 is used:

Code: Select all

int Encrypt&#40;u32 *buf, int size&#41;
&#123;
	buf&#91;0&#93; = 4;
	buf&#91;1&#93; = buf&#91;2&#93; = 0;
	buf&#91;3&#93; = 0x100;
	buf&#91;4&#93; = size;

	/* Note&#58; this encryption returns different data in each psp,
	   But it always returns the same in a specific psp &#40;even if it has two nands&#41; */
	if &#40;g_mangleProc&#40;buf, size+0x14, buf, size+0x14, 5&#41; < 0&#41;
		return -1;

	return 0;
&#125;
I can't figure out why. What am I missing. Is the OP 5 different from OP 1, 7, 11? I am unsure of the format of the header (specifically giving the size may mean this header can be larger, and that psardump is using the "strict minimum". Is this header discussed elsewhere?.

On a side note, I also saw:

Code: Select all

int ReadFile&#40;const char* file, u32 offset, void *buf, u32 size&#41;
&#123;
	SceUID fd = sceIoOpen&#40;file, PSP_O_RDONLY, 0777&#41;;
	int read;

	if &#40;fd < 0&#41;
		return fd;

	if &#40;offset != 0&#41;
	&#123;
		sceIoLseek32&#40;fd, 0, PSP_SEEK_SET&#41;;
	&#125;

	read = sceIoRead&#40;fd, buf, size&#41;;
	sceIoClose&#40;fd&#41;;

	return read;
&#125;
there seems to be a weird use of the offset argument (should change the IoLseek call?). This does not seem to have an impact (not used).


Thanks in advance
Post Reply