Porting Quake II to MS-DOS pt5 – 3DFX, GameSpy, Quake 2, and The Universe

The following is a guest post / wrap-up of the Q2DOS adventure by [HCI]Mara’akate.q2dos_3dfx_4
In the last update sezero and I([HCI]Mara’akate) tied up most loose ends with regards to Q2DOS.  Specifically: adding in DXE support for mods and cleaning up some code from the early efforts.  During this time, a forum user by the name of ggorts (strogg spelled backwards!) mentioned the possibility of using an old Mesa version with 3DFX support in DOS. I worked on separating the ref_soft from being statically linked into a DXE form and sezero cleaned up any potential problems there.

I mentioned the possibility of attempting the Mesa port to sezero and he thought it was probably a wasted effort and thought making a ref_glide depending only on glide3x.dxe would be a better way to go with less overhead.  I started some initial work on it but quickly abandoned this side-project as I have no real glide (or even OpenGL) knowledge and didn’t have enough time on my hands to play around with it.

Around this time, we also separated the GameSpy browser code into a separate DXE for potential legal issues.  The GameSpy code was publicly released, but never officially GPL’d.  Using this method, other port authors could link against a gamespy.dll to add in the browser capabilities that connect to my GameSpy master server emulator (see QDOS branch for source code to that particular project).

Ggorts also came up with some code for us to be able to finally use the banked modes and Mode-X 320×240.  Though 320×240 Mode-X seems to have some issues with certain emulator configurations, for the most part it works OK.  This also helped us to get some ASM rendering code in from Q1 and help clean up the original mess that was the SVGA driver; a lot of unused code from Q1 was removed and sezero found a clever way to send the video modes list between the game binary and renderer DXE.

In any event, one night I figured I’d take a stab at trying to get Mesa working in Q2DOS.  Checking out the Mesa3d FTP and researching the various changelogs it appears as if Mesa 5 series was the last true effort with Mesa 6.4.x series being the last maintained version with 3DFX specific code.  I got everything to compile but ran into hard-lock issues no matter what I attempted.  During this time, ggorts found out some various small, but now obvious issues. Including increasing the stack size to 1MB and he hard-coded the ref_gl to only work in 640×480.  It took a lot of pleading but eventually he released his source with a static compile for Voodoo 1 cards only as he was testing this on emulators like DOSBox with glide support and PCem dev branch.

I worked on cleaning up the source and he produced some glide3x libraries for me for Voodoo 2 and Voodoo 5 as these were the only cards I personally owned.  Imagine my surprise as I first loaded it up and it actually worked!  And it was smooth with no rendering issues!

q2dos_3dfx_3

At this point, sezero became involved and worked very hard to clean up the Mesa compile issues, including various scary warnings and helped to update us to the final glide3x commit pushed to the development branch and Mesa v6.4.3 which was an unreleased maintenance update for Mesa v6.4.2.

It was a long journey to get the code all working together just right, and a big thanks goes out to the early Mesa crew including Brian Paul, Daniel Borca, and “KoolSmoky” and the mysterious ggorts fellow who pushed hard for this feature.

To recap, Q2DOS from the last time we talked now has:

  • 3DFX Rendering with Mesa v6.4.3 for all Voodoo cards.
  • Separated renderer so it is no longer statically linked.
  • GameSpy is now a DXE.
  • WAV streaming, which is practically free as opposed to the OGG format.

q2dos_3dfx_1
q2dos_3dfx_8

We are about at the end of our Q2DOS journey.  A few odds and ends with Mesa and Voodoo 5 SLI issues remain (though nothing too show stopping) and there’s a small wishlist of some unnecessary features but it’s come a long way from the initial null driver effort!

q2dos_3dfx_2*Neozeed

I have to say it is simply incredible to see how Q2DOS went from a very primitive ‘wow it works’ port to a full featured port.  Simply amazing!

For those who missed the adventure it starts in Part 1, continued in Part 2, Part 3 and Part 4.

VenturComm Venix/86 on PCem

(this is a guest post by Tenox)

This is a step by step guide on how to install Venix/86 on PCem, by runner up of Venix/86 Virtualization Challenge – Mihai Gaitos of hawk.ro. Thanks for a great work!

Rebuilding Venix for PCEM:

First, in order to avoid problems with weird HDD parameters I chose a reasonable hdd geometry – 512 cylinders, 8 heads, 17 sectors (most drives back then had 17 sectors).

HDD geometry:
pcemven1

BIOS Autodetect:
pcemven2(answer “Y” here)

The obvious approach of Booting the XFER.IMG and then switching to BACKUPn.IMG doesn’t work, failing with “Soft error”:
pcemven3 Continue reading

“warning: Invalid parameter passed to C runtime function.”

