PrinHackEd

Post Reply
User avatar
mickey96
Beylerbey
Beylerbey
Posts: 70
Joined: November 29th, 2008, 2:19 pm
Location: Nairobi, Kenya
Contact:

PrinHackEd

Post by mickey96 »

Hello everybody,

I've created an Prince of Persia .exe editor for DOS.
You can download it here: http://www.mediafire.com/download.php?iyygkm3t3t0

UPDATE:
- 1.1 released.
- Distribution now includes source

Contents of PRINHELP.TXT :
PrinHackEd v1.1
-=-=-=-=-=-=-=-

by mickey96

What is PrinHackEd?
-------------------

PrinHackEd is a .EXE editor for the original 1990 Prince of Persia by Jordan Merchner. Tired of having
to fire up a browser just to use CusPop? Tired of hex editing? Tired of reading slow download from
CusPop? Tired of reading this? Then give PrinHackEd a try and you'll see its powerful!

Essential keys
--------------
Q - Quits the program. (without asking if you want to save your changes!)
H - Gives some help. (This gives some more information).
S - Saves a patch see Patch Files
L - Saves a patch see Patch Files
W - Writes changes to PRINCE.EXE.
R - Runs the written PRINCE.EXE. (not working yet)

General section keys
--------------------
T - Set starting time.
P - Set hit point the prince has when he starts level 1.

Guards section keys
-------------------
P - Edit guards' hit points
T - Edit guards' type on each level

Misc section keys
-----------------
A - Enable\Disable WDA
E - Edit level types

Patch Files
-----------
Patches file use the .PEH extension. This is where to store the starting time
and hit points. This helps to keep changes along with your mod. And they are 8K right now, (the program writes some unexpected bytes though).

Patch files are entirely different from DAT files. You just can't play a mod like typing PRINCE EXAMPLE.PEH,
it won't work! You need to load from PrinHackEd and write the changes.

How to read a patch file:
-------------------------
This will show how to do it in Pascal. (I'll let you to port it to C\C++).

Code: Select all

procedure LoadPatch (Filename : String);
var
PatchHandle : File;
begin
Assign(PatchHandle, Filename);
if IOResult = 0 then begin
BlockRead(PatchHandle, PatchVer, 1, PatchVer);
BlockRead(PatchHandle, Time, 2);
BlockRead(PatchHandle, HPLimit, 2);
BlockRead(PatchHandle, HP, 2);
BlockRead(PatchHandle, GHPDEMO, 1);
BlockRead(PatchHandle, GHP1, 1);
BlockRead(PatchHandle, GHP2, 1);
BlockRead(PatchHandle, GHP3, 1);
BlockRead(PatchHandle, GHP4, 1);
BlockRead(PatchHandle, GHP5, 1);
BlockRead(PatchHandle, GHP6, 1);
BlockRead(PatchHandle, GHP7, 1);
BlockRead(PatchHandle, GHP8, 1);
BlockRead(PatchHandle, GHP9, 1);
BlockRead(PatchHandle, GHP10, 1);
BlockRead(PatchHandle, GHP11, 1);
BlockRead(PatchHandle, GHP12a, 1);
BlockRead(PatchHandle, GHP12b, 1);
BlockRead(PatchHandle, GHP13, 1);
BlockRead(PatchHandle, GTYP1, 2);
BlockRead(PatchHandle, GTYP2, 2);
BlockRead(PatchHandle, GTYP3, 2);
BlockRead(PatchHandle, GTYP4, 2);
BlockRead(PatchHandle, GTYP5, 2);
BlockRead(PatchHandle, GTYP6, 2);
BlockRead(PatchHandle, GTYP7, 2);
BlockRead(PatchHandle, GTYP8, 2);
BlockRead(PatchHandle, GTYP9, 2);
BlockRead(PatchHandle, GTYP10, 2);
BlockRead(PatchHandle, GTYP11, 2);
BlockRead(PatchHandle, GTYP12a, 2);
BlockRead(PatchHandle, GTYP12b, 2);
BlockRead(PatchHandle, GTYP13, 2);
BlockRead(PatchHandle, LTYPDEMO, 1);
BlockRead(PatchHandle, LTYP1, 1);
BlockRead(PatchHandle, LTYP2, 1);
BlockRead(PatchHandle, LTYP3, 1);
BlockRead(PatchHandle, LTYP4, 1);
BlockRead(PatchHandle, LTYP5, 1);
BlockRead(PatchHandle, LTYP6, 1);
BlockRead(PatchHandle, LTYP7, 1);
BlockRead(PatchHandle, LTYP8, 1);
BlockRead(PatchHandle, LTYP9, 1);
BlockRead(PatchHandle, LTYP10, 1);
BlockRead(PatchHandle, LTYP11, 1);
BlockRead(PatchHandle, LTYP12a, 1);
BlockRead(PatchHandle, LTYP12b, 1);
BlockRead(PatchHandle, LTYP13, 1);
Close(PatchHandle);
end;
else begin
{ TODO: Add your uninitalization routines }
writeln('Error loading patch file ',Filename);
Exit;
end;

end;
Installation
------------
*READ THIS FIRST*

Copy PRINHACK.EXE to your Prince of Persia directory (whatever version you want).

Known Bugs
----------

- When you load the patches it reads them abnormally. When you wrote the changes,
it scrambles up the EXEs' varibles!
Last edited by mickey96 on June 20th, 2009, 9:49 am, edited 2 times in total.
Refueled my car! Now I can keep going!
User avatar
Veke
Wise Scribe
Wise Scribe
Posts: 399
Joined: November 23rd, 2008, 7:58 pm
Location: Finland

Re: PrinHackEd

Post by Veke »

I get "Runtime error 002 at 0000:2060" when trying to run it through DOSbox.
User avatar
mickey96
Beylerbey
Beylerbey
Posts: 70
Joined: November 29th, 2008, 2:19 pm
Location: Nairobi, Kenya
Contact:

Re: PrinHackEd

Post by mickey96 »

Copy it to your Prince of Persia 1.0 directory, but unpack it *first*!
Refueled my car! Now I can keep going!
User avatar
Veke
Wise Scribe
Wise Scribe
Posts: 399
Joined: November 23rd, 2008, 7:58 pm
Location: Finland

Re: PrinHackEd

Post by Veke »

Ah, ok. This can come in handy if you add more functions.
User avatar
mickey96
Beylerbey
Beylerbey
Posts: 70
Joined: November 29th, 2008, 2:19 pm
Location: Nairobi, Kenya
Contact:

Re: PrinHackEd

Post by mickey96 »

These are the things that have to wait for 1.1.
Refueled my car! Now I can keep going!
User avatar
mk1995
The Prince of Persia
The Prince of Persia
Posts: 1160
Joined: February 27th, 2009, 10:09 pm
Location: Germany

Re: PrinHackEd

Post by mk1995 »

Whoa, I never knew you were a developer, mickey96.

It reads pretty promising, I think I'll give it a try.
Image
Just to make something clear: I will not reply to daft PMs like "Where can I find X?" or "Can you give me a link to Y?". Most of your questions are likely answerable if only you took your bloody time to look through these forums and use Google if all else fails. Sheesh...
BlackChar
Sheikh
Sheikh
Posts: 24
Joined: November 18th, 2008, 3:26 am
Location: Prague, Czech Republic
Contact:

Re: PrinHackEd

Post by BlackChar »

Neither did I, cool :) And pascal, too. Well done. Would you care to share the sources with others? We could help help you improve it and it could liven things up a bit. I don't know anything more motivating than a bunch of nerd... uh.. programmers, having a talk on some program :D
User avatar
mickey96
Beylerbey
Beylerbey
Posts: 70
Joined: November 29th, 2008, 2:19 pm
Location: Nairobi, Kenya
Contact:

Re: PrinHackEd

Post by mickey96 »

The source is included as of right now.
Refueled my car! Now I can keep going!
Post Reply