Disassemblies of PoP2
Disassemblies of PoP2
Here is a disassembly of PoP2 IR.
(I already mentioned that I started this, here: viewtopic.php?p=14176#p14176 )
Note that this EXE is overlaid, that is, different parts are loaded at the same place at different times.
Since IDA can't handle this, there is a huge empty area in the middle of the disassembly. (Between non-overlaid code and data.)
(I already mentioned that I started this, here: viewtopic.php?p=14176#p14176 )
Note that this EXE is overlaid, that is, different parts are loaded at the same place at different times.
Since IDA can't handle this, there is a huge empty area in the middle of the disassembly. (Between non-overlaid code and data.)
- Attachments
-
- pop2_ida.zip
- (1.94 MiB) Downloaded 274 times
Re: Disassembly of PoP2 IR
So, the 0011 file is the overlay? How did you extract it manually? I'm also wondering how you managed to get output with things like "cmp level_type, caverns". Was that altered/added by hand? I am a (dis)assembly noob and used ndisasm, but didn't get any of that information. I also tried using various unpackers first, but got nothing better.
Re: Disassembly of PoP2 IR
On a somewhat related note. I'm trying to figure out for which rooms the EXE overrides what happens when you leave the room, for a future document about PoP2 events. Sometimes leaving to the bottom will have the prince falling/screaming down a pit; sometimes leaving to a side will have the prince end up in another room than the room links specify. Figuring this out by hand is a lot of work, so I'm looking at the disassembly.
In level 6, room 27 always has room 3 to its left. I found mentions of "room_left" but nothing interesting nearby, and searched for 1Bh (27) and then 3 nearby but didn't find anything.
Down in room 13 of level 13 is a pit. So, I searched for 13 and eventually found "seg003:019B cmp shown_room, 13; level 13, room 13: chasm". Then I searched for "chasm" and found several other hits...
...but this is incomplete. Several are still missing, like the flame room (level 13, room 4) and several rooms of level 1 (rooftops).
In level 6, room 27 always has room 3 to its left. I found mentions of "room_left" but nothing interesting nearby, and searched for 1Bh (27) and then 3 nearby but didn't find anything.
Down in room 13 of level 13 is a pit. So, I searched for 13 and eventually found "seg003:019B cmp shown_room, 13; level 13, room 13: chasm". Then I searched for "chasm" and found several other hits...
Code: Select all
seg003:17C6 cmp level_number, 9 ; level 9 room 16: chasm
seg003:17D7 cmp level_number, 6 ; level 6 room 27: chasm
seg010:0674 cmp level_number, 9 ; level 9 room 16: chasm
Re: Disassembly of PoP2 IR
Yes, it is *an* overlay, though it's not in a separate file (originally).Norbert wrote:So, the 0011 file is the overlay?
This overlay is different from the others in this exe, because it is always loaded.
The other overlays contain code that is loaded only in some cases, for example, depending on the type of the level.
There is a part in the file that stores where the overlays are in the file, and where are they loaded. In the disassembly I marked it with the label "ovl_segments".Norbert wrote:How did you extract it manually?
Note that sizes and addresses have to be multiplied by 16.
Yes, all names (and comments) were added by me. (Of course this means that some of them may be wrong or misleading.)Norbert wrote:I'm also wondering how you managed to get output with things like "cmp level_type, caverns". Was that altered/added by hand? I am a (dis)assembly noob and used ndisasm, but didn't get any of that information.
PRINCE.EXE of PoP2 is not compressed.Norbert wrote:I also tried using various unpackers first, but got nothing better.
Norbert wrote:Sometimes leaving to the bottom will have the prince falling/screaming down a pit;
Level 13, room 4 has no room linked at the bottom, so it does not need any special events. Same is the case with level 1, except with room 11.Norbert wrote:Several are still missing, like the flame room (level 13, room 4) and several rooms of level 1 (rooftops).
Some other rooms, however, have another room linked at their bottom, but treated as having nothing below.
Examples are: level 13 room 13, level 5 room 10, level 14 room 5.
I tried something: I changed the level type of level 6 to temple. After that, this special event did not work anymore.Norbert wrote:In level 6, room 27 always has room 3 to its left. I found mentions of "room_left" but nothing interesting nearby, and searched for 1Bh (27) and then 3 nearby but didn't find anything.
But I can't find where is this event specified.
I tried these: (after restoring the level type, of course!)
* To zero out all the modifiers so that the custom background is not loaded.
* To delete the CUST resource for this room.
* Scan the exe for all instances of "cmp <something>,27" (and 28) and replaced 27/28 with 0.
Next step would be using the DOSBox debugger... (To catch the moment when the kid is moved to room 3.)
-
- Calif
- Posts: 553
- Joined: August 27th, 2011, 2:04 am
Re: Disassembly of PoP2 IR
This means, that will be more easy to create a prince of persia 2 editor and mods??
Check my Prince in C# https://github.com/salvadorc17/Prince-Monogame
Re: Disassembly of PoP2 IR
Maybe it's done using a variable. Something like:David wrote: I tried these: (after restoring the level type, of course!)
* To zero out all the modifiers so that the custom background is not loaded.
* To delete the CUST resource for this room.
* Scan the exe for all instances of "cmp <something>,27" (and 28) and replaced 27/28 with 0.
Next step would be using the DOSBox debugger... (To catch the moment when the kid is moved to room 3.)
mov variable, 1Bh
(...)
cmp something, variable
Re: Disassembly of PoP2 IR
Interesting. I think I will check one level a day by hand. Then I should be done in 14 days (or, inc. gameplay, 28), which is totally doable.
Levels 1, 2 and 14 are difficult for PoP2, so if you're new to level editing, I suggest you start with level 3 through 13.
If you haven't used apoplexy before, it may be best to first watch the old instructional video (here) and then its supplement (here).
[Edit: Or maybe you mean for the SNES version?]
The latest apoplexy (ZIP for Windows) should be fairly usable for that.salvadorc17 wrote:This means, that will be more easy to create a prince of persia 2 editor and mods??
Levels 1, 2 and 14 are difficult for PoP2, so if you're new to level editing, I suggest you start with level 3 through 13.
If you haven't used apoplexy before, it may be best to first watch the old instructional video (here) and then its supplement (here).
[Edit: Or maybe you mean for the SNES version?]
-
- Calif
- Posts: 553
- Joined: August 27th, 2011, 2:04 am
Re: Disassembly of PoP2 IR
Yes i mean the snes version, but dont know if there is a difference, the main problem for me with pc is that windows is not so compatible with the dos versions...
Check my Prince in C# https://github.com/salvadorc17/Prince-Monogame
Re: Disassembly of PoP2 IR
I'm not sure I understand what you mean there.salvadorc17 wrote:[...] windows is not so compatible with the dos versions...
If you mean that the DOS program won't run on Windows, you can use DOSBox for that (which is also included with apoplexy for Windows).
Re: Disassembly of PoP2 IR
Meanwhile I found where is the level 6 event checked. (Entering the ruins.)
It is not in the current disassembly, but in overlay 0x0003. (It is loaded only when in-game, and not loaded when in the intro. In the intro, overlay 0x0002 is loaded instead.)
So I also added that overlay to the disassembly.
I tried to find and mark every place where something is done depending on the current level or room.
Though I am not always sure what happens.
I attached the new version to this post.
It is not in the current disassembly, but in overlay 0x0003. (It is loaded only when in-game, and not loaded when in the intro. In the intro, overlay 0x0002 is loaded instead.)
So I also added that overlay to the disassembly.
I tried to find and mark every place where something is done depending on the current level or room.
Though I am not always sure what happens.
I attached the new version to this post.
- Attachments
-
- pop2_ida.zip
- (2.36 MiB) Downloaded 190 times
Re: Disassembly of PoP2 IR
Here is the newest disassembly.
I added many names and comments since the last one.
* The overlays folder: It's the same as before.
* PRINCE_ingame.asm: It's not really needed, it's the same as PRINCE_ingame.lst but without the offsets and hex codes.
* An area in PRINCE_ingame.lst that contained only uninitialized bytes.
I added many names and comments since the last one.
I removed some things:the forum wrote:The attachment’s file size is too large, the maximum upload size is 2 MB.
* The overlays folder: It's the same as before.
* PRINCE_ingame.asm: It's not really needed, it's the same as PRINCE_ingame.lst but without the offsets and hex codes.
* An area in PRINCE_ingame.lst that contained only uninitialized bytes.
- Attachments
-
- pop2_IR_ida.zip
- (1.97 MiB) Downloaded 205 times
Re: Disassembly of PoP2 IR
It's 5 MB. People have uploaded >2 MB things recently.the forum wrote:The attachment’s file size is too large, the maximum upload size is 2 MB.
I'm going to ignore the forum error, just because phpBB is already causing me enough discomfort.
(Unless someone has very specific instructions to make the thing that is already 5 MB really 5 MB for everyone everywhere.)
PS: I already checked if the "Prince Of Persia 2: The Shadow And The Flame" board has any settings that override the global setting and as far as I can tell there are no such settings.
Re: Disassemblies of PoP2
Here is a disassembly of PoP2 v1.1.
I used this to make the hacks which change the arrow keys or Alt+N.
I didn't add meaningful names in most other parts of the code, though.
I used this to make the hacks which change the arrow keys or Alt+N.
I didn't add meaningful names in most other parts of the code, though.
- Attachments
-
- ida_pop2_11.zip
- (1.75 MiB) Downloaded 162 times
-
- Vizier
- Posts: 86
- Joined: June 6th, 2004, 7:05 pm
Re: Disassemblies of PoP2
Is this supposed to be openable with IDA Free?David wrote: ↑August 8th, 2020, 7:56 pm Here is a disassembly of PoP2 v1.1.
I used this to make the hacks which change the arrow keys or Alt+N.
I didn't add meaningful names in most other parts of the code, though.
When I open prince.exe I get this error message:
PRINCE.EXE is not a PE file.
This version of IDA can only disassembly PE files
Re: Disassemblies of PoP2
Hm, it seems that each newer version of IDA Free supports fewer executable formats and CPUs.FluffyQuack wrote: ↑December 3rd, 2022, 6:55 pm Is this supposed to be openable with IDA Free?
When I open prince.exe I get this error message:PRINCE.EXE is not a PE file.
This version of IDA can only disassembly PE files
(Guess why?)
I used IDA Free 4.3 to make this disassembly.
I think 5.0 still supports DOS executables.
BTW, you should open the *.idb file instead of PRINCE.EXE, though that might display the same error message.