what PRINCE.EXE to use?

Windows and Linux editor of PoP1 (for DOS and SNES) and PoP2 (for DOS).
Post Reply
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

what PRINCE.EXE to use?

Post by Norbert »

The past couple of weeks, I've been working on apoplexy and I'm very close to releasing a new version.

I'm wondering if anyone has a good solution to the following problem, related to the PRINCE.EXE file.
What I would like is a PRINCE.EXE v1.0 file that loads all resources in all levels, but that doesn't load the potions level when I start level 2 as such: PRINCE.EXE megahit 2
The problem I'm running into is that the only working CusPop version that I'm aware of (the one at popot.org) uses this (renamed PRINCE.EXE) file hosted at princed.org.
And that file seems to be cracked in a way that does not skip the potions level when the game is started as I wrote above.
Is what I write correct? Any ideas how to tackle this problem? Should I contact poirot and, if so, what replacement file should I ask him to upload?
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Re: what PRINCE.EXE to use?

Post by poirot »

I'm just explaining in case other people read the thread (for more info read viewtopic.php?f=68&t=2903), here is a small explanation of the .exe files I've added to CusPop:
  • bin.p0: Prince v1.0 packed
    bin.p3: Prince v1.3 packed
    bin.p4: Prince v1.4 packed
    bin.u0: Prince v1.0 unpacked
    bin.u3: Prince v1.3 unpacked
    bin.u4: Prince v1.4 unpacked
The original distribution of POP was packed (packed files are smaller but some features can't be edited, the optimal way to create a distribution is to edit the unpacked version and re-pack the downloaded file).

Now the problem with the potion level (I believe it was prince megahit 15) is that I'm using a Prince v1.0 (bin.{p0,u0}) cracked by R. Bubba Magillicutty from THG, just because I couldn't fing the original Prince v1.0 file without the crack. I included it anyway to just help people to create mods without a potion level and because it was the file used by most crackers. If you can find the original file, CusAsm is designed to find all the offsets in the file so we can add it to the .xml file and CusPop.

I would also like to create a new version of CusPop using jQuery that directly parses the .xml file, generates a proper form hiding disabled fields for this version and supports save using browser cookies or user login.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: what PRINCE.EXE to use?

Post by Norbert »

poirot wrote:Here is a small explanation of the .exe files I've added to CusPop: [...]
Yep, I know...
I wrote diffpop and added ExePack and UPackExe to popot.org. ;)
poirot wrote:If you can find the original file, [...]
It's in Andrew's "The Ultimate Collection (DOS) v1.3 (New)".
poirot wrote:I would also like to create a new version of CusPop using jQuery that [...]
Sounds great (better not force a user login, I think).

Is there any way you could easily use some CusPop version out there to patch this PRINCE.EXE to allow all resources in all levels?
That version doesn't have the potions issue and it would be very nice if I could provide users with some kind of PoP1 package that will work nicely with level editors.
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Re: what PRINCE.EXE to use?

Post by poirot »

Yes, tell me what is the version of this EXE and what cracks has it inside?
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: what PRINCE.EXE to use?

Post by Norbert »

