| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | @echo off | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :: Setting initial paths  | 
					
						
							|  |  |  | set "mo2_install=%cd%" | 
					
						
							|  |  |  | set "repository=%mo2_install%\Fika-Tarkov" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  | :: Specifying links to download for files | 
					
						
							|  |  |  | set "git_repository=https://files.moddinglounge.com/Rage/Fika-Tarkov.git" | 
					
						
							|  |  |  | set "git_file=https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.1/PortableGit-2.47.1-64-bit.7z.exe" | 
					
						
							|  |  |  | set "SevenZ_file=https://www.7-zip.org/a/7zr.exe" | 
					
						
							|  |  |  | set "mo2_file=https://github.com/ModOrganizer2/modorganizer/releases/download/v2.5.2/Mod.Organizer-2.5.2.7z" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  | :: Set path to the portable Git executable | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | set "portable_git=%mo2_install%\PortableGit\bin\git.exe" | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  | set "portable_7z=%mo2_install%\7zr.exe" | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | :: Check if curl is installed | 
					
						
							|  |  |  | where curl >nul 2>nul | 
					
						
							|  |  |  | if %errorlevel% neq 0 ( | 
					
						
							|  |  |  |     echo ERROR: curl is not installed or not in your PATH. | 
					
						
							|  |  |  |     echo Please install curl or ensure it is in your PATH and try again. | 
					
						
							|  |  |  |     pause | 
					
						
							|  |  |  |     exit /b | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :: Checking if Git Portable exists | 
					
						
							|  |  |  | if not exist "%mo2_install%\PortableGit\bin\git.exe" ( | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Installing Portable Git... | 
					
						
							|  |  |  |     :: Download Git Portable | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     curl -L -o PortableGit-2.47.1-64-bit.7z.exe %git_file% | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |      | 
					
						
							|  |  |  |     if %errorlevel% neq 0 ( | 
					
						
							|  |  |  |         echo ERROR: Failed to download Git Portable. Check your internet connection and try again. | 
					
						
							|  |  |  |         pause | 
					
						
							|  |  |  |         exit /b | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     :: Run the portable executable to setup | 
					
						
							|  |  |  |     start PortableGit-2.47.1-64-bit.7z.exe | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     set /p userInput=Press Enter once the Portable Git installation has finished. | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :: Check if 7z is installed | 
					
						
							| 
									
										
										
										
											2025-01-03 18:07:11 -05:00
										 |  |  | if not exist "%mo2_install%\7zr.exe" ( | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Installing 7zip Portable... | 
					
						
							|  |  |  |     :: Download 7zip Portable | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     curl -L -o 7zr.exe %SevenZ_file% | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  | :: Determining if an installation exists already | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | IF EXIST "%mo2_install%\ModOrganizer.exe" ( | 
					
						
							|  |  |  |     call :UpdateModpack | 
					
						
							|  |  |  |     exit /B 0 | 
					
						
							|  |  |  | ) ELSE ( | 
					
						
							|  |  |  |     call :InstallModpack | 
					
						
							|  |  |  |     exit /B 0 | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :UpdateModpack | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  |     echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
					
						
							|  |  |  |     echo                    WARNING! Existing installation detected! | 
					
						
							|  |  |  |     echo          Be sure to save a backup of your changes if you want to keep them! | 
					
						
							|  |  |  |     echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo. | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     echo Existing installation detected! Updating modpack, please wait. | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  |     timeout 10 | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     :: Clone or update the Git repository | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     if not exist "%repository%\.git" ( | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |         echo ---- | 
					
						
							|  |  |  |         echo Cloning repository... | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |         "%portable_git%" clone %git_repository% | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     ) else ( | 
					
						
							|  |  |  |         echo ---- | 
					
						
							|  |  |  |         echo Repository already exists. Pulling latest changes... | 
					
						
							|  |  |  |         cd %repository% | 
					
						
							|  |  |  |         git fetch --all | 
					
						
							|  |  |  |         git reset --hard origin/main | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ---- | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  |     echo Synchronizing mods folder... | 
					
						
							| 
									
										
										
										
											2025-01-08 12:20:44 -05:00
										 |  |  |     robocopy "%repository%/mods" "%mo2_install%/mods" /MIR | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Synchronizing profiles folder... | 
					
						
							| 
									
										
										
										
											2025-01-08 12:20:44 -05:00
										 |  |  |     robocopy "%repository%/profiles" "%mo2_install%/profiles" /MIR | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     pause | 
					
						
							|  |  |  |     exit /B 0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | :InstallModpack | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     echo. | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  |     echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
					
						
							|  |  |  |     echo    WARNING! The script will install the modpack in the folder this script is ran from! | 
					
						
							|  |  |  |     echo        Be sure that your folder is empty before continuing with the installation! | 
					
						
							|  |  |  |     echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     setlocal enableextensions disabledelayedexpansion | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  |     echo. | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     echo No existing installation detected. Downloading modpack. | 
					
						
							| 
									
										
										
										
											2025-01-05 09:25:28 -05:00
										 |  |  |     timeout 30 | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     :: Requiring user input for game path | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     echo ---- | 
					
						
							|  |  |  |     set /p "game_path=Please enter the path to your game installation: " | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if "%game_path%"=="" ( | 
					
						
							|  |  |  |         echo. | 
					
						
							|  |  |  |         echo No path entered. Exiting. | 
					
						
							|  |  |  |         echo. | 
					
						
							|  |  |  |         pause | 
					
						
							|  |  |  |         exit /b 1 | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     :: Download MO2 | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     curl -L -o MO2.7z %mo2_file% | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     if %errorlevel% neq 0 ( | 
					
						
							|  |  |  |         echo ERROR: Failed to download the archive. Check your internet connection and try again. | 
					
						
							|  |  |  |         pause | 
					
						
							|  |  |  |         exit /b | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     :: Confirm the file exists | 
					
						
							|  |  |  |     if not exist "MO2.7z" ( | 
					
						
							|  |  |  |         echo ERROR: Download completed, but the file MO2.7z was not found. | 
					
						
							|  |  |  |         echo Please check your internet connection or the download URL. | 
					
						
							|  |  |  |         pause | 
					
						
							|  |  |  |         exit /b | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     :: Extracting MO2 and installing | 
					
						
							| 
									
										
										
										
											2025-01-03 18:07:11 -05:00
										 |  |  |     .\7zr x MO2.7z | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     if %errorlevel% neq 0 ( | 
					
						
							|  |  |  |         echo ERROR: Failed to extract the archive. Ensure the archive is valid and try again. | 
					
						
							|  |  |  |         pause | 
					
						
							|  |  |  |         exit /b | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     :: Deleting the archive | 
					
						
							|  |  |  |     del MO2.7z | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-16 00:59:36 -04:00
										 |  |  |     :: Syncing all of the necessary folders and files | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Cloning repository... | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     "%portable_git%" clone %git_repository% | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     echo ---- | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  |     echo Synchronizing mods folder... | 
					
						
							| 
									
										
										
										
											2025-01-08 12:20:44 -05:00
										 |  |  |     robocopy "%repository%/mods" "%mo2_install%/mods" /MIR | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Synchronizing profiles folder... | 
					
						
							| 
									
										
										
										
											2025-01-08 12:20:44 -05:00
										 |  |  |     robocopy "%repository%/profiles" "%mo2_install%/profiles" /MIR | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Synchronizing plugins folder... | 
					
						
							|  |  |  |     robocopy "%repository%/plugins" "%mo2_install%/plugins" /E | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Synchronizing stylesheets folder... | 
					
						
							| 
									
										
										
										
											2025-01-08 12:23:23 -05:00
										 |  |  |     robocopy "%repository%/stylesheets" "%mo2_install%/stylesheets" /E | 
					
						
							| 
									
										
										
										
											2025-05-16 00:59:36 -04:00
										 |  |  |      | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Synchronizing USVFS files... | 
					
						
							| 
									
										
										
										
											2025-05-16 16:55:49 -04:00
										 |  |  |     robocopy "usvfs_proxy_x64.exe" "%mo2_install%" /E | 
					
						
							|  |  |  |     robocopy "usvfs_proxy_x86.exe" "%mo2_install%" /E | 
					
						
							|  |  |  |     robocopy "usvfs_x64.dll" "%mo2_install%" /E | 
					
						
							|  |  |  |     robocopy "usvfs_x86.dll" "%mo2_install%" /E | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     :: Escape backslashes in the game path | 
					
						
							|  |  |  |     setlocal enabledelayedexpansion | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     set "game_path=!game_path:\=/!" | 
					
						
							|  |  |  |     set "escaped_path=" | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     for /l %%i in (0,1,255) do ( | 
					
						
							|  |  |  |         for /f "tokens=1,* delims=" %%a in ("!game_path:~%%i,1!") do ( | 
					
						
							|  |  |  |             if "%%a"=="" goto path_done | 
					
						
							|  |  |  |             if %%a==/ ( | 
					
						
							|  |  |  |                 set "escaped_path=!escaped_path!//" :: Double the backslash | 
					
						
							|  |  |  |             ) else ( | 
					
						
							|  |  |  |                 set "escaped_path=!escaped_path!%%a" | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     :path_done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo Original Path: %game_path% | 
					
						
							|  |  |  |     echo Escaped Path:  %escaped_path% | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     :: Replace placeholders in ModOrganizer.ini | 
					
						
							| 
									
										
										
										
											2025-01-08 12:18:31 -05:00
										 |  |  |     echo ---- | 
					
						
							| 
									
										
										
										
											2025-01-16 02:24:37 -05:00
										 |  |  |     echo Updating ModOrganizer.ini... | 
					
						
							|  |  |  |     set "ini_file=%repository%\ModOrganizer.ini" | 
					
						
							|  |  |  |     set "temp_ini=%ini_file%.tmp" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     (for /f "usebackq delims=" %%A in ("%ini_file%") do ( | 
					
						
							|  |  |  |         set "line=%%A" | 
					
						
							|  |  |  |         set "line=!line:game_path=%escaped_path%!" | 
					
						
							|  |  |  |         set "line=!line:replace_me=%game_path%!" | 
					
						
							|  |  |  |         echo(!line! | 
					
						
							|  |  |  |     )) > "%temp_ini%" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     move /y "%temp_ini%" "%mo2_install%\ModOrganizer.ini" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     echo ModOrganizer.ini updated successfully! | 
					
						
							| 
									
										
										
										
											2025-01-03 13:24:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     echo ---- | 
					
						
							|  |  |  |     echo Installation complete. Launch ModOrganizer.exe and follow the remaining instructions. | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     pause | 
					
						
							|  |  |  |     exit /B 0 |