Jump to content
LaunchBox Community Forums

Found a method to launch GOG, etc. games similarly to Steam games


Firefairy

Recommended Posts

TL;DR: You can use a copy-paste batch file and a PowerShell script to emulate the Steam behavior that allows games to be handled well whether or not they are currently installed. You will need to know where files go with each game; the simplest way to do this is to install them, then uninstall them once you get them into LaunchBox.

Full version:
I came up with this after learning that the current way to import GOG/Itch/GameJolt games and any other games that don't show up in the Start menu was to create shortcuts and import those. If I was going to do that, surely I could figure out some way to have the ones that come with launchers in a friendlier fashion.

So, this does involve a bit more work, but it saves me from having to keep all my games installed in order for them to show up in LaunchBox and provides a clean link to the relevant launcher/installer if I do want to play them. Once I get the batch and script set up, I can uninstall the games until I want them.

In place of the shortcut, there's a batch file to run a PowerShell script. Slightly more trouble to make than a shortcut, but it's still copy-paste easy. The added bit is the script, which checks to see if the game is installed (by looking for a file that would be present if it is), and either runs the game or the relevant launcher, as appropriate. Again, copy and paste easy.

I have one folder to hold the batch files, with a subfolder to hold the scripts, which keeps things nice and neat and easy to import if I need to do it again.

Part 1: The Batch File.

All this does is run PowerShell.exe, tell it not to bother you by asking for a signed script at the moment, then the script to run. The "remotesigned" in the middle actually tells it to still ask for signatures/permission on scripts downloaded from the internet, but not local scripts. Without that, you would need to confirm every time, which kind of misses the point of automation. The .\Scripts\ folder is the subfolder where the scripts are.

So, to run the game Armikrog, which I have on GOG, I have the following batch and script.

Here's the contents of my Armikrog.bat:

Powershell.exe -executionpolicy remotesigned -File  .\Scripts\Armikrog.ps1

Part 2: The PowerShell Script.

This checks to see if a file you define is present (pick something that definitely means the game is installed), and if it is present, runs a command you define (can be the same as the first one), and if the file isn't present, runs the relevant launcher so you can install the game. The "-LiteralPath" and quotes help it handle spaces in the paths.

Here are the contents of Armikrog.ps1:

if (Test-Path -LiteralPath "Q:\GOG Galaxy\Games\Armikrog\Armikrog.exe")
{
& 'Q:\GOG Galaxy\Games\Armikrog\Armikrog.exe'
}
Else
{
& 'Q:\GOG Galaxy\GalaxyClient.exe'
}

The only slightly tricky part is that GOG had to do some wrangling to get old games working. For most of my games, I was able to open the Properties of the "Launch X game" shortcut in each GOG game folder, copy the target, and paste it in the first and second spots, as here. A few have command line arguments or are otherwise squirrely, so I just pointed at the shortcut itself for those.

I'll respond to this thread if I hit any other snags; hopefully I can save other people some trouble. ^.^

Edited by Firefairy
Link to comment
Share on other sites

Figured out a way to tell whether a game is likely to need to be installed from the link rather than directly- if there is a scummvm or dosbox subfolder to the game, it won't launch properly unless you use the link. That said, there isn't really any reason using the link every time is bad, it just requires a few more clicks (and for me, annoys my inner old-school codger).

Also- this is only relevant if you are using this install on multiple computers- some games might require you to verify or reinstall on each computer so that they have registry entries or external files that they need. From what I have seen, you should just do an install right over your existing files. This leaves your saves intact.

Edited by Firefairy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...