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

Call of Duty 4: Modern Warfare · handler “Call of Duty 4: Modern Warfare (2007)”

Version 1

Release notes

First very annoying release.

Released
Size
11.4 MB
Downloads
71
Check
Verified
SHA-256
9bafdad55dc537b2c6bbbe2925a65876bcf7aa9978dad17e3854b38353553df8
Download v1 (.nc)All versions

Files 21

PathSize
Call of Duty 4 Modern Warfare/active.txt3 B
Call of Duty 4 Modern Warfare/config_mp.cfg12 KB
Call of Duty 4 Modern Warfare/F2.au36.5 KB
Call of Duty 4 Modern Warfare/F2.exe1014 KB
Call of Duty 4 Modern Warfare/F2X.au36.5 KB
Call of Duty 4 Modern Warfare/F2X.exe1014 KB
Call of Duty 4 Modern Warfare/Mods/PUT YOUR MOD FOLDER HERE0 B
Call of Duty 4 Modern Warfare/mpdata8.3 KB
Call of Duty 4 Modern Warfare/PeZBOT/mod.ff2.3 MB
Call of Duty 4 Modern Warfare/PeZBOT/pezbot.cfg1.8 KB
Call of Duty 4 Modern Warfare/PeZBOT/pezbot.iwd6.4 MB
Call of Duty 4 Modern Warfare/PeZBOT/pezbot_dev.cfg973 B
Call of Duty 4 Modern Warfare/prompt1.au35.8 KB
Call of Duty 4 Modern Warfare/prompt1.exe1014 KB
Call of Duty 4 Modern Warfare/prompt2.au35.4 KB
Call of Duty 4 Modern Warfare/prompt2.exe1014 KB
Call of Duty 4 Modern Warfare/Start.au34.0 KB
Call of Duty 4 Modern Warfare/Start.exe1014 KB
Call of Duty 4 Modern Warfare/StartX.au34.1 KB
Call of Duty 4 Modern Warfare/StartX.exe1014 KB
handler.js38 KB

handler.js

Plain text
Hub.Handler.Version = 1; // Released at https://hub.splitscreen.me/ on Tue Dec 03 2024 10:51:37 GMT+0000 (Coordinated Universal Time).
Hub.Handler.Id = "EjJLt5yBadfKfNdaW";
Hub.Maintainer.Name = "THEKlNG";
Hub.Maintainer.Id = "5EhQGHyiGFZA689yF";

var answers = ["Yes", "No"];
var answers1 = ["No", "Yes"];
var answers2 = ["65", "70", "75", "80", "85", "90"];
var answers3 = ["-", "vsync", "30", "40", "50", "60", "70", "80", "90", "100", "110", "120", "200", "300"];
var answers4 = ["Automatic", "Low", "Normal", "High", "Extra"];
var answers5 = ["0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"];
var answers6 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"];
var answers7 = [];
var answers8 = ["NO MOD", "Yes", "Custom mod"];
var answers9 = ["NO!", "OK"];
Game.AddOption(
  "Start game with Bots MOD (PeZBots)?",
  "Already included in the handler. Bots will go away you if start a new game so you need to press F5 in your keyboard to return bots.",
  "Mod",
  answers8
);
Game.AddOption(
  "Launch a Custom mod?",
  "Put your custom mod in the 'Mods' folder inside the handler folder,  write its folder name here and it will launch automatically for all players.",
  "MOD",
  answers7
);
Game.AddOption("Select the number of Bots to be added", "The chosen amount of bots will be added for each team.", "Bots", answers6);
Game.AddOption("Select the Bot skill level", "Bot skill level (1.0 = highest, 0.1 = lowest).", "Skill", answers5);
Game.AddOption("Choose your preferred graphic settings", "Default will use the previous or default settings.", "Graphics", answers4);
Game.AddOption("Select the FPS Cap the game will use", "", "FPS", answers3);
Game.AddOption("Select the FOV for the game to use", "Values from 65 to 90 (90 is better).", "FOV", answers2);
Game.AddOption("Unlock all stats?", "Level up to 55 with all challenges, guns, and every camouflage unlocked!", "Unlock", answers1);
Game.AddOption("Reset User Data?", "Will remove all your achievements and you will begin at level 1 again.", "Reset", answers9);
Game.AddOption("Apply registry fix for CD key?", "Needed for the unlock all stats option to work and to connect to online servers.", "registry", answers);

