win32: register with the Game Explorer

scancodes-fix
Günther Brammer 2011-10-30 16:16:14 +01:00
parent 95582747db
commit d995490137
4 changed files with 252 additions and 125 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<GameDefinitionFile xmlns:baseTypes="urn:schemas-microsoft-com:GamesExplorerBaseTypes.v1" xmlns="urn:schemas-microsoft-com:GameDescription.v1">
<GameDefinition gameID="{C90AA63B-E8DB-4EAF-88EC-B5257A86FF5A}">
<Name>OpenClonk</Name>
<Genres>
<Genre>Action</Genre>
<Genre>Strategy</Genre>
</Genres>
<Version>
<VersionFile path="Clonk.exe" />
</Version>
<SavedGames baseKnownFolderID="{f1b32785-6fba-4fcf-9d55-7b8e7f157091}" path="OpenClonk" />
<Developers>
<Developer URI="http://openclonk.org">OpenClonk Project</Developer>
</Developers>
</GameDefinition>
</GameDefinitionFile>

View File

@ -4,29 +4,16 @@
#include "C4Version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <winresrc.h>
#define IDC_STATIC (-1)
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
// Icons
//
// Icon with lowest ID value placed first to ensure application icon
@ -44,33 +31,13 @@ IDI_10_OCV ICON DISCARDABLE "ocv.ico"
IDI_11_OCL ICON DISCARDABLE "ocl.ico"
IDI_13_OCU ICON DISCARDABLE "ocu.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
// Game Explorer Integration
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
__GDF_XML DATA "WindowsGamesExplorer.xml"
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
@ -113,12 +80,9 @@ BEGIN
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
// Dialogs
//
IDD_CONSOLE DIALOGEX 0, 0, 232, 127
@ -203,50 +167,6 @@ BEGIN
ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONSOLE, DIALOG
BEGIN
LEFTMARGIN, 1
RIGHTMARGIN, 230
TOPMARGIN, 1
BOTTOMMARGIN, 126
END
IDD_PROPERTIES, DIALOG
BEGIN
LEFTMARGIN, 2
RIGHTMARGIN, 166
TOPMARGIN, 2
BOTTOMMARGIN, 60
END
IDD_TOOLS, DIALOG
BEGIN
LEFTMARGIN, 2
RIGHTMARGIN, 192
TOPMARGIN, 2
BOTTOMMARGIN, 53
END
IDD_COMPONENT, DIALOG
BEGIN
LEFTMARGIN, 1
RIGHTMARGIN, 276
TOPMARGIN, 1
BOTTOMMARGIN, 148
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
@ -322,16 +242,3 @@ BEGIN
END
END
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,184 @@
# user interface
!define GameExplorer_GenerateGUID '!insertmacro GameExplorer_GenerateGUID'
!define GameExplorer_AddGame '!insertmacro GameExplorer_AddGame'
!define GameExplorer_UpdateGame '!insertmacro GameExplorer_UpdateGame'
!define GameExplorer_RemoveGame '!insertmacro GameExplorer_RemoveGame'
# internal stuff
!define CLSCTX_INPROC_SERVER 1
!define IID_IGameExplorer {E7B2FB72-D728-49B3-A5F2-18EBF5F1349E}
!define CLSID_GameExplorer {9A5EA990-3034-4D6F-9128-01F3C61022BC}
!define GIS_CURRENT_USER 2
!define GIS_ALL_USERS 3
!define IGameExplorer_QueryInterface 0
!define IGameExplorer_AddRef 1
!define IGameExplorer_Release 2
!define IGameExplorer_AddGame 3
!define IGameExplorer_RemoveGame 4
!define IGameExplorer_UpdateGame 5
!define IGameExplorer_VerifyAccess 6
# includes
!include LogicLib.nsh
# the actual code
!macro GameExplorer_GenerateGUID
System::Call 'ole32::CoCreateGuid(g .s)'
!macroend
!macro GameExplorer_AddGame CONTEXT GDF INSTDIR EXE GUID
!define __GAME_EXPLORER_UNIQUE "${__LINE__}${__FILE__}"
Push $0
Push $1
Push $R0
Push $R1
Push $R2
Push $R3
Push "${EXE}"
Push "${GUID}"
Push "${INSTDIR}"
Push "${GDF}"
Pop $R0 # == ${GDF}
Pop $R1 # == ${INSTDIR}
Pop $R2 # == ${GUID}
Pop $R3 # == ${EXE}
ClearErrors
System::Call "ole32::CoCreateInstance( \
g '${CLSID_GameExplorer}', i 0, \
i ${CLSCTX_INPROC_SERVER}, \
g '${IID_IGameExplorer}', *i .r1) i .r0"
${If} $0 != 0 # S_OK
SetErrors
Goto "done_${__GAME_EXPLORER_UNIQUE}"
${EndIf}
${If} ${CONTEXT} == AllUsers
System::Call "$1->${IGameExplorer_AddGame}(w R0, w R1, i ${GIS_ALL_USERS}, g R2) i .r0"
${Else}
System::Call "$1->${IGameExplorer_AddGame}(w R0, w R1, i ${GIS_CURRENT_USER}, g R2) i .r0"
${EndIf}
${If} $0 != 0 # S_OK
SetErrors
${Else}
# Create play task
CreateDirectory $APPDATA\Microsoft\Windows\GameExplorer\$R2\PlayTasks\0
CreateShortcut $APPDATA\Microsoft\Windows\GameExplorer\$R2\PlayTasks\0\Play.lnk $R3
${EndIf}
System::Call "$1->${IGameExplorer_Release}()"
"done_${__GAME_EXPLORER_UNIQUE}:"
Pop $R3
Pop $R2
Pop $R1
Pop $R0
Pop $1
Pop $0
!undef __GAME_EXPLORER_UNIQUE
!macroend
!macro _GameExplorer_GUID_Function Function GUID
!define __GAME_EXPLORER_UNIQUE "${__LINE__}${__FILE__}"
Push $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $R0
Push "${GUID}"
Pop $R0 # == ${GUID}
System::Alloc 16
Exch $R0
System::Call "ole32::CLSIDFromString(w s, i R0)"
System::Call "*$R0(i .r2, i .r3, i .r4, i .r5)"
System::Free $R0
ClearErrors
System::Call "ole32::CoCreateInstance( \
g '${CLSID_GameExplorer}', i 0, \
i ${CLSCTX_INPROC_SERVER}, \
g '${IID_IGameExplorer}', *i .r1) i .r0"
${If} $0 != 0 # S_OK
SetErrors
Goto "done_${__GAME_EXPLORER_UNIQUE}"
${EndIf}
System::Call "$1->${Function}(i r2, i r3, i r4, i r5) i .r0"
${If} $0 != 0 # S_OK
SetErrors
${EndIf}
System::Call "$1->${IGameExplorer_Release}()"
"done_${__GAME_EXPLORER_UNIQUE}:"
Pop $R0
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!undef __GAME_EXPLORER_UNIQUE
!macroend
!macro GameExplorer_UpdateGame GUID
!insertmacro _GameExplorer_GUID_Function ${IGameExplorer_UpdateGame} "${GUID}"
!macroend
!macro GameExplorer_RemoveGame GUID
!insertmacro _GameExplorer_GUID_Function ${IGameExplorer_RemoveGame} "${GUID}"
!macroend

