VOGONS


3dfx voodoo chip emulation

Topic actions

  • This topic is locked. You cannot reply or edit posts.

Reply 40 of 386, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
sliderider wrote:

how would you strip the emulator code out of MAME and incorporate it into DOSBox without violating his IP?

With MAME 0.139u2 (released on August 30th), the Voodoo emulation sourcecode in MAME has been licensed by Aaron Giles under a BSD license, which is compatible with GPL, intentionally for those working on adding something like it to DOSBox.

I worked behind the scenes to make sure the request for assistance didn't fall into the spam-bucket, and I thought it likely Aaron would be able to help. This isn't the first time his MAME code has been "dual-licensed", if I recall correctly. Much of his code or the code that he's extensively rewritten has been licensed that way.
http://www.google.com/search?q=site%3Amamedev … tion+and+use%22

This is something, incidentally, I've wanted for a long time. Good luck, everybody! 😀 We now return you to your regularly scheduled DOSBox program...

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 41 of 386, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

I added a quick line renderer, just to start showing some nice triangle edges; there's still much to do, the code is a mess and many things are unimplemented.
I'm adding the sources, please don't look at the code quality...

And here you are, these are the first screens from the emulated 3dfx in dosbox! I just dumped the raw content of the frame buffer to disk; it would be nice to see it on screen. Have a look at the function swapbuffer in voodoo_func.h to have a clue on how it works.
The game is screamer rally.

Attachments

  • sr_3dfx.png
    Filename
    sr_3dfx.png
    File size
    118.08 KiB
    Views
    9255 views
    File license
    Fair use/fair dealing exception
  • sr_3dfx_2.png
    Filename
    sr_3dfx_2.png
    File size
    20.76 KiB
    Views
    9255 views
    File license
    Fair use/fair dealing exception
  • Filename
    dosbox_20100908.zip
    File size
    998.35 KiB
    Downloads
    458 downloads
    File license
    Fair use/fair dealing exception

Reply 46 of 386, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

the vga.mem.linear trick didn't work under dos of course, because of the different video mode, but worked great when I booted windows.
I managed to fix the page flipping and few other buffer bugs; now I'm playing tomb raider 2, rock stable, in wireframe mode.
About the rendering, I'm afraid that the mame renderer is not covered by bsd license, so it needs to be replaced.

So this is the status:
- the emulation is still unstable and at this moment it's "always on", that means there are data initialization issues
- not all the structures are correctly initialized or deallocated when a game is closed
- clut/gamma/otherthingsidontremenber are mostly not handled
- the renderer must be done from scratch
- a correct video mode switch handling should be implemented
- I simply ignored: timing, chip stall, vblank, retrace, other things mame does and I just don't do or didn't copy
- while glide games seem quite stable, few windows/directx games still crash and need further investigations (see tr3 or moto racer)
- tr1 gives a gp fault
- some aspects of the chip detection are not covered

about the detection routine, the tmu info detection relies on some routines that render triangles and then read the frame buffer (see sst1InitGetTmuInfo in the glide2x dll code), so at this moment it detects a random number of tmu units with 0mb memory each.

As you can see there's quite something left to do; any help in debugging, completing the porting, writing the renderer, cleaning up the code or in any other way will be appreciated 😀
>sources<

Attachments

  • Filename
    dosbox_20100910.zip
    File size
    971.28 KiB
    Downloads
    544 downloads
    File license
    Fair use/fair dealing exception
  • tr2.PNG
    Filename
    tr2.PNG
    File size
    55.52 KiB
    Views
    9041 views
    File license
    Fair use/fair dealing exception

Reply 47 of 386, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

I made some progress with the rasterizer; actually there are just a couple of functions that belong to poly.* and I'm just replacing them, hopefully there should be no license issue.
many games show from messed polys to blank screen, some seem to work better... Texture mapping is not working yet.
I'm having troubles understanding why textures are not rendered correctly while shading/clipping/z work fine (I'm tired...)
I'm attaching the sources as always, just in case someone feel like helping a bit.
Let me know if you manage to run it and if you discover something that may help to fix the bugs.

