My bad. I don’t run Vista. Really. I don’t like it, it’s glacially slow, and doesn’t give me anything as a developer (except more flashy looking Explorer screens and maybe a Start menu I can search). So I’m an XP boy, however that was a bad mistake on my part with the release of Terrarium.
Vista users were getting an exception message and it was pretty quick to see that it was a DirectX problem. The problem was a) Vista doesn’t support DirectX 7 which Terrarium requires and b) Bil is an idiot for not thinking about this. Again, my bad and I apologize.
So first off there’s a quick fix (which I can’t test myself, but according to comments on Scott’s blog it works).
- Find an XP machine and grab the following older DirectX DLLs:
- Run regsvr32.exe against the dx7vb.dll and dx8vb.dll
- Drop everything in the %SYSDIR%\system32 folder
That should fix you up in the interim. Unfortunately I cannot redistribute the files to you as they’re MS property and all that jazz.
For longer term, I’m ripping out the DirectX COM calls (which are actually wrappers to wrappers) that are in the current codebase and calling the DirectX managed ones provided in DirectX 9. This will probably result in not only a more readable codebase (and one that works on Vista) but it might even gain a little performance along the way.
The managed DirectX classes Microsoft provides in DirectX 9 are pretty nice and rather than a bevy of cryptic constants, enums and ref objects everywhere they’re all wrapped up in a nice OO-like package for you.
For example here’s the old DX7 code (ugly COM and DirectX goo):
1: /// <summary>
2: /// Determines if the surface is in video memory
3: /// or system memory.
4: /// </summary>
5: public bool InVideo
9: if (surface != null)
11: DDSCAPS2 ddsc = new DDSCAPS2();
12: surface.GetCaps(ref ddsc);
13: if ((ddsc.lCaps & CONSTDDSURFACECAPSFLAGS.DDSCAPSVIDEOMEMORY) > 0)
15: return true;
18: return false;
As with most DirectX code you come across, it’s rather cryptic and ugly. Here’s what this method will look like after the conversion to use the DirectX managed classes:
1: public bool InVideo
5: if (surface != null)
7: SurfaceCaps ddsc = surface.SurfaceDescription.SurfaceCaps;
8: return ddsc.VideoMemory;
10: return false;
Much nicer and more readable (well, as readable as DirectX code can ever be).
In any case, this is a better place to be but it’ll be awhile before I can commit all this work (and I’m flying without unit tests which is killing me here). I’m now re-living my past life when I knew what DDSCAPS_VIDEOMEMORY was (and regretting it as it all comes flashing back to me now). This probably won’t get us much closer to an XNA implementation of Terrarium but it’ll cause me to pull out less of my hair when we do (I think).
This fix will be in a 2.1 release that I’ll pump out when I get back from vanishing into the backwoods of British Columbia next week (sorry, but we geeks do need our downtime once in awhile).