![]() |
Last Visit : never :: 2010-8-01 @ 01:50 am : Now | |||
FAQ |
Search |
Memberlist |
Usergroups |
|
Register |
Profile |
Messages |
Log in |
|
| Forum Index :: DOSBox Development :: | |
Glide patch
|
|
|---|---|
Glide patch :: 2007-8-20 @ 11:49 am
|
|
|
gulikoza Oldbie Joined: 2004-06-25 Posts: 1265 |
This patch has been available for a while now in ykhwong's builds. It allows DOSBox to run DOS Glide games (not all of them though) and now I am also releasing the source. The patch is composed of two (3 if you count glide wrapper) parts.
The first part is the GLIDE2X.OVL file. This is a DOS (kinda) DLL file that games use to access the Voodoo board. This OVL has been rewritten to talk to DOSBox instead of the Voodoo board. The file has to be present in the game directory (or somewhere in the path inside DOSBox, it can also be present in DOSBox directory; in this case it will automatically be added to the Z: drive) and is platform independent (since it runs inside DOSBox). There are games which directly access the Voodoo board without loading the OVL file. These games will not work with this patch (these are mostly early 3dfx games/demos: original [not Voodoo Rush] Tomb Rider patch, Fatal Racing, Eurofighter 2000...) and will never work unless true hardware emulation is written. The second part is the DOSBox patch. The patch should be relatively easy to apply and compile, it only requires a few 3dfx headers (sdk2_*.h files) which are available in the OpenGlide cvs. You need to run autogen.sh before running configure. The patch should be fairly crossplatform, but only Linux (x86 & x64) and Windows have been tested so far... These two patches allow games to access Glide on the host computer. But since most of you do not have Voodoo boards anymore (Glide DOSBox version has been tested to work with true Voodoo2 board in Win98 without any wrappers ) a glide wrapper is also required. You can use any wrapper you like, but some might work better or worse. The tested ones are:
- OpenGlide (see patches here) - dgVoodoo (be sure to set it to render in window mode) - zeckensack's (switches to fullscreen automatically) - psvoodoo but the first 2 are usually the recommended ones. Some games might work better with OpenGlide, others with dgVoodoo, but OpenGlide is the only one crossplatform. MAC users, see MACGlide and it might be possible with some simple patches to get OpenGlide to work as well. But DOSBox patch has not been tested on Mac at all (Update: DOSBox-Glide has been tested to work on MacOSX, see this thread for OpenGlide patches, use latest dosbox_glide patch).
Currently, the following games have been tested: Archimedean Dynasty (wrapper related graphics corruption) Blood (works with dgvooodoo) Carmageddon (works with dgVoodoo afaik) Descent2 (works with openglide, use the unofficial 3dfx patch) Dreams to Reality (not working, DOSBox problem -> software version also does not work) Extreme Assault (DEMO version works, full version not tested...) GTA (no problems) Lands of Lore 2 (works fine, some wrapper related problems) RedGuard (no problems) Screamer 2 & Rally (a bit slow with openglide, works fine with dgvoodoo if LFB access is disabled) TombRider (no problems, use the patch from Eidos, search for Voodoo Rush patch if the link is broken) For testing purposes, free Glide SDK tests can be found on the net, which should all work fine. PROBLEMS: - OpenGlide (some recent cvs version should be fine) has some serious drawbacks and performance issues. For now, use the version in my builds or compile your own version with the patches (most of the patches have been already commited) - When glide is active, the wrapper is in control of the DOSBox window. This means that DOSBox window related options (resolution, scaler, ...) do not work - Because of that, ALT-Enter fullscreen switch will not work as desired. In OpenGlide you have to edit OpenGLid.ini to have fullscreen, other wrappers work in fullscreen by default. With dgVoodoo, if you set the renderer to Direct3D9, ALT-Enter should work ok! (at least it does on my computer )
- If you receive warnings like "Glide:Warning, unable to load grSstConfigPipeline from glide2x", it's not a problem. These are just functions that the particular wrapper does not support...unless of course the game happens to use them, but that will show as another error
- Do not use the mapper when Glide is running - If you like, you can place 3dfxSpl2.dll from the voodoo drivers in the DOSBox directory and you will see 3dfx splash screen when Glide activates
Updates: 22.8.2007: Fix compilation problems 23.8.2007: Fix buffer overflow 28.8.2007: x86_64 support 03.9.2007: Fix a crash when closing dosbox while glide is active 18.10.2007: Add TombRaider shadow hack (thanks gidierre!) 06.11.2007: Improve TR shadow support (gidierre) 17.2.2008: Updated for current CVS 14.9.2008: Updated for current CVS, allow disabling LFB reads/writes 04.6.2009: Updated for 0.73, add MSVC6 projects for glide2x win9x build 30.8.2009: Fix LFB operations when paging is active 09.10.2009: Various fixes and code cleanups, fix originlocation + splash screen 24.11.2009: Fix some minor issues, add MacOSX support (!) Last edited by gulikoza on 2009-11-24 @ 02:42 pm; edited 20 times in total _________________ DOSBoxcvs-090407 + patches (4.7.2009): http://www.si-gamer.net/gulikoza |
|
|
Re: Glide patch :: 2007-8-21 @ 08:09 am
|
|
|
wd DOSBox Author Joined: 2003-12-03 Posts: 9334 |
Nice, thanks ![]() |
|
|
Re: Glide patch :: 2007-8-21 @ 09:57 am
|
|
|
qsonic Newbie Joined: 2007-07-27 Posts: 11 Location: Austria |
Very cool indeed, works perfectly.
Adding to your note about Archimedean Dynasty: the game seems to display graphics fine using Zeckensacks wrapper, although it has windowing issues (at least for me, controlling the game with his wrapper is impossible). Seems like OpenGlide has a variety of issues as of now... Hope to be able to fix a couple of them. |
|
|
Re: Glide patch :: 2007-8-21 @ 10:09 am
|
|
|
gulikoza Oldbie Joined: 2004-06-25 Posts: 1265 |
Thanks, haven't tried it with zeckensack's yet
Try to set the configuration to render in the game window (the default option is to render in it's own window). But it's still somewhat annoying since it will switch resolutions. Somebody has to hexedit the dll and NOP that ChangeDisplaySetting call ![]() _________________ DOSBoxcvs-090407 + patches (4.7.2009): http://www.si-gamer.net/gulikoza |
|
|
Re: Glide patch :: 2007-8-21 @ 05:28 pm
|
|
|
qsonic Newbie Joined: 2007-07-27 Posts: 11 Location: Austria |
Oh, I forgot to mention I am compiling with VC8, and for anyone who wants to do that, as well:
1.) Add the files which the patch adds to the source tree to the VC project file, namely: src\hardware\glide.cpp include\glide.h include\glidedef.h 2.) Change these 2 lines in glide.cpp: Line 393: typedef FxBool FX_CALL (*pfxSplashInit)(FxU32 hWnd, FxU32 screenWidth, FxU32 screenHeight, To: typedef FxBool (FX_CALL *pfxSplashInit)(FxU32 hWnd, FxU32 screenWidth, FxU32 screenHeight, Line 395: typedef void FX_CALL (*pfxSplash)(float x, float y, float w, float h, FxU32 frameNumber); To: typedef void (FX_CALL *pfxSplash)(float x, float y, float w, float h, FxU32 frameNumber); |
|
|
Re: Glide patch :: 2007-8-22 @ 01:51 pm
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
Hi,
I just tried the patch on Linux, but it fails when compiling glide.cpp: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -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 ../../include/sdk2_glide.h:53: error: expected `)' before ‘*’ token glide.cpp: In constructor ‘GLIDE::GLIDE(Section*)’: glide.cpp:204: error: expected primary-expression before ‘void’ glide.cpp:204: error: expected `)' before ‘void’ glide.cpp: At global scope: glide.cpp:393: error: typedef ‘__stdcall’ is initialized (use __typeof__ instead) glide.cpp:393: error: ‘pfxSplashInit’ was not declared in this scope glide.cpp:395: error: typedef ‘__stdcall’ is initialized (use __typeof__ instead) glide.cpp:395: error: ‘pfxSplash’ was not declared in this scope and then the make process fails, quitting with an error... Looking at line 53 of sdk2_glide.h, the "culprit" is this one: typedef void (FX_CALL *GrProc)(); It probably isn't a matter of g++ 4.1 vs 3.4, because I tried them both with the same result: besides, I successfully installed Openglide CVS using 4.1. What could be the reason? Thanks in advance, hope to hear from you soon! |
|
|
Re: Glide patch :: 2007-8-22 @ 02:04 pm
|
|
|
gulikoza Oldbie Joined: 2004-06-25 Posts: 1265 |
There's one ) missing at glide.cpp:204. The 393 error is probably the same as qsonic reported, will check what's wrong at sdk2_glide.h:53 and fix my patch accordingly ![]() _________________ DOSBoxcvs-090407 + patches (4.7.2009): http://www.si-gamer.net/gulikoza |
|
|
Re: Glide patch :: 2007-8-22 @ 02:17 pm
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
I managed to turn around the compilation problems this way:
1) I forced the defines of FX_ENTRY and FX_CALL to #define FX_ENTRY extern #define FX_CALL in sdk2_3dfx.h, because otherwise it kept introducing __stdcall which doesn't exist in Linux; 2) I didn't notice the mixxing bracket at line 204, you're right; however, I just removed the (void*) caster, since dlsym already returns a void*, and it compiled fine. Unfortunately, dosbox crashes when trying to start it... Quote: CONFIG:Loading primary settings from config file dosbox.conf
ALSA:Client initialised [17:0] MIDI:Opened device:alsa Glide:Warning, unable to load grSstConfigPipeline from glide2x Glide:Warning, unable to load grSstVidMode from glide2x Glide:Warning, unable to load guMPDrawTriangle from glide2x Glide:Warning, unable to load guMPInit from glide2x Glide:Warning, unable to load guMPTexCombineFunction from glide2x Glide:Warning, unable to load guMPTexSource from glide2x Glide:Warning, unable to load guMovieSetName from glide2x Glide:Warning, unable to load guMovieStart from glide2x Glide:Warning, unable to load guMovieStop from glide2x Segmentation fault This is the backtrace: Quote: [Thread debugging using libthread_db enabled]
[New Thread -1208506640 (LWP 13227)] [New Thread 25160592 (LWP 13230)] CONFIG:Loading primary settings from config file dosbox.conf [New Thread 35650448 (LWP 13231)] ALSA:Client initialised [17:0] MIDI:Opened device:alsa Glide:Warning, unable to load grSstConfigPipeline from glide2x Glide:Warning, unable to load grSstVidMode from glide2x Glide:Warning, unable to load guMPDrawTriangle from glide2x Glide:Warning, unable to load guMPInit from glide2x Glide:Warning, unable to load guMPTexCombineFunction from glide2x Glide:Warning, unable to load guMPTexSource from glide2x Glide:Warning, unable to load guMovieSetName from glide2x Glide:Warning, unable to load guMovieStart from glide2x Glide:Warning, unable to load guMovieStop from glide2x Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1208506640 (LWP 13227)] 0x00ceff5c in malloc_consolidate () from /lib/libc.so.6 (gdb) bt #0 0x00ceff5c in malloc_consolidate () from /lib/libc.so.6 #1 0x00cf20bd in _int_malloc () from /lib/libc.so.6 #2 0x00cf3ebe in malloc () from /lib/libc.so.6 #3 0x07a42557 in operator new () from /usr/lib/libstdc++.so.6 #4 0x07a1dc0b in std::string::_Rep::_S_create () from /usr/lib/libstdc++.so.6 #5 0x07a1e7a8 in std::string::_Rep::_M_clone () from /usr/lib/libstdc++.so.6 #6 0x07a1f358 in std::string::reserve () from /usr/lib/libstdc++.so.6 #7 0x07a18003 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow () from /usr/lib/libstdc++.so.6 #8 0x07a1cdd1 in std::basic_streambuf<char, std::char_traits<char> >::xsputn () from /usr/lib/libstdc++.so.6 #9 0x07a1217b in std::operator<< <std::char_traits<char> > () from /usr/lib/libstdc++.so.6 #10 0x080e8841 in GLIDE_Init (sec=0x9e92158) at /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/ostream.tcc:86 #11 0x081c4f5b in Section::ExecuteInit (this=0x9e92158, initall=true) at /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_list.h:131 #12 0x081c4f95 in Config::Init (this=0xbfb88070) at /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_list.h:212 #13 0x080fa877 in main (argc=1, argv=0xbfb88134) at sdlmain.cpp:1499 The dosbox.conf I used is exactly the same as the one I used wih the stable dosbox, with the only addons being the [glide] context copied from ykhwong's one. Any idea what it could be? |
|
|
Re: Glide patch :: 2007-8-22 @ 03:32 pm
|
|
|
gulikoza Oldbie Joined: 2004-06-25 Posts: 1265 |
Okay...fixed the compilation problems, the patch is updated in the first post.
But this crash is strange...I can't reproduce it, and it crashes somewhere inside malloc?? _________________ DOSBoxcvs-090407 + patches (4.7.2009): http://www.si-gamer.net/gulikoza |
|
|
Re: Glide patch :: 2007-8-22 @ 04:01 pm
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
Just tried recompiling with your new patch, and now it compiles fine without having to touch anything. I also added --enable-debug to see if it gave me more info about the crash. However, now it didn't crash at all!
So I made a few tests: The 3dfx diagnostic kit tests worked fine; Tomb Raider also did start fine, even if it crashed when leaving the game; Redguard instead crashed after leaving the game menu, which, as it was in ykhwong's build, was corrupt anyway (the main diary page is invisible, you can see the side of the book on the right). But it's a great step ahead from the previous issues ![]() |
|
|
Re: Glide patch :: 2007-8-22 @ 04:20 pm
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
I recompiled disabling the debug, and dosbox crashes again on startup... it looks like debug mode made it more fault tolerant. ![]() |
|
|
Re: Glide patch :: 2007-8-22 @ 06:53 pm
|
|
|
`Moe` Barkeeper Joined: 2004-04-29 Posts: 1180 Location: Oldenburg, Germany |
Crashes inside malloc usually result from a buffer overrun that has clobbered malloc's data structures. A double free might also apply, but IIRC modern glibcs should detect those.
BTW, is that a 32-bit or a 64-bit build? |
|
|
Re: Glide patch :: 2007-8-22 @ 11:00 pm
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
Hi Moe,
it's a 32-bit build, in a Fedora 7 OS. Let me know if there's anything I can do to help you sort out the problem. |
|
|
Re: Glide patch :: 2007-8-23 @ 11:57 am
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
Investigating the issues another bit, I found out a line where the problem might be. The backtrace reports:
Code: (gdb) bt
#0 0x00ceff5c in malloc_consolidate () from /lib/libc.so.6 #1 0x00cf20bd in _int_malloc () from /lib/libc.so.6 #2 0x00cf3ebe in malloc () from /lib/libc.so.6 #3 0x07a42557 in operator new () from /usr/lib/libstdc++.so.6 #4 0x07a1dc0b in std::string::_Rep::_S_create () from /usr/lib/libstdc++.so.6 #5 0x07a1e7a8 in std::string::_Rep::_M_clone () from /usr/lib/libstdc++.so.6 #6 0x07a1f358 in std::string::reserve () from /usr/lib/libstdc++.so.6 #7 0x07a18003 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow () from /usr/lib/libstdc++.so.6 #8 0x07a1cdd1 in std::basic_streambuf<char, std::char_traits<char> >::xsputn () from /usr/lib/libstdc++.so.6 #9 0x07a1217b in std::operator<< <std::char_traits<char> > () from /usr/lib/libstdc++.so.6 #10 0x080eca53 in GLIDE (this=0xabf5c80, configuration=0xabc2158) at glide.cpp:217 #11 0x080ec309 in GLIDE_Init (sec=0xabc2158) at glide.cpp:268 #12 0x081d4655 in Section::ExecuteInit (this=0xabc2158, initall=true) at setup.cpp:271 #13 0x081d4ca8 in Config::Init (this=0xbfd6f25c) at setup.cpp:256 #14 0x080ff887 in main (argc=Cannot access memory at address 0x1 ) at sdlmain.cpp:1499 The overflow appears when compiling a string at the line: Code: ostringstream temp;
temp << "SET GLIDE=" << hex << setw(3) << glide_base << ends; I have no idea why such an operation should fail, I guess temp is correctly initialized... however, considering glide_base is statically set up as 0x300, I removed those lines and forced a static Code: autoexecline.Install("SET GLIDE=0x300");
which should do the same. Doing this, dosbox stops crashing at that point but crashes somewhere else: Code: Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208301840 (LWP 14368)] 0x00ceff5c in malloc_consolidate () from /lib/libc.so.6 (gdb) bt #0 0x00ceff5c in malloc_consolidate () from /lib/libc.so.6 #1 0x00cf20bd in _int_malloc () from /lib/libc.so.6 #2 0x00cf3ebe in malloc () from /lib/libc.so.6 #3 0x07a42557 in operator new () from /usr/lib/libstdc++.so.6 #4 0x080aa2a4 in DOS_SetupFiles () at dos_files.cpp:1091 #5 0x080a7690 in DOS (this=0xa0a0630, configuration=0xa06b278) at dos.cpp:1089 #6 0x080a5149 in DOS_Init (sec=0xa06b278) at dos.cpp:1122 #7 0x081d40e5 in Section::ExecuteInit (this=0xa06b278, initall=true) at setup.cpp:271 #8 0x081d4738 in Config::Init (this=0xbff72c5c) at setup.cpp:256 #9 0x080ff317 in main (argc=Cannot access memory at address 0x1 ) at sdlmain.cpp:1499 These errors are related to setting up the file systems, so I really have no idea how I could mess around with this... I hope all this helped, hope to hear from you soon. |
|
|
Re: Glide patch :: 2007-8-23 @ 11:59 am
|
|
|
Qbix DOSBox Author Joined: 2002-11-27 Posts: 8229 Location: Fryslan |
your stack is allready corrupt before that.
have you tried running it through valgrind ? _________________ Water flows down the stream How to ask questions the smart way |
|
|
Re: Glide patch :: 2007-8-23 @ 12:06 pm
|
|
|
gulikoza Oldbie Joined: 2004-06-25 Posts: 1265 |
The autoexec line is not even needed. And it is created the same way as other autoexec lines (sblaster...)
Something seems very wrong here. If you start with glide disabled (or even without the patch compiled in), does dosbox work?? _________________ DOSBoxcvs-090407 + patches (4.7.2009): http://www.si-gamer.net/gulikoza |
|
|
Re: Glide patch :: 2007-8-23 @ 12:16 pm
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
I just did it, you can find the output in the attached file. Running through Valgrind doesn't make dosbox crash (as the dosbox --enable-debug did). However, trying one of the 3dfx tests freezes dosbox.
My guess is the problem starts here: Code: ==14936== Invalid write of size 4
==14936== at 0x80EC8CB: GLIDE::GLIDE(Section*) (glide.cpp:204) ==14936== by 0x80EC308: GLIDE_Init(Section*) (glide.cpp:268) ==14936== by 0x81D4664: Section::ExecuteInit(bool) (setup.cpp:271) ==14936== by 0x81D4CB7: Config::Init() (setup.cpp:256) ==14936== by 0x80FF896: main (sdlmain.cpp:1499) ==14936== Address 0x4D0F384 is 0 bytes after a block of size 516 alloc'd ==14936== at 0x40054E5: malloc (vg_replace_malloc.c:149) ==14936== by 0x80EC88D: GLIDE::GLIDE(Section*) (glide.cpp:192) ==14936== by 0x80EC308: GLIDE_Init(Section*) (glide.cpp:268) ==14936== by 0x81D4664: Section::ExecuteInit(bool) (setup.cpp:271) ==14936== by 0x81D4CB7: Config::Init() (setup.cpp:256) ==14936== by 0x80FF896: main (sdlmain.cpp:1499) ==14936== but I'm not sure of it... |
|
|
Re: Glide patch :: 2007-8-23 @ 12:18 pm
|
|
|
Rainmak3r Newbie Joined: 2007-08-18 Posts: 18 |
Yes, with glide disabled dosbox works just fine, so it surely is a problem in the glide initialization somewhere... |
|
|
Re: Glide patch :: 2007-8-23 @ 12:56 pm
|
|
|
gulikoza Oldbie Joined: 2004-06-25 Posts: 1265 |
That malloc might indeed be 1 element too small
try fn_pt = (void**)malloc(sizeof(void*)*(GLIDE_END-GLIDE_START)+1); _________________ DOSBoxcvs-090407 + patches (4.7.2009): http://www.si-gamer.net/gulikoza |
|
|
Re: Glide patch :: 2007-8-23 @ 01:03 pm
|
|
|
Qbix DOSBox Author Joined: 2002-11-27 Posts: 8229 Location: Fryslan |
if it 1 element shouldn't it be
fn_pt = (void**)malloc(sizeof(void*)*(GLIDE_END-GLIDE_START+1)); _________________ Water flows down the stream How to ask questions the smart way |
|
|
|
page 1 of 8
|
|
| All times are GMT |
| Moderate |
|---|
| Quick Reply & Options | |
|---|---|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum |
|
2002-2003 zetafleet.dom.