Skip to content

Add new Windows installer scripts

mazmazz requested to merge new-install into master

I made a new installer for .21 because I needed a way to move old DLLs and EXEs to an "old-install" folder for the patcher.

I treat that task as a requirement because we're changing the DLL lineup for .21 -- and, with 64-bit on the menu, it's a good idea to separate those binaries from 32-bit.

User Impact

This creates new Start Menu icons for SRB2, as well as an Uninstaller.

Most importantly, the installer sets the location default as C:\Users\[User]\AppData\Local\SRB2. This has the following implication:

  • If you install into AppData\Local or Program Files, your game data and WADs will be stored in your Windows account user folder: C:\Users\[User]\SRB2
  • If you install into any other location, it's business as usual: your data will be stored in your install folder
  • If you have a pre-existing install in AppData\Local or Program Files (hi MI 👋) AND config.cfg exists in that folder, your data remains in your install folder.

This mirrors game behavior that has existed for a while: if config.cfg is not found AND an SRB2 folder exists in your user profile, the game defaults to that location for data.

It's obscure behavior because nobody on Windows has bothered to make a user profile folder on first startup. However, it's standard practice on Linux and OSX.

Therefore, I made the installer create that folder if you're installing into the standard Program directories.

Bundling Process

This is similar to what was done previously.

  1. Zip up the install files into a 7z archive (NOT an EXE yet!)
    • All install files must be in a "new-install" subfolder, or the staging script will not work properly.
  2. Save the 7z archive to [repo-root]\windows-installer with these filenames:
    • Installer.7z - 32-bit full installer
    • Patch.7z - 32-bit patch
    • Installer_x64.7z - 64-bit full installer
    • Patch_x64.7z - 64-bit patch
  3. Run [repo-root]\windows-installer\BuildInstaller.bat. The EXE installers will generate in that folder.

Install Sequence

The idea is to preserve the old files that would be overwritten by the install, and leave it up to the user to delete those files. It leaves alone all non-install files, such as addons.

  1. Extract all files to the install directory. The new files to install are in [install-root]\new-install
  2. Run [install-root]\new-install\staging.bat
  3. If MoveOldExesDlls=1 in the script, copy existing *.exe and *.dll into [install-root]\old-install. Important for .21.
  4. For every file that exists in new-install, move that same existing file from [install-root] to old-install.
  5. Move new-install files into [install-root]
  6. Delete new-install folder.
  7. Show the user their user profile folder, or their install folder, depending on where they installed.

Uninstall Sequence

The idea is to remove only the install files, and leave the user's files alone. Show the user those leftover files and leave it up to them whether to delete.

  1. Ask "Do you want to uninstall SRB2?"
  2. Delete only the install files. If the user has a user profile folder for their data, leave that folder alone.
  3. Check for leftover files in the install folder and the user profile folder.
  4. Prompt the user whether they want to see those leftover files.
  5. Attempt to delete the install folder, if it is empty. Leave alone if non-empty.

Scenarios Tested

  • Installing into C:\Program Files and C:\Users\[User]\AppData\Local
  • Installing into other folders
  • Installing into administrator-required folders
  • Installing into network paths
  • Installing when the path has a space in it
  • Uninstalling from all of the above

Screenshots

Installer screen:

image

Patch screen:

image

Post-install screen:

image

Program group:

image

Uninstall screen (does not list all of the install files because I didn't package them for my tests):

image

Edited by mazmazz

Merge request reports