md5sums of PRINCE.EXE files

Discuss PoP1 for DOS here.
Post Reply
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

md5sums of PRINCE.EXE files

Post by Norbert »

I'm busy trying to find out which PRINCE.EXE files of mods in Total Pack 2.06 have been changed and which have not. Basically, I want to know all the MD5 checksums of the 'default/clean' (but cracked) PRINCE.EXE files for versions 1.0, 1.3 and 1.4.

I'm unsure these are correct:
http://www.princed.org/standards/xml/princehack.xml

While looking into this, I noticed that there are two very similar - but different - PRINCE.EXE files being used a lot. Their MD5 checksums are:
4ac7c522469baa084f1687c1c93f38c3 (used 23 times, for example: p02_4d, p15_hobbit)
b75f8ed573f71c22f57038ee7795df58 (used 13 times, for example: p01_original, p17_sword)

Both: used a lot, version 1.0, 123335 bytes (packed with ExePack), potions level disabled, 60 minutes starting time, and so on. So, what is different? I used vbindiff to compare these binary files and found three sections with differences:

EB -> 74
EB -> 74
B8 01 00 90 -> 1B C0 F7 D8

However, the "1.0 packed" version of CusPop has a different md5sum:
064b9d41972630f2cf26a4732ff29d13

The version on Abandonia has yet another md5sum:
15d0bb09cc74a33980c76db91499f2ba

This makes me wonder: which one is the default and what has been changed in the other semi-default versions? I might look into this further and post additional information in this thread.
Andrew
Wise Scribe
Wise Scribe
Posts: 313
Joined: July 16th, 2009, 4:39 pm

Re: md5sums of PRINCE.EXE files

Post by Andrew »

I believe my collection has the unmodified files for each version, copied from original floppies/CDs or disk images wherever possible. You can download the latest version below (or at least the latest I have access to at present, but later versions only had new cracks and no changes to the game files themselves). If you find any discrepancy where you can conclusively state that any file in my collection is not the original, kindly do let me know so that I can update it accordingly.

So this pretty much solves your issue of figuring out the hashes for each version of PoP1/2, but that's only for the original packed versions of the EXEs. I had faced this issue of reliably detecting the version back when I was coding a small utility, and the problem is that when it comes to unpacked versions, different unpackers result in different unpacked EXEs. They all work the same and are the exact same size of course, but due to the very nature of the process, they don't result in bit-for-bit exact copies. For example, I just unpacked my PoP1 v1.4 EXE with UNP 4.12β and UPACKEXE.EXE 1.00a respectively, and ended up with 2 different hashes. So the hashes for the unpacked versions in that XML you linked to are only valid as long as the same unpacker is used (and maybe even the same version as well).

As for the cracks, don't even get me started on those. Image There are many available for each version, except for the latest PoP1 v1.4 and PoP2 v1.1, for which I believe my cracks are the only ones available (couldn't find any others and my requests fell on deaf ears, so still would like better ones compared to my amateurish attempts). Thus IMO there's no use listing hashes for all the cracks out there, unless maybe you find the best for each version and declare those as the "official" ones to be used.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: md5sums of PRINCE.EXE files

Post by Norbert »

Norbert wrote:[...], I noticed that there are two very similar - but different - PRINCE.EXE files being used a lot. [...] I used vbindiff to compare these binary files and found three sections with differences:

EB -> 74
EB -> 74
B8 01 00 90 -> 1B C0 F7 D8
I figured out how these PRINCE.EXE files are different. According to princehack.xml, these three sections (starting at 0xA7BB, 0xAC9B and 0xC51C) are all related to "WDA in palace". WDA stands for wall-drawing algorithm. If this hack is enabled, the dungeon WDA will be used for palace levels. (More information in this thread.) In other words, the only difference between these 23 similar PRINCE.EXE files in Total Pack 2.06 and these other 13 similar PRINCE.EXE files in the same pack is whether or not the WDA is enabled for palace levels.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: md5sums of PRINCE.EXE files

Post by Norbert »

I found something that can be changed that isn't in princehack.xml yet. :D

I was just comparing the 23 similar PRINCE.EXE files from Total Pack 2.06 (the ones with "WDA in palace" disabled; which, by the way, are the same as PrinceC1.exe in Andrew's pack) with the packed 1.0 version of CusPop and found 3 sections with differences. None of them are known by princehack.xml, because diffpop finds 0 differences. The three sections are:

-----
1. 4A5F
(23 similar) EB
(CusPop) 75

2. 4B72
(23 similar) 90 90 90 90 90
(CusPop) C7 46 06 0F 00

3. 1D3BF / 1D3F8
(23 similar) 68 74 74 70 3A 2F 2F 77 77 77 2E 70 72 69 6E / 63 65 6F 66 70 65 72 73 69 61 2E 74 6B 20 2D 20 4A 61 6C 61 6C 20 4E 6F 75 72 65 64 64 69 6E 65
(CusPop) 48 6F 70 65 20 79 6F 75 20 65 6E 6A 6F 79 65 / 64 20 69 74 20 2D 20 52 2E 20 42 75 62 62 61 20 4D 61 67 69 6C 6C 69 63 75 74 74 79 2F 54 48 47
-----

Guess what the 3rd sections spell out... :)

