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

Call of Duty: Modern Warfare 2 · handler “Modern Warfare 2 Multiplayer”

Version 1

Release notes

Call of Duty: Modern Warfare 2 (IW4x) handler

Released
Size
9.3 MB
Downloads
317
Check
Verified
SHA-256
ef40418dd634516515baa250841c7d9ed375c0f1631ac15b19efe68d13700203
Download v1 (.nc)All versions

Files 137

PathSize
handler/d3d9.dll8.1 MB
handler/d3d9.ini4.3 KB
handler/F2 Guest.au31.3 KB
handler/F2 Guest.exe894 KB
handler/F2 Host.exe894 KB
handler/F2.au31.2 KB
handler/iw4x-sp.exe1.5 MB
handler/iw4x.dll2.6 MB
handler/iw4x.exe4.0 MB
handler/iw4x.stat8.0 KB
handler/iw4x_config.cfg13 KB
handler/mods/bots/bots.txt355 B
handler/mods/bots/maps/mp/bots/waypoints/afghan.gsc32 KB
handler/mods/bots/maps/mp/bots/waypoints/afghancaves.gsc32 B
handler/mods/bots/maps/mp/bots/waypoints/afghanchase.gsc17 KB
handler/mods/bots/maps/mp/bots/waypoints/airport.gsc40 KB
handler/mods/bots/maps/mp/bots/waypoints/arcadia.gsc28 B
handler/mods/bots/maps/mp/bots/waypoints/bailout.gsc68 KB
handler/mods/bots/maps/mp/bots/waypoints/bloc.gsc70 KB
handler/mods/bots/maps/mp/bots/waypoints/bog.gsc41 KB
handler/mods/bots/maps/mp/bots/waypoints/boneyard.gsc29 B
handler/mods/bots/maps/mp/bots/waypoints/bridge.gsc27 B
handler/mods/bots/maps/mp/bots/waypoints/burgertown.gsc18 KB
handler/mods/bots/maps/mp/bots/waypoints/carnival.gsc43 KB
handler/mods/bots/maps/mp/bots/waypoints/cliffhanger.gsc71 KB
handler/mods/bots/maps/mp/bots/waypoints/contingency.gsc52 KB
handler/mods/bots/maps/mp/bots/waypoints/crash.gsc62 KB
handler/mods/bots/maps/mp/bots/waypoints/crossfire.gsc85 KB
handler/mods/bots/maps/mp/bots/waypoints/dcburning.gsc30 B
handler/mods/bots/maps/mp/bots/waypoints/dcemp.gsc21 KB
handler/mods/bots/maps/mp/bots/waypoints/derail.gsc80 KB
handler/mods/bots/maps/mp/bots/waypoints/downtown.gsc29 B
handler/mods/bots/maps/mp/bots/waypoints/estate.gsc61 KB
handler/mods/bots/maps/mp/bots/waypoints/estatesp.gsc29 B
handler/mods/bots/maps/mp/bots/waypoints/favela.gsc50 KB
handler/mods/bots/maps/mp/bots/waypoints/favelaescape.gsc33 B
handler/mods/bots/maps/mp/bots/waypoints/favelasp.gsc29 B
handler/mods/bots/maps/mp/bots/waypoints/firingrange.gsc66 KB
handler/mods/bots/maps/mp/bots/waypoints/fuel.gsc74 KB
handler/mods/bots/maps/mp/bots/waypoints/gulag.gsc28 KB
handler/mods/bots/maps/mp/bots/waypoints/highrise.gsc65 KB
handler/mods/bots/maps/mp/bots/waypoints/hunted.gsc18 KB
handler/mods/bots/maps/mp/bots/waypoints/invasion.gsc59 KB
handler/mods/bots/maps/mp/bots/waypoints/karachi.gsc46 KB
handler/mods/bots/maps/mp/bots/waypoints/killhouse.gsc32 KB
handler/mods/bots/maps/mp/bots/waypoints/museum.gsc8.0 KB
handler/mods/bots/maps/mp/bots/waypoints/nuketown.gsc53 KB
handler/mods/bots/maps/mp/bots/waypoints/oilrig.gsc31 KB
handler/mods/bots/maps/mp/bots/waypoints/overgrown.gsc81 KB
handler/mods/bots/maps/mp/bots/waypoints/pripyat.gsc32 KB
handler/mods/bots/maps/mp/bots/waypoints/quarry.gsc46 KB
handler/mods/bots/maps/mp/bots/waypoints/roadkill.gsc21 KB
handler/mods/bots/maps/mp/bots/waypoints/rundown.gsc58 KB
handler/mods/bots/maps/mp/bots/waypoints/rust.gsc55 KB
handler/mods/bots/maps/mp/bots/waypoints/rustlong.gsc36 KB
handler/mods/bots/maps/mp/bots/waypoints/salvage.gsc57 KB
handler/mods/bots/maps/mp/bots/waypoints/scrapyard.gsc40 KB
handler/mods/bots/maps/mp/bots/waypoints/shipment.gsc15 KB
handler/mods/bots/maps/mp/bots/waypoints/shipmentlong.gsc26 KB
handler/mods/bots/maps/mp/bots/waypoints/skidrow.gsc63 KB
handler/mods/bots/maps/mp/bots/waypoints/storm.gsc82 KB
handler/mods/bots/maps/mp/bots/waypoints/strike.gsc94 KB
handler/mods/bots/maps/mp/bots/waypoints/subbase.gsc53 KB
handler/mods/bots/maps/mp/bots/waypoints/terminal.gsc66 KB
handler/mods/bots/maps/mp/bots/waypoints/testmap.gsc8.0 KB
handler/mods/bots/maps/mp/bots/waypoints/trailerpark.gsc40 KB
handler/mods/bots/maps/mp/bots/waypoints/trainer.gsc24 KB
handler/mods/bots/maps/mp/bots/waypoints/underpass.gsc38 KB
handler/mods/bots/maps/mp/bots/waypoints/vacant.gsc39 KB
handler/mods/bots/maps/mp/bots/waypoints/wasteland.gsc53 KB
handler/mods/bots/maps/mp/bots/waypoints/wetwork.gsc62 KB
handler/mods/bots/maps/mp/bots/waypoints/whitehouse.gsc31 B
handler/mods/bots/maps/mp/bots/waypoints/_custom_map.gsc99 KB
handler/mods/bots/maps/mp/bots/_bot.gsc23 KB
handler/mods/bots/maps/mp/bots/_bot_chat.gsc58 KB
handler/mods/bots/maps/mp/bots/_bot_http.gsc356 B
handler/mods/bots/maps/mp/bots/_bot_internal.gsc62 KB
handler/mods/bots/maps/mp/bots/_bot_script.gsc162 KB
handler/mods/bots/maps/mp/bots/_bot_utility.gsc66 KB
handler/mods/bots/maps/mp/bots/_menu.gsc28 KB
handler/mods/bots/maps/mp/bots/_wp_editor.gsc20 KB
handler/mods/bots/scripts/bots.gsc56 B
handler/mods/bots/scripts/bots_chat.gsc61 B
handler/mods/bots/scripts/bots_menu.gsc53 B
handler/mods/bots/scripts/bots_wp_editor.gsc58 B
handler/mods/bots/waypoints/co_hunted_wp.csv8.9 KB
handler/mods/bots/waypoints/mp_abandon_wp.csv22 KB
handler/mods/bots/waypoints/mp_afghan_wp.csv17 KB
handler/mods/bots/waypoints/mp_bloc_sh_wp.csv25 KB
handler/mods/bots/waypoints/mp_bloc_wp.csv25 KB
handler/mods/bots/waypoints/mp_bog_sh_wp.csv11 KB
handler/mods/bots/waypoints/mp_bog_wp.csv6.1 KB
handler/mods/bots/waypoints/mp_boneyard_wp.csv13 KB
handler/mods/bots/waypoints/mp_brecourt_wp.csv17 KB
handler/mods/bots/waypoints/mp_cargoship_wp.csv16 KB
handler/mods/bots/waypoints/mp_checkpoint_wp.csv32 KB
handler/mods/bots/waypoints/mp_compact_wp.csv17 KB
handler/mods/bots/waypoints/mp_complex_wp.csv19 KB
handler/mods/bots/waypoints/mp_crash_tropical.csv16 KB
handler/mods/bots/waypoints/mp_crash_wp.csv16 KB
handler/mods/bots/waypoints/mp_cross_fire_wp.csv23 KB
handler/mods/bots/waypoints/mp_derail_wp.csv27 KB
handler/mods/bots/waypoints/mp_estate_tropical_wp.csv26 KB
handler/mods/bots/waypoints/mp_estate_wp.csv26 KB
handler/mods/bots/waypoints/mp_favela_wp.csv16 KB
handler/mods/bots/waypoints/mp_fav_tropical_wp.csv16 KB
handler/mods/bots/waypoints/mp_firingrange_wp.csv13 KB
handler/mods/bots/waypoints/mp_fuel2_wp.csv35 KB
handler/mods/bots/waypoints/mp_highrise_wp.csv23 KB
handler/mods/bots/waypoints/mp_invasion_wp.csv35 KB
handler/mods/bots/waypoints/mp_killhouse_wp.csv9.6 KB
handler/mods/bots/waypoints/mp_nightshift_wp.csv15 KB
handler/mods/bots/waypoints/mp_nuked_wp.csv13 KB
handler/mods/bots/waypoints/mp_overgrown_wp.csv31 KB
handler/mods/bots/waypoints/mp_quarry_wp.csv30 KB
handler/mods/bots/waypoints/mp_rundown_wp.csv26 KB
handler/mods/bots/waypoints/mp_rust_long_wp.csv9.5 KB
handler/mods/bots/waypoints/mp_rust_wp.csv7.2 KB
handler/mods/bots/waypoints/mp_shipment_long_wp.csv5.9 KB
handler/mods/bots/waypoints/mp_shipment_wp.csv3.9 KB
handler/mods/bots/waypoints/mp_storm_spring_wp.csv19 KB
handler/mods/bots/waypoints/mp_storm_wp.csv19 KB
handler/mods/bots/waypoints/mp_strike_wp.csv27 KB
handler/mods/bots/waypoints/mp_subbase_wp.csv18 KB
handler/mods/bots/waypoints/mp_terminal_wp.csv15 KB
handler/mods/bots/waypoints/mp_trailerpark_wp.csv15 KB
handler/mods/bots/waypoints/mp_underpass_wp.csv23 KB
handler/mods/bots/waypoints/mp_vacant_wp.csv13 KB
handler/mods/bots/waypoints/oilrig_wp.csv7.9 KB
handler/osd.ini4.6 KB
handler/Prompt.au31.2 KB
handler/Prompt.exe894 KB
handler/Prompt2.au3515 B
handler/Prompt2.exe894 KB
handler/start.au31.0 KB
handler/start.exe894 KB
handler.js36 KB

