From owner-svn-ports-all@freebsd.org Sun Jun 28 14:24:00 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB96334D69F; Sun, 28 Jun 2020 14:24:00 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49vtCh5W6sz4Tb2; Sun, 28 Jun 2020 14:24:00 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FA4E17868; Sun, 28 Jun 2020 14:24:00 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05SEO0mY076166; Sun, 28 Jun 2020 14:24:00 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SENwYp076153; Sun, 28 Jun 2020 14:23:58 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202006281423.05SENwYp076153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sun, 28 Jun 2020 14:23:58 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r540723 - in head/games: . shockolate shockolate/files X-SVN-Group: ports-head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/games: . shockolate shockolate/files X-SVN-Commit-Revision: 540723 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2020 14:24:00 -0000 Author: lwhsu Date: Sun Jun 28 14:23:58 2020 New Revision: 540723 URL: https://svnweb.freebsd.org/changeset/ports/540723 Log: Add games/shockolate, Cross platform System Shock PR: 246072 Submitted by: Vasily Postnicov Added: head/games/shockolate/ head/games/shockolate/Makefile (contents, props changed) head/games/shockolate/distinfo (contents, props changed) head/games/shockolate/files/ head/games/shockolate/files/patch-src_GameSrc_setup.c (contents, props changed) head/games/shockolate/files/patch-src_Libraries_RES_Source_caseless.c (contents, props changed) head/games/shockolate/files/patch-src_MacSrc_OpenGL.cc (contents, props changed) head/games/shockolate/files/patch-src_MusicSrc_MusicDevice.c (contents, props changed) head/games/shockolate/pkg-descr (contents, props changed) head/games/shockolate/pkg-message (contents, props changed) head/games/shockolate/pkg-plist (contents, props changed) Modified: head/games/Makefile Modified: head/games/Makefile ============================================================================== --- head/games/Makefile Sun Jun 28 14:21:13 2020 (r540722) +++ head/games/Makefile Sun Jun 28 14:23:58 2020 (r540723) @@ -873,6 +873,7 @@ SUBDIR += sex SUBDIR += sgt-puzzles SUBDIR += shaaft + SUBDIR += shockolate SUBDIR += shootingstar SUBDIR += simplevaders SUBDIR += simsu Added: head/games/shockolate/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/Makefile Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,41 @@ +# Created by: Vasily Postnicov +# $FreeBSD$ + +PORTNAME= shockolate +DISTVERSIONPREFIX= v +DISTVERSION= 0.8.2-43 +DISTVERSIONSUFFIX= -ga9eb1b93 +CATEGORIES= games + +MAINTAINER= shamaz.mazum@gmail.com +COMMENT= Open source and cross-platform remake of a cult game System Shock + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +LIB_DEPENDS= libfluidsynth.so:audio/fluidsynth \ + libasound.so:audio/alsa-lib + +USES= cmake gl sdl pkgconfig +USE_GL= gl glu +USE_SDL= sdl2 mixer2 + +USE_GITHUB= yes +GH_ACCOUNT= Interrupt +GH_PROJECT= systemshock + +CMAKE_ON= ENABLE_SDL2 ENABLE_SOUND ENABLE_FLUIDSYNTH + +post-patch: .SILENT + ${REINPLACE_CMD} -e 's|%%DATADIR%%|${LOCALBASE}/share/shockolate/|' \ + ${WRKSRC}/src/Libraries/RES/Source/caseless.c \ + ${WRKSRC}/src/MacSrc/OpenGL.cc + ${REINPLACE_CMD} -e 's|%%MIDIDIR%%|${LOCALBASE}/share/sounds/sf2/|' \ + ${WRKSRC}/src/MusicSrc/MusicDevice.c + +do-install: + ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/systemshock ${STAGEDIR}${PREFIX}/bin + (cd ${WRKSRC} && ${COPYTREE_SHARE} shaders ${STAGEDIR}${DATADIR}) + ${MKDIR} ${STAGEDIR}${DATADIR}/res + +.include Added: head/games/shockolate/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/distinfo Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,3 @@ +TIMESTAMP = 1591116062 +SHA256 (Interrupt-systemshock-v0.8.2-43-ga9eb1b93_GH0.tar.gz) = f7c9e9e4a87346ef70e928a965449c7f8e81f0ad47af168d6135fc6cd1bcea1e +SIZE (Interrupt-systemshock-v0.8.2-43-ga9eb1b93_GH0.tar.gz) = 12381862 Added: head/games/shockolate/files/patch-src_GameSrc_setup.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/files/patch-src_GameSrc_setup.c Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,52 @@ +--- src/GameSrc/setup.c.orig 2020-04-23 04:29:54 UTC ++++ src/GameSrc/setup.c +@@ -25,6 +25,7 @@ along with this program. If not, see + #include + + // TODO: extract this into a compatibility header +@@ -36,6 +37,10 @@ along with this program. If not, see + #endif + ++#ifndef PATH_MAX ++#define PATH_MAX 4096 ++#endif ++ + #include "archiveformat.h" + #include "ShockDialogs.h" + #include "setup.h" +@@ -1305,8 +1310,21 @@ uchar intro_key_handler(uiEvent *ev, LGRegion *r, intp + return (main_kb_callback(ev, r, user_data)); + } + ++static int file_exists_in_homedir_p (const char *filename) ++{ ++ char *home = getenv ("HOME"); ++ char path[PATH_MAX]; ++ int res = 0; + ++ if (home != NULL) { ++ snprintf (path, PATH_MAX, "%s/.sshock/%s", ++ home, filename); ++ res = access (path, F_OK) != -1; ++ } + ++ return res; ++} ++ + errtype load_savegame_names(void) + { + int i; +@@ -1320,7 +1338,7 @@ errtype load_savegame_names(void) + { + Poke_SaveName(i); + +- if (access(save_game_name, F_OK) != -1) ++ if (file_exists_in_homedir_p (save_game_name)) + { + file = ResOpenFile(save_game_name); + if (ResInUse(OLD_SAVE_GAME_ID_BASE)) Added: head/games/shockolate/files/patch-src_Libraries_RES_Source_caseless.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/files/patch-src_Libraries_RES_Source_caseless.c Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,49 @@ +--- src/Libraries/RES/Source/caseless.c.orig 2020-04-23 04:29:54 UTC ++++ src/Libraries/RES/Source/caseless.c +@@ -20,6 +20,7 @@ along with this program. If not, see ++#include + #include + #include + #include +@@ -241,18 +242,35 @@ int caselesspath(const char *inpath, char *outpath, in + + FILE *fopen_caseless(const char *path, const char *mode) { + FILE *ret = NULL; ++ char fullpath[PATH_MAX]; ++ char *home = getenv("HOME"); + + if (path == NULL || mode == NULL) + return NULL; + +- ret = fopen(path, mode); ++ if (strcmp (path, "CurrentGame.dat") == 0 || ++ strncmp (path, "savgam", strlen ("savgam")) == 0) { ++ if (home == NULL) ++ return NULL; + ++ snprintf (fullpath, PATH_MAX, "%s/.sshock/", home); ++ if (strstr (mode, "w") != NULL) { ++ /* Ensure the local directory exists */ ++ mkdir (fullpath, 0755); ++ } ++ ++ strlcat (fullpath, path, PATH_MAX); ++ } else { ++ snprintf (fullpath, PATH_MAX, "%%DATADIR%%%s", path); ++ } ++ ++ ret = fopen(fullpath, mode); + #ifndef _WIN32 // not windows + if (ret == NULL) { + char fixedpath[PATH_MAX]; +- size_t pathlen = strlen(path); ++ size_t pathlen = strlen(fullpath); + +- if (pathlen < sizeof(fixedpath) && caselesspath(path, fixedpath, 0)) { ++ if (pathlen < sizeof(fixedpath) && caselesspath(fullpath, fixedpath, 0)) { + ret = fopen(fixedpath, mode); + } + } Added: head/games/shockolate/files/patch-src_MacSrc_OpenGL.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/files/patch-src_MacSrc_OpenGL.cc Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,11 @@ +--- src/MacSrc/OpenGL.cc.orig 2020-04-23 04:29:54 UTC ++++ src/MacSrc/OpenGL.cc +@@ -195,7 +195,7 @@ static GLuint loadShader(GLenum type, const char *file + DEBUG("Loading shader %s", filename); + + char fb[256]; +- sprintf(fb, "shaders/%s", filename); ++ sprintf(fb, "%%DATADIR%%shaders/%s", filename); + + FILE* file = fopen(fb, "r"); + if(file == nullptr) { Added: head/games/shockolate/files/patch-src_MusicSrc_MusicDevice.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/files/patch-src_MusicSrc_MusicDevice.c Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,91 @@ +--- src/MusicSrc/MusicDevice.c.orig 2020-04-23 04:29:54 UTC ++++ src/MusicSrc/MusicDevice.c +@@ -1023,9 +1023,10 @@ static int FluidMidiInit(MusicDevice *dev, const unsig + fluid_settings_t *settings; + fluid_synth_t *synth; + int sfid; +- char fileName[1024] = "res/"; ++ char fileName[1024] = "%%MIDIDIR%%"; ++ size_t dirlen = strlen (fileName); + +- FluidMidiGetOutputName(dev, outputIndex, &fileName[4], 1020); ++ FluidMidiGetOutputName(dev, outputIndex, &fileName[dirlen], 1024 - dirlen); + if (strlen(fileName) == 4) + { + WARN("Failed to locate SoundFont for outputIndex=%d", outputIndex); +@@ -1184,19 +1185,20 @@ static unsigned int FluidMidiGetOutputCount(MusicDevic + FindClose(hFind); + } + #else +- DIR *dirp = opendir("res"); ++ DIR *dirp = opendir("%%MIDIDIR%%"); + struct dirent *dp = 0; +- while ((dp = readdir(dirp))) +- { +- char *filename = dp->d_name; +- char namelen = strlen(filename); +- if (namelen < 4) continue; // ".sf2" +- if (strcasecmp(".sf2", (char*)(filename + (namelen - 4)))) continue; +- // found one +- // INFO("Counting SoundFont file: %s", filename); +- ++outputCount; ++ if (dirp != NULL) { ++ while ((dp = readdir(dirp))) { ++ char *filename = dp->d_name; ++ char namelen = strlen(filename); ++ if (namelen < 4) continue; // ".sf2" ++ if (strcasecmp(".sf2", (char*)(filename + (namelen - 4)))) continue; ++ // found one ++ // INFO("Counting SoundFont file: %s", filename); ++ ++outputCount; ++ } ++ closedir(dirp); + } +- closedir(dirp); + #endif + + // suppress compiler warnings +@@ -1237,24 +1239,26 @@ static void FluidMidiGetOutputName(MusicDevice *dev, c + unsigned int outputCount = 0; // subtract 1 to get index + // count .sf2 files in res/ subdirectory until we find the one that the user + // probably wants +- DIR *dirp = opendir("res"); +- struct dirent *dp = 0; +- while ((outputCount <= outputIndex) && +- (dp = readdir(dirp))) +- { +- char *filename = dp->d_name; +- char namelen = strlen(filename); +- if (namelen < 4) continue; // ".sf2" +- if (strcasecmp(".sf2", (char*)(filename + (namelen - 4)))) continue; +- // found one +- // INFO("Counting SoundFont file: %s", filename); +- ++outputCount; +- if (outputCount - 1 != outputIndex) continue; +- // found it +- strncpy(buffer, filename, bufferSize - 1); +- // INFO("Found SoundFont file for outputIndex=%d: %s", outputIndex, filename); ++ DIR *dirp = opendir("%%MIDIDIR%%"); ++ ++ if (dirp != NULL) { ++ struct dirent *dp = 0; ++ while ((outputCount <= outputIndex) && ++ (dp = readdir(dirp))) { ++ char *filename = dp->d_name; ++ char namelen = strlen(filename); ++ if (namelen < 4) continue; // ".sf2" ++ if (strcasecmp(".sf2", (char*)(filename + (namelen - 4)))) continue; ++ // found one ++ // INFO("Counting SoundFont file: %s", filename); ++ ++outputCount; ++ if (outputCount - 1 != outputIndex) continue; ++ // found it ++ strncpy(buffer, filename, bufferSize - 1); ++ // INFO("Found SoundFont file for outputIndex=%d: %s", outputIndex, filename); ++ } ++ closedir(dirp); + } +- closedir(dirp); + #endif + // put NULL in last position in case we filled up everything else + *(buffer + bufferSize - 1) = '\0'; Added: head/games/shockolate/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/pkg-descr Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,6 @@ +Shockolate is an opensource remake of System Shock, a 1994 FPS game in +cyberpunk setting. + +You will need original System Shock data files to run the game. + +WWW: https://github.com/Interrupt/systemshock Added: head/games/shockolate/pkg-message ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/pkg-message Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,13 @@ +[ +{ type: install + message: << EOM +To run the game, copy the game's datafiles (data and sound +directories) into %%PREFIX%%/shared/shockolate/res, then run + +$ systemshock + +If you want to play MIDI soundtracks with fluidsynth, you need to +manually install audio/fluid-soundfont port. +EOM +} +] Added: head/games/shockolate/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/games/shockolate/pkg-plist Sun Jun 28 14:23:58 2020 (r540723) @@ -0,0 +1,6 @@ +bin/systemshock +%%DATADIR%%/shaders/color.frag +%%DATADIR%%/shaders/main.vert +%%DATADIR%%/shaders/star.frag +%%DATADIR%%/shaders/texture.frag +@dir %%DATADIR%%/res