Well it mostly works now. Â But did we ever have the biggest fun with the sound and SVGA.
SoÂ [HCI]Maraâ€™akateÂ integrated all the Q1 sound code, got it to compile, but nothing not a peep from the sound card. Â While I was busy trashing the video code, he spent way too much time on the audio, and then for the heck of it I thought I’d look at the code, although I’m really stabbing in the dark when it comes to audio. Â Imagine my surprise when I compiled the code, and ran it and got the sound blasting at full volume! Â It turns out that I had my audio set to ‘high quality’ in the client, while he had his set to ‘low quality’. Â What it does is govern the frequency between 11Khz and 22Khz. Â And if you get this wrong you get *NO* audio. OOPS. Â At least it was one of those feeling vindicated moments that his efforts for sound really did work.
Now with audio, it was my time to hurry up and get the video going. Â I had basic VGA working so I figured I didn’t want to spend a lot of time on this, so I was going to go with the VESA 2.0 linear frame buffer. Â Well this once more again proved to be a bit more involved as the only way I really have to test is emulation via DOSBox and Qemu. Â And naturally both of them worked fine, but whenÂ [HCI]Maraâ€™akate ran it on his real DOS Box (with GUS of course) it crashed wonderfully.
Now I had taken the VESA init code from Quake 1 to build a table of what 8bit modes are supported, and used the VESA code to switch, along with drawing to the buffer with a simple memcpy. Â And we got nothing but crashes.
After looking more around, I found that you had to add 0x4000 to the VESA mode you want if you wanted to access it’s LFB. Â Did that work? No still crashed.
Later in the adventure we noticed to get proper access you had enable ‘near pointer acess’ with a call to :
So naturally I would disable it when I’m done, making the call look like this:
WRONG. Oh so WRONG. Â Well OK technically it did work, but if sound is enabled (and why wouldn’t it be?) it would immediately crash with an error in the DMA code. Â We ended up wasting over a day trying to figure this one out until I just said screw it, let’s never dsiable the nearpointer, leave it unprotected. Â Naturally that actually worked. Â The hint is in map_in_conventional_memory, whereÂ __djgpp_nearptr_enable(); is called, but of course there is no calls toÂ __djgpp_nearptr_disable(); Â I’ve thought about going back through the source to ‘clean’ it up to make it lock and unlock memory as needed, but this is 2015 not 1997 so good enough is well, good enough.
So now with VESA and Sound, I thought this would be a great time to tackle the dynamic loading of gamex86. Â We will have to re-compile whatever gamex86 DLLs are out there as of course DOS is DOS. Â The HX DOS guyÂ Japheth seems to have died, as his site and all the info on that extender seems to have mostly vanished. Â I have an old copy, but I never could make it call DOS stuff if you had WIN32 stuff going on. Â And if he’s really dead it’s too late to ask him.
Ages ago I remembered this DLL support for DJGPP called DLM, so I thought I’d give that a try. Â I was able to take our ‘null’ version of Quake II, and get it to where it can load and unload the gamex86.dlm at will. Â So I figured this was going to be an easy win, right?
Wrong again. Â Once I started to put in the MS-DOS specific code I got this fun crash:
DLM -> Exiting due to signal SIGSEGV at
0x0014f59d SYM: _dos_lockmem+0x9 DLM: q2.exe [0xf5000]
possibly because of undefined reference to symbol ‘___djgpp_base_address’
DLM call frame traceback :
0x0014dcaf SYM: _Sys_PageInProgram+0x37 DLM: q2.exe [0xf5000]
0x0014e1c4 SYM: _main+0x18 DLM: q2.exe [0xf5000]
So apparently it doesn’t export (or import) djgpp stuff like the base address calculations so we can’t do direct memory access, which means no video and no sound. Â Ouch. Â I’ll have to hit the lists to see about support. Â I don’t like the DXE’s because they cannot be unloaded, so that isn’t much good. Â And of course things like the JVM inside of gamex86.dll is right out as JAVA inside of MS-DOS? in 64MB of RAM? Dream on.
So for now, the gamex86.dll is statically linked into the executable. Â You are restricted to vanilla gameplay for now.
As an added bonus, I used Rufus 2.2, to setup a bootable MS-DOS USB stick, slapped everything onto there, and booted up on my Xeon, and it works!
Now as a super bonus,Â Â [HCI]Maraâ€™akate went above and beyond by adding in a bunch of fixes, and updates from 3.24 and varous stuff from Knightmare. Â And then the best part is integrating libogg, so it can now play the ogg sound track! Â Really, just place the ogg files in the baseq2\music directory and away you go!
For anyone who is interested, I’ve updated the binaries, to include the latest version with built in quakespy technology! Â Run an /slist2 and get a list of servers!
At this point the ‘alpha 2’ version contains:
- SoundBlaster and Gravis UltraSound Family
- CD-ROM music
- OGG music
- Networking (You need a packet driver)
I’ve also compiled a ‘server’ for Linux based on the code, and put it online @ 18.104.22.168:27910