Is it possible to run SRB2CB in Linux?

Status
Not open for further replies.
Right now, I have "svn://code.srb2.org/" checked out with SVN, and it has two directories it in with SRB2CB: "SRB2/branches/CB" and "SRB21094/branches/SRB2CB". Which one of these, if any, is the one I should use?
 
Right now, I have "svn://code.srb2.org/" checked out with SVN, and it has two directories it in with SRB2CB: "SRB2/branches/CB" and "SRB21094/branches/SRB2CB". Which one of these, if any, is the one I should use?

update your working copy, with
Code:
svn update
"SRB2/branches/CB" had been deleted, "SRB21094/branches/SRB2CB" is for old SRB2 1.09.4, and "SRB2/vendor/SRB2CBv1.1" is the new resting place for SRB2 'Community Build'
 
I updated it using "svn up" and went to "SRB2/vendor/SRB2CBv1.1". This time it actually started compiling, but then it came across an error:

Code:
$ make LINUX=1 NONX86=1
Creating dependency file, depend.dep
Created dependency file, depend.dep
d_net.c: In function ‘Net_AckTicker’:
d_net.c:481:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
dehacked.c: In function ‘DEH_LoadDehackedFile’:
dehacked.c:2003:25: warning: variable ‘savesprnames’ set but not used [-Wunused-but-set-variable]
dehacked.c:2002:23: warning: variable ‘saveactions’ set but not used [-Wunused-but-set-variable]
z_zone.c: In function ‘Z_FreeTags’:
z_zone.c:318:24: warning: ‘block’ may be used uninitialized in this function [-Wuninitialized]
g_game.c: In function ‘G_CheckSpot’:
g_game.c:1978:15: warning: variable ‘ss’ set but not used [-Wunused-but-set-variable]
g_game.c: In function ‘G_DoPlayDemo’:
g_game.c:3196:9: warning: variable ‘map’ set but not used [-Wunused-but-set-variable]
command.c: In function ‘COM_Exec_f’:
command.c:573:9: warning: variable ‘length’ set but not used [-Wunused-but-set-variable]
console.c: In function ‘CONS_LogPrintf’:
console.c:1157:10: warning: variable ‘d’ set but not used [-Wunused-but-set-variable]
hu_stuff.c: In function ‘HU_Responder’:
hu_stuff.c:834:36: warning: variable ‘altdown’ set but not used [-Wunused-but-set-variable]
m_cheat.c: In function ‘cht_Responder’:
m_cheat.c:147:19: warning: variable ‘plyr’ set but not used [-Wunused-but-set-variable]
m_misc.c: In function ‘M_PNGfix_acTL’:
m_misc.c:846:2: warning: implicit declaration of function ‘png_debug’ [-Wimplicit-function-declaration]
m_misc.c:848:2: warning: ‘num_frames_to_write’ is deprecated (declared at /usr/include/libpng14/png.h:1509) [-Wdeprecated-declarations]
info.c: In function ‘GDF_CleanUp’:
info.c:10710:12: warning: variable ‘k’ set but not used [-Wunused-but-set-variable]
info.c:10710:9: warning: variable ‘j’ set but not used [-Wunused-but-set-variable]
info.c:10710:6: warning: variable ‘i’ set but not used [-Wunused-but-set-variable]
info.c: In function ‘GDF_Format’:
info.c:11032:6: warning: variable ‘j’ set but not used [-Wunused-but-set-variable]
p_enemy.c: In function ‘P_LookForPlayers’:
p_enemy.c:608:12: warning: variable ‘sector’ set but not used [-Wunused-but-set-variable]
p_enemy.c: In function ‘P_LookForShield’:
p_enemy.c:693:12: warning: variable ‘sector’ set but not used [-Wunused-but-set-variable]
p_enemy.c: In function ‘A_DetonChase’:
p_enemy.c:3754:10: warning: variable ‘oldtracer’ set but not used [-Wunused-but-set-variable]
p_enemy.c: In function ‘A_RecyclePowers’:
p_enemy.c:4675:7: warning: variable ‘pindex’ set but not used [-Wunused-but-set-variable]
p_floor.c: In function ‘T_ContinuousFalling’:
p_floor.c:603:21: warning: variable ‘destceiling’ set but not used [-Wunused-but-set-variable]
p_floor.c:603:10: warning: variable ‘destfloor’ set but not used [-Wunused-but-set-variable]
p_floor.c: In function ‘EV_DoFloor’:
p_floor.c:2510:6: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_floor.c:2520:6: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_inter.c: In function ‘P_PlayerEmeraldBurst’:
p_inter.c:3859:6: warning: variable ‘amt’ set but not used [-Wunused-but-set-variable]
p_map.c: In function ‘P_TryCameraMove’:
p_map.c:1603:16: warning: variable ‘oldy’ set but not used [-Wunused-but-set-variable]
p_map.c:1603:10: warning: variable ‘oldx’ set but not used [-Wunused-but-set-variable]
p_map.c: In function ‘P_TryMove’:
p_map.c:1809:16: warning: variable ‘oldy’ set but not used [-Wunused-but-set-variable]
p_map.c:1809:10: warning: variable ‘oldx’ set but not used [-Wunused-but-set-variable]
p_map.c: In function ‘P_SceneryTryMove’:
p_map.c:2161:16: warning: variable ‘oldy’ set but not used [-Wunused-but-set-variable]
p_map.c:2161:10: warning: variable ‘oldx’ set but not used [-Wunused-but-set-variable]
p_map.c: In function ‘P_HitBounceLine’:
p_map.c:2399:6: warning: variable ‘side’ set but not used [-Wunused-but-set-variable]
p_map.c: In function ‘P_IsClimbingValid’:
p_map.c:2514:47: warning: variable ‘boostup’ set but not used [-Wunused-but-set-variable]
p_map.c:2514:31: warning: variable ‘thrust’ set but not used [-Wunused-but-set-variable]
p_map.c:2492:10: warning: variable ‘climb’ set but not used [-Wunused-but-set-variable]
p_map.c: In function ‘PIT_RadiusAttack’:
p_map.c:3611:17: warning: variable ‘momy’ set but not used [-Wunused-but-set-variable]
p_map.c:3611:7: warning: variable ‘momx’ set but not used [-Wunused-but-set-variable]
p_map.c: In function ‘PTR_AimTraverse’:
p_map.c:3380:27: warning: ‘th’ may be used uninitialized in this function [-Wuninitialized]
p_mobj.c: In function ‘P_MobjCheckWater’:
p_mobj.c:2671:8: warning: variable ‘oldeflags’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_DestroyRobots’:
p_mobj.c:3054:6: warning: variable ‘count’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_CameraThinker’:
p_mobj.c:3108:17: warning: variable ‘oldy’ set but not used [-Wunused-but-set-variable]
p_mobj.c:3108:11: warning: variable ‘oldx’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_PlayerMobjThinker’:
p_mobj.c:3558:11: warning: variable ‘roverfound’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_Look4Players’:
p_mobj.c:3820:12: warning: variable ‘sector’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_SpawnParaloop’:
p_mobj.c:5275:9: warning: variable ‘hoopcenter’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_PushableThinker’:
p_mobj.c:7542:10: warning: variable ‘mceilingz’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_RespawnSpecials’:
p_mobj.c:8743:21: warning: variable ‘closey’ set but not used [-Wunused-but-set-variable]
p_mobj.c:8743:13: warning: variable ‘closex’ set but not used [-Wunused-but-set-variable]
p_mobj.c: In function ‘P_SpawnMapThing’:
p_mobj.c:9545:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_mobj.c:9567:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_mobj.c: In function ‘P_Particles’:
p_mobj.c:10804:6: warning: variable ‘prand’ set but not used [-Wunused-but-set-variable]
p_setup.c: In function ‘P_InitMapHeaders’:
p_setup.c:303:6: warning: variable ‘moremapnumbers’ set but not used [-Wunused-but-set-variable]
p_setup.c: In function ‘P_WriteThings’:
p_setup.c:991:8: warning: variable ‘data’ set but not used [-Wunused-but-set-variable]
p_setup.c: In function ‘P_GroupLines’:
p_setup.c:2006:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_setup.c:2010:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_setup.c:2014:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_setup.c:2014:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat]
p_setup.c:2018:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_setup.c:2018:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat]
p_spec.c: In function ‘P_LinedefExecute’:
p_spec.c:1551:8: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_spec.c:1551:8: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
p_spec.c:1577:8: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_spec.c:1577:8: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
p_user.c: In function ‘P_DoJump’:
p_user.c:1786:13: warning: variable ‘nextsector’ set but not used [-Wunused-but-set-variable]
p_user.c: In function ‘P_GetPlayerControlDirection’:
p_user.c:2622:10: warning: variable ‘controldirection’ set but not used [-Wunused-but-set-variable]
p_user.c: In function ‘P_CheckChangeCTFTeam’:
p_user.c:6935:29: warning: variable ‘bluearray’ set but not used [-Wunused-but-set-variable]
p_user.c:6935:7: warning: variable ‘redarray’ set but not used [-Wunused-but-set-variable]
p_user.c: In function ‘P_CheckPlayerClimb’:
p_user.c:7507:16: warning: variable ‘topheight’ set but not used [-Wunused-but-set-variable]
p_user.c:7557:16: warning: variable ‘bottomheight’ set but not used [-Wunused-but-set-variable]
p_user.c: In function ‘JB_BotWander’:
p_user.c:12425:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c:12422:10: warning: variable ‘abilityjump’ set but not used [-Wunused-but-set-variable]
p_user.c: In function ‘JB_Jump4AirBubble’:
p_user.c:12497:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘JB_CoopThink’:
p_user.c:12527:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c:12686:10: warning: variable ‘abilityjump’ set but not used [-Wunused-but-set-variable]
p_user.c: In function ‘JB_SmartCoopThink’:
p_user.c:12807:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘JB_RaceThink’:
p_user.c:13074:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘JB_MatchThink’:
p_user.c:13190:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘JB_CTFThink’:
p_user.c:13443:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘JB_TagThink’:
p_user.c:13668:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘JB_ChaosThink’:
p_user.c:13776:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘JB_BotThink’:
p_user.c:13895:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c:13891:16: warning: variable ‘botownerstate’ set but not used [-Wunused-but-set-variable]
p_user.c: In function ‘P_BotThink’:
p_user.c:14030:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
p_user.c: In function ‘P_PlayerThink’:
p_user.c:14364:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
r_data.c: In function ‘R_DrawColumnInCache’:
r_data.c:147:8: warning: variable ‘dest’ set but not used [-Wunused-but-set-variable]
r_data.c: In function ‘R_LoadTextures’:
r_data.c:661:27: warning: array subscript is above array bounds [-Warray-bounds]
r_data.c:662:27: warning: array subscript is above array bounds [-Warray-bounds]
r_data.c:705:18: warning: array subscript is above array bounds [-Warray-bounds]
r_data.c:792:19: warning: array subscript is above array bounds [-Warray-bounds]
r_data.c:557:13: warning: ‘addtex’ may be used uninitialized in this function [-Wuninitialized]
In file included from r_draw.c:485:0:
r_draw8.c: In function ‘R_DrawFogSpan_8’:
r_draw8.c:891:8: warning: variable ‘transmap’ set but not used [-Wunused-but-set-variable]
r_draw8.c: In function ‘R_DrawColumnShadowed_8’:
r_draw8.c:962:21: warning: variable ‘realyl’ set but not used [-Wunused-but-set-variable]
r_main.c: In function ‘R_SetupFrame’:
r_main.c:815:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
r_plane.c: In function ‘R_ExpandPlane’:
r_plane.c:1266:13: warning: variable ‘intrh’ set but not used [-Wunused-but-set-variable]
r_plane.c:1266:6: warning: variable ‘intrl’ set but not used [-Wunused-but-set-variable]
r_segs.c: In function ‘R_StoreWallRange’:
r_segs.c:1334:16: warning: variable ‘lheight’ set but not used [-Wunused-but-set-variable]
r_things.c: In function ‘R_CreateDrawNodes’:
r_things.c:1737:10: warning: variable ‘gzm’ set but not used [-Wunused-but-set-variable]
r_things.c: In function ‘R_AddSkins’:
r_things.c:2792:10: warning: variable ‘colorval’ set but not used [-Wunused-but-set-variable]
s_sound.c: In function ‘S_AdjustSoundParams’:
s_sound.c:481:41: warning: variable ‘closey’ set but not used [-Wunused-but-set-variable]
s_sound.c:481:33: warning: variable ‘closex’ set but not used [-Wunused-but-set-variable]
s_sound.c: In function ‘S_UpdateSounds’:
s_sound.c:888:13: warning: variable ‘sfx’ set but not used [-Wunused-but-set-variable]
sdl/i_system.c: In function ‘tty_Back’:
sdl/i_system.c:390:10: warning: variable ‘d’ set but not used [-Wunused-but-set-variable]
sdl/i_system.c: In function ‘tty_Show’:
sdl/i_system.c:431:10: warning: variable ‘d’ set but not used [-Wunused-but-set-variable]
sdl/i_system.c: In function ‘I_GetConsoleEvents’:
sdl/i_system.c:510:10: warning: variable ‘d’ set but not used [-Wunused-but-set-variable]
sdl/i_system.c: In function ‘I_OutputMsg’:
sdl/i_system.c:740:9: warning: variable ‘d’ set but not used [-Wunused-but-set-variable]
hardware/r_opengl/r_opengl.c: In function ‘SetStates’:
hardware/r_opengl/r_opengl.c:218:8: warning: variable ‘Data’ set but not used [-Wunused-but-set-variable]
hardware/hw_main.c: In function ‘HWR_ProcessSeg’:
hardware/hw_main.c:2016:65: warning: variable ‘worldlowsec’ set but not used [-Wunused-but-set-variable]
hardware/hw_main.c:2016:50: warning: variable ‘worldhighsec’ set but not used [-Wunused-but-set-variable]
hardware/hw_main.c:2016:33: warning: variable ‘worldbottomsec’ set but not used [-Wunused-but-set-variable]
hardware/hw_main.c:2016:19: warning: variable ‘worldtopsec’ set but not used [-Wunused-but-set-variable]
hardware/hw_main.c: In function ‘HWR_DrawShadow’:
hardware/hw_main.c:3979:11: warning: variable ‘shadowdir’ set but not used [-Wunused-but-set-variable]
hardware/hw_main.c:3930:7: warning: variable ‘flip’ set but not used [-Wunused-but-set-variable]
hardware/hw_main.c: In function ‘HWR_DrawMD2’:
hardware/hw_main.c:4397:11: warning: variable ‘floorheight’ set but not used [-Wunused-but-set-variable]
hardware/hw3sound.c: In function ‘HW3S_GetSource’:
hardware/hw3sound.c:207:13: warning: variable ‘listener’ set but not used [-Wunused-but-set-variable]
hardware/hw3sound.c: In function ‘HW3S_I_StartSound’:
hardware/hw3sound.c:348:13: warning: variable ‘listener2’ set but not used [-Wunused-but-set-variable]
hardware/hw3sound.c:347:13: warning: variable ‘listener’ set but not used [-Wunused-but-set-variable]
Linking lsdlsrb2...
../objs/Linux/SDL/Release/m_misc.o: In function `M_StopMovie':
m_misc.c:(.text+0x5d6): undefined reference to `png_debug'
collect2: ld returned 1 exit status
make: *** [../bin/Linux/Release/lsdlsrb2] Error 1
 
