Portal Knights · handler “PortalKnights”
Version 4
Release notes
native lan option, you can unlock steam achievements.
- Released
- Size
- 1.7 KB
- Downloads
- 737
- Check
- Verified
- SHA-256
- 305a144b4e1865be62fe029f8b64c33d32a85203a7654ffa66ce7e3a428b24b6
Files 1
| Path | Size |
|---|---|
| handler.js | 4.9 KB |
handler.js
Plain textHub.Handler.Version = 4; // Released at https://hub.splitscreen.me/ on Fri Apr 09 2021 23:06:06 GMT+0000 (UTC).
Hub.Handler.Id = "vbLcyw3hLFRBGBwCt";
Hub.Maintainer.Name = "Talos91";
Hub.Maintainer.Id = "eeL7HAz8zJovChWw4";
var answers1 = ["Yes", "No"];
var answers2 = ["Yes", "No"];
Game.AddOption("Will you use the game's native splitscreen?", "If yes launch only two instances, you need 3 or 4 gamepads.", "Native", answers1);
Game.AddOption("Use native LAN?", "Connect the instances via the game LAN option, read notes before using.", "LAN", answers2);
Game.FileSymlinkExclusions = ["steam_api64.dll", "steam_appid.txt", "winmm.dll"];
Game.FileSymlinkCopyInstead = ["portal_knights.cfg"];
Game.UseNucleusEnvironment = true;
Game.NeedsSteamEmulation = false;
Game.UseGoldberg = true;
Game.GoldbergNoLocalSave = true;
Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SupportsKeyboard = true;
Game.ExecutableName = "portal_knights_x64.exe";
Game.SteamID = "374040";
Game.GUID = "Portal Knights";
Game.GameName = "Portal Knights";
Game.MaxPlayers = 4;
Game.MaxPlayersOneMonitor = 4;
Game.LauncherTitle = "";
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Portal Knights";
Game.FakeFocus = true;
Game.ResetWindows = true;
Game.Hook.DInputEnabled = false;
Game.Hook.DInputForceDisable = true;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.XInputPlusDll = ["xinput1_4.dll"];
Game.Hook.CustomDllEnabled = false;
Game.UserProfileSavePath = "AppData\\Roaming\\Goldberg SteamEmu Saves\\374040\\remote";
Game.Description =
"This script is designed for 2 players per instance using the game's native splitscreen, so you can play with 4 players in only two instances of the game for better performance, the first two gamepads will control the first instance and the other two gamepads the second, press start in the character selection screen to add a local player in each instance, if you only want to have one player per instance select No in the UI option. With the native LAN UI option the script will launch all instances under your steam account, you can unlock steam achievements using this option, to connect the instances select LAN/Wifi only in the network settings before starting your world then join in the other instances, use a different character per instance, create them before launching via Nucleus. If you select no in the native LAN UI option the script will use goldberg emulator instead.";
Game.PauseBetweenStarts = 30;
Game.Play = function() {
var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\portal_knights.cfg";
var dict = [
Context.FindLineNumberInTextFile(txtPath, ' "windowType":', Nucleus.SearchType.StartsWith) + '| "windowType": "Default",',
Context.FindLineNumberInTextFile(txtPath, ' "windowSizeX":', Nucleus.SearchType.StartsWith) + '| "windowSizeX": ' + Context.Width + ",",
Context.FindLineNumberInTextFile(txtPath, ' "windowSizeY":', Nucleus.SearchType.StartsWith) + '| "windowSizeY": ' + Context.Height + ","
];
Context.ReplaceLinesInTextFile(txtPath, dict);
var native = Context.Options["Native"];
var lan = Context.Options["LAN"];
if (native == "Yes") {
if (Context.PlayerID == 0) {
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) {
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") {
}
if (lan == "Yes") {
Game.UseNucleusEnvironment = false;
var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "steam_api64.dll");
var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\steam_api64.dll");
System.IO.File.Copy(savePkgOrigin, savePath, true);
}
if (lan == "No") {
var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\winmm.dll");
var savePkgOrigin = System.IO.Path.Combine(Context.NucleusFolder, "utils\\Steam Stub DRM Patcher\\x64\\winmm.dll");
System.IO.File.Copy(savePkgOrigin, savePath, true);
}
};