VOGONS


Tutorial: dosbox with Glide under Linux

Topic actions

First post, by weirdnose

User metadata
Rank Newbie
Rank
Newbie

To play those old gems you need a modified version of dosbox. Modifying dosbox is not too hard and I try to be as clearly as possible.

First of all, I take no responsibility for the health of your system. Use this tutorial at your own risk! You have been warned.

You have to be sudo/root for parts of this tutorial. And also, of course, you need an acclerated card. To make sure that you're system is ready to roll check with the command glxinfo | grep rendering. If it says direct rendering: Yes then you're off to go! If it says no, please find out first how to install accleration on your system.

If you ever run into trouble because a command is not to be found, just check if you can get it by apt-get. E.g. sudo apt-get install patch

Oh, and it looks longer than it actually takes!

  • Get build tools
    sudo apt-get install libsdl1.2-dev libsdl-sound1.2-dev libsdl-net1.2-dev libpcap-dev build-essential cvs
  • Get current OpenGLide version
    cvs -d:pserver:anonymous@openglide.cvs.sourceforge.net:/cvsroot/openglide login

    (When asked for a password, just press Enter)

    cvs -z3 -d:pserver:anonymous@openglide.cvs.sourceforge.net:/cvsroot/openglide co -P openglide

    sudo apt-get install autoconf libtool

    cd openglide

    ./bootstrap

    ./configure
    make
    sudo make install
    If you have a problem with make (an error in gbanner.cpp) open the file, search for include <glide.h> and replace it with include <sdk2_glide.h>. Now enter make clean and then make.
  • Get patch out of forum
    Go to this topic and download both files. Put the patch one folder higher than the dosbox folder. Make sure your dosbox folder is called dosbox.
  • Apply patch
    cat dosbox_glide.diff | patch -p0 
    This should run through without any problems. If not, make sure you have the right cvs version (from the exactly date) and you are one folder level higher than the dosbox folder.
  • Compile dosbox
    Change into the dosbox folder.
    ./autogen.sh

    ./configure CPPFLAGS="-I /usr/local/include/openglide/"

    make

    sudo make install
    Now you have a glide enabled dosbox version on your Linux machine, installed and ready to use! But before we really start off, there are a few settings which have to be checked first.
  • Start dosbox
    It is important that you use the OpenGLide library libglide2x.so and not the one provided from the system. To do that, you have to execute the following line first before starting dosbox.
    export LD_LIBRARY_PATH=/usr/local/lib 

    dosbox
    It is also possible to put both commands into one line if you would like to make a start menu entry.
    LD_LIBRARY_PATH=/usr/local/lib dosbox
    You have to use this every time, otherwise the OpenGLide libraries cannot be found.
  • Write configure file
    In dosbox, use the command
    CONFIG -WRITECONFIG dosbox.conf 
    to write the config file. There is now a dosbox.conf in your current folder. Only if you start dosbox out of this folder you get the configuration. If you want to have this configuration enabled always, copy the file to ~/.dosboxrc
  • Check Glide is enabled
    Exit dosbox and check in dosbox.conf if in the section [glide] it says glide=true
  • Install glide2x.ovl
    Now you have to extract the glide2x.ovl file into the game folder and into the folder where you will start dosbox. Make sure (!) that you rename the file to lowercase with rn Glide2x.ovl glide2x.ovl, otherwise the wrapper cannot find the file!
  • Start dosbox again
    Start dosbox again (don't forget the LD_LIBRARY_PATH command if you are in a new shell)
  • Start the game!
    Change into your favorite game folder, make sure you are starting the 3dfx version and enjoy!

FAQ

1 Q It says "Can't find or access Banshee/V3 board"
1 A Your system supports Voodoo cards natively. This means that you have a libglide2x.so in your /usr/lib folder. Make sure you do export LD_LIBRARY_PATH=/usr/local/lib before running dosbox so dosbox knows where to look.

2 Q The patching of dosbox doesn't work - some hooks or so
2 A Make sure you check out the version with the date provided - copy the command is the easiest choice.

And that's all for now! I hope you enjoy playing those classics and using dosbox as an alternative to Glidos. Anyway, dosbox patched seemed to be the only way to run 3dfx DOS games on Linux. If you enjoyed this you can also always take a look into my blog - just use the address below. And it may be the only way to play DOS games on Linux, but at least there is a way!

Changes:
20.06.2009 - Updated to 0.73 instructions

Last edited by weirdnose on 2009-06-21, 03:57. Edited 1 time in total.

http://www.tobiasmaasland.de/

Reply 1 of 63, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Thanks Weirdnose. Moved to the guides section.

DOSBox 0.73 ReadMe | DOSBox Wiki | DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Win 10 Pro

Reply 2 of 63, by robertmo

User metadata
Rank l33t++
Rank
l33t++

This forum supports only official versions of dosbox so i think you should stick it in dosbox developement subforum (and this discussion too Problems getting Glide Support under Ubuntu - just not sticky 😉 )

Reply 3 of 63, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

Thanks for this great tutorial 😀

You can check the updated patch for 0.73 in the Glide thread and see if it solves some of your problems.

Also...patching is usualy done inside the directory that holdes the sources and -p1 parameter 😉

http://www.si-gamer.net/gulikoza

Reply 4 of 63, by weirdnose

User metadata
Rank Newbie
Rank
Newbie

Hey gulizoka,

dosbox 0.73 + Glide + 3dfx is working flawless.

Just a small suggestion: Could you also put the version number into your patch file the file is supposed to be for? So everyone knows at sight that your file is for e.g. 0.73

Because I got a little mixed up, when I was trying again. Turned out that you'd updated your patch file but I thought it's still the same.

Anyway, thanks for porting this to 0.73!

Regards,

Tobias

http://www.tobiasmaasland.de/

Reply 5 of 63, by Kent-

User metadata
Rank Newbie
Rank
Newbie

Hi. First of all, thanks for this tutorial.

I get an error in "Get current openGlide version" when trying to MAKE

FormatConversion.cpp: Assembler messages: FormatConversion.cpp:469: Error: Incorrect register `%rdi' used with `l' suffix Format […]
Show full quote

FormatConversion.cpp: Assembler messages:
FormatConversion.cpp:469: Error: Incorrect register `%rdi' used with `l' suffix
FormatConversion.cpp:469: Error: Incorrect register `%rsi' used with `l' suffix
FormatConversion.cpp:469: Error: Incorrect register `%rdx' used with `l' suffix

What did I do wrong?

Running Ubuntu 9.04 (Jaunty) x64

Thanks.

Last edited by Kent- on 2009-07-26, 15:16. Edited 1 time in total.

/Kent-

Reply 9 of 63, by Kent-

User metadata
Rank Newbie
Rank
Newbie

Thanks Gulikoza.

Unfortunately, now I got the -fPIC error...

/usr/bin/ld: .libs/FormatConversion.o: relocation R_X86_64_32S against `Mask565R' can not be used when making a shared object; recompile with -fPIC
.libs/FormatConversion.o: could not read symbols: Bad value

I'm guessing that I need to compile it with the -fPIC flag. But I don't know how to do that.

/Kent-

Reply 10 of 63, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

No, more troubles 😀

Change line 430 to read: "movq %6, %%mm4;" and line 462 to read: "m" (Mask565A), "m" (Mask565B), "m" (Mask565G), "m" (Mask565R)

You might then get an error regarding too few registers; in that case move all the Mask* variables inside the Convert565to8888() function.

http://www.si-gamer.net/gulikoza

Reply 14 of 63, by mihal812

User metadata
Rank Newbie
Rank
Newbie

I've got problems getting it to work. When I try to build OpenGLide I get:

bront@bront:~/Downloads/openglide$ make                                       
make all-recursive
make[1]: Entering directory `/home/bront/Downloads/openglide'
Making all in platform
make[2]: Entering directory `/home/bront/Downloads/openglide/platform'
Making all in linux
make[3]: Entering directory `/home/bront/Downloads/openglide/platform/linux'
/bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..
-I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include -march=i686
-fomit-frame-pointer -g -O2 -mmmx -msse -D__unix__ -D__linux__ -I../../platform/linux
-MT clock.lo -MD -MP -MF .deps/clock.Tpo -c -o clock.lo clock.cpp
../../libtool: line 847: X--tag=CXX: command not found
../../libtool: line 880: libtool: ignoring unknown tag : command not found
../../libtool: line 847: X--mode=compile: command not found
../../libtool: line 1014: *** Warning: inferring the mode of operation is deprecated.: command not found
../../libtool: line 1015: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../../libtool: line 1158: Xg++: command not found
../../libtool: line 1158: X-DHAVE_CONFIG_H: command not found
../../libtool: line 1158: X-I.: command not found
../../libtool: line 1158: X-I../..: No such file or directory
../../libtool: line 1158: X-I/usr/local/include/SDL: No such file or directory
../../libtool: line 1158: X-D_GNU_SOURCE=1: command not found
../../libtool: line 1158: X-D_REENTRANT: command not found
../../libtool: line 1158: X-I/usr/include: No such file or directory
../../libtool: line 1158: X-march=i686: command not found
../../libtool: line 1158: X-fomit-frame-pointer: command not found
../../libtool: line 1158: X-g: command not found
../../libtool: line 1158: X-O2: command not found
../../libtool: line 1158: X-mmmx: command not found
../../libtool: line 1158: X-msse: command not found
../../libtool: line 1158: X-D__unix__: command not found
../../libtool: line 1158: X-D__linux__: command not found
../../libtool: line 1158: X-I../../platform/linux: No such file or directory
../../libtool: line 1158: X-MT: command not found
../../libtool: line 1158: Xclock.lo: command not found
../../libtool: line 1158: X-MD: command not found
../../libtool: line 1158: X-MP: command not found
../../libtool: line 1158: X-MF: command not found
../../libtool: line 1158: X.deps/clock.Tpo: No such file or directory
../../libtool: line 1158: X-c: command not found
../../libtool: line 1211: Xclock.lo: command not found
../../libtool: line 1216: libtool: compile: cannot determine name of library object from `': command not found
make[3]: *** [clock.lo] Ошибка 1
make[3]: Leaving directory `/home/bront/Downloads/openglide/platform/linux'
make[2]: *** [all-recursive] Ошибка 1
make[2]: Leaving directory `/home/bront/Downloads/openglide/platform'
make[1]: *** [all-recursive] Ошибка 1
make[1]: Leaving directory `/home/bront/Downloads/openglide'
make: *** [all] Ошибка 2
bront@bront:~/Downloads/openglide$

Editing libtool script doesn't work.
System: Debian Sid, GCC 4.3.4-1, all necessary packages are installed.

Reply 15 of 63, by Hinrik

User metadata
Rank Newbie
Rank
Newbie

gulikoza: The latest DOSBox (2009-11-24 svn) doesn't compile with your patch:

$ patch -p1 < /tmp/foo/dosbox_glide.diff 
patching file include/glidedef.h
patching file include/glide.h
patching file include/mem.h
patching file src/dosbox.cpp
patching file src/gui/sdlmain.cpp
Hunk #2 succeeded at 350 (offset 1 line).
Hunk #3 succeeded at 692 (offset 1 line).
Hunk #4 succeeded at 1417 (offset 1 line).
Hunk #5 succeeded at 1769 (offset 1 line).
patching file src/hardware/glide.cpp
patching file src/hardware/Makefile.am
patching file src/hardware/memory.cpp
patching file src/hardware/vga_draw.cpp
Hunk #2 succeeded at 1433 (offset 68 lines).

...

$ make
...

g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -I /home/hinrik/src/openglide/ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -g -O2 -MT glide.o -MD -MP -MF .deps/glide.Tpo -c -o glide.o glide.cpp
glide.cpp: In constructor ‘GLIDE::GLIDE(Section*)’:
glide.cpp:258: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glide.cpp: In constructor ‘GLIDE::GLIDE(Section*)’:
glide.cpp:258: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glide.cpp: In constructor ‘GLIDE::GLIDE(Section*)’:
glide.cpp:258: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glide.cpp: In function ‘void process_msg(Bitu)’:
glide.cpp:476: error: ‘MAX_PATH’ was not declared in this scope
glide.cpp:774: error: ‘filename’ was not declared in this scope
make[4]: *** [glide.o] Error 1
make[4]: Leaving directory `/home/hinrik/src/dosbox/src/hardware'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/hinrik/src/dosbox/src/hardware'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/hinrik/src/dosbox/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/hinrik/src/dosbox'
make: *** [all] Error 2

I'm doing this on an x86-64 Ubuntu 9.10, with the latest cvs version of OpenGlide.

Reply 17 of 63, by Hinrik

User metadata
Rank Newbie
Rank
Newbie

Alright. DOSBox compiles now, but when I run it with glide enabled I get this:

Glide:LFB access: read-write
Glide:Unable to load glide2x library, glide emulation disabled

According to hardware/glide.cpp, this means it was unable to load libglide2x.so:

#if defined(WIN32)
hdll = LoadLibrary("glide2x.dll");
#elif defined(MACOSX)
hdll = dlopen("libglide2x.dylib", RTLD_NOW);
#else
hdll = dlopen("libglide2x.so", RTLD_NOW);
#endif

if(!hdll) {
LOG_MSG("Glide:Unable to load glide2x library, glide emulation disabled");
return;
}

But according to strace, I know that it is at least successfully opening the file:

$ LD_LIBRARY_PATH=/usr/local/lib strace dosbox
...
write(1, "Glide:LFB access: read-write\n", 29) = 29
open("glide2x.ovl", O_RDONLY) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=31223, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f239f062000
fstat(11, {st_mode=S_IFREG|0644, st_size=31223, ...}) = 0
lseek(11, 28672, SEEK_SET) = 28672
read(11, "\25\30\1\0\0\260r\356\302\10\0\241\20\1\0\0\243\24\1\0\0\243\10\1\0\0\307\0\0\0\0\0"..., 2551) = 2551
lseek(11, 0, SEEK_SET) = 0
read(11, "MZ\200\0\1\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 28672) = 28672
read(11, "\25\30\1\0\0\260r\356\302\10\0\241\20\1\0\0\243\24\1\0\0\243\10\1\0\0\307\0\0\0\0\0"..., 4096) = 2551
close(11) = 0
munmap(0x7f239f062000, 4096) = 0
open("/usr/local/lib/libglide2x.so", O_RDONLY) = 11
read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\343\0\0\0\0\0\0"..., 832) = 832
fstat(11, {st_mode=S_IFREG|0755, st_size=516652, ...}) = 0
mmap(NULL, 19503272, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 11, 0) = 0x7f239ddc9000
mprotect(0x7f239ddea000, 2097152, PROT_NONE) = 0
mmap(0x7f239dfea000, 143360, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 11, 0x21000) = 0x7f239dfea000
mmap(0x7f239e00d000, 17127592, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f239e00d000
close(11) = 0
open("/usr/local/lib/libGLU.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=104843, ...}) = 0
mmap(NULL, 104843, PROT_READ, MAP_PRIVATE, 11, 0) = 0x7f23a854d000
close(11) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/libGLU.so.1", O_RDONLY) = 11
read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0L\0\0\0\0\0\0"..., 832) = 832
fstat(11, {st_mode=S_IFREG|0644, st_size=461488, ...}) = 0
mmap(NULL, 2556512, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 11, 0) = 0x7f239db58000
mprotect(0x7f239dbc7000, 2093056, PROT_NONE) = 0
mmap(0x7f239ddc6000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 11, 0x6e000) = 0x7f239ddc6000
close(11) = 0
mprotect(0x7f239ddc6000, 8192, PROT_READ) = 0
munmap(0x7f23a854d000, 104843) = 0
munmap(0x7f239ddc9000, 19503272) = 0
munmap(0x7f239db58000, 2556512) = 0
write(1, "Glide:Unable to load glide2x lib"..., 63) = 63
...

Reply 18 of 63, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

You can change the LOG_MSG line:

LOG_MSG("Glide:Unable to load glide2x library, glide emulation disabled: %s", dlerror());

so you'll get an exact error why the load fails.

http://www.si-gamer.net/gulikoza