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

Sonic & All-Stars Racing Transformed · handler “Sonic & All-Stars Racing Transformed”

Version 1

Release notes

Allows up to 8 player split-screen

Released
Size
267 KB
Downloads
9
Check
Verified
SHA-256
6c4acb0e664a1004a3d4d0d28a70eaef4a440daec06086596b32cb0df71c064e
Download v1 (.nc)All versions

Files 6

PathSize
handler/High.xml821 B
handler/intro/drifting.usm329 KB
handler/intro/logos.usm17 KB
handler/Low.xml821 B
handler/Normal.xml821 B
handler.js9.2 KB

handler.js

Plain text
Hub.Handler.Version = 1; // Released at https://hub.splitscreen.me/ on Sun May 21 2023 07:48:28 GMT+0000 (Coordinated Universal Time).
Hub.Handler.Id = "a54KcnrDjJLAtCHNP";
Hub.Maintainer.Name = "Perserveruz";
Hub.Maintainer.Id = "nFAYvHKj75jAFRAgt";

var answers = ["No", "Yes"];
var answers1 = ["No", "720p", "1080p"];
var answers2 = ["Default", "Low", "Normal", "High"];
Game.AddOption("Are you launching more than one instance?", "", "BigParty", answers);
Game.AddOption("Choose your preferred config settings?", "Default will use the previous or default settings", "Config", answers2);
Game.AddOption("Apply 720p or 1080p full screen resolution for low-end PC", "Only supports one instance", "resolution", answers1);
Game.FileSymlinkExclusions = ["credits.usm", "drifting.usm", "gameclear.usm", "logos.usm"];
Game.FileSymlinkCopyInstead = ["steam_api.dll"];
Game.HandlerInterval = 100;
Game.UseNucleusEnvironment = true;
Game.SymlinkExe = false;
Game.KeepSymLinkOnExit = true;
Game.SymlinkExe = false;
Game.SymlinkGame = true;
Game.SymlinkFolders = true;
Game.SupportsKeyboard = false;
Game.NeedsSteamEmulation = true;
Game.UseSteamless = true;
Game.SSEAdditionalLines = [
  "DLC|271030=Sonic and All-Stars Racing Transformed: Ryo Hazuki",
  "DLC|264600=Sonic and All-Stars Racing Transformed -Yogscast DLC",
  "DLC|229660=Sonic and All-Stars Racing Transformed: Ryo Hazuki",
  "Launcher|InjectDll=1",
  "SmartSteamEmu|SteamIdGeneration=GenerateRandom",
  "SmartSteamEmu|StorageOnAppdata=1",
  "SteamApi|SteamClient=15",
  "SteamApi|SteamGameServer=11",
  "SteamApi|SteamScreenshots=2"
];
Game.ExecutableName = "ASN_App_PcDx9_Final.exe";
Game.LauncherTitle = "Sonic & All-Stars Racing Transformed -";
Game.SteamID = "212480";
Game.GUID = "Sonic & All-Stars Racing Transformed";
Game.GameName = "Sonic & All-Stars Racing Transformed";
Game.MaxPlayers = 8;
Game.MaxPlayersOneMonitor = 8;
Game.HideTaskbar = false;
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Sonic & All-Stars Racing Transformed -";
Game.HasDynamicWindowTitle = true;
Game.HookFocus = false;
Game.FakeFocus = false;
Game.PreventWindowDeactivation = false;
Game.Hook.DInputEnabled = false;
Game.Hook.DInputEnabled = false;
Game.Hook.XInputEnabled = false;
Game.Hook.XInputReroute = false;
Game.Hook.CustomDllEnabled = false;
Game.ProtoInput.XinputHook = true;
Game.ProtoInput.UseOpenXinput = true;
Game.DocumentsConfigPath = "SART";
Game.PauseBetweenProcessGrab = 10;
Game.PauseBetweenProcessStarts = 20;
Game.ResetWindows = false;
Game.Description =
  "Purpose of this handler it to enable 8 player split-screen either on one PC or over LAN on different PCs. If you want to play 1-4 native splitscreen on one instance, assign one controller to one instance and select No under the option Are you launching more than one instance? For 5-8 players assign the first controller to the first instance and the second controller to the second instance, and select Yes under the option Are you launching more than one instance? Once in game, the second instance or the instance that opened last, proceeds to create a custom online game, make sure that everyone has pressed start on their controller prior to creating a custom match. Once the custom game has been setup, click with your mouse on the first instance and simultaneously press shift and tab, this should automatically connect the first instance to the lobby of the custom match. Have fun!";

