SDLPoP; David's open-source port of PoP
Re: SDLPoP; David's open-source port of PoP
I implemented support for PC speaker sounds.
See: https://github.com/NagyD/SDLPoP/pull/188
It can be tested by removing the DIGISND and MIDISND files from the data folder, so that SDLPoP will automatically fall back to the IBM_SND files.
Also, the blinking sound of the "Press button to continue" text only exists as a speaker sound, so that sound can now finally be played.
I am not 100% happy with my implementation of a square wave synthesizer, because the sound seems to hitch a tiny bit when switching from one note to another. Maybe that can be fixed later on.
Edit: I guess with the addition of support for speaker sounds, SDLPoP is more or less "feature complete"? As in, it's on par with the most commonly used configuration of the original Prince of Persia for DOS? (Although of course there are less commonly used audio and video modes that have not been implemented in SDLPoP.)
See: https://github.com/NagyD/SDLPoP/pull/188
It can be tested by removing the DIGISND and MIDISND files from the data folder, so that SDLPoP will automatically fall back to the IBM_SND files.
Also, the blinking sound of the "Press button to continue" text only exists as a speaker sound, so that sound can now finally be played.
I am not 100% happy with my implementation of a square wave synthesizer, because the sound seems to hitch a tiny bit when switching from one note to another. Maybe that can be fixed later on.
Edit: I guess with the addition of support for speaker sounds, SDLPoP is more or less "feature complete"? As in, it's on par with the most commonly used configuration of the original Prince of Persia for DOS? (Although of course there are less commonly used audio and video modes that have not been implemented in SDLPoP.)
Re: SDLPoP; David's open-source port of PoP
It works mostly well for me.Falcury wrote: ↑January 5th, 2019, 3:43 pm I implemented support for PC speaker sounds.
See: https://github.com/NagyD/SDLPoP/pull/188
However, I have some remarks:
1.
Code: Select all
period_in_samples /= 2.0f; // Apparently, the frequencies in the sound files are an octave too low.
It's needed because we need the time between two "flips", which is the half of the period.
Code: Select all
period
<--------------------->
__________ __________
| | | |
_____| |__________| |_____
<---------->
time between flips
Code: Select all
memset(stream, square_wave_state, sizeof(short));
If I change the initial value of square_wave_state to 1024 then the square wave can't be heard at all. (The output will flip between 0x0000 and 0xFFFF.)
Didn't you mean something like this instead?
Code: Select all
*(short*)stream = square_wave_state;
Some sound effects sound really different from the original game.
For example, the gate slam (res10006) at the beginning of level 1, or the breaking loose floor (res10002), or the closing level door (res10014).
What's common about these sounds is that they consist of notes with length = 1.
I think that stream should be incremented after the call to generate_square_wave().
This increment is already present in the "rest" branch of the if, so it just has to be moved outside:
Code: Select all
size_t copy_len = (size_t)note_samples_to_emit * bytes_per_sample;
if (note->frequency <= 0x01 /*rest*/) {
memset(stream, digi_audiospec->silence, copy_len);
} else {
generate_square_wave(stream, (float)note->frequency, note_samples_to_emit);
}
stream += copy_len;
Re: SDLPoP; David's open-source port of PoP
Thanks for the feedback, David!
This clears things up for me, and I think you are totally right.
I added a second commit, with the changes applied. I renamed period_in_samples to half_period_in_samples (that seemed appropriate). I also updated ChangeLog.txt, which I had initially forgotten to do.

