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

Tom Clancy's H.A.W.X · handler “Tom Clancy's H.A.W.X”

Version 1

Release notes

First release

Released
Size
3.3 MB
Downloads
17
Check
Verified
SHA-256
7aa69cf45f42026da6c040e829d0d10ab18684bb9f089ffc417f4310037a737e
Download v1 (.nc)All versions

Files 7

PathSize
handler/d3d9.dll10.1 MB
handler/d3d9.ini5.7 KB
handler/new10 KB
handler/new.keys18 KB
handler/player110 KB
handler/player1_0.1.525.keys19 KB
handler.js12 KB

handler.js

Plain text
Hub.Handler.Version = 1; // Released at https://hub.splitscreen.me/ on Wed Nov 20 2024 21:03:04 GMT+0000 (Coordinated Universal Time).
Hub.Handler.Id = "JXPB5KZKJWhyj9JRt";
Hub.Maintainer.Name = "messenils";
Hub.Maintainer.Id = "5NNQPxAD7mmwGuvKp";

var answers8 = ["Yes. Level 1", "Yes. Max level", "No"];
Game.AddOption("Profiles", 'Lets the handler create profiles. Max level profiles or new ones. Creates backup of old profiles. Option "No" restores old profiles', "Setprofile", answers8);

var answers8 = ["No", "Yes"];
Game.AddOption(
  "Profile overwrite",
  'Overwrite if profile exist? Useful if you want to change between new and max level profiles. Choose "No" if you want to progress profiles',
  "Writeprofile",
  answers8
);

var answers8 = ["Enable fix", "Disable fix"];
Game.AddOption("Freeze fix", "Will stop the game traffic to dead ubisoft servers.", "Freezefix", answers8);

Game.FileSymlinkCopyInstead = [
  "binkw32.dll",
  "eax.dll",
  "setting.lua",
  "FirewallInstallHelper.dll",
  "GameuxInstallHelper.dll",
  "input_filters.cfg",
  "autodetect.ini",
  "settings.ini",
  "MappaingIcons.txt"
];
Game.FileSymlinkExclusions = ["d3d9.dll", "d3d9.ini", "xinput1_3.dll", "Clancyman_720p.bik", " d_geoeye.bik", "disclaimers.bik", "logo_wide.bik", "rating.bik", "teaser_logo.bik", "UBIPresents.bik"];

Game.KillMutex = ["Tom Clancy's H.A.W.X"];
Game.DirSymlinkExclusions = ["Data\\Settings", "Data\\Movies"];

Game.NeedsSteamEmulation = false;
Game.HandlerInterval = 100;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = true;
Game.SupportsKeyboard = false;
Game.ExecutableName = "HAWX.exe";
Game.SteamID = "";
Game.GUID = "HAWX";
Game.GameName = "Tom Clancy's H.A.W.X";
Game.MaxPlayers = 4;
Game.MaxPlayersOneMonitor = 4;
Game.LauncherTitle = "";
Game.HideTaskbar = true;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Tom Clancy's H.A.W.X";
Game.Hook.DInputEnabled = false;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.Hook.CustomDllEnabled = false;
Game.XInputPlusDll = ["xinput1_3.dll", "xinput1_4.dll", "dinput8.dll"];
Game.UserProfileConfigPath = "Saved Games\\Tom Clancy's H.A.W.X\\Profiles";
Game.Description =
  "Only works on version 1.02\n\nCreate a server in all instances (same settings). Close the lobby in all instancecs besides the last one, now you will be able to join in the last player lobby\n\nThe consistent freezing is a game problem but this handler will attempt to fix it. therefore its very important that game version matches";
Game.PauseBetweenStarts = 10;
Game.SetWindowHook = true;