So while debugging Dynamips I got this fun message under GDB.  Of course it doesn’t tell you WHAT function did it, or HOW it was trying to do it.  Fantastic.

Thankfully Dennis Yurichev’s blog gave me the hint to put a breakpoint on ‘OutputDebugStringA’ and sure enough I could see Dynamips trying to treat a socket like a stdio file handle.  Something you can’t do in Win32 world.

On the plus side, I just had to do a small re-write of some functions and I can talk to the Dynamips hypervisor!  Idle and JIT are working too!  Along with WinPcap and UDP transports.

Dynamips on MinGW

It’s always bugged me that the only way to build Dynamips for Windows was with Cygwin.

Well fear no more, I’ve mashed an old version (I would have tried newer, but of course Cmake fails spectacularly and with zero help as always!) and not only does it compile, but it can boot a 7200 version of IOS.

Dynamips on MinGW

Dynamips on MinGW

JIT is broken.  You have to telnet into the console.  And the console is a little wonkey as I’m sure it’s doing a lot more UNIX translation vs being a Win32 program but it does work enough to login, save the config, and reload.

But it’ll crash on reload.

I’m sure it’s full of bugs actually.

https://sourceforge.net/projects/dynamips-mingw/

I started with Dynamips 0.2.8-RC7-community and started commenting out stuff to get it to compile.  Luckily I found this ezwinports that includes mairix that includes some memory mapping functions, namely mmap and munmap ported to Win32 in an early glibc port. While I was trying to integrate libuuid, I got this fun error:

mingw “error: conflicting types” “UUID”

MinGW includes UUID support, since it’s a Microsoft thing.  Unfortunately libuuid doesn’t include unique names,  so I had to rename uuid_t to uu_uuid_t

//typedef unsigned char uuid_t[16];
typedef unsigned char uu_uuid_t[16];

in the uuid.h header file, along with all instances in Dynamips.

I also borrowed sendmsg/recvmsg along with the msg structures from VLC.  inetaton.c from WSHelper, and finally telnet.h from NetBSD.

After that it was a matter of making sure Winsock starts up, and fixing some linking breakage.

For those who want to try, the binary package is here.  I’ll have to setup git on this machine and upload all the changes.  It shouldn’t require any DLL’s, although I haven’t looked at the pcap stuff, as I mentioned it’s largely untested, so I have no idea if any of it works other than the telnet console.

Dealing with Gmail’s attachment ‘security’

Blocked!

Blocked!

Ugh I’m sure I’m not the only one that has this issue.  So before google drive, and friends were a thing, gmail gave us 1GB of mail space (at the time why it was called ‘G’ mail).  And what better way to make files available between machines than to email them to yourself?

Well this worked for YEARS then they started to block some extensions, and now they block damned near everything.  From their ‘Learn more’

Some file types are blocked

As a security measure to prevent potential viruses, Gmail doesn’t allow you to send or receive executable files (such as files ending in .exe). Executable files can contain harmful code that might cause malicious software to download to your computer. In addition, Gmail doesn’t allow you to send or receive corrupted files, files that don’t work properly.

File types that can’t be sent or received

You can’t send or receive the following file types:

.ade, .adp, .bat, .chm, .cmd, .com, .cpl, .exe, .hta, .ins, .isp, .jar, .jse, .lib, .lnk, .mde, .msc, .msp, .mst, .pif, .scr, .sct, .shb, .sys, .vb, .vbe, .vbs, .vxd, .wsc, .wsf, .wsh

Messages containing the types of files listed above will be bounced back and returned to the sender automatically. Gmail won’t accept these file types even if they’re sent in a zipped format. Here are some examples of zipped formats:

.zip, .tar, .tgz, .taz, .z, .gz, .rar

Well isn’t that great.  Of course when I’m uploading source I tend to include executables, custom batch scripts to either clean or prepare, and sometimes run whatever it is I’m doing. Perhaps libraries, jar’s and maybe even device drivers.

Thinking the email attachment had been lost I was looking to see if I can forward it, when I stumbled onto this interesting bit:

show original

The show original option!

This lets you view the email in it’s un- formatted state, which also includes the attachments!

So from here it’s a simple matter of saving the file to your hard disk.  It is important that you ONLY save the base64 portion not that headers.  I guess this is a pain for multiple attachments as b64 doesn’t read MIME containers.

If you look at an email it’ll roughly look like this:

MIME-Version: 1.0
Received: by 10.64.9.141 with HTTP; Tue, 29 Oct 2012 13:33:16 -0700 (PDT)
Date: Tue, 29 Oct 2012 13:33:26 +0800
Delivered-To: [email protected]
Message-ID: <CA+rfG9Z-5Ej7iuXs36a_Lryqw+gs52GMUEFE9XPrSswjHRxXqw@mail.gmail.com>
Subject: doom?
From: Neozeed <[email protected]>
To: The Number One Guy <[email protected]>
Content-Type: multipart/mixed; boundary=001a11c3b874d1eaf704e9dde937

