Skip to content
Beta: this is a preview of the new SplitScreen.Me. Data may be reset before launch.

Max Payne 3: The Complete Edition · handler “Max Payne 3: The Complete Edition”

Version 4

Release notes

Rockstar Games Launcher support

Released
Size
9.3 MB
Downloads
686
Check
Verified
SHA-256
31e36992edd68af8b1a28055c51fca56f0b463f00bb6e8842dbe17406259cdc8
Download v4 (.nc)All versions

Files 29

PathSize
Max Payne 3/common/movies/mp3_logo_bink_pt01.bik468 B
Max Payne 3/common/movies/mp3_logo_bink_pt02.bik468 B
Max Payne 3/common/movies/mp3_logo_bink_pt03.bik468 B
Max Payne 3/common/movies/mp3_payne_pill_rockstar_logo.bik468 B
Max Payne 3/downgrade_rgl.xdelta3.4 MB
Max Payne 3/downgrade_steam.xdelta3.5 MB
Max Payne 3/Goldberg SocialClub Emu Saves/Max Payne 3/0F74F4C4/MP3_LOADOUT13 KB
Max Payne 3/Goldberg SocialClub Emu Saves/Max Payne 3/0F74F4C4/MP3_PLAYERCUSTOM35 KB
Max Payne 3/Goldberg SocialClub Emu Saves/Max Payne 3/0F74F4C4/MP3_PROGRESSION63 KB
Max Payne 3/Goldberg SocialClub Emu Saves/Max Payne 3/0F74F4C4/MP3_PROG_BACKUP63 KB
Max Payne 3/Goldberg SocialClub Emu Saves/Max Payne 3/0F74F4C4/MP3_STATS63 KB
Max Payne 3/Goldberg SocialClub Emu Saves/settings/account_name.txt9 B
Max Payne 3/Goldberg SteamEmu Saves/settings/account_name.txt9 B
Max Payne 3/graphics.xml535 B
Max Payne 3/scripthook/dinput8.dll200 KB
Max Payne 3/scripthook/ScriptHook.dll941 KB
Max Payne 3/scripthook/Trainer.asi277 KB
Max Payne 3/scripthook/Trainer.ini237 B
Max Payne 3/socialclub.dll391 KB
Max Payne 3/socialclub.ini750 B
Max Payne 3/steam_api.dll2.2 MB
Max Payne 3/steam_api.ini2.1 KB
Max Payne 3/steam_interfaces.txt357 B
Max Payne 3/steam_settings/disable_networking.txt71 B
Max Payne 3/steam_settings/disable_overlay.txt0 B
Max Payne 3/steam_settings/load_dlls/launc.dll189 KB
Max Payne 3/steam_settings/steam_appid.txt6 B
Max Payne 3/xdelta.exe610 KB
handler.js11 KB

handler.js

Plain text
Hub.Handler.Version = 4; // Released at https://hub.splitscreen.me/ on Wed Sep 04 2024 21:46:19 GMT+0000 (Coordinated Universal Time).
Hub.Handler.Id = "yD93rAKiBNpPZkrrB";
Hub.Maintainer.Name = "happyexpress";
Hub.Maintainer.Id = "yasq5hW6LH5sjwQty";

Game.Description =
  "For the latest Steam or Rockstar Game Launcher versions of Max Payne 3. \n" +
  "Gamepads only. \n" +
  "Your game must be installed outside C:\\Users\\. \n" +
  "This script will generate Windows user accounts for each player. \n" +
  "You can remove them by pressing Windows key and searching 'Add, Edit, or Remove Other Users'. \n" +
  "\n" +
  "Steps: \n" +
  "Run Nucleus as Administrator. \n" +
  //"I recommend you check 'Keep Nucleus Accounts' in your Nucleus settings. \n" +
  // "Run the handler and click OK on the prompt window each time an instance starts \n" +
  // "(You may need to Alt+Tab to the prompt). \n" +
  "Player 1 should go to Multiplayer -> LAN -> Select Gamemode to start a lobby. \n" +
  "Other players can then go to Multiplayer -> LAN -> Select Gamemode to join. \n" +
  "If you want to use Free Aim instead of Soft Lock, go to the Select Gamemode screen \n" +
  "and press X to switch. Everyone else must do the same to join your lobby. \n" +
  "\n" +
  "Unlock all mod: https://drive.google.com/file/d/19_r1zDUBR-L5bjkAccdFGTyRo8AbLiuj/view?usp=drivesdk \n" +
  "Hide enemy nametags and healthbars mod: https://drive.google.com/file/d/1e6of9RNzO84Oxhg00tg-OTPkcu6Ji12D/view?usp=drivesdk";