handler.js

Plain text
Hub.Handler.Version = 1; // Released at https://hub.splitscreen.me/ on Sun Jan 29 2023 03:14:12 GMT+0000 (Coordinated Universal Time).
Hub.Handler.Id = "esp2D3Wr49B3EBkbX";
Hub.Maintainer.Name = "Perserveruz";
Hub.Maintainer.Id = "nFAYvHKj75jAFRAgt";

var answers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"];
var answers1 = ["2", "1", "3", "4", "5", "6", "7", "8", "0"];
var answers2 = ["No", "Yes"];
var answers3 = ["Yes", "No"];
var answers4 = ["60", "50", "45", "40", "30", "0"];
var answers5 = ["Default", "Yes", "No"];
var answers6 = ["Host PC", "Guest PC"];
Game.AddOption("Launch bot mod", "", "botmod", answers3);
Game.AddOption("Select the number of bots to be added", "", "Bots", answers);
Game.AddOption("Select the bot skill level", "", "Skill", answers1);
Game.AddOption("Unlock all stats", "", "Unlock", answers2);
Game.AddOption("Apply optimized graphic settings for low-end PC", "", "opt", answers2);
Game.AddOption("Enable music only in the first instance?", "", "Mus", answers3);
Game.AddOption("LAN options", "Select whether you are the host or guest PC", "LAN", answers6);
Game.AddOption("Swap shoulder and trigger buttons (useful for Playstation controllers)", "", "pscontrollers", answers5);
Game.AddOption("Select the FPS Cap the game will use", "", "fps", answers4);
Game.KillMutexType = "Mutant";
Game.KillMutex = ["iw4x_mutex"];
Game.FileSymlinkExclusions = ["d3d9.dll", "d3d9.ini", "Xinputplus.ini", "xinput1_4.dll", "xinput1_3.dll", "iw4x_config.cfg", "iw4x.dll", "guid.dat", "iw4x.stat", "nodes.dat"];
Game.FileSymlinkCopyInstead = ["crash.log", "binkw32.dll", "mss32.dll", "localization.txt", ".version.json", "iw4x-sp.exe", "iw4sp.exe"];
Game.DirExclusions = ["miles"];
Game.DirSymlinkCopyInstead = ["userraw", "logs"];
Game.DirSymlinkCopyInsteadIncludeSubFolders = true;
Game.SymlinkGame = true;
Game.SymlinkExe = false;
Game.SymlinkFolders = false;
Game.KeepSymLinkOnExit = true;
Game.SupportsKeyboard = false;
Game.UseNucleusEnvironment = true;
Game.HandlerInterval = 100;
Game.ExecutableName = "iw4x.exe";
Game.NeedsSteamEmulation = false;
Game.SteamID = "";
Game.GUID = "IW4x";
Game.GameName = "IW4x";
Game.MaxPlayers = 4;
Game.MaxPlayersOneMonitor = 4;
Game.SupportsPositioning = true;
Game.HideTaskbar = false;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "IW4x -";
Game.HasDynamicWindowTitle = true;
Game.HookFocus = true;
Game.FakeFocus = false;
Game.SendFakeFocusMsg = false;
Game.PreventWindowDeactivation = false;
Game.KeyboardPlayerSkipPreventWindowDeactivate = false;
Game.Hook.DInputEnabled = false;
Game.Hook.DInputForceDisable = true;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.InjectHookXinput = true;
Game.BlockRawInput = false;
Game.Hook.CustomDllEnabled = false;
Game.Hook.UseAlpha8CustomDll = false;
Game.SetForegroundWindowElsewhere = true;
Game.ProcessChangesAtEnd = false;
Game.KillProcessesOnClose = ["start", "Prompt", "Prompt2", "connect", "F2 Host", "F2 Guest", "cmd"];
Game.DontResize = true;
Game.DontRemoveBorders = true;
Game.DontReposition = true;
Game.ResetWindows = true;
Game.SupportsMultipleKeyboardsAndMice = true;
Game.Description =
  "Requires a copy of Call of Duty Modern Warfare 2 in English (support will only be provided for the original Steam version), Nucleus v2.1.2 and above, IW4x client, and preferably the IW4x DLC map pack. Go to https://xlabs.dev/ for a guide on how to setup IW4x, and to download both client and DLC maps. Once all the instances have finished resizing and repositioning, have the first player create a game and the other players join by pressing F2. If one of the instances is using mouse/keyboard, you will need to lock input by pressing the end key. Press the end key again to unlock the input. Please note that if the input is locked then F2 will not work so only lock input by pressing the end key once everyone is connected to the match. To select maps with controller, you will need to place your mouse pointer over the map list. For this reason, if you're using a mix of controllers and mouse/keyboard, it is advisable to let the person using the mouse and keyboard host the match so that they can use the mouse to select the desired map even after input is locked. Online play on IW4x servers also works but if you want to connect to servers, you will need to select No under the Launch bot mod option. Spec Ops mode is currently not supported";