Game.DirSymlinkExclusions = ["players"];
Game.FileSymlinkExclusions = ["active.txt", "config_mp.cfg", "mpdata"];
Game.FileSymlinkCopyInstead = ["binkw32.dll", "steam_api.dll", "steamclient.dll", "mss32.dll", "miles32.dll", "cod.bmp", "codlogo.bmp"];
Game.BackupFolders = ["players"];
Game.GameName = "Call of Duty 4: Modern Warfare (2007)";
Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = false;
Game.KeepSymLinkOnExit = true;
Game.ExecutableName = "iw3mp.exe";
Game.GUID = "Call of Duty 4 Modern Warfare";
Game.SteamID = "7940";
Game.MaxPlayers = 32;
Game.MaxPlayersOneMonitor = 32;
Game.HideTaskbar = false;
Game.SetTopMostAtEnd = true;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Call of Duty 4";
Game.HasDynamicWindowTitle = true;
Game.ResetWindows = true;
Game.SetWindowHook = false;
Game.SetForegroundWindowElsewhere = true;
Game.Hook.DInputEnabled = false;
Game.Hook.XInputEnabled = false;
Game.Hook.CustomDllEnabled = false;
Game.ForceProcessPick = true;
Game.KillProcessesOnClose = ["Start", "StartX", "prompt1", "prompt2", "F2", "F2X", "cmd"];
Game.SaveCustomUserGeneralValues = true;
Game.UserProfileSavePath = "AppData\\Local\\CallofDuty4MW\\players\\profiles";
Game.Description =
  "This handler works with the legit Steam Version and COD4X version.\n\nYou can also get the latest patches and client version 21_1 from this link (https://cod4x.ovh/t/cod4x-releases/24) if you are using the CODX4 mod.\n\nYou also need to have a valid CD-KEY already to join online servers.\n\nFor best performance fully close Steam before using the handler.\n\nThe game doesn't have controller support so this handler only supports keyboards & mice.\n\nThis handler includes a Bots mod and autoit exe files (make sure you make an exception to the handler folder in your Antivirus as to not remove  or block any files of the handler).\n\nIf you want to launch your custom mod just put it in the Mods folder inside the handler folder and write its folder name in the custom mod Nucleus UI option, the mod will launch automatically when you enter the game.\n\nThere are 3 ways to make a server:\n\n1)Create a match with the first player then press F2 in your keyboard to connect all players to the host server, it Works when the input is unlocked before pressing the END key.\n\n2)Press '~' in your keyboard and type 127.0.0.1 local direct ip in the console and connect to the server normally.\n\n3)When you are in the main menu click join game and choose Favorites or Lan then you can see the host server appear, click on it and connect normally.\n\nOnce all the players have connected you can quickly restart the match by pressing F3 on your keyboard.\n\nAfter all the instances have launched, resized and positioned correctly, press the END key once to lock the input for all instances to have their own working cursor and keyboard, you need to left click each mouse to make the emulated cursors appear after locking the input. Press the END key again to unlock the input when you finish playing. You can also use CTRL+Q to close Nucleus and all instances when the input is unlocked.\n\nHave Fun!";
Game.PauseBetweenContextAndLaunch = 5;
Game.PauseBetweenProcessGrab = 20;
Game.PauseBetweenStarts = 5;

//USS deprecated options:

Game.InjectHookXinput = false;
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 = false;
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 = true;
Game.ProtoInput.FocusHooks = false;
Game.ProtoInput.DrawFakeCursor = false;
Game.ProtoInput.FindWindowHook = 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 = false;

