You are here

Max Payne 3 portable

1 post / 0 new
Hansj
Offline
Last seen: 9 years 8 months ago
Joined: 2012-05-30 06:46
Max Payne 3 portable

Tried VMware ThinApp and Cameyo to make Max Payne 3 portable. That game is around 30 GB and consist of a launcher in a separate folder. But the package builds failed.

Though I managed to get it all portable by a simple batch script + junction v1.06 to create symbolic links with.

Here's the batch:
1. It needs to correct current directory because that can change when running as admin
2. Then it needs to correct %DOCUMENTS% environment var because that don't work too, if your computer has changed language during installation etc.
3. Then the batch need admin rights so that it can create a junction from c:\ProgramFiles folder
4. And then it must create junctions for the game launcher and the save game folder
---------------------------------------------------------

@setlocal enableextensions
@cd /d "%~dp0"

ECHO OFF

REM My Documents Folder
IF DEFINED %DOCUMENTS% GOTO MyDocsIsSet

REM ENGLISH
IF EXIST "%USERPROFILE%\Documents" SET DOCUMENTS="%USERPROFILE%\Documents"

:MyDocsIsSet

:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (shift & goto gotPrivileges)

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B

:gotPrivileges
::::::::::::::::::::::::::::
:START
::::::::::::::::::::::::::::
setlocal & pushd .

REM Remove directory and content if it already exists
rd /s /q "%DOCUMENTS%\Rockstar Games"
md "%CD%\..\Documents\Saved Game Data\Rockstar Games"
REM Remove directory and content if it already exists
rd /s /q "%ProgramFiles(x86)%\Rockstar Games"

REG ADD "HKCU\Software\Sysinternals\Junction" /v EulaAccepted /t REG_DWORD /d 1 /f
JUNCTION\junction.exe "%DOCUMENTS%\Rockstar Games" "%CD%\..\Documents\Saved Game Data\Rockstar Games"
JUNCTION\junction.exe "%ProgramFiles(x86)%\Rockstar Games" "%CD%\Rockstar Games"

CD "Max Payne 3"
MaxPayne3.exe
CD ..

REM Removes junction directory
JUNCTION\junction.exe -d "%DOCUMENTS%\Rockstar Games"
JUNCTION\junction.exe -d "%ProgramFiles(x86)%\Rockstar Games"