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

Borderlands 3 · handler “Borderlands 3”

Version 11

Release notes

Legit EGS version support.

Released
Size
3.4 KB
Downloads
1,775
Check
Verified
SHA-256
fcf00006bf02e062d57d686cd815d261767f77b089f166d025bd480daf81e589
Download v11 (.nc)All versions

Files 1

PathSize
handler.js11 KB

handler.js

Plain text
Hub.Handler.Version = 11; // Released at https://hub.splitscreen.me/ on Sat Aug 14 2021 14:28:56 GMT+0000 (Coordinated Universal Time).
Hub.Handler.Id = "NkdddxaAdx6BKfdnt";
Hub.Maintainer.Name = "Talos91";
Hub.Maintainer.Id = "eeL7HAz8zJovChWw4";

var answers1 = ["Yes", "No"];
var answers2 = ["No", "Yes"];
Game.AddOption("Launch all instances under your Steam account?", "Allows you to unlock steam achievements, connect via LAN.", "Steam", answers1);
Game.AddOption("Epic Games Store version?", "ONLY if you've the egs version. Nucleus will close on first run, launch again.", "Epic", answers2);

Game.DirSymlinkExclusions = ["OakGame\\Binaries\\Win64", "Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64", "Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64\\steam_settings"];
Game.FileSymlinkExclusions = ["steam_api64.dll", "steam_appid.txt", "xinput1_3.dll"];
Game.GameName = "Borderlands 3";
Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = true;
Game.SupportsKeyboard = true;
Game.ExecutableName = "Borderlands3.exe";
Game.SteamID = "397540";
Game.GUID = "Borderlands 3";
Game.MaxPlayers = 4;
Game.MaxPlayersOneMonitor = 4;
Game.BinariesFolder = "OakGame\\Binaries\\Win64";
Game.UseNucleusEnvironment = true;
Game.UseGoldberg = true;
Game.CreateSteamAppIdByExe = true;
Game.LauncherTitle = "splashscreen";
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Borderlands® 3";
Game.PreventWindowDeactivation = true;
Game.KeyboardPlayerSkipPreventWindowDeactivate = true;
Game.HookFocus = true;
Game.SetWindowHook = true;
Game.ResetWindows = true;
Game.RefreshWindowAfterStart = true;
Game.Hook.DInputEnabled = false;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.Hook.CustomDllEnabled = false;
Game.XInputPlusDll = ["xinput1_3.dll"];
//Game.PlayerSteamIDs = ["76561198089222861"];
Game.UserProfileConfigPath = "Documents\\My Games\\Borderlands 3\\Saved\\Config\\WindowsNoEditor";
Game.UserProfileSavePath = "Documents\\My Games\\Borderlands 3\\Saved\\SaveGames";
Game.Description =
  "Go to network options, network mode and select LAN in each instance. Limit the fps for better performance, you can also alt-tab to the Nucleus app window or press the windows key+b to unfocus all instances and even out fps when using multiple controllers, the game windows will remain on top.";
Game.PauseBetweenContextAndLaunch = 5;
Game.PauseBetweenStarts = 45;

