Ports: Added a Prince of Persia (SDLPoP) port.

This is a port of the dissasembly version of the DOS prince of persia
game :)
This commit is contained in:
Manuel Palenzuela 2021-04-03 17:53:44 +02:00 committed by Andreas Kling
parent bf1ad16078
commit 83b5655977
Notes: sideshowbarker 2024-07-18 20:51:24 +09:00
6 changed files with 167 additions and 0 deletions

View File

@ -66,6 +66,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`patch`](patch/) | patch (OpenBSD) | 6.6 | https://github.com/ibara/libpuffy |
| [`pcre2`](pcre2/) | Perl-compatible Regular Expressions (PCRE2) | 10.34 | https://www.pcre.org/ |
| [`pkgconf`](pkgconf/) | pkgconf | 1.7.3 | https://github.com/pkgconf/pkgconf |
| [`SDLPoP`](SDLPoP/) | Prince of Persia game | | https://github.com/NagyD/SDLPoP |
| [`printf`](printf/) | printf (OpenBSD) | 6.6 | https://github.com/ibara/libpuffy |
| [`pt2-clone`](pt2-clone/) | ProTracker 2 clone | 1.28 | https://github.com/8bitbubsy/pt2-clone |
| [`python3`](python3/) | Python | 3.9.2 | https://www.python.org/ |

18
Ports/SDLPoP/package.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=PrinceOfPersia
useconfigure=true
version=git
depends="SDL2 SDL2_image"
workdir=SDLPoP-master
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_ROOT/Toolchain/CMakeToolchain.txt"
files="https://github.com/NagyD/SDLPoP/archive/refs/heads/master.zip PoP.zip"
install_location="Root/opt/PrinceOfPersia"
configure() {
run cmake $configopts src/.
}
install() {
run mkdir -p "${SERENITY_BUILD_DIR}/${install_location}"
run cp -r prince data SDLPoP.ini "${SERENITY_BUILD_DIR}/${install_location}"
}

View File

@ -0,0 +1,87 @@
diff --git a/src/config.h b/src/config.h
index b6bb168..5af0adf 100644
--- a/src/config.h
+++ b/src/config.h
@@ -35,7 +35,7 @@ The authors of this program may be contacted at https://forum.princed.org
// Enable or disable the SDL hardware accelerated renderer backend
// Uses a software backend otherwise
-#define USE_HW_ACCELERATION
+//#define USE_HW_ACCELERATION
// Enable or disable fading.
// Fading used to be very buggy, but now it works correctly.
@@ -58,23 +58,23 @@ The authors of this program may be contacted at https://forum.princed.org
//#define USE_COMPAT_TIMER
// Enable quicksave/load feature.
-#define USE_QUICKSAVE
+//#define USE_QUICKSAVE
// Try to let time keep running out when quickloading. (similar to Ctrl+A)
// Technically, the 'remaining time' is still restored, but with a penalty for elapsed time (up to 1 minute).
// The one minute penalty will also be applied when quickloading from e.g. the title screen.
-#define USE_QUICKLOAD_PENALTY
+//#define USE_QUICKLOAD_PENALTY
#ifdef USE_QUICKSAVE // Replay relies on quicksave, because the replay file begins with a quicksave of the initial state.
// Enable recording/replay feature.
-#define USE_REPLAY
+//#define USE_REPLAY
#endif
// Adds a way to crouch immediately after climbing up: press down and forward simultaneously.
// In the original game, this could not be done (pressing down always causes the kid to climb down).
-#define ALLOW_CROUCH_AFTER_CLIMBING
+//#define ALLOW_CROUCH_AFTER_CLIMBING
// Time runs out while the level ending music plays; however, the music can be skipped by disabling sound.
// This option stops time while the ending music is playing (so there is no need to disable sound).
@@ -90,12 +90,12 @@ The authors of this program may be contacted at https://forum.princed.org
#define USE_FAKE_TILES
// Allow guard hitpoints not resetting to their default (maximum) value when re-entering the room
-#define REMEMBER_GUARD_HP
+//#define REMEMBER_GUARD_HP
// Enable completely disabling the time limit. To use this feature, set the starting time to -1.
// This also disables the in-game messages that report how much time is left every minute.
// The elasped time is still kept track of, so that the shortest times will appear in the Hall of Fame.
-#define ALLOW_INFINITE_TIME
+//#define ALLOW_INFINITE_TIME
// Bugfixes:
@@ -250,11 +250,11 @@ The authors of this program may be contacted at https://forum.princed.org
#define USE_LIGHTING
// Enable screenshot features.
-#define USE_SCREENSHOT
+//#define USE_SCREENSHOT
// Automatically switch to keyboard or joystick/gamepad mode if there is input from that device.
// Useful if SDL detected a gamepad but there is none.
-#define USE_AUTO_INPUT_MODE
+//#define USE_AUTO_INPUT_MODE
#ifdef USE_TEXT // The menu won't work without text.
@@ -264,13 +264,13 @@ The authors of this program may be contacted at https://forum.princed.org
#endif
// Enable colored torches. A torch can be colored by changing its modifier in a level editor.
-#define USE_COLORED_TORCHES
+//#define USE_COLORED_TORCHES
// Enable fast forwarding with the backtick key.
-#define USE_FAST_FORWARD
+//#define USE_FAST_FORWARD
// Set how much should the fast forwarding speed up the game.
-#define FAST_FORWARD_RATIO 10
+//#define FAST_FORWARD_RATIO 10
// Speed up the sound during fast forward using resampling.
// If disabled, the sound is sped up by clipping out parts from it.