View File

@ -17,6 +17,7 @@
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_INSTDIR}"
!define PRODUCT_USER_KEY "Software\${PRODUCT_COMPANY}\OpenClonk"
!define PRODUCT_COMPANY_KEY "Software\${PRODUCT_COMPANY}"
!define PRODUCT_GAME_EXPLORER_INSTANCE {366C86B6-FD74-BD8E-0F02-F0AE847304A9}
Name "${PRODUCT_NAME}"
SetCompressor lzma
@ -71,6 +72,9 @@ LangString MUI_TEXT_USERPATH ${LANG_English} "User Path"
;ReserveFile "${NSISDIR}\Plugins\*.dll"
; MUI end ------
; Game Explorer
!include "${SRCDIR}/tools/install\GameExplorer.nsh"
ShowInstDetails show
ShowUnInstDetails show
@ -78,39 +82,49 @@ Section
SetOutPath "$INSTDIR"
SetOverwrite on
; Main program files
; Main program files
File "${CLONK}"
File "${C4GROUP}"
File "*.dll"
File "*.oc?"
File "${SRCDIR}\planet\AUTHORS"
File "${SRCDIR}\planet\COPYING"
File "${SRCDIR}\licenses\LGPL.txt"
File "${SRCDIR}\Credits.txt"
; Create user path (works for the installing user only... might also want to put an info.txt dummy in there...)
; Create user path (works for the installing user only... might also want to put an info.txt dummy in there...)
CreateDirectory "$APPDATA\OpenClonk"
; Create desktop shortcut
CreateShortcut "$DESKTOP\OpenClonk.lnk" "$INSTDIR\Clonk.exe"
; Create website url in program directory
; Create website url in program directory
WriteIniStr "$INSTDIR\${PRODUCT_WEB_SITE_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
; Create user path shortcut in program directory
CreateShortCut "$INSTDIR\$(MUI_TEXT_USERPATH).lnk" "%APPDATA%\OpenClonk"
; Game Explorer integration
${GameExplorer_AddGame} $MultiUser.InstallMode $INSTDIR\Clonk.exe $INSTDIR $INSTDIR\Clonk.exe ${PRODUCT_GAME_EXPLORER_INSTANCE}
; Start menu shortcuts
CreateDirectory "$SMPROGRAMS\OpenClonk"
CreateShortCut "$SMPROGRAMS\OpenClonk\OpenClonk.lnk" "$INSTDIR\Clonk.exe"
CreateShortCut "$SMPROGRAMS\OpenClonk\OpenClonk Editor.lnk" "$INSTDIR\Clonk.exe" "--editor"
CreateShortCut "$SMPROGRAMS\OpenClonk\${PRODUCT_WEB_SITE_NAME}.lnk" "$INSTDIR\${PRODUCT_WEB_SITE_NAME}.url"
CreateShortCut "$SMPROGRAMS\OpenClonk\$(MUI_TEXT_USERPATH).lnk" "%APPDATA%\OpenClonk"
IfErrors StartMenu 0
CreateDirectory $APPDATA\Microsoft\Windows\GameExplorer\${PRODUCT_GAME_EXPLORER_INSTANCE}\SupportTasks\0
CreateShortcut $APPDATA\Microsoft\Windows\GameExplorer\${PRODUCT_GAME_EXPLORER_INSTANCE}\SupportTasks\0\Editor.lnk $INSTDIR\Clonk.exe --editor
goto EndStartMenu
; Uninstaller info
StartMenu:
; Create desktop shortcut
CreateShortcut "$DESKTOP\OpenClonk.lnk" "$INSTDIR\Clonk.exe"
; Create user path shortcut in program directory
CreateShortCut "$INSTDIR\$(MUI_TEXT_USERPATH).lnk" "%APPDATA%\OpenClonk"
; Start menu shortcuts
CreateDirectory "$SMPROGRAMS\OpenClonk"
CreateShortCut "$SMPROGRAMS\OpenClonk\OpenClonk.lnk" "$INSTDIR\Clonk.exe"
CreateShortCut "$SMPROGRAMS\OpenClonk\OpenClonk Editor.lnk" "$INSTDIR\Clonk.exe" "--editor"
CreateShortCut "$SMPROGRAMS\OpenClonk\${PRODUCT_WEB_SITE_NAME}.lnk" "$INSTDIR\${PRODUCT_WEB_SITE_NAME}.url"
CreateShortCut "$SMPROGRAMS\OpenClonk\$(MUI_TEXT_USERPATH).lnk" "%APPDATA%\OpenClonk"
EndStartMenu:
; Uninstaller info
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr SHELL_CONTEXT "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr SHELL_CONTEXT "${PRODUCT_UNINST_KEY}" "UninstallString" \
@ -123,7 +137,7 @@ Section
WriteRegStr SHELL_CONTEXT "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr SHELL_CONTEXT "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
WriteRegStr SHELL_CONTEXT "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
; Register file types
; Register file types
WriteRegStr HKCR ".ocs" "" "OpenClonk.Scenario"
WriteRegStr HKCR ".ocs\Content Type" "" "vnd.clonk.c4group"
WriteRegStr HKCR ".ocg" "" "OpenClonk.Group"
@ -146,7 +160,8 @@ Section
WriteRegStr HKCR ".ocl\Content Type" "" "vnd.clonk.c4group"
WriteRegStr HKCR ".ocu" "" "OpenClonk.Update"
WriteRegStr HKCR ".ocu\Content Type" "" "vnd.clonk.c4group"
; Register file classes
; Register file classes
WriteRegStr HKCR "OpenClonk.Scenario" "" "OpenClonk Scenario"
WriteRegStr HKCR "OpenClonk.Scenario\DefaultIcon" "" "$INSTDIR\Clonk.exe,1"
WriteRegStr HKCR "OpenClonk.Group" "" "OpenClonk Group"
@ -169,7 +184,8 @@ Section
WriteRegStr HKCR "OpenClonk.Weblink\DefaultIcon" "" "$INSTDIR\Clonk.exe,10"
WriteRegStr HKCR "OpenClonk.Update" "" "OpenClonk Update"
WriteRegStr HKCR "OpenClonk.Update\DefaultIcon" "" "$INSTDIR\Clonk.exe,11"
; Register additional file handling
; Register additional file handling
WriteRegStr HKCR "OpenClonk.Update\Shell\Update" "" "Update"
WriteRegStr HKCR "OpenClonk.Update\Shell\Update\Command" "" "$\"$INSTDIR\Clonk.exe$\" $\"%1$\""
@ -191,22 +207,29 @@ Section Uninstall
Delete "$INSTDIR\LGPL.txt"
Delete "$INSTDIR\OpenSSL.txt" ; For installations up to 5.2.x
Delete "$INSTDIR\Credits.txt"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\${PRODUCT_WEB_SITE_NAME}.url"
Delete "$INSTDIR\$(MUI_TEXT_USERPATH).lnk"
RMDir "$INSTDIR"
; Game Explorer
${GameExplorer_RemoveGame} ${PRODUCT_GAME_EXPLORER_INSTANCE}
; Desktop shortcut
Delete "$DESKTOP\OpenClonk.lnk"
; Start menu shortcuts
Delete "$SMPROGRAMS\OpenClonk\*.lnk"
RMDir "$SMPROGRAMS\OpenClonk"
; Registry: config
DeleteRegKey HKCU "${PRODUCT_USER_KEY}"
DeleteRegKey /ifempty HKCU "${PRODUCT_COMPANY_KEY}"
; Registry: Uninstaller info
DeleteRegKey SHELL_CONTEXT "${PRODUCT_UNINST_KEY}"
; Registry: classes
DeleteRegKey HKCR ".ocs"
DeleteRegKey HKCR "OpenClonk.Scenario"
@ -230,9 +253,5 @@ Section Uninstall
DeleteRegKey HKCR "OpenClonk.Weblink"
DeleteRegKey HKCR ".ocu"
DeleteRegKey HKCR "OpenClonk.Update"
; Start menu shortcuts
Delete "$SMPROGRAMS\OpenClonk\*.lnk"
RMDir "$SMPROGRAMS\OpenClonk"
SectionEnd