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

Borderlands 2 · handler “Borderlands 2”

Version 7

Release notes

ucp notes

Released
Size
2.5 KB
Downloads
328
Check
Verified
SHA-256
1e403b46b46decee53166aed8e7eb21061c1a9b89bde96f6bf669ef631a8d5f6
Download v7 (.nc)All versions

Files 1

PathSize
handler.js7.7 KB

handler.js

Plain text
Hub.Handler.Version = 7; // Released at https://hub.splitscreen.me/ on Sat Nov 21 2020 03:33:28 GMT+0000 (UTC).
Hub.Handler.Id = "YztSFvxEtWgjuGwTT";
Hub.Maintainer.Name = "Talos91";
Hub.Maintainer.Id = "eeL7HAz8zJovChWw4";

var answers1 = ["Disabled", "Enable"];
var answers2 = ["No", "Yes"];
var answers3 = ["Default", "Enable", "Disable"];
Game.AddOption("Keyboard instance fix.", "Only use if you're using one kb/m and the kb instance isn't working correctly.", "FIX", answers1);
Game.AddOption("Are you using the Unofficial Community Patch?", "Select yes only if you're using UCP for mods and the default options don't work for you.", "Mods", answers2);
Game.AddOption("Enable multiple keyboards and mice support?", "Launch then close Nucleus and open it again for the mkb support to enable.", "MKB", answers3);

Game.DirSymlinkExclusions = ["binaries\\win32"];
Game.FileSymlinkExclusions = ["steam_api.dll", "steam_appid.txt", "steam_interfaces.txt", "d3d9.dll"];
Game.FileSymlinkCopyInstead = ["Patch.txt", "PatchOffline.txt"];
Game.GameName = "Borderlands 2";
Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = true;
Game.SupportsKeyboard = true;
Game.ExecutableName = "borderlands2.exe";
Game.SteamID = "49520";
Game.GUID = "Borderlands 2";
Game.MaxPlayers = 4;
Game.MaxPlayersOneMonitor = 4;
Game.BinariesFolder = "binaries\\win32";
Game.NeedsSteamEmulation = false;
Game.UseGoldberg = true;
Game.LauncherTitle = "splashscreen";
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Borderlands 2 (32-bit, DX9)";
Game.UseDirectX9Wrapper = true;
Game.Hook.DInputEnabled = false;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.XInputPlusDll = ["xinput1_3.dll"];
Game.Hook.CustomDllEnabled = false;
Game.FakeFocus = false;
Game.HookFocus = true;
Game.SetWindowHookStart = false;
Game.ResetWindows = false;
Game.UserProfileSavePath = "Documents\\My Games\\Borderlands 2\\WillowGame\\SaveData";
Game.UserProfileConfigPath = "Documents\\My Games\\Borderlands 2\\WillowGame\\Config";
Game.UserProfileSavePathNoCopy = true;
Game.UserProfileConfigPathNoCopy = true;
Game.Description =
  "Go to network options, network mode and select LAN in each instance, then use the find games option to join the other players. If you launch an instance with the keyboard icon the last instance that opens will always be the keyboard player. If you enable multikeyboard/mice support in the UI options press the END key in your keyboard to unlock the input when you finish playing. You can also use CTRL+Q to close Nucleus and all its instances. If you use the UCP option go to network options, network mode and select LAN, then launch the next instance. Repeat this for each game. Once you get the prompt to execute the hooks, do it. Once all the games are set to LAN, execute the patch for all instances. Now you can connect and have fun.";
Game.PauseBetweenStarts = 35;

Game.SupportsMultipleKeyboardsAndMice = false;

Game.HookSetCursorPos = true;
Game.HookGetCursorPos = true;
Game.HookGetKeyState = false;
Game.HookGetAsyncKeyState = false;
Game.HookGetKeyboardState = false;
Game.HookFilterRawInput = true;
Game.HookFilterMouseMessages = false;
Game.HookUseLegacyInput = false;
Game.HookDontUpdateLegacyInMouseMsg = false;
Game.HookMouseVisibility = true;

Game.SendNormalMouseInput = true;
Game.SendNormalKeyboardInput = true;
Game.SendScrollWheel = false;
Game.ForwardRawKeyboardInput = false;
Game.ForwardRawMouseInput = false;
Game.HookReRegisterRawInput = false;
Game.HookReRegisterRawInputMouse = false;
Game.HookReRegisterRawInputKeyboard = false;
Game.DrawFakeMouseCursor = true;
Game.LockInputAtStart = true;
Game.LockInputToggleKey = 0x23;

