DirectX SDK vs. Windows SDK

Enno: this article! http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275(v=vs.85).aspx
Enno: “Starting with Windows Developer Preview, the DirectX SDK is included as part of the Windows SDK.”
Kael: yep
Kael: DERP
Kael: that also means they don’t push out frequent dx sdk updates anymore
Kael: you get to wait for the next windows sdk update
Enno: what is “Windows Developer Preview”?
Enno: has that happened?
Kael: that’s part of why some people were claiming that directx is dying a slow death
Enno: is the 2010 update the most recent?
Kael: windows developer preview is windows 8 that you install in a vm
Kael: and visual studio that you have to run inside the windows 8 vm
Kael: it’s retarded because the visual studio division is currently buried deep inside their own ass
Enno: okay, so for me on Win7, with VS 2010, this should not apply?
Kael: yeah, for you you get to use old sdks
Kael: they aren’t releasing new sdks for you
Kael: not yet, anyway.
Kael: i think once windows 8 is out they may release a new one that will work on windows 7
Enno: that is totally confusing, because this link is the topmost article on http://msdn.microsoft.com/en-us/directx/
Kael: D3DX is not considered the canonical API for using Direct3D in Windows Developer Preview and therefore does not ship in the corresponding Windows SDK. You are recommended to investigate alternate solutions for working with the Direct3D API. For legacy projects such as the Windows 7 (and earlier) DirectX SDK samples, the following steps are necessary to build applications with D3DX using the DirectX SDK:
Kael: windows 7 is ‘legacy’
Enno: and i thought “oh, that explains why the last SDK is from 2010 – it’s no longer the way to do things”
Kael: no, it’s just from 2010 because microsoft is totally fucking up directx
Kael: someone wrote a good blog post explaining this stuff, sec
Enno: I am trying to compile some shit, and I want to install the right SDK, and fucking msdn is leading me astray
Kael: http://ventspace.wordpress.com/2011/11/28/directx-and-xna-status-report/
Enno: plus, the Windows SDK for Win7 will not install if you have the VC++ Redist files installed already. which _really_ ruined my day
Enno: because error messages are for pussies.
Enno: 🙁
Enno: okay, marty. we’re going back to the future. set the flux compensator for 2010

Windows SDK installation woes. Update: Solved, sort of.

My computer doesn’t have a dxsdkver.h file. That should be in the DirectX SDK. Except that no longer exists, and is now part of the Windows SDK (latest version: 7.1). That should have been installed with Visual Studio, but somehow my computer is very special, once again.

So today I tried installing the Windows SDK, and I get this feeling of deja vu:

A problem occurred while installing selected Windows SDK components.

Setup could not find the file WinSDKhelpWinSDKHelp_x86.msi at any of the specified source locations http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/setup

I cannot install the Windows SDK, and I have been here before! In fact, my Firefox history still remembers half the links that a cursory Google search lists as visited. I hope it doesn’t mean I have to reinstall Visual Studio.

Update 1: I downloaded the Windows SDK 7.1 ISO, ran the setup from that, and now I get this message:

Installation of the “Microsoft Windows SDK for Windows 7” product has reported the following error: Please refer to SamplesSetupHTMLConfigDetails.htm document for further information.

What the Hell? That tells me nothing. Google points me to this page of regedit fuckery, which seems like something I tried last time I was here, but will be the next thing I try.

Update 2: Well, that didn’t work either. The next advice I followed was from this forum post, which suggested to uncheck the compilers (since I believe I have the SP1 compiler installed), but again, no dice. Time to try installing one component at a time, and fine-combing the log file each time one fails.

Update 3: Never mind what I just wrote. It turns out even when I deselect every single option in the installer, the installation still fails.

=== Logging started: 2/19/2012  18:05:16 ===

Action start 18:05:16: INSTALL.

Action start 18:05:16: DDSE_CA_Uninstall_InstallExecuteSequenceStarts_x86.

02/19/12 18:05:16 DDSet_Status: LANGID: 1033

02/19/12 18:05:16 DDSet_Entry: ImmediateDispatch: DDSE_CA_Uninstall_InstallExecuteSequenceStarts entry

02/19/12 18:05:16 DDSet_Error: Patch Hooks: Missing required property ‘ProductFamily’: Setup cannot continue.

02/19/12 18:05:16 DDSet_Warning: Setup failed while calling ‘getDLLName’. System error: Cannot create a file when that file already exists.

Every log file has entries like this, which seems to indicate that something that’s already installed is causing an issue with this installer. WTF.

Update 4: Progress!

Further on, the log file said that

vcredist_x86.exe installation failed with return code 5100

On a whim, I uninstalled the Visual C++ 2010 x86 Redistributable from the control panel, then tried the “empty” installation again, and Heureka! It worked.

Maybe now I can install the full product?

Installation of the “Microsoft Windows SDK for Windows 7 Compilers for x86” product has reported the following error: Fatal error during installation.

Let me just uninstall “Microsoft Visual C++ Compilers 2010 SP1 Standard – x86. I’m pretty sure I can install them again later. and oh wonder, the installation finishes!

Still doesn’t include dxsdkver.h, though. I think my initial research must have been faulty.

The problem with tolua++ and DLLs (solved!)

Today I was going to make a tiny DLL that binds some C code with tolua++, and I ran into this error message:

lua: error loading module ‘foo’ from file ‘daisydebugfoo.dll’:

        The specified procedure could not be found.

That looks like my DLL isn’t exporting the luaopen_foo function correctly. That is the function lua calls to initialize the package it just opened, and tolua++ was not declaring it properly:

TOLUA_API int luaopen_foo (lua_State* tolua_S) {
  return tolua_foo_open(tolua_S);
};

TOLUA_APIis defined toextern, which doesn’t mean that it will be exported by the DLL, because on windows, the magic incantation for that is__declspec(dllexport). The tolua++ header has no special treatment for Windows, so I’m guessing that problem has just never come up for them.

Once the problem is understood, the solution is easy: I added another function to dllmain.cpp that has the correct export declaration and calls the generated one.

extern "C" {
  int tolua_bar_open(lua_State*);
  int __declspec(dllexport) luaopen_foo (lua_State* L) {
    return tolua_bar_open(L);
  };
}

There’s one caveat, because tolua++ has already created a function named luaopen_foo, so I had to tell it to name things differently, for which there is a command-line argument:

tolua++ -n bar foo.pkg > foo.c

Domain expired :-(

Gmail has been sorting dyndns.org emails into my spam folder, so I missed the expiration notice for enno.homeunix.net – a domain I’ve used for years to point to my blog du jour.

Additionally, ennos.homes.pages.de, which points to the defunct address, no longer has an interface for administration. I’ve used that URL about as much as the other, and for longer, so pretty much every URL pointing to my blog anywhere on the internet is now wrong, with no way for me to fix them.

That is a pretty terrible state of affairs. Time to buy some domain names.

WIL WHEATON dot TUMBLR: “What I’m looking at is fairly standard police procedure.”

Charles J. Kelly, a former Baltimore Police Department lieutenant who wrote the department’s use of force guidelines, said pepper spray is a “compliance tool” that can be used on subjects who do not resist, and is preferable to simply lifting protesters.

“When you start picking up human bodies,…

WIL WHEATON dot TUMBLR: “What I’m looking at is fairly standard police procedure.”

Maximizing battery life on the Optimus T

Yes, talking about my phone again. As was to be expected, I spent a lot of time with the phone on day one, and drained the battery in record time. Something needed to be done about that, and here’s what I’ve arrived at:

  1. I don’t need 3G, so I turned on the “2G only” option. I do not have a contract, because I like the $0 monthly fee of a prepaid SIM, and with T-Mobile that means I don’t get a mobile data plan. 2G is all I need, and it’s a lot less of a power-hog than 3G or 4G are.
  2. Turn Wi-Fi off. This sounds counter-intuitive, especially since I don’t have a data plan, but a lot of the time there’s no Wi-Fi network in range I can connect to, and even when there is, I don’t need to be permanently connected. Instead, I switch it on every few hours, which causes the phone’s various accounts to sync, then turn it off again and read the new emails/tweets/etc that came in.
  3. Display brightness all the way down. I’m indoors most of the time, and reading the screen is not a problem.
  4. Optimize for signal. T-Mobile has a terrible network, and my apartment is almost a dead zone for reception. Leaving my phone near the window instead of on the couch table means it won’t constantly be scanning for a network.

With all of this, I’ve gotten nearly 2 days out of the battery so far, though I didn’t make any calls in that time. It’s not the 5 days I used to get out of my Nokia 6300, but I think it will do.

Speaking of the lousy network coverage, T-Mobile has installed a funny app on the phone for “Wi-Fi calling”. It uses the Wi-Fi network for making calls, but still charges minutes to my prepaid contract. This seems ass-backwards at first, until you realize it’s a trick of theirs to hide how awful their 3G network really is. It’s enabled by default, and assuming you’re mostly calling from home and within reach of your wireless router, you get crisp quality phone calls, and aren’t immediately tempted to research Skype or Google Voice.

I bought a phone!

Today is the first time I’ve bought a phone. All my prior phones were either paid for and bought by my employer or hand-me-downs. This month, the last one of these did its final gasp, and it was time for me to look for a replacement.

After unsuccessfully trying to navigate a couple of online stores and filing to find an offer that didn’t require a degree in advanced marketing buzzword and retail theory, I simply walked into the T-Mobile store, told them I wanted an affordable android phone without a plan, and walked out with an LG Optimus T. It’s not going to win awards for 3D games performance, but that’s not what I wanted it for. And it’s not burning a hole in my wallet every month. First impression is pretty good, time to install a ton of apps!

git svn rebase fails, not using plink

I installed a new version of msysgit some days ago, and git svn rebase stopped working. Some digging showed that it wasn’ using plink to talk to putty anymore, but using openssh. This despite my having told the git installer that I would like to use plink.exe (and pageant).

What was going on? git wasn’t to blame here – it was svn that was using plink. I had also reinstalled msys, and with it a new subversion config file, it seems. The fix was to edit my C:Userserehling.subversionconfig file like this:

[tunnels]
ssh="C:/Program Files (x86)/PuTTY/plink.exe"

Next time this happens, I hope I’ll remember that I wrote this little reminder for myself 🙂

Good old games are not all that good.

GOG.com is currently offering one of my all-time favorite games, Wing Commander for purchase and download. Even though I still have the original floppies somewhere, I whipped out my credit card and figured I’d spend a fun afternoon with it. My friend Francis came over that day, and he’d never heard of it (he is 20 years old and was not quite born yet when the game was released), so I figured I’d show him what a great game it was. Except it turns out it isn’t. Because we live in the future now.

Never mind that it took a while to configure DOSBox properly, the game itself just doesn’t hold up to modern standards in so many ways:

  • The aspect ratio of 4:3 (with occasional Letterbox bars in movie sequences) was stretched onto my 16:9 TV.
  • The controls keyboard+mouse, but WASD wasn’t invented yet, and the mouse sensitivity is all wrong. Mice were new, and the OS didn’t have sensitivity preferences.
  • The graphics are 320x200x8. The art is good within those limitations, but looks terrible to our modern eyes, especially on a 40" screen.
  • Support for my game pad is so bad that I chose to play without it. In fact, having it plugged in made the mouse cursor jitter. Joysticks for PCs were pretty unusual then, and they didn’t have 16 buttons and weren’t always analog.

On the plus side, I was right about the game being crack for Francis. The story is great, even full of tropes as it is, and the pacing works, the space combat is exactly what a young nerd who has seen too much Star Wars wants it to be like. There are likeable characters that you care about, and your protagonist’s character development is fantastic. This game would still be a blockbuster if it was made today, with today’s technology. But as it is, it runs in an emulator and is stuck in the technological constraints of the very early 90s.

Compare this with the movies or music industry. If the only way to watch Charlie Chaplin’s movies today was to go to a cinema and watch it on the original celluloid, few of us would even know who he is. But the movie industry has moved with the times, and I can watch Metropolis on Blu-ray and Charlie Chaplin on Netflix. And before this, they were available on VHS and Laserdisc.

I strongly believe the Game Industry is leaving lots of money on the table by neglecting its back catalog in this way. There is an entire generation of consumers that have never played the great games of the 90s, and we’re discouraging them from that because we’re basically letting these games rot.

What it takes to keep these games attractive is not a reboot every couple of years. Those are expensive and risky, as DNF should have shown all of us. Why aren’t we just keeping the original games fresh? If new hardware comes along, or the way people consume games changes, it should be so much easier to adapt an existing game to that then to make an entirely new game. To use my Wing commander example: Support game pads. Port it to consoles. Sell it on Steam. If numbers are still good after 10 years, pay a studio to re-do all the art in higher resolution, using the originals as their guide. Don’t make me use an emulator.

There are a few games that get this. Another World had a 15th anniversary edition with new graphics and a port to Windows. Monkey Island released a Special Edition that was the talk of the press, because who doesn’t love Monkey Island? It’s gorgeous, and it got me to play through one of my favorite games one more time. And you know what? The story holds up, the humor is still funny, and it doesn’t feel like I’m playing something that came out of a time capsule.