Skip to content

G2HR Windows Installer

robotanarchy edited this page Aug 17, 2015 · 1 revision

A G2HR Windows installer was planned for version 0.4, but then discarded due to lack of time. It is included in the source tree and can be completed later though. Here's a quick write-up of how it works and what is already implemented.

backend

The backend code is written in lightweight C and can handle the following actions:

  • default: extracts the frontend to a temporary path and runs it (with the path to the backend as parameter)
  • verify: verifies the SHA-512 sum of the original GTA2 installer
  • extract_all: extracts all files included in the installer to a path passed by the frontend
  • cleanup: cleans up the frontend in the temporary folder

Look in src/installer/pack.sh for information, how the packing works (it's a simple Unix shell script).

frontend

Because writing the frontend in C code would take even more time and the AutoIt3 runtime is already used in the 'meta' component of the mod, the installer frontend is also written in AutoIt3. If someone wants to port it to pure C, go ahead!

  • 1st screen: asks for the original GTA2 installer, and tries to verify it.
  • 2nd screen: can only be opened, once the installer has been verified. the user can select the folder, where the mod should be installed to (by default in %APPDATA%/bytewerk/G2HR, as this is the path SDL2 chooses to save settings in)
  • 3rd screen: the actual install progress. It is planned, that the original GTA2 content gets extracted somehow, and then the extract_all backend command gets executed

IPC

Inter-process communication between both components. Both components set environment variables to pass parameters (so we don't need to escape spaces in paths etc), and the backend can spawn a hidden window and set a title as a status message. The autoit code reads that window and fills a progress-bar or shows the message (already implemented)

Extracting the GTA2 installer

This is the only part, that isn't working at all right now. The installer was made with InstallShield version 7, so right now there are no open source extracting tools (this would be the best way!). If there was one, we could integrate the extracting functionality in the backend and have the whole thing completed.

Of course InstallShield7 doesn't provide options to just extract the contents.

workaround: sandboxing

The installer can do some sort of silent install (when providing an ini file that contains the installation procedure). We could combine that with a proxy-dll to avoid registry reads and writes. Otherwise it probably will fail, in case the game is already installed (we want a side-by-side installation, so we know, that the files have not been modified yet, this is better for troubleshooting etc).

uninstaller

not written yet, but could be easily done in autoit3.