### Create Directory Example
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Demonstrates how to create a new directory within the game's instance folder. This is useful for organizing handler-specific files.
```javascript
var filePath = (Context.filePath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\handlers");
System.IO.Directory.CreateDirectory(filePath);
```
--------------------------------
### Install Project Dependencies
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/README.md
Installs the necessary project dependencies using Yarn. This is the first step before running any other commands.
```bash
yarn
```
--------------------------------
### Nucleus Co-op Installation Steps
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/installation.md
This section outlines the primary steps for installing Nucleus Co-op. It includes downloading the latest release, creating a dedicated folder, adding it to Microsoft Defender exclusions, and extracting the archive with specific instructions to avoid common issues.
```English
1. Download latest Nucleus Co-op from the [Github releases page](https://github.com/SplitScreen-Me/splitscreenme-nucleus/releases).
2. Create a folder named "NucleusCo-op" or similar in the root of your C:/ drive, then add it to the [Microsoft defender exclusions](https://learn.microsoft.com/en-us/answers/questions/3187645/how-to-add-an-exception-to-windows-defender?forum=windows-all&referrer=answers) list.
3. Copy the NucleusApp.zip to this folder then right click, properties -> unblock the zip (if needed) and extract the files there using [7-Zip](https://www.7-zip.org/) (password: `nucleus`), don't use the default Windows extraction tool as it can cause issues.
4. Alternatively you can use the Installer.exe to extract the Nucleus Co-op files to the correct folder.
5. Run NucleusCoop.exe. If you encounter a "Win32Exception the operation was canceled by the user" error when launching a handler, run every .exe file in the Nucleus Co-op folder (like StartGame.exe) and accept the UAC prompts.
```
--------------------------------
### Copy File Example
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Shows how to copy a file from the game's handler folder to the Nucleus Co-op utils folder. This is often used for configuration files.
```javascript
var savePath = Context.NucleusFolder + "\utils\FlawlessWidescreen\x64\settings.xml";
var savePkgOrigin = System.IO.Path.Combine(Game.Folder, "FlawlessWidescreen\settings.xml");
System.IO.File.Copy(savePkgOrigin, savePath, true);
```
--------------------------------
### Important Notes on False Positives and Installation
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/installation.md
This section addresses potential false positive detections by antivirus software and provides crucial advice regarding installation practices to ensure Nucleus Co-op functions correctly.
```English
Note: Some Nucleus Co-op hook dlls and Goldberg emulator can be detected as potential treats by Microsoft Defender and other anti-viruses or web browsers. This is 100% a false positive. Allow Nucleus Co-op as an exception in Microsoft Defender before extracting. Do not overwrite older Nucleus Co-op versions files with new ones; perform a clean install.
```
--------------------------------
### Full Proto Input Configuration Example
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/protoinput.md
A comprehensive example demonstrating the configuration of various Proto Input settings, including hook management, input locking behavior, and message filtering. This serves as a template for most Nucleus Coop handlers.
```js
Game.SupportsMultipleKeyboardsAndMice = true;
// 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.ProtoInput.FreezeExternalInputWhenInputNotLocked = true;
Game.LockInputToggleKey = 0x23;
Game.ProtoInput.InjectStartup = false;
Game.ProtoInput.InjectRuntime_RemoteLoadMethod = false;
Game.ProtoInput.InjectRuntime_EasyHookMethod = true;
Game.ProtoInput.InjectRuntime_EasyHookStealthMethod = false;
// This hook should always be on, regardless of input lock
Game.ProtoInput.RegisterRawInputHook = true;
// This can always be enabled, since we are going to allow/disallow raw input with the bypass function
Game.ProtoInput.GetRawInputDataHook = true;
// We will be installing/uninstalling the filters manually so there's no need to
Game.ProtoInput.MessageFilterHook = true;
Game.ProtoInput.ClipCursorHook = true;
Game.ProtoInput.FocusHooks = true;
// These aren't problematic to leave on, since the external "freeze fake input input" when real input ISN'T locked will prevent these from interfering
Game.ProtoInput.SendMouseWheelMessages = true;
Game.ProtoInput.SendMouseButtonMessages = true;
Game.ProtoInput.SendMouseMovementMessages = true;
Game.ProtoInput.SendKeyboardButtonMessages = true;
// Handled on input lock/unlock, don't enable this by default
Game.ProtoInput.EnableFocusMessageLoop = false;
//Game.ProtoInput.FocusLoopIntervalMilliseconds = 5;
//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.DrawFakeCursor = false; // This is set in the input locking
Game.ProtoInput.BlockedMessages = [ 0x0008 ]; // Blocks WM_KILLFOCUS
Game.ProtoInput.RenameHandlesHook = false;
Game.ProtoInput.RenameHandles = [];
Game.ProtoInput.RenameNamedPipes = [];
```
--------------------------------
### Start Local Development Server
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/README.md
Starts a local development server for the Docusaurus 2 project. Changes are reflected live without requiring a server restart.
```bash
yarn start
```
--------------------------------
### Nucleus Co-op Installation and Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/FAQ.md
Steps to ensure a clean installation of Nucleus Co-op and configure system settings for optimal handler performance. This includes folder placement, antivirus exclusions, and file extraction methods.
```en
1. Download the latest NucleusApp.zip.
2. Create a folder named "NucleusCo-op" in the root of your C:/ drive.
3. Add this folder to Microsoft Defender exclusions.
4. Copy NucleusApp.zip to the "NucleusCo-op" folder.
5. Right-click the zip file, go to Properties -> Unblock.
6. Extract the files using 7zip (password: nucleus). Avoid the default Windows extraction tool.
```
```en
Run every .exe file in the Nucleus Co-op folder (e.g., StartGame.exe) and accept UAC prompts if they appear to resolve "Win32Exception the operation was canceled by the user" errors.
```
```en
Exclude your Nucleus Co-op folder from Microsoft Defender if you encounter "ProtoInputHooks64.dll is missing" errors. Refer to Microsoft's documentation for instructions on adding exceptions.
```
```en
Ensure your drive uses a file format that supports symlinking, such as NTFS. exFAT format may cause issues with handlers that rely on symlinking.
```
```en
Move Nucleus Co-op outside of user or protected folders. Placing it in C:/NucleusCo-op is recommended. Ensure it is on the same drive as your game but not within the game's installation directory.
```
```en
Launch Nucleus Co-op as an administrator if the handler documentation specifies it.
```
```en
Delete Nucleus Co-op content folder, then re-add the game within Nucleus Co-op.
```
```en
If using handlers that create temporary Windows users (e.g., State of Decay 2), ensure Nucleus Co-op is in C:/NucleusCo-op. Close Nucleus using CTRL+Q, delete any remaining Nucleus-created Windows users and their folders from C:/Users/, and restart your PC if necessary before running the handler again.
```
--------------------------------
### Specify Instances for Start Hooks
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
If you only want specific instances to have starting hooks, specify them in a comma-separated string. This allows for granular control over which instances are hooked at startup.
```javascript
Game.StartHookInstances = "1,2,3,4";
```
--------------------------------
### Find and Edit Text File Example
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Demonstrates finding a specific line in a text file by its content and then editing it. This provides a more robust way to modify configuration files.
```javascript
var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\data\config\current\current_control.map";
var joystick = Context.FindLineNumberInTextFile(txtPath, "JOYSTICK ENABLED", Nucleus.SearchType.Contains);
var dict = [
joystick + "|JOYSTICK ENABLED=TRUE",
];
Context.ReplaceLinesInTextFile(txtPath, dict);
```
--------------------------------
### Set Start Arguments
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Sets the launch (start) arguments for the executable from within the Game.Play() function. This allows dynamic modification of game startup parameters.
```js
Context.StartArguments = "";
```
--------------------------------
### Bug Report Example
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/FAQ.md
An example of a comprehensive bug report for Nucleus Co-op, detailing the issue, expected behavior, potential cause, reproduction steps, severity, Nucleus options, and system specifications.
```text
Thread name: [BUG REPORT] Simon falling off horse
BUG: Simon falls off his horse.
EXPECTED: Simon should not fall off his horse, right?
CAUSE: I'm pretty sure it's because I have my computer plugged into an auto-blow.
STEPS TO REPRODUCE
1. Open up Simon Stays On His Horse: The Interactive Video Game of the Movie.
2. Choose Co-Op and join with another player.
3. Simon falls off his horse!!!
TYPE: Severe! The gameplay can't continue if Simon isn't on his horse! (Alternatively, Minor if the gameplay can continue but it's just annoying)
NUCLEUS OPTIONS: I played with 2 players using the vertical splitscreen (left and right) on one tv and 2 famicom controllers. I'm using the latest version
SYSTEM: I'm on Windows 3.1 with 4MB of RAM, a 2KHz CPU and no graphics card, playing on a projector. She's a monster.
I'd really like this to get fixed please thanks magic man! -Beanboy
```
--------------------------------
### X360ce Integration for Controller Setup
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Enables the use of X360ce for controller configuration before launching games. NucleusCoop will automatically open X360ce to allow users to set up their controllers. This method should not be used with custom DLLs.
```INI
Game.UseX360ce = true; // Before launching any games, NucleusCoop will open x360ce and let the user set up their controllers before continuing close x360ce to continue Don't use with custom dlls
```
--------------------------------
### Customizing Split-Screen Layout
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/FAQ.md
Guides users on how to create and apply custom split-screen layouts within Nucleus Co-op.
```User Guide
1. Go to Nucleus Co-op settings > Custom Layout tab.
2. Customize your layout and save it.
3. Select a game.
4. In the split-screen layout, click the top-left corner icon until 'custom' is displayed.
5. Drag input devices to the desired positions.
```
--------------------------------
### Execute Game Play Before Setup
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Executes the `Game.Play` function with context before the majority of the game setup is completed. This allows for early intervention in the game's lifecycle.
```js
Game.GamePlayBeforeGameSetup = false;
```
--------------------------------
### Prompt After First Instance Setup
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Displays a prompt that requires user confirmation (clicking OK) after the first game instance has been set up. This allows for manual control over subsequent instance launches.
```js
Game.PromptAfterFirstInstance = false;
```
--------------------------------
### Advanced Game Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Configures advanced game settings like binary folder location, Steam integration, and launcher executables.
```APIDOC
Game.BinariesFolder = "Bin";
- In which folder the game exe is located? Relative path to where Nucleus should start the game's working folder to.
Game.SteamID = "1234";
- Here the SteamID of the game. You can find it on https://steamdb.info/ . Add only if the game is available on Steam.
Game.LauncherTitle = "";
- The name of the launcher's window title. Some games need to go through a launcher to open. This is needed or else the application will lose the game's window.
Game.LauncherExe = "gamelauncher.exe";
- If the game needs to go through a launcher before opening. Nucleus will use this exe to start the game and it will follow Game.ExecutableName process for resizing and positioning. You can also write it like this: Game.LauncherExe = "gamelauncher.exe|NucleusDefined"; for let the User select the launcher exe the very first time (useful if is not located in the game folder).
Game.LauncherExeIgnoreFileCheck = true;
- Do not check if Launcher Exe exists in game folder | you will need to provide a relative filepath from game root folder
```
--------------------------------
### Input Locking at Start
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Automatically locks input for all instances once they are set up, equivalent to pressing the 'End' key. Game.LockInputAtStart is convenient for final setup but should typically be disabled during testing phases to allow for adjustments.
```csharp
Game.LockInputAtStart = true;
```
--------------------------------
### ProtoInput.cs API Signature
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/protoinput.md
Provides the C# signature for the `InstallHook` method within the ProtoInput API, which is used to install specific input hooks for a given instance handle.
```csharp
public void InstallHook(uint instanceHandle, ProtoHookIDs hookID)
```
--------------------------------
### Edit Text File Example
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Illustrates how to modify specific lines within a text file. This is commonly used for game configuration or settings files.
```javascript
var txtPath = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\data\config\current\current_control.map";
var dict = ["24 JOYSTICK ENABLED=TRUE", "70 KEYBOARD ENABLED=FALSE" ];
Context.ReplaceLinesInTextFile(txtPath, dict);
```
--------------------------------
### Game Starting Arguments Inclusion
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Determines whether the game's starting arguments should be included within the same quotation marks as the game path.
```js
Game.CMDStartArgsInside = false;
```
--------------------------------
### Nucleus Co-op Handler Settings
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Configuration options for Nucleus Co-op handlers, controlling update intervals and startup delays between game instances.
```APIDOC
Game.HandlerInterval = 100;
- Description: The interval in milliseconds the Handler should be updated at. Set it to 0 to disable updating (will lose all functionality that depends on ticks).
Game.PauseBetweenStarts = 20;
- Description: Pause between game instances starts in milliseconds. Higher time could help low spec PCs.
```
--------------------------------
### Nucleus Co-op Folder Placement Guidelines
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/installation.md
Provides essential guidelines for placing the Nucleus Co-op folder to prevent operational issues. It covers what to avoid and the recommended location for optimal compatibility.
```English
* DO NOT place Nucleus Co-op inside a folder containing files for a game you wish to play.
* Avoid placing it inside a folder that has security settings applied to it, such as Program Files, Program Files (x86).
* Some handlers require the Nucleus Co-op folder to be located in the same drive as the game files.
* If you are still unsure where to place the folder, the root of your main drive (C:/NucleusCo-op) is the best option.
```
--------------------------------
### Launcher Executable Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Specifies the executable for a game launcher. Nucleus will start this launcher, but will continue to use `Game.ExecutableName` for process tracking.
```js
Game.LauncherExe = "Launcher.exe";
```
--------------------------------
### Downloading Earlier Versions of Nucleus Co-op
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/installation.md
Information on how to access and download older versions of Nucleus Co-op from alternative GitHub repositories. It also notes that these older versions may have limited game support and are no longer officially supported.
```English
You can download earlier versions of Nucleus Co-op from [Lucas's](https://github.com/lucasassislar/nucleuscoop) or [Zerofox's](https://github.com/ZeroFox5866/nucleuscoop/releases) GitHub repos. Note that these versions will not support as many games and that we no longer provide support for earlier versions.
```
--------------------------------
### Create Text File with Specific Lines
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Illustrates how to create a new text file and populate it with predefined lines of text. This is commonly used for configuration files or scripts.
```csharp
var autoExec = Context.GetFolder(Nucleus.Folder.InstancedGameFolder) + "\doi\cfg\autoexec.cfg";
var lines = [
"engine_no_focus_sleep 0",
'm_rawinput "1"',
"bind F8 pause",
'joystick_force_disabled_set "1"',
"exec undo360controller.cfg",
"host_writeconfig",
'echo "$$$$$$ autoexec.cfg loaded = controller disabled $$$$$$"'
];
Context.WriteTextFile(autoExec, lines);
```
--------------------------------
### Path Variables - Installation and Game Folders
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Provides paths to the source game root folder, Nucleus Co-op root folder, handlers root folder, and specific game handler folders.
```js
Context.RootInstallFolder
Context.NucleusFolder
Context.ScriptFolder
Game.Folder
```
--------------------------------
### Enable Game Windows at End
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Enables each game window at the end of the setup process. This is useful if windows became disabled during setup or for games that require this function to display correctly.
```javascript
Game.EnableWindows = false;
```
--------------------------------
### Enable Game Symlinking
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Controls whether game files should be symbolically linked to a temporary directory. If false, games launch directly from their installation directory.
```js
Game.SymlinkGame = true;
```
--------------------------------
### Proto Input API Usage
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/protoinput.md
Demonstrates how to call Proto Input API functions like `InstallHook` from a Nucleus handler. It shows how to iterate through players and apply hooks, such as getting cursor position.
```js
ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetCursorPosHookID);
```
```js
for (var i = 0; i < PlayerList.Count; i++) {
var player = PlayerList[i];
ProtoInput.InstallHook(player.ProtoInputInstanceHandle, ProtoInput.Values.GetCursorPosHookID);
}
```
--------------------------------
### Add Launch Options to Game Executable
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Shows how to set custom launch arguments for a game executable using Nucleus Co-op. This is useful for applying specific game configurations or launch parameters.
```csharp
var fps = "144"; // Example FPS value
var Args = (Context.Args = " -windowed -noborder -AlwaysFocus -insecure -novid +sv_lan 1 +sv_pausable 1 +fps_max " + fps);
Context.StartArguments = Args;
```
--------------------------------
### Nucleus Co-op Handler Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Essential configuration lines for Nucleus Co-op handlers to define game properties, executable paths, and player limits.
```javascript
Game.KeepSymLinkOnExit = true;
Game.HookInit = true;
```
--------------------------------
### Process Changes at End
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Performs resizing, repositioning, and post-launch hooking of all game instances at the very end of the setup. Note that this option may not work with all other configurations.
```javascript
Game.ProcessChangesAtEnd = false;
```
--------------------------------
### Multiple Input Device Support Settings
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Configuration options for supporting multiple mice and keyboards. These settings are deprecated and replaced by the Proto Input guide.
```js
Game.SupportsMultipleKeyboardsAndMice = true;
Game.SendNormalMouseInput = true;
Game.SendNormalKeyboardInput = true;
Game.ForwardRawKeyboardInput = false;
Game.ForwardRawMouseInput = false;
Game.SendScrollWheel = false;
Game.DrawFakeMouseCursor = true;
Game.DrawFakeMouseForControllers = false;
Game.HookFilterRawInput = false;
Game.HookFilterMouseMessages = false;
Game.HookGetCursorPos = true;
Game.HookSetCursorPos = true;
Game.HookUseLegacyInput = false;
Game.HookDontUpdateLegacyInMouseMsg = false;
Game.HookGetKeyState = false;
Game.HookGetAsyncKeyState = true;
Game.HookGetKeyboardState = false;
Game.HookMouseVisibility = false;
Game.LockInputAtStart = true;
Game.LockInputToggleKey = 0x23; //See https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
Game.HookReRegisterRawInput = false; //Re-register raw input from directly within game process | Recommended to disable forwarding input while using this
Game.HookReRegisterRawInputMouse = true;
Game.HookReRegisterRawInputKeyboard = true;
Game.UpdateFakeMouseWithInternalInput = false;
```
--------------------------------
### Gamepad Input Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Options for managing DirectInput (DInput) and XInput devices, including enabling/disabling hooks, rerouting XInput devices, and blocking DInput.
```plaintext
Game.Hook.DInputEnabled = false;
Game.Hook.DInputForceDisable = true;
Game.Hook.XInputEnabled = true;
Game.Hook.XInputReroute = false;
Game.UseDInputBlocker = true;
```
--------------------------------
### Game Information Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Defines core game properties such as the executable name, internal folder name, display name in the UI, and maximum player counts.
```APIDOC
Game.ExecutableName = "game.exe";
- The name of the game executable with the extension. This will be used by Nucleus to add games, to run the game and as process to follow for positioning and resizing.
Game.GUID = "Game Name";
- The name of the folder that will be created inside the Nucleus content folder (just use letters not symbols). In this folder Nucleus will store the symlinked or copied game files for each instance of the game.
Game.GameName = "Game Name on Nucleu UI";
- Title of the game that will be shown on Nucleus.
Game.MaxPlayersOneMonitor = 4;
- This is just an info. It will not limit the players' numbers.
Game.MaxPlayers = 16;
- This is just the max players info that shows under the handler name in Nucleus UI. Usually we write the max number of players the game supports. (PC, should support 16 max connected input devices).
```
--------------------------------
### Keyboard Input Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Settings to enable and configure keyboard input for game instances. This includes whether the keyboard is supported and which player it should be assigned to.
```plaintext
Game.SupportsKeyboard = true;
Game.KeyboardPlayerFirst = false;
```
--------------------------------
### Context and Launch Delay
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Sets the number of seconds to wait after running additional files before proceeding with player setup. This can be useful for synchronizing external processes.
```js
Game.PauseBetweenContextAndLaunch = 0;
```
--------------------------------
### Backup a File with Nucleus Co-op
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Demonstrates how to create a backup of a specified file using Nucleus Co-op. The backup is automatically restored when Nucleus Co-op closes, making it safe for modifying original game files.
```csharp
Context.BackupFile(Context.NucleusFolder + "\utils\FlawlessWidescreen\x64\settings.xml", true);
```
--------------------------------
### Get System Architecture
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the system architecture (e.g., 'x64', 'x86'). This information can be used for compatibility checks or platform-specific logic.
```js
Context.Arch
```
--------------------------------
### Get Raw Gamepad GUID
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the raw GUID of the gamepad. This identifier is crucial for correctly mapping controllers to players.
```js
Context.GamepadGuid
```
--------------------------------
### Get x360ce Gamepad GUID
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the x360ce formatted gamepad GUID. This format is commonly used by the x360ce emulator for controller configuration.
```js
Context.x360ceGamepadGuid
```
--------------------------------
### Installing DirectX End-User Runtime on Windows 11
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/Xboxone.md
For the driver reconfiguration method to work correctly on Windows 11, it is recommended to install the DirectX End-User Runtime. This ensures that all necessary DirectX components are present for the system to properly handle DirectInput devices.
```Windows
If you are on Windows 11 install the [DirectX End-User Runtime](https://www.microsoft.com/en-us/download/details.aspx?id=35) for the method in this guide to work correctly.
```
--------------------------------
### XInputPlus Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Sets up XInputPlus to manage XInput DLLs for games. It allows specifying multiple DLLs, including DInput DLLs for games without native XInput support. XinputPlus supports a maximum of 4 controllers. The old DLL version can be used if newer versions cause crashes.
```INI
Game.XInputPlusDll = ["xinput1_3.dll"]; // You can specify different xinput dlls. Add dinput dlls for use XinputPlus DInput mode and let XInput gamepads work in game that doesn't have XInput support. Example ["xinput1_3.dll", "dinput.dll", "dinput8.dll"];
Game.XInputPlusOldDll = true; // It seems that new xinputplus DINPUT dlls make games crash. When using Game.XInputPlusDll, you can specify to use the previous version instead of the latest (needed for some games)
```
--------------------------------
### Get Gamepad ID
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the Gamepad ID, which is useful for ensuring controllers are assigned to the correct players. This helps in managing multi-controller setups.
```js
Context.GamepadId
```
--------------------------------
### Renaming Game Executable for Multiple Instances
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Explains how to configure Nucleus Co-op to rename the game's executable for each instance, facilitating the running of multiple copies of the same game.
```APIDOC
Nucleus Co-op Configuration:
Setting: Game.ChangeExe = true
Description: Enables the renaming of the game's executable file for each instance launched by Nucleus Co-op. This is a common method to bypass game instance checks that rely on the executable name.
```
--------------------------------
### Closing Game Mutexes with Process Explorer
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Demonstrates how to identify and close game mutexes using Process Explorer to allow multiple game instances to run. This involves launching the game, viewing its handles, and closing relevant mutexes, events, or semaphores.
```APIDOC
Process Explorer:
Usage: Run with admin rights.
Steps:
1. Start the game.
2. Select the game process in the list.
3. Press Ctrl+H to view handles.
4. Identify mutexes, events, or semaphores (often containing game or engine names).
5. Right-click and select 'Close Handle' for suspected handles.
6. Test by attempting to run a second instance of the game.
Note: Some games may require multiple mutexes to be closed. Launchers like Goldberg may hide game instances from the launcher.
```
--------------------------------
### Nucleus Co-op Environment Variables
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Configuration options for Nucleus Co-op to manage game document paths and user profile settings. These settings allow games to use separate directories for documents and configurations per player, enhancing multi-player functionality.
```APIDOC
Game.UseNucleusEnvironment = true;
- Description: Use custom environment variables for games that use them, replaces some common paths (e.g. AppData) with C:\\Users\\\\NucleusCoop.
Game.UserProfileConfigPath = "AppData\\Local\\Game\\Config";
- Description: Relative path from user profile (e.g. C:\\Users\\ZeroFox) to game's config path. Used to provide some extra functionality (open/delete/copy over to Nucleus Environment). In context = Context.UserProfileConfigPath.
Game.UserProfileSavePath = "AppData\\Local\\Game\\Saves";
- Description: Relative path from user profile (e.g. C:\\Users\\ZeroFox) to game's save path. Used to provide some extra functionality (open/delete/copy over to Nucleus Environment). In context = Context.UserProfileSavePath.
Game.DocumentsConfigPath = "Path\\Here";
- Description: Relative path from user document folder (e.g. C:\\Users\\ZeroFox\\Documents) to game's config path. Used to provide some extra functionality (open/delete/copy over to Nucleus Environment). Use this when the game uses Documents to store game files. In context = Context.DocumentsConfigPath.
Game.DocumentsSavePath = "Path\\Here";
- Description: Relative path from user document folder (e.g. C:\\Users\\ZeroFox\\Documents) to game's save path. Used to provide some extra functionality (open/delete/copy over to Nucleus Environment). Use this when the game uses Documents to store game files. In context = Context.DocumentsSavePath.
```
--------------------------------
### Raw Input Forwarding
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Options for forwarding raw input, primarily for mouse and keyboard. Game.ForwardRawMouseInput and Game.ForwardRawKeyboardInput are generally not recommended due to high CPU usage and potential input loss, with re-registering raw input being a more efficient alternative.
```csharp
Game.ForwardRawMouseInput = true;
Game.ForwardRawKeyboardInput = true;
```
--------------------------------
### Path Manipulation in C#
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Illustrates how to navigate directory structures using `System.IO.Path.Combine` to go up one or two folders, and `System.IO.Directory.GetParent` to get the parent directory of a specified path in C#.
```csharp
var OneFolderUP = System.IO.Path.Combine(Path goes here, ".."); // The variable OneFolderUP will return a folder UP of the specified path. Example: var OneFolderUP = System.IO.Path.Combine(Game.Folder, "..")
var TwoFolderUP = System.IO.Path.Combine(Path goes here, "..", ".."); // The variable TwoFolderUP will return a folder UP of the specified path. Example: var OneFolderUP = System.IO.Path.Combine(Game.Folder, "..", "..")
var OneFolderUP = System.IO.Directory.GetParent("SourceDirectory"); // The variable OneFolderUP will return a folder UP of the specified path ("SourceDirectory").
```
--------------------------------
### Player Nickname and Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Provides access to the player's nickname and is used to edit NemirtingasEpicEmu.json or set user Epic language parameters in start arguments.
```js
Context.Nickname
```
--------------------------------
### Nucleus Co-op YouTube Introduction
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/FAQ.md
An embedded YouTube video introducing Nucleus Co-op, a tool for split-screen gaming.
```html
```
--------------------------------
### Set Steamless Command Line Arguments
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Sets the command line arguments for Steamless when `Game.UseSteamless` is set to `true`. The command line version of Steamless allows for different launch arguments to be used. Example arguments include `--quiet` and `--keepbind`.
```JavaScript
Game.SteamlessArgs = "--quiet --keepbind";
```
--------------------------------
### Game Focus Management
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Configure how game instances maintain focus, including faking window events and managing dynamic window titles. These settings are crucial for ensuring all game instances receive input correctly.
```plaintext
Game.Hook.ForceFocus = true;
Game.Hook.ForceFocusWindowName = "Game window title";
Game.HasDynamicWindowTitle = true;
Game.HookFocus = true;
Game.FakeFocus = true;
Game.PreventWindowDeactivation = true;
Game.SetForegroundWindowElsewhere = true;
Game.HookInit = true;
```
--------------------------------
### Window Style Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Allows customization of window styles using specific values. References to Microsoft's documentation provide details on available window style flags. `Game.WindowStyleValues` and `Game.ExtWindowStyleValues` set initial styles, while `Game.WindowStyleEndChanges` and `Game.ExtWindowStyleEndChanges` apply styles after initial setup.
```js
Game.WindowStyleValues = [ "~0xC00000", "0x8000000" ];
Game.ExtWindowStyleValues = [ "~0x200", "0x200000" ];
Game.WindowStyleEndChanges = [ "~0xC00000", "0x8000000" ];
Game.ExtWindowStyleEndChanges = [ "~0xC00000", "0x8000000" ];
```
--------------------------------
### XInput Custom DLL Configuration
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Configures the use of a custom XInput DLL for gamepad control. It specifies which DLLs the custom implementation will use, and notes that DInput DLLs are not supported in this mode. CustomDllEnabled is enabled by default.
```INI
Game.Hook.CustomDllEnabled = false;
Game.Hook.XInputNames = [ "xinput1_3.dll"]; //This line specify which DLLS CustomDll will use. DInput dlls are not supported.
```
--------------------------------
### Handler GUID
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the GUID associated with the current handler. This identifier is likely used for internal tracking or configuration.
```js
Context.HandlerGUID
```
--------------------------------
### XInput Hooking for Controller Redirection
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/create-handlers.md
Enables hooking XInput for games, redirecting controller input to specific controller indices. This method is similar to Universal Split Screen's approach and does not create any files. It can also translate XInput to DInput when combined with XInputReroute.
```INI
Game.InjectHookXinput = true; // This method is the same used by Universal Split Screen (Hook Xinput for gamepads). It will make the instance redirect the controllers' input to a specific controller index. This restriction method doesn't create any files.
Game.InjectDinputToXinputTranslation = true; // If you want to translate XInput to Dinput when using this restriction method + Game.Hook.XInputReroute = true;
```
--------------------------------
### ProtoInputHost - Configuration Options
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/protoinput.md
Details the various configuration options available within the ProtoInputHost GUI for managing game processes, input devices, and injection settings. Covers process selection, injection methods, hook settings, and input locking behavior.
```APIDOC
ProtoInputHost GUI Settings:
1. Instances List: Displays currently configured game instances.
2. Startup Injection (Browse Game Executable): Selects a game executable for EasyHook startup injection.
3. Runtime Injection (Focus Game Window): Selects a running game process by focusing its window.
4. Runtime Injection (Search Processes): Searches and selects from all currently running processes.
5. Input Devices Panel: Assigns specific input devices (keyboards, mice) to selected instances.
6. Injection Method Selection: Chooses the injection technique (EasyHook Inject, Remote Load Library, Stealth Inject, EasyHook Create and Inject).
7. Hooks Settings: Configures specific input hooks (e.g., multiple keyboards, window focus) to be sent to the injected DLL.
8. Start Injection / Lock Input:
- Starts the injection process for configured instances.
- 'Lock input with End key': Enables/disables locking of physical input devices when the End key is pressed.
- 'Lock input also suspends explorer.exe': Suspends explorer.exe threads when input is locked to prevent accidental system actions.
- 'Freeze game input when input isn't locked': Prevents simultaneous control of real and fake cursors.
9. Profile Management (Save/Load): Saves current settings to a profile file (e.g., profile.json) or loads a previously saved profile.
```
--------------------------------
### Command Line Options
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Specifies command-line arguments to be used when launching the game via `Game.CMDLaunch`. Each element in the array corresponds to the options for a different instance.
```js
Game.CMDOptions = ["ops1","ops2"];
```
--------------------------------
### ProtoInputLoader API - Injection Methods
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/protoinput.md
Demonstrates the different methods available in ProtoInputLoader for injecting hooks into game processes. Includes EasyHook startup injection, runtime injection, and stealth injection, along with considerations for games that may block standard injection techniques.
```APIDOC
ProtoInputLoader:
Inject(process_id: int, injection_method: str, hooks_settings: dict)
Injects hooks into a specified running process.
Parameters:
process_id: The ID of the target process.
injection_method: The method to use for injection (e.g., 'EasyHook', 'RemoteLoadLibrary', 'StealthInject').
hooks_settings: A dictionary containing the hook configurations to be applied.
Returns: True if injection was successful, False otherwise.
CreateAndInject(executable_path: str, injection_method: str, hooks_settings: dict)
Creates a new game process and injects hooks into it at startup.
Parameters:
executable_path: The path to the game's executable file.
injection_method: The method to use for injection (e.g., 'EasyHookCreateAndInject').
hooks_settings: A dictionary containing the hook configurations to be applied.
Returns: The process ID of the created game process if successful, None otherwise.
SetHooks(process_id: int, hooks_settings: dict)
Applies hook settings to an already injected process.
Parameters:
process_id: The ID of the target process.
hooks_settings: A dictionary containing the hook configurations to be applied.
Returns: True if hooks were set successfully, False otherwise.
ClosePipe(process_id: int)
Closes the communication pipe associated with a process.
Parameters:
process_id: The ID of the target process.
Notes:
- EasyHook Inject is generally recommended for runtime injection.
- Remote Load Library and Stealth Inject are alternatives for games that resist standard injection.
- Create and Inject is for games requiring early hook initialization.
```
--------------------------------
### Troubleshooting Nucleus Co-op Launch Issues
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/FAQ.md
Provides steps to resolve issues where Nucleus Co-op fails to launch or crashes. This includes updating system dependencies like .NET Framework and Visual C++ Redistributable, configuring antivirus exceptions, and ensuring proper file extraction.
```Troubleshooting
1. Update Microsoft .NET Framework.
2. Install/reinstall Visual C++ Redistributable (2010-2017, 2015-2019, x86 and x64).
3. Add Nucleus Co-op folder as an exception in antivirus/Microsoft Defender.
4. Extract Nucleus Co-op using 7-Zip.
5. Install DirectX End-User Runtime (for Windows 11).
6. Restart your PC.
```
--------------------------------
### Ignore Delete Files Prompt
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Suppresses the warning message that appears when files are deleted during the game setup process.
```javascript
Game.IgnoreDeleteFilesPrompt = false;
```
--------------------------------
### Build Static Website
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/README.md
Generates the static content for the website into the 'build' directory. This output can be hosted on any static hosting service.
```bash
yarn build
```
--------------------------------
### Get Monitor Height
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the height of the player's monitor. This is useful for UI scaling and layout adjustments.
```js
Context.MonitorHeight
```
--------------------------------
### Command Line Batch Before Launch
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Defines command lines to be executed in the same command prompt session *before* the game launches. This is used in conjunction with `Game.CMDLaunch` or `UseForceBindIP`. The syntax is `instance#|command` for instance-specific commands, or just `command` for all instances.
```js
Game.CMDBatchBefore = [ "0|ops1", "1|ops2" ];
```
--------------------------------
### Get Monitor Width
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the width of the player's monitor. This is useful for UI scaling and layout adjustments.
```js
Context.MonitorWidth
```
--------------------------------
### Get Player Y Position
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the Y-coordinate of the player's position. This is likely related to window or screen positioning.
```js
Context.PosY
```
--------------------------------
### Improving In-Game FPS and Performance
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/FAQ.md
Provides tips for low or uneven in-game frames per second (FPS) across multiple instances. Suggests reducing graphics settings, limiting FPS, and unfocusing game windows to equalize priority. Mentions keyboard shortcuts for unfocusing and the potential benefit of forcing Vsync.
```APIDOC
Nucleus Co-op FPS and Performance Optimization:
Issue:
Low or inconsistent in-game frames per second (FPS) across multiple instances.
Cause:
Running multiple game instances can be demanding on PC resources.
Solutions:
1. Reduce Graphics Settings:
- Lower settings like textures and shadows within the game.
2. Limit FPS:
- Use in-game or graphics driver settings to cap the FPS.
3. Equalize Instance Priority:
- Unfocus all game windows to give them equal processing priority.
- Methods to unfocus:
- Alt-Tab to a different window (e.g., Nucleus Co-op app).
- Use Nucleus Co-op shortcut Ctrl+H to unfocus all instances.
- Press Windows key + b.
4. Force Vsync:
- Enabling Vsync through your graphics driver panel may improve performance in some cases.
```
--------------------------------
### Get Local IP Address
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Retrieves the local IP address of the computer. This is useful for network-related configurations and debugging.
```js
Context.LocalIP
```
--------------------------------
### Force Window Title
Source: https://github.com/splitscreen-me/splitscreenme-www/blob/master/docs/handler-api.mdx
Forces the game window title to be a specific name defined in Game.Hook.ForceFocusWindowName. This triggers once after all instances have started.
```javascript
Game.ForceWindowTitle = false;
```