On Friday 03 August 2007 09:06:44 am Fabian Greffrath wrote:
> Dear ROTTers,
>
> last weekend I finally found the time to implement what Darren Salt (and
> several 64bit-porting documentations the web) suggested and replaced all
> unsinged and signed long variables in the ROTT source code with the
> corresponfing (u)int32_t variables. Please find the dpatch at:
>
> http://www.geocities.com/fab666_2000/10-32bitisms.dpatch.zip
>
> You need to copy it into the rott-1.0/debian/patches directory and
> append '10-32bitisms' to the debian/patches/00list file.
>
> Please rebuild rott on AMD64 and try if it works for you. Please check
> especially if sound and writing/loading of savegames work.
> If it happens to be still buggy I highly appreciate further help!!!

I tried that, it gave the following error:
=====================================
[EMAIL PROTECTED]:~/rott-1.0/rott$ ./rott
Rise of the Triad Startup  Version 1.4
 Shareware Version
Z_INIT: 8950000 bytes
IN_Startup: Mouse Present
    Adding /usr/share/games/rott/HUNTBGIN.WAD.
    Adding /usr/share/games/rott/REMOTE1.RTS.
W_Wad: Wad Manager Started NUMLUMPS=2103
RT_DRAW: Tables Initialized
MU_Startup: No SoundBlaster cards available.
SD_SetupFXCard: No SoundBlaster cards available.
SD_Startup: No SoundBlaster cards available.
RT_MAIN: Fonts Initialized
RT_MSG: Message System Started
W_ReadLump: only read -1 of 8192 on lump 545 Episode      = 0
Area         = 1
=====================================

After some pleasant tinkering with GDB (didn't use that for ages) and fixing 
various things I managed to make it start a game;  the graphics and gameplay 
at the beginning seem normal.  Sound works, but music is just a loud humming.  
Loading a game produces segfault.

I've got other things to do for the time being, so I don't plan to see into 
these issues any time soon.  Hope somebody else will do that :)
By the way, GCC just screams about these issues in it's warnings, like
===============================================
rt_actor.c: In function ‘FindAddresses’:
rt_actor.c:1004: warning: cast from pointer to integer of different size
rt_actor.c:1012: warning: cast from pointer to integer of different size
===============================================
Probably fixing all these warnings in the first place will solve the issues.

The patch is attached.  I wonder what is the scheme of working on packages in 
Debian is --- surely it's something more advanced than cp/diff I used?

> Thanks for testing!

No problem, thank you for your support.

Regards,
-- 
        -- Dmitry Rutsky
diff -u rott-1.0/rott/modexlib.c rott/modexlib.c
--- rott-1.0/rott/modexlib.c	2007-08-03 14:55:20.000000000 +0400
+++ rott/modexlib.c	2007-08-03 16:37:01.000000000 +0400
@@ -46,12 +46,12 @@
 
 int    linewidth;
 int    ylookup[MAXSCREENHEIGHT];
-int    page1start;
-int    page2start;
-int    page3start;
+intptr_t    page1start;
+intptr_t    page2start;
+intptr_t    page3start;
 int    screensize;
-unsigned bufferofs;
-unsigned displayofs;
+intptr_t bufferofs;
+intptr_t displayofs;
 boolean graphicsmode=false;
 
 #ifdef DOS
@@ -517,13 +517,13 @@
     screensize=MAXSCREENHEIGHT*MAXSCREENWIDTH;
 
 #ifdef FULLSCREENHACK    // [!New!
-    page1start=(int)backbuf;
-    page2start=(int)backbuf;
-    page3start=(int)backbuf;
+    page1start=(intptr_t)backbuf;
+    page2start=(intptr_t)backbuf;
+    page3start=(intptr_t)backbuf;
 #else                    // !New!]
