Modifications to prince.exe (hex editing)

Prince of Persia related subjects that do not have their own boards.
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Modifications to prince.exe (hex editing)

Post by poirot »

I'm reopening this thread so we can post new hacks.

I'm starting with level 1 events. I have to check if they are already implemented in princehack.xml.

Level 1 events:

Code: Select all

07e2:4b2d  a3 98 4c           mov    [4c98],ax
07e2:4b30  a3 f2 5f           mov    [5ff2],ax
07e2:4b33  83 3e 9e 0f 01     cmp    word ptr [0f9e],0001 <-- level where the kid starts crouching
07e2:4b38  75 22              jne    4b5c
Search for: a3 .. .. a3 .. .. 83 3e .. .. 01 75 22
(offsets are p0:0x4c2d, u0:0x62dd, p3:0x50b5, u3:0x57f5, p4:0x4b71, u4:0x5ca1)

and replace
01 for level where the kid starts crouching

Code: Select all

07e2:61cb  83 3e aa 4c 00     cmp    word ptr [4caa],0000
07e2:61d0  74 30              je     6202
07e2:61d2  83 3e 9e 0f 01     cmp    word ptr [0f9e],0001 <-- level where the kid music is played after loading
07e2:61d7  75 29              jne    6202
07e2:61d9  9a 99 72 79 0c     call   0c79:7299
Search for: 83 3e .. .. .. 74 .. 83 3e .. .. 01 75
(offsets are p0:0x62cb, u0:0x797b, p3:0x675f, u3:0x6e9f, p4:0x621b, u4:0x734b)

and replace
01 for level where the kid music is played after loading

---------------------

xml hacks are:

Code: Select all

<hack name="Hack name here">
	<offset file="p0" value="0x62cb"/>
	<offset file="u0" value="0x797b"/>
	<offset file="p3" value="0x675f"/>
	<offset file="u3" value="0x6e9f"/>
	<offset file="p4" value="0x621b"/>
	<offset file="u4" value="0x734b"/>

	<check codes="83 3e .. .. .. 74 .. 83 3e .. .."/>
	<read default="01" name="level where the kid music is played after loading" type=""/>
</hack>
<hack name="Hack name here">
	<offset file="p0" value="0x4c2d"/>
	<offset file="u0" value="0x62dd"/>
	<offset file="p3" value="0x50b5"/>
	<offset file="u3" value="0x57f5"/>
	<offset file="p4" value="0x4b71"/>
	<offset file="u4" value="0x5ca1"/>

	<check codes="a3 .. .. a3 .. .. 83 3e .. .."/>
	<read default="01" name="level where the kid starts crouching" type=""/>
</hack>
I'll take a look at the sword level too. Btw, I'm using a development version of CusAsm 2.0 that I'll put online asap.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifications to prince.exe (hex editing)

Post by David »

We already have a topic with the same title: viewtopic.php?f=73&t=661

Having the sword at the beginning of the level:

Code: Select all

00004B25:i837E0601                       cmp (w)   [bp+06],+01
00004B29:i7405                           je        file:00004B30
00004B2B:iB80100                         mov       ax,0001
00004B2E:iEB02                           jmps      file:00004B32
00004B30:i2BC0                           sub       ax,ax
00004B32:iA3A234                         mov       [+34A2],ax
[bp+06] stores (temporarily) the number of the current level.
[+34A2] stores whether the prince has the sword (0=no, 1=yes)

search: 83 7E 06 01 74 05
change: This can be changed in many ways.
If you want that the prince has the sword on all levels except one, change 01 to the number of that level.
If you want that the prince never has the sword, change 74 to EB. (je->jmp)
If you want that the prince always has the sword, change 74 05 to 90 90. (je->nop)
If you want that the prince has the sword on level XX and all levels after that, change 01 to XX and 74 to 7C. (je->jl)

offsets:
u0: 0x61D5, u3: 0x56E5, u4: 0x5B91, p0: 0x4B25, p3: 0x4FA5, p4: 0x4A61


Also, I have been making a disassembly using IDA, and I thought I could upload it. It could be used to search hacks easier.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Modifications to prince.exe (hex editing)

Post by Norbert »

David wrote:[...], and I thought I could upload it.
Go for it. ;)
Feel free to PM me anything if you want me to put it up at popot.org.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifications to prince.exe (hex editing)

Post by David »

I have attached the disassembly to this post.
Of course it is far from being complete. All suggestions and corrections are welcome.
Attachments
pop1_ida.zip
PoP1 disassembly
(1.28 MiB) Downloaded 279 times
User avatar
yaqxsw
Wizard Scribe
Wizard Scribe
Posts: 727
Joined: June 18th, 2012, 3:35 pm
Location: Germany

Re: Modifications to prince.exe (hex editing)

