POP 2 Reverse engineering in the development of PR 1.2

About PR usage and development, and about the POP format.

Moderator: English Moderator Team

Post Reply
User avatar
poirot
Princed Developer
Princed Developer
Posts: 382
Joined: March 24th, 2003, 8:52 pm
Location: Ushuaia, Argentina
Contact:

POP 2 Reverse engineering in the development of PR 1.2

Post by poirot » February 8th, 2006, 6:27 am

Yes, for the fans of pop2, we had great news about the inmprovements:

From earlier experiences working in reverse engineering in pop1 we knew the following image could be 88x79 pixels. Looking at the image it is obvious that there is a compression algorithm involved. It seems to be a very hard work, let's see what happened.

<img src="http://forum.princed.com.ar/images/shots/1.png" alt="shot 1" />

I found something really interesing: the LZG checksum is right, it can't be a coincidense, it has to be compressed with an LZG variant or something.

<img src="http://forum.princed.com.ar/images/shots/2.png" alt="shot 2" />

Well, luckely it was only an offset problem, now we know it has a layer of LZG. Now we see the garbage has a uniform distribution. But, there are still a lot of work to do.

<img src="http://forum.princed.com.ar/images/shots/3.png" alt="shot 3" />

I couldn't keep working without the propper palette, so I took my time to reverse it. Why a palette is so important? Well, not only to see it more realistic but also because of the following process:
Corrupting the image we can find where in the game is located and the edge of the image. Then we can repair the image and using pop recorder, take a screen shot of both -the screen with the image corrupted and the screen without corruptions-.
Compearing both images we can crop exactly the right image making it fit in the corrupted place and voi-la... we have a bitmap of the image in question! With the propper difference layering in a powerful photo editor I was able to drop the transparented pixels and get the original image.
And now is then the palette goes in... applying the palette to this image with the nearest colour method I was able to get extracted from the game the real image paletted with the same indexes. Now saving it as raw will get me the uncompressed original binary code. And now, let the hex editor show the compression patterns.
As we can see our image has improved only in the colours.

<img src="http://forum.princed.com.ar/images/shots/4.png" alt="shot 4" />

Hey, this looks like an rle layer. Now it seems to be a bit more realistic... well... only a bit...

<img src="http://forum.princed.com.ar/images/shots/5.png" alt="shot 5" />

And now... the results

<img src="http://forum.princed.com.ar/images/shots/6.png" alt="shot 6" />

User avatar
CrazyDiamond
Vizier
Vizier
Posts: 92
Joined: September 13th, 2005, 12:17 am
Location: Persia

Post by CrazyDiamond » February 8th, 2006, 7:40 pm

:D :D :D :D :D

cool :wink:
remember when you were young / you shone like the sun / shine on you crazy diamond

User avatar
peter_k
Sheikh
Sheikh
Posts: 29
Joined: March 28th, 2004, 3:00 pm
Location: Gdynia
Contact:

Post by peter_k » February 9th, 2006, 12:23 pm

Really good work! Can PR extract now each dat file? Maybe i'll made my own pop2 engine in future ;)

User avatar
poirot
Princed Developer
Princed Developer
Posts: 382
Joined: March 24th, 2003, 8:52 pm
Location: Ushuaia, Argentina
Contact:

Post by poirot » February 9th, 2006, 11:28 pm

not right now, I still need to add the extractor in PR, and then code a compressor too!

User avatar
poirot
Princed Developer
Princed Developer
Posts: 382
Joined: March 24th, 2003, 8:52 pm
Location: Ushuaia, Argentina
Contact:

Post by poirot » February 10th, 2006, 4:27 am

Btw, I'm still having troubles with the images with a height more than 90 pixels, I hope I can find the solution and code a nice extraction routine for PR.

Ohh, and thanks, pop recorder helped a lot!

Post Reply