Index: head/games/openbor/Makefile =================================================================== --- head/games/openbor/Makefile (revision 431546) +++ head/games/openbor/Makefile (revision 431547) @@ -1,116 +1,117 @@ # $FreeBSD$ PORTNAME= openbor PORTVERSION= 3.0.r4426 +PORTREVISION= 1 CATEGORIES= games MASTER_SITES= LOCAL/jbeich \ https://svn.code.sf.net/p/${PORTNAME}/engine/engine/:svn MAINTAINER= jbeich@FreeBSD.org COMMENT= Moddable fighting game engine (aka Beats of Rage) LICENSE= BSD3CLAUSE GPLv2+ ISCL LICENSE_COMB= multi LICENSE_FILE_BSD3CLAUSE=${WRKSRC}/LICENSE LICENSE_FILE_GPLv2+ = ${_LICENSE_STORE}/GPLv2 # source/gfxlib/hq2x.c LICENSE_FILE_ISCL= ${WRKSRC}/source/webmlib/nestegg/LICENSE LIB_DEPENDS= libpng.so:graphics/png \ libvpx.so:multimedia/libvpx USES= gmake pkgconfig tar:xz USE_SDL= gfx2 MAKE_ENV= BUILD_LINUX=1 SDKPATH="${LOCALBASE}" \ GCC_TARGET="${CONFIGURE_TARGET:S/amd64/x86_64/}" MAKE_ARGS= CC="${CC}" LIBRARIES="${LOCALBASE}/lib" \ TARGET_ARCH=${ARCH:S/i386/x86/} ARCHFLAGS="" \ - TARGET_FINAL='${TARGET}' BUILD_MMX="" + TARGET_FINAL='${TARGET}' BUILD_MMX="" ECHO="${ECHO}" CFLAGS+= -fgnu89-inline ${CFLAGS_${OPSYS}} CFLAGS_DragonFly= -D_GCC_MAX_ALIGN_T # system stddef.h LDFLAGS+= -Wl,--as-needed # ogg, pthread, zlib PLIST_FILES= bin/${PORTNAME} \ share/pixmaps/${PORTNAME}.png PORTDOCS= README DESKTOP_ENTRIES="OpenBOR" \ "" \ "${PORTNAME}" \ "${PORTNAME}" \ "Game;ArcadeGame;" \ "" OPTIONS_DEFINE= TREMOR OPTIONS_DEFAULT= ${MACHINE_CPU:Msoftfp:C/.+/TREMOR/} OPTIONS_DEFINE_i386= MMX OPTIONS_DEFAULT_i386= MMX # runtime detection MMX_BUILD_DEPENDS= yasm:devel/yasm MMX_MAKE_ARGS= BUILD_MMX=1 TREMOR_LIB_DEPENDS= libvorbisidec.so:audio/libtremor TREMOR_MAKE_ARGS= BUILD_TREMOR=1 BUILD_VORBIS="" TREMOR_LIB_DEPENDS_OFF= libvorbisfile.so:audio/libvorbis # # To update snapshot: make makesum BOOTSTRAP= # Specific snapshot: make makesum SVN_FETCH= PORTVERSION=1.0.r1234 # .if defined(BOOTSTRAP) # XXX SED and _MASTER_SITES_svn aren't defined yet SED?= /usr/bin/sed SVN_REV!= ${SETENV} LC_ALL=C svn info \ ${MASTER_SITES:M*\:svn:S/:svn//} | \ ${SED} -n 's/^Last Changed Rev: //p' PORTVERSION:= ${PORTVERSION:R}.r${SVN_REV} .else SVN_REV?= ${PORTVERSION:E:S/r//} .endif .if defined(BOOTSTRAP) || defined(SVN_FETCH) FETCH_DEPENDS+= svn:devel/subversion NO_CHECKSUM= yes do-fetch: ${MKDIR} ${WRKDIR} svn export -r${SVN_REV} ${_MASTER_SITES_svn} ${WRKSRC} (cd ${WRKDIR} && ${TAR} cJvf \ ${_DISTDIR}/${DISTNAME}${EXTRACT_SUFX} \ --uid 0 --gid 0 ${DISTNAME}) . ifmake makesum ${REINPLACE_CMD} -i '' '/^PORTVERSION=/s/r.*/r${SVN_REV}/' \ ${MASTERDIR}/Makefile . endif . if ${USER} == ${MAINTAINER:C/@.*//} -scp ${_DISTDIR}/${DISTNAME}${EXTRACT_SUFX} \ freefall.freebsd.org:public_distfiles/ . endif .endif post-patch: @${REINPLACE_CMD} -e 's/ -O[0-9]//; s/ -g//; s/ -Werror//' \ -e 's/ -fomit-frame-pointer//' \ -e 's/ -freorder-blocks//' \ - -e 's/ -Wno-unused-result//' \ -e 's/ -Wl,-rpath,$$(LIBRARIES)//' \ -e '/echo/!s/ @/ /' \ + -e 's/@echo/@$$(ECHO)/' \ -e 's/$$(LIBS)/$$(LDFLAGS) &/' \ ${WRKSRC}/Makefile @${GREP} -Flr 'malloc.h' ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} \ 's,malloc\.h,stdlib.h,' @${REINPLACE_CMD} -e 's/^function \(.*\) {/\1() {/' \ -e 's/^get_revnum$$/VERSION_BUILD=${SVN_REV}/' \ ${WRKSRC}/version.sh do-configure: (cd ${WRKSRC} && ${SH} ./version.sh) do-install: ${INSTALL_PROGRAM} ${WRKSRC}/OpenBOR.elf \ ${STAGEDIR}${PREFIX}/bin/${PORTNAME} ${INSTALL_DATA} ${WRKSRC}/resources/OpenBOR_Icon_128x128.png \ ${STAGEDIR}${PREFIX}/share/pixmaps/${PORTNAME}.png (cd ${WRKSRC} && ${COPYTREE_SHARE} \ "${PORTDOCS}" ${STAGEDIR}${DOCSDIR}) .include Index: head/games/openbor/files/patch-openbor.c =================================================================== --- head/games/openbor/files/patch-openbor.c (revision 431546) +++ head/games/openbor/files/patch-openbor.c (revision 431547) @@ -1,61 +1,93 @@ Fix potential crashes found by ASan/Clang/GCC +Fix an infinite loop in lcmScriptDeleteMain() +Avoid accidental rounding from abs() --- openbor.c.orig 2016-12-22 13:02:02 UTC +++ openbor.c @@ -5810,7 +5810,7 @@ s_collision_attack **collision_alloc_att size_t alloc_size; // Get amount of memory we'll need. - alloc_size = sizeof(*result); + alloc_size = max_collisons * sizeof(*result); // Allocate memory and get pointer. result = malloc(alloc_size); @@ -5859,7 +5859,7 @@ s_collision_body **collision_alloc_body_ size_t alloc_size; // Get amount of memory we'll need. - alloc_size = sizeof(*result); + alloc_size = max_collisons * sizeof(*result); // Allocate memory and get pointer. result = malloc(alloc_size); +@@ -8204,7 +8204,8 @@ size_t lcmScriptCopyBuffer(ArgList *argl + + size_t lcmScriptDeleteMain(char **buf) + { +- size_t len = 0, i = 0; ++ size_t len = 0; ++ int i = 0; + ptrdiff_t pos = 0; + char *newbuf = NULL; + @@ -13933,7 +13933,7 @@ void generate_basemap(int map_index, flo void load_level(char *filename) { - char *buf; + char *buf = NULL; size_t size, len, sblen; ptrdiff_t pos, oldpos; char *command; @@ -15210,6 +15210,11 @@ void bar(int x, int y, int value, int ma return; } + if (value < 0) + { + value = 0; + } + if (value > maxvalue) { value = maxvalue; @@ -20471,7 +20476,7 @@ void common_dot() entity *eOpp; //Owner of dot effect. s_collision_attack attack; //Attack struct. - for(iIndex = 0; iIndex <= MAX_DOTS; iIndex++) //Loop through all DOT indexes. + for(iIndex = 0; iIndex < MAX_DOTS; iIndex++) //Loop through all DOT indexes. { iDot_time = self->dot_time[iIndex]; //Get expire time. iDot_cnt = self->dot_cnt[iIndex]; //Get next tick time. +@@ -21710,8 +21716,8 @@ int reset_backpain(entity *ent) + if (ent->normaldamageflipdir == DIRECTION_RIGHT) ent->direction = DIRECTION_RIGHT; + else ent->direction = DIRECTION_LEFT; + +- if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*abs(ent->velocity.x); +- else ent->velocity.x = abs(ent->velocity.x); ++ if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*ABS(ent->velocity.x); ++ else ent->velocity.x = ABS(ent->velocity.x); + + return 1; + } +@@ -25831,7 +25837,7 @@ int common_try_wander(entity *target, in + mod = -mod; + } + //if ((self->sortid / 100) % 2) +- if (abs(rand32()) % 2) ++ if (rand32() % 2) + { + mod = 3 - mod; + } @@ -34607,7 +34612,7 @@ void keyboard_setup(int player) strncpy(buttonnames[SDID_SPECIAL], "Special", 16); strncpy(buttonnames[SDID_START], "Start", 16); strncpy(buttonnames[SDID_SCREENSHOT], "Screenshot", 16); - strncpy(buttonnames[SDID_ESC], "Exit", 16); + //strncpy(buttonnames[SDID_ESC], "Exit", 16); savesettings(); bothnewkeys = 0; Index: head/games/openbor/files/patch-source_gamelib_packfile.c =================================================================== --- head/games/openbor/files/patch-source_gamelib_packfile.c (nonexistent) +++ head/games/openbor/files/patch-source_gamelib_packfile.c (revision 431547) @@ -0,0 +1,13 @@ +Reset seek position for BGM with more than 64 tracks + +--- source/gamelib/packfile.c.orig 2015-04-18 21:22:03 UTC ++++ source/gamelib/packfile.c +@@ -1399,7 +1399,7 @@ void packfile_music_read(fileliststruct + getBasePath(packfile, filelist[i].filename, 1); + if(stristr(packfile, ".pak")) + { +- memset(filelist[i].bgmTracks, 0, 256); ++ memset(filelist[i].bgmTracks, 0, sizeof(filelist[i].bgmTracks)); + filelist[i].nTracks = 0; + fd = fopen(packfile, "rb"); + if(fd == NULL) Property changes on: head/games/openbor/files/patch-source_gamelib_packfile.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/games/openbor/files/patch-source_scriptlib_Parser.c =================================================================== --- head/games/openbor/files/patch-source_scriptlib_Parser.c (nonexistent) +++ head/games/openbor/files/patch-source_scriptlib_Parser.c (revision 431547) @@ -0,0 +1,13 @@ +Make room for terminating NUL added by sprintf() + +--- source/scriptlib/Parser.c.orig 2016-12-15 02:16:03 UTC ++++ source/scriptlib/Parser.c +@@ -1828,7 +1828,7 @@ void Parser_Mult_expr2(Parser *pparser ) + + void Parser_Unary_expr(Parser *pparser ) + { +- static CHAR buf[MAX_TOKEN_LENGTH + 1]; ++ static CHAR buf[MAX_TOKEN_LENGTH + 2]; + Instruction *pInstruction = NULL; + + if (ParserSet_First(&(pparser->theParserSet), postfix_expr, pparser->theNextToken.theType )) Property changes on: head/games/openbor/files/patch-source_scriptlib_Parser.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property