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

Insurgency · handler “Insurgency”

Version 1

Release notes

First release.

Released
Size
2.2 KB
Downloads
212
Check
Verified
SHA-256
122728ca7d237b684af1c06a3b0b321b9389d6029b1b331c3621dc250d5af81b
Download v1 (.nc)All versions

Files 1

PathSize
handler.js6.0 KB

handler.js

Plain text
Hub.Handler.Version = 1; // Released at https://hub.splitscreen.me/ on Wed May 13 2020 21:52:09 GMT+0000 (UTC).
Hub.Handler.Id = "wLuYwd4N6YpGZYEhw";
Hub.Maintainer.Name = "Bizzo";
Hub.Maintainer.Id = "HEgozNi3MNvhAmWfi";

Game.KillMutex = ["hl2_singleton_mutex"]; //killing the right mutex for open the game multiple times
Game.DirSymlinkExclusions = ["insurgency", "insurgency\\cfg", "bin", "bin\\x64"]; //what folder should be copied and not symlinked

Game.FileSymlinkExclusions = [
  //what files should not be copied
  "steam_api64.dll",
  "account_name.txt",
  "user_steam_id.txt",
  "local_save.txt",
  "steam_interfaces.txt",
  "steam_appid.txt",
  "autoexec.cfg",
  "xinput1_3.dll",
  "xinput9_1_0.dll"
];

Game.FileSymlinkCopyInstead = [
  //what files should be copied and not symlinked
  "video.txt",
  "config.cfg",
  "controller.cfg"
];

var answers = ["No", "Yes"]; //adding variables that user can use on the options

Game.AddOption("More than four controllers?", "You must enable XInputReroute inside the .js file", "Pad", answers);

Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SupportsKeyboard = true;
Game.KeyboardPlayerFirst = true;
Game.ExecutableName = "insurgency_x64.exe";
Game.SteamID = "222880";
Game.GUID = "Insurgency";
Game.GameName = "Insurgency";
Game.NeedsSteamEmulation = false;
Game.UseGoldberg = true;
Game.LauncherTitle = "";
Game.SaveType = Nucleus.SaveType.CFG;
Game.SupportsPositioning = true;
Game.HideTaskbar = true;
Game.StartArguments = "-windowed -AlwaysFocus -insecure -engine_no_focus_sleep 0 +sv_lan 1";
Game.WorkingFolder = "";
Game.MaxPlayersOneMonitor = 6;
Game.MaxPlayers = 32;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "INSURGENCY";
Game.Hook.DInputEnabled = false;
Game.Hook.DInputForceDisable = false;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false; //set on true for play more than 4 controllers . You can use only ONE XboxOne controller and you can't use at the same time the keyboard. You must click/alt+tab on the corrisponding instance for make it work. In alternative you can try fix the problem by doing this http://www.snes9x.com/phpbb3/viewtopic.php?t=27510 or try Xoutput.
Game.Hook.CustomDllEnabled = true;
(Game.Hook.XInputNames = ["xinput1_3.dll"]), ["xinput9_1_0.dll"];
Game.PromptBetweenInstances = true;
Game.HookFocus = true;
Game.PauseBetweenStarts = 30;
Game.Description =
  "Change Nucleus shortcuts with Alt combination (Ctrl is used for crouch in game). Start a Solo game in the first instance. When you are in the match, click ok on the Nucleus Prompt for start the new instance. When all is set, click ok on the last prompt (hook/sends fake messages). You can use the controller for equipments but mouse is needed for menu and is more easy to use. For use more than 4 controllers open the .js file and enable XInputReroute.";

Game.Play = function() {
  var saveSrc = System.IO.Path.Combine(Context.RootInstallFolder, "insurgency\\cfg\\video.txt"); //editing the video.txt file
  var savePath = System.IO.Path.Combine(Context.RootFolder, "insurgency\\cfg\\video.txt");
  Context.ModifySaveFile(saveSrc, savePath, Nucleus.SaveType.CFG, [
    new Nucleus.CfgSaveInfo("config", "setting.fullscreen", "0"),
    new Nucleus.CfgSaveInfo("config", "setting.defaultres", Math.max(640, Context.Width)),
    new Nucleus.CfgSaveInfo("config", "setting.defaultresheight", Math.max(360, Context.Height)),
    new Nucleus.CfgSaveInfo("config", "setting.nowindowborder", "0"),
    new Nucleus.CfgSaveInfo("VideoConfig", "setting.fullscreen", "0"),
    new Nucleus.CfgSaveInfo("VideoConfig", "setting.defaultres", Math.max(640, Context.Width)),
    new Nucleus.CfgSaveInfo("VideoConfig", "setting.defaultresheight", Math.max(360, Context.Height)),
    new Nucleus.CfgSaveInfo("VideoConfig ", "setting.nowindowborder", "0")
  ]);

  if (Player.IsKeyboardPlayer) {
    //if the player use keyboard the script will do this
    var autoExec = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\insurgency\\cfg\\autoexec.cfg"; //adding a autoexec.cfg file with the next lines
    var lines = [
      "sv_lan 1",
      "engine_no_focus_sleep 0",
      'joystick_force_disabled_set "1"',
      "exec undo360controller.cfg",
      "fps_max 60",
      "host_writeconfig",
      'echo "$$$$$$ autoexec.cfg loaded = controller disabled $$$$$$'
    ];
  } else {
    //if is not using a keyboard the script will do this
    var pad = Context.Options["Pad"]; //this is what happens on the "More than four controllers?" option if you choose No.
    if (pad == "No") {
      var autoExec = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\insurgency\\cfg\\autoexec.cfg";
      var lines = [
        "sv_lan 1",
        "engine_no_focus_sleep 0",
        'joystick_force_disabled_set "0"',
        "exec controller.cfg",
        'zoom_sensitivity_ratio_joystick ".32"',
        'bind "L_TRIGGER" "+special2"',
        "fps_max 60",
        "host_writeconfig",
        'echo "$$$$$$ autoexec.cfg loaded = controller enabled $$$$$$$'
      ];
    }
    if (pad == "Yes") {
      //this is what happens on the "More than four controllers?" option if you choose Yes.
      var autoExec = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\insurgency\\cfg\\autoexec.cfg";
      var lines = [
        "sv_lan 1",
        "engine_no_focus_sleep 0",
        'joystick_force_disabled_set "0"',
        "exec controller.cfg",
        'zoom_sensitivity_ratio_joystick ".32"',
        'bind "L_TRIGGER" "+toggle_zoom"',
        "fps_max 60",
        "host_writeconfig",
        'echo "$$$$$$ autoexec.cfg loaded = controller enabled $$$$$$$'
      ];
      Context.WriteTextFile(autoExec, lines);
    }
  }
  if (Context.PlayerID == 0) {
    //The script will do this only for the first player
  } else {
    //The script will do this only for the others
    lines.push("connect " + Context.User.GetLocalIP()); //adding line on the autoexec file (var autoExec)
  }

  Context.WriteTextFile(autoExec, lines);
};