(23 similar) http://www.princeofpersia.tk - Jalal Noureddine
(CusPop) Hope you enjoyed it - R. Bubba Magillicutty/THG

These messages are shown when, instead of closing DOSBox, the user quits PoP1 normally using Ctrl-Q.

I do not yet know what the first two sections do.

PrinceC2.exe in Andrew's pack is the same as the executable from Abandonia, and the only difference between these files and the packed 1.0 version of CusPop is that single byte in aforementioned section 1. The original Prince.exe has 75, so it seems that Jalal Noureddine decided to change that byte.

[Edit: I had to edit this post a couple of times, to correct/clarify things.]
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: md5sums of PRINCE.EXE files

Post by Norbert »

Norbert wrote:I do not yet know what the first two sections do.
However, htamas had/has already looked into this further.
- The first section is a +5 jump, either unconditional (EB 05) or conditional (75 05).
- The second section sets a variable to 15 (= potions level), or it does nothing (5x 90).
- The original PRINCE.EXE has a null pointer assignment message in the third section, so obviously that's being triggered.

At some point in time, I will try out various combinations of these changes to see what effect they have exactly when:
- starting with "megahit 2",
- starting with "demo" (what version to use?),
- load a game from the title screen,
- load a game from the title screen, then die,
- load a game from the title screen, then press Ctrl-A.

There's one thing I don't understand. Is the cheat option (megahit/improved) part of the original PRINCE.EXE and, if so, doesn't that by itself somewhat defeat the purpose of adding the potions level? Surely they understood that sooner or later someone would find out about the cheat option and use it to skip the potions level. Or at least, that is possible with the - supposedly original - "Prince.exe" file in Andrew's package. Or maybe that executable also isn't the original...
Andrew
Wise Scribe
Wise Scribe
Posts: 313
Joined: July 16th, 2009, 4:39 pm

Re: md5sums of PRINCE.EXE files

Post by Andrew »

Norbert wrote: However, htamas had/has already looked into this further.
- The first section is a +5 jump, either unconditional (EB 05) or conditional (75 05).
- The second section sets a variable to 15 (= potions level), or it does nothing (5x 90).
So what does the jump or setting the variable actually accomplish? I'm guessing it has something to do with skipping the copy-protection level?
Norbert wrote: There's one thing I don't understand. Is the cheat option (megahit/improved) part of the original PRINCE.EXE and, if so, doesn't that by itself somewhat defeat the purpose of adding the potions level? Surely they understood that sooner or later someone would find out about the cheat option and use it to skip the potions level. Or at least, that is possible with the - supposedly original - "Prince.exe" file in Andrew's package. Or maybe that executable also isn't the original...
The cheats are part of the original games. From my testing, none of the PoP1 versions display the copy-protection level when you use the cheats to directly start the game from a given level. All do show the copy-protection level when loading from a saved game (irrespective of cheats being used or not). Cheats don't allow you to skip the copy-protection level once it's shown.

PoP2 IR (Initial Release) seems to behave the same as PoP1. However, with PoP2 1.0 and 1.1, you now have the copy-protection level being shown whether you load from a saved game, or whether you use a cheat to directly try and jump to a later level. So better copy-protection was implemented with PoP2 1.0 onwards.

P.S. The files are original as far as I know. I preferred extracting from original unmodified floppy/CD images wherever possible. But like I said, if anyone finds a supposedly unmodified source with different files, please do let me know.

P.P.S. Regarding skipping the copy-protection level using the cheats, what good does it do to anyone interesting in playing properly? You can't skip the level while playing normally, and you can't skip it while loading a saved game. Starting a game directly from the next level means your flow is interrupted (since you need to quit and restart), plus your timings are not maintained for the entire game.
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Re: md5sums of PRINCE.EXE files

Post by poirot »

It's funny. I've used unexe (UNEXE v1.0, 05b57c5d750d5a87073a8eb363aaeb59) but I've tried to recreate the unpacked files and got different md5sums, even worse, both unpacked files pipped hexdump differs a lot! So maybe I've used another tool or changed something in the files. Interesting because unexe was in this directory.

I remember reading in the forum prince.exe was compiled using a quickC or something like that and packed using another tool, I believe I've used this tool. I should take a deeper look to the forum.

Edit:

From viewtopic.php?f=69&t=366
poirot wrote:the code was made in MS Quick C and packed with an exe packing tool, you can download that and get the original msqc exe file to make dissasembling much human readable.
Post Reply