Play the Demo level?

Discuss PoP1 for DOS here.
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Play the Demo level?

Post by David »

Norbert wrote: November 20th, 2020, 1:35 pm I can find these bytes in p0 and u0, but not in p3, u3, p4, u4.
Any chance the JMP can also be applied to 1.3 and 1.4?
In 1.3 and 1.4, the bytes to search are slightly different, because the referenced variables (current_level and start_level) have different addresses.

In 1.3:

Code: Select all

seg000:7E49 83 3E B0 10 00           cmp  current_level, 0
seg000:7E4E 75 34                    jnz  loc_7E84

seg000:05B4 83 3E B2 44 00           cmp  start_level, 0
seg000:05B9 75 51                    jnz  loc_60C
First part (already in SDLPoP):
Search: 83 3E B0 10 00 75 34
Change: 75 to EB

Second part (missing from SDLPoP):
Search: 83 3E B2 44 00 75 51
Change: 75 to EB

In 1.4:

Code: Select all

seg006:0D05 83 3E AA 10 00           cmp  current_level, 0
seg006:0D0A 75 34                    jnz  loc_7940

seg000:0578 83 3E 84 42 00           cmp  start_level, 0
seg000:057D 75 51                    jnz  loc_5D0
First part (already in SDLPoP):
Search: 83 3E AA 10 00 75 34
Change: 75 to EB

Second part (missing from SDLPoP):
Search: 83 3E 84 42 00 75 51
Change: 75 to EB


Instructions for any version, with wildcards:

First part (already in SDLPoP):
Search: 83 3E .. .. 00 75 34
Change: 75 to EB

Second part (missing from SDLPoP):
Search: 83 3E .. .. 00 75 51
Change: 75 to EB
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5749
Joined: April 9th, 2009, 10:58 pm

Re: Play the Demo level?

Post by Norbert »

I'm not totally sure yet, but I don't think what you wrote is correct.
Try it with 1.3...
[Edit: It does kind of work, but breaks the keyboard during the intro and the game no longer launches to other levels.]
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Play the Demo level?

Post by David »

Norbert wrote: November 21st, 2020, 3:38 pm I'm not totally sure yet, but I don't think what you wrote is correct.
Try it with 1.3...
[Edit: It does kind of work, but breaks the keyboard during the intro and the game no longer launches to other levels.]
Yes... You're completely right, and even the hack for 1.0 has this problem.
It seems my testing was incomplete again...

The problem is in the second part of the hack:

Code: Select all

in process_key():
seg000:04E0 83 3E B8 42 00           cmp  start_level, 0
seg000:04E5 75 51                    jnz  loc_538 ; <-- change to JMP
The problem is, start_level is 0 during both the intro and the demo level.
So if we disable interrupting the demo level then we also disable interrupting the intro.

Side note:
In SDLPoP, I disambiguated the values of start_level, so it's -1 in the intro and 0 on the demo level.
I originally did that so it would be possible to start level 0 (the demo level) from the command line.
But it also means that to make the demo level playable in SDLPoP, it's enough to do the equivalent of the first part of the hack, i.e. remove the level check from control_kid().
I added it to SDLPoP as a command line option: https://github.com/NagyD/SDLPoP/commit/ ... afaab8bbe0


So what is the possible solution for DOS PoP?
It turns out that current_level is -1 in the original PoP during the intro, and 0 during the demo level.

So we need to change "cmp start_level, 0" to "cmp current_level, -1".

The new hack for PoP 1.0:

(the first part is unchanged in every version)
Search: 83 3E 9E 0F 00 75 34
Change: 75 to EB

Search: 83 3E B8 42 00 75 51 (same as before)
Change: 83 3E 9E 0F FF 75 51 (new)

for PoP 1.3:

Search: 83 3E B0 10 00 75 34
Change: 75 to EB

Search: 83 3E B2 44 00 75 51
Change: 83 3E B0 10 FF 75 51

for PoP 1.4:

Search: 83 3E AA 10 00 75 34
Change: 75 to EB

Search: 83 3E 84 42 00 75 51
Change: 83 3E AA 10 FF 75 51

for any version:

Search: 83 3E .. .. 00 75 34
Change: 75 to EB

Search: 83 3E .. .. 00 75 51
Change: 83 3E !! !! FF 75 51
Where !! !! are the bytes matched by .. .. in the first part.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5749
Joined: April 9th, 2009, 10:58 pm

Re: Play the Demo level?

Post by Norbert »

David wrote: November 28th, 2020, 8:29 pmIn SDLPoP, I disambiguated the values of start_level, so it's -1 in the intro and 0 on the demo level.
[...]
It turns out that current_level is -1 in the original PoP during the intro, and 0 during the demo level.
Heh. :)
Thanks for posting the improved hack.
Post Reply