Game.ProtoInput.SendMouseWheelMessages = true;
Game.ProtoInput.SendMouseButtonMessages = true;
Game.ProtoInput.SendMouseMovementMessages = true;
Game.ProtoInput.SendKeyboardButtonMessages = true;

Game.ProtoInput.EnableFocusMessageLoop = false;
//Game.ProtoInput.FocusLoopIntervalMilliseconds = 40000;
//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 = [0x0008];

Game.Play = function() {
  Context.RunAdditionalFiles([Context.ScriptFolder + "\\Start.exe"], false, 10);
  Context.RunAdditionalFiles([Context.ScriptFolder + "\\StartX.exe"], false, 10);
  Context.RunAdditionalFiles([Context.ScriptFolder + "\\F2.exe"], false, 10);
  Context.RunAdditionalFiles([Context.ScriptFolder + "\\F2X.exe"], false, 10);
  Context.RunAdditionalFiles([Context.ScriptFolder + "\\prompt1.exe"], false, 10);
  Context.RunAdditionalFiles([Context.ScriptFolder + "\\prompt2.exe"], false, 10);

  var Args = " +ui_playerProfileAlreadyChosen 1 ";
  var username = Context.Nickname;

  var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players");
  System.IO.Directory.CreateDirectory(filePath);

  var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles");
  System.IO.Directory.CreateDirectory(filePath);

  var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username);
  System.IO.Directory.CreateDirectory(filePath);

  var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\active.txt";
  var lines = ["" + username];
  Context.WriteTextFile(txtPath, lines);

  var savePath = filePath + "\\config_mp.cfg";
  var savePkgOrigin = Context.ScriptFolder + "\\config_mp.cfg";
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  var OneFolderUP = System.IO.Path.Combine(Context.EnvironmentRoot, "..");
  var envpath = OneFolderUP + "\\AppData\\Local\\CallofDuty4MW\\players\\profiles\\active.txt";
  if (System.IO.File.Exists(envpath)) {
    System.IO.File.Delete(envpath);
    Context.Wait(200);
    var lines = [username];
    Context.WriteTextFile(txtPath, lines);
  }

  var envpath = OneFolderUP + "\\AppData\\Local\\CallofDuty4MW\\players\\profiles\\" + username + "\\config_mp.cfg";
  if (System.IO.File.Exists(envpath)) {
    System.IO.File.Delete(envpath);
  }

  var Reset = Context.Options["Reset"];
  if (Reset == "NO!") {
  }
  if (Reset == "OK") {
    if (!System.IO.File.Exists(savePath)) {
      var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\mpdata");
      System.IO.File.Delete(savePath);
    }

    if (!System.IO.File.Exists(envpath)) {
      var envpath = OneFolderUP + "\\AppData\\Local\\CallofDuty4MW\\players\\profiles\\" + username + "\\mpdata";
      System.IO.File.Delete(envpath);
    }
  }

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

    if (!System.IO.File.Exists(envpath)) {
      var envpath = OneFolderUP + "\\AppData\\Local\\CallofDuty4MW\\players\\profiles\\" + username + "\\mpdata";
      var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "mpdata");
      System.IO.File.Copy(savePkgOrigin, envpath, true);
    }
  }

  var registry = Context.Options["registry"];
  if (registry == "No") {
  }
  if (registry == "Yes") {
    Context.EditRegKey("HKEY_LOCAL_MACHINE", "SOFTWARE\\WOW6432Node\\Activision\\Call of Duty 4", "codkey", "DL2J8PY44Q22GE4888D2", Nucleus.RegType.String);
  }

  var Mod = Context.Options["Mod"];
  if (Mod == "NO MOD") {
  }
  if (Mod == "Yes") {
    var Skill = Context.Options["Skill"];
    var Bots = Context.Options["Bots"];
    var unlock = Context.Options["Unlock"];
    if (unlock == "Yes") {
      unlock = "1";
    } else {
      unlock = "0";
    }

    var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\");
    System.IO.Directory.CreateDirectory(filePath);

    var filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\pezbots";
    System.IO.Directory.CreateDirectory(filePath);

    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\pezbots\\pezbot.cfg";
    var savePkgOrigin = Context.ScriptFolder + "\\PeZBOT\\pezbot.cfg";
    System.IO.File.Copy(savePkgOrigin, savePath, true);

    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\pezbots\\mod.ff";
    var savePkgOrigin = Context.ScriptFolder + "\\PeZBOT\\mod.ff";
    System.IO.File.Copy(savePkgOrigin, savePath, true);

    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\pezbots\\pezbot_dev.cfg";
    var savePkgOrigin = Context.ScriptFolder + "\\PeZBOT\\pezbot_dev.cfg";
    System.IO.File.Copy(savePkgOrigin, savePath, true);

    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\pezbots\\pezbot.iwd";
    var savePkgOrigin = Context.ScriptFolder + "\\PeZBOT\\pezbot.iwd";
    System.IO.File.Copy(savePkgOrigin, savePath, true);

    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\pezbots\\pezbot.cfg";
    var lines = [
      'set svr_pezbots "' + Bots + '"',
      'set svr_pezbots_allies "0"',
      'set svr_pezbots_axis "0"',
      'set svr_pezbots_skill "' + Skill + '"',
      'set svr_pezbots_playstyle "2"',
      'set svr_pezbots_useperks "1"',
      'svr_pezbots_modelchoice "0"',
      'set svr_pezbots_chatter "1"',
      'set svr_pezbots_dewards "0"',
      'set svr_pezbots_grenadepickup "1"',
      'set svr_pezbots_XPcheat "' + unlock + '"',
      'set svr_pezbots_roundCount "2"',
      'set svr_pezbots_mode "normal"',
      'bind F5 "exec pezbot.cfg"'
    ];
    Context.WriteTextFile(txtPath, lines);

    Args += '+set fs_game "Mods/pezbots" +exec pezbot.cfg';
  }
  if (Mod == "Custom mod") {
    var MOD = Context.Options["MOD"];

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

    var Bat = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\mods.bat";
    var lines = [
      "@ECHO OFF",
      "SET SrcRoot=" + Context.ScriptFolder + "\\Mods\\",
      "SET TargetRoot=" + Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Mods\\",
      'FOR /D %%A IN ("%SrcRoot%*") DO (MKLINK /D "%TargetRoot%%%~NA" "%%~A")',
      'FOR %%A IN ("%SrcRoot%*") DO (MKLINK "%TargetRoot%%%~NXA" "%%~A")',
      ""
    ];
    Context.WriteTextFile(Bat, lines);

    Args += '+set fs_game "Mods/' + MOD + '"';

    Context.RunAdditionalFiles(["all|" + Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\mods.bat"], false, 0, true, false);
  }

  var FPS = Context.Options["FPS"];
  if (FPS == "-") {
  }
  if (FPS == "vsync") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "1"'];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "30") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "30"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "40") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "40"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "50") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "50"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "60") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "60"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "70") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "70"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "80") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "80"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "90") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "90"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "100") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "100"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "120") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "120"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "200") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "200"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }
  if (FPS == "300") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta com_maxfps", Nucleus.SearchType.StartsWith) + '|seta com_maxfps "300"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_vsync", Nucleus.SearchType.StartsWith) + '|seta r_vsync "0"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  var FOV = Context.Options["FOV"];
  var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
  var dict = [
    Context.FindLineNumberInTextFile(txtPath, "seta cg_fov", Nucleus.SearchType.StartsWith) + '|seta cg_fov "' + FOV + '"',
    Context.FindLineNumberInTextFile(txtPath, "seta r_fullscreen", Nucleus.SearchType.StartsWith) + '|seta r_fullscreen "0"',
    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_noborder", Nucleus.SearchType.StartsWith) + '|seta r_noborder "1"',
    Context.FindLineNumberInTextFile(txtPath, "seta sv_hostname", Nucleus.SearchType.StartsWith) + '|seta sv_hostname "' + Context.Nickname + '"',
    Context.FindLineNumberInTextFile(txtPath, "seta intro", Nucleus.SearchType.StartsWith) + '|seta intro "0"',
    Context.FindLineNumberInTextFile(txtPath, "seta vid_xpos", Nucleus.SearchType.StartsWith) + '|seta vid_xpos ""',
    Context.FindLineNumberInTextFile(txtPath, "seta vid_ypos", Nucleus.SearchType.StartsWith) + '|seta vid_ypos ""',
    Context.FindLineNumberInTextFile(savePath, "posX=", Nucleus.SearchType.StartsWith) + "|posX=" + Context.PosX,
    Context.FindLineNumberInTextFile(savePath, "posY=", Nucleus.SearchType.StartsWith) + "|posY=" + Context.PosY
  ];
  Context.ReplaceLinesInTextFile(txtPath, dict);

  var Graphics = Context.Options["Graphics"];
  if (Graphics == "Automatic") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_aaSamples", Nucleus.SearchType.StartsWith) + '|seta r_aaSamples "1"',
      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_picmip", Nucleus.SearchType.StartsWith) + '|seta r_picmip "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_bump", Nucleus.SearchType.StartsWith) + '|seta r_picmip_bump "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_manual", Nucleus.SearchType.StartsWith) + '|seta r_picmip_manual "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_spec", Nucleus.SearchType.StartsWith) + '|seta r_picmip_spec "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_water", Nucleus.SearchType.StartsWith) + '|seta r_picmip_water "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterAnisoMax", Nucleus.SearchType.StartsWith) + '|seta r_texFilterAnisoMax "4"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterAnisoMin", Nucleus.SearchType.StartsWith) + '|seta r_texFilterAnisoMin "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterMipMode", Nucleus.SearchType.StartsWith) + '|seta r_texFilterMipMode "Unchanged"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_specular", Nucleus.SearchType.StartsWith) + '|seta r_specular "1"',
      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 "Default"',
      Context.FindLineNumberInTextFile(txtPath, "seta snd_outputConfiguration", Nucleus.SearchType.StartsWith) + '|seta snd_outputConfiguration "Windows default"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  if (Graphics == "Low") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "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_picmip", Nucleus.SearchType.StartsWith) + '|seta r_picmip "3"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_bump", Nucleus.SearchType.StartsWith) + '|seta r_picmip_bump "3"',
      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);
  }

  if (Graphics == "Normal") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_aaSamples", Nucleus.SearchType.StartsWith) + '|seta r_aaSamples "4"',
      Context.FindLineNumberInTextFile(txtPath, "seta sm_enable", Nucleus.SearchType.StartsWith) + '|seta sm_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta ragdoll_enable", Nucleus.SearchType.StartsWith) + '|seta ragdoll_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip", Nucleus.SearchType.StartsWith) + '|seta r_picmip "2"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_bump", Nucleus.SearchType.StartsWith) + '|seta r_picmip_bump "2"',
      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 "2"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_water", Nucleus.SearchType.StartsWith) + '|seta r_picmip_water "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterAnisoMax", Nucleus.SearchType.StartsWith) + '|seta r_texFilterAnisoMax "4"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterAnisoMin", Nucleus.SearchType.StartsWith) + '|seta r_texFilterAnisoMin "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterMipMode", Nucleus.SearchType.StartsWith) + '|seta r_texFilterMipMode "Unchanged"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_specular", Nucleus.SearchType.StartsWith) + '|seta r_specular "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_zFeather", Nucleus.SearchType.StartsWith) + '|seta r_zFeather "1"',
      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 "Default"',
      Context.FindLineNumberInTextFile(txtPath, "seta snd_outputConfiguration", Nucleus.SearchType.StartsWith) + '|seta snd_outputConfiguration "Windows default"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  if (Graphics == "High") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_aaSamples", Nucleus.SearchType.StartsWith) + '|seta r_aaSamples "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta sm_enable", Nucleus.SearchType.StartsWith) + '|seta sm_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta ragdoll_enable", Nucleus.SearchType.StartsWith) + '|seta ragdoll_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip", Nucleus.SearchType.StartsWith) + '|seta r_picmip "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_bump", Nucleus.SearchType.StartsWith) + '|seta r_picmip_bump "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 "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_specular", Nucleus.SearchType.StartsWith) + '|seta r_specular "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_zFeather", Nucleus.SearchType.StartsWith) + '|seta r_zFeather "1"',
      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);
  }

  if (Graphics == "Extra") {
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\players\\profiles\\" + username + "\\config_mp.cfg";
    var dict = [
      Context.FindLineNumberInTextFile(txtPath, "seta r_dof_enable", Nucleus.SearchType.StartsWith) + '|seta r_dof_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_aaSamples", Nucleus.SearchType.StartsWith) + '|seta r_aaSamples "4"',
      Context.FindLineNumberInTextFile(txtPath, "seta sm_enable", Nucleus.SearchType.StartsWith) + '|seta sm_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta ragdoll_enable", Nucleus.SearchType.StartsWith) + '|seta ragdoll_enable "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip", Nucleus.SearchType.StartsWith) + '|seta r_picmip "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_bump", Nucleus.SearchType.StartsWith) + '|seta r_picmip_bump "0"',
      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 "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_picmip_water", Nucleus.SearchType.StartsWith) + '|seta r_picmip_water "0"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterAnisoMax", Nucleus.SearchType.StartsWith) + '|seta r_texFilterAnisoMax "4"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterAnisoMin", Nucleus.SearchType.StartsWith) + '|seta r_texFilterAnisoMin "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_texFilterMipMode", Nucleus.SearchType.StartsWith) + '|seta r_texFilterMipMode "Unchanged"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_specular", Nucleus.SearchType.StartsWith) + '|seta r_specular "1"',
      Context.FindLineNumberInTextFile(txtPath, "seta r_zFeather", Nucleus.SearchType.StartsWith) + '|seta r_zFeather "1"',
      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 "Default"',
      Context.FindLineNumberInTextFile(txtPath, "seta snd_outputConfiguration", Nucleus.SearchType.StartsWith) + '|seta snd_outputConfiguration "Windows default"'
    ];
    Context.ReplaceLinesInTextFile(txtPath, dict);
  }

  //////////

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

      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetCursorPosHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.SetCursorPosHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetKeyStateHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetAsyncKeyStateHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetKeyboardStateHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.CursorVisibilityStateHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetRawInputDataHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.RegisterRawInputHookID);
      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.MessageFilterHookID);

      ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.FocusHooksHookID);

      //Avoid the mouse move filter unless absolutely necessary as it can massively affect performance if the game gets primary input from mouse move messages
      //ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseMoveFilterID);

      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.RawInputFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseActivateFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.WindowActivateFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.WindowActivateAppFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseWheelFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseButtonFilterID);
      ProtoInput.EnableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.KeyboardButtonFilterID);

      ProtoInput.SetDrawFakeCursor(player.ProtoInputInstanceHandle, true);

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

      System.Threading.Thread.Sleep(1000);

      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.GetKeyStateHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetAsyncKeyStateHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetKeyboardStateHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.CursorVisibilityStateHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetRawInputDataHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.RegisterRawInputHookID);
      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.MessageFilterHookID);

      ProtoInput.UninstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.FocusHooksHookID);

      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.RawInputFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseMoveFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseActivateFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.WindowActivateFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.WindowActivateAppFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseWheelFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.MouseButtonFilterID);
      ProtoInput.DisableMessageFilter(player.ProtoInputInstanceHandle, ProtoInput.Values.KeyboardButtonFilterID);

      ProtoInput.SetDrawFakeCursor(player.ProtoInputInstanceHandle, false);
    }
  };
};