r6646 - packages/trunk/biniax2/debian/patches
Miriam Ruiz
baby-guest at alioth.debian.org
Fri Apr 18 13:44:53 UTC 2008
Author: baby-guest
Date: 2008-04-18 13:44:53 +0000 (Fri, 18 Apr 2008)
New Revision: 6646
Modified:
packages/trunk/biniax2/debian/patches/datadir.patch
packages/trunk/biniax2/debian/patches/endianess.patch
packages/trunk/biniax2/debian/patches/fixes.patch
packages/trunk/biniax2/debian/patches/warnings.patch
Log:
Solved endianess problems with hall of fame data.
Sorry Rhonda, I'll not commit as baby-guest any more, but I had to upload this one ;)
Modified: packages/trunk/biniax2/debian/patches/datadir.patch
===================================================================
--- packages/trunk/biniax2/debian/patches/datadir.patch 2008-04-18 13:13:32 UTC (rev 6645)
+++ packages/trunk/biniax2/debian/patches/datadir.patch 2008-04-18 13:44:53 UTC (rev 6646)
@@ -1,10 +1,10 @@
# Copyright (C) 2008 by Miriam Ruiz <little_miry at yahoo.es>
# Distributed under the same license as the game. See debian/copyright
-Index: biniax2-0.0.20080410/desktop/gfx.c
+Index: biniax2/desktop/gfx.c
===================================================================
---- biniax2-0.0.20080410.orig/desktop/gfx.c 2008-04-10 11:43:43.000000000 +0000
-+++ biniax2-0.0.20080410/desktop/gfx.c 2008-04-10 11:43:46.000000000 +0000
+--- biniax2.orig/desktop/gfx.c 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/desktop/gfx.c 2008-04-18 13:44:57.000000000 +0000
@@ -789,39 +789,39 @@
BNX_BOOL bLoad = BNX_TRUE;
@@ -71,10 +71,10 @@
return bLoad;
}
-Index: biniax2-0.0.20080410/desktop/snd.c
+Index: biniax2/desktop/snd.c
===================================================================
---- biniax2-0.0.20080410.orig/desktop/snd.c 2008-04-10 11:43:43.000000000 +0000
-+++ biniax2-0.0.20080410/desktop/snd.c 2008-04-10 11:43:46.000000000 +0000
+--- biniax2.orig/desktop/snd.c 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/desktop/snd.c 2008-04-18 13:40:20.000000000 +0000
@@ -60,20 +60,20 @@
Mix_VolumeMusic( MIX_MAX_VOLUME >> 1 );
@@ -110,10 +110,10 @@
return BNX_TRUE;
}
-Index: biniax2-0.0.20080410/makefile
+Index: biniax2/makefile
===================================================================
---- biniax2-0.0.20080410.orig/makefile 2008-04-10 11:43:43.000000000 +0000
-+++ biniax2-0.0.20080410/makefile 2008-04-10 11:44:24.000000000 +0000
+--- biniax2.orig/makefile 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/makefile 2008-04-18 13:40:20.000000000 +0000
@@ -8,8 +8,9 @@
FILES=biniax.c hof.c desktop/cfg.c desktop/gfx.c desktop/snd.c desktop/inp.c desktop/sys.c
INCLUDES=-I . -I desktop
Modified: packages/trunk/biniax2/debian/patches/endianess.patch
===================================================================
--- packages/trunk/biniax2/debian/patches/endianess.patch 2008-04-18 13:13:32 UTC (rev 6645)
+++ packages/trunk/biniax2/debian/patches/endianess.patch 2008-04-18 13:44:53 UTC (rev 6646)
@@ -3,29 +3,45 @@
Index: biniax2/biniax.c
===================================================================
---- biniax2.orig/biniax.c 2008-04-18 10:00:58.000000000 +0000
-+++ biniax2/biniax.c 2008-04-18 10:02:19.000000000 +0000
-@@ -61,6 +61,7 @@
+--- biniax2.orig/biniax.c 2008-04-18 13:40:20.000000000 +0000
++++ biniax2/biniax.c 2008-04-18 13:44:57.000000000 +0000
+@@ -61,8 +61,12 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <stdint.h>
#endif
++#include <errno.h>
++#include <string.h>
++
/* Global instance of GAME structure */
-@@ -1219,6 +1220,148 @@
+ BNX_GAME Game;
+
+@@ -157,6 +161,10 @@
+ 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
+@@ -1219,6 +1227,157 @@
#endif
}
+#ifndef _WIN32
-+static uint16_t GetInt16(FILE *fp)
++uint16_t GetInt16(FILE *fp)
+{
+ uint16_t i = (uint16_t) (fgetc(fp) & 0xFF);
+ i |= ((uint16_t) (fgetc(fp) & 0xFF) << 0x08);
+ return i;
+}
+
-+static uint32_t GetInt32(FILE *fp)
++uint32_t GetInt32(FILE *fp)
+{
+ uint32_t i = (uint32_t) (fgetc(fp) & 0xFF);
+ i |= ((uint32_t) (fgetc(fp) & 0xFF) << 0x08);
@@ -34,13 +50,13 @@
+ return i;
+}
+
-+static void PutInt16(uint16_t i, FILE *fp)
++void PutInt16(uint16_t i, FILE *fp)
+{
+ fputc(i & 0xFF, fp);
+ fputc((i >> 0x08) & 0xFF, fp);
+}
+
-+static void PutInt32(uint32_t i, FILE *fp)
++void PutInt32(uint32_t i, FILE *fp)
+{
+ fputc(i & 0xFF, fp);
+ fputc((i >> 0x08) & 0xFF, fp);
@@ -53,11 +69,12 @@
+ FILE *file;
+ int i, j;
+
++ fprintf(stderr, "Saving game data in \"%s\"\n", saveFileName());
+ file = fopen( saveFileName(), "wb" );
+ if ( file == (FILE *) NULL )
+ return BNX_FALSE;
+
-+ PutInt16( 0xB201 , file );
++ PutInt16( 0xB2D1 , file );
+
+ PutInt32( game->moment , file );
+ PutInt16( game->mode , file );
@@ -91,7 +108,7 @@
+ for (i = 0; i < cGridX; i++)
+ fputc( game->grid[i][j] , file );
+
-+ PutInt16( 0xB200 , file );
++ PutInt16( 0xB2D0 , file );
+
+ fclose( file );
+ return BNX_TRUE;
@@ -99,18 +116,21 @@
+
+BNX_BOOL loadGame( BNX_GAME *game )
+{
-+ FILE *file;
++ FILE *file = NULL;
+ int i, j;
+ uint16_t id, mp;
+ uint32_t mx, my;
+
++ fprintf(stderr, "Loading game data from \"%s\"\n", saveFileName());
+ file = fopen( saveFileName(), "rb" );
+ if ( file == (FILE *) NULL )
+ return BNX_FALSE;
+
++ errno = 0;
++
+ id = GetInt16(file);
-+ if (id != 0xB201)
-+ return BNX_FALSE;
++ if (id != 0xB2D1)
++ goto error;
+
+ game->moment = GetInt32(file);
+ game->mode = GetInt16(file);
@@ -127,7 +147,7 @@
+
+ mp = GetInt16(file);
+ if (mp != cMaxPlayers)
-+ return BNX_FALSE;
++ goto error;
+
+ for (i = 0; i < cMaxPlayers; i++)
+ {
@@ -141,28 +161,33 @@
+
+ mx = GetInt32(file);
+ if (mx != cGridX)
-+ return BNX_FALSE;
++ goto error;
+ my = GetInt32(file);
+ if (my != cGridY)
-+ return BNX_FALSE;
++ goto error;
+
+ for (j = 0; j < cGridY; j++)
+ for (i = 0; i < cGridX; i++)
+ game->grid[i][j] = fgetc(file);
+
+ id = GetInt16(file);
-+ if (id != 0xB200)
-+ return BNX_FALSE;
++ if (id != 0xB2D0)
++ goto error;
+
+ fclose( file );
+ return BNX_TRUE;
++
++error:
++ if (file)
++ fclose( file );
++ return BNX_FALSE;
+}
+
+#else /* WIN 32 */
BNX_BOOL saveGame( BNX_GAME *game )
{
FILE *file;
-@@ -1250,6 +1393,7 @@
+@@ -1250,6 +1409,7 @@
return BNX_TRUE;
}
@@ -170,8 +195,184 @@
BNX_BOOL loadHiScore( BNX_GAME *game )
{
-@@ -1257,4 +1401,3 @@
+@@ -1257,4 +1417,3 @@
game->best[ cModeTurn ] = hofGet()->tactic[ 0 ].score;
return BNX_TRUE;
}
-
+Index: biniax2/hof.c
+===================================================================
+--- biniax2.orig/hof.c 2008-04-18 13:40:20.000000000 +0000
++++ biniax2/hof.c 2008-04-18 13:40:20.000000000 +0000
+@@ -43,6 +43,9 @@
+ #include <sys/types.h>
+ #endif
+
++#include <errno.h>
++#include <string.h>
++
+ #define chCursor '_'
+ #define chSpace ' '
+
+@@ -126,6 +129,117 @@
+ #endif
+ }
+
++#ifndef _WIN32
++BNX_BOOL hofInit()
++{
++ FILE *file = NULL;
++ int i;
++ uint16_t id, me, ml;
++
++ file = fopen( hofFileName(), "rb" );
++
++ if ( file == (FILE *) NULL )
++ goto error;
++
++ fprintf(stderr, "Loading Hall of Fame data from \"%s\"\n", hofFileName());
++
++ errno = 0;
++
++ id = GetInt16(file);
++ if (id != 0xB2F1)
++ goto error;
++
++ ml = GetInt16(file);
++ if (ml != cHofNameLen)
++ goto error;
++
++ me = GetInt16(file);
++ if (me != cHofEntries)
++ goto error;
++
++ for ( i = 0; i < cHofEntries; ++i )
++ {
++ fread( Hof.arcade[i].name, 1, cHofNameLen, file );
++ Hof.arcade[i].score = GetInt32(file);
++ }
++
++ for ( i = 0; i < cHofEntries; ++i )
++ {
++ fread( Hof.tactic[i].name, 1, cHofNameLen, file );
++ Hof.tactic[i].score = GetInt32(file);
++ }
++
++ id = GetInt16(file);
++ if (id != 0xB2F0)
++ goto error;
++
++ fclose( file );
++
++ return BNX_TRUE;
++
++error:
++ if (errno)
++ fprintf(stderr, "Could not load Hall of Fame data from \"%s\": %s\n", hofFileName(), strerror(errno));
++ else
++ fprintf(stderr, "Could not load Hall of Fame data from \"%s\"", hofFileName());
++
++ if (file)
++ fclose( file );
++
++ for ( i = 0; i < cHofEntries; ++i )
++ {
++ strcpy( Hof.arcade[ i ].name, "DEBIAN " );
++ Hof.arcade[ i ].score = (cHofEntries - i - 1) * cHofInitScore;
++
++ strcpy( Hof.tactic[ i ].name, "DEBIAN " );
++ Hof.tactic[ i ].score = (cHofEntries - i - 1) * cHofInitScore;
++ }
++
++ return BNX_FALSE;
++}
++
++BNX_BOOL hofSave()
++{
++ FILE *file;
++ int i;
++
++ file = fopen( hofFileName(), "wb" );
++
++ if ( file == (FILE *) NULL )
++ {
++ if (errno)
++ fprintf(stderr, "Could not save Hall of Fame data in \"%s\": %s\n", hofFileName(), strerror(errno));
++ else
++ fprintf(stderr, "Could not save Hall of Fame data in \"%s\"\n", hofFileName());
++ return BNX_FALSE;
++ }
++
++ fprintf(stderr, "Saving Hall of Fame data in \"%s\"\n", hofFileName());
++
++ PutInt16( 0xB2F1 , file );
++ PutInt16( cHofNameLen , file );
++ PutInt16( cHofEntries , file );
++
++ for ( i = 0; i < cHofEntries; ++i )
++ {
++ fwrite( Hof.arcade[i].name, 1, cHofNameLen, file );
++ PutInt32(Hof.arcade[i].score, file);
++ }
++
++ for ( i = 0; i < cHofEntries; ++i )
++ {
++ fwrite( Hof.tactic[i].name, 1, cHofNameLen, file );
++ PutInt32(Hof.tactic[i].score, file);
++ }
++
++ PutInt16( 0xB2F0 , file );
++
++ fclose( file );
++
++ return BNX_TRUE;
++}
++
++#else /* WIN32 */
+ BNX_BOOL hofInit()
+ {
+ FILE *file;
+@@ -141,7 +255,7 @@
+ Hof.tactic[ i ].score = (cHofEntries - i) * cHofInitScore;
+ }
+
+- file = fopen( hofFileName(), "rb" );
++ file = fopen( "hof.bnx2", "rb" );
+
+ if ( file == (FILE *) NULL )
+ return BNX_FALSE;
+@@ -157,7 +271,7 @@
+ {
+ FILE *file;
+
+- file = fopen( hofFileName(), "wb" );
++ file = fopen( "hof.bnx2", "wb" );
+
+ if ( file == (FILE *) NULL )
+ return BNX_FALSE;
+@@ -168,6 +282,7 @@
+
+ return BNX_TRUE;
+ }
++#endif /* WIN32 */
+
+ BNX_BOOL hofEnter( BNX_GAME *game )
+ {
+Index: biniax2/inc.h
+===================================================================
+--- biniax2.orig/inc.h 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/inc.h 2008-04-18 13:40:20.000000000 +0000
+@@ -68,5 +68,13 @@
+ #include "symbian/sys.h"
+ #endif
+
++#ifndef _WIN32
++#include <stdint.h>
++#include <stdio.h>
++uint16_t GetInt16(FILE *fp);
++uint32_t GetInt32(FILE *fp);
++void PutInt16(uint16_t i, FILE *fp);
++void PutInt32(uint32_t i, FILE *fp);
++#endif
+
+ #endif
Modified: packages/trunk/biniax2/debian/patches/fixes.patch
===================================================================
--- packages/trunk/biniax2/debian/patches/fixes.patch 2008-04-18 13:13:32 UTC (rev 6645)
+++ packages/trunk/biniax2/debian/patches/fixes.patch 2008-04-18 13:44:53 UTC (rev 6646)
@@ -3,8 +3,8 @@
Index: biniax2/biniax.c
===================================================================
---- biniax2.orig/biniax.c 2008-04-17 12:03:55.000000000 +0000
-+++ biniax2/biniax.c 2008-04-17 12:06:57.000000000 +0000
+--- biniax2.orig/biniax.c 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/biniax.c 2008-04-18 13:45:00.000000000 +0000
@@ -51,6 +51,18 @@
#include "lev.h"
#include "inc.h"
@@ -109,8 +109,8 @@
return BNX_FALSE;
Index: biniax2/desktop/cfg.c
===================================================================
---- biniax2.orig/desktop/cfg.c 2008-04-17 12:03:55.000000000 +0000
-+++ biniax2/desktop/cfg.c 2008-04-17 12:03:57.000000000 +0000
+--- biniax2.orig/desktop/cfg.c 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/desktop/cfg.c 2008-04-18 13:40:20.000000000 +0000
@@ -30,6 +30,17 @@
#include "inc.h"
@@ -213,8 +213,8 @@
+}
Index: biniax2/desktop/cfg.h
===================================================================
---- biniax2.orig/desktop/cfg.h 2008-04-17 12:03:55.000000000 +0000
-+++ biniax2/desktop/cfg.h 2008-04-17 12:03:57.000000000 +0000
+--- biniax2.orig/desktop/cfg.h 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/desktop/cfg.h 2008-04-18 13:40:20.000000000 +0000
@@ -43,4 +43,8 @@
BNX_BOOL cfgGetMusic();
BNX_BOOL cfgGetFullscreen();
@@ -226,8 +226,8 @@
#endif
Index: biniax2/hof.c
===================================================================
---- biniax2.orig/hof.c 2008-04-17 12:03:55.000000000 +0000
-+++ biniax2/hof.c 2008-04-17 12:07:28.000000000 +0000
+--- biniax2.orig/hof.c 2008-04-18 13:40:19.000000000 +0000
++++ biniax2/hof.c 2008-04-18 13:45:00.000000000 +0000
@@ -31,6 +31,18 @@
#include "inc.h"
Modified: packages/trunk/biniax2/debian/patches/warnings.patch
===================================================================
--- packages/trunk/biniax2/debian/patches/warnings.patch 2008-04-18 13:13:32 UTC (rev 6645)
+++ packages/trunk/biniax2/debian/patches/warnings.patch 2008-04-18 13:44:53 UTC (rev 6646)
@@ -3,8 +3,8 @@
Index: biniax2/desktop/inp.c
===================================================================
---- biniax2.orig/desktop/inp.c 2008-04-18 10:20:20.000000000 +0000
-+++ biniax2/desktop/inp.c 2008-04-18 10:20:21.000000000 +0000
+--- biniax2.orig/desktop/inp.c 2008-04-18 13:43:10.000000000 +0000
++++ biniax2/desktop/inp.c 2008-04-18 13:44:51.000000000 +0000
@@ -118,6 +118,8 @@
case SDLK_PAGEDOWN :
_Inp.keyPageDown= BNX_TRUE;
@@ -16,8 +16,8 @@
{
Index: biniax2/desktop/gfx.c
===================================================================
---- biniax2.orig/desktop/gfx.c 2008-04-18 10:20:21.000000000 +0000
-+++ biniax2/desktop/gfx.c 2008-04-18 10:20:21.000000000 +0000
+--- biniax2.orig/desktop/gfx.c 2008-04-18 13:43:10.000000000 +0000
++++ biniax2/desktop/gfx.c 2008-04-18 13:44:51.000000000 +0000
@@ -194,7 +194,7 @@
pos.y = cGfxZeroY + game->player[ cPlayer1 ].y * cGfxPairPlusY;
if ( pos.y <= cGfxZeroY )
@@ -56,9 +56,9 @@
gfxNewParticle( pos.x + (cGfxNextPlusX >> 1), pos.y );
Index: biniax2/biniax.c
===================================================================
---- biniax2.orig/biniax.c 2008-04-18 10:20:21.000000000 +0000
-+++ biniax2/biniax.c 2008-04-18 10:20:45.000000000 +0000
-@@ -105,7 +105,6 @@
+--- biniax2.orig/biniax.c 2008-04-18 13:43:10.000000000 +0000
++++ biniax2/biniax.c 2008-04-18 13:44:51.000000000 +0000
+@@ -108,7 +108,6 @@
BNX_BOOL bquit = BNX_FALSE;
BNX_INT16 enterState = cStateMainMenu;
BNX_INT16 nmenu = 0;
@@ -66,7 +66,7 @@
UNREF( argc );
UNREF( argv );
-@@ -308,7 +307,7 @@
+@@ -315,7 +314,7 @@
if ( game->grid[ i ][ nearLine ] != 0 )
{
game->player[ cPlayer1 ].e = pairLeft( game->grid[ i ][ nearLine ] );
@@ -75,7 +75,7 @@
break;
}
}
-@@ -320,7 +319,7 @@
+@@ -327,7 +326,7 @@
if ( game->grid[ i ][ nearLine ] != 0 )
{
game->player[ cPlayer2 ].e = pairRight( game->grid[ i ][ nearLine ] );
@@ -84,7 +84,7 @@
break;
}
}
-@@ -522,7 +521,7 @@
+@@ -529,7 +528,7 @@
{
if ( takePair( game, p->x, newY, pIndex ) == BNX_TRUE )
{
@@ -93,7 +93,7 @@
p->y = newY;
return BNX_TRUE;
}
-@@ -540,7 +539,7 @@
+@@ -547,7 +546,7 @@
{
if ( takePair( game, p->x, newY, pIndex ) == BNX_TRUE )
{
@@ -102,7 +102,7 @@
p->y = newY;
return BNX_TRUE;
}
-@@ -558,7 +557,7 @@
+@@ -565,7 +564,7 @@
{
if ( takePair( game, newX, p->y, pIndex ) == BNX_TRUE )
{
@@ -111,7 +111,7 @@
p->x = newX;
return BNX_TRUE;
}
-@@ -576,7 +575,7 @@
+@@ -583,7 +582,7 @@
{
if ( takePair( game, newX, p->y, pIndex ) == BNX_TRUE )
{
@@ -120,7 +120,7 @@
p->x = newX;
return BNX_TRUE;
}
-@@ -634,9 +633,9 @@
+@@ -641,9 +640,9 @@
{
for ( y = 0; y < cGridY; ++y )
{
More information about the Pkg-games-commits
mailing list