Skip to content

Instantly share code, notes, and snippets.

@WamWooWam
Last active November 11, 2021 02:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WamWooWam/c86017c5ac1ccd3ee2ad0a0c1c1e7859 to your computer and use it in GitHub Desktop.
Save WamWooWam/c86017c5ac1ccd3ee2ad0a0c1c1e7859 to your computer and use it in GitHub Desktop.
Replacement PlayGTAV.exe for the Epic Games Store version of Grand Theft Auto V
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
//
// If you replace PlayGTAV.exe in your game folder with this code, it'll fix two problems:
// - The game will launch successfully if you simply double click PlayGTAV.exe (it'll actually launch EGS properly)
// - You won't have to accept a UAC prompt every time you launch the game
// - If the exe doesn't find Rockstar Social Club, it'll try and install it from the default location
//
// Rockstar could've done this very easily, but they didn't, because Rockstar are twats.
//
static class Program
{
private const string INSTALLER_REG_KEY = "SOFTWARE\\WOW6432Node\\Rockstar Games\\Launcher";
static void Main(string[] args)
{
if (args.Length == 0)
{
Process.Start("com.epicgames.launcher://apps/9d2d0eb64d5c44529cece33fe2a46482?action=launch&silent=true");
}
else
{
var key = Registry.LocalMachine.OpenSubKey(INSTALLER_REG_KEY); // support non-standard launcher locations
if (key == null)
{
// if we couldn't open the key, it's safe to assume Social Club isn't installed
var installerPsi = new ProcessStartInfo(Path.Combine(Directory.GetCurrentDirectory(), "Redistributables", "Rockstar-Games-Epic.exe"));
installerPsi.Verb = "runas";
Process.Start(installerPsi).WaitForExit();
key = Registry.LocalMachine.OpenSubKey(INSTALLER_REG_KEY);
}
var val = (string)key.GetValue("InstallFolder");
var psi = new ProcessStartInfo($@"{val}\Launcher.exe", string.Join(" ", args) + " -skipPatcherCheck -epicAppId=gta5 @args.txt");
psi.UseShellExecute = false;
Process.Start(psi).WaitForExit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment