Author: jseidel-guest
Date: 2007-09-06 00:21:33 +0000 (Thu, 06 Sep 2007)
New Revision: 4087

Modified:
   packages/trunk/hex-a-hop/debian/patches/endianess.patch
Log:
More endian specific changes, mostly in inactive code


Modified: packages/trunk/hex-a-hop/debian/patches/endianess.patch
===================================================================
--- packages/trunk/hex-a-hop/debian/patches/endianess.patch     2007-09-05 
22:18:54 UTC (rev 4086)
+++ packages/trunk/hex-a-hop/debian/patches/endianess.patch     2007-09-06 
00:21:33 UTC (rev 4087)
@@ -2,11 +2,11 @@
 # Copyright (C) 2007  Jens Seidel <[EMAIL PROTECTED]>
 # Licensed under the GPL, see /usr/share/common-licenses/GPL
 
-Index: hex-a-hop-0.0.20070315/packfile.h
+Index: hex-a-hop.svn/packfile.h
 ===================================================================
---- hex-a-hop-0.0.20070315.orig/packfile.h
-+++ hex-a-hop-0.0.20070315/packfile.h
-@@ -16,11 +16,14 @@
+--- hex-a-hop.svn.orig/packfile.h      2007-09-05 23:51:42.000000000 +0200
++++ hex-a-hop.svn/packfile.h   2007-09-06 02:05:59.000000000 +0200
+@@ -16,11 +16,16 @@
      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
  
@@ -16,13 +16,15 @@
  
  struct PackFile1
  {
++  /* CHECKME: Is it save to interpret a byte stream as list of Entries?
++   * Does the alignment could increase the Entry size on 64 bit systems? */
        class Entry {
 -              int len;
 +              int32_t len;
        public:
                char name[1];
  
-@@ -73,10 +76,13 @@ struct PackFile1
+@@ -73,10 +78,13 @@
                if (numfiles || e || data)
                        FATAL("Calling Packfile1::Read when already 
initialised.");
  
@@ -37,22 +39,22 @@
                fseek(f, end_offset - size, SEEK_SET);
  
                data = malloc(size);
-@@ -88,6 +94,10 @@ struct PackFile1
+@@ -88,6 +96,10 @@
                while ((void*)i < data_end)
                {
                        numfiles++;
++#if __BYTE_ORDER == __BIG_ENDIAN
 +                      int32_t *data_length = (int32_t*)i;
-+#if __BYTE_ORDER == __BIG_ENDIAN
 +                      *data_length = bswap_32(*data_length);
 +#endif
                        i = i->GetNext();
                }
                
-Index: hex-a-hop-0.0.20070315/hex_puzzzle.cpp
+Index: hex-a-hop.svn/hex_puzzzle.cpp
 ===================================================================
---- hex-a-hop-0.0.20070315.orig/hex_puzzzle.cpp
-+++ hex-a-hop-0.0.20070315/hex_puzzzle.cpp
-@@ -444,10 +444,10 @@ void SaveState::ApplyStuff()
+--- hex-a-hop.svn.orig/hex_puzzzle.cpp 2007-09-05 23:51:42.000000000 +0200
++++ hex-a-hop.svn/hex_puzzzle.cpp      2007-09-06 02:14:52.000000000 +0200
+@@ -444,10 +444,10 @@
  }
  
  
@@ -65,16 +67,47 @@
        Pos() : x(0), y(0) {}
        Pos(int a, int b) : x(a), y(b) {}
        bool operator == (Pos const & p) const 
-@@ -1579,6 +1579,7 @@ struct HexPuzzle : public State
-                       for (int i=bounds[0]; i<=bounds[1]; i++)
-                               for (int j=bounds[2]; j<=bounds[3]; j++)
-                               {
-+                                      unused code
-                                       unsigned char comp = map[i][j] | 
(map_item[i][j]<<5);
-                                       fread(&comp, sizeof(comp), 1, f);
-                                       int t = comp & 0x1f;
-@@ -1884,7 +1885,7 @@ struct HexPuzzle : public State
+@@ -1497,7 +1497,7 @@
+       Tile map[MAP_SIZE][MAP_SIZE];
+       int map_item[MAP_SIZE][MAP_SIZE];
+       int tileCount[NumTileTypes];
+-      int levelPar, levelDiff;
++      int32_t levelPar, levelDiff;
+       int turboAnim;
+       Pos player;
+       int player_items[2];
+@@ -1565,14 +1565,26 @@
  
+                       fgetc(f); // Remove '\n' character
+ 
+-                      int par, diff;
++                      int32_t par, diff;
+                       unsigned char bounds[4];
+                       Pos playerStart;
+                       fread(&par, sizeof(par), 1, f);
+-                      if (version >= 4)
++#if __BYTE_ORDER == __BIG_ENDIAN
++                      par = bswap_32(par);
++#endif
++
++                      if (version >= 4) {
+                               fread(&diff, sizeof(diff), 1, f);
++#if __BYTE_ORDER == __BIG_ENDIAN
++                      diff = bswap_32(diff);
++#endif
++      }
+                       fread(bounds, sizeof(bounds), 1, f);
+-                      fread(&playerStart, sizeof(player), 1, f);
++                      fread(&playerStart, sizeof(playerStart), 1, f);
++#if __BYTE_ORDER == __BIG_ENDIAN
++              playerStart.x = bswap_32(playerStart.x);
++              playerStart.y = bswap_32(playerStart.y);
++#endif
+ 
+                       int highval=0;
+ 
+@@ -1884,7 +1896,7 @@
+ 
                                if (!save)
                                {
 -                                      char* data = ReadAll(f);
@@ -82,11 +115,9 @@
                                        _LoadSave(f, save);
                                        delete [] data;
                                        loadPtr = endLoad = 0;
-@@ -1934,9 +1935,14 @@ struct HexPuzzle : public State
- 
+@@ -1935,10 +1947,20 @@
                if (version==1)
                {
-+                      printf("Reading version 1 file format ...\n");
                        for (int i=0; i<MAP_SIZE; i++)
 -                              for (int j=0; j<MAP_SIZE; j++)
 +                              for (int j=0; j<MAP_SIZE; j++) {
@@ -97,14 +128,23 @@
 +                                      }
  
                        fn(&player, sizeof(player), 1, f);
++      if (!save) {
++#if __BYTE_ORDER == __BIG_ENDIAN
++                                      player.x = bswap_32(player.x);
++                                      player.y = bswap_32(player.y);
++#endif
++      }
  
-@@ -1966,18 +1972,34 @@ struct HexPuzzle : public State
+                       if (fn(map_item, sizeof(map_item), 1, f) == 0)
                                memset(map_item, 0, sizeof(map_item));
+@@ -1966,18 +1988,34 @@
+                               memset(map_item, 0, sizeof(map_item));
                        }
  
 -                      if (version>=3)
+-                              fn(&levelPar, 1, sizeof(levelPar), f);
 +                      if (version>=3) {
-                               fn(&levelPar, 1, sizeof(levelPar), f);
++                              fn(&levelPar, sizeof(levelPar), 1, f);
 +                              if (!save) {
 +#if __BYTE_ORDER == __BIG_ENDIAN
 +                                      levelPar = bswap_32(levelPar);
@@ -115,8 +155,9 @@
                                levelPar = 0;
  
 -                      if (version>=4)
+-                              fn(&levelDiff, 1, sizeof(levelDiff), f);
 +                      if (version>=4) {
-                               fn(&levelDiff, 1, sizeof(levelDiff), f);
++                              fn(&levelDiff, sizeof(levelDiff), 1, f);
 +                              if (!save) {
 +#if __BYTE_ORDER == __BIG_ENDIAN
 +                                      levelDiff = bswap_32(levelDiff);
@@ -126,7 +167,8 @@
                        else if (!save)
                                levelDiff = 0;
  
-                       fn(bounds, sizeof(bounds), 1, f);
+-                      fn(bounds, sizeof(bounds), 1, f);
++                      fn(bounds, sizeof(bounds), 1, f); // CHECKME
                        fn(&player, sizeof(player), 1, f);
 +#if __BYTE_ORDER == __BIG_ENDIAN
 +                                      player.x = bswap_32(player.x);
@@ -135,7 +177,7 @@
  
                        int offsetx=0, offsety=0;
  
-@@ -2027,13 +2049,16 @@ struct HexPuzzle : public State
+@@ -2027,13 +2065,16 @@
                        else
                        {
                                while(1){
@@ -153,7 +195,7 @@
                                        if (len<0) break;
                                        char* tmp = new char[len+1];
                                        tmp[len] = 0;
-@@ -2398,10 +2423,14 @@ struct HexPuzzle : public State
+@@ -2398,10 +2439,14 @@
                FILE* f = file_open(bmp, "rb");
                if (!f) FATAL("Unable to open file", bmp);
  
@@ -170,7 +212,7 @@
  
                tmp = new uint32[(int)w*h];
                
-@@ -2414,9 +2443,16 @@ struct HexPuzzle : public State
+@@ -2414,9 +2459,16 @@
                        else
                        {
                                fread(&c, sizeof(c), 1, f);


_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-games-commits

Reply via email to