Game.Play = function() {
  // 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.DrawFakeMouseCursor = false;
  Game.LockInputAtStart = false;
  Game.LockInputSuspendsExplorer = true;
  Game.LockInputToggleKey = 0x23;

  if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\logs\\crash.log"))) {
    System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\logs\\crash.log"));
  }

  var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.dll");
  var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "d3d9.dll");
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.ini");
  var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "d3d9.ini");
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\iw4x.dll");
  var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "iw4x.dll");
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\iw4x-sp.exe");
  var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "iw4x-sp.exe");
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x_config.cfg")) {
    var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x_config.cfg");
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "iw4x_config.cfg");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }

  if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.Documents) + "\\My Mods\\SpecialK\\Global\\osd.ini")) {
    var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.Documents) + "\\My Mods\\SpecialK\\Global\\osd.ini");
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "osd.ini");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  } else {
    var txtPath = Context.GetFolder(Nucleus.Folder.Documents) + "\\My Mods\\SpecialK\\Global\\osd.ini";
    Context.ReplaceLinesInTextFile(txtPath, [Context.FindLineNumberInTextFile(txtPath, "Duration=", Nucleus.SearchType.StartsWith) + "|Duration=0.0"], "utf-8");
  }

  var LAN = Context.Options["LAN"];
  if (LAN == "Host PC") {
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\start.exe"], false, 10);
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\F2 Host.exe"], false, 10);
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\Prompt.exe"], false, 10);
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\Prompt2.exe"], false, 10);
  }
  if (LAN == "Guest PC") {
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\start.exe"], false, 10);
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\F2 Guest.exe"], false, 10);
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\Prompt.exe"], false, 10);
    Context.RunAdditionalFiles([Context.ScriptFolder + "\\Prompt2.exe"], false, 10);
  }

  var Unlock = Context.Options["Unlock"];
  if (Unlock == "No") {
  }
  if (Unlock == "Yes") {
    var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x.stat");
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "iw4x.stat");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }

  var opt = Context.Options["opt"];
  if (opt == "Yes") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x_config.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_specular", Nucleus.SearchType.StartsWith) + '|seta r_specular "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_aaSamples", Nucleus.SearchType.StartsWith) + '|seta r_aaSamples "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta sm_enable", Nucleus.SearchType.StartsWith) + '|seta sm_enable "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta ragdoll_enable", Nucleus.SearchType.StartsWith) + '|seta ragdoll_enable "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_useD3D9Ex", Nucleus.SearchType.StartsWith) + '|seta r_useD3D9Ex "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip ", Nucleus.SearchType.StartsWith) + '|seta r_picmip "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_manual ", Nucleus.SearchType.StartsWith) + '|seta r_picmip_manual "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_spec", Nucleus.SearchType.StartsWith) + '|seta r_picmip_spec "3"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_specular", Nucleus.SearchType.StartsWith) + '|seta r_specular "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_zFeather", Nucleus.SearchType.StartsWith) + '|seta r_zFeather "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta sm_maxLights", Nucleus.SearchType.StartsWith) + '|seta sm_maxLights "4"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_rendererPreference", Nucleus.SearchType.StartsWith) + '|seta r_rendererPreference "Shader model 2.0"',
      Context.FindLineNumberInTextFile(txtPath, "seta snd_outputConfiguration", Nucleus.SearchType.StartsWith) + '|seta snd_outputConfiguration "Stereo"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  Context.CopyScriptFolder(Context.GetFolder(Nucleus.Folder.InstancedGameFolder));

  var Mus = Context.Options["Mus"];

  if (Mus == "Yes") {
    if (Context.PlayerID == 0) {
      var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles");
      System.IO.Directory.CreateDirectory(filePath);

      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\milesEq.flt")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\milesEq.flt");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\milesEq.flt");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mpthree asi.file")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mpthree asi.file");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mpthree asi.file");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdolby.flt")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdolby.flt");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssdolby.flt");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "miles\\mssds3d.flt")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssds3d.flt");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssds3d.flt");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdsp.flt")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdsp.flt");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssdsp.flt");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msseax.flt")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msseax.flt");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\msseax.flt");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssmp3.asi")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssmp3.asi");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssmp3.asi");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssogg.asi")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssogg.asi");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssogg.asi");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msssrs.flt")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msssrs.flt");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\msssrs.flt");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
      if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssvoice.asi")) {
        var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssvoice.asi");
        var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssvoice.asi");
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
    } else {
      if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\milesEq.flt"))) {
        System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\milesEq.flt"));
      }
      if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssds3d.flt"))) {
        System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\mssds3d.flt"));
      }
      if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\\\mssdsp.flt"))) {
        System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdsp.flt"));
      }
      if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msseax.flt"))) {
        System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msseax.flt"));
      }
      if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssmp3.asi"))) {
        System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssmp3.asi"));
      }
      if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssvoice.asi"))) {
        System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssvoice.asi"));
      }
    }
  }

  if (Mus == "No") {
    var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles");
    System.IO.Directory.CreateDirectory(filePath);

    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\milesEq.flt")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\milesEq.flt");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\milesEq.flt");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mpthree asi.file")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mpthree asi.file");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mpthree asi.file");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdolby.flt")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdolby.flt");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssdolby.flt");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "miles\\mssds3d.flt")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssds3d.flt");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssds3d.flt");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdsp.flt")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssdsp.flt");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssdsp.flt");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msseax.flt")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msseax.flt");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\msseax.flt");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssmp3.asi")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssmp3.asi");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssmp3.asi");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssogg.asi")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssogg.asi");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssogg.asi");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msssrs.flt")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\msssrs.flt");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\msssrs.flt");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
    if (!System.IO.File.Exists(Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssvoice.asi")) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\miles\\mssvoice.asi");
      var savePkgOrigin = System.IO.Path.Combine(Context.RootInstallFolder, "miles\\mssvoice.asi");
      System.IO.File.Copy(savePkgOrigin, savePath, true);
    }
  }

  var botmod = Context.Options["botmod"];
  if (botmod == "Yes") {
    var Skill = Context.Options["Skill"];
    var Bots = Context.Options["Bots"];

    var Args = (Context.Args =
      " +set fs_game mods/bots +set bots_skill " + Skill + " +set bots_manage_fill " + Bots + " +set bots_main_waitForHostTime 360 +exec z_svr_bots.cfg +sv_securityLevel 1 +r_fullscreen 0 +nosteam ");
    Context.StartArguments = Args;
  }
  var botmod = Context.Options["botmod"];
  if (botmod == "No") {
    var Skill = Context.Options["Skill"];
    var Bots = Context.Options["Bots"];

    var Args = (Context.Args = " +set bots_skill " + Skill + " +set bots_manage_fill " + Bots + " +exec z_svr_bots.cfg +r_fullscreen 0 +nosteam ");
    Context.StartArguments = Args;
  }

  var pscontrollers = Context.Options["pscontrollers"];
  if (pscontrollers == "Default") {
  }
  if (pscontrollers == "Yes") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x_config.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta gpad_buttonConfig", Nucleus.SearchType.StartsWith) + '|seta gpad_buttonConfig "buttons_default"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_LSHLDR", Nucleus.SearchType.StartsWith) + '|bind BUTTON_LSHLDR "+speed_throw"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_RSHLDR", Nucleus.SearchType.StartsWith) + '|bind BUTTON_RSHLDR "+attack"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_LTRIG", Nucleus.SearchType.StartsWith) + '|bind BUTTON_LTRIG "+smoke"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_RTRIG", Nucleus.SearchType.StartsWith) + '|bind BUTTON_RTRIG "+frag"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  var pscontrollers = Context.Options["pscontrollers"];
  if (pscontrollers == "No") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x_config.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta gpad_buttonConfig", Nucleus.SearchType.StartsWith) + '|seta gpad_buttonConfig "buttons_default"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_LSHLDR", Nucleus.SearchType.StartsWith) + '|bind BUTTON_LSHLDR "+smoke"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_RSHLDR", Nucleus.SearchType.StartsWith) + '|bind BUTTON_RSHLDR "+frag"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_LTRIG", Nucleus.SearchType.StartsWith) + '|bind BUTTON_LTRIG "+speed_throw"',
      Context.FindLineNumberInTextFile(txtPath, "bind BUTTON_RTRIG", Nucleus.SearchType.StartsWith) + '|bind BUTTON_RTRIG "+attack"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  if (Context.AspectRatioDecimal < 1.2) {
    Game.DontReposition = true;
    Game.DontResize = true;
    Game.DontRemoveBorders = true;
    var x = Context.Height;
    var y = 1.5;
    var scrheight = x / y;
    Game.Hook.ResWidth = Context.Width;
    Game.Hook.ResHeight = scrheight;
    var i = Context.OrigHeight;
    var h = x - scrheight;
    var Yoffset = h / 2;
    Context.HideDesktop();

    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x_config.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "TargetFPS=", Nucleus.SearchType.StartsWith) + "|TargetFPS=" + fps,
      Context.FindLineNumberInTextFile(txtPath, "BackgroundFPS=", Nucleus.SearchType.StartsWith) + "|BackgroundFPS=" + fps,
      Context.FindLineNumberInTextFile(txtPath, "seta r_mode", Nucleus.SearchType.StartsWith) + '|seta r_mode "' + Context.Width + "x" + scrheight + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_customMode", Nucleus.SearchType.StartsWith) + '|seta r_customMode "' + Context.Width + "x" + scrheight + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_displayMode", Nucleus.SearchType.StartsWith) + '|seta r_displayMode "windowed (no border)"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_aspectRatio", Nucleus.SearchType.StartsWith) + '|seta r_aspectRatio "custom"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_customAspectRatio", Nucleus.SearchType.StartsWith) + '|seta r_customAspectRatio "' + Context.AspectRatioDecimal + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta name", Nucleus.SearchType.StartsWith) + '|seta name "' + Context.Nickname + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta intro", Nucleus.SearchType.StartsWith) + '|seta intro "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_useD3D9Ex", Nucleus.SearchType.StartsWith) + '|seta r_useD3D9Ex "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);

    var fps = Context.Options["fps"];
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.ini";
    Context.ReplaceLinesInTextFile(
      txtPath,
      [
        Context.FindLineNumberInTextFile(txtPath, "Borderless=", Nucleus.SearchType.StartsWith) + "|Borderless=true",
        Context.FindLineNumberInTextFile(txtPath, "RenderInBackground=", Nucleus.SearchType.StartsWith) + "|RenderInBackground=true",
        Context.FindLineNumberInTextFile(txtPath, "XOffset=", Nucleus.SearchType.StartsWith) + "|XOffset=0.0%",
        Context.FindLineNumberInTextFile(txtPath, "YOffset=", Nucleus.SearchType.StartsWith) + "|YOffset=" + Yoffset,
        Context.FindLineNumberInTextFile(txtPath, "DontHookWndProc=", Nucleus.SearchType.StartsWith) + "|DontHookWndProc=false",
        Context.FindLineNumberInTextFile(txtPath, "OverrideRes=", Nucleus.SearchType.StartsWith) + '|OverrideRes="' + Context.Width + "x" + scrheight + '"'
      ],
      "utf-8"
    );
    if (Context.PlayerID == 0) {
      var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.ini";
      Context.ReplaceLinesInTextFile(txtPath, [Context.FindLineNumberInTextFile(txtPath, "XOffset=", Nucleus.SearchType.StartsWith) + "|XOffset=0.0%"], "utf-8");
    } else {
      var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.ini";
      Context.ReplaceLinesInTextFile(txtPath, [Context.FindLineNumberInTextFile(txtPath, "XOffset=", Nucleus.SearchType.StartsWith) + "|XOffset=50.0%"], "utf-8");
    }
  } else {
    Game.DontReposition = false;
    Game.DontResize = false;
    Game.DontRemoveBorders = true;

    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.ini";
    Context.ReplaceLinesInTextFile(
      txtPath,
      [
        Context.FindLineNumberInTextFile(txtPath, "TargetFPS=", Nucleus.SearchType.StartsWith) + "|TargetFPS=" + fps,
        Context.FindLineNumberInTextFile(txtPath, "BackgroundFPS=", Nucleus.SearchType.StartsWith) + "|BackgroundFPS=" + fps,
        Context.FindLineNumberInTextFile(txtPath, "Borderless=", Nucleus.SearchType.StartsWith) + "|Borderless=true",
        Context.FindLineNumberInTextFile(txtPath, "RenderInBackground=", Nucleus.SearchType.StartsWith) + "|RenderInBackground=true",
        Context.FindLineNumberInTextFile(txtPath, "XOffset=", Nucleus.SearchType.StartsWith) + "|XOffset=0.0%",
        Context.FindLineNumberInTextFile(txtPath, "YOffset=", Nucleus.SearchType.StartsWith) + "|YOffset=0.0%",
        Context.FindLineNumberInTextFile(txtPath, "DontHookWndProc=", Nucleus.SearchType.StartsWith) + "|DontHookWndProc=false",
        Context.FindLineNumberInTextFile(txtPath, "OverrideRes=", Nucleus.SearchType.StartsWith) + "|OverrideRes=" + Context.Width + "x" + Context.Height + ""
      ],
      "utf-8"
    );

    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\iw4x_config.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta r_mode", Nucleus.SearchType.StartsWith) + '|seta r_mode "' + Context.Width + "x" + Context.Height + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_customMode", Nucleus.SearchType.StartsWith) + '|seta r_customMode "' + Context.Width + "x" + Context.Height + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_displayMode", Nucleus.SearchType.StartsWith) + '|seta r_displayMode "windowed (no border)"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_aspectRatio", Nucleus.SearchType.StartsWith) + '|seta r_aspectRatio "custom"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_customAspectRatio", Nucleus.SearchType.StartsWith) + '|seta r_customAspectRatio "' + Context.AspectRatioDecimal + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta name", Nucleus.SearchType.StartsWith) + '|seta name "' + Context.Nickname + '"',
      Context.FindLineNumberInTextFile(txtPath, "seta intro", Nucleus.SearchType.StartsWith) + '|seta intro "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_useD3D9Ex", Nucleus.SearchType.StartsWith) + '|seta r_useD3D9Ex "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  if (Context.HasKeyboardPlayer) {
    if (System.IO.File.Exists((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.dll"))) {
      System.IO.File.Delete((Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\d3d9.dll"));
    }
    Game.PauseBetweenProcessGrab = 25;
    Game.PauseBetweenStarts = 0;
    Game.ProtoInput.InjectStartup = false;
    Game.ProtoInput.InjectRuntime_RemoteLoadMethod = false;
    Game.ProtoInput.InjectRuntime_EasyHookMethod = true;
    Game.ProtoInput.InjectRuntime_EasyHookStealthMethod = false;
    Game.ProtoInput.FindWindowHook = true;
    Game.ProtoInput.RegisterRawInputHook = true;
    Game.ProtoInput.GetRawInputDataHook = true;
    Game.ProtoInput.MessageFilterHook = true;
    Game.ProtoInput.GetCursorPosHook = false;
    Game.ProtoInput.SetCursorPosHook = false;
    Game.ProtoInput.GetKeyStateHook = false;
    Game.ProtoInput.GetAsyncKeyStateHook = false;
    Game.ProtoInput.GetKeyboardStateHook = false;
    Game.ProtoInput.CursorVisibilityHook = false;
    Game.ProtoInput.ClipCursorHook = false;
    Game.ProtoInput.FocusHooks = false;
    Game.ProtoInput.DrawFakeCursor = false;
    Game.ProtoInput.ClipCursorHookCreatesFakeClip = false;
    Game.ProtoInput.RawInputFilter = false;
    Game.ProtoInput.MouseMoveFilter = false;
    Game.ProtoInput.MouseActivateFilter = false;
    Game.ProtoInput.WindowActivateFilter = false;
    Game.ProtoInput.WindowActvateAppFilter = false;
    Game.ProtoInput.MouseWheelFilter = false;
    Game.ProtoInput.MouseButtonFilter = false;
    Game.ProtoInput.KeyboardButtonFilter = true;
    Game.ProtoInput.SendMouseWheelMessages = true;
    Game.ProtoInput.SendMouseButtonMessages = true;
    Game.ProtoInput.SendMouseMovementMessages = true;
    Game.ProtoInput.SendKeyboardButtonMessages = true;
    Game.ProtoInput.EnableFocusMessageLoop = false;
    Game.ProtoInput.FocusLoopIntervalMilliseconds = 0;
    Game.ProtoInput.FocusLoop_WM_ACTIVATE = true;
    Game.ProtoInput.FocusLoop_WM_ACTIVATEAPP = true;
    Game.ProtoInput.FocusLoop_WM_NCACTIVATE = true;
    Game.ProtoInput.FocusLoop_WM_SETFOCUS = true;
    Game.ProtoInput.FocusLoop_WM_MOUSEACTIVATE = true;
    Game.ProtoInput.BlockedMessages = [];
    Game.ProtoInput.RenameHandlesHook = false;
    Game.ProtoInput.RenameHandles = [];
    Game.ProtoInput.RenameNamedPipes = [];
  } else {
    Game.PauseBetweenProcessGrab = 10;
    Game.PauseBetweenStarts = 0;
  }
  Game.ProtoInput.OnInputLocked = function() {
    if (Context.HasKeyboardPlayer) {
      for (var i = 0; i < PlayerList.Count; i++) {
        var player = PlayerList[i];
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.FocusHooksHookID);
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetCursorPosHookID);
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.SetCursorPosHookID);
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.CursorVisibilityStateHookID);
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.ClipCursorHookID);
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetKeyStateHookID);
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetKeyboardStateHookID);
        ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetAsyncKeyStateHookID);

        ProtoInput.StartFocusMessageLoop(player.ProtoInputInstanceHandle, 5, true, true, true, true, true);
        System.Threading.Thread.Sleep(1000);
        ProtoInput.SetRawInputBypass(player.ProtoInputInstanceHandle, false);
        ProtoInput.StopFocusMessageLoop(player.ProtoInputInstanceHandle);

        ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.RawInputFilterID);
        ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.KeyboardButtonFilterID);
        ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseButtonFilterID);
        ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseWheelFilterID);
        ProtoInput.EnableMessageBlock(player.ProtoInputInstanceHandle, 0x0008);
      }
    }
  };
  Game.ProtoInput.OnInputUnlocked = function() {
    for (var i = 0; i < PlayerList.Count; i++) {
      var player = PlayerList[i];
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.FocusHooksHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetCursorPosHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.SetCursorPosHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.CursorVisibilityStateHookID);

      ProtoInput.SetDrawFakeCursor(player.ProtoInputInstanceHandle, false);
      ProtoInput.SetRawInputBypass(player.ProtoInputInstanceHandle, true);

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