Skip to content
⌘ NSIS Forum Archive

windows vista -> nsis using game explorer

41 posts

mauvecloud#
I was able to add an entry to game explorer using the GUID extracted from the GDF resource beforehand, and code like the following:


;--------------------------------
Function GE_AddGame
SetOutPath $PLUGINSDIR
File "GameuxInstallHelper.dll"
System::Call 'GameuxInstallHelper::AddToGameExplorerStrGUID(t "$INSTDIR\${GDF_BINARY}", t "$INSTDIR\", i 3, t "${GAME_GUID}")'
FunctionEnd

;--------------------------------
Function GE_AddTasks
SetShellVarContext all
System::Call 'GameuxInstallHelper::CreateTaskStrGUID(i 3, t "${GAME_GUID}", i 0, i 0, t "Play", t "$INSTDIR\${GAME_EXE}", t "")'
SetShellVarContext current
FunctionEnd

;--------------------------------
Function un.GE_RemoveGame
SetOutPath $PLUGINSDIR
File "GameuxInstallHelper.dll"
System::Call 'GameuxInstallHelper::RemoveFromGameExplorerStrGUID(t "${GAME_GUID}")'
System::Call 'GameuxInstallHelper::RemoveTasksStrGUID(t "${GAME_GUID}")'
FunctionEnd
Possibly the GUID passed to the functions needs to be the same as in the GDF resource, but if that's the case, what's the point of having a GenerateGUID function in GameuxInstallHelper instead of an ExtractGUID function?
oborstad#
Originally posted by mauvecloud
Possibly the GUID passed to the functions needs to be the same as in the GDF resource, but if that's the case, what's the point of having a GenerateGUID function in GameuxInstallHelper instead of an ExtractGUID function?
It doesn't, the GUID that you use for passing into the game explorer should be unique so that you could potentially add multiple versions/installs of the game to the explorer if you really wanted to. The GenerateGUID was failing for me because I had the 64 bit version of the dll instead of the 32 bit version on a 32 bit system.

we use:

System::Call "GameuxInstallHelper::GenerateGUID(g .r0)"
StrCmp $0 '{00000000-0000-0000-0000-000000000000}' finished

System::Call "GameuxInstallHelper::AddToGameExplorer(t 'path_to_gdf_file', t 'path_to_exe', i ${GIS_ALL_USERS}, g r0) i .r4"

System::Call "GameuxInstallHelper::CreateTask(i ${GIS_ALL_USERS}, g r0, i 1, i 0, t 'Play', t 'path_to_exe', t 'arguments') i .r4"
System::Call "GameuxInstallHelper::CreateTask(i ${GIS_ALL_USERS}, g r0, i 0, i 0, t 'Support', t 'path_to_exe', t 'arguments') i .r4"

System::Call "GameuxInstallHelper::SetupRihcSavedGames(t '.save_game_extension', t 'path_to_exe', t 'Save_game_descriptor') i .r4"

System::Call "GameuxInstallHelper::RegisterWithMediaCenter(t 'path_to_gdf_file', t 'path_to_mcl_location', i ${GIS_ALL_USERS}, t 'path_to_exe', t 'args', i 0) i .r4"
finished:
${GIS_ALL_USERS} = 3, can be 1 for current user instead (HKCU vs LM and for limited user can be 1)

Hope that helps anyone else that is trying to get this up and running.

Owen.
kichik#
There's no need to use GameuxInstallHelper. There are better solutions available.


mauvecloud#
I fail to see how either of those is better than GameuxInstallHelper. The "Games" plugin looks like it will only work if the GDF is embedded in the EXE, not if it's in a separate DLL, and requires MSVCR80.dll. The "GameExplorer" header doesn't handle Media Center (and also looks a little buggy - I mean, why swap the GDF path and INSTDIR depending on current or all users?), and neither currently supports rich saved games.
kichik#
GameExplorer header is smaller, simpler, easier to get and just works. Just look at the length of this GameuxInstallHelper related thread to see what I mean. I've created the GameExplorer headers to help users avoid this DLL.
mauvecloud#
I'm doubtful of the "just works" part. I still don't understand the reversal of R0 and R1 depending on ${CONTEXT} in the following snippet:

