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

Star Wars: Jedi Knight - Jedi Academy · handler “Star Wars: Jedi Knight - Jedi Academy”

Version 3

Release notes

Fixed KotF not launching properly

Released
Size
3.1 KB
Downloads
2
Check
Verified
SHA-256
fcb3ee986370703aa97bd768f6b7d16102bb581eea37858528086029c0ead388
Download v3 (.nc)All versions

Files 1

PathSize
handler.js11 KB

handler.js

Plain text
Hub.Handler.Version = 3; // Released at https://hub.splitscreen.me/ on Thu Nov 25 2021 01:01:55 GMT+0000 (Coordinated Universal Time).
Hub.Handler.Id = "3FufqRA2jbQC86XQh";
Hub.Maintainer.Name = "Zensuu";
Hub.Maintainer.Id = "sshRgms8c4xET4sCy";

var answers1 = ["None", "Knights of The Force 2.1", "Open Jedi Project Enhanced"];
Game.AddOption("Select mod?", "KotF does not support analog joystick input.", "Mod", answers1);

Game.FileSymlinkExclusions = [
  "steam_api.dll",
  "steam_api64.dll",
  "steam_appid.txt",
  "jaconfig.cfg",
  "jampconfig.cfg",
  "KotFSPconfig.cfg",
  "KotFMPconfig.cfg",
  "openjk.cfg",
  "autoexec.cfg",
  "xinput.cfg"
];
Game.HandlerInterval = 100;
Game.NeedsSteamEmulation = false;
Game.UseNucleusEnvironment = true;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SupportsKeyboard = false;
Game.ExecutableName = "openjk.x86.exe";
Game.SteamID = "6020";
Game.GUID = "JediKnightAcadeny";
Game.GameName = "Star Wars: Jedi Knight - Jedi Academy";
Game.LauncherTitle = "";
Game.MaxPlayersOneMonitor = 32;
Game.MaxPlayers = 32;
Game.HideTaskbar = true;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "OpenJK (MP)";
Game.HasDynamicWindowTitle = true;
Game.Hook.DInputEnabled = false;
Game.Hook.DInputForceDisable = true;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.XInputPlusDll = ["xinput1_3.dll"];
Game.Hook.CustomDllEnabled = false;
Game.UserProfileConfigPath = "Documents\\My Games\\OpenJK\\base";
Game.UserProfileConfigPathNoCopy = true;
Game.Description =
  'Requires the "Jedi Outcast & Jedi Academy Xinput Support v2" mod, based on OpenJK, from moddb installed in your game files. Alt tab and use your mouse cursor to navigate the UI in all gamepad instances. Each keyboard player can use their own keyboard and mouse. Host with one instance and join with the rest. Alt tab to a keyboard player if you have one before pressing END to lock input after all gamepad players have joined. Press the END key again to unlock the input in order to change profile details for gamepad players. You can also use CTRL+Q to close Nucleus and all its instances while input is unlocked.';
Game.PromptBetweenInstances = true;
Game.PauseBetweenProcessGrab = 5;
Game.PauseBetweenStarts = 25;

//USS deprecated options:

Game.HookSetCursorPos = false;
Game.HookGetCursorPos = false;
Game.HookGetKeyState = false;
Game.HookGetAsyncKeyState = false;
Game.HookGetKeyboardState = false;
Game.HookFilterRawInput = false;
Game.HookFilterMouseMessages = false;
Game.HookUseLegacyInput = false;
Game.HookDontUpdateLegacyInMouseMsg = false;
Game.HookMouseVisibility = false;

Game.SendNormalMouseInput = false;
Game.SendNormalKeyboardInput = false;
Game.SendScrollWheel = false;
Game.ForwardRawKeyboardInput = false;
Game.ForwardRawMouseInput = false;
Game.HookReRegisterRawInput = false;
Game.HookReRegisterRawInputMouse = false;
Game.HookReRegisterRawInputKeyboard = false;
Game.DrawFakeMouseCursor = false;

//ProtoInput:

Game.SupportsMultipleKeyboardsAndMice = true;

Game.ProtoInput.InjectStartup = false;
Game.ProtoInput.InjectRuntime_RemoteLoadMethod = false;
Game.ProtoInput.InjectRuntime_EasyHookMethod = true;
Game.ProtoInput.InjectRuntime_EasyHookStealthMethod = false;

