Modifications to prince.exe (hex editing)

David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifications to prince.exe (hex editing)

Post by David »

Shauing wrote: January 23rd, 2022, 8:20 am I tried to do this first one, but the Shadow doesn't run to the right of the screen, he stays still after getting out of the mirror
Sorry, I forgot one thing:

Code: Select all

seg002:1000                      autocontrol_shadow_level4 proc far
seg002:1000 80 3E 2B 3D 04                       cmp     char.room, 4
seg002:1005 75 12                                jnz     locret_4699
Search: 80 3E 2B 3D 04 75 12
Change: 04 to room number
Offset: 0x5F34

Shauing wrote: January 23rd, 2022, 8:20 am (at least on DOSBox, on SDLPoP the mirror appears on Room 20 for some reason and on a different column).
Because SDLPoP is not prepared for the hack with allows the room and column numbers to be different.
So it interprets 0x16 (decimal 22) as the room and the column.
Column 22 is column 2 of the second room to the right.
If you numbered the rooms as in the SNES version of Queen Of Light (level 6), then the second room to the right is indeed room 20.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifications to prince.exe (hex editing)

Post by David »

Shauing wrote: January 22nd, 2022, 11:07 am How can it be made that all guards can fall to other rooms without dying?
Spoiler: show
We can change the code which handles the skeleton falling into the room below.

Code: Select all

in check_guard_fallout():
seg002:0299                      loc_3919:
seg002:0299 80 3E E7 42 04                       cmp     guard.charid, charid_4_skeleton ; skeleton
seg002:029E 75 2F                                jnz     loc_394F
seg002:02A0 A0 E5 42                             mov     al, guard.room
seg002:02A3 98                                   cbw
seg002:02A4 8B D8                                mov     bx, ax
seg002:02A6 D1 E3                                shl     bx, 1
seg002:02A8 D1 E3                                shl     bx, 1
seg002:02AA 8A 87 23 57                          mov     al, link_down_1[bx]
seg002:02AE A2 E5 42                             mov     guard.room, al
seg002:02B1 3C 03                                cmp     al, 3           ; if skeleton falls down into room 3
seg002:02B3 75 1A                                jnz     loc_394F
seg002:02B5 C6 06 DD 42 85                       mov     guard.x, 133
seg002:02BA C6 06 E1 42 01                       mov     guard.curr_row, 1
seg002:02BF C6 06 DF 42 00                       mov     guard.direction, dir_0_right
seg002:02C4 C6 06 E9 42 FF                       mov     guard.alive, 0FFh
seg002:02C9 0E                                   push    cs
seg002:02CA E8 28 00                             call    near ptr leave_guard
seg002:02CD EB 25                                jmp     short locret_3974
At 0x51CE change: 75 2F -> 90 90 -- Don't check guard type.
At 0x51E1 change: 3C 03 -> 3C 00 -- Check for room 0 instead.
At 0x51E3 change: 75 1A -> 74 1A -- If the guard fell into room 0 then he dies.
Adjust the coordinates to the room below:
At 0x51E5 change: C6 06 DD 42 85 -> 80 2E DE 42 BD -- Guard.y -= 189;
At 0x51EA change: C6 06 E1 42 01 -> 80 2E E1 42 03 -- Guard.curr_row -= 3;
Remove the guard from the current room (from the level data):
At 0x51EF change: C6 06 DF 42 00 C6 06 E9 42 FF -> 8B 1E 9E 40 C6 87 CA 57 FF 90 -- level.guards_tile[drawn_room - 1] = -1;
At 0x51F9 change: 0E E8 28 00 -> 90 90 90 90 -- Don't leave the guard, keep track of him.

Code: Select all

in play_guard_frame():
seg000:0F63 A0 2B 3D                             mov     al, char.room
seg000:0F66 98                                   cbw
seg000:0F67 3B 06 9E 40                          cmp     ax, drawn_room
seg000:0F6B 75 4A                                jnz     loc_FB7
At 0x281B change: 75 4A -> 90 90 -- Continue animating the guard even when he is another room.

Known problems:
1. If the guard doesn't die and you follow him down, he will regain his original hit points. Like when you leave a guard and later meet him again.
2. If the guard falls to his death in the room below, the victory music is not played. The splat sound has higher priority than the music.
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Modifications to prince.exe (hex editing)

Post by Shauing »