Game.Play = function() {
  var setprofile = Context.Options["Setprofile"];
  var writeprofile = Context.Options["Writeprofile"];
  var freezefix = Context.Options["Freezefix"];

  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 cfgpath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\_settings_0.1.525.ini";
  var dict = [
    Context.FindLineNumberInTextFile(cfgpath, "mode", Nucleus.SearchType.StartsWith) + "|mode = -1",
    Context.FindLineNumberInTextFile(cfgpath, "windowed", Nucleus.SearchType.StartsWith) + "|windowed = true",
    Context.FindLineNumberInTextFile(cfgpath, "width", Nucleus.SearchType.StartsWith) + "|width = " + Context.Width,
    Context.FindLineNumberInTextFile(cfgpath, "height", Nucleus.SearchType.StartsWith) + "|height = " + Context.Height
  ];
  Context.ReplaceLinesInTextFile(cfgpath, dict);

  var cfgpath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Data\\Settings\\settings.ini";
  var dict = [
    Context.FindLineNumberInTextFile(cfgpath, "mode", Nucleus.SearchType.StartsWith) + "|mode = -1",
    Context.FindLineNumberInTextFile(cfgpath, "windowed", Nucleus.SearchType.StartsWith) + "|windowed = true",
    Context.FindLineNumberInTextFile(cfgpath, "width", Nucleus.SearchType.StartsWith) + "|width = " + Context.Width,
    Context.FindLineNumberInTextFile(cfgpath, "height", Nucleus.SearchType.StartsWith) + "|height = " + Context.Height
  ];
  Context.ReplaceLinesInTextFile(cfgpath, dict);

  if (Context.IsKeyboardPlayer) {
    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\XInputPlus.ini";
    Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller1", ""),
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller2", ""),
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller3", ""),
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller4", "")
    ]);
  } else {
    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\XInputPlus.ini";
    Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller1", Context.GamepadId),
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller2", Context.GamepadId),
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller3", Context.GamepadId),
      new Nucleus.IniSaveInfo("ControllerNumber", "Controller4", Context.GamepadId)
    ]);
  }

  if (Context.PlayerID == 0) {
    var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\_settings_0.1.525.ini";
    Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [new Nucleus.IniSaveInfo("Sound", "musicvolume", " 1.000000")]);
    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Data\\Settings\\settings.ini";
    Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [new Nucleus.IniSaveInfo("Sound", "musicvolume", "1.000000")]);
  } else {
    var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\_settings_0.1.525.ini";
    Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [new Nucleus.IniSaveInfo("Sound", "musicvolume", " 0.000000")]);
    var savePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Data\\Settings\\settings.ini";
    Context.ModifySaveFile(savePath, savePath, Nucleus.SaveType.INI, [new Nucleus.IniSaveInfo("Sound", "musicvolume", "0.000000")]);
  }
  ////////////////////////////////////////
  if (setprofile != "No") {
    //playername
    var OriName = Context.Nickname;
    var PlayerName = OriName[0];

    var k = 0;

    for (var i = 1; i < OriName.length; i++) {
      if (i < 15) {
        PlayerName += OriName[i];
        k++;
      }
    }
    var Namlnt = "00";
    if (k == 1) {
      Namlnt = "01";
    }
    if (k == 2) {
      Namlnt = "02";
    }
    if (k == 3) {
      Namlnt = "03";
    }
    if (k == 4) {
      Namlnt = "04";
    }
    if (k == 5) {
      Namlnt = "05";
    }
    if (k == 6) {
      Namlnt = "06";
    }
    if (k == 7) {
      Namlnt = "07";
    }
    if (k == 8) {
      Namlnt = "08";
    }
    if (k == 9) {
      Namlnt = "09";
    }
    if (k == 10) {
      Namlnt = "0A";
    }
    if (k == 11) {
      Namlnt = "0B";
    }
    if (k == 12) {
      Namlnt = "0C";
    }
    if (k == 13) {
      Namlnt = "0D";
    }
    if (k == 14) {
      Namlnt = "0E";
    }
    if (k == 15) {
      Namlnt = "0F";
    }

    //writing profile_list.bin
    var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\profile_list.bin";
    var lines = ["123456789" + "0" + PlayerName + "99"];
    Context.WriteTextFile(txtPath, lines);

    //repairing corruption
    Context.Wait(300);
    Context.PatchFileFindPattern(
      System.IO.Path.Combine(Context.RootFolder, "profile_list.bin"),
      System.IO.Path.Combine(Context.RootFolder, "profile_list.bin"),
      "31 32 33 34 35 36 37 38 39 30",
      "00 00 00 B9 00 00 00 01 00" + Namlnt,
      true
    );
    Context.Wait(200);
    Context.PatchFileFindPattern(System.IO.Path.Combine(Context.RootFolder, "profile_list.bin"), System.IO.Path.Combine(Context.RootFolder, "profile_list.bin"), "39 39", "00 00", true);
    Context.Wait(200);

    var profilebackup = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\profile_list.bin.old";
    if (!System.IO.File.Exists(profilebackup)) {
      var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\profile_list.bin.old";
      var savePkgOrigin = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\profile_list.bin";
      if (System.IO.File.Exists(savePkgOrigin)) {
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
    }
    var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\profile_list.bin";
    var savePkgOrigin = txtPath;
    System.IO.File.Copy(savePkgOrigin, savePath, true);
    if (setprofile == "Yes. Level 1") {
      var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\" + PlayerName;
      if (!System.IO.File.Exists(savePath) || writeprofile == "Yes") {
        var savePkgOrigin = Context.ScriptFolder + "\\new";
        System.IO.File.Copy(savePkgOrigin, savePath, true);
        var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\" + PlayerName + "_0.1.525.keys";
        var savePkgOrigin = Context.ScriptFolder + "\\new.keys";
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
    }
    if (setprofile == "Yes. Max level") {
      var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\" + PlayerName;
      if (!System.IO.File.Exists(savePath) || writeprofile == "Yes") {
        var savePkgOrigin = Context.ScriptFolder + "\\player1";
        System.IO.File.Copy(savePkgOrigin, savePath, true);
        var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\" + PlayerName + "_0.1.525.keys";
        var savePkgOrigin = Context.ScriptFolder + "\\player1_0.1.525.keys";
        System.IO.File.Copy(savePkgOrigin, savePath, true);
      }
    }
  } else {
    var savePkgOrigin = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\profile_list.bin.old";
    var savePath = Context.NucleusUserRoot + "\\" + Context.UserProfileConfigPath + "\\profile_list.bin";
    if (System.IO.File.Exists(savePkgOrigin)) {
      System.IO.File.Copy(savePkgOrigin, savePath, true);
      System.IO.File.Delete(savePkgOrigin);
    }
  }
  ///////////////////////

  Context.PatchFileFindPattern(
    //X prepare
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    "7D 08 83 65 F0 00 83 65 FC 00 0F B6 45 0B A3 3C BF DE",
    "90 90 90 90 90 90 0F B6 45 0B A3 3C BF DE 00 B8" + "99 99",
    true
  );
  Context.Wait(200); //Y prepare
  Context.PatchFileFindPattern(
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    "8B 45 EC A3 1C BF DE 00 8B 45 E8",
    "00 A3 1C BF DE 00 B8" + "88 88" + "00 00",
    true
  );
  Context.Wait(200);
  Context.PatchFileFindPattern(
    //X apply
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    "0B A3 3C BF DE 00 B8 99 99",
    Context.Width,
    8,
    true
  );
  Context.Wait(200);
  Context.PatchFileFindPattern(
    //Y apply
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
    "00 A3 1C BF DE 00 B8 88 88 00 00",
    Context.Height,
    8,
    true
  );
  if (freezefix == "Enable fix") {
    Context.Wait(200);
    Context.PatchFileFindPattern(
      //freeze fix
      System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
      System.IO.Path.Combine(Context.RootFolder, "HAWX.exe"),
      "74 47 8B 44 24 30 8B 4C 24 2C 50 51 8D 4C 24 10",
      "EB 47 8B 44 24 30 8B 4C 24 2C 50 51 8D 4C 24 10",
      true
    );
  }
};