Attachments

  • tr4.PNG
    Filename
    tr4.PNG
    File size
    121.22 KiB
    Views
    8930 views
    File license
    Fair use/fair dealing exception
  • Filename
    dosbox_20100911.zip
    File size
    974.39 KiB
    Downloads
    616 downloads
    File license
    Fair use/fair dealing exception

Reply 50 of 386, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

another question for the experts: I'm experiencing a strange behavior in vs2008, glide/d3d games start correctly when I run dosbox by launching it from inside the ide (F5, "start debugging"), while they all crash when launching the dosbox executable directly.
I'm building the "release" version, with dosbox internal debugger enabled; the "debug" version seem to run even worse, with random crashes. any clue?

Reply 52 of 386, by Harekiet

User metadata
Rank DOSBox Author
Rank
DOSBox Author

When you run it inside the debugger it might fill the memory differently with 0xcd's instead of 0's when running normally. Either way it would usually mean you're accessing freed memory or going out of bounds or something crazy.

Reply 54 of 386, by kekko

User metadata
Rank Oldbie
Rank
Oldbie
Harekiet wrote:

When you run it inside the debugger it might fill the memory differently with 0xcd's instead of 0's when running normally. Either way it would usually mean you're accessing freed memory or going out of bounds or something crazy.

it seems at startup the voodoo structures are filled with zero either way... other ideas?

Miki Maus wrote:

I've tested Carmageddon, Whiplash and Starfighter 3000 and they didn't work. Is anything else needed in addition to compiled dosbox executable?

run dosbox from within the ide (F5). if under win9x, make sure 3dfx is recognized and the drivers are installed.

Reply 55 of 386, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

run it under valgrind or some other memory profiler/leak checker.
As harekiet pointed out, out of bounds or something like that is usually the cause for the errors.

Water flows down the stream
How to ask questions the smart way!

Reply 56 of 386, by robertmo

User metadata
Rank l33t++
Rank
l33t++
kekko wrote:

another question for the experts: I'm experiencing a strange behavior in vs2008, glide/d3d games start correctly when I run dosbox by launching it from inside the ide (F5, "start debugging"), while they all crash when launching the dosbox executable directly.
I'm building the "release" version, with dosbox internal debugger enabled;

are you completely sure about it? cause for me games sometmes work and sometimes doen't work. And it doesn't matter whether i run dosbox from "start debugging" or from launching the dosbox executable directly.

I noticed when using tomb raider 2 setup test that depending on dosbox start sometimes it works ok, sometimes it doesn't work and sometimes it doesn't work for z buffer or triple buffer in 640x480 and 800x600 so maybe it has something with not enough voodoo memory, maybe sometimes something got stuck in it making less memory available so that you have to disable either z or triple buffer or lower resolution to make test work)

by the way, working games: Quake III Arena, Tomb Raider 5, X-Wing 95

Tomb Raider 3 is making a paging error, so maybe it has nothing to do with your emulation.

Reply 57 of 386, by kekko

User metadata
Rank Oldbie
Rank
Oldbie

It seems that changing memsize to 16 (was higher in config file) resolved my problem, but I can't say why. I tried increasing memory by steps, starting from 16 and games suddenly become unstable again. actually, launching dosbox from the ide, the memsize was 16. I'm wondering if there are errors in my page handler; if you have any suggestion, please let me know.

Reply 58 of 386, by Miki Maus

User metadata
Rank Member
Rank
Member
kekko wrote:

run dosbox from within the ide (F5). if under win9x, make sure 3dfx is recognized and the drivers are installed.

Still doesn't work. DOSBox debug window shows (last 8 eight lines):

 27407217: PCI:reg 4a fct 18; addr 80001848
27407217: PCI:read pci (80001848)
27407217: PCI:reg 4b fct 18; addr 80001848
27407256: PCI:writing address 80001848
27407259: PCI:write 0
27407259: PCI:write 0
27407259: PCI:write 0
27407259: PCI:write 0

Then it just sits there while DOSBox main window shows black screen and dosbox_xd.exe uses about 10-15% of CPU.

All three are DOS games, and Whiplash and Starfighter 3000 are statically linked. Should I boot DOSBox in real MS-DOS?