diff --git a/games-arcade/open-supaplex/additional-files/open_supaplex.rdef.in b/games-arcade/open-supaplex/additional-files/open_supaplex.rdef.in new file mode 100644 index 000000000..ea2a4b063 --- /dev/null +++ b/games-arcade/open-supaplex/additional-files/open_supaplex.rdef.in @@ -0,0 +1,36 @@ +resource app_flags B_SINGLE_LAUNCH; + +resource app_version { + major = @MAJOR@, + middle = @MIDDLE@, + minor = @MINOR@, + + variety = B_APPV_FINAL, + internal = 0, + + short_info = "OpenSupaplex", + long_info = "@LONG_INFO@" +}; + +resource app_signature "@APP_SIGNATURE@"; + +resource vector_icon array { + $"6E636966040400660501020106030000003E9FF2BE6FF200000048C00046C000" + $"00FFFFFF8EFF5252FF73030303AD0404060606FF07455D455DBC3D5D2CC4552C" + $"C82E2CC07A453ABC3D3AC73D3A5EC4555EC07A5E54455D575E455D5D0608FF7F" + $"3D233D23BA0123B53BBB9FB633B75EB53ABC06B624BD2AB579BC87B5A1BF22B7" + $"5FC411B585C1C6B91FC60F3D53BBB053C3D553553B55C30955B8793D23C3D523" + $"3D2323060AFFFE073D233D23BA0123B53BBB9FB633B75EB53ABC06B624BD2AB5" + $"79BC87B6C9BDC5303FB7CFBE7D444A5145BE85C750C342C6DCBE87C7503D53BE" + $"8A53C3D553553B55C30955B8793D23C3D5233D23230606FF07B74FBE17B74FBE" + $"17B6D4BDC0B624BD2AB671BD72B578BFC33150B57EC382BC7DC7C8C106C6A1BE" + $"FBC78EB9DBC572B74FBE17B7CDC148B74FBE17BE170606BF07303F303FB88ABE" + $"E4B74FBE17B7DCBE79B7CDC148C106C6A1B9DBC572C45FC51E5145303F444A30" + $"3F3F02044030C34530BC3A30304030BC3A30C3454050BC3A50C34550504050C3" + $"4550BC3A070A000100023FF53EB8CCB638F594401782C42E6BBE07D90A010101" + $"12401A4C000000000000401999C22F34B732FE01178400040A02010202401A4C" + $"000000000000401999C22F34B732FE0A03010302401A4C000000000000401999" + $"C22F34B732FE0A01010402401A4C000000000000401999C22F34B732FE0A0101" + $"0502BBEE4BB913A439A79ABC654B4A786F4A5DDA0A01010502BA7F75BA25EE3A" + $"98C1BC27FE46FF864995AE" +}; diff --git a/games-arcade/open-supaplex/open_supaplex-7.1.2.recipe b/games-arcade/open-supaplex/open_supaplex-7.1.2.recipe new file mode 100644 index 000000000..2933710a6 --- /dev/null +++ b/games-arcade/open-supaplex/open_supaplex-7.1.2.recipe @@ -0,0 +1,86 @@ +SUMMARY="A Boulder Dash like game" +DESCRIPTION="Supaplex is a Boulder Dash like game where you control a \ +red Pac-Man like character called Murphy who needs to collect \ +\"Infotrons\" while exploring inside a computer. Watch out for \ +various hazards though! Like in Boulder Dash, the \"boulders\" \ +that are freed from support will fall down and can crush Murphy \ +or block further passage through a level. Other obstacles and \ +hazards exist too, and will require some thinking ahead to \ +overcome safely. + +OpenSupaplex is a 1:1 reimplementation of the original \ +game in C and SDL, with just a few changes to make it easy to use \ +with game controllers, and also easy to port to any platform." +HOMEPAGE="https://github.com/sergiou87/open-supaplex" +COPYRIGHT="Philip Jespersen, Michael Stopp, Robin Heydon, Matt Smith, David Whittaker, Sergio Padrino" +LICENSE="GNU GPL v3" +REVISION="1" +SOURCE_URI="https://github.com/sergiou87/open-supaplex/archive/refs/tags/v${portVersion}.tar.gz" +CHECKSUM_SHA256="769f7cf8684e8d42849581a210d11bbe5c487a24738560f574a084e9d749164b" +SOURCE_DIR="open-supaplex-$portVersion" +PATCHES="open_supaplex-$portVersion.patchset" +ADDITIONAL_FILES="open_supaplex.rdef.in" + +ARCHITECTURES="!x86_gcc2 x86_64" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + open_supaplex$secondaryArchSuffix = $portVersion + app:OpenSupaplex + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libGL$secondaryArchSuffix + lib:libogg$secondaryArchSuffix + lib:libSDL2_2.0$secondaryArchSuffix + lib:libSDL2_mixer_2.0$secondaryArchSuffix + lib:libvorbis$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libGL$secondaryArchSuffix + devel:libglu$secondaryArchSuffix + devel:libogg$secondaryArchSuffix + devel:libSDL2_2.0$secondaryArchSuffix + devel:libSDL2_mixer_2.0$secondaryArchSuffix + devel:libvorbis$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + " + +BUILD() +{ + cd linux + make $jobArgs +} + +INSTALL() +{ + mkdir -p $appsDir/OpenSupaplex/data + cp linux/opensupaplex $appsDir/OpenSupaplex/OpenSupaplex + cp -R resources/* $appsDir/OpenSupaplex/data + mv $appsDir/OpenSupaplex/data/audio-hq $appsDir/OpenSupaplex + rm -rf $appsDir/OpenSupaplex/data/audio-{lq,mq} + + local APP_SIGNATURE="application/x-vnd.open-supaplex" + local MAJOR="`echo "$portVersion" | cut -d. -f1`" + local MIDDLE="`echo "$portVersion" | cut -d. -f2`" + local MINOR="`echo "$portVersion" | cut -d. -f3`" + local LONG_INFO="$SUMMARY" + sed \ + -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \ + -e "s|@MAJOR@|$MAJOR|" \ + -e "s|@MIDDLE@|$MIDDLE|" \ + -e "s|@MINOR@|$MINOR|" \ + -e "s|@LONG_INFO@|$LONG_INFO|" \ + $portDir/additional-files/open_supaplex.rdef.in > $sourceDir/open_supaplex.rdef + + addResourcesToBinaries $sourceDir/open_supaplex.rdef \ + $appsDir/OpenSupaplex/OpenSupaplex + addAppDeskbarSymlink $appsDir/OpenSupaplex/OpenSupaplex +} diff --git a/games-arcade/open-supaplex/patches/open_supaplex-7.1.2.patchset b/games-arcade/open-supaplex/patches/open_supaplex-7.1.2.patchset new file mode 100644 index 000000000..5e67ee884 --- /dev/null +++ b/games-arcade/open-supaplex/patches/open_supaplex-7.1.2.patchset @@ -0,0 +1,118 @@ +From 6043dca6b8c05351f19f8fe4a06570f41b686879 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Mon, 12 Apr 2021 16:56:08 +1000 +Subject: Fix for Haiku + + +diff --git a/src/file.c b/src/file.c +index 2be6f6f..d65d508 100644 +--- a/src/file.c ++++ b/src/file.c +@@ -55,6 +55,34 @@ FILE *openWritableFile(const char *pathname, const char *mode) + + return fopen(finalPathname, mode); + } ++#elif defined(__HAIKU__) ++#include ++ ++#define HAIKU_DATA_PATH "/system/apps/OpenSupaplex/data/" ++#define HAIKU_WRITABLE_PATH "/boot/home/config/settings/OpenSupaplex/" ++ ++void getReadonlyFilePath(const char *pathname, char outPath[kMaxFilePathLength]) ++{ ++ snprintf(outPath, kMaxFilePathLength, HAIKU_DATA_PATH "%s", pathname); ++} ++void getWritableFilePath(const char *pathname, char outPath[kMaxFilePathLength]) ++{ ++ snprintf(outPath, kMaxFilePathLength, HAIKU_WRITABLE_PATH "%s", pathname); ++} ++FILE *openReadonlyFile(const char *pathname, const char *mode) ++{ ++ char finalPathname[kMaxFilePathLength]; ++ getReadonlyFilePath(pathname, finalPathname); ++ return fopen(finalPathname, mode); ++} ++ ++FILE *openWritableFile(const char *pathname, const char *mode) ++{ ++ mkdir(HAIKU_WRITABLE_PATH, ALLPERMS); ++ char finalPathname[kMaxFilePathLength]; ++ getWritableFilePath(pathname, finalPathname); ++ return fopen(finalPathname, mode); ++} + #elif defined(FILE_FHS_XDG_DIRS) + + #if defined(FILE_DATA_PATH) +diff --git a/src/sdl2/video.c b/src/sdl2/video.c +index 694c4af..161d682 100644 +--- a/src/sdl2/video.c ++++ b/src/sdl2/video.c +@@ -20,6 +20,9 @@ + #include + #include + #include ++#ifdef __HAIKU__ ++#include ++#endif + + #include "../logging.h" + #include "../utils.h" +@@ -33,6 +36,9 @@ static const int kWindowHeight = 544; + #elif defined(__PSL1GHT__) || defined(__WIIU__) + static const int kWindowWidth = 1280; + static const int kWindowHeight = 720; ++#elif defined(__HAIKU__) ++static const int kWindowWidth = kScreenWidth * 3; ++static const int kWindowHeight = kScreenHeight * 3; + #else + static const int kWindowWidth = kScreenWidth * 4; + static const int kWindowHeight = kScreenHeight * 4; +@@ -229,16 +235,19 @@ void getMouseState(int *x, int *y, uint8_t *leftButton, uint8_t *rightButton) + void toggleFullscreen() + { + setFullscreenMode(getFullscreenMode() == 0); ++#ifdef __HAIKU__ ++ usleep(250000); ++#endif + } + + void setFullscreenMode(uint8_t fullscreen) + { +- SDL_SetWindowFullscreen(gWindow, fullscreen ? SDL_WINDOW_FULLSCREEN : 0); ++ SDL_SetWindowFullscreen(gWindow, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); + } + + uint8_t getFullscreenMode(void) + { +- uint8_t isFullscreen = SDL_GetWindowFlags(gWindow) & SDL_WINDOW_FULLSCREEN; ++ uint8_t isFullscreen = SDL_GetWindowFlags(gWindow) & SDL_WINDOW_FULLSCREEN_DESKTOP; + return (isFullscreen != 0); + } + +@@ -258,8 +267,10 @@ int windowResizingEventWatcher(void* data, SDL_Event* event) + && event->window.event == SDL_WINDOWEVENT_RESIZED) + { + updateWindowViewport(); ++#ifndef __HAIKU__ + render(); + present(); ++#endif + } + + return 0; +diff --git a/src/sdl_common/audio.c b/src/sdl_common/audio.c +index 797c678..1de79b8 100644 +--- a/src/sdl_common/audio.c ++++ b/src/sdl_common/audio.c +@@ -81,6 +81,8 @@ static const char *kBaseAudioFolder = "app0:/audio"; + static const char *kBaseAudioFolder = "sdmc:/OpenSupaplex/audio"; + #elif defined(__PSL1GHT__) + static const char *kBaseAudioFolder = "/dev_hdd0/game/" PS3APPID "/USRDIR/audio"; ++#elif defined(__HAIKU__) ++static const char *kBaseAudioFolder = "/system/apps/OpenSupaplex/audio"; + #elif defined(__WII__) + static const char *kBaseAudioFolder = "/apps/OpenSupaplex/audio"; + #elif defined(__WIIU__) +-- +2.30.2 +