VOGONS


NVIDIA NV1 Wrapper

Topic actions

First post, by blueshogun96

User metadata
Rank Newbie
Rank
Newbie

Hey everyone, blueshogun here. I've been interested in writing an NV1 wrapper (or at least attempt one) so I can play some of those old NV1 based games such as Panzer Dragoon. I know this isn't going to be an easy thing to do here, but I wanted to at least try. So far, I've managed to write some basic wrapper .dlls required for the game to run. Fortunately, I have a copy of IDA pro laying around so I was able to dissassemble the required .dll files (which come with the nv1 driver package: NVAPI.DLL and NVVIDMON.DLL) and find out which functions are being exported and such. So far, There are 19 total functions, and one pointer variable (string?) being exported from both DLLs. Here's what I found:

NVAPI.DLL (17
- NvOpen();
- NvClose( Unknown1 );
- NvNotifyMsg( Unknown1, Unknown2, Unknown3 );
- NvErrorMsg( Unknown1, Unknown2, Unknown3 );
- NvWait();
- NvGetFlatDataSelector();
- NvGetFlatCodeSelector();
- NvConfigVersion();
- NvConfigGet( Unknown1 );
- NvConfigSet( Unknown1, Unknown2 );
- NvConfigUpdate( Unknown );
- NvGetHardwarePointers( Unknown1, Unknown2, Unknown3, Unknown4 );
- NvDeviceBaseGet( Unknown );
- NvDeviceLimitGet( Unknown );
- NvDeviceSelectorGet( Unknown );
- NvSysOpen( Unknown );
- NvSysClose( Unknown );

- THK_ThunkData32 (36 bytes)

NVVIDMOD.DLL
- NvRequestVideoMode( DEVMODE* _devicemodeA, Unknown1, DWORD Unknown2, Unknown3 );
- NvRestoreVideoMode();

So I wrote my own empty implementations of these functions inside of the aptly named fake .DLLs, and I got a prompt from the game to put in the CD. Now, if any of you have ever tried running this game on Windows running a higher end GeForce card, you might get an error message pertaining to ThunkConnect32 not being found in NVAPI.DLL. That's because the game was expecting to find the NV1 version of NVAPI.DLL; the newer cards do contain a NVAPI.DLL in the driver package. Just thought I'd throw that in there as it took me a moment to find out about the .DLL referencing problem. In order for the wrapper to work, we have to have 2 .DLLs, not just one. While the .DLLs don't do anything but crash the game atm, I'm slowly but surely learning how these .dlls function, as well as how Panzer Dragoon uses them.

As far as documentation goes, I don't have much at all. All I have is the specs on the PCI registers that I found some years ago (don't remember where I found it), but it's here: http://www.megaupload.com/?d=IB9I44C0 Take it and run with it! The document also explains how the VGA, DSP and audio registers work, but nothing on 3D quadratic rendering. Another thing, since I don't have the old NVSDK (NVlib, was it?), it's going to be tough trying to document the APIs and how they work since my reverse engineering skills aren't the greatest. I had a book on the subject, but it's in another state 🙁

So far, I haven't found anything on how the card handles quads/NURBS at all. I was hoping to use OpenGL for this, but without any documentation on how it works, I'm at a loss. I checked XFree86, but there was minimal information in the archived source code. I'm not sure where else to look and any open source drivers supporting NV1 are far and few.

With that being said, I was wondering if anyone else knew where to turn to. There aren't many forums that specialize in this sort of thing, and this place along side of assembler games appears to be the best place to start. I've seen only 3 threads where NV1 was mentioned, but nothing conclusive happened in any of those. So I was hoping that the work I've done so far would help generate a bit of interest.

Any ideas? Thanks.

Reply 1 of 28, by F2bnp

User metadata
Rank l33t
Rank
l33t

I have no idea how to help you. May I suggest you also ask here : http://classicplatforms.com/forum/index.php
If you manage to do this though you'll be king mate. I've always wanted to see those PC ports and tech demos and a wrapper seems like the best idea!

Reply 4 of 28, by sliderider

User metadata
Rank l33t++
Rank
l33t++
swaaye wrote:

I would email NVIDIA. Maybe there's a chance of them being helpful.

I tend to doubt they would be willing to provide any technical support for something that old, at least not for free.

Reply 5 of 28, by swaaye

User metadata
Rank Moderator
Rank
Moderator

Yeah it is unlikely, especially considering they told the Linux world to get lost too and forced nouveau to rely on reverse engineering.

Maybe another route is to try to contact people involved with the 4 or so games for Edge3D? Maybe they have a CDROM somewhere? 😉

Reply 6 of 28, by leileilol

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

I tend to doubt they would be willing to provide any technical support for something that old, at least not for free.

PowerVR's even like that regarding the PCX2 these days (despite the whole marketing switch focus to mobile/embedded stuff). It's still as confidential as ever.

apsosig.png

Reply 7 of 28, by sliderider

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

I tend to doubt they would be willing to provide any technical support for something that old, at least not for free.

PowerVR's even like that regarding the PCX2 these days (despite the whole marketing switch focus to mobile/embedded stuff). It's still as confidential as ever.

That's where getting your hands on a developers documentation comes in handy, but how often do you ever see those come up for sale? Some of that documentation may still be under secrecy agreement so it might even be illegal to pass them along to someone who hasn't signed the agreement. Most likely once those cards fell out of the mainstream any documentation that was sent to developers was either returned or destroyed.

Reply 8 of 28, by leileilol