--001a11c3b874d1eaf704e9dde937
Content-Type: multipart/alternative; boundary=001a11c3b874d1eaf204e9dde935

--001a11c3b874d1eaf204e9dde935
Content-Type: text/plain; charset=ISO-8859-1

Don't lose this file!

--001a11c3b874d1eaf204e9dde935
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Don't lose this file! =A0<div><br></div>

--001a11c3b874d1eaf204e9dde935--
--001a11c3b874d1eaf704e9dde937
Content-Type: application/octet-stream; name="DOOM_SRC_102813.7Z"
Content-Disposition: attachment; filename="DOOM_SRC_102813.7Z"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hncxub2b0

N3q8ryccAAPH+QLokKMEAAAAAAAkAAAAAAAAAKm3ezkABoLDcK0hSHl0xaeKFIsLY1Idc7MMQAtM
jDXWS9Sc5PvtvOmy27+byH8YZTOBY65JnEi5L9U41YDw53Wi1/xxpcR8Az8yIfc7DjQIT0ULtATL

We start the file at the ”

N3q8ryccAAPH+QLokKMEAAAAAAAkAAAAAAAAAKm3ezkABoLDcK0hSHl0xaeKFIsLY1Idc7MMQAtM

line.  I’m going to save it in notepad as “attachment.b64”

Now for the decoding!

I’m using b64, from sourceforge.  However you need an ‘older’ version 1.4 as the newer version has a decode bug.  Also

b64 -l76 -d attachment.b64 output.7z

And this will (blindly) decode the attachment.b64 into output.7z.  And from here you can extract the file without any issues.

As a bonus, if you have Outlook, you can just save the entire file as an .eml and open it in Outlook!

So easy!

So easy!

Also for Outlook 2003/2007 users you may have to use this registry alteration to have them support directly loading of .eml files.

Failure to upgrade to Windows 10

It’s been a bad hardware day for me, my MacBook Air that I bought in 2012 stopped working.  And it’ll cost at least half the price of a new one to fix it.  So instead of that I don’t want to spend that much right now so I picked up a cheap used Fujitsu laptop.  It had Windows 7 on it, which qualifies for Windows 10, so I figured I’d just use that free upgrade!

Wow that was a whole day shot by.  Although now that I’m posting this from Windows 10, it is much more faster and responsive than Windows 7.

The first big problem I had was that this laptop didn’t have *ANY* updates installed.  Service pack 1 for Windows 7 is required for the upgrade, and that is a 1GB download on it’s own!  Then after that, it demanded KB2952664 which wanted forever to install, so I said screw it and run the Windows update, which was 199 updates to go. So after all those hours, I’m finally ready to install Windows 10!

Au

I wanted an upgrade!

So during the install, about 25% of the way in, 83% copying files it suddenly reboots, and then starts to restore my prior copy of Windows.  Great, something failed.  Once back in Windows 7 I get this wonderful message:

I love these cryptic errors!

I love these cryptic errors!

0xc1900101 – 0x20004 The installation failed in the SAFE_OS phase with an error during the INSTALL_RECOVERY_ENVIRONMENT operation.

After trying more updates, defraging, it failed to upgrade another two times.  So I googled some more, and it turns out that a lot of people had laptops like this Fujitsu that were partitioned 50/50 and people would convert their disk from a basic MBR to a dynamic disk, so they could destroy the un-needed and wasteful D drive, and merge it into a nice C drive.  So what is the fix? UGH you have to convert the disk back to a basic disk with a normal MBR.  Except You can’t easily revert as you can convert.  So a bunch of more time wasted with a Windows Vista DVD that can read the disk, and an external drive let me copy windows off, redo the disk as MBR and restore Windows.

After all that drama the Windows 10 upgrade went without a hitch!

Bottom line, is that it’s probably easier to just buy a copy of Windows 10.  There is a utility to convert a dynamic disk to a basic disk, Partition Wizard Pro which costs $39.  Which is better towards a copy of 10.

Oh well it’s finally done.

Update review

Update review

Probably a bad time to ask.

PCem networking update to build 335

Well after extensive testing of various CFLAGS settings it turns out that “-O2 -flto -ffast-math -mfpmath=387” gives the best overall settings for PCem.

So yeah me and leileilol went through a dozen+ iterations to arrive at this fun conclusion.

So I’ve only included 2 executables, a debug and the -O2 build.

You can download it here.

I haven’t made any changes to the networking code, and even with a LOT of fighting got OS/2 Warp 3.0 Connect to install.

Gopher

Gopher

Plus I fixed my gopher!

**EDIT

I made a mistake, and built both exe’s as debug.  I updated the archive, those who downloaded it, will want to do so again!