Is it possible to run SRB2CB in Linux?

Status
Not open for further replies.
I don't feel like trying to understand it and make it work for 64-bit (at least now), but I do have multilib installed. It it possible to compile it as 32-bit?

sure, like this:
Code:
CFLAGS=-m32 LDFLAGS=-m32 make LINUX=1
 
I tried compiling it as 32-bit and it failed, but I was trying to get the 64-bit version working.

I replaced all the integer entries in the WAD structs to ones that explicitly mention the sie in bytes, and I made functions to read the WAD headers and directory entries:

Code:
// Read wad header without depending on integer size and
// endianness of the processor
int W_ReadHeader(FILE *handle, wadinfo_t *wadinfo)
{
    unsigned char buffer[12];
    if (fread(buffer, 1, 12, handle) != 12) return 0;

    memcpy(wadinfo->identification, buffer, 4);

    wadinfo->numlumps = buffer[4];
    wadinfo->numlumps |= ((UINT32) buffer[5]) << 8;
    wadinfo->numlumps |= ((UINT32) buffer[6]) << 16;
    wadinfo->numlumps |= ((UINT32) buffer[7]) << 24;

    wadinfo->infotableofs = buffer[8];
    wadinfo->infotableofs |= ((UINT32) buffer[9]) << 8;
    wadinfo->infotableofs |= ((UINT32) buffer[10]) << 16;
    wadinfo->infotableofs |= ((UINT32) buffer[11]) << 24;

    return 1;
}

// Read wad lump directory without depending on integer size and
// endianness of the processor
int W_ReadLumpDir(FILE *handle, wadinfo_t *header, filelump_t *info)
{
    if (fseek(handle, header->infotableofs, SEEK_SET)) return 0;

    UINT32 i;
    for (i=0; i<header->numlumps; i++)
    {
        unsigned char buffer[16];
        if (fread(buffer, 1, 16, handle) != 16) return 0;

        info->filepos = buffer[0];
        info->filepos |= ((UINT32) buffer[1]) << 8;
        info->filepos |= ((UINT32) buffer[2]) << 16;
        info->filepos |= ((UINT32) buffer[3]) << 24;

        info->size = buffer[4];
        info->size |= ((UINT32) buffer[5]) << 8;
        info->size |= ((UINT32) buffer[6]) << 16;
        info->size |= ((UINT32) buffer[7]) << 24;

        memcpy(info->name, buffer+8, 8);

        info++;
    }

    return 1;
}
It compiles successfully, and the window even pops up with the loading screen for a split-second, but it fails:

Code:
$ ../Linux/Debug/lsdlsrb2 
Looking for WADs in: SRB2WADDIR,.
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/srb2.srb
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/zones.dta
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/sonic.plr
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/tails.plr
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/knux.plr
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/rings.wpn
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/drill.dta
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/soar.dta
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/SRB2CB.dta
Attempting to load WAD file: /home/michael/scm/svn/code.srb2.org/SRB2/vendor/SRB2CBv1.1/bin/Resources/music.dta
Shutdown tty console
Error: Corrupt game data file.
Delete gamedata.dat(maybe in /home/michael/.srb2)
and try again.
EDIT: I deleted the gamedata.dat file as suggested, and now the loading screen lasts as long as in my working copy of SRB2. But when the loading screen ends, it segfaults. I'll try to use a debugger to see why.
 
I should probably just really try to compile as 32-bit instead, since this is getting really messy. Anyway, this happens when I try it:

Code:
$ CFLAGS=-m32 LDFLAGS=-m32 make LINUX=1
vid_copy.s: Assembler messages:
vid_copy.s:38: Error: invalid instruction suffix for `push'
vid_copy.s:39: Error: invalid instruction suffix for `push'
vid_copy.s:40: Error: invalid instruction suffix for `push'
vid_copy.s:41: Error: invalid instruction suffix for `push'
vid_copy.s:61: Error: invalid instruction suffix for `pop'
vid_copy.s:62: Error: invalid instruction suffix for `pop'
vid_copy.s:63: Error: invalid instruction suffix for `pop'
vid_copy.s:64: Error: invalid instruction suffix for `pop'
make: *** [../objs/Linux/SDL/Release/vid_copy.o] Error 1
And when I add the NOASM flag:

Code:
$ CFLAGS=-m32 LDFLAGS=-m32 make LINUX=1 NOASM=1
Linking lsdlsrb2...
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libSDL_mixer.so when searching for -lSDL_mixer
/usr/bin/ld: skipping incompatible /usr/lib/libSDL_mixer.a when searching for -lSDL_mixer
/usr/bin/ld: skipping incompatible /usr/lib/libSDL_mixer.so when searching for -lSDL_mixer
/usr/bin/ld: skipping incompatible /usr/lib/libSDL_mixer.a when searching for -lSDL_mixer
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/librt.a when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/librt.a when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /usr/lib/libGLU.so when searching for -lGLU
/usr/bin/ld: skipping incompatible /usr/lib/libGLU.so when searching for -lGLU
/usr/bin/ld: skipping incompatible /usr/lib/libpng14.so when searching for -lpng14
/usr/bin/ld: skipping incompatible /usr/lib/libpng14.a when searching for -lpng14
/usr/bin/ld: skipping incompatible /usr/lib/libpng14.so when searching for -lpng14
/usr/bin/ld: skipping incompatible /usr/lib/libpng14.a when searching for -lpng14
/usr/bin/ld: skipping incompatible /usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/string.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/dstrings.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/m_argv.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/m_bbox.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/m_fixed.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/m_random.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/p_maputl.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/tables.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/lzf.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/i_cdmus.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/md5.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/dosstr.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/r_opengl.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `../objs/Linux/SDL/Release/hw_trick.o' is incompatible with i386 output
collect2: ld returned 1 exit status
make: *** [../bin/Linux/Release/lsdlsrb2] Error 1
 
Did you install the ia32-dev package?

Sent from my HTC Vision using Tapatalk
 
opps, I mean ia32-libs-dev package

Sent from my HTC Vision using Tapatalk
 
doh... I forget you was not running a debian system

Sent from my HTC Vision using Tapatalk
 
I think some of your object file are still compiled as 86_64, run the clean target and try again

Sent from my HTC Vision using Tapatalk
 
make clean worked, it compiled and runs, but when I click start game and it shows me the list of save slots, it segfaults when I select one of them.
 
I forgot that I was using the modified code, I checked it out again and it works. Actually, it segfaulted at first, and I found that a call to free() was calling it. I decided to just comment it out, and now it seems to work fine.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top