David wrote: January 23rd, 2022, 9:03 pm [quote=Shauing post_id=34330 time=1642918808
Because SDLPoP is not prepared for the hack with allows the room and column numbers to be different.
So it interprets 0x16 (decimal 22) as the room and the column.
Column 22 is column 2 of the second room to the right.
If you numbered the rooms as in the SNES version of Queen Of Light (level 6), then the second room to the right is indeed room 20.
So for the SDLPoP, what should I do to make this hack work? Will it have to be two different versions? One for DOS and another for SDLPoP?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifications to prince.exe (hex editing)

Post by David »

Shauing wrote: January 30th, 2022, 7:55 pm So for the SDLPoP, what should I do to make this hack work? Will it have to be two different versions? One for DOS and another for SDLPoP?
I need to add support for this to SDLPoP.

At this part:

Code: Select all

		process(&custom_saved.mirror_level, 1, {0x08dc7, 0x0a477, 0x09274, 0x099b4, 0x08d30, 0x09e60});
		process(&custom_saved.mirror_room, 1, {0x08dcb, 0x0a47b, 0x09278, 0x099b8, 0x08d34, 0x09e64});
		if (read_ok) custom_saved.mirror_column = custom_saved.mirror_room;
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifications to prince.exe (hex editing)

Post by David »

David wrote: February 5th, 2022, 8:58 pm
Shauing wrote: January 30th, 2022, 7:55 pm So for the SDLPoP, what should I do to make this hack work? Will it have to be two different versions? One for DOS and another for SDLPoP?
I need to add support for this to SDLPoP.
Done: https://github.com/NagyD/SDLPoP/commit/ ... b945ffe34a

It turns out that changes to the level 5, 6, 12 shadow are not detected by SDLPoP.
So I need to add them as well, great...
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifications to prince.exe (hex editing)

Post by David »

David wrote: February 5th, 2022, 9:16 pm It turns out that changes to the level 5, 6, 12 shadow are not detected by SDLPoP.
So I need to add them as well, great...
Done, so far only for the level 5 and 6 shadow.
https://github.com/NagyD/SDLPoP/commit/ ... bedc0f016d
teljesnegyzet
Efendi
Efendi
Posts: 14
Joined: September 20th, 2021, 8:29 pm

Re: Modifications to prince.exe (hex editing)

Post by teljesnegyzet »

These are the modifications I've made for my Christmas of Persia mod:

the mouse doesn't appear in the ending sequence

Code: Select all

0E E8 35 FE 9A 64 04 CB 06 B8 09 00 50 0E E8 57 FB
->

Code: Select all

EB 27 35 FE 9A 64 04 CB 06 B8 09 00 50 0E E8 57 FB
drawing flames of torches with alpha and in another position:

Code: Select all

A1 68 59 40 50 2B C0 50 A1 26 43 2D 28 00 50 2B C0 50
->

Code: Select all

A1 68 59 50 2B C0 50 A1 26 43 2D 4A 00 50 B8 10 00 50
drawing flames of torches with alpha in the princess' room:

Code: Select all

FF B4 F4 0D FF B4 F8 0D B8 74 00 50 2B C0
->

Code: Select all

FF B4 F4 0D FF B4 F8 0D B8 74 00 50 B0 10
much shorter intro:

Code: Select all

4C FF 36 8A 58 50 50 50 0E E8 C4 02 B8 03 00
->

Code: Select all

4C FF 36 8A 58 50 50 50 0E E8 C4 02 E9 D5 01
faster paced intro:

Code: Select all

9A 20 72 79 0C C7 06 EC 31 82
->

Code: Select all

9A 20 72 79 0C C7 06 EC 31 10
and

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 CD
->

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 90
and

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 41
->

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 10
and

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 0E 01
->

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 90 00
and

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 EB
->

Code: Select all

9A A9 0E 79 0C C7 06 EC 31 10
the kid already has the sword in level 1:

Code: Select all

83 7E 06 01 74 05 B8 01 00
->

Code: Select all

83 7E 06 22 74 05 B8 01 00
after the intro the first level begins instead of the demo level:

Code: Select all

0E E8 68 00 2B C0 50 9A 00 00 7F 04 8B E5 5D CB
->

Code: Select all

0E E8 68 00 B0 01 50 9A 00 00 7F 04 8B E5 5D CB
and

Code: Select all

83 3E 9A 00 00 74 17 83 7E 06 02 7E 11 C7 06 B8 42 00 00
->

Code: Select all

83 7E 06 01 75 18 C7 06 B8 42 01 00 EB 10 90 90 90 90 90
disabling cutscenes between levels:

Code: Select all

8B 97 A2 0F 89 46 FC 89 56 FE 0B C2 74 1D
->

Code: Select all

8B 97 A2 0F 89 46 FC 89 56 FE 0B C2 EB 1D
shorter outro:

Code: Select all

52 50 B8 01 00 50 0E E8 D1 02 9A 02 1F 00 00 B8 38 00
->

Code: Select all

52 50 B8 01 00 50 0E E8 D1 02 9A 02 1F 00 00 E9 65 02
no stars in the princess' room:

Code: Select all

74 12 B8 05 00 50 9A 0A 04 79 0C
->

Code: Select all

EB 12 B8 05 00 50 9A 0A 04 79 0C
and

Code: Select all

FF 76 FE 2B C0 50 0E E8 54 00 FF 46 FE
->

Code: Select all

FF 76 FE 2B C0 50 0E 90 90 90 FF 46 FE
Post Reply