====== Compiling GTAV Leaked Salsa 🥫 ======
{{ :450px-gtav_compiled_source.jpg?nolink|}}
===== Prerequisites =====
It's strongly advised to use a virtual machine/clean windows installation. The install steps will install some R* internal tools.
You will also need the leaked source code. For obvious reasons it's not posted here.
* 3dsMax SDK 2010
* Incredibuild 4.0
* DXSDK June 2010
* Visual Studio 2012 to 2020
===== Prerequisite Setup =====
==== Install Incredibuild 4.0 ====
'''Incredibuild 4 has an expired sign certificate and will trigger a UAC alert on windows!'''
* If you encounter the error that the installer is "Blocked by your administrator," follow these steps:
** Hold Shift and right-click the incredibuild4_0.exe file, select "Copy as path."
** Open Command Prompt as Administrator.
** Paste the path and press Enter.
** Select to install "Incredibuild Agent," "Incredibuild Coordinator," and the extension for Visual Studio.
==== Install DirectX SDK June 2010 ====
==== Install OpenIV ====
* Create X:\ drive:
** Open Command Prompt.
** Run `net use X: \\localhost\c$\ /persistent:yes`.
* Create the folder X:\gta5 and copy all folders from `GTAVSP.7z\GTA V Source` into it.
* Right-click the folder X:\gta5, select "Properties," uncheck "Read-only," click Apply then OK.
* Copy all folders in `dll_patches.zip` to X:\gta5\tools_ng\bin, make sure to overwrite when copying.
* Open Command Prompt as Administrator and run the following commands, then close:
** `setx /m RS_TOOLSROOT X:\gta5\tools_ng`
** `setx /m DXSDK_DIR "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)"`
** `setx /m RS_CODEBRANCH X:\gta5\src\dev_ng`
* To ensure changes are finalized, restart the build machine.
===== Patching the Source Code =====
* Open `rush_patches-master.zip`.
* Copy `game` and `rage` folders to `X:\gta5\src\dev_ng`, make sure to overwrite when copying.
* (Optional) To skip the launcher requirement for running the game, copy `game` and `rage` folders from `OPTIONAL_FIXES` to the same folder.
===== Building the Game Binary =====
* Run `X:\gta5\src\dev_ng\game\VS_Project\load_sln_unity_2012.bat` and press Enter when you see WARNING.
* If prompted with "How do you want to open this file?", check "Always use this app to open .sln files" and click OK.
* Once the solution loads, open the dropdown menu that says "Debug" at the top, select "Configuration Manager."
* Change "Active Solution Platform" to "x64" and close the configuration window.
* Hold Ctrl key and click all projects under "GameLibs" and "Rage," right-click and select "Properties."
* In the "Configuration" dropdown, select "All Configurations." Select `C/C++ > All options`, under "Look for options or switches," search "err" and set "Treat Warnings as Errors" to "No (/WX-)", then click "Apply" and "OK." For faster compiles, search "mul" and set "Multiprocessor Compilation" to "Yes (/MP)."
** If you get the error C1060: Compiler is out of heap space during build, come back to the above setting and turn it off.
* Right-click the "game" project and select "Properties" and do step 5 again.
** Select `Linker > General` and change "Output File" to `X:\gta5\titleupdate\dev_ng\GTA5.exe`, then click "Apply" then "OK."
* At the top of the window, select `Build > Build Solution` and wait for the build to finish.
** (Optional) If the build finishes successfully, change build type at the top of the window from "Debug" to "BankRelease" and build again for better performance.
* Copy output binary to the game folder, make sure to overwrite the existing binary.
===== Note =====
* Building shaders and scripts can be skipped using the prebuilt files above. These steps are here to allow modding or for those who prefer to build from source as much as possible.
===== Building Shaders =====
* Under "Shaders," right-click the "shaders_rc" project and click "Build."
* (Optional) Build low-quality shaders.
* Right-click the "shaders_rc" project and click "Properties."
* Select `Configuration Properties > NMake`.
* Under "General," change all command lines from ending with win32_40.bat to ending with win32_40_lq.bat, then click "Apply" and "OK."
* Rebuild shaders.
* Copy `X:\gta5\titleupdate\dev_ng\common` to the game directory.
===== Building Game Scripts =====
* Open Command Prompt.
* Run the following commands:
** `X:`
** `cd X:\gta5\src\dev_ng`
** `setenv`
** `cd ..\..\tools_ng\bin\RageScriptEditor`
** `ragScriptEditor`
* In the editor, select `File > Open Project` and open `X:\gta5\script\dev_ng\singleplayer\GTA5_SP.scproj`.
* Select `Compiling > Intellibuild > Build Project`.
===== Patching Game Assets (Optional) =====
* Run OpenIV, select "Windows."
* Select the game folder and click "Continue."
* Open `GTA V\update\update2.rpf\x64\levels\gta5\script`.
* Click the "Edit mode" button and copy `X:\gta5\titleupdate\dev_ng\x64\levels\gta5\script\script.rpf` to the OpenIV window.
* (Optional) Fix Story Mode:
** Open `GTA V\update\update.rpf\common\data` and make sure "Edit Mode" is enabled.
** Under "XML Text Files," right-click `gameconfig.xml` and click "Edit."
** Under "Search," type "51000."
** Change the value of 51000 to 53000.
** Click "Save."
** Close OpenIV.
* From `rush_patches-master.zip`, copy all files in the `ARCHIVEFIX` folder to a separate location.
* Open `\update` and drag `update.rpf` and `update2.rpf` onto `ArchiveFix.exe`.
* Close both windows.
===== Running the Game =====
* In the game directory, create a file named `launch.bat` and add these contents:
`PlayGTAV.exe -noSocialClub -nokeyboardhook -nonetlogs`
* Optional ARGs:
** -kbgame - Start game with game keyboard enabled
** -output - Show console log of game
** -rag - Enable support for RAG, the internal game debugging tool
** -ragUseOwnWindow - Combined with -rag to make game run outside of RAG window
** -DoReleaseStartup - Start real Story Mode on launch