Jump to content
Sign in to follow this  
azrapse

Unified way to find the game's directory?

Recommended Posts

Hi. I'm writing a tool that needs to find the game's folder automatically. The problem is that I cannot easily find out how, because the game can be installed standalone or through Steam, and it doesn't write it's path to any key in the Registry in my Steam version.

Also, Steam can be installed in different places, and the game library could be installed in a path unrelated to Steam's own executable path.

I have seen that the SDK has a bat file attempting to find out the game folder by looking it up at the Registry, but it fails when I run it and I have to manually edit that file with the right path for it to work.

Does anyone have any hint?

Share this post


Link to post
Share on other sites

I would probably use this if you have it http://www.delphibasics.co.uk/RTL.asp?Name=FileSearch

OR FindFirst and FindNext(or your languages equivalent), here it is in pascal http://www.delphibasics.co.uk/RTL.asp?Name=FindNext

With this use a generic search for *.*, parse all folders except "." and ".." and then add all files that match "carrier.exe". If it is a different name for the stand alone then you need to look out for that too. The second one takes a long time but has the advantage of searching all folders if you are unsure where to look.

Edited by disorder

Share this post


Link to post
Share on other sites

Some ways of detecting the game folder through the registry (Windows 7 x64, other windows versions might vary):

- Using the uninstall information for installed software under [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall]

[u]Steam version[/u]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 65740]
"InstallLocation"="[b]D:\\SteamLibrary\\steamapps\\common\\Carrier Command Gaea Mission[/b]"
[u]BIS store version[/u]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\CarrierCommand]
"UninstallString"="[b]D:\\Program Files\\Bohemia Interactive\\Carrier Command Gaea Mission[/b]\\UnInstall.exe"

-Under Windows 7 volume mixer settings are saved under [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore].

Searching there for carrier.exe will give you a key containing the full path.

For example {0.0.0.00000000}.{c7e26ded-2d6f-4c5e-a96b-7a8234c4fa18}|\Device\HarddiskVolume6\Program Files\Bohemia Interactive\Carrier Command Gaea Mission\carrier.exe%b{00000000-0000-0000-0000-000000000000}. You will have to find which drive letter is HarddiskVolumeX.

Share this post


Link to post
Share on other sites
I would probably use this if you have it http://www.delphibasics.co.uk/RTL.asp?Name=FileSearch

OR FindFirst and FindNext(or your languages equivalent), here it is in pascal http://www.delphibasics.co.uk/RTL.asp?Name=FindNext

With this use a generic search for *.*, parse all folders except "." and ".." and then add all files that match "carrier.exe". If it is a different name for the stand alone then you need to look out for that too. The second one takes a long time but has the advantage of searching all folders if you are unsure where to look.

Hmm. I think that could take like... forever... if I have to start searching at the root of the drive. And I would need to scan for all the drives... Definitely there must be an instant way to get it. Thanks for the suggestion, anyway. :)

Some ways of detecting the game folder through the registry (Windows 7 x64, other windows versions might vary):

- Using the uninstall information for installed software under [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall]

[u]Steam version[/u]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 65740]
"InstallLocation"="[b]D:\\SteamLibrary\\steamapps\\common\\Carrier Command Gaea Mission[/b]"
[u]BIS store version[/u]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\CarrierCommand]
"UninstallString"="[b]D:\\Program Files\\Bohemia Interactive\\Carrier Command Gaea Mission[/b]\\UnInstall.exe"

I think it is a little bit hackish, but it's quite ingenious also. Thanks for the idea. I think I will go with this one! :D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×