Patch to unpack-pbp

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

Moderators: cheriff, TyRaNiD

Post Reply
Archaemic
Posts: 38
Joined: Sun Mar 18, 2007 7:23 am

Patch to unpack-pbp

Post by Archaemic »

With the release of the second version of 3.93 (that I've found--the PSAR is slightly bigger than the version that was up earlier), the beginning of the PBP was padded such that the offset listed for the beginning (the PARAM.SFO) wasn't directly after the header. This was not being read properly by unpack-pbp. Here's a patch so that it is:

Code: Select all

--- unpack-pbp.c        (revision 2351)
+++ unpack-pbp.c        (working copy)
@@ -136,6 +136,12 @@
       
       // Skip the file if empty
       if (!size) continue;
+
+      // Seek to the proper position in the file
+      if (fseek(infile, header.offset[loop0], SEEK_SET) != 0) {
+         printf("ERROR: Could not seek in the input file.\n");
+         return -1;
+      }
       
       // Open the output file
       outfile = fopen(filename[loop0], "wb");
(That's actually executed for every file, which is superfluous, but I really shouldn't be working on this right now, so I'll leave it as an exercise for the reader to figure out how to get it to only seek on the first run of the loop)

E] Fixed, no thanks to me being stupid, and thanks to IWN being not stupid
Last edited by Archaemic on Wed Mar 19, 2008 9:59 am, edited 2 times in total.
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Re: Patch to unpack-pbp

Post by Insert_witty_name »

Archaemic wrote:

Code: Select all

+      if (fseek(infile, header.offset[loop0], SEEK_SET != 0)) {
That line doesn't look quite right...
Archaemic
Posts: 38
Joined: Sun Mar 18, 2007 7:23 am

Post by Archaemic »

...wow, how did I not notice that (and how did I write that in the first place)? Thank you. I must be dead today. Stupid midterms wreaking havoc on my brain!

E] Oh, wait, still dead. Let me see if it's not broken...it was working before, oddly.

E2] Yeah, it works.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Yesterday i read this topic, and a few minutes ago I found this:
http://forum.console-tribe.com/psp-offi ... 64033.html
Is it using your patch? In the readme file it's giving credit to a certain "Blaky"...
Archaemic
Posts: 38
Joined: Sun Mar 18, 2007 7:23 am

Post by Archaemic »

No, that's for unarchiving the 3.93 PSAR, not for unpacking the 3.93 PBP into its constituents. Wholly different.
Post Reply