Game.LockInputAtStart = false;
Game.LockInputSuspendsExplorer = true;
Game.ProtoInput.FreezeExternalInputWhenInputNotLocked = false;
Game.LockInputToggleKey = 0x23;

Game.ProtoInput.RenameHandlesHook = false;
Game.ProtoInput.RenameHandles = [];
Game.ProtoInput.RenameNamedPipes = [];

Game.ProtoInput.RegisterRawInputHook = false;
Game.ProtoInput.GetRawInputDataHook = true;
Game.ProtoInput.MessageFilterHook = true;
Game.ProtoInput.GetCursorPosHook = false;
Game.ProtoInput.SetCursorPosHook = false;
Game.ProtoInput.GetKeyStateHook = true;
Game.ProtoInput.GetAsyncKeyStateHook = true;
Game.ProtoInput.GetKeyboardStateHook = true;
Game.ProtoInput.CursorVisibilityHook = false;
Game.ProtoInput.ClipCursorHook = false;
Game.ProtoInput.FocusHooks = true;
Game.ProtoInput.DrawFakeCursor = false;
Game.ProtoInput.ClipCursorHookCreatesFakeClip = false;
Game.ProtoInput.EnableToggleFakeCursorVisibilityShortcut = false;

Game.ProtoInput.RawInputFilter = false;
Game.ProtoInput.MouseMoveFilter = false;
Game.ProtoInput.MouseActivateFilter = false;
Game.ProtoInput.WindowActivateFilter = true;
Game.ProtoInput.WindowActvateAppFilter = true;
Game.ProtoInput.MouseWheelFilter = true;
Game.ProtoInput.MouseButtonFilter = false;
Game.ProtoInput.KeyboardButtonFilter = false;

Game.ProtoInput.SendMouseWheelMessages = true;
Game.ProtoInput.SendMouseButtonMessages = true;
Game.ProtoInput.SendMouseMovementMessages = true;
Game.ProtoInput.SendKeyboardButtonMessages = true;
Game.ProtoInput.XinputHook = false;
Game.ProtoInput.UseOpenXinput = false;
Game.ProtoInput.UseDinputRedirection = false;
Game.ProtoInput.DinputDeviceHook = false;
Game.ProtoInput.DinputHookAlsoHooksGetDeviceState = false;

Game.ProtoInput.EnableFocusMessageLoop = true;
Game.ProtoInput.FocusLoopIntervalMilliseconds = 5;
Game.ProtoInput.FocusLoop_WM_ACTIVATE = false;
Game.ProtoInput.FocusLoop_WM_ACTIVATEAPP = false;
Game.ProtoInput.FocusLoop_WM_NCACTIVATE = false;
Game.ProtoInput.FocusLoop_WM_SETFOCUS = false;
Game.ProtoInput.FocusLoop_WM_MOUSEACTIVATE = false;
Game.ProtoInput.WindowActivateFilter = false;
Game.ProtoInput.BlockedMessages = [0x0008, 0x0006];

