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

Day of Infamy · handler “Day of Infamy”

Version 1

Release notes

First release

Released
Size
2.1 KB
Downloads
22
Check
Verified
SHA-256
16947bf8b7d9d4d8ae8c3fcbdb9a16a9b1ff29d5dacb394264bd4d2c714dfbab
Download v1 (.nc)All versions

Files 1

PathSize
handler.js5.9 KB

handler.js

Plain text
Hub.Handler.Version = 1; // Released at https://hub.splitscreen.me/ on Wed May 13 2020 20:46:43 GMT+0000 (UTC).
Hub.Handler.Id = "sZrAZ5kA9MjuaiTFq";
Hub.Maintainer.Name = "Bizzo";
Hub.Maintainer.Id = "HEgozNi3MNvhAmWfi";

Game.KillMutex = [
  //killing the right mutex for open the game multiple times
  "hl2_singleton_mutex"
];
Game.DirSymlinkExclusions = [
  //what folder should be copied and not symlinked
  "doi",
  "doi\\cfg",
  "bin",
  "bin\\x64"
];
Game.FileSymlinkExclusions = [
  //what files should not be copied
  "dayofinfamy_BE.exe",
  "steam_appid.txt",
  "autoexec.cfg",
  "xinput1_3.dll"
];
Game.FileSymlinkCopyInstead = [
  //what files should be copied and not symlinked
  "video.txt",
  "config.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);

Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = true;
Game.SupportsKeyboard = true;
Game.ExecutableName = "dayofinfamy_x64.exe";
Game.SteamID = "447820";
Game.GUID = "Day of Infamy";
Game.GameName = "Day of Infamy";
Game.NeedsSteamEmulation = false;
Game.CreateSteamAppIdByExe = true;
Game.LauncherTitle = "";
Game.SupportsPositioning = true;
Game.StartArguments = "";
Game.WorkingFolder = "";
Game.MaxPlayersOneMonitor = 16;
Game.MaxPlayers = 32;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Day of Infamy";
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 = false;
Game.XInputPlusDll = ["xinput1_3.dll"];
Game.HookFocus = true;
Game.Hook.UseAlpha8CustomDll = false;
Game.PauseBetweenStarts = 30;
Game.PromptBetweenInstances = true;
Game.ResetWindows = true;
Game.Description =
  "Start a practice mode match in the first instance, use the mouse cursor to navigate the menus. When you are in-game start the next instance. Click on the last Nucleus prompt when all instances are set. If you use the keyboard click/alt-tab on the corresponding keyboard-player instance. Enable XInputReroute inside the .js file for play with more than 4 controllers.";

Game.Play = function() {
  var Args = (Context.Args = " -windowed +sv_lan 1 -AlwaysFocus -insecure -novid" + " -w " + Context.Width + " -h " + Context.Height); //launch options that the game should use

  Context.StartArguments = Args;

  var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\doi\\cfg\\video.txt"); //editing the video.txt file
  Context.ModifySaveFile(savePath, 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")
  ]);

  if (Player.IsKeyboardPlayer) {
    //if the player use keyboard the script will do this
    var autoExec = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\doi\\cfg\\autoexec.cfg"; //adding a autoexec.cfg file with the next lines
    var lines = [
      "engine_no_focus_sleep 0",
      'joystick_force_disabled_set "1"',
      "exec undo360controller.cfg",
      "host_writeconfig",
      "fps_max 60",
      'echo "$$$$$$ autoexec.cfg loaded = controller disabled $$$$$$'
    ];

    Context.ReplaceLinesInTextFile(txtPath, dict);
  } 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) + "\\doi\\cfg\\autoexec.cfg";
      var lines = [
        "engine_no_focus_sleep 0",
        'joystick_force_disabled_set "0"',
        "exec controller.cfg",
        'zoom_sensitivity_ratio_joystick ".32"',
        'bind "L_TRIGGER" "+special2"',
        "fps_max 60",
        "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) + "\\doi\\cfg\\autoexec.cfg";
      var lines = [
        "engine_no_focus_sleep 0",
        'joystick_force_disabled_set "0"',
        "exec controller.cfg",
        'zoom_sensitivity_ratio_joystick ".32"',
        'bind "L_TRIGGER" "+toggle_zoom"',
        "fps_max 60",
        "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);
};