SDLPoP; David's open-source port of PoP

Open-source port of PoP that runs natively on Windows, Linux, etc.
User avatar
SuavePrince
The Prince of Persia
The Prince of Persia
Posts: 1092
Joined: January 26th, 2015, 6:21 pm

Re: SDLPoP; David's open-source port of PoP

Post by SuavePrince »

Is possible save state and dont alterate the time in sdlpop?is perfect,but personally, dont necessary appear quicksave,and other this dosbox that David show is almost perfect,except that lost sound...NIce job ..
http://ykhwong.x-y.net thanxs for the info David :P
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP

Post by David »

SuavePrince wrote:and other this dosbox that David show is almost perfect,except that lost sound...
That's strange.
That unofficial DOSBox *does* have sound for me. In fact, it even supports the MT-32 better than the official DOSBox!

---
Someone opened this issue: https://github.com/NagyD/SDLPoP/issues/59
User avatar
SuavePrince
The Prince of Persia
The Prince of Persia
Posts: 1092
Joined: January 26th, 2015, 6:21 pm

Re: SDLPoP; David's open-source port of PoP

Post by SuavePrince »

David wrote:
SuavePrince wrote:and other this dosbox that David show is almost perfect,except that lost sound...
That's strange.
That unofficial DOSBox *does* have sound for me. In fact, it even supports the MT-32 better than the official DOSBox!

---
Someone opened this issue: https://github.com/NagyD/SDLPoP/issues/59
When save state,lost sound :( i think that need try different ways
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP

Post by David »

(I think these last few posts about the custom DOSBox should be moved.)
So sound is lost only when you save/load state?
I tried that now, but it still does not happen for me.
digi@os2.snc.ru
Scholar Scribe
Scholar Scribe
Posts: 1
Joined: February 29th, 2016, 3:42 am

Re: SDLPoP; David's open-source port of PoP

Post by digi@os2.snc.ru »

Hello.

I've made port of v. 1.16 for eComStation (OS/2).
Some things looks strange for me:
1. Not all variables in data.h have prefix "extern", as result I have compiler warnings (gcc 4.9.2) and all that variables are duplicates for each module. I have add "extern" prefixes.
2. Array timer_stopped (data.h) not initialized by any values, as result I have black screen after first screen ("fixes and enhancements, Y/N"). I have replace:
int timer_stopped[2];
with
extern int timer_stopped[2] INIT( = { 1, 1 } );

After this changes all work fine for me.
OS/2 binaries: http://hobbes.nmsu.edu/h-search.php?key=sdlpop
Falcury
Calif
Calif
Posts: 568
Joined: June 25th, 2009, 10:01 pm

Re: SDLPoP; David's open-source port of PoP

Post by Falcury »

Hi and welcome to the forum!
digi@os2.snc.ru wrote: Some things looks strange for me:
1. Not all variables in data.h have prefix "extern", as result I have compiler warnings (gcc 4.9.2) and all that variables are duplicates for each module. I have add "extern" prefixes.
I don't get any warnings myself. My hunch is that this occurs because of a difference between C and C++, namely that C allows tentative definitions, while C++ doesn't (did you use gcc, or g++ to compile?)
It wouldn't hurt to add the missing "extern" keywords, I think (probably good for consistency as well, as you say it looks a bit strange).
digi@os2.snc.ru wrote:2. Array timer_stopped (data.h) not initialized by any values, as result I have black screen after first screen ("fixes and enhancements, Y/N"). I have replace:
int timer_stopped[2];
with
extern int timer_stopped[2] INIT( = { 1, 1 } );
It is not uninitialized, though: because timer_stopped has static storage duration (it being a global variable), it is initialized to {0,0} by default. However, it is strange that this would lead to a freeze...
digi@os2.snc.ru wrote:After this changes all work fine for me.
OS/2 binaries: http://hobbes.nmsu.edu/h-search.php?key=sdlpop
Good to hear that, and thank you for your feedback!
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP

Post by David »

Falcury wrote: My hunch is that this occurs because of a difference between C and C++, namely that C allows tentative definitions, while C++ doesn't
If I select "Compile file as C++" at data.c then I get errors like this:

Code: Select all

data.h:577:6: error: redefinition of 'word last_loose_sound'
But also hundreds of errors like this:

Code: Select all

c:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/fvec.h:178:62: error: conflicting declaration of C function 'F32vec1 operator&(const F32vec1&, const F32vec1&)'
(fvec.h is included through SDL.h.)
(How is it a "C function" by the way? It's an operator and it uses references!)

I added extern to everything in data.h.

I also added an initialization to timer_stopped and now I get an error about it:
It's defined in both data.h and seg009.c. So I removed it from data.h.

But it's initialized only in seg009.c. This might explain the second point.

Code: Select all

int timer_stopped[2] = {1,1};
If I change that initialization to {0,0} or {0,1}, then:
The intro won't appear, the bugfix question stays on screen. But any key will start the first level.
Ctrl+R will show a black screen, but again, any key will stop the "intro".

The intro gets stuck in show_title(), at "do_wait(timer_0);" that has no matching start_timer().
It waits for timer_stopped[0] to become 1.

Here are the changes: https://github.com/NagyD/SDLPoP/commit/ ... a680ac7a47
Also added this fix: https://github.com/NagyD/SDLPoP/commit/ ... a9ae7595e6
And updated the Readme: https://github.com/NagyD/SDLPoP/commit/ ... dd6b5ebf8d
Falcury
Calif
Calif
Posts: 568
Joined: June 25th, 2009, 10:01 pm

Re: SDLPoP; David's open-source port of PoP

Post by Falcury »

Hm, perhaps then the compiler ignored the {1,1} initialization in seg009.c, because it saw the duplicate definition in data.c and used that instead?

I merged the changes into the branch with the prototype scripting/modding features (maybe I should prepare a new test build for this).
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5786
Joined: April 9th, 2009, 10:58 pm

Re: SDLPoP; David's open-source port of PoP

Post by Norbert »

Related to the easy mode discussion we had at the beginning of the year.

StaticReturn
Efendi
Efendi
Posts: 13
Joined: September 2nd, 2014, 4:14 am

Re: SDLPoP; David's open-source port of PoP

Post by StaticReturn »

To those that are working on SDLPoP: I was just checking the SDLPoP source on GitHub and noticed that my old MAC_CHANGES.txt file is present. Please feel free to remove it or any other cruft that is left behind from my amateurish attempt to get Prince of Persia working on OS X. :)
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Re: SDLPoP; David's open-source port of PoP

Post by poirot »

StaticReturn wrote:To those that are working on SDLPoP: I was just checking the SDLPoP source on GitHub and noticed that my old MAC_CHANGES.txt file is present. Please feel free to remove it or any other cruft that is left behind from my amateurish attempt to get Prince of Persia working on OS X. :)
Yes, and I moved the old mac installation instructions to the original readme file, with more data.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP

Post by David »

Falcury
Calif
Calif
Posts: 568
Joined: June 25th, 2009, 10:01 pm

Re: SDLPoP; David's open-source port of PoP

Post by Falcury »

David wrote: Problem!
With SDL 2.0.4, SDLPoP crashes when I resize the window in any way. This includes entering/exiting fullscreen mode.
The crash happens in the SDL_RenderClear() call.
If I comment that out then it crashes in SDL_RenderCopy().
If I also comment that out, then there is no crash (and no display either).

Apoplexy does not crash with the same DLL.

Update:
There are two versions of SDL2.dll in the SDL2-devel-2.0.4-mingw.tar.gz archive.
SDL2-2.0.4\i686-w64-mingw32\bin\SDL2.dll --> This crashes.
SDL2-2.0.4\lib\x86\SDL2.dll --> This does not crash. But this is version 2.0.2 !
acd2001 wrote:You must recompile sdl2 v2.04 with this patch.
I have the same problem before...

diff -Naur src/render/direct3d/SDL_render_d3d.c src/render/direct3d/SDL_render_d3d.c
--- src/render/direct3d/SDL_render_d3d.c 2016-01-02 19:56:31 +0000
+++ src/render/direct3d/SDL_render_d3d.c 2016-01-13 22:24:01 +0000
@@ -1003,6 +1003,10 @@
{
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
+
+ if (!texturedata) {
+ return 0;
+ }

if (D3D_RecreateTextureRep(data->device, &texturedata->texture, texture->format, texture->w, texture->h) < 0) {
return -1;


https://bugzilla.libsdl.org/attachment. ... ction=edit
I compiled a version of the v2.0.4 SDL2.dll with this patch applied.
For some reason, the dll size is smaller compared to official release from on libsdl.org (746 KiB vs 1023 KiB). Not that I'm complaining!
Attachments
SDL2_2.0.4_patched.zip
(291.29 KiB) Downloaded 223 times
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP

Post by David »

Falcury wrote:I compiled a version of the v2.0.4 SDL2.dll with this patch applied.
Thank you, it works perfectly!

I noticed something strange, though:
(I guess this is part of the original 2.0.4 and not caused by the patch!)
At certain window sizes, there is a few pixel wide black stripe at the bottom or the right side of the window.
It's always in the direction in which the image should completely fill the window.
(See the attached screenshot.)
This does not happen with SDL 2.0.3.
But at least it's not as annoying as the 16-bit sound bug or the crash-on-resize bug.

Another thing: If I grab the window for moving or resizing, then the sounds will keep playing but everything else pauses.
But this also happens with SDL 2.0.3.
Attachments
black_stripe.png
Falcury
Calif
Calif
Posts: 568
Joined: June 25th, 2009, 10:01 pm

Re: SDLPoP; David's open-source port of PoP

Post by Falcury »

I just learned that the "color ids" used when drawing text, hp boxes, potion bubbles etc. correspond closely to the "EGA color palette":
https://en.wikipedia.org/wiki/Enhanced_Graphics_Adapter

The EGA color table is also mentioned in the Prince of Persia Specifications of File Formats document (that's how I found this).

Apparently there are "official" names for these colors, so I guess these names in types.h are not really correct:

Code: Select all

enum colorids {
	color_0_black = 0,
	color_1_darkblue = 1,    // "blue" 
	color_2_darkgreen = 2,   // "green"
	color_3_turquoise = 3,   // "cyan"
	color_4_darkred = 4,     // "red"
	color_5_purple = 5,      // "magenta"
	color_6_gold = 6,        // "brown"
	color_7_grey = 7,        // "light grey"
	color_8_darkgrey = 8,    // "dark grey"
	color_9_blue = 9,        // "bright blue"
	color_10_green = 10,     // "bright green"
	color_11_lightblue = 11, // "bright cyan"
	color_12_red = 12,       // "bright red"
	color_13_violet = 13,    // "bright magenta"
	color_14_yellow = 14,    // "bright yellow"
	color_15_white = 15,     // "bright white"
};
Edit: sorry, meant to post this in the main SDLPoP thread. I can repost there if necessary (I cannot delete the post here).
[Edit: Moved. --Norbert]
Post Reply