debian/0000755000000000000000000000000012132052171007160 5ustar debian/biniax2.install0000644000000000000000000000013412127470047012114 0ustar biniax2 usr/games/ debian/*.desktop usr/share/applications/ debian/*.xpm usr/share/pixmaps/ debian/changelog0000644000000000000000000000540512132051614011037 0ustar biniax2 (1.30-2) unstable; urgency=low * Team upload. [ Miriam Ruiz ] * Fix biniax2.6 man page and specify the correct config file location. (Closes: #616047) [ Markus Koschany ] * Switch to package format 3.0 (quilt). * Bump compat level to 9 and require debhelper >=9 for automatic hardening build flags. * debian/control: - Remove quilt dependency because package format 3.0 uses quilt by default. - Bump Standards-Version to 3.9.4, no changes required. - Use canonical Vcs-URI. - Fix spelling in biniax2 package description. (Closes: #659609). Thanks Maarten Bezemer for the report and patch. - binax2-data: + Lower recommendation for biniax2 to Suggests. Most people who install biniax2-data directly are only interested in the data files. + Update package description and be more verbose. * biniax2.desktop: remove unnecessary equals sign from short description. (Closes: #611029) Thanks Robert Roth for the report and patch. * biniax2.menu: Add longtitle. * Remove empty docs file. * Fix spelling in README.Debian. * Delete README.source. Quilt is the default patch system used by package format 3.0. * Update debian/copyright to copyright format 1.0. Remove CC-BY-3.0 license because all the game data files are licensed under the ZLib license, too. See License.txt for more information. * Add hardening-support.patch which provides Debian's hardening build flags via dpkg-buildflags. * Simplify debian/rules by using dh sequencer. * Build with hardening=+all. * Use high resolution icon logo.png for biniax2.desktop file instead of biniax2.xpm. * Improve userdir.patch. Create an initial config file if necessary. Remove all PATH_MAX declarations and replace them with a fixed value of 1024 bytes. This ensures that biniax2 can be built on GNU/Hurd too. * Drop fixes.patch. It was not applied anyway. * Install biniax2.6 with manpages file. -- Markus Koschany Fri, 12 Apr 2013 20:33:40 +0200 biniax2 (1.30-1) unstable; urgency=low [ Miriam Ruiz ] * Fixed patch fixes.patch to save hall of fame in biniax2/hof instead of biniax2/config [ Paul Wise ] * New upstream release * Add a watch file - PLEASE NOTE UPSTREAM 1.20 == 0.0.20080409 [ Barry deFreese ] * Add myself to uploaders. * Add README.source for quilt patch system. * Fix spelling error in README.Debian. * Fix syntax in debian/copyright to make lintian happy. * Bump Standards Version to 3.8.3. (No changes needed). -- Barry deFreese Sun, 27 Sep 2009 10:45:47 -0400 biniax2 (0.0.20080409-1) unstable; urgency=low [ Miriam Ruiz ] * Initial release (Closes: #476247) -- Miriam Ruiz Thu, 10 Apr 2008 11:12:15 +0000 debian/manpages0000644000000000000000000000002112127470047010701 0ustar debian/biniax2.6 debian/biniax2.xpm0000644000000000000000000000241412127470047011255 0ustar /* XPM */ static char * icon_xpm[] = { "32 32 6 1", " c None", ". c #800000", "+ c #FF8204", "@ c #FC4E04", "# c #FCA204", "$ c #FEC489", " ", " ", " ", " . ", " ++++++++++ .@. ", " +########$ .@@@$ ", " +#$$$$$$$$ $@$ ", " +#$ $ ", " +#$ ", " +#$ ", " +#$ ++++ +++ +++ ", " +#$ +#### +#$ +#$ ", " +#$ +####+ +#$ +#$ ", " +#$ +#$#### +#$ +#$ ", " +#$ +#$ $##+ +#$ +#$ ", " +#$ +#$ #### +#$ +#$ ", " +#$ +#$ $##+ +#$ +#$ ", " +#$ +#$ #### +#$ +#$ ", " +#$ +#$ $##+ +#$ +#$ ", " +#$ +#$ ######$ +#$ ", " +#$ +#$ $####$ +#$ ", " +#$ +#$ ####$ +#$ ", " $$$ $$$ $$$$ +#$ ", " +#$ ", " +#$ ", " . +#$ ", " .@. ++++++++#$ ", " .@@@$ +########$ ", " $@$ $$$$$$$$$$ ", " $ ", " ", " "}; debian/rules0000755000000000000000000000041512127500720010242 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ override_dh_install: find $(CURDIR)/data -name Thumbs.db -exec rm {} \; for i in `find $(CURDIR)/data`; do if [ -f $$i ]; then \ chmod -x $$i; fi; done dh_install debian/watch0000644000000000000000000000013112127470047010216 0ustar version=3 http://mordred.dir.bg/biniax/download2.html biniax2-([\d\.]+)-fullsrc\.tar\.gz debian/compat0000644000000000000000000000000212127470047010370 0ustar 9 debian/biniax2.60000644000000000000000000000252412127473640010622 0ustar .TH "Biniax2" "6" "April 5 , 2013" "" "" .SH "NAME" Biniax2 \- Logic game with arcade and tactics modes .SH "SYNOPSIS" .B biniax2 .SH "DESCRIPTION" \fBBiniax 2\fP is an original and entertaining game. It takes a minute to learn and gives you hours and hours of gameplay. There are three game modes (two singleplayer and one multiplayer), hall of fame, dynamic music and a nice cartoon look. Playing the game is really simple: you move a single tile around a field of pairs of tiles. You can remove a pair from the game board if one of the tiles is similar to your own. When you do that, your tile changes into the other tile that was part of the pair you just removed. You have to do this quickly, otherwise the pairs will pile on top of you and take you to the Game Over screen. .SH "CONFIGURATION" User Configuration File: (by default, ~/.config/biniax2/config), 1=on, 0=off .br .TP User Configuration Example: SOUND=1 .br MUSIC=1 .br FULLSCREEN=0 .br .SH "SEE ALSO" Homepage of the game: http://biniax.com .br .SH "AUTHOR" Biniax 2 was written by Jordan Tuzsuzov . .PP This manual page was written by Miriam Ruiz for the Debian project (but may be used by others). Permission is granted to copy, distribute, made available for copying through any means and/or modify this document under the terms of the ZLIB License. debian/biniax2.menu0000644000000000000000000000033612127470047011416 0ustar ?package(biniax2):needs="X11" \ section="Games/Puzzles" \ title="Biniax 2" \ longtitle="Biniax 2 - logic game with arcade and tactics modes" \ command="/usr/games/biniax2" \ icon="/usr/share/pixmaps/biniax2.xpm" debian/biniax2.desktop0000644000000000000000000000046012127476634012131 0ustar [Desktop Entry] Type=Application Version=1.0 Name=Biniax-2 Comment=Colorful Logic game with arcade and tactics modes Comment[de]=Farbenfrohes Logikspiel mit Arkade- und Taktikmodus Icon=/usr/share/games/biniax2/graphics/logo.png Exec=biniax2 Terminal=false StartupNotify=false Categories=Game;LogicGame; debian/control0000644000000000000000000000255512127470047010604 0ustar Source: biniax2 Section: games Priority: extra Maintainer: Debian Games Team Uploaders: Miriam Ruiz , Barry deFreese Build-Depends: debhelper (>= 9), libsdl-image1.2-dev, libsdl-mixer1.2-dev, libsdl1.2-dev Standards-Version: 3.9.4 Homepage: http://biniax.com/index2.html Vcs-Svn: svn://anonscm.debian.org/pkg-games/packages/trunk/biniax2/ Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-games/packages/trunk/biniax2/ Package: biniax2 Architecture: any Depends: biniax2-data (= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} Description: logic game with arcade and tactics modes Biniax-2 is an original and entertaining game. It only takes a minute to learn and gives you hours and hours of gameplay. There are three game modes (two singleplayer and one multiplayer), hall of fame, dynamic music and a nice cartoon look. Package: biniax2-data Architecture: all Depends: ${misc:Depends} Suggests: biniax2 Description: logic game with arcade and tactics modes -- data Biniax-2 is an original and entertaining game. It only takes a minute to learn and gives you hours and hours of gameplay. There are three game modes (two singleplayer and one multiplayer), hall of fame, dynamic music and a nice cartoon look. . This package contains the game data files for the game Biniax-2. debian/copyright0000644000000000000000000000402712132052041011112 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Biniax-2 Source:http://mordred.dir.bg/biniax/download2.html Files: * Copyright: 2005-2008, Jordan Tuzsuzov License: ZLib Files: SDLinclude/* Copyright: 1997-2006, Sam Lantinga License: LGPL-2.1+ Files: debian/* Copyright: 2008-2009, Miriam Ruiz 2009, Barry deFreese 2009, Paul Wise 2013, Markus Koschany License: ZLib License: ZLib This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. . Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: . 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. License: LGPL-2.1+ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. . This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . On Debian systems, the complete text of the last version of the GNU Lesser General Public License can be found in `/usr/share/common-licenses/LGPL-2.1'. debian/source/0000755000000000000000000000000012127472353010474 5ustar debian/source/format0000644000000000000000000000001412127470047011700 0ustar 3.0 (quilt) debian/README.Debian0000644000000000000000000000142712127472564011245 0ustar Biniax2 for Debian ------------------ The format and location for the user files of the game have been changed. They have been placed according to the XDG Base Directory Specification [1] The format has been changed to make them work in different endianness and word sizes. The original code made a direct memory dump to the hard disk thus there was no guarantee that the files were even loadable when they were compiled with different parameters on the same computer. Upstream has not adopted the patches for this bug correction, so games stored in the Windows version of the game won't be compatible with this version. They weren't previously compatible anyway. [1] http://standards.freedesktop.org/basedir-spec/ -- Miriam Ruiz Thu, 10 Apr 2008 11:12:15 +0000 debian/biniax2-data.install0000644000000000000000000000004012127470047013017 0ustar data/* usr/share/games/biniax2/ debian/patches/0000755000000000000000000000000012132052164010611 5ustar debian/patches/hardening-support.patch0000644000000000000000000000155212127473712015320 0ustar From: Markus Koschany Date: Fri, 5 Apr 2013 00:15:13 +0200 Subject: hardening support --- makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 2bdd4df..e7882ca 100755 --- a/makefile +++ b/makefile @@ -3,11 +3,13 @@ # To build the game you need the development libraries of SDL 1.2, SDL_mixer and SDL_image. # To execute the game you need the runtimes of SDL, SDL_mixer and SDL_image. -FLAGS=-W -WALL +FLAGS+=`dpkg-buildflags --get CFLAGS` +FLAGS+=`dpkg-buildflags --get CPPFLAGS` CC=gcc FILES=biniax.c hof.c desktop/cfg.c desktop/gfx.c desktop/snd.c desktop/inp.c desktop/sys.c INCLUDES=-I . -I desktop LINKTO=-lSDL -lSDL_mixer -lSDL_image +LINKTO+=`dpkg-buildflags --get LDFLAGS` DATADIR=/usr/share/games/biniax2 AUTO=`sdl-config --libs --cflags` -DDATADIR=\"$(DATADIR)\" TARGET=biniax2 debian/patches/userdir.patch0000644000000000000000000004413112127473715013327 0ustar From: Miriam Ruiz Date: Fri, 5 Apr 2013 00:08:18 +0200 Subject: userdir --- biniax.c | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- desktop/cfg.c | 122 +++++++++++++++++++++++------- hof.c | 202 ++++++++++++++++++++++++++++++++++++++++++++++++-- inc.h | 4 + 4 files changed, 520 insertions(+), 36 deletions(-) diff --git a/biniax.c b/biniax.c index 886b692..5cc5765 100755 --- a/biniax.c +++ b/biniax.c @@ -51,6 +51,22 @@ INCLUDES #include "lev.h" #include "inc.h" +#ifndef _WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include +#include + /* Global instance of GAME structure */ BNX_GAME Game; @@ -82,6 +98,9 @@ BNX_BOOL saveGame( BNX_GAME *game ); BNX_BOOL loadGame( BNX_GAME *game ); BNX_BOOL loadHiScore( BNX_GAME *game ); +BNX_BOOL saveOldDebianGame( BNX_GAME *game ); +BNX_BOOL loadOldDebianGame( BNX_GAME *game ); + #define UNREF( A ) (A) = (A) /****************************************************************************** PROGRAM START @@ -100,13 +119,27 @@ int main( int argc, char *argv[] ) cfgInit(); hofInit(); if ( gfxInit() == BNX_FALSE ) + { + fprintf(stderr, "Error in Graphics Initialization\n"); return -1; + } if ( sysInit() == BNX_FALSE ) + { + fprintf(stderr, "Error in System Initialization\n"); return -2; + } if ( inpInit() == BNX_FALSE ) + { + fprintf(stderr, "Error in Input Initialization\n"); return -3; + } if ( sndInit() == BNX_FALSE ) - return -4; + { + fprintf(stderr, "Error in Sound Initialization\n"); + cfgSetSound(BNX_FALSE); + cfgSetMusic(BNX_FALSE); + /* return -4; */ + } /****************************************************************** SHOW INITIAL WELCOME SCREEN @@ -131,6 +164,10 @@ int main( int argc, char *argv[] ) case cOptionContinue: if ( loadGame( &Game ) == BNX_FALSE ) { + if (errno) + fprintf(stderr, "Error loading game data: %s\n", strerror(errno)); + else + fprintf(stderr, "Error loading game data\n"); enterState = cStateMainMenu; } else @@ -1178,13 +1215,70 @@ void showHelp( BNX_GAME *game ) GAME AND HISCORE SAVE / RESTORE ******************************************************************************/ +static const char *saveFileName() +{ +#ifndef _WIN32 + char filename[1024]; + char *home; + struct passwd *passwd; + if (!getuid()) + { + fprintf(stderr, "No access to data files for root.\n"); + return BNX_FALSE; + } else { + if ((home = getenv("XDG_DATA_HOME"))) + { /* See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html */ + if (strlen(home) > 1024 - sizeof("/biniax2/hof")) + { + fprintf(stderr, "$XDG_DATA_HOME is excessively long.n"); + return BNX_FALSE; + } + snprintf(filename, sizeof(filename), "%s/biniax2", home); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } + else if ((home = getenv("HOME"))) + { + passwd = getpwuid (getuid()); + home=passwd->pw_dir; + if (!home) + { + fprintf(stderr, "$HOME is not defined.\n"); + return BNX_FALSE; + } + if (strlen(home) > 1024 - sizeof("/.local/share/biniax2/autosave")) + { + fprintf(stderr, "$HOME is excessively long.n"); + return BNX_FALSE; + } + snprintf(filename, sizeof(filename), "%s/.local", home); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + strncat(filename, "/share", sizeof(filename)-1); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + strncat(filename, "/biniax2", sizeof(filename)-1); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } + else + { + fprintf(stderr, "Neither $XDG_DATA_HOME nor $HOME are defined.\n"); + return BNX_FALSE; + } + } + strncat(filename, "/autosave", sizeof(filename)-1); + return filename; +#else + return "./autosave.bnx2"; +#endif +} + BNX_BOOL saveGame( BNX_GAME *game ) { FILE *file; BNX_INT32 i; BNX_INT32 j; - file = fopen( sysGetFullFileName( csSaveGameName ), "wb" ); + fprintf(stderr, "Saving game data in \"%s\"\n", saveFileName()); + + file = fopen( saveFileName(), "wb" ); if ( file == (FILE *) NULL ) return BNX_FALSE; @@ -1242,9 +1336,14 @@ BNX_BOOL loadGame( BNX_GAME *game ) BNX_INT32 i; BNX_INT32 j; - if ( sysGetFileLen( sysGetFullFileName( csSaveGameName ) ) != cSaveFileSize ) + if (loadOldDebianGame(game) == BNX_TRUE) + return BNX_TRUE; + + fprintf(stderr, "Loading game data from \"%s\"\n", saveFileName()); + + if ( sysGetFileLen( saveFileName() ) != cSaveFileSize ) return BNX_FALSE; - file = fopen( sysGetFullFileName( csSaveGameName ), "rb" ); + file = fopen( saveFileName(), "rb" ); if ( file == (FILE *) NULL ) return BNX_FALSE; @@ -1302,3 +1401,124 @@ BNX_BOOL loadHiScore( BNX_GAME *game ) return BNX_TRUE; } +// DEBIAN SPECIFIC STUFF + +BNX_BOOL saveOldDebianGame( BNX_GAME *game ) +{ + FILE *file; + int i, j; + + fprintf(stderr, "Saving game data with old format in \"%s\"\n", saveFileName()); + file = fopen( saveFileName(), "wb" ); + if ( file == (FILE *) NULL ) + return BNX_FALSE; + + sysFPut16( 0xB2D1 , file ); + + sysFPut32( game->moment , file ); + sysFPut16( game->mode , file ); + sysFPut16( game->scroll , file ); + sysFPut16( game->speed , file ); + sysFPut16( game->moves , file ); + sysFPut16( game->clears , file ); + fputc( game->ingame , file ); + sysFPut32( game->sounds , file ); + fputc( game->message , file ); + sysFPut32( game->lines , file ); + sysFPut16( game->level , file ); + sysFPut16( game->level_count , file ); + + sysFPut16( cMaxPlayers , file ); + + for (i = 0; i < cMaxPlayers; i++) + { + fputc( game->player[i].x , file ); + fputc( game->player[i].y , file ); + fputc( game->player[i].e , file ); + sysFPut32( game->score[i] , file ); + sysFPut32( game->wins[i] , file ); + sysFPut32( game->best[i] , file ); + } + + sysFPut32( cGridX , file ); + sysFPut32( cGridY , file ); + + for (j = 0; j < cGridY; j++) + for (i = 0; i < cGridX; i++) + fputc( game->grid[i][j] , file ); + + sysFPut16( 0xB2D0 , file ); + + fclose( file ); + return BNX_TRUE; +} + +BNX_BOOL loadOldDebianGame( BNX_GAME *game ) +{ + FILE *file = NULL; + int i, j; + uint16_t id, mp; + uint32_t mx, my; + + file = fopen( saveFileName(), "rb" ); + if ( file == (FILE *) NULL ) + return BNX_FALSE; + + errno = 0; + + id = sysFGet16(file); + if (id != 0xB2D1) + goto error; + + fprintf(stderr, "Loading game data with old format from \"%s\"\n", saveFileName()); + + game->moment = sysFGet32(file); + game->mode = sysFGet16(file); + game->scroll = sysFGet16(file); + game->speed = sysFGet16(file); + game->moves = sysFGet16(file); + game->clears = sysFGet16(file); + game->ingame = fgetc(file); + game->sounds = sysFGet32(file); + game->message = fgetc(file); + game->lines = sysFGet32(file); + game->level = sysFGet16(file); + game->level_count = sysFGet16(file); + + mp = sysFGet16(file); + if (mp != cMaxPlayers) + goto error; + + for (i = 0; i < cMaxPlayers; i++) + { + game->player[i].x = fgetc(file); + game->player[i].y = fgetc(file); + game->player[i].e = fgetc(file); + game->score[i] = sysFGet32(file); + game->wins[i] = sysFGet32(file); + game->best[i] = sysFGet32(file); + } + + mx = sysFGet32(file); + if (mx != cGridX) + goto error; + my = sysFGet32(file); + if (my != cGridY) + goto error; + + for (j = 0; j < cGridY; j++) + for (i = 0; i < cGridX; i++) + game->grid[i][j] = fgetc(file); + + id = sysFGet16(file); + if (id != 0xB2D0) + goto error; + + fclose( file ); + return BNX_TRUE; + +error: + if (file) + fclose( file ); + return BNX_FALSE; +} diff --git a/desktop/cfg.c b/desktop/cfg.c index 5c2773a..b735566 100755 --- a/desktop/cfg.c +++ b/desktop/cfg.c @@ -30,6 +30,17 @@ INCLUDES #include "inc.h" +#ifndef _WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif /****************************************************************************** FUNCTIONS @@ -54,38 +65,99 @@ BNX_BOOL cfgInit() char buffer[ _Cfg_Buffer ]; int nTemp; +#ifndef _WIN32 + char filename[1024]; + char *home; + struct passwd *passwd; + if (!getuid()) + { + fprintf(stderr, "No access to config files for root.\n"); + return BNX_FALSE; + } else { + if ((home = getenv("XDG_CONFIG_HOME"))) + { /* See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html */ + if (strlen(home) > 1024 - sizeof("/biniax2/config")) + { + fprintf(stderr, "$XDG_CONFIG_HOME is excessively long.n"); + return BNX_FALSE; + } + snprintf(filename, sizeof(filename), "%s/biniax2", home); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } + else if ((home = getenv("HOME"))) + { + passwd = getpwuid (getuid()); + home=passwd->pw_dir; + if (!home) + { + fprintf(stderr, "$HOME is not defined.\n"); + return BNX_FALSE; + } + if (strlen(home) > 1024 - sizeof("/.config/biniax2/config")) + { + fprintf(stderr, "$HOME is excessively long.n"); + return BNX_FALSE; + } + snprintf(filename, sizeof(filename), "%s/.config", home); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + strncat(filename, "/biniax2", sizeof(filename)-1); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } + else + { + fprintf(stderr, "Neither $XDG_CONFIG_HOME nor $HOME are defined.\n"); + return BNX_FALSE; + } + } + strncat(filename, "/config", sizeof(filename)-1); +#else + char filename[] = "./config.bnx2"; +#endif + _Cfg.sound = BNX_TRUE; _Cfg.music = BNX_TRUE; _Cfg.fullscreen = BNX_FALSE; _Cfg.touch = BNX_FALSE; - f = fopen( sysGetFullFileName( csConfigName ), "rt" ); - if ( f == 0 ) - { - return BNX_FALSE; - } - - fgets( buffer, _Cfg_Buffer, f ); - sscanf( buffer, "SOUND=%d", &nTemp ); - _Cfg.sound = (BNX_BOOL) nTemp; - - fgets( buffer, _Cfg_Buffer, f ); - sscanf( buffer, "MUSIC=%d", &nTemp ); - _Cfg.music = (BNX_BOOL) nTemp; - - fgets( buffer, _Cfg_Buffer, f ); - sscanf( buffer, "FULLSCREEN=%d", &nTemp ); - _Cfg.fullscreen = (BNX_BOOL) nTemp; - - fgets( buffer, _Cfg_Buffer, f ); - sscanf( buffer, "TOUCH=%d", &nTemp ); - _Cfg.touch = (BNX_BOOL) nTemp; - - fclose( f ); - +if( access( filename, F_OK ) != -1 ) { + f = fopen( filename, "r" ); + if ( f == NULL ) + { + fprintf( stderr,"Configuration file \"%s\" not found\n", filename ); + return BNX_FALSE; + } + else { + fgets( buffer, _Cfg_Buffer, f ); + sscanf( buffer, "SOUND=%d", &nTemp ); + _Cfg.sound = (BNX_BOOL) nTemp; + + fgets( buffer, _Cfg_Buffer, f ); + sscanf( buffer, "MUSIC=%d", &nTemp ); + _Cfg.music = (BNX_BOOL) nTemp; + + fgets( buffer, _Cfg_Buffer, f ); + sscanf( buffer, "FULLSCREEN=%d", &nTemp ); + _Cfg.fullscreen = (BNX_BOOL) nTemp; + + fgets( buffer, _Cfg_Buffer, f ); + sscanf( buffer, "TOUCH=%d", &nTemp ); + _Cfg.touch = (BNX_BOOL) nTemp; + fclose( f ); + + fprintf( stderr, _Cfg.sound ? "Sound On\n" : "Sound Off\n" ); + fprintf( stderr, _Cfg.music ? "Music On\n" : "Music Off\n" ); + fprintf( stderr, _Cfg.fullscreen ? "Fullscreen On\n" : "Fullscreen Off\n" ); + return BNX_TRUE; + } +} else { + f = fopen( filename, "w" ); + fputs("SOUND=1\n", f); + fputs("MUSIC=1\n", f); + fputs("FULLSCREEN=0", f); + fclose(f); return BNX_TRUE; } - +} BNX_BOOL cfgGetSound() { return _Cfg.sound; diff --git a/hof.c b/hof.c index 6472e68..d0c6efb 100755 --- a/hof.c +++ b/hof.c @@ -31,6 +31,21 @@ INCLUDES #include "inc.h" +#ifndef _WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include +#include + #define chCursor '_' /* Cursor ON */ #define chSpace ' ' /* Cursor OFF*/ @@ -46,6 +61,8 @@ void hofAddLetter( BNX_INT16 pos, char a, char *name ); void hofBlinkCursor( BNX_INT16 pos, char *name ); void hofResetCursor( BNX_INT16 pos, char *name ); +BNX_BOOL hofOldDebianInit(); +BNX_BOOL hofOldDebianSave(); void hofAddLetter( BNX_INT16 pos, char a, char *name ) { @@ -85,25 +102,81 @@ void hofResetCursor( BNX_INT16 pos, char *name ) } } +static const char *hofFileName() +{ +#ifndef _WIN32 + char filename[1024]; + char *home; + struct passwd *passwd; + if (!getuid()) + { + fprintf(stderr, "No access to data files for root.\n"); + return BNX_FALSE; + } else { + if ((home = getenv("XDG_DATA_HOME"))) + { /* See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html */ + if (strlen(home) > 1024 - sizeof("/biniax2/hof")) + { + fprintf(stderr, "$XDG_DATA_HOME is excessively long.n"); + return BNX_FALSE; + } + snprintf(filename, sizeof(filename), "%s/biniax2", home); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } + else if ((home = getenv("HOME"))) + { + passwd = getpwuid (getuid()); + home=passwd->pw_dir; + if (!home) + { + fprintf(stderr, "$HOME is not defined.\n"); + return BNX_FALSE; + } + if (strlen(home) > 1024 - sizeof("/.local/share/biniax2/hof")) + { + fprintf(stderr, "$HOME is excessively long.n"); + return BNX_FALSE; + } + snprintf(filename, sizeof(filename), "%s/.local", home); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + strncat(filename, "/share", sizeof(filename)-1); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + strncat(filename, "/biniax2", sizeof(filename)-1); + mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } + else + { + fprintf(stderr, "Neither $XDG_DATA_HOME nor $HOME are defined.\n"); + return BNX_FALSE; + } + } + strncat(filename, "/hof", sizeof(filename)-1); + return filename; +#else + return "./hof.bnx2"; +#endif +} BNX_BOOL hofInit() { FILE *file; BNX_INT16 i, j; - + + if (hofOldDebianInit() == BNX_TRUE) + return BNX_TRUE; for ( i = 0; i < cHofEntries; ++i ) { - strcpy( Hof.arcade[ i ].name, "JORDAN " ); + strcpy( Hof.arcade[ i ].name, "DEBIAN " ); Hof.arcade[ i ].score = (cHofEntries - i) * cHofInitScore; - strcpy( Hof.tactic[ i ].name, "JORDAN " ); + strcpy( Hof.tactic[ i ].name, "DEBIAN " ); Hof.tactic[ i ].score = (cHofEntries - i) * cHofInitScore; } - if ( sysGetFileLen( sysGetFullFileName( csHOFName ) ) != cHOFFileSize ) + if ( sysGetFileLen( hofFileName() ) != cHOFFileSize ) return BNX_FALSE; - file = fopen( sysGetFullFileName( csHOFName ), "rb" ); + file = fopen( hofFileName(), "rb" ); if ( file == (FILE *) NULL ) return BNX_FALSE; @@ -137,7 +210,7 @@ BNX_BOOL hofSave() FILE *file; int i, j; - file = fopen( sysGetFullFileName( csHOFName ), "wb" ); + file = fopen( hofFileName(), "wb" ); if ( file == (FILE *) NULL ) return BNX_FALSE; @@ -292,4 +365,119 @@ void hofView() BNX_HALL *hofGet() { return (BNX_HALL *) &Hof; -} \ No newline at end of file +} + +// DEBIAN SPECIFIC + +BNX_BOOL hofOldDebianInit() +{ + FILE *file = NULL; + int i; + uint16_t id, me, ml; + const char *filename = NULL; + char alt_filename[1024+3]; + + file = fopen( (filename = hofFileName()), "rb" ); + + if ( file == (FILE *) NULL ) // Bug in previous version, see if data can be reached + { + char *ptr; + strncpy(alt_filename, filename, 1024); + ptr = strrchr(alt_filename, '/'); + if (ptr != NULL) + { + ptr++; + filename = alt_filename; + strcpy(ptr, "config"); + file = fopen( filename, "rb" ); + } + } + + if ( file == (FILE *) NULL ) + { + goto error; + } + + errno = 0; + + id = sysFGet16(file); + if (id != 0xB2F1) + goto error; + + fprintf(stderr, "Loading Hall of Fame data with old format from \"%s\"\n", filename); + + ml = sysFGet16(file); + if (ml != cHofNameLen) + goto error; + + me = sysFGet16(file); + if (me != cHofEntries) + goto error; + + for ( i = 0; i < cHofEntries; ++i ) + { + fread( Hof.arcade[i].name, 1, cHofNameLen, file ); + Hof.arcade[i].score = sysFGet32(file); + } + + for ( i = 0; i < cHofEntries; ++i ) + { + fread( Hof.tactic[i].name, 1, cHofNameLen, file ); + Hof.tactic[i].score = sysFGet32(file); + } + + id = sysFGet16(file); + if (id != 0xB2F0) + goto error; + + fclose( file ); + + return BNX_TRUE; + +error: + if (file) + fclose( file ); + return BNX_FALSE; +} + +BNX_BOOL hofOldDebianSave() +{ + FILE *file; + int i; + const char *filename = NULL; + + file = fopen( (filename=hofFileName()), "wb" ); + + if ( file == (FILE *) NULL ) + { + if (errno) + fprintf(stderr, "Could not save Hall of Fame data with old format in \"%s\": %s\n", filename, strerror(errno)); + else + fprintf(stderr, "Could not save Hall of Fame data with old format in \"%s\"\n", filename); + return BNX_FALSE; + } + + fprintf(stderr, "Saving Hall of Fame data with old format in \"%s\"\n", filename); + + sysFPut16( 0xB2F1 , file ); + sysFPut16( cHofNameLen , file ); + sysFPut16( cHofEntries , file ); + + for ( i = 0; i < cHofEntries; ++i ) + { + fwrite( Hof.arcade[i].name, 1, cHofNameLen, file ); + sysFPut32(Hof.arcade[i].score, file); + } + + for ( i = 0; i < cHofEntries; ++i ) + { + fwrite( Hof.tactic[i].name, 1, cHofNameLen, file ); + sysFPut32(Hof.tactic[i].score, file); + } + + sysFPut16( 0xB2F0 , file ); + + fclose( file ); + + return BNX_TRUE; +} diff --git a/inc.h b/inc.h index ee3459a..e9c8379 100755 --- a/inc.h +++ b/inc.h @@ -68,5 +68,9 @@ INCLUDES #include "symbian/sys.h" #endif +#ifndef _WIN32 +#include +#include +#endif #endif debian/patches/series0000644000000000000000000000010312127473674012041 0ustar datadir.patch userdir.patch warnings.patch hardening-support.patch debian/patches/warnings.patch0000644000000000000000000001161112127474017013473 0ustar From: Miriam Ruiz Date: Fri, 5 Apr 2013 00:36:51 +0200 Subject: warnings --- biniax.c | 17 ++++++++--------- desktop/gfx.c | 8 ++++---- desktop/inp.c | 2 ++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/biniax.c b/biniax.c index 5cc5765..06f2500 100755 --- a/biniax.c +++ b/biniax.c @@ -111,7 +111,6 @@ int main( int argc, char *argv[] ) BNX_BOOL bquit = BNX_FALSE; BNX_INT16 enterState = cStateMainMenu; BNX_INT16 nmenu = 0; - BNX_INT16 mmenu = 0; UNREF( argc ); UNREF( argv ); @@ -318,7 +317,7 @@ void initPlayer( BNX_GAME *game ) if ( game->grid[ i ][ nearLine ] != 0 ) { game->player[ cPlayer1 ].e = pairLeft( game->grid[ i ][ nearLine ] ); - game->grid[ game->player[ cPlayer1 ].x ][ game->player[ cPlayer1 ].y ] = cPlayerFlag; + game->grid[ (int)game->player[ cPlayer1 ].x ][ (int)game->player[ cPlayer1 ].y ] = cPlayerFlag; break; } } @@ -330,7 +329,7 @@ void initPlayer( BNX_GAME *game ) if ( game->grid[ i ][ nearLine ] != 0 ) { game->player[ cPlayer2 ].e = pairRight( game->grid[ i ][ nearLine ] ); - game->grid[ game->player[ cPlayer2 ].x ][ game->player[ cPlayer2 ].y ] = cPlayerFlag; + game->grid[ (int)game->player[ cPlayer2 ].x ][ (int)game->player[ cPlayer2 ].y ] = cPlayerFlag; break; } } @@ -532,7 +531,7 @@ BNX_BOOL moveUp( BNX_GAME *game, BNX_INT16 pIndex ) { if ( takePair( game, p->x, newY, pIndex ) == BNX_TRUE ) { - game->grid[ p->x ][ p->y ] = 0; + game->grid[ (int)p->x ][ (int)p->y ] = 0; p->y = newY; return BNX_TRUE; } @@ -550,7 +549,7 @@ BNX_BOOL moveDown( BNX_GAME *game, BNX_INT16 pIndex ) { if ( takePair( game, p->x, newY, pIndex ) == BNX_TRUE ) { - game->grid[ p->x ][ p->y ] = 0; + game->grid[ (int)p->x ][ (int)p->y ] = 0; p->y = newY; return BNX_TRUE; } @@ -568,7 +567,7 @@ BNX_BOOL moveLeft( BNX_GAME *game, BNX_INT16 pIndex ) { if ( takePair( game, newX, p->y, pIndex ) == BNX_TRUE ) { - game->grid[ p->x ][ p->y ] = 0; + game->grid[ (int)p->x ][ (int)p->y ] = 0; p->x = newX; return BNX_TRUE; } @@ -586,7 +585,7 @@ BNX_BOOL moveRight( BNX_GAME *game, BNX_INT16 pIndex ) { if ( takePair( game, newX, p->y, pIndex ) == BNX_TRUE ) { - game->grid[ p->x ][ p->y ] = 0; + game->grid[ (int)p->x ][ (int)p->y ] = 0; p->x = newX; return BNX_TRUE; } @@ -644,9 +643,9 @@ BNX_BOOL clearColumn( BNX_GAME *game ) { for ( y = 0; y < cGridY; ++y ) { - if ( game->grid[ game->player[ cPlayer1 ].x ][ y ] != cPlayerFlag ) + if ( game->grid[ (int)game->player[ cPlayer1 ].x ][ y ] != cPlayerFlag ) { - game->grid[ game->player[ cPlayer1 ].x ][ y ] = 0; + game->grid[ (int)game->player[ cPlayer1 ].x ][ y ] = 0; } } } diff --git a/desktop/gfx.c b/desktop/gfx.c index c834026..3e2e206 100755 --- a/desktop/gfx.c +++ b/desktop/gfx.c @@ -194,7 +194,7 @@ void gfxRenderGame( BNX_GAME *game ) pos.y = cGfxZeroY + game->player[ cPlayer1 ].y * cGfxPairPlusY; if ( pos.y <= cGfxZeroY ) { - SDL_BlitSurface( _Gfx.cursors[cursor], NULL, _Gfx.screen, &pos ); + SDL_BlitSurface( _Gfx.cursors[ (int)cursor ], NULL, _Gfx.screen, &pos ); } /* RENDER MAIN (WHITE) PLAYER */ @@ -202,7 +202,7 @@ void gfxRenderGame( BNX_GAME *game ) pos.y = cGfxZeroY + game->player[ cPlayer1 ].y * cGfxPairPlusY; if ( pos.y <= cGfxZeroY ) { - SDL_BlitSurface( _Gfx.elements[game->player[ cPlayer1 ].e], NULL, _Gfx.screen, &pos ); + SDL_BlitSurface( _Gfx.elements[ (int)game->player[ cPlayer1 ].e], NULL, _Gfx.screen, &pos ); if ( game->score[ cPlayer1 ] != prevScore[ cPlayer1 ] ) { gfxNewParticle( pos.x + (cGfxNextPlusX >> 1), pos.y ); @@ -229,7 +229,7 @@ void gfxRenderGame( BNX_GAME *game ) pos.y = cGfxZeroY + game->player[ cPlayer2 ].y * cGfxPairPlusY; if ( pos.y <= cGfxZeroY ) { - SDL_BlitSurface( _Gfx.cursors[cursor], NULL, _Gfx.screen, &pos ); + SDL_BlitSurface( _Gfx.cursors[ (int)cursor ], NULL, _Gfx.screen, &pos ); } /* RENDER GREEN PLAYER */ @@ -237,7 +237,7 @@ void gfxRenderGame( BNX_GAME *game ) pos.y = cGfxZeroY + game->player[ cPlayer2 ].y * cGfxPairPlusY; if ( pos.y <= cGfxZeroY ) { - SDL_BlitSurface( _Gfx.elements[game->player[ cPlayer2 ].e], NULL, _Gfx.screen, &pos ); + SDL_BlitSurface( _Gfx.elements[ (int)game->player[ cPlayer2 ].e], NULL, _Gfx.screen, &pos ); if ( game->score[ cPlayer2 ] != prevScore[ cPlayer2 ] ) { gfxNewParticle( pos.x + (cGfxNextPlusX >> 1), pos.y ); diff --git a/desktop/inp.c b/desktop/inp.c index e9a49fd..72a42af 100755 --- a/desktop/inp.c +++ b/desktop/inp.c @@ -124,6 +124,8 @@ void inpUpdate() case SDLK_PAGEDOWN : _Inp.keyPageDown= BNX_TRUE; break; + default: + break; } if ( event.key.keysym.sym >= SDLK_a && event.key.keysym.sym <= SDLK_z ) { debian/patches/datadir.patch0000644000000000000000000001577512127473707013277 0ustar From: Miriam Ruiz Date: Fri, 5 Apr 2013 00:08:18 +0200 Subject: datadir # Copyright (C) 2008 by Miriam Ruiz # Distributed under the same license as the game. See debian/copyright --- desktop/gfx.c | 52 ++++++++++++++++++++++++++-------------------------- desktop/snd.c | 28 ++++++++++++++-------------- makefile | 5 +++-- 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/desktop/gfx.c b/desktop/gfx.c index c71c855..c834026 100755 --- a/desktop/gfx.c +++ b/desktop/gfx.c @@ -809,40 +809,40 @@ BNX_BOOL gfxLoadResources() BNX_BOOL bLoad = BNX_TRUE; /* Load GUI related graphics data */ - bLoad &= gfxLoadImage( "data/graphics/background0.png", &_Gfx.background[ cModeRealtime ]); - bLoad &= gfxLoadImage( "data/graphics/background1.png", &_Gfx.background[ cModeTurn ]); - bLoad &= gfxLoadImage( "data/graphics/background2.png", &_Gfx.background[ cModeMultiplayer ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/background0.png", &_Gfx.background[ cModeRealtime ]); + bLoad &= gfxLoadImage( DATADIR "/graphics/background1.png", &_Gfx.background[ cModeTurn ]); + bLoad &= gfxLoadImage( DATADIR "/graphics/background2.png", &_Gfx.background[ cModeMultiplayer ] ); - bLoad &= gfxLoadImage( "data/graphics/window.png", &_Gfx.window ); - bLoad &= gfxLoadImage( "data/graphics/splash.png", &_Gfx.splash ); - bLoad &= gfxLoadImage( "data/graphics/logo.png", &_Gfx.logo ); - bLoad &= gfxLoadImage( "data/graphics/help.png", &_Gfx.help ); - bLoad &= gfxLoadImage( "data/graphics/font.png", &_Gfx.font ); - bLoad &= gfxLoadImage( "data/graphics/roadmap.png", &_Gfx.roadmap ); + bLoad &= gfxLoadImage( DATADIR "/graphics/window.png", &_Gfx.window ); + bLoad &= gfxLoadImage( DATADIR "/graphics/splash.png", &_Gfx.splash ); + bLoad &= gfxLoadImage( DATADIR "/graphics/logo.png", &_Gfx.logo ); + bLoad &= gfxLoadImage( DATADIR "/graphics/help.png", &_Gfx.help ); + bLoad &= gfxLoadImage( DATADIR "/graphics/font.png", &_Gfx.font ); + bLoad &= gfxLoadImage( DATADIR "/graphics/roadmap.png", &_Gfx.roadmap ); // Loading Game Elements - bLoad &= gfxLoadImage( "data/graphics/element0.png", &_Gfx.elements[ 0 ] ); - bLoad &= gfxLoadImage( "data/graphics/element1.png", &_Gfx.elements[ 1 ] ); - bLoad &= gfxLoadImage( "data/graphics/element2.png", &_Gfx.elements[ 2 ] ); - bLoad &= gfxLoadImage( "data/graphics/element3.png", &_Gfx.elements[ 3 ] ); - bLoad &= gfxLoadImage( "data/graphics/elementB.png", &_Gfx.elements[ 4 ] ); - - bLoad &= gfxLoadImage( "data/graphics/movecount.png", &_Gfx.movecount ); - bLoad &= gfxLoadImage( "data/graphics/keyboard.png", &_Gfx.keyboard ); - bLoad &= gfxLoadImage( "data/graphics/cursor0.png", &_Gfx.cursors[ 0 ] ); - bLoad &= gfxLoadImage( "data/graphics/cursor1.png", &_Gfx.cursors[ 1 ] ); - bLoad &= gfxLoadImage( "data/graphics/marker0.png", &_Gfx.markers[ 0 ] ); - bLoad &= gfxLoadImage( "data/graphics/marker1.png", &_Gfx.markers[ 1 ] ); - - bLoad &= gfxLoadImage( "data/graphics/particle0.png", &_Gfx.part[ 0 ] ); - bLoad &= gfxLoadImage( "data/graphics/particle1.png", &_Gfx.part[ 1 ] ); - bLoad &= gfxLoadImage( "data/graphics/particle2.png", &_Gfx.part[ 2 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/element0.png", &_Gfx.elements[ 0 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/element1.png", &_Gfx.elements[ 1 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/element2.png", &_Gfx.elements[ 2 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/element3.png", &_Gfx.elements[ 3 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/elementB.png", &_Gfx.elements[ 4 ] ); + + bLoad &= gfxLoadImage( DATADIR "/graphics/movecount.png", &_Gfx.movecount ); + bLoad &= gfxLoadImage( DATADIR "/graphics/keyboard.png", &_Gfx.keyboard ); + bLoad &= gfxLoadImage( DATADIR "/graphics/cursor0.png", &_Gfx.cursors[ 0 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/cursor1.png", &_Gfx.cursors[ 1 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/marker0.png", &_Gfx.markers[ 0 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/marker1.png", &_Gfx.markers[ 1 ] ); + + bLoad &= gfxLoadImage( DATADIR "/graphics/particle0.png", &_Gfx.part[ 0 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/particle1.png", &_Gfx.part[ 1 ] ); + bLoad &= gfxLoadImage( DATADIR "/graphics/particle2.png", &_Gfx.part[ 2 ] ); // Set alpha SDL_SetAlpha( _Gfx.window, SDL_SRCALPHA | SDL_RLEACCEL, cGfxWinBlending ); // Load Help Text - gfxLoadHelp( "data/text/help.txt" ); + gfxLoadHelp( DATADIR "/text/help.txt" ); return bLoad; } diff --git a/desktop/snd.c b/desktop/snd.c index 55b1c87..b2a9e07 100755 --- a/desktop/snd.c +++ b/desktop/snd.c @@ -63,20 +63,20 @@ BNX_BOOL sndInit() Mix_VolumeMusic( MIX_MAX_VOLUME >> 1 ); - _Snd.sounds[ 1 ] = Mix_LoadWAV( "data/sound/sfx1.wav" ); - _Snd.sounds[ 2 ] = Mix_LoadWAV( "data/sound/sfx2.wav" ); - _Snd.sounds[ 3 ] = Mix_LoadWAV( "data/sound/sfx3.wav" ); - _Snd.sounds[ 4 ] = Mix_LoadWAV( "data/sound/sfx4.wav" ); - _Snd.sounds[ 5 ] = Mix_LoadWAV( "data/sound/sfx5.wav" ); - - _Snd.music[ 0 ] = Mix_LoadMUS( "data/music/biniax_common00.it" ); - _Snd.music[ 1 ] = Mix_LoadMUS( "data/music/biniax_common01.it" ); - _Snd.music[ 2 ] = Mix_LoadMUS( "data/music/biniax_common02.it" ); - _Snd.music[ 3 ] = Mix_LoadMUS( "data/music/biniax_common03.it" ); - _Snd.music[ 4 ] = Mix_LoadMUS( "data/music/biniax_common04.it" ); - _Snd.music[ 5 ] = Mix_LoadMUS( "data/music/biniax_common05.it" ); - _Snd.music[ 6 ] = Mix_LoadMUS( "data/music/biniax_common06.it" ); - _Snd.music[ 7 ] = Mix_LoadMUS( "data/music/biniax_common07.it" ); + _Snd.sounds[ 1 ] = Mix_LoadWAV( DATADIR "/sound/sfx1.wav" ); + _Snd.sounds[ 2 ] = Mix_LoadWAV( DATADIR "/sound/sfx2.wav" ); + _Snd.sounds[ 3 ] = Mix_LoadWAV( DATADIR "/sound/sfx3.wav" ); + _Snd.sounds[ 4 ] = Mix_LoadWAV( DATADIR "/sound/sfx4.wav" ); + _Snd.sounds[ 5 ] = Mix_LoadWAV( DATADIR "/sound/sfx5.wav" ); + + _Snd.music[ 0 ] = Mix_LoadMUS( DATADIR "/music/biniax_common00.it" ); + _Snd.music[ 1 ] = Mix_LoadMUS( DATADIR "/music/biniax_common01.it" ); + _Snd.music[ 2 ] = Mix_LoadMUS( DATADIR "/music/biniax_common02.it" ); + _Snd.music[ 3 ] = Mix_LoadMUS( DATADIR "/music/biniax_common03.it" ); + _Snd.music[ 4 ] = Mix_LoadMUS( DATADIR "/music/biniax_common04.it" ); + _Snd.music[ 5 ] = Mix_LoadMUS( DATADIR "/music/biniax_common05.it" ); + _Snd.music[ 6 ] = Mix_LoadMUS( DATADIR "/music/biniax_common06.it" ); + _Snd.music[ 7 ] = Mix_LoadMUS( DATADIR "/music/biniax_common07.it" ); return loaded; } diff --git a/makefile b/makefile index 39d3596..62e0da1 100755 --- a/makefile +++ b/makefile @@ -8,8 +8,9 @@ CC=gcc FILES=biniax.c hof.c desktop/cfg.c desktop/gfx.c desktop/snd.c desktop/inp.c desktop/sys.c INCLUDES=-I . -I desktop LINKTO=-lSDL -lSDL_mixer -lSDL_image -AUTO=`sdl-config --libs --cflags` +DATADIR=/usr/share/games/biniax2 +AUTO=`sdl-config --libs --cflags` -DDATADIR=\"$(DATADIR)\" TARGET=biniax2 biniax: - $(CC) $(AUTO) $(FILES) $(INCLUDES) -o $(TARGET) $(LINKTO) \ No newline at end of file + $(CC) $(FLAGS) $(AUTO) $(FILES) $(INCLUDES) -o $(TARGET) $(LINKTO)