Page 1 of 1

Port of the Software Renderer to Linux

Posted: Sun Mar 12, 2006 7:59
by Jim
Graf, I decided to port the software renderer to Linux (adding the missing system files from ZDoom's Linux port). I simply only included the files that don't require OpenGL or when necessary stubbed the hardware functions for now. Anyway, this seemed like a good first step to porting it to Linux.

Anyway, I got it to compile with changes here as previously described, with changes necessary here and there. (Also, all the source files need to be named in lowercase).

However, when I run it it seems like it is finding and loading the IWAD, then it fails when looking for the first texture.

Code: Select all

Please select a game wad:
1. DOOM 2: Hell on Earth (doom2.wad)
2. DOOM 2: Plutonia Experiment (plutonia.wad)
3. DOOM 2: TNT - Evilution (tnt.wad)
4. The Ultimate DOOM (doom.wad)
5. Heretic: Shadow of the Serpent Riders (heretic.wad)
6. Hexen: Beyond Heretic (hexen.wad)
7. Hexen: Deathkings of the Dark Citadel (hexdd.wad)
8. Strife: Quest for the Sigil (strife1.wad)
Which one? 4
 adding gzdoom.pk3
 adding ./doom.wad (2306 lumps)
CPU Speed: ~866.599060 MHz
CPU Vendor ID: GenuineIntel
  Family 6, Model 8, Stepping 3
  Features: MMX SSE
I_InitSound: Initializing FMOD
  Setting ALSA (Advanced Linux Sound Architecture) output succeeded
  Setting driver 0 succeeded
  Initialization succeeded
Using software 3D sound
W_GetNumForName: DBIGFONT not found!
I have attached the patch. Any suggestions?

Edit: Resolved. Updated patch below.

Posted: Sun Mar 12, 2006 10:54
by Graf Zahl
I can't run your patch because it gives me this error:

Code: Select all

patching file `cbuild.c'
patching file `cmdlib.cpp'
patching file `default.cbd'
patching file `fragglescript/t_func.h'
patching file `fragglescript/t_oper.cpp'
patching file `fragglescript/t_oper.h'
patching file `fragglescript/t_parse.cpp'
missing header for unified diff at line 2502 of patch
can't find file to patch at input line 2502
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|3,7 +223,11 @@
|       linestart = rover;      // save the start
|
|       if (rover[0]=='0' && rover[1]=='x')
|+              #ifdef _MSC_VER
|               __asm nop
|+              #else
|+              asm("nop");
|+              #endif
|       if(*rover)
|               while(1)
|               {
--------------------------

Posted: Sun Mar 12, 2006 19:22
by Jim
Okay, try the new patch. The problem was that diff prints

Code: Select all

\ No newline at end of file
in the locale the diff is done and then I think patch looks for it in the language of the locale it is run in.

I just removed those parts of the patch since they didn't really matter anyway. GCC just bitches about there being no newline at the end of files, which annoyingly obscures more important warnings.

Posted: Mon Mar 13, 2006 18:49
by Jim
Okay, I realize now that the error is not that the IWAD isn't being loaded correctly, but that gzdoom.pk3 isn't being loaded correctly. I got past that error by loading zdoom.wad.

Posted: Mon Mar 13, 2006 19:44
by Graf Zahl
Check the alignment settings in w_zip.h. I don't know how to change them for GCC but it is necessary to align some of the header structs to words instead of dwords.

Posted: Sun Mar 19, 2006 23:21
by Jim
Okay, I fixed the problems I mentioned. Randy wrote strupr incorrectly (its behavior is undefined according to the C or C++ language specs). Since you used it for the zip loading, none of those lumps were loaded under the correct name. I also used gcc's method for packing structures. Still, GZDoom would crash on startup.

However, when I ported everything to GZDoom 1.0.03, it no longer crashes on startup! Please apply the patch as-is into the next version of GZDoom. (GCC uses not as a synonym for ! and "" cannot be assigned to a char* unless it is typecast).

I also changed the directories to .gzdoom from .zdoom so they wouldn't share the same configuration file. I had problems with ZDoom crashing when they used the same config file.

You forgot one last renaming:
move src/fragglescript/t_Saveg.cpp src/fragglescript/t_saveg.cpp

Edit:
It seems that GCC has supported #pragma packed() since at least version 3, so I posted a new patch without any changes made to w_zip.h. Also, I fixed up the files in src/gl/, except for those in src/gl/r_render. So everything in src/gl/ (except files in the r_render subdirectory) is pretty much Linux ready. I made that a separate patch since it is only important for the future (or probably for compiling with MinGW).

Posted: Sat Apr 01, 2006 22:45
by Jim
Well, since you didn't apply my patches (or even just the one that got the software renderer compiling), I have to make them again. You still have to:
move src/fragglescript/t_Saveg.cpp src/fragglescript/t_saveg.cpp

I have attached the patch for the software compilation issues. I'll redo the other one later.

Graf, please let me know if and when you have applied this patch and future patches (and when you do not, why you did not).

Also, a reminder to anyone running gzdoom or zdoom under Linux: You will get very poor performance if you use SDL's default X11 driver. You will get significantly better performance using DRI. That can be done by running

Code: Select all

export SDL_VIDEODRIVER=dga && ./zdoom
provided your user has permission to use DRI.

Posted: Sun Apr 02, 2006 0:24
by Graf Zahl
For some reason the patch doesn't get applied for me. Do I have to use some specific command line parameters?

Posted: Sun Apr 02, 2006 2:31
by Jim
The patch applies fine for me without anything special (other than first renaming t_Saveg.cpp -> t_saveg.cpp), but try this from inside the main directory:

Code: Select all

patch -lp1<../gzdoom-1.0.04-linux.diff
If that doesn't work (the -l makes patch permissive regarding whitespace characters), then what does it say is happening when you use --verbose?

Another suggestion: try explicitly specifying -u to say it is a unified diff.

Posted: Sun Apr 02, 2006 9:26
by Graf Zahl
I have no idea what is happening. patch.exe says it is patching the files but the results are identical with the old versions. Can it be that your .diff is incompatible with my patch.exe?

When I add --verbose it is simply crashing. Can't you just zip the altered files and attach that to your post?

Posted: Sun Apr 02, 2006 10:04
by Jim
Okay, but just for testing sake, I also added a patch that does not have diff use the ignore whitespace differences flag (-w). (I only use this option to avoid diffs with all kinds of extra lines due to line-end differences). Could you try that first, so I know for the future?

Posted: Sun Apr 02, 2006 11:13
by Graf Zahl
Yes, this patch did work.