Insurgency · handler “Insurgency”
Version 2
Release notes
Multiple Keyboards/Mice support and FPS limiter.
- Released
- Size
- 2.9 KB
- Downloads
- 74
- Check
- Verified
- SHA-256
- f9a186d6043a7b62639655d2e1c7d74134617b1163d302ef6c7c99b9bdba95c0
Files 1
| Path | Size |
|---|---|
| handler.js | 8.6 KB |
handler.js
Plain textHub.Handler.Version = 2; // Released at https://hub.splitscreen.me/ on Sat Nov 28 2020 00:13:38 GMT+0000 (UTC).
Hub.Handler.Id = "wLuYwd4N6YpGZYEhw";
Hub.Maintainer.Name = "Bizzo";
Hub.Maintainer.Id = "HEgozNi3MNvhAmWfi";
/*Nucleus R4 make the mouse pointer lag when using DInput. This should be used only with controllers:
With 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 corresponding instance to 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.
For enable the support, set on true or remove slashes from this line:
- Game.Hook.XInputReroute
*/
Game.KillMutex = ["hl2_singleton_mutex"]; //killing the right mutex for open the game multiple times
Game.RenameNotKillMutex = true;
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);
var answers1 = ["60", "45", "30", "120", "144", "240", "300"];
Game.AddOption("Which FPS Cap the game will use?", "", "Fps", answers1);
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 -noborder -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"];
Game.PromptBetweenInstances = true;
Game.HookFocus = true;
Game.HookInit = true;
Game.SetWindowHookStart = true;
Game.DontResize = true;
Game.PauseBetweenStarts = 30;
Game.SupportsMultipleKeyboardsAndMice = true;
Game.HookSetCursorPos = true;
Game.HookGetCursorPos = true;
Game.HookGetKeyState = true;
Game.HookGetAsyncKeyState = true;
Game.HookGetKeyboardState = false;
Game.HookFilterRawInput = true;
Game.HookFilterMouseMessages = false;
Game.HookUseLegacyInput = false;
Game.HookDontUpdateLegacyInMouseMsg = false;
Game.SendNormalMouseInput = true;
Game.SendNormalKeyboardInput = true;
Game.SendScrollWheel = true;
Game.ForwardRawMouseInput = false;
Game.ForwardRawKeyboardInput = false;
Game.HookReRegisterRawInput = false;
Game.HookReRegisterRawInputMouse = false;
Game.HookReRegisterRawInputKeyboard = false;
Game.DrawFakeMouseCursor = true;
Game.LockInputAtStart = false;
Game.LockInputToggleKey = 0x23;
Game.Description =
"The first time one instance could crash and the map will take long time to load. Change Nucleus shortcuts with Alt combination (Ctrl is used for crouch in game). Start a Solo game in the first instance. Select your role and edit you equipments (do not apply). When the player is ready, click 'ok' on the Nucleus Prompt for start the new instance (repeat the process for each instance). When all is set, click 'ok' on the last prompt (hook/sends fake messages). Press END for restrict the keyboard to their specific instance (press again for unlock). You can press B on the controller for exit the equipment screen. For use more than 4 controllers open the .js file and enable XInputReroute.";
Game.Play = function() {
//The configuration of multi keyboards/mice must have FakeFocus turned on. Also HookMouseVisibility could cause crashes so it will enable only on the keyboard players.
if (Player.IsKeyboardPlayer) {
Game.FakeFocus = true;
Game.HookMouseVisibility = true;
} else {
Game.FakeFocus = false;
Game.HookMouseVisibility = false;
}
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")
]);
var fps = Context.Options["Fps"];
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",
"sv_pausable 1",
"engine_no_focus_sleep 0",
'joystick "0"',
'joystick_force_disabled "1"',
'joystick_force_disabled_set "1"',
'm_rawinput "1"',
"bind F8 pause",
"exec undo360controller.cfg",
"fps_max " + fps, //--------------------- using variable fps for set fps cap
"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",
"sv_pausable 1",
"engine_no_focus_sleep 0",
'm_rawinput "0"',
'joystick_force_disabled_set "0"',
"exec controller.cfg",
'zoom_sensitivity_ratio_joystick ".32"',
'bind "L_TRIGGER" "+special2"',
"bind F8 pause",
'bind "BACK" "pause; changeinventory"',
"fps_max " + fps,
"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",
"sv_pausable 1",
"engine_no_focus_sleep 0",
'm_rawinput "0"',
'joystick_force_disabled_set "0"',
"exec controller.cfg",
'zoom_sensitivity_ratio_joystick ".32"',
'bind "L_TRIGGER" "+toggle_zoom"',
"bind F8 pause",
'bind "BACK" "pause; changeinventory"',
"fps_max " + fps,
"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);
};