Game.Play = function() {
  var mod = Context.Options["Mod"];
  var xinputCfg = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\base\\xinput.cfg";

  if (mod == "Open Jedi Project Enhanced") {
    var modArgs = "+set fs_game ojpenhanced";
    Context.StartArguments = modArgs;
  }

  if (mod == "Knights of the Force 2.1") {
    Game.Hook.ForceFocusWindowName = "Knights of the Force";

    if (Context.IsKeyboardPlayer) {
      Game.ProtoInput.RegisterRawInputHook = true;
    } else {
    }

    System.IO.File.Copy(System.IO.Path.Combine(Context.RootInstallFolder, "KotF 2.1 MP.exe"), System.IO.Path.Combine(Context.RootFolder, "openjk.x86.exe"), true);

    var lines = [
      "in_joystick 1",
      "in_restart",
      'bind JOY2 "forceprev"',
      'bind JOY1 "+moveup"',
      'bind JOY3 "+use"',
      'bind JOY4 "forcenext"',
      'bind JOY7 "datapad"',
      'bind JOY8 "togglemenu"',
      'bind JOY9 "+movedown"',
      'bind JOY10 "+zoom"',
      'bind JOY5 "saberAttackCycle"',
      'bind JOY6 "+altattack"',
      'bind JOY28 "+button2"',
      'bind JOY30 "invnext"',
      'bind JOY31 "weapprev"',
      'bind JOY29 "weapnext"',
      'bind JOY17 "+useforce"',
      'bind JOY23 "+attack"',
      'bind JOY18 "+left"',
      'bind JOY19 "+right"',
      'bind JOY20 "+lookup"',
      'bind JOY21 "+lookdown"',
      'bind "UPARROW" "+forward"',
      'bind "DOWNARROW" "+back"',
      'bind "LEFTARROW" "+moveleft"',
      'bind "RIGHTARROW" "+moveright"'
    ];
  } else {
    Game.ProtoInput.RegisterRawInputHook = true;

    var lines = [
      "in_joystick 2",
      "in_restart",
      'bind JOY12 "forceprev"',
      'bind JOY11 "+moveup"',
      'bind JOY13 "+use"',
      'bind JOY14 "forcenext"',
      'bind JOY5 "datapad"',
      'bind JOY4 "togglemenu"',
      'bind JOY6 "+movedown"',
      'bind JOY7 "+zoom"',
      'bind JOY8 "+useforce"',
      'bind JOY9 "+altattack"',
      'bind JOY0 "saberAttackCycle"',
      'bind JOY1 "cg_thirdperson !"',
      'bind JOY2 "weapprev"',
      'bind JOY3 "weapnext"',
      'bind JOY15 "+useforce"',
      'bind JOY16 "+attack"'
    ];
  }
  Context.WriteTextFile(xinputCfg, lines);

  var autoExec = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\base\\autoexec.cfg";
  var lines = [
    'seta name "' + Context.Nickname + '"',
    'seta r_mode "-1"',
    'seta r_customwidth "' + Context.Width + '"',
    'seta r_customheight "' + Context.Height + '"',
    'seta r_fullscreen "0"',
    'seta r_allowResize "1"',
    'seta r_noborder "1"',
    'seta r_centerWindow "0"',
    'seta cg_deferPlayers "0"',
    'seta cg_fixedAspect "2"',
    'seta s_musicvolume "0.25"',
    'seta in_joystick "2"',
    'seta in_mouse "1"',
    //	'seta sv_cheats "1"',
    //	'seta helpusobi "1"',
    //	'seta g_saberMoreRealistic "3"',
    //	'seta g_dismemberment "3"',
    //	'seta g_dismemberProbabilities "100"',
    //	'seta g_corpseRemovalTime "0"',
    //	'seta broadsword "1"',
    "exec xinput.cfg"
  ];

  Context.WriteTextFile(autoExec, lines);

  var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\base\\autoexec.cfg";

  if (Context.PlayerID > 0) {
    var dict = [Context.FindLineNumberInTextFile(txtPath, "seta s_musicvolume", Nucleus.SearchType.StartsWith) + '|seta s_musicvolume "0.0"'];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  Game.ProtoInput.OnInputLocked = function() {
    for (var i = 0; i < PlayerList.Count; i++) {
      var player = PlayerList[i];

      ProtoInput.DisableMessageBlock(player.ProtoInputInstanceHandle, 0x0006);
      ProtoInput.StartFocusMessageLoop(player.ProtoInputInstanceHandle, 0, true, false, false, false, false);

      System.Threading.Thread.Sleep(100);

      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetCursorPosHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.SetCursorPosHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.CursorVisibilityStateHookID);

      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.RawInputFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseButtonFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.KeyboardButtonFilterID);

      ProtoInput.EnableMessageBlock(player.ProtoInputInstanceHandle, 0x0006);
      ProtoInput.StopFocusMessageLoop(player.ProtoInputInstanceHandle);
    }
  };

  Game.ProtoInput.OnInputUnlocked = function() {
    for (var i = 0; i < PlayerList.Count; i++) {
      var player = PlayerList[i];

      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetCursorPosHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.SetCursorPosHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.CursorVisibilityStateHookID);

      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.RawInputFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseButtonFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.KeyboardButtonFilterID);
    }
  };
};