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

Portal Knights · handler “PortalKnights”

Version 3

Release notes

added UI option for number of players per instance.

Released
Size
1.4 KB
Downloads
372
Check
Verified
SHA-256
1bea73bd9808daeffe0bd5c4aea428abeb2bddbe50f7bd78a5cc6b24e576944f
Download v3 (.nc)All versions

Files 1

PathSize
handler.js3.5 KB

handler.js

Plain text
Hub.Handler.Version = 3; // Released at https://hub.splitscreen.me/ on Thu Jul 23 2020 00:49:55 GMT+0000 (UTC).
Hub.Handler.Id = "vbLcyw3hLFRBGBwCt";
Hub.Maintainer.Name = "Talos91";
Hub.Maintainer.Id = "eeL7HAz8zJovChWw4";

var answers1 = ["Yes", "No"];
Game.AddOption("Will you use the game native splitscreen?", "If yes launch only two instances, you need 3 or 4 gamepads.", "Native", answers1);

Game.FileSymlinkExclusions = ["steam_api64.dll", "steam_appid.txt", "winmm.dll"];
Game.FileSymlinkCopyInstead = ["portal_knights.cfg"];
Game.NeedsSteamEmulation = false;
Game.UseGoldberg = true;
Game.GoldbergNoLocalSave = true;
Game.UseNucleusEnvironment = true;
Game.UseSteamStubDRMPatcher = 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.SupportsPositioning = true;
Game.HideTaskbar = false;
Game.ForceFinishOnPlay = true;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Portal Knights";
Game.Hook.DInputEnabled = false;
Game.Hook.DInputForceDisable = true;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.FakeFocus = true;
Game.Hook.CustomDllEnabled = false;
Game.XInputPlusDll = ["xinput1_4.dll"];
Game.UserProfileSavePath = "AppData\\Roaming\\Goldberg SteamEmu Saves\\374040\\remote";
Game.Description =
  "This script is designed for 2 players per instance using the game native splitscreen, so you can play with 4 players in only two instances of the game for better performance, so 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 want to have only one player per instance select No in the UI option.";
Game.PauseBetweenStarts = 25;

Game.Play = function() {
  var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\portal_knights.cfg";
  var dict = ['11|"windowType": "Default",', '14|"windowSizeX":  ' + Context.Width + ",", '15|"windowSizeY":  ' + Context.Height + ","];

  Context.ReplaceLinesInTextFile(txtPath, dict);

  var native = Context.Options["Native"];

  if (Context.PlayerID == 0) {
    if (native == "Yes") {
      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") {
      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") {
  }
};