!if ${CONTEXT} == all
System::Call "$1->${IGameExplorer_AddGame}(w R0, w R1, i ${GIS_ALL_USERS}, g R2) i .r0"
!else if ${CONTEXT} == user
System::Call "$1->${IGameExplorer_AddGame}(w R1, w R0, i ${GIS_CURRENT_USER}, g R2) i .r0"
!else
!error "Invalid CONTEXT passed to GameExplorer_AddGame! Must be `user` or `all`."
!endif
Anyway, I think the clarifications in this thread can be summarized as follows, and maybe added to a wiki page about GameuxInstallHelper:
1. The correct parameter type to use for the GUID (it's "g", not "i" or "*g" - the System plugin takes care of creating a GUID from the string and passing a pointer to it)
2. Use the 32-bit version of GameuxInstallHelper.dll, not the 64-bit version (unless maybe you want to only allow the game to be installed on a 64-bit system)
3. The GUID can be generated during the install, and shouldn't be the same as the gameID in the GDF resource.
Once those three things are understood, using GameuxInstallHelper is almost as easy as the GameExplorer header or Games plugin.
kichik#
If you're going to create a Wiki page for GameuxInstallHelper, I suggest you put a direct link to the correct version or step by step instructions for its location.
mauvecloud#
Here you go:
http://nsis.sourceforge.net/Game_Explorer_with_Helper
(I haven't figured out yet how this forum decides which links to block, so I'm leaving it as text for now)

For comparison:
Weaknesses of old Game Explorer header:
1. No save game support
2. No media center support
3. Additional tasks have to be created manually (with long paths to remember)
4. No support for pre-Vista systems that might get upgraded

Weaknesses of Games plug-in:
1. Requires msvcr80.dll (612 KB)
2. Can't handle GDF in separate dll
3. No save game support
4. All tasks have to be created manually
5. No support for pre-Vista systems that might get upgraded

Weaknesses of Game Explorer with Helper header:
1. Requires GameuxInstallHelper.dll (95 KB)
2. Doesn't support more than one game per installer
oborstad#
2. Doesn't support more than one game per installer
If you change the macro for the adding the game to do a check to see if the dll is already written out, then it should work fine to add multiple games, as long as you make sure to always add them in sequence.

!ifndef GAME_EXPLORER_DLL_EXISTS
!ifdef GAME_EXPLORER_HELPER_PATH
File "/oname=GameuxInstallHelper.dll" "${GAME_EXPLORER_HELPER_PATH}"
!else
File "GameuxInstallHelper.dll"
!endif
!define GAME_EXPLORER_DLL_EXISTS
!endif
Also, another suggestion, for localization reasons, I'd pull the "Play" task out of the first macro, otherwise the French will see "Play". Or put them in as extra label options. (Same for support), or make them come from language strings $(GameExplorerPlayTask) or something.

Owen.
mauvecloud#
Supporting more than one game per installer took a little more than just checking for the dll, due to the way it had been using defines for the play task number and support task number, which wouldn't work if the task adding was done in a function declared before the one that added the game, so I switched to variables, and it should be more robust now.

As far as localization, I see your point, but I don't want to force the use of LangStrings, so I pulled the task adding out of the GameExplorer_AddGame, and GameExplorer_AddPlayTask and GameExplorer_AddSupportTask already allow the task names to be specified separately.
Nico_BF#
Age Control

Hi Everybody,

I tried both posted versions of the game explorer integration and both worked quite well except for one thing. I was not able to insert the age control to the game explorer. It is definately set in the GDF file but it just doesn't show up.

In the old version it is missing and so I tried to add VerifyAccess to the macro like this

System::Call "$1->${IGameExplorer_VerifyAccess}(w R0, i R4) i .r0"

Unfortunately with no success.

In the new version it seems to me that the VerifyAccess is already implemented into the AddToGameExplorerA function but the age control still doesn't work.

Does anybody have any idea what the problem might be?

Thanks a lot for your help!