0

I'm making a installer for a GTA modification. When the user executes the .exe the first thing it does before showing any GUI is searching for where GTA-SA.exe is located.

I've written common install locations:

# Most common directories where GTA SA can be found

# Default installation directory from GTA SA setup
!define DEFAULT_DIR "$PROGRAMFILES\Rockstar Games\GTA San Andreas\"

# Default installation directory from Steam version
!define STEAM_DIR "$PROGRAMFILES\Steam\steamapps\common\Grand Theft Auto San Andreas"
!define OTHER_DIR_STEAM "D:\SteamLibrary\steamapps\common\Grand Theft Auto San Andrea"

# MixMods recommend users to install their GTA SA folder into Documents
!define MIXMODS_DIR "$DOCUMENTS"

And this is my Locate function inside .onInit code:

# Makes a search into the most common GTA installation folders to
# check where the GTA_SA.exe (or gta-sa.exe) is located
${locate::Open} "${STEAM_DIR}|${MIXMODS_DIR}|C:\|$PROGRAMFILES|${OTHER_DIR_STEAM}|D:\" `\
                /F=1 \
                /D=0 \
                /M=gta?sa.exe \
                /A=-HIDDEN|-SYSTEM \
                /-PN=Temp|WINDOWS` $0

Can searching through C:\ drive cause issues to the user (Specially in slow HDDs)? If so, what would be the best practice to make this search?

  • Is there no registry entry you can check? – Anders May 08 '22 at 17:16
  • @Anders With some search I was able to find the registry entry for the Steam version of the game. But most of the users (at least in the modding community) doesn't have a original copy of the program. – Pedro Toriality May 08 '22 at 19:09

1 Answers1

0

I think I get what you are trying to do.

You want to first check if GTA is installed and then you want to get the exact directory where it is installed.

Checking the Steam registry entries didn't work for you though because it could also be installed from another platform.

If I were you I would check this registry directory: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall".

All the programs wich can be uninstalled are located here, wich should include GTA, even if it was installed using some other platform than Steam.

You can then find the path where the game is installed in the GTA registry.

For more information I would recommend checking out this post here.

Let me know if I could help you with your issue.

SnarkDev
  • 111
  • 7
  • Thanks for your answer. With this information now I have both Steam version and CD version install directories. However, I still have problems with users that got the cracked game from .rar, which is a big number of users. But I think there isn't much I can do in this case. So, in that scenario, should I put the instdir as empty string and prompts the user to enter the right path, or making the locate in C:\ is fine? – Pedro Toriality May 13 '22 at 13:21
  • I would try to locate the game data and if it fails, (if the user has installed a cracked version), I would display a prompt in wich the user can input the path to the game files himself. You can't really do it any other way since you have no control over where the user might install a cracked version of the game. – SnarkDev May 16 '22 at 13:58