View File

@ -0,0 +1,11 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3558a6c..2092651 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -118,5 +118,5 @@ if(WIN32)
elseif(APPLE)
target_link_libraries(prince SDL2main SDL2 SDL2_image m)
else() # Linux, *BSD, etc.
- target_link_libraries(prince SDL2 SDL2_image m)
+ target_link_libraries(prince SDL2 SDL2_image -lm -lpng -ljpeg -lz -lgui -lcore -lipc -lgfx -lpthread)
endif()

View File

@ -0,0 +1,37 @@
diff --git a/src/options.c b/src/options.c
index 1bfe473..2bf173e 100644
--- a/src/options.c
+++ b/src/options.c
@@ -56,8 +56,8 @@ int ini_load(const char *filename,
}
while (!feof(f)) {
- if (fscanf(f, "[%127[^];\n]]\n", section) == 1) {
- } else if ((cnt = fscanf(f, " %63[^=;\n] = %255[^;\n]", name, value))) {
+ if (fscanf(f, "[%[^];\n]]\n", section) == 1) {
+ } else if ((cnt = fscanf(f, " %[^=;\n] = %[^;\n]", name, value))) {
if (cnt == 1)
*value = 0;
for (s = name + strlen(name) - 1; s > name && isspace(*s); s--)
@@ -66,7 +66,7 @@ int ini_load(const char *filename,
*s = 0;
report(section, name, value);
}
- if (fscanf(f, " ;%*[^\n]") != 0 ||
+ if (fscanf(f, " ;%[^\n]") != 0 ||
fscanf(f, " \n") != 0) {
fprintf(stderr, "short read from %s!?\n", filename);
fclose(f);
diff --git a/src/seg009.c b/src/seg009.c
index 139c2d8..e2047fb 100644
--- a/src/seg009.c
+++ b/src/seg009.c
@@ -2077,7 +2077,7 @@ void load_sound_names() {
while (!feof(fp)) {
int index;
char name[POP_MAX_PATH];
- if (fscanf(fp, "%d=%255s\n", &index, /*sizeof(name)-1,*/ name) != 2) {
+ if (fscanf(fp, "%d=%s\n", &index, /*sizeof(name)-1,*/ name) != 2) {
perror(names_path);
continue;
}

View File

@ -0,0 +1,13 @@
diff --git a/src/options.c b/src/options.c
index 1bfe473..ba13dab 100644
--- a/src/options.c
+++ b/src/options.c
@@ -130,7 +130,7 @@ static int ini_process_##data_type(const char* curr_name, const char* value, con
if(strcasecmp(curr_name, option_name) == 0) { \
if (strcasecmp(value, "default") != 0) { \
int named_value = ini_get_named_value(value, value_names); \
- *target = (named_value == INI_NO_VALID_NAME) ? ((data_type) strtoimax(value, NULL, 0)) : ((data_type) named_value); \
+ *target = (named_value == INI_NO_VALID_NAME) ? ((data_type) strtol(value, NULL, 0)) : ((data_type) named_value); \
} \
return 1; /* finished; don't look for more possible options that curr_name can be */ \
} \