User metadata
Rank l33t++
Rank
l33t++

The funny thing, for the PCX2, the SGL header and library WAS available publically, and even mastered onto the Matrox M3D cds. It's been since retracted.

Dunno about the NV1 though

apsosig.png

Reply 9 of 28, by blueshogun96

User metadata
Rank Newbie
Rank
Newbie
swaaye wrote:

I would email NVIDIA. Maybe there's a chance of them being helpful.

NVIDIA Corporation is known for being stingy with their hardware specs for even their oldest video cards, so I doubt they would help/care to begin with.

Quite frankly, I don't know who I could contact about this. These games were released almost 20 years ago and the only names I can even pull up are some of the Japanese developers of Panzer Dragoon. How to get in touch with them I don't know.

I guess my best bet for now is to see what XFree86 has left of it in the archives... 😖

Davros wrote:

I'll ask on b3d for you

Beyond 3D? Thanks.

Reply 10 of 28, by blueshogun96

User metadata
Rank Newbie
Rank
Newbie

Okay, I know it's old, but I kinda want to keep this in one thread if that's okay. If not, feel free to close it, and we'll start anew.

Thanks to Stiletto going though so much trouble tracking me down, I've got my paws on some more useful information. So now that I have official docs on the outer and inner GPU registers, I have a better understanding of how this card works. And after scanning though all the information, I can already say that writing an NV1 wrapper is going to be M-U-C-H harder than I thought. Not only are there multiple different ways of accessing the hardware, the SDK doesn't really expose the APIs that are in NVAPI.DLL (the NV1 version obviously), so those will generally remain undocumented unless reverse engineered. Even worse, the NV1 has special hardware flags for waveOut functions. Not sure if that's a big issue, but I'd hate to have to account for that also.

Lastly, I'm also beginning to consider that maybe a wrapper is less practical than actual hardware emulation. The software side is a real pain since the exposed API doesn't sync up too well with the API found in NVAPI.LIB driver, and since NVLIB and DirectDraw 2.0 (and possibly 3.0 as well) can be used simultaneously, that further complicates things. At this point, I think maybe digging up that NV1 version of DOSBox I started would be a better idea since I have nearly all of the registers documented (including the PCI register layout here(the megaupload link is dead): http://code.shogun3d.net/coolstuff/nv1.rar).

My next quest is to actually compile some NVLIB samples. None of my compilers work on it so far. Digital Mars normally builds anything I throw at it (with enough tweaking), but since it doesn't like the library (.LIB) formats, I keep getting linker errors.

Any more thoughts?

Shogun.

EDIT: I just realized it's been almost exactly 3 years since I've last logged on here. Has it really been that long already?

Reply 12 of 28, by blueshogun96

User metadata
Rank Newbie
Rank
Newbie

Interesting. Anyone have any success adding PVR support to DOSBox while I was gone?

While this is interesting, I know next to nothing of how PowerVR cards work on a register level. Since I'm heading out the door, I'll have to look at it later today.

Shogun

Reply 14 of 28, by blueshogun96

User metadata
Rank Newbie
Rank
Newbie

Very interesting. Never heard of this emu until now. If it aims to be a PC emu that supports multiple types of video and sound cards, it's the ideal PC (Windows) emulator I've dreaming about, but never had the skill/patience to write. But so far, DOSBox is so easy to work with and the most straight forward of PC/DOS emulators I've come across.

After a bit of searching, I managed to dig up the old NV1 version of DOSBox I started working on. Now I have to remember how this thing works. Going to have to go through the data sheet again, because I forgot that this card technically counts as two PCI devices which both need to be accounted for in one way or another. Fortunately, they are both well documented.

Shogun.

Reply 16 of 28, by VirtuaIceMan

User metadata
Rank Oldbie
Rank
Oldbie

Wasn't the NV1 very much related to the hardware in the Sega Saturn? Would the various emulators for that help in any way?

I'm guessing not, but just mentioned it!

My PC spec: Win10 64bit, i7-4970K (not overclocked), KFA2 GeForce RTX 2070 SUPER, Creative Soundblaster ZXr, 16GB RAM, Asus Z97-A motherboard, NZXT 410 case, ROG Swift GSYNC monitor

Reply 17 of 28, by kolano

User metadata
Rank Oldbie
Rank
Oldbie
VirtuaIceMan wrote:

Wasn't the NV1 very much related to the hardware in the Sega Saturn? Would the various emulators for that help in any way?

I'm guessing not, but just mentioned it!

It was, though I don't believe they were exactly aligned, I believe both used the weird "quads" for rendering though. My recollection of the currently available Saturn emulators seems to be that they were somewhat lacking anyway, though it's been some time since I investigated such.

Eyecandy: Turn your computer into an expensive lava lamp.

Reply 18 of 28, by blueshogun96

User metadata
Rank Newbie
Rank
Newbie
kolano wrote:
VirtuaIceMan wrote:

Wasn't the NV1 very much related to the hardware in the Sega Saturn? Would the various emulators for that help in any way?

I'm guessing not, but just mentioned it!

It was, though I don't believe they were exactly aligned, I believe both used the weird "quads" for rendering though. My recollection of the currently available Saturn emulators seems to be that they were somewhat lacking anyway, though it's been some time since I investigated such.

The NV1 and Saturn VDP are by no means related except rendering methodology. They both use quadratic rendering using NURBS or Bézier curves IIRC. I took a look at the SDK, and NV decided to choose a rendering architecture similar to Saturn's VDP by using 9 control points rendered using quads.

Shogun.