diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2021-04-03 17:53:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-03 23:30:27 +0200 |
commit | 83b5655977787ebd3410c6d2562fc18e97ae0a91 (patch) | |
tree | 38f327ec09b7cec0984415734713250e79cd642d | |
parent | bf1ad160788e396987a0969626e6c05649943581 (diff) | |
download | serenity-83b5655977787ebd3410c6d2562fc18e97ae0a91.zip |
Ports: Added a Prince of Persia (SDLPoP) port.
This is a port of the dissasembly version of the DOS prince of persia
game :)
-rw-r--r-- | Ports/AvailablePorts.md | 1 | ||||
-rwxr-xr-x | Ports/SDLPoP/package.sh | 18 | ||||
-rw-r--r-- | Ports/SDLPoP/patches/disable_extra_features.patch | 87 | ||||
-rw-r--r-- | Ports/SDLPoP/patches/link_against_serenity_libs.patch | 11 | ||||
-rw-r--r-- | Ports/SDLPoP/patches/remove_fscanf_unknwn_conversion_specfier.patch | 37 | ||||
-rw-r--r-- | Ports/SDLPoP/patches/remove_strtoimax.patch | 13 |
6 files changed, 167 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index b9903c4ac2..ded3eeb348 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -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/ | diff --git a/Ports/SDLPoP/package.sh b/Ports/SDLPoP/package.sh new file mode 100755 index 0000000000..4e688e223f --- /dev/null +++ b/Ports/SDLPoP/package.sh @@ -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}" +} diff --git a/Ports/SDLPoP/patches/disable_extra_features.patch b/Ports/SDLPoP/patches/disable_extra_features.patch new file mode 100644 index 0000000000..af976b3e87 --- /dev/null +++ b/Ports/SDLPoP/patches/disable_extra_features.patch @@ -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. diff --git a/Ports/SDLPoP/patches/link_against_serenity_libs.patch b/Ports/SDLPoP/patches/link_against_serenity_libs.patch new file mode 100644 index 0000000000..ab51236a70 --- /dev/null +++ b/Ports/SDLPoP/patches/link_against_serenity_libs.patch @@ -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() diff --git a/Ports/SDLPoP/patches/remove_fscanf_unknwn_conversion_specfier.patch b/Ports/SDLPoP/patches/remove_fscanf_unknwn_conversion_specfier.patch new file mode 100644 index 0000000000..9354d644fd --- /dev/null +++ b/Ports/SDLPoP/patches/remove_fscanf_unknwn_conversion_specfier.patch @@ -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; + } diff --git a/Ports/SDLPoP/patches/remove_strtoimax.patch b/Ports/SDLPoP/patches/remove_strtoimax.patch new file mode 100644 index 0000000000..86ed22871b --- /dev/null +++ b/Ports/SDLPoP/patches/remove_strtoimax.patch @@ -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 */ \ + } \ |