[Edit: I've updated the PoP1.zip file on popot.org, so this information is no longer 100% valid!]
poirot wrote:Yes, tell me what is the version of this EXE and what cracks has it inside?
Actually, I've figured out how I can fix the problem myself. :D
I can simply use the CusPop result that's being generated from bin.u0 and then change the 0000610F from 75 to EB.
I've attached a three-way hex comparison of the differences below:

Code: Select all

-------------
iscracked: http://www.popot.org/get_the_games/software/PoP1.zip
uncracked: PoP_TUC/PoP1_10/Prince.exe (from The Ultimate Collection)
princedu0: http://www.princed.org/wp-content/plugins/cuspop/vers/bin.u0

First, use UPackExe on iscracked and uncracked: http://www.popot.org/other_useful_tools/software/pack_unpack.zip
-------------
0000 610F
iscracked: EB
(.)
uncracked: 75
(u)
princedu0: 75
(u)
-------------
0000 6210 - 0000 6218
iscracked: 8C 1E 0A 00 FF 1E 08 00 90
(.........)
uncracked: 89 46 06 A1 9E 00 39 46 06
(.F....9F.)
princedu0: 8C 1E 0A 00 FF 1E 08 00 90
(.........)
-------------
0001 C598 - 0001 C5CF
iscracked: 0D 00 48 49 00 83 F8 01 75 05 C6 06 0C 00 00 83 F8 02 75 0F 80 3E 0C 00 01 74 08 B8 10 00 C6 06 0C 00 01 89 46 06 A1 9E 00 39 46 06 CB 52 42 4D 2F 54 48 47 20 20 20 20
(..HI....u.........u..>...t..........F....9F..RBM/THG    )
uncracked: 4D 53 20 52 75 6E 2D 54 69 6D 65 20 4C 69 62 72 61 72 79 20 2D 20 43 6F 70 79 72 69 67 68 74 20 28 63 29 20 31 39 38 38 2C 20 4D 69 63 72 6F 73 6F 66 74 20 43 6F 72 70
(MS Run-Time Library - Copyright (c) 1988, Microsoft Corp)
princedu0: 0D 00 48 49 00 83 F8 01 75 05 C6 06 0C 00 00 83 F8 02 75 0F 80 3E 0C 00 01 74 08 B8 10 00 C6 06 0C 00 01 89 46 06 A1 9E 00 39 46 06 CB 52 42 4D 2F 54 48 47 20 20 20 20
(..HI....u.........u..>...t..........F....9F..RBM/THG    )
-------------
0001 F97E - 0001 F98C
iscracked: 48 6F 70 65 20 79 6F 75 20 65 6E 6A 6F 79 65
(Hope you enjoye)
uncracked: 72 75 6E 2D 74 69 6D 65 20 65 72 72 6F 72 20
(run-time error )
princedu0: 48 6F 70 65 20 79 6F 75 20 65 6E 6A 6F 79 65
(Hope you enjoye)
-------------
0001 F9B7 - 0001 F9D7
iscracked: 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 0D
(d it - R. Bubba Magillicutty/THG.)
uncracked: 52 36 30 30 31 0D 0A 2D 20 6E 75 6C 6C 20 70 6F 69 6E 74 65 72 20 61 73 73 69 67 6E 6D 65 6E 74 0D
(R6001..- null pointer assignment.)
princedu0: 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 0D
(d it - R. Bubba Magillicutty/THG.)
-------------
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Re: what PRINCE.EXE to use?

Post by poirot »

Great! Anyways, I'd like to fix CusPop and add the uncracked version. I'll do it as soon as I have some free time.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: what PRINCE.EXE to use?

Post by Norbert »

poirot wrote:Anyways, I'd like to fix CusPop and add the uncracked version.
Yes, we should have enough information to start with the non-cracked version.
And then allow either a crack that will skip the potions level while playing regularly but not with megahit, and a crack that will always skip the potions level.
The quitting text could also be customizable.
poirot wrote:I'll do it as soon as I have some free time.
Maybe take a well-deserved vacation to free up some hacking time? :lol:
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: what PRINCE.EXE to use?

Post by David »

Is this still a problem?

Some time ago, Andrew asked me in PM about disabling the potions level. (He wrote he was making an "Ultimate Prince Patching Project", but he didn't post anything related to that.)
This was the simplest I could come up with: (You need to start with the original EXE.)
David wrote:Also, I have found yet another way for disabling in PoP1:
Find the word "unpack". After that, there are some 00-s (and in 1.3 and 1.4, the version string), and then a 02.
That 02 determines which level should be preceded by the copy protection level. Interestingly, if you replace it with 00, the copy protection level will not appear, not even when loading a saved game.
The only problem with this method is that 1.3 and 1.4 restore this value after a Ctrl-R. In these versions, you should replace 02 and the 00 following it with FF FF.
The other cracks (which all seem to be based on the RBM/THG one) have this bug: (Andrew said that's why he wanted to redo them.)
Make sure you have a saved game.
Start the game in cheat mode. Press Ctrl-L on the title screen.
Press Shift-L until you get to level 1. - Or, press Ctrl-R and any key to start a new game.
If you press Shift-L now, you'll get to the saved level.
But wait, there's more:
Again, press Shift-L until you get to level 1. (Don't use Ctrl-R this time!)
If you press Shift-L now, the game will crash with an "R6003 - integer divide by 0" error, leaving DosBox in a messy state.

I debugged the game to see what's happening, and the bug involves these:
- some code was added in place of the "Run-Time Library" text, *
- some flag-byte is used by this code, that is not in sync with the rest of the game,
- this code would load level 16 that would come after level 15, and the game would use it to detect when it needs to continue after an interruption - but only the first time,
- level 16 is an out-of-bounds index into the cutscenes table,
- this causes the game to jump into random memory (0001:010C),
- and finally an ES: AAM ON 0 instruction (26 D4 00) (at 0001:0400) stops all this madness.

* By the way, this is why the game always exits with an error, which originally was "R6001 - null pointer assignment", but RBM/THG replaced it with their message.
From http://support.microsoft.com/kb/71252:
The location of the null segment can be observed in a link map. It starts at DS:0 and is 42H bytes long. The Microsoft copyright notice is written there at program startup and if this area is written to during the course of the program, the run-time error R6001 will be generated upon program termination.
Indeed, this is the part of prince.exe that checks this:

Code: Select all

seg010:0FFE check_ms_string proc far		    ; CODE XREF: exit+2CP
seg010:0FFE		    push    si
seg010:0FFF		    xor	    si,	si
seg010:1001		    mov	    cx,	42h ; 'B'
seg010:1004		    xor	    ah,	ah
seg010:1006		    cld
seg010:1007 
seg010:1007 loc_17AC7:				    ; CODE XREF: check_ms_string+Cj
seg010:1007		    lodsb
seg010:1008		    xor	    ah,	al
seg010:100A		    loop    loc_17AC7
seg010:100C		    xor	    ah,	55h
seg010:100F		    jz	    loc_17AE2
seg010:1011		    call    write_runtime_error
seg010:1016		    mov	    ax,	1	    ; null pointer assignment
seg010:1019		    push    ax
seg010:101A		    call    write_errmsg
seg010:101F		    mov	    ax,	1
seg010:1022 
seg010:1022 loc_17AE2:				    ; CODE XREF: check_ms_string+11j
seg010:1022		    pop	    si
seg010:1023		    retf
seg010:1023 check_ms_string endp
(Uhh, I've been writing this post for almost an hour! (It's not unusual for my detailed posts!) I'd better submit it now!)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: what PRINCE.EXE to use?

Post by Norbert »

David wrote:(Uhh, I've been writing this post for almost an hour! (It's not unusual for my detailed posts!) I'd better submit it now!)
Interesting stuff.
It's crazy how much knowledge has been acquired about all the details of this almost 25 year old game. :)
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: what PRINCE.EXE to use?

Post by David »

David wrote:Also, I have found yet another way for disabling in PoP1:
Find the word "unpack". After that, there are some 00-s (and in 1.3 and 1.4, the version string), and then a 02.
That 02 determines which level should be preceded by the copy protection level. Interestingly, if you replace it with 00, the copy protection level will not appear, not even when loading a saved game.
The only problem with this method is that 1.3 and 1.4 restore this value after a Ctrl-R. In these versions, you should replace 02 and the 00 following it with FF FF.
Now I found out why do you need FF FF.
Our newest member Yury sent me some PMs, asking about the various cracks:
And why 1.1, 1.3 and 1.4 versions restore potions level after Ctrl+R in case we replace 02 with 00, but do not restore if we replace 02 00 with FF FF?
They contain an explicit check at Ctrl-R: If copyprot_level is not -1 then it is restored to 2.

Code: Select all

1.0
seg000:0620                      label_key_ctrl_r:
seg000:0620 C7 06 B8 42 00 00                    mov     start_level, 0
seg000:0626 0E                                   push    cs
seg000:0627 E8 2E FD                             call    near ptr start_game

Code: Select all

1.3
seg000:070C                      label_key_ctrl_r:
seg000:070C C7 06 B2 44 00 00                    mov     start_level, 0
seg000:0712 83 3E 2E 01 FF                       cmp     copyprot_level, 0FFFFh
seg000:0717 74 06                                jz      loc_71F
seg000:0719 C7 06 2E 01 02 00                    mov     copyprot_level, 2
seg000:071F                      loc_71F:
seg000:071F 0E                                   push    cs
seg000:0720 E8 F4 FC                             call    near ptr start_game
But why? I figured it out only now.
Start the original 1.0, load a saved game. Now the potions level starts. Press Ctrl-R, and complete level 1.
You won't see the potions level now. It will appear only if you reach the level that was in the saved game.

And if the saved game had a non-existent level, then you will never reach that level.

Perhaps some clever people found this out, and Broderbund wanted to stop that.

This is not the only potions level-related bug in 1.0 that was fixed later, though.
For example, in cheat mode, you can skip the potions level with Shift-L.

Another: Drink a potion on the potions level. Note that the letter disappears.
Press Ctrl-R and start the potions level again. The letter at that place will not appear.
Andrew
Wise Scribe
Wise Scribe
Posts: 313
Joined: July 16th, 2009, 4:39 pm

Re: what PRINCE.EXE to use?

Post by Andrew »

David wrote:Start the original 1.0, load a saved game. Now the potions level starts. Press Ctrl-R, and complete level 1.
You won't see the potions level now. It will appear only if you reach the level that was in the saved game.

And if the saved game had a non-existent level, then you will never reach that level.

Perhaps some clever people found this out, and Broderbund wanted to stop that.

This is not the only potions level-related bug in 1.0 that was fixed later, though.
For example, in cheat mode, you can skip the potions level with Shift-L.

Another: Drink a potion on the potions level. Note that the letter disappears.
Press Ctrl-R and start the potions level again. The letter at that place will not appear.
:lol: I haven't played 1.0 as much as the later versions, but wow that is such an obvious bug! So much fun finding these (or in my case mainly reading about what you found) and testing them. Love it that even after all these years there are still interesting bits 'n' pieces to discover in these games.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: what PRINCE.EXE to use?

Post by Norbert »

Andrew wrote:Love it that even after all these years there are still interesting bits 'n' pieces to discover in these games.
Yes, it's cool. :)
Plus, with SDLPoP, there's now a whole new realm of possibilities.
Post Reply