I added a second commit, with the changes applied. I renamed period_in_samples to half_period_in_samples (that seemed appropriate). I also updated ChangeLog.txt, which I had initially forgotten to do.
Re: SDLPoP; David's open-source port of PoP
Right, I merged it: https://github.com/NagyD/SDLPoP/commits
I also added the "stdsnd" command line parameter so you don't have to rename files to use PC Speaker mode.
(The "adlib" mode would also be easy to add, because it simply uses MIDI music with PC Speaker sound effects.)
Is this still so? Fix #3 in my previous post might have fixed this, but I'm not sure.
GitHub just reminded me that my system is outdated:
For Windows XP, the last version of Firefox is 52.9 ESR. I have this version.
GitHub says (at the top of every page) that it doesn't support this browser version anymore. And indeed the Merge button doesn't work, among others.
Good thing I have Opera: GitHub doesn't complain about it, and the Merge button works there.
Re: SDLPoP; David's open-source port of PoP
Yes, I think that solved it.
It looks like fix #2 influenced only the amplitude of the wave (which makes sense, considering what you wrote), explaining why the initial value of square_wave_state needed to be changed from 1000 to a higher value, as you did in your most recent commit.
Edit:
Right, good idea!
That mode has unique sound effects in version 1.3. A while back, somebody mentioned these on GitHub as a feature request:
https://github.com/NagyD/SDLPoP/issues/167
I think these sound effects use the percussion instruments of the OPL2 chip. (I briefly tried and failed to figure out how these work while implementing MIDI playback.)
Re: SDLPoP; David's open-source port of PoP
Well, I did run into another one.
https://www.youtube.com/watch?v=26uZkd_wke4
You can see the menu, plus use of quicksave/load throughout.
It's the original game with Pirates of Persia graphics, and a mobile/gamepad overlay.
Re: SDLPoP; David's open-source port of PoP
The menu has "WARP" instead of "SETTINGS". I wonder what it does...Norbert wrote: ↑January 12th, 2019, 9:09 pm https://www.youtube.com/watch?v=26uZkd_wke4
You can see the menu, plus use of quicksave/load throughout.
I'm wondering why does the player visit every closed gate (at 0:03, 0:42, 1:09).

Yeah, so the game can be played on a touchscreen.
At the very end you can see it's played on a smartphone.
Apparently the green button is shift (grab, attack), and the blue button is up (jump, parry) or maybe up+forward.
The uploader also made videos of levels 1-6: https://www.youtube.com/channel/UCRpa1i ... voA/videos
I'm wondering if this modified version is available somewhere?
Update:
Found it: https://play.google.com/store/apps/deta ... forandroid
It's the second result for "Prince of Persia" in Google Play: https://play.google.com/store/search?q= ... %22&c=apps
Now I'm wondering if the source code of this version is available somewhere?
Re: SDLPoP; David's open-source port of PoP
According to its page, this one has no ads or in-app purchases.David wrote: ↑January 13th, 2019, 1:07 pmFound it: https://play.google.com/store/apps/deta ... forandroid
It's the second result for "Prince of Persia" in Google Play: https://play.google.com/store/search?q= ... %22&c=apps
Now I'm wondering if the source code of this version is available somewhere?
The permissions it takes are very broad though, including reading media and storage, plus full internet access.
This makes me think it, unfortunately, might be used as trojan software.
I don't have much faith in Google keeping crap away from Google Play.
Android phones have a bad reputation when it comes to the trustworthiness of available software.
Re: SDLPoP; David's open-source port of PoP
I see in the PoPOT stats that the SDLPoP page recently got about 50 visitors from:
http://www.inven.co.kr/board/diablo3/3991/64565
http://www.inven.co.kr/board/diablo3/3991/64565
Re: SDLPoP; David's open-source port of PoP
Here you can see it on the Nintendo Switch homebrew screen, around 0:14.
https://www.youtube.com/watch?v=4LI9DL9yark
Re: SDLPoP; David's open-source port of PoP
https://www.youtube.com/watch?v=26uZkd_wke4
You can see the menu, plus use of quicksave/load throughout.
It's the original game with Pirates of Persia graphics, and a mobile/gamepad overlay.
[/quote]
Norbert! Tell me, what is this MOD?
Looks like Pirates, but this is not the MOD?
https://www.popot.org/custom_levels.php?mod=0000047
You can see the menu, plus use of quicksave/load throughout.
It's the original game with Pirates of Persia graphics, and a mobile/gamepad overlay.
[/quote]
Norbert! Tell me, what is this MOD?
Looks like Pirates, but this is not the MOD?
https://www.popot.org/custom_levels.php?mod=0000047
Re: SDLPoP; David's open-source port of PoP
A very minor difference between the original and SDLPoP: if the game is in upside-down mode (after drinking the flip potion) and time runs out, the original does not show the torch flames and hourglass in the princess room, while SDLPoP does. In SDLPoP, the torch flames do not move for most of that cutscene (when upside-down).