SDLPoP; David's open-source port of PoP

Open-source port of PoP that runs natively on Windows, Linux, etc.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

StaticReturn wrote: The result of your debug statement prints out 34 cases of the following, with "i" going from 0 to 33.

Code: Select all

i=0, BitsPerPixel=32, palette=0x0
SDL_SetColors: 
Right. So the images are loaded as 32-bit (RGBA) images.
But the original images in data/GUARD.DAT/ are paletted images.
Just a question: Are you using the original images?
If you do, then this might be a bug in SDL that appears only on OS X.

EDIT:
I just found this: http://forums.libsdl.org/viewtopic.php?p=27895#27895 -- PNG with 8bit colormap loaded as full 32 bits per pixel
So this is a bug in SDL, more precisely in the PNG loader of OS X.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

Here is the new version.

Changes:
CHANGE: Added a font inside the exe. So the game can start without the data/font/ folder.
CHANGE: Changed project type to GUI. This means that the (empty) console window won't appear under Windows.
CHANGE: Changed "SDL" to "SDLPoP" in the window title.
Attachments
SDLPoP_v1.11.zip
(1 MiB) Downloaded 125 times
StaticReturn
Efendi
Efendi
Posts: 13
Joined: September 2nd, 2014, 4:14 am

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by StaticReturn »

Here is a new OS X binary of SDLPoP. It's a lot bigger than last time because I didn't statically link the necessary X11 libraries that SDL was dependent on. But don't take my word for it, you can compile your own. New installation instructions are in the spoiler tag below.
Spoiler: show
This is how I got things to compile. There are other ways.
- by StaticReturn
###########################################################

There is an issue with SDL_image loading images on OS X. Because of this you must play with the original .DAT files.

WARNING: If any of these steps seem vauge then these instructions may not be for you. You can damage your system by entering commands you do not understand!


STEP 1: GET DEVLEOPMENT TOOLS
a) Install Xcode.
b) Install the "command line developer tools" by typing 'xcode-select --install' at the prompt.

STEP 2: GET SDL AND SDL_IMAGE
a) Install "port" from http://www.macports.org/
b) Using port, install libsdl & libsdl_image.
c) In the root directory of SDLPOP, type 'make -f Makefile.osx'.

STEP 3: INSTALL FILES TO THEIR RIGHT PALCES
a) Get your copy of Prince of Persia 1, aka PoP 1, with the original .DAT files.
b) Copy the prince executable you just compiled to the PoP 1 directory.

STEP 4: PLAY!
a) Read the Readme.txt file.
b) In the root directory of PoP 1, type './prince' or './prince full'.
c) Hit Control-Q to quit.

DISCLAIMER: I am using my own Macbook Pro to get this to work. I don't know what will happen if you don't have my exact setup. I don't know what I have broken in my amature attempt to get SDLPOP to compile and run.
Attachments
prince.zip
(924.86 KiB) Downloaded 78 times
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by salvadorc17 »

How are you compiling it????, i want to know what to do to donwload for linux ubuntu...
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by Norbert »

salvadorc17 wrote:How are you compiling it????, i want to know what to do to donwload for linux ubuntu...

Code: Select all

$ sudo apt-get install unzip make gcc libsdl-image1.2-dev libsdl1.2-dev libjpeg-dev libpng12-dev zlib1g-dev
$ unzip SDLPoP_v1.11.zip
$ cd SDLPoP/
SDLPoP $ make
SDLPoP $ ./prince
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by Norbert »

I have tested all (97) tricks currently listed on popot.org with SDLPoP 1.11.
It's always difficult for me to do trick 22, so no guarantees there, but...

All tricks work. :)

The only difference I found was for trick 95. In the original game, there are three outcomes while SDLPoP has four:
1. Successful execution. In other words, the trick worked.
2. The prince falls into the hole (jumped too early).
3. The prince lands on the tiles in the top right area (jumped too late).
4. [This is only for SDLPoP] The prince bumps off - is sort of launched back from - the corner of the hole, and then lands in the hole.

If you want, for example when you're unable to get a desired result, I can record a video of 4., or even videos of 1-4.
Let me know if you want me to do that.
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