Game.FileSymlinkExclusions = ["MaxPayne3.exe", "steam_api.dll", "socialclub.dll"];

Game.GameName = "Max Payne 3";
Game.HandlerInterval = 100;
Game.SupportsKeyboard = false;
//Game.KeyboardPlayerFirst = true;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = false;
Game.GUID = "Max Payne 3";
Game.ExecutableName = "MaxPayne3.exe";
Game.MaxPlayers = 16;
Game.MaxPlayersOneMonitor = 16;
Game.Hook.DInputEnabled = false;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.Hook.CustomDllEnabled = false;
Game.InjectHookXinput = true;
Game.FakeFocus = true;
Game.FakeFocusInterval = 10000;
Game.HookFocus = true;
Game.SetWindowHook = true;
Game.PauseBetweenStarts = 20;
Game.PauseBetweenProcessGrab = 20;
Game.ThirdPartyLaunch = true;
Game.RequiresAdmin = true;
Game.IgnoreThirdPartyPrompt = true;

var answers1 = ["Steam", "Rockstar Games Launcher"];
Game.AddOption("Game version", "Select the launcher you installed the game from.", "Version", answers1);

var answers2 = ["Yes", "No"];
Game.AddOption(
  "Downgrade the EXE?",
  "The game's EXE file will be copied and downgraded to an earlier version. Select 'No' if you've already downgraded your game to v216 or earlier.",
  "Downgrade",
  answers2
);