Game.Play = function() {
  var savePath = Context.EnvironmentPlayer + Context.UserProfileConfigPath + "\\GameUserSettings.ini";
  Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [
    new Nucleus.IniSaveInfo("/Script/OakGame.OakGameUserSettings", "FullscreenMode", "2"),
    new Nucleus.IniSaveInfo("/Script/OakGame.OakGameUserSettings", "ResolutionSizeX", Context.Width),
    new Nucleus.IniSaveInfo("/Script/OakGame.OakGameUserSettings", "ResolutionSizeY", Context.Height)
  ]);

  if (Context.IsKeyboardPlayer) {
    Context.StartArguments = "-windowed -AlwaysFocus -nosplash -NoController";
  } else {
    Game.SetForegroundWindowElsewhere = true;

    Context.StartArguments = "-windowed -AlwaysFocus -nosplash";
  }

  var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64\\steam_settings");
  System.IO.Directory.CreateDirectory(filePath);

  var dlc = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64\\steam_settings\\DLC.txt";
  var lines = [
    "1537993=Disciples of the Vault Zane Cosmetic Pack",
    "1537992=Disciples of the Vault Moze Cosmetic Pack",
    "1537991=Disciples of the Vault FL4K Cosmetic Pack",
    "1537990=Disciples of the Vault Amara Cosmetic Pack",
    "1396474=Borderlands 3: Season Pass 2",
    "1396473=Borderlands 3: FL4K Final Form Pack",
    "1396472=Borderlands 3: Moze Final Form Pack",
    "1396471=Borderlands 3: Zane Final Form Pack",
    "1396470=Borderlands 3: Amara Final Form Pack",
    "1361830=Borderlands 3: Designer's Cut",
    "1256890=Borderlands 3: Digital Deluxe Extras",
    "1233062=Borderlands 3: Season Pass",
    "1233061=Borderlands 3: Psycho Krieg and the Fantastic Fustercluck",
    "1233060=Borderlands 3: Bounty of Blood",
    "1232257=Borderlands 3: Guns, Love, and Tentacles",
    "1232256=Borderlands 3: Moxxi's Heist of the Handsome Jackpot",
    "1232255=Borderlands 3: Toy Box Weapons Pack",
    "1232254=Borderlands 3: Retro Cosmetic Pack",
    "1232253=Borderlands 3: Neon Cosmetic Pack",
    "1232252=Borderlands 3: Gold Weapons Skins Pack",
    "1232251=Borderlands 3: Gearbox Cosmetic Pack",
    "1232250=Borderlands 3: Butt Stallion Pack",
    "1232240=Borderlands 3: Booster Pack"
  ];
  Context.WriteTextFile(dlc, lines);

  if (!System.IO.File.Exists(Context.OrigRootFolder + "\\Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64\\steam_api64.dll")) {
    Game.UseGoldberg = false;
  } else {
  }

  var steam = Context.Options["Steam"];
  var epic = Context.Options["Epic"];

  if (steam == "No") {
  }

  if (steam == "Yes") {
    if (!System.IO.File.Exists(Context.OrigRootFolder + "\\Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64\\steam_api64.dll")) {
    } else {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64\\steam_api64.dll");
      var savePkgOrigin = System.IO.Path.Combine(Context.OrigRootFolder, "Engine\\Binaries\\ThirdParty\\steamworks\\steamv147\\win64\\steam_api64.dll");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
  }

  if (epic == "No") {
  }

  if (epic == "Yes") {
    var EpicArgs = "PREFLIGHT_SCRIPT_WILL_REPLACE";

    if (Context.IsKeyboardPlayer) {
      Context.StartArguments = "-windowed -AlwaysFocus -nosplash -NoController" + EpicArgs;
    } else {
      Game.SetForegroundWindowElsewhere = true;

      Context.StartArguments = "-windowed -AlwaysFocus -nosplash" + EpicArgs;
    }

    if (System.IO.File.Exists(Context.NucleusFolder + "\\scripts\\borderlands3_preflight.ps1")) {
    } else {
      Game.PauseBetweenContextAndLaunch = 15;
      Game.ForceProcessPick = true;

      var preflight = Context.NucleusFolder + "\\scripts\\borderlands3_preflight.ps1";
      var lines = [
        '$NC_SCRIPT_PATH = ".\\Borderlands3.js"',
        '$NC_SCRIPT_REPLACE_STRING = "PREFLIGHT_SCRIPT_WILL_REPLACE"',
        '$EPIC_LOG_PATH = "$env:USERPROFILE\\AppData\\Local\\EpicGamesLauncher\\Saved\\Logs\\EpicGamesLauncher.log"',
        "",
        "try {",
        "    Write-Host Checking if NC Script file needs launch args",
        "    $containsString = Select-String -Path $NC_SCRIPT_PATH -Pattern $NC_SCRIPT_REPLACE_STRING",
        "    If ($null -eq $containsString) {",
        '        Write-Host "Launch args already added! Skipping..."',
        "        exit",
        "    }",
        "}",
        "catch {",
        '    Write-Error "Unable to open nucleus script file. Quitting..." -ErrorAction Stop',
        "}",
        "try { ",
        "    Write-Host Checking if epic logs already contain launch args",
        "    $Launch_Info = Get-Content $env:USERPROFILE\\AppData\\Local\\EpicGamesLauncher\\Saved\\Logs\\EpicGamesLauncher.log | `",
        "       Where-Object { $_ -like '*FCommunityPortalLaunchAppTask: Launching app*Borderlands3.exe*' } | `",
        "        Select-Object -First 1",
        "}",
        "catch {",
        "    # Cant find args yet",
        "}",
        "if ($null -eq $Launch_Info) {",
        "    # Start an instance of Borderlands 3 using the Epic Launcher",
        "try {",
        "        Write-Host Args not found yet. Starting Borderlands 3 using Epic Launcher",
        '        Start-Process -FilePath "com.epicgames.launcher://apps/Catnip?action=launch&silent=true"',
        "   }",
        "    catch {",
        '        Write-Error "Unable to launch Borderlands 3 using Epic Launcher. Quitting..." -ErrorAction Stop',
        "    }",
        "    # Get args needed to launch BL3 offline",
        "    try {",
        "        # Search through Epic Launcher logs to find the launch parameters for Borderlands 3.",
        "        Write-Host Finding offline launch arguments",
        "        while (($null -eq $Launch_Info ) -or ($null -eq $bl3_process)) {",
        "            Start-Sleep -s 1",
        "            $bl3_process = Get-Process -name Borderlands3 -ErrorAction SilentlyContinue",
        "           $Launch_Info = Get-Content $EPIC_LOG_PATH | `",
        "                Where-Object { $_ -like '*FCommunityPortalLaunchAppTask: Launching app*Borderlands3.exe*' } | `",
        "                Select-Object -First 1",
        "        }",
        "        Start-Sleep -s 15",
        "       Write-Host Killing Borderlands3",
        "       Stop-Process $bl3_process.Id",
        "   }",
        "    catch {",
        '        Write-Error "Unable to get offline args for Borderlands 3. Quitting..." -ErrorAction Stop',
        "    }",
        "}",
        "try {",
        "    Write-Host Parsing launch args",
        "    # Reformat it, split out the binary/args",
        '    $null, $bl3_bin = $Launch_Info -split "Launching app "',
        '    $bl3_bin = $bl3_bin -replace "' + "'" + '"' + ', ""',
        '    $bl3_bin, $bl3_arg = $bl3_bin -split "with commandline "',
        '    $bl3_bin = $bl3_bin -replace "Borderlands3.exe", "OakGame/Binaries/Win64/Borderlands3.exe"',
        "    # Sanity check- make sure binary exists",
        "    $null = Test-Path -Path $bl3_bin -ErrorAction stop",
        "    Write-Host Found Borderlands 3 args",
        "",
        "    Write-Host Writing launch args to script",
        "    (Get-Content -Path $NC_SCRIPT_PATH) -replace $NC_SCRIPT_REPLACE_STRING, $bl3_arg | Set-Content -Path $NC_SCRIPT_PATH",
        "}",
        "catch {",
        '    Write-Error "Unable to write launch args to NC script. Quitting..." -ErrorAction Stop ',
        "}",
        "Write-Host All done!"
      ];
      Context.WriteTextFile(preflight, lines);

      var Bat = Context.NucleusFolder + "\\scripts\\start.bat";
      var lines = ['PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& ' + "'./borderlands3_preflight.ps1'" + '"'];
      Context.WriteTextFile(Bat, lines);

      Context.RunAdditionalFiles(["1|" + Context.NucleusFolder + "\\scripts\\start.bat"], false, 1);

      var Bat = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\close.bat";
      var lines = ["timeout /t 5 /nobreak", 'taskkill -im "NucleusCoop.exe"'];
      Context.WriteTextFile(Bat, lines);

      Context.RunAdditionalFiles(["1|" + Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\close.bat"], false, 1);
    }
  }
};