How splitscreen-me/splitscreenme-nucleus works
Project Type & Purpose
• Nucleus Co-op is a Windows desktop “full-stack” tooling suite (C++ and C#/.NET) that lets users launch multiple instances of PC games, inject custom hooks, re-route input, and coordinate instances via LAN/online emulators to create synthetic split-screen gameplay.
Key Architectural Components
a. Solution & Modules
• NucleusCoop.sln – top‐level solution
• C++ Hook Libraries
– Nucleus.Hook: low-level WinAPI hooks (mouse, keyboard, focus, cursor)
– Nucleus.SHook: secondary hook module
• Injector
– Nucleus.Inject (.NET): launches games, injects hook DLLs
• UI / Orchestration
– NucleusCoopTool (WinForms/WPF + WebView2): main user interface, asset downloader, theme engine
• Core Logic Library
– NucleusGaming (.NET): game handlers, process management, window‐tiling, input multiplexing, caching, coop logic
• Launcher
– StartGame: specialized launcher for single game instances
• Third-Party Utilities
– EasyHook, AutoHotkey.Interop, WindowScrape, x360ce, ForceBindIP, GoldbergEmu, SmartSteamEmu, Steamless, XInputPlus, DarkReader (webview plugin), etc.
b. External Services & Files
• Local file system: game files, symlinked folders, handler scripts
• LAN/Online Emulation: Goldberg, Nemirtingas emulators for multiplayer emulation
• WebView2: for downloading game handlers and assets
Relationships & Data Flow
1. User interacts with NucleusCoopTool UI →
2. UI calls into NucleusGaming backend →
3. Backend orchestrates:
• Start or symlink game processes via StartGame or direct Process.Start →
• Invoke Nucleus.Inject to inject Nucleus.Hook/Nucleus.SHook DLLs into each process →
• Hook modules intercept raw input and window messages, filter by gamepad assignment, and communicate back to backend via named pipes or hook callbacks →
• Backend applies window management (resize, remove borders, reposition) →
• For multiplayer emulation, backend launches/configures external emulators (Goldberg, SmartSteamEmu, ForceBindIP) →
• UI reflects game state, player nicknames, division overlays (using WebView2 + DarkReader extension for theming)
Architectural Patterns & Design Principles
• Modular layered architecture:
• Presentation Layer (WinForms/WPF + WebView2)
• Application Layer (NucleusGaming orchestration)
• Infrastructure Layer (Injection, Hooking, External Utils)
• Plugin/Handler pattern: game‐specific logic lives in “handlers” (scripts or DLLs) loaded at runtime
• Dependency Injection / inversion of control via interfaces in NucleusGaming (IGameHandler, IGameInfo)
• Separation of concerns: native hooking isolated in C++ DLLs, high-level coop logic in managed .NET
Essential Details to Capture
• Named pipe or hook callback channel between Hook Modules and Core Backend
• Symlink / mutex-kill techniques for launching multiple instances
• Controller isolation via custom xinput DLLs or XInputPlus
• Window management (borderless, reposition, scaling)
• Emulation layer for multiplayer connectivity