Game.Play = function() {
  var accountName = "MaxPayne3Player" + (Context.PlayerID + 1);
  var version = Context.Options["Version"];
  var downgrade = Context.Options["Downgrade"] == "Yes";
  var uniqueUser = true; //Context.Options["UniqueUser"] == "Yes";

  if (uniqueUser) {
    // Execute a powershell script to manually create a distinct user to run this instance
    var psScriptFile = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\createuser.ps1";
    const psScript = [
      "$UserExists = Get-WmiObject -Class Win32_UserAccount -Filter \"Name='" + accountName + "'\";													",
      "																																				",
      "if (-not $UserExists) {																														",
      "    # Create the user account without a password																								",
      '	 New-LocalUser -Name "' + accountName + '" -Password (ConvertTo-SecureString "12345" -AsPlainText -Force) -PasswordNeverExpires;		',
      "																																				",
      "	 # Add the user to the Administrators group 																								",
      '	 Add-LocalGroupMember -Group "Administrators" -Member "' + accountName + '";															',
      " 																																				",
      '	$UserName = "' + accountName + '" 																										',
      '	$Password = ConvertTo-SecureString "12345" -AsPlainText -Force 																			',
      "	$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $Password) 													",
      " 																																				",
      "	# Run a program as the user to generate the user data 																						",
      '	Start-Process -FilePath "cmd.exe" -ArgumentList "/C exit" -Credential $Credential 														',
      "																																				",
      "    Write-Host \"User account '" + accountName + "' created and added to the Administrators group.\";											",
      "} else {																																		",
      "    Write-Host \"User account '" + accountName + "' already exists.\";																			",
      "}																																				"
    ];
    var cmd = '%SystemRoot%\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy RemoteSigned -command ".\\createuser.ps1"; '; //PAUSE;";
    var cmdFile = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\createuser.bat";

    Context.WriteTextFile(psScriptFile, psScript);
    Context.WriteTextFile(cmdFile, [cmd]);
    Context.RunAdditionalFiles(["all|" + cmdFile], false, 5, true, false);

    Context.Wait(2000);
  }

  const copiedFiles = ["socialclub.dll", "socialclub.ini", "steam_api.dll", "steam_api.ini", "steam_interfaces.txt", "downgrade_steam.xdelta", "downgrade_rgl.xdelta", "xdelta.exe"];

  for (let index = 0; index < copiedFiles.length; ++index) {
    const fileName = copiedFiles[index];
    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\" + fileName;
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, fileName);
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }

  // var bat = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\steam_settings.bat";
  // var lines = ['xcopy /E /I /Y "' + Game.Folder + "\\steam_settings" + '" "' + Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\steam_settings" + '" '];
  // Context.WriteTextFile(bat, lines);
  // Context.RunAdditionalFiles(["all|" + bat], false, 5);
  var bat = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\copyFolders.bat";
  var lines = [
    'xcopy /E /I /Y "' + Game.Folder + "\\steam_settings" + '" "' + Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\steam_settings" + '" ',
    'xcopy /E /I /Y "' + Game.Folder + "\\common" + '" "' + Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\common" + '" '
  ];
  Context.WriteTextFile(bat, lines);
  Context.RunAdditionalFiles(["all|" + bat], false, 0, true, false);

  // Player nicknames
  var path = Game.Folder + "\\Goldberg SocialClub Emu Saves\\settings\\account_name.txt";
  var lines = ["1|" + Context.Nickname];
  Context.ReplaceLinesInTextFile(path, lines);

  var path = Game.Folder + "\\Goldberg SteamEmu Saves\\settings\\account_name.txt";
  var lines = ["1|" + Context.Nickname];
  Context.ReplaceLinesInTextFile(path, lines);

  var appdata = uniqueUser ? "C:\\Users\\" + accountName + "\\AppData\\Roaming" : Context.NucleusUserRoot + "\\AppData\\Roaming";
  var documents = uniqueUser ? "C:\\Users\\" + accountName + "\\Documents" : Context.NucleusUserRoot + "\\Documents";

  if (!System.IO.Directory.Exists(appdata + "\\Goldberg SocialClub Emu Saves\\Max Payne 3")) {
    // If this folder doesn't exist, we can assume first time setup needs to be done
    var bat = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\copysaves.bat";
    var lines = [
      'xcopy /E /I /Y "' + Game.Folder + "\\Goldberg SocialClub Emu Saves" + '" "' + appdata + "\\Goldberg SocialClub Emu Saves" + '"',
      'xcopy /E /I /Y "' + Game.Folder + "\\Goldberg SteamEmu Saves" + '" "' + appdata + "\\Goldberg SteamEmu Saves" + '"',
      uniqueUser
        ? 'xcopy "' +
          Game.Folder +
          "\\graphics.xml" + //Guarantees the instance launches in windowed mode
          '" "' +
          documents +
          "\\Rockstar Games\\Max Payne 3\\" +
          '"'
        : ""
    ];
    Context.WriteTextFile(bat, lines);
    Context.RunAdditionalFiles(["all|" + bat], false, 5);
    Context.Wait(2000);
  }

  var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\MaxPayne3Old.exe";
  var savePkgOrigin = Context.RootInstallFolder + "\\MaxPayne3.exe";
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  var psScriptFile = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\start.ps1";
  if (uniqueUser) {
    // Execute a powershell script to run Max Payne 3 through ForceBindIP
    const psScript = [
      "$ForceBindIPPath = '" + Context.NucleusFolder + "\\utils\\ForceBindIP\\ForceBindIP.exe';									",
      "$ProgramPath = '" + Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\MaxPayne3.exe';								",
      "if (-Not (Test-Path -Path $ProgramPath -PathType Leaf)) {                                                                  ",
      '	[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms");                                           	',
      '	[System.Windows.Forms.MessageBox]::Show("EXE not found! Are you sure you have the latest legit ' + version + ' version?");      ',
      "	Exit;                                                                                                                   ",
      "}                                                                                                                          ",
      "$IPAddress = '127.0.0." + (Context.PlayerID + 1) + "';																		",
      "$UserName = '" + accountName + "';																							",
      "$Password = ConvertTo-SecureString '12345' -AsPlainText -Force;															",
      "$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $Password);									",
      'Start-Process -FilePath $ForceBindIPPath -ArgumentList " -i $IPAddress `"$ProgramPath`" " -Credential $Credential;		'
    ];
  } else {
  }

  var cmdFile = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\start.bat";
  var downgradeCmd = downgrade
    ? [
        "(xdelta.exe -d -s MaxPayne3Old.exe " + (version == "Steam" ? "downgrade_steam.xdelta" : "downgrade_rgl.xdelta") + " MaxPayne3.exe);", // Downgrade to an older version
        'IF %ERRORLEVEL% NEQ 0 (%SystemRoot%\\Sysnative\\msg.exe * "EXE downgrade failed! Are you sure you have the latest legit ' + version + ' version?");'
      ]
    : [];
  var startCmd = ['%SystemRoot%\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy RemoteSigned -command ".\\start.ps1"; ']; //PAUSE;"];

  Context.WriteTextFile(psScriptFile, psScript);
  Context.WriteTextFile(cmdFile, downgradeCmd.concat(startCmd));
  Context.RunAdditionalFiles(["all|" + cmdFile], false, 5, true, false);
};