Post by yaqxsw »

David wrote:I have attached the disassembly to this post.
Of course it is far from being complete. All suggestions and corrections are welcome.
that prince without sword all level? but i brought more time, guards LP too.. :?
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Modifications to prince.exe (hex editing)

Post by Norbert »

yaqxsw wrote:that prince without sword all level?
Not yet, but we're getting closer. ;)
Thanks for the upload David.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Modifications to prince.exe (hex editing)

Post by Norbert »

yaqxsw, if you want I can provide you with a PRINCE.EXE file that will make the prince never have a sword (or only from a certain level, like from 11).
(I will use David's instructions to make the changes.)
If you want this, you can send me the PRINCE.EXE file you're using (from the CusPop export) via a private message and I'll send it back with the changes you want.
Or, alternatively, you could try to use a hex editor yourself (like wxHexEditor; wxHexEditor-v0.20-Win32.zip is for Windows).
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Re: Modifications to prince.exe (hex editing)

Post by poirot »

Is it possible to ask for the source code to Lance Groody? Anybody wants to do that?
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Modifications to prince.exe (hex editing)

Post by Norbert »

poirot wrote:Is it possible to ask for the source code to Lance Groody? Anybody wants to do that?
Would having the source code be an end by itself or a means to an end?
Either way, Groody, as a non-copyright holder, is not in a position to publish the code.
We'd have to ask Mechner to ask Groody, I think.
The code itself could be useful to find exploits/bugs, and could simplify making modifications.
Other than that, there are copyright/trademark problems, even with FreePrince.
Maybe we should let sleeping dogs lie, I don't know.
User avatar
yaqxsw
Wizard Scribe
Wizard Scribe
Posts: 727
Joined: June 18th, 2012, 3:35 pm
Location: Germany

Re: Modifications to prince.exe (hex editing)

Post by yaqxsw »

Norbert wrote:yaqxsw, if you want I can provide you with a PRINCE.EXE file that will make the prince never have a sword (or only from a certain level, like from 11).
(I will use David's instructions to make the changes.)
If you want this, you can send me the PRINCE.EXE file you're using (from the CusPop export) via a private message and I'll send it back with the changes you want.
Or, alternatively, you could try to use a hex editor yourself (like wxHexEditor; wxHexEditor-v0.20-Win32.zip is for Windows).
I not programmist, and i can't try HexEditor.. but i sent you my Edit PRINCE.EXE
User avatar
yaqxsw
Wizard Scribe
Wizard Scribe
Posts: 727
Joined: June 18th, 2012, 3:35 pm
Location: Germany

Re: Modifications to prince.exe (hex editing)

Post by yaqxsw »

Norbert wrote:yaqxsw, if you want I can provide you with a PRINCE.EXE file that will make the prince never have a sword (or only from a certain level, like from 11).
(I will use David's instructions to make the changes.)
If you want this, you can send me the PRINCE.EXE file you're using (from the CusPop export) via a private message and I'll send it back with the changes you want.
Or, alternatively, you could try to use a hex editor yourself (like wxHexEditor; wxHexEditor-v0.20-Win32.zip is for Windows).
How sent Prince.EXE? Message said, i cannot add some File.. i think, i can sent you in E-Mail or i write here my edit.

-----------------
300 minuts Time
Start level 1, Start LP 2

Maximal Prince LP 12

Guards LP
Level 1 - 3
Level 2 - 3

Level 4 - 4
Level 5 - 5
Level 6 - 6
Level 7 - 6
Level 8 - 6
Level 9 - 6
Level 10 - 6
Level 11 - 6
Level 12 - 6
Level 13 - 12
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Modifications to prince.exe (hex editing)

Post by Norbert »

yaqxsw wrote:How sent Prince.EXE?
If private messaging is not working, you can e-mail it to info@popot.org.

By the way, CusPop has a section "Customize allowed resources per level".
If you check everything there, you can use, for example, use the chomper in level 2.
It allows you to use (almost) all the resources everywhere and the screen will not get distorted.
User avatar
yaqxsw
Wizard Scribe
Wizard Scribe
Posts: 727
Joined: June 18th, 2012, 3:35 pm
Location: Germany

Re: Modifications to prince.exe (hex editing)

Post by yaqxsw »

E-mail sent
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: Modifications to prince.exe (hex editing)

Post by Norbert »

yaqxsw wrote:E-mail sent
Okay, I've made the change and I've sent you back the altered PRINCE.EXE file.
User avatar
yaqxsw
Wizard Scribe
Wizard Scribe
Posts: 727
Joined: June 18th, 2012, 3:35 pm
Location: Germany

Re: Modifications to prince.exe (hex editing)

Post by yaqxsw »

Thank! ot functioniert! :D
Post Reply