[PSP] (Not) figuring out 1/2 Summer+ .pac texture file

YEARS AGO...

Finding no documentation nor anyone giving a single fuck about this game, I decided it would be a nice translation project.

Unfortunately, I originally thought it would be a good idea to work with the PSP remake-port-thing. This was a mistake since within the first couple of days I ran into a bunch of issues. Namely the .pac texture files. They're some obscure texture with no documentation - Which means I have to figure them out myself. After dicking around for a couple of days, I eventually gave up and started to work on the original PC version instead.

Good news: The PC game engine is easy to modify since it's well documented.
Bad news: 1/2 Summer+ for the PSP has exclusive content, so it needs to be ported back to the PC version.

Project stalled and pretty much stagnated here for a few years.





NOW:

Trying to find something to do (but mostly get rid of dead space), I thought it'd be fun to pick the project back up - but not so seriously this time.

With absolutely ZERO experience messing with texture files, I started off with the first thing any sensible romhacker/modder would do: Load the game into a disassembler. Spending a couple of days in the disassembler trying to make sense of at least the .pac portion basically led to absolutely nowhere. Back to square one.




Next try is to load the game in PPSSPP, dick around in it, and load a hex editor of a .pac texture file. Having the hex editor open at the same time probably didn't help at all, but that's besides the point.

First thing I did in PPSSPP was open the "GE debugger" and poke around with it. Probably doesn't help since it's more of an "interpretation" of what the texture file looks like in the PSP, but it's better than staring at a hex editor full of bytes.

Obviously not much of this makes sense, but I took a look at the "Texture" tab for hopefully more info.
Screenshot_1.png
Interesting... it has memory addresses, and the texture's format...

So, off to poke at memory for the "Texture L0 addr".
Screenshot_2.png
It doesn't look like much, but it does look familiar.

Screenshot_3.png
Turns out it is familiar. That's part of the .pac texture file I couldn't figure out for years.

Next to look at this "Tex CLUT" address...
Screenshot_5.png
Looks strangely familiar again...

Screenshot_4.png
Yep. Definitely part of the .pac texture file again.

Now, I'm not one for acronyms much, but if I had to assume, CLUT means color-look-up-table. And switching to CLUT view in the GE debugger, it looks like my assumption is right. It's a fucking color palette.
Screenshot_6.png

At this point, we know what some of the .pac texture file contains.
CLUT: 0x54 to 0x454
Raw data: 0x454 and beyond

We have almost everything we need to maybe form an image. But we still need to figure out what the image's width and height is.

Unfortunately, the GE debugger's "Texture L0 size" is not a reliable source since it's an interpretation, but it's a start.
So, while randomly messing around, I tried plugging 512 in as an integer. This made it return 0x00020000, which doesn't look like it's part of the pac texture.

Next is to try a short. This returns 0x0002
Screenshot_8.png
Looks like this is actually part of the pac texture.

Now, since I'm familiar with binary files, the short next to it must be the width or height (haven't figured it out yet).
Screenshot_9.png
Converting the hexadecimal over to decimal, it's 272.

Looking at Wikipedia (great source, right?) we can see that the PSP screen is 480 by 272 (width by height).

So, we can deduce that the first short is the width and the second short is the height. Apparently the framebuffer internally is larger than what is actually shown, so 512 would make sense. I don't remember where I heard this from - just trust me on this one.

We can then further prove this by multiplying 512 (width) by 272 (height) and getting 139264, then selecting all the bytes from 0x454 to the end of the file - which gives us 139264 bytes. So this means each byte is a single pixel.

Remember when I said that PPSSPP isn't a reliable source? That's what I meant by this. PPSSPP said 512x512, but the texture file is actually 512x272. PPSSSPP got it half right, to its credit.

Summary:
Width: 0x08 to 0x09 (short or 2 bytes)
Height: 0x0A to 0x0B (short or 2 bytes)
CLUT: 0x54 to 0x454 (1024 bytes - 1024/16=256 colors)
Raw data: 0x454 and beyond (width * height - each byte is 1 pixel?)

After some fumbling around in Noesis with barely any documentation, I managed to get SOMETHING - although it doesn't look like much.
Screenshot_10.png

And 30 minutes in while writing this post and purely dicking around, I managed to somehow get a full texture image. Lucky me. 🤦‍♂️
Screenshot_10.png

Unfortunately, it's not perfect and fails on certain images.
Screenshot_11.pngScreenshot_12.pngScreenshot_13.png

If you've somehow managed to make it this far by reading the entire post, congrats. Here's a cookie 🍪

If you skipped to the end... 😡
  • Like
Reactions: cearp

Comments

Blog entry information

Author
master801
Views
285
Comments
2
Last update

More entries in Personal Blogs

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: https://youtu.be/22tVWwmTie8?si=2CEDZldUW5ODozYh meh