Left 4 Dead 2 · handler “Left 4 Dead 2”
Version 3
Release notes
UI option to use the native splitscreen.
- Released
- Size
- 301 KB
- Downloads
- 4,469
- Check
- Verified
- SHA-256
- fa7b741824167c3b83123fc9c43600861b35b26cae6cc78d65d919d3624115fc
Files 2
| Path | Size |
|---|---|
| handler.js | 7.4 KB |
| Left4Dead2/571568537.vpk | 3.9 MB |
handler.js
Plain textHub.Handler.Version = 3; // Released at https://hub.splitscreen.me/ on Fri Jul 24 2020 01:07:25 GMT+0000 (UTC).
Hub.Handler.Id = "wFsXDjoAkHpL4XZm8";
Hub.Maintainer.Name = "Talos91";
Hub.Maintainer.Id = "eeL7HAz8zJovChWw4";
var answers1 = ["No", "Yes"];
Game.AddOption("Will you use the game native splitscreen?", "If yes launch only two instances, you need 3 or 4 gamepads.", "Native", answers1);
Game.KillMutex = ["hl2_singleton_mutex"];
Game.DirSymlinkExclusions = ["left4dead2", "left4dead2\\cfg", "left4dead2\\addons", "bin"];
Game.FileSymlinkCopyInstead = ["360controller.cfg"];
Game.FileSymlinkExclusions = ["autoexec.cfg", "video.txt", "config.cfg", "steam_api.dll", "steam_appid.txt", "steam_interfaces.txt", "xinput1_3.dll", "571568537.vpk", "pak01_000.vpk"];
Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = true;
Game.SupportsKeyboard = true;
Game.ExecutableName = "left4dead2.exe";
Game.SteamID = "550";
Game.GUID = "Left 4 Dead 2";
Game.GameName = "Left 4 Dead 2";
Game.NeedsSteamEmulation = false;
Game.UseGoldberg = true;
Game.LauncherTitle = "";
Game.SaveType = Nucleus.SaveType.CFG;
Game.SupportsPositioning = true;
Game.WorkingFolder = "bin";
Game.StartArguments = "-steam -window -AlwaysFocus -nointro -novid";
Game.MaxPlayersOneMonitor = 8;
Game.MaxPlayers = 8;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Left 4 Dead 2";
Game.Hook.DInputEnabled = false;
Game.Hook.DInputForceDisable = true;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.Hook.CustomDllEnabled = false;
Game.XInputPlusDll = ["xinput1_3.dll"];
Game.HookFocus = true;
Game.PauseBetweenStarts = 25;
Game.DPIHandling = Nucleus.DPIHandling.InvScaled;
Game.Play = function() {
var saveSrc = System.IO.Path.Combine(Context.RootInstallFolder, "left4dead2\\cfg\\video.txt");
var savePath = System.IO.Path.Combine(Context.RootFolder, "left4dead2\\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")
]);
//copy config.cfg
System.IO.File.Copy(System.IO.Path.Combine(Context.RootInstallFolder, "left4dead2\\cfg\\config.cfg"), System.IO.Path.Combine(Context.RootFolder, "left4dead2\\cfg\\config.cfg"), true);
var autoExec = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\left4dead2\\cfg\\autoexec.cfg";
var lines = [
"engine_no_focus_sleep 0" // unlimited FPS on all screens
];
if (Player.IsKeyboardPlayer) {
lines.push("joystick 0");
lines.push("exec undo360controller.cfg");
} else {
lines.push("exec 360controller.cfg");
}
Context.WriteTextFile(autoExec, lines);
var native = Context.Options["Native"];
if (Context.PlayerID == 0) {
if (native == "Yes") {
var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\left4dead2\\cfg\\360controller.cfg";
var dict = ["60|cmd2 +jlook "];
Context.ReplaceLinesInTextFile(txtPath, dict);
var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\left4dead2\\addons\\571568537.vpk");
var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "571568537.vpk");
System.IO.File.Copy(savePkgOrigin, savePath, true);
if (Player.Owner.IsDualHorizontal()) {
//patch native splitscreen aspect ratio
Context.PatchFile(
System.IO.Path.Combine(Context.RootInstallFolder, "left4dead2\\pak01_000.vpk"),
System.IO.Path.Combine(Context.RootFolder, "left4dead2\\pak01_000.vpk"),
[0x09, 0x22, 0x38, 0x20, 0x62, 0x79, 0x20, 0x39],
[0x09, 0x22, 0x39, 0x20, 0x62, 0x79, 0x20, 0x35]
);
}
if (Player.Owner.IsDualVertical()) {
//patch native splitscreen aspect ratio
Context.PatchFile(
System.IO.Path.Combine(Context.RootInstallFolder, "left4dead2\\pak01_000.vpk"),
System.IO.Path.Combine(Context.RootFolder, "left4dead2\\pak01_000.vpk"),
[0x09, 0x22, 0x38, 0x20, 0x62, 0x79, 0x20, 0x33],
[0x09, 0x22, 0x37, 0x20, 0x62, 0x79, 0x20, 0x34]
);
}
var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\XinputPlus.ini";
Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [
new Nucleus.IniSaveInfo("ControllerNumber", "Controller1", "1"),
new Nucleus.IniSaveInfo("ControllerNumber", "Controller2", "2"),
new Nucleus.IniSaveInfo("ControllerNumber", "Controller3", "0"),
new Nucleus.IniSaveInfo("ControllerNumber", "Controller4", "0")
]);
}
}
if (Context.PlayerID == 1) {
if (native == "Yes") {
Context.StartArguments = "-steam -window -AlwaysFocus -nointro -novid -console";
var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\left4dead2\\cfg\\360controller.cfg";
var dict = ["60|cmd2 +jlook "];
Context.ReplaceLinesInTextFile(txtPath, dict);
var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\left4dead2\\addons\\571568537.vpk");
var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "571568537.vpk");
System.IO.File.Copy(savePkgOrigin, savePath, true);
if (Player.Owner.IsDualHorizontal()) {
//patch native splitscreen aspect ratio
Context.PatchFile(
System.IO.Path.Combine(Context.RootInstallFolder, "left4dead2\\pak01_000.vpk"),
System.IO.Path.Combine(Context.RootFolder, "left4dead2\\pak01_000.vpk"),
[0x09, 0x22, 0x38, 0x20, 0x62, 0x79, 0x20, 0x39],
[0x09, 0x22, 0x39, 0x20, 0x62, 0x79, 0x20, 0x35]
);
}
if (Player.Owner.IsDualVertical()) {
//patch native splitscreen aspect ratio
Context.PatchFile(
System.IO.Path.Combine(Context.RootInstallFolder, "left4dead2\\pak01_000.vpk"),
System.IO.Path.Combine(Context.RootFolder, "left4dead2\\pak01_000.vpk"),
[0x09, 0x22, 0x38, 0x20, 0x62, 0x79, 0x20, 0x33],
[0x09, 0x22, 0x37, 0x20, 0x62, 0x79, 0x20, 0x34]
);
}
var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\XinputPlus.ini";
Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [
new Nucleus.IniSaveInfo("ControllerNumber", "Controller1", "3"),
new Nucleus.IniSaveInfo("ControllerNumber", "Controller2", "4"),
new Nucleus.IniSaveInfo("ControllerNumber", "Controller3", "0"),
new Nucleus.IniSaveInfo("ControllerNumber", "Controller4", "0")
]);
}
}
if (native == "No") {
System.IO.File.Copy(System.IO.Path.Combine(Context.RootInstallFolder, "left4dead2\\pak01_000.vpk"), System.IO.Path.Combine(Context.RootFolder, "left4dead2\\pak01_000.vpk"), true);
}
};