Archive: Vista Games Explorer and Media Center


Vista Games Explorer and Media Center
Hello all!

I've written a plug-in to aid in registering a game with Vista's new Games explorer as well as the Games section of Windows Media Center. I've already uploaded and documented it on the wiki, so now I'm just letting you guys know about it.

If anybody wants to help me out, the one thing I can't test is whether the game gets registered properly with Media Center on a 64-bit version of Windows with a 32-bit installer. Any reports are appreciated!


Working url: http://nsis.sourceforge.net/Games_plug-in

Looks good, there was a thread about the game explorer already, but it was using the system dll. A plugin for something is always helpful

One little thing, I thought the official way to restore mediacenter was to run %systemroot%\eHome\ehShell.exe and not looking for its window


Yep, I know about the other thread you're talking about. I originally started working with that code, but I wanted it to load the information directly from the embedded GDF instead of having to specify it twice, and after a while of trying to do that with the system dll I realized that it was getting ridiculous and made much more sense to do it as a plug-in.

I've also read the ehShell.exe approach you're talking about. For reference, it's documented here: http://msdn2.microsoft.com/en-us/library/ms977646.aspx

Note to anybody reading that code: IsMediaCenter() doesn't actually exist. They don't actually say this, but they want you to write that function yourself and use your own method for figuring out whether or not the game was launched from Media Center.

I could have gotten away with launching ehShell.exe at exit when I wrote MCEWrapper, but originally I tested my code directly in one of our games, and the advantage with the method I used is that it works even when you don't know when your game was launched from Media Center, so that's what I would suggest if you were building it directly into your game.

I found that approach from this blog post by Aaron Stebner, the Program Manager of Windows Media Center: http://blogs.msdn.com/astebner/archi...ia-center.aspx

Hopefully he knows what he's talking about. (Not that I have the greatest opinion about how Media Center was written...)


The findwindow approach is only slightly better, media center could be running but that doesnt mean your game was started from MCE. Putting MCE code in your app is silly anyway, but if you had to do it, you could pass some argument to the game to tell if it was started from MCE. For MCEWrapper it doesnt really matter what you do I guess. And I agree about MCE, it could be so much better than it is now


I agree with everything you said >:)


After some testing on Windows XP, it seems the FindWindow method doesn't return Media Center to fullscreen mode.

I've uploaded and new version that fixes that as well as other XP-related bugs, and reduced the footprint a little. I've also updated the Wiki page accordingly.


In my MCE controller app, I do SNDMSG(hMCE,WM_SYSCOMMAND,SC_MAXIMIZE,0); seems to work on XP, not really tested on Vista


That looks like it would work, but wouldn't it maximize Media Center after you've exited your game, even if you had it in window mode beforehand?

Granted, that would be a relatively minor gripe, since Media Center is intended to be used in fullscreen mode.


Yeah, I don't have the code in front of me right now, Im probably checking for WS_MAXIMIZE style or something like that to decide what message to send


the dll failes loading on my vista business installation while it just exits with error code 0, like documented, on xp pro sp2.

what's wrong with it?

nsis can't load the dll on runtime on vista, it says.


The DLL posted on the Wiki depends on MSVCR80.dll. It should be recompiled statically, or better yet, without the CRT.


static recompilation gave me a 120kb file.

thats ok for me, because it doesn't really matter in an 13mb game installer.

yet it should of course not waste that much space if unnecessary.

i would appreciate any optimization on this one.



also, though i now got it running, it failes on registering my game.

i have a valid GDF file, but the error message is "could not add or update game"

skrapion, you got any hint on what may be wrong?


Most likely it means you already registered the game on that machine, and then changed the GUID in your GDF. Use regedit to delete any old and invalid keys from this location:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\Games\{Whatever your GUIDs are}

I'll look into the dependency. I thought I'd got them all sorted out, but you know how it is.


Can't seem to get it to work!
I just can't seem to get it to work. I know the GDF is embedded (I checked using a resource editor) and I know the GDF is properly formatted (made using the GDF maker) and it seems to be all well and good.

The only thing in the exe is the GDF file, so, I don't know if there is a way to check for errors; so I only added an ${Else} to echo out if it doesn't register; and the game just won't register.

Using this code...

        Games::registerGame "$INSTDIR\pokequest.exe"
pop $0
${If} $0 != "0"
${AndIf} $0 != ""
MessageBox MB_OK "Game Registered!!!"
CreateDirectory "$0\PlayTasks\0"
CreateShortCut "$0\PlayTasks\0\Play.lnk" "$INSTDIR\pokequest.exe"
CreateDirectory "$0\SupportTasks\0"
CreateShortCut "$0\SupportTasks\0\Home Page.lnk" "http://pokequest.gtaero.net/"
CreateDirectory "$0\SupportTasks\1"
CreateShortCut "$0\SupportTasks\1\Forums.lnk" "http://pokequest.gtaero.net/forum"
${Else}
MessageBox MB_OK "Game Not Registered! @.@;;"
${EndIf}


and I get back "Game Not Registered! @.@;;" every time! I checked using regedit and found that there is no data in the registry for my game.

What is the problem? Does anyone know, can anyone help me?

[pokequest [dot] gtaero [dot] net/pokequest.exe] for reference. (It literally does nothing and wont even run without cygwin1.dll, all it has is the GDF embedded)

What is the value in $0? Is it "0" (indicating that there was an error) or "" (indicating that the target machine isn't Windows Vista)?

If it's "", and your machine is Windows Vista, then there's probably a bug in the plugin.

If it's "0", then check your log messages, because it should give you a better error message there.


Originally posted by Skrapion
What is the value in $0? Is it "0" (indicating that there was an error) or "" (indicating that the target machine isn't Windows Vista)?

If it's "", and your machine is Windows Vista, then there's probably a bug in the plugin.

If it's "0", then check your log messages, because it should give you a better error message there.
Okay; EDIT; I checked the log; and it seems that its failing to find the GDF embedded. As far as I know; the GDF is embedded, and it seems to be embedded correctly in the EXE file. I'll run a check installing the "bejewled.exe" file using NSIS to see if it does the same or if it works...

FOLLOWUP: I used the Bejeweled.exe from PopCap Games, and it gives a problem. "The following error occurred while parsing the GDF data embedded in 'C:\Program Files\pokequest\pokequest.exe'
Error document empty."

FOLLOWUP: I found a problem in the EXE, not having the resource named correctly; I fixed that problem up right quick and its giving me the same error it did with Bejeweled, That the Error Document Empty. They're set to the Neutral Language. So I believe its a problem with the plugin?

FOLLOWUP: The Same problem happens with it set to English (United States). ???

It seems the plugin doesn't like UTF-16. Convert the xml file to UTF-8 (including the <?xml?> statement) and try again.

I'll put that on my TODO list, but I'm too busy to fix it until next month.


Originally posted by Skrapion
It seems the plugin doesn't like UTF-16. Convert the xml file to UTF-8 (including the <?xml?> statement) and try again.

I'll put that on my TODO list, but I'm too busy to fix it until next month.
Thanks; yeah, it was because it was using UTF-16. You really need to build in some support for that for the poor chinese users :-p

Thanks a whole bunch man, you're the greatest :3

No problem. Let me know if you find more bugs!