Game.Play = function() {
  if (Context.Options["BigParty"] == "No") {
    Game.ProtoInput.MultipleProtoControllers = true;

    ProtoController1 = 1;
    ProtoController2 = 2;
    ProtoController3 = 3;
    ProtoController4 = 4;
  }
  if (Context.Options["BigParty"] == "Yes") {
    Game.ProtoInput.InjectStartup = false;
    Game.ProtoInput.InjectRuntime_RemoteLoadMethod = false;
    Game.ProtoInput.InjectRuntime_EasyHookMethod = true;
    Game.ProtoInput.InjectRuntime_EasyHookStealthMethod = false;
    Game.ProtoInput.GetRawInputDataHook = true;

    if (Context.PlayerID == 0) {
      // So the code only runs once
      Game.ProtoInput.MultipleProtoControllers = true;

      // The number of controller icons dragged onto the screens
      var numPlayers = 0;

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

        if (player.IsXInput && player.ScreenIndex !== -1) {
          numPlayers++;
        }

        // These might not be reset between runs, so let's reset them here
        // 0 means no controller, 1 means controller 1, etc
        player.ProtoController1 = 0;
        player.ProtoController2 = 0;
        player.ProtoController3 = 0;
        player.ProtoController4 = 0;
      }

      var controllerCounter = 1;
      while (controllerCounter < numPlayers * 4) {
        for (var i = 0; i < PlayerList.Count; i++) {
          var player = PlayerList[i];

          if (player.IsXInput && player.ScreenIndex !== -1) {
            if (player.ProtoController1 == 0) {
              player.ProtoController1 = controllerCounter;
              controllerCounter++;
            } else if (player.ProtoController2 == 0) {
              player.ProtoController2 = controllerCounter;
              controllerCounter++;
            } else if (player.ProtoController3 == 0) {
              player.ProtoController3 = controllerCounter;
              controllerCounter++;
            } else if (player.ProtoController4 == 0) {
              player.ProtoController4 = controllerCounter;
              controllerCounter++;
            } else {
              // This instance has all its controllers set already
            }
          }
        }
      }
    }
  }

  var filePath = Context.EnvironmentPlayer + "\\Documents";
  System.IO.Directory.CreateDirectory(filePath);

  var filePath = Context.EnvironmentPlayer + "\\Documents\\SART";
  System.IO.Directory.CreateDirectory(filePath);

  if (!System.IO.File.Exists(Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml")) {
    var savePath = Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml";
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "Normal.xml");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }

  var Config = Context.Options["Config"];
  if (Config == "Default") {
  }
  if (Config == "Low") {
    var savePath = Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml";
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "Low.xml");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }
  if (Config == "Normal") {
    var savePath = Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml";
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "Normal.xml");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }

  if (Config == "High") {
    var savePath = Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml";
    var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "High.xml");
    System.IO.File.Copy(savePkgOrigin, savePath, true);
  }

  var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Data\\movies\\drifting.usm");
  var savePkgOrigin = System.IO.Path.Combine(Game.Folder + "\\intro\\drifting.usm");
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  var savePath = (Context.SavePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\\Data\\movies\\logos.usm");
  var savePkgOrigin = System.IO.Path.Combine(Game.Folder + "\\intro\\logos.usm");
  System.IO.File.Copy(savePkgOrigin, savePath, true);

  var resolution = Context.Options["resolution"];
  if (resolution == "No") {
    Game.DontResize = false;
    Game.DontReposition = false;
    Game.DontRemoveBorders = true;

    var path = Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml";
    Context.ChangeXmlNodeInnerTextValue(path, "//width", Context.width);
    Context.ChangeXmlNodeInnerTextValue(path, "//height", Context.height);
    Context.ChangeXmlNodeInnerTextValue(path, "//fullscreen", "2");
    Context.ChangeXmlNodeInnerTextValue(path, "//vsync", "1");
  }

  var resolution = Context.Options["resolution"];
  if (resolution == "720p") {
    Game.DontResize = true;
    Game.DontReposition = true;
    Game.DontRemoveBorders = true;
    Game.PreventWindowDeactivation = false;
    var path = Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml";
    Context.ChangeXmlNodeInnerTextValue(path, "//width", 1280);
    Context.ChangeXmlNodeInnerTextValue(path, "//height", 720);
    Context.ChangeXmlNodeInnerTextValue(path, "//fullscreen", "1");
    Context.ChangeXmlNodeInnerTextValue(path, "//vsync", "1");
  }
  var resolution = Context.Options["resolution"];
  if (resolution == "1080p") {
    Game.DontResize = true;
    Game.DontReposition = true;
    Game.DontRemoveBorders = true;
    Game.PreventWindowDeactivation = false;
    var path = Context.EnvironmentPlayer + "\\Documents\\SART\\settings.xml";
    Context.ChangeXmlNodeInnerTextValue(path, "//width", 1920);
    Context.ChangeXmlNodeInnerTextValue(path, "//height", 1080);
    Context.ChangeXmlNodeInnerTextValue(path, "//fullscreen", "1");
    Context.ChangeXmlNodeInnerTextValue(path, "//vsync", "1");
  }
};