Game.Play = function() {
  var savePath = Context.GetFolder(Nucleus.Folder.Documents) + "\\My Games\\Borderlands 2\\WillowGame\\Config\\WillowEngine.ini";
  Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [
    new Nucleus.IniSaveInfo("SystemSettings", "WindowedFullscreen", Context.IsFullscreen),
    new Nucleus.IniSaveInfo("SystemSettings", "Fullscreen", true),
    new Nucleus.IniSaveInfo("Engine.Engine", "bPauseOnLossOfFocus", false),
    new Nucleus.IniSaveInfo("WillowGame.WillowGameEngine", "bPauseLostFocusWindowed", false),
    new Nucleus.IniSaveInfo("Engine.Engine", "bMuteAudioWhenNotInFocus", false),
    new Nucleus.IniSaveInfo("Engine.Engine", "bPauseOnLossOfFocus", false),
    new Nucleus.IniSaveInfo("WillowGame.WillowGameEngine", "bMuteAudioWhenNotInFocus", false)
  ]);

  if (Context.IsKeyboardPlayer) {
    Context.StartArguments = "-AlwaysFocus -nosplash -nomoviestartup -NoController" + " -ResX= " + Context.Width + " -ResY= " + Context.Height;

    Context.Hook.BlockMouseEvents = "False";
    Context.Hook.BlockKeyboardEvents = "False";
    Context.Hook.BlockInputEvents = "False";
    Context.Hook.ForceFocus = "False";
  } else {
    Context.StartArguments = "-AlwaysFocus -nosplash -nomoviestartup -nomouse" + " -ResX= " + Context.Width + " -ResY= " + Context.Height;

    Context.Hook.BlockMouseEvents = "True";
    Context.Hook.BlockKeyboardEvents = "True";
    Context.Hook.BlockInputEvents = "True";
    Context.Hook.ForceFocus = "True";
  }

  var interfaces = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\binaries\\win32\\steam_interfaces.txt";
  var lines = [
    "SteamClient012",
    "SteamGameServer011",
    "SteamGameServerStats001",
    "SteamUser016",
    "SteamFriends013",
    "SteamUtils005",
    "SteamMatchMaking009",
    "SteamMatchMakingServers002",
    "STEAMUSERSTATS_INTERFACE_VERSION011",
    "STEAMAPPS_INTERFACE_VERSION005",
    "SteamNetworking005",
    "STEAMREMOTESTORAGE_INTERFACE_VERSION008",
    "STEAMSCREENSHOTS_INTERFACE_VERSION001",
    "STEAMHTTP_INTERFACE_VERSION001"
  ];

  Context.WriteTextFile(interfaces, lines);

  var fix = Context.Options["FIX"];
  var mods = Context.Options["Mods"];
  var mkb = Context.Options["MKB"];

  if (fix == "Disabled") {
  }

  if (fix == "Enable") {
    Game.Hook.CustomDllEnabled = true;
    Game.Hook.UseAlpha8CustomDll = true;
    Game.HookFocus = false;
  }

  if (mods == "No") {
  }

  if (mods == "Yes") {
    Game.UseNucleusEnvironment = true;
    Game.PromptBetweenInstances = true;

    var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "steam_api.dll");
    var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\binaries\\win32\\steam_api.dll");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }
  if (mkb == "Default") {
  }

  if (mkb == "Enable") {
    var NucleusRoot = System.IO.Path.Combine(Game.Folder, "..", "..");
    var cfgFilePath = NucleusRoot + "\\scripts\\Borderlands 2.js";

    var multiple = Context.FindLineNumberInTextFile(cfgFilePath, "Game.SupportsMultipleKeyboardsAndMice", Nucleus.SearchType.StartsWith);
    var keyboard = Context.FindLineNumberInTextFile(cfgFilePath, "Game.SupportsKeyboard", Nucleus.SearchType.StartsWith);

    Context.ReplaceLinesInTextFile(cfgFilePath, [multiple + "|Game.SupportsMultipleKeyboardsAndMice = true; ", keyboard + "|Game.SupportsKeyboard = false; "]);
  }
  if (mkb == "Disable") {
    var NucleusRoot = System.IO.Path.Combine(Game.Folder, "..", "..");
    var cfgFilePath = NucleusRoot + "\\scripts\\Borderlands 2.js";

    var multiple = Context.FindLineNumberInTextFile(cfgFilePath, "Game.SupportsMultipleKeyboardsAndMice", Nucleus.SearchType.StartsWith);
    var keyboard = Context.FindLineNumberInTextFile(cfgFilePath, "Game.SupportsKeyboard", Nucleus.SearchType.StartsWith);

    Context.ReplaceLinesInTextFile(cfgFilePath, [multiple + "|Game.SupportsMultipleKeyboardsAndMice = false; ", keyboard + "|Game.SupportsKeyboard = true; "]);
  }
};