Norbert wrote:The only difference I found was for trick 95.
I tried that trick with turn-jumping from various frames, using Esc.
(Remember that there is a one-frame delay as mentioned here: viewtopic.php?p=15840#p15840
The images show the last frame where the game was paused.)
The results are on the image below. The numbers mean the outcomes in your list.
The only difference is in row 5.
result.png
result.png (9.75 KiB) Viewed 6124 times
There used to be a different problem related to this trick: viewtopic.php?p=15042#p15042
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

With some debugging, I found out that a function call was missing:

Code: Select all

start_fall(): (seg006.c)
	seqtbl_offset_char(104); // start fall (when?)
+	play_seq();
And now I can also answer that "when?".
Eugene
Efendi
Efendi
Posts: 14
Joined: August 7th, 2014, 2:17 pm

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by Eugene »

Hello. David!
I tried compile SDLpop v.1.11 on Raspberry PI computer.
But I have not hardware Raspberry PI. And I run it in QEMU.
And in emulator RPI don't have sound device.
That is why SDLpop is crashes after start.
See attached video.
Would be necessary to handle this exception.
Thanks.

This is video
https://www.dropbox.com/s/bxxyexxjax879 ... .webm?dl=0
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

Sorry for the late reply, but I didn't visit the forum in the last few days.

I changed the behaviour, now the game won't quit if there is no sound device, it just disables sound.
This is different from "sound off": for example, the sound-based timing of the slow-fall or the level ending music will still work.

Changes:
FIXED: When doing Trick 95, the kid might bounce back from the wall a bit. It was reported at: viewtopic.php?p=15912#p15912
FIXED: Don't quit if there is no sound device available.
Attachments
SDLPoP_v1.12.zip
(1 MiB) Downloaded 105 times
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

I tried this Raspberry Pi in QEMU. (Instructions are here or an all-in-one package for Windows is here)

Note: SDL applications can run even if the X Window System is not running. They will use the full screen in this case.

SDLPoP runs at playable speed, and QEMU eats only 10%-20% of the host CPU. (Practically 0% if the game is paused.)
The only exception is when the screen is flashing or fading: that is very slow and uses 80%-100% of the CPU.
Of course this might be different on a real Raspberry Pi.

I compared this with PoP1 in DOSBox (still in QEMU).
Firstly, DOSBox senses the keys wrongly. In the file ~/.dosbox/dosbox-0.74.conf set usescancodes=false .
(But then DOSBox does not see some keys if you selected a non-US layout in the Raspberry setup.)
The DOSBox'ed PoP is slower than SDLPoP, it's not really playable.
(Again, this might be different on a real Raspberry Pi.)
Eugene
Efendi
Efendi
Posts: 14
Joined: August 7th, 2014, 2:17 pm

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by Eugene »

Thanks, David. It's fine!
Now SDLPoP is working without sound device.
But the error messages continues to pour into the console.
See this video:
https://dl.dropboxusercontent.com/u/533 ... 22007.webm
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

Eugene wrote:But the error messages continues to pour into the console.
They are written when the game tries to access the audio device, but it can't.
(Only the "SDL_OpenAudio" line is written directly by the game, the others are written by the libraries used.)

They could be removed only if there would be a way to check if there is an audio device, before opening it.
But it seems to me that SDL does not have such a feature.

Anyway, they are written only once, when the first sound would be played.
Eugene
Efendi
Efendi
Posts: 14
Joined: August 7th, 2014, 2:17 pm

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by Eugene »

Hello. David.

1. Run prince on DOS. Level 1.
https://dl.dropboxusercontent.com/u/533 ... 31347.webm

2. Run SDLPoP_v1.12. Ibid.
https://dl.dropboxusercontent.com/u/533 ... 31040.webm
No blinking, no sound after picking up the sword.

Maybe can you fix this?

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

Re: SDLPoP; David's open-source port of PoP (pre-release)

Post by David »

Eugene wrote:No blinking, no sound after picking up the sword.
Music is not yet implemented in SDLPoP, but blinking should work.

Maybe the blinking disappears too fast.
Try this:
In seg009.c find this line:

Code: Select all

if (hc_pal_index != 0) SDL_Delay(1000/60);
Change 1000 to 2*1000 and recompile.
With this change, the color of the blink should be shown twice longer.
Post Reply