Page 1 of 1

PrinHackEd

Posted: June 13th, 2009, 9:07 am
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!

Re: PrinHackEd

Posted: June 13th, 2009, 11:13 am
by Veke
I get "Runtime error 002 at 0000:2060" when trying to run it through DOSbox.

Re: PrinHackEd

Posted: June 13th, 2009, 12:42 pm
by mickey96
Copy it to your Prince of Persia 1.0 directory, but unpack it *first*!

Re: PrinHackEd

Posted: June 13th, 2009, 2:58 pm
by Veke
Ah, ok. This can come in handy if you add more functions.

Re: PrinHackEd

Posted: June 13th, 2009, 3:01 pm
by mickey96
These are the things that have to wait for 1.1.

Re: PrinHackEd

Posted: June 15th, 2009, 7:51 pm
by mk1995
Whoa, I never knew you were a developer, mickey96.

It reads pretty promising, I think I'll give it a try.

Re: PrinHackEd

Posted: June 18th, 2009, 10:50 am
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

Re: PrinHackEd

Posted: June 20th, 2009, 10:18 am
by mickey96
The source is included as of right now.