Game explorer: Difference between revisions
No edit summary |
|||
Line 13: | Line 13: | ||
Function GameExplorer | Function GameExplorer | ||
Push $0 | |||
; Check if we have Vista or later | ; Check if we have Vista or later |
Revision as of 23:27, 30 March 2007
Author: codev (talk, contrib) |
Description
Microsoft Windows Vista ships with a feature called Game Explorer that allows a developer to list games in a central explorer location. Following the useful code from kichik and Doca Cola in this thread: http://forums.winamp.com/showthread.php?s=&threadid=258969 I wrote an installer that adds an item to Game Explorer and removes it.
To integrate with Game Explorer you need to add a gdf xml file, icon and screenshot to the resources of an exe or dll that installs with your app. You can generate these with the Game Explorer tool that ships in the Microsoft DirectX SDK. You will also need that SDK for the GameuxInstallHelper.dll library these routines use to install the app.
The code
RequestExecutionLevel admin !define GIS_CURRENT_USER 2 !define GIS_ALL_USERS 3 Function GameExplorer Push $0 ; Check if we have Vista or later ClearErrors ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion IfErrors finished StrCpy $0 $0 1 IntCmp $0 6 0 finished ; Register with Game Explorer if so SetOutPath $Temp File "GameuxInstallHelper.dll" ; Remove first to avoid duplication ReadRegStr $0 HKCU "Software\TITLE" "GameExplorer" StrCmp $0 '' skipUninstall System::Call "GameuxInstallHelper::RemoveFromGameExplorer(g r0)" System::Call "GameuxInstallHelper::RemoveTasks(g r0)" skipUninstall: ; Now add to GE System::Call "GameuxInstallHelper::GenerateGUID(g .r0)" WriteRegStr HKCU "Software\TITLE" "GameExplorer" $0 System::Call "GameuxInstallHelper::AddToGameExplorer(t 'GDFEXE', t 'APPPATH', i ${GIS_ALL_USERS}, g r0 r0)" System::Call "GameuxInstallHelper::CreateTask(i ${GIS_ALL_USERS}, g r0, i 0, i 0, t 'Play', t 'PROGPATH', t 'PROGARGS')" System::Call "GameuxInstallHelper::CreateTask(i ${GIS_ALL_USERS}, g r0, i 1, i 0, t 'Support', t 'http://www.codev.co.uk/', t '')" finished: Pop $0 FunctionEnd Function un.GameExplorer Push $0 ; Check if we have Vista or later ClearErrors ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion IfErrors finished StrCpy $0 $0 1 IntCmp $0 6 0 finished ; Remove from game explorer SetOutPath $Temp File "GameuxInstallHelper.dll" ReadRegStr $0 HKCU "Software\TITLE" "GameExplorer" StrCmp $0 '' finished System::Call "GameuxInstallHelper::RemoveFromGameExplorer(g r0)" System::Call "GameuxInstallHelper::RemoveTasks(g r0)" finished: Pop $0 FunctionEnd
Usage
Just put Call GameExplorer in your install section and Call un.GameExplorer in your uninstall section.
Replace TITLE with the name of your app, GDFAPP with the executable containing the GDF resources, APPPATH with the application path, PROGPATH with the program to run when the user double clicks your game (you can add arguments in the place of PROGARGS) and your application's website in the place of http://www.codev.co.uk