I updated it using "svn up" and went to "SRB2/vendor/SRB2CBv1.1". This time it actually started compiling, but then it came across an error:

Code:
$
Linking lsdlsrb2...
../objs/Linux/SDL/Release/m_misc.o: In function `M_StopMovie':
m_misc.c:(.text+0x5d6): undefined reference to `png_debug'
collect2: ld returned 1 exit status
make: *** [../bin/Linux/Release/lsdlsrb2] Error 1

find a line in m_misc.c
Code:
png_debug(1, "in png_write_acTL\n");

and delete it, libpng 1.4.0+ moved that function out of the public API
 
It compiled:

Code:
$ sed -i '/png_debug/d' m_misc.c
$ make LINUX=1 NONX86=1
m_misc.c: In function ‘M_PNGfix_acTL’:
m_misc.c:847:2: warning: ‘num_frames_to_write’ is deprecated (declared at /usr/include/libpng14/png.h:1509) [-Wdeprecated-declarations]
Linking lsdlsrb2...
But it doesn't run:

Code:
$ ./lsdlsrb2 
Looking for WADs in: SRB2WADDIR,.,/usr/local/share/games/srb2,/usr/local/games/srb2,/usr/share/games/srb2
Shutdown tty console
Error: W_InitMultipleFiles: no files found
Note that I do have the regular SRB2 installed from the AUR package (http://aur.archlinux.org/packages.php?ID=43803).
 
It compiled:

Code:
$ sed -i '/png_debug/d' m_misc.c
$ make LINUX=1 NONX86=1
m_misc.c: In function ‘M_PNGfix_acTL’:
m_misc.c:847:2: warning: ‘num_frames_to_write’ is deprecated (declared at /usr/include/libpng14/png.h:1509) [-Wdeprecated-declarations]
Linking lsdlsrb2...
But it doesn't run:

Code:
$ ./lsdlsrb2 
Looking for WADs in: SRB2WADDIR,.,/usr/local/share/games/srb2,/usr/local/games/srb2,/usr/share/games/srb2
Shutdown tty console
Error: W_InitMultipleFiles: no files found
Note that I do have the regular SRB2 installed from the AUR package (http://aur.archlinux.org/packages.php?ID=43803).

as you know, I am not touching this code with a 10 foot pool, but you could try this:
change into the bin/Resource file, and this
Code:
ln -s /usr/share/games/srb2/* .
then try
Code:
../Linux/Release/lsdlsrb2
 
It still doesn't work:

Code:
$ ln -s /usr/share/games/srb2/* .
$ ls
SRB2CB.dta  knux.plr   rings.wpn  sonic.plr  tails.plr
drill.dta   music.dta  soar.dta   srb2.srb   zones.dta
$ cd ../Linux/Release/
$ ./lsdlsrb2 
Looking for WADs in: SRB2WADDIR,.,/usr/local/share/games/srb2,/usr/local/games/srb2,/usr/share/games/srb2
Shutdown tty console
Error: W_InitMultipleFiles: no files found
 
It still doesn't work:

Code:
$ cd ../Linux/Release/


sigh, did I said to change location?

SRB2 for Linux look in the env SRB2WADDIR, then the current folder, then /usr/local's game folder, /usr's game folders, keep the CWD to bin/Resources
 
Code:
$ ls
SRB2CB.dta  knux.plr   rings.wpn  sonic.plr  tails.plr
drill.dta   music.dta  soar.dta   srb2.srb   zones.dta
$ ../Linux/Release/lsdlsrb2 
Looking for WADs in: SRB2WADDIR,.
Shutdown tty console
Error: W_InitMultipleFiles: no files found
 
Code:
$ ls
SRB2CB.dta  knux.plr   rings.wpn  sonic.plr  tails.plr
drill.dta   music.dta  soar.dta   srb2.srb   zones.dta
$ ../Linux/Release/lsdlsrb2 
Looking for WADs in: SRB2WADDIR,.
Shutdown tty console
Error: W_InitMultipleFiles: no files found

Ok......, no clue, not touching that code. I am sorry, but you are on your own
 
I searched the source code for the error message strign thet it prints, and found that it comes from here:

Code:
int W_InitMultipleFiles(char **filenames)
{
        int rc = 1;

        // open all the files, load headers, and count lumps
        numwadfiles = 0;

        // will be realloced as lumps are added
        for (; *filenames; filenames++)
        {
                //CONS_Printf("Loading %s\n", *filenames);
                printf("**** Filename: %s\n", *filenames); // I added this for debugging purposes
                rc &= (W_LoadWadFile(*filenames) != MAXSHORT) ? 1 : 0;
        }

        if (!numwadfiles)
                I_Error("W_InitMultipleFiles: no files found");

        return rc;
}

It looks like it's not loading any of the files, even though I see that the loop is iterating over the proper files. So i looked at the W_LoadWadFile function:

Code:
                wadinfo_t header; 
                lumpinfo_t *lump_p; 
                filelump_t *fileinfo; 
                void *fileinfov; 
        
                // read the header 
                if (fread(&header, 1, sizeof header, handle) < sizeof header) 
                {                       
                        CONS_Printf("Can't read wad header from %s because %s\n", filename, strerror(ferror(handle))); 
                        return MAXSHORT; 
                }                                       
                                
                if (memcmp(header.identification, "ZWAD", 4) == 0) 
                        compressed = 1; 
                else if (memcmp(header.identification, "IWAD", 4) != 0 
                        && memcmp(header.identification, "PWAD", 4) != 0 
                        && memcmp(header.identification, "SDLL", 4) != 0) 
                {               
                        CONS_Printf("%s doesn't have IWAD or PWAD id\n", filename); 
                        return MAXSHORT; 
                }                       
                                        
                header.numlumps = LONG(header.numlumps); 
                header.infotableofs = LONG(header.infotableofs); 
                                
                // read wad file directory 
                i = header.numlumps * sizeof (filelump_t); 
                fileinfov = fileinfo = malloc(i); 

                // ***** I modified this part for easier debugging *****

                if (fseek(handle, header.infotableofs, SEEK_SET) == -1) 
                { 
                    printf("**** fseek returned -1, %s\n", strerror(ferror(handle))); 
                    free(fileinfov); 
                    return MAXSHORT; 
                } 
                printf("offset: %d\n", header.infotableofs); 
                size_t foo;     
                if ((foo = fread(fileinfo, 1, i, handle)) < i) 
                { 
                    // CONS_Printf("%s wadfile directory is corrupt; Maybe %s\n", filename, strerror(ferror(handle))); 
                    printf("%s fread failed %s, returned %d, i = %d\n", filename, strerror(ferror(handle)), foo, i); 
                    free(fileinfov); 
                    return MAXSHORT; 
                }

It looks like fread() is actually succeeding, but reading less that i bytes. When I compare the value of i printed by the printf()s that I added to the size of the actaul files, it looks like the value of i is much bigger than the actual files. For example, "sonic.plr" is 358189 bytes, but the value of i for it is 8525496. This makes me think that it's reading the headers wrong. Any ideas on how to fix this, or at least some good documentation on the WAD file format (I don't really know much about it).
 
It looks like fread() is actually succeeding, but reading less that i bytes. When I compare the value of i printed by the printf()s that I added to the size of the actaul files, it looks like the value of i is much bigger than the actual files. For example, "sonic.plr" is 358189 bytes, but the value of i for it is 8525496. This makes me think that it's reading the headers wrong. Any ideas on how to fix this, or at least some good documentation on the WAD file format (I don't really know much about it).

It looks like SRB2CB does not work as a 64-bit program, you going to have to compile it as 32-bit, since it is based on 2.0.4, not 2.0.6, which have 64-bit support.
 
It looks like SRB2CB does not work as a 64-bit program, you going to have to compile it as 32-bit, since it is based on 2.0.4, not 2.0.6, which have 64-bit support.

Is it possibe to modify the code that reads the header so that it doesn't depend on how the CPU stores numbers in memory, or would that not be practical?

And is it not just the header-reading code that's affected by this?
 
Is it possibe to modify the code that reads the header so that it doesn't depend on how the CPU stores numbers in memory, or would that not be practical?

And is it not just the header-reading code that's affected by this?

hell yea, the 2.0.6 code got a workover for 64-bit support and big-endian support.
 
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?
 
Status
Not open for further replies.

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

Back
Top