-    page1start=(int)sdl_surface->pixels;
-    page2start=(int)sdl_surface->pixels;
-    page3start=(int)sdl_surface->pixels;	
+    page1start=sdl_surface->pixels;
+    page2start=sdl_surface->pixels;
+    page3start=sdl_surface->pixels;	
 #endif                   // !New!
     displayofs = page1start;
     bufferofs = page2start;
@@ -627,7 +627,7 @@
 =================
 */
 
-void VL_ClearBuffer (unsigned buf, byte color)
+void VL_ClearBuffer (intptr_t buf, byte color)
 {
 #ifdef DOS
   VGAMAPMASK(15);
diff -u rott-1.0/rott/modexlib.h rott/modexlib.h
--- rott-1.0/rott/modexlib.h	2003-01-01 12:23:50.000000000 +0300
+++ rott/modexlib.h	2007-08-03 16:37:14.000000000 +0400
@@ -104,19 +104,19 @@
 
 extern  int      ylookup[MAXSCREENHEIGHT];      // Table of row offsets
 extern  int      linewidth;
-extern  int      page1start;
-extern  int      page2start;
-extern  int      page3start;
+extern  intptr_t      page1start;
+extern  intptr_t      page2start;
+extern  intptr_t      page3start;
 extern  int      screensize;
-extern  unsigned bufferofs;
-extern  unsigned displayofs;
+extern  intptr_t bufferofs;
+extern  intptr_t displayofs;
 extern  boolean  graphicsmode;
 
 
 void  GraphicsMode ( void );
 void  SetTextMode ( void );
 void  VL_SetVGAPlaneMode ( void );
-void  VL_ClearBuffer (unsigned buf, byte color);
+void  VL_ClearBuffer (intptr_t buf, byte color);
 void  VL_ClearVideo (byte color);
 void  VL_DePlaneVGA (void);
 void  VL_CopyDisplayToHidden ( void );
Binary files rott-1.0/rott/rott and rott/rott differ
diff -u rott-1.0/rott/rt_game.c rott/rt_game.c
--- rott-1.0/rott/rt_game.c	2007-08-03 14:55:20.000000000 +0400
+++ rott/rt_game.c	2007-08-03 17:28:26.000000000 +0400
@@ -998,7 +998,10 @@
 
 void DrawGameString (int x, int y, char * str, boolean bufferofsonly)
 {
-   unsigned tempbuf;
+   intptr_t tempbuf;
+
+   if (str == NULL)
+     return;
 
    px=x;
    py=y;
@@ -2254,7 +2257,7 @@
 void DrawPause (void)
 {
    pic_t *p;
-   int bufftemp = bufferofs;
+   intptr_t bufftemp = bufferofs;
 
    bufferofs -= screenofs;
 
diff -u rott-1.0/rott/rt_main.c rott/rt_main.c
--- rott-1.0/rott/rt_main.c	2007-08-03 14:55:20.000000000 +0400
+++ rott/rt_main.c	2007-08-03 16:31:39.000000000 +0400
@@ -979,7 +979,7 @@
                while ((!LastScan) && (!IN_GetMouseButtons()))
                   {
                   int i;
-                  unsigned tempbuf;
+                  intptr_t tempbuf;
                   MenuFadeOut();
                   ClearGraphicsScreen();
                   SetPalette(&dimpal[0]);
diff -u rott-1.0/rott/rt_ted.c rott/rt_ted.c
--- rott-1.0/rott/rt_ted.c	2007-08-03 14:55:20.000000000 +0400
+++ rott/rt_ted.c	2007-08-03 17:06:00.000000000 +0400
@@ -1143,7 +1143,7 @@
    int lastmem=0;
    int lastcache=0;
    int ticdelay;
-   unsigned tempbuf;
+   intptr_t tempbuf;
 
    if (CachingStarted==false)
       {
diff -u rott-1.0/rott/rt_vid.c rott/rt_vid.c
--- rott-1.0/rott/rt_vid.c	2002-12-24 10:29:52.000000000 +0300
+++ rott/rt_vid.c	2007-08-03 16:54:53.000000000 +0400
@@ -968,7 +968,7 @@
 
 void SwitchPalette (byte * newpal, int steps)
 {
-   int temp;
+   intptr_t temp;
 
    VL_FadeOut(0,255,0,0,0,steps>>1);
 
Only in rott: rt_vid.c.v2
diff -u rott-1.0/rott/rt_view.c rott/rt_view.c
--- rott-1.0/rott/rt_view.c	2007-08-03 14:55:20.000000000 +0400
+++ rott/rt_view.c	2007-08-03 16:04:24.000000000 +0400
@@ -447,7 +447,7 @@
 	lump = W_GetNumForName("colormap");
 	length = W_LumpLength (lump) + 255;
 	colormap = SafeMalloc (length);
-	colormap = (byte *)( ((int)colormap + 255)&~0xff);
+	colormap = (byte *)( ((uintptr_t)colormap + 255)&~0xff);
 	W_ReadLump (lump,colormap);
 
 // Fix fire colors in colormap
@@ -461,7 +461,7 @@
 	lump = W_GetNumForName("specmaps");
 	length = W_LumpLength (lump+1) + 255;
 	redmap = SafeMalloc (length);
-	redmap = (byte *)( ((int)redmap + 255)&~0xff);
+	redmap = (byte *)( ((uintptr_t)redmap + 255)&~0xff);
 	W_ReadLump (lump+1,redmap);
    greenmap = redmap+(16*256);
 
@@ -474,7 +474,7 @@
          {
 	      length = W_LumpLength (lump+i) + 255;
 	      playermaps[i] = SafeMalloc (length);
-	      playermaps[i] = (byte *)( ((int)playermaps[i] + 255)&~0xff);
+	      playermaps[i] = (byte *)( ((uintptr_t)playermaps[i] + 255)&~0xff);
 	      W_ReadLump (lump+i,playermaps[i]);
          }
       }
diff -u rott-1.0/rott/w_wad.c rott/w_wad.c
--- rott-1.0/rott/w_wad.c	2007-08-03 14:55:20.000000000 +0400
+++ rott/w_wad.c	2007-08-03 16:01:22.000000000 +0400
@@ -304,8 +304,8 @@
         name8[8] = 0;                   // in case the name was a fill 8 chars
         strupr (name8);                 // case insensitive
 
-        v1 = *(int *)name8;
-        v2 = *(int *)&name8[4];
+        v1 = *(int32_t *)name8;
+        v2 = *(int32_t *)&name8[4];
 
 
 // scan backwards so patch lump files take precedence
@@ -315,7 +315,7 @@
 
         while (lump_p != endlump)
            {
-           if ( *(int *)lump_p->name == v1 && *(int *)&lump_p->name[4] == v2)
+           if ( *(int32_t *)lump_p->name == v1 && *(int *)&lump_p->name[4] == v2)
               return lump_p - lumpinfo;
            lump_p++;
            }
diff -u rott-1.0/rott/_w_wad.h rott/_w_wad.h
--- rott-1.0/rott/_w_wad.h	2002-12-24 08:16:23.000000000 +0300
+++ rott/_w_wad.h	2007-08-03 15:45:45.000000000 +0400
@@ -53,23 +53,23 @@
 typedef struct
 {
         char            name[8];
-        int             handle,position,size;
-        int             byteswapped;
+        int32_t             handle,position,size;
+        int32_t             byteswapped;
 } lumpinfo_t;
 
 
 typedef struct
 {
         char            identification[4];              // should be IWAD
-        int             numlumps;
-        int             infotableofs;
+        int32_t             numlumps;
+        int32_t             infotableofs;
 } wadinfo_t;
 
 
 typedef struct
 {
-        int             filepos;
-        int             size;
+        int32_t             filepos;
+        int32_t             size;
         char            name[8];
 } filelump_t;
 

Reply via email to