How the core loads ​

Play starts Overcooked 2 with Unity Doorstop preloaded. Doorstop runs Swofty.Overcooked2.Core.dll inside the game's Mono runtime before the game's own code. Swofty Core then reads the session file the launcher wrote, loads Swofty.Overcooked2.dll and every addon that is on, and patches the game with Harmony.

text
launcher ── writes ──▶ sessions/<stamp>/session.json
    │
    └─ starts Overcooked2.x86_64 with LD_PRELOAD=libdoorstop.so
       (Overcooked2.exe with winhttp.dll and --doorstop-* arguments)
           │
           └─ Doorstop ─▶ Swofty.Overcooked2.Core.dll   Doorstop.Entrypoint.Start
                              ├─ reads session.json
                              ├─ loads Swofty.Overcooked2.dll and 0Harmony.dll
                              ├─ loads each addon's assemblies, calls Load on each IAddon
                              ├─ adds the MODS tab to the main menu: Addons and every MainMenu.AddButton
                              └─ writes core.log and status.json

The files ​

The launcher ships Swofty Core in cores/overcooked_2/ in its install folder, next to bin/:

text
cores/overcooked_2/
├── core.json                          {"core": "0.1.0", "std": "0.1.0", "harmony": "…", "doorstop": "…"}
├── core/
│   ├── Swofty.Overcooked2.Core.dll    the Doorstop target
│   ├── Swofty.Overcooked2.dll         the standard library
│   └── 0Harmony.dll
└── doorstop/
    ├── linux_x64/libdoorstop.so
    ├── windows_x86/winhttp.dll        for the Windows build Steam ships, which is 32-bit
    └── windows_x64/winhttp.dll

SWOFTY_OC2_CORE_DIR points the launcher at another copy of that folder, such as games/overcooked_2/dist/ in a source checkout after games/overcooked_2/build.sh.

The launch ​

Play starts a copy Steam installed through Steam, so Steam's overlay works in the game: Steam gives its overlay only to a game it starts. Any other copy, and play --direct, starts the game's exe itself, without Steam.

Through Steam on Windows ​

The launcher copies winhttp.dll (windows_x86, or windows_x64 for a 64-bit exe) into the game folder and asks Steam to start the game with Doorstop's settings and the session file as its arguments:

text
steam.exe -applaunch 728880 -logFile <session>\player.log -swofty-session <session>\session.json --doorstop-enabled true --doorstop-target-assembly <core>\Swofty.Overcooked2.Core.dll

A path with a space goes by its short name, such as C:\PROGRA~1\…, so it reaches the game whole however Steam quotes it. On a drive that keeps no short names, a path with a space can't go through Steam, so Play starts the game without Steam and says why in the launcher's log. Swofty Core reads the session file from SWOFTY_OC2_SESSION, else from -swofty-session. The launcher then follows the Overcooked2.exe whose command line names the session, for Stop, the play bar and taking the dll back out.

Through Steam on Linux ​

Steam can't give one launch an environment of its own, so the game's Steam launch option runs the launcher's CLI around the game (see the Steam launch option):

text
/bin/sh -c '<script>' "<install folder>/bin/swofty" --game overcooked_2 run -- %command%

The script runs swofty with the rest when it is there, else Steam's command after the first --, so a moved or deleted install still lets Steam's Play start the game, without the core. A launcher with its own data folder adds --data-dir "<folder>" before --game. Play writes the session, leaves it in $DATA/games/overcooked_2/steam-launch.json and runs steam -applaunch 728880. When Steam runs the launch option, the CLI:

  1. takes that launch, when Play left one in the last 90 seconds, as long as Play waits for the game, or writes a session of its own for Steam's own Play;
  2. adds the core's settings to the launch Steam gave: DOORSTOP_ENABLED, DOORSTOP_TARGET_ASSEMBLY and SWOFTY_OC2_SESSION, -logFile and -swofty-session after the game's arguments, and a /bin/sh step just before the game that puts Doorstop first in its LD_PRELOAD, ahead of Steam's own entries such as the overlay. Only the game loads Doorstop, not Steam's programs in between. Under Proton it puts in winhttp.dll and adds winhttp=n,b to WINEDLLOVERRIDES instead;
  3. runs Steam's command in its own place, so Steam follows the game as it would without the launcher.

What it did is in steam-launch.log, in the session folder and in $DATA/games/overcooked_2/. When it can't put the core in, such as when Swofty Core is missing, the game still starts, without addons, and the launcher's Play says why. The launcher follows the game whose SWOFTY_OC2_SESSION names the session.

Without Steam ​

On the native Linux build, the launcher starts Overcooked2.x86_64 -logFile <session>/player.log -swofty-session <session>/session.json from the game folder with:

sh
LD_PRELOAD=$CORE/doorstop/linux_x64/libdoorstop.so      # before any LD_PRELOAD you already have
DOORSTOP_ENABLED=1
DOORSTOP_TARGET_ASSEMBLY=$CORE/core/Swofty.Overcooked2.Core.dll
SteamAppId=728880
SteamGameId=728880
SWOFTY_OC2_SESSION=$DATA/games/overcooked_2/sessions/<stamp>/session.json

Steam must be running. Nothing in the game folder changes.

On the Windows build, the launcher copies winhttp.dll into the game folder and starts Overcooked2.exe with Doorstop's settings on its command line, plus the same SteamAppId, SteamGameId and SWOFTY_OC2_SESSION:

text
Overcooked2.exe -logFile <session>\player.log -swofty-session <session>\session.json --doorstop-enabled true --doorstop-target-assembly <core>\Swofty.Overcooked2.Core.dll

On Linux, a game folder with only Overcooked2.exe (the Windows build) plays under Proton, inside the Steam Linux Runtime that Proton needs, as Steam would start it:

sh
SteamLinuxRuntime_sniper/_v2-entry-point --verb=waitforexitandrun -- proton waitforexitandrun Overcooked2.exe -logFile 'Z:\…\player.log' -swofty-session 'Z:\…\session.json' --doorstop-enabled true --doorstop-target-assembly 'Z:\…\Swofty.Overcooked2.Core.dll'
WINEDLLOVERRIDES="winhttp=n,b"     # added to your own overrides; one you set for winhttp wins
STEAM_COMPAT_DATA_PATH=<library>/steamapps/compatdata/728880
SWOFTY_OC2_SESSION='Z:\…\session.json'

The Proton is the one Steam is set to run Overcooked 2 with, else Steam's default, else the newest Proton installed. SWOFTY_OC2_PROTON names another Proton folder. The runtime is the SteamLinuxRuntime_sniper beside that Proton or in any Steam library. Without one, the launcher runs Proton alone, and the game can stop on its intro video. A copy outside a Steam library gets its own prefix in $DATA/games/overcooked_2/proton. Every path the game reads, in the session file and in inbox commands too, is written through Wine's Z: drive.

Doorstop's dll ​

No doorstop_config.ini is written, so Doorstop stays off without the launcher's arguments. A winhttp.dll left in the game folder does nothing when Steam starts the game on its own. The launcher takes the dll out when the game exits. If the launcher or the game died, it takes it out at its next start once the game isn't running. Before placing the dll, it writes placed.json in the session folder. A dll that no longer holds what the launcher put there is left alone.

A winhttp.dll the launcher didn't put in the game folder, such as another mod loader's, stops Play with … is already in the game folder; take it out (another mod loader?) and press Play again. A doorstop_config.ini of your own stays as it is; the arguments win over it for the launcher's launch only.

The session file ​

SWOFTY_OC2_SESSION, or the game's -swofty-session argument, names the session file. The addons are the ones that are on, in load order:

json
{
  "schema": 1,
  "launcher": "1.10.63",
  "game_dir": "/home/you/.local/share/Steam/steamapps/common/Overcooked! 2",
  "data_dir": "/home/you/.local/share/swofty/games/overcooked_2",
  "log": "/home/you/.local/share/swofty/games/overcooked_2/sessions/20261128-131500/core.log",
  "status": "/home/you/.local/share/swofty/games/overcooked_2/sessions/20261128-131500/status.json",
  "addons": [
    {
      "id": "swofty.hello-kitchen",
      "name": "Hello Kitchen",
      "version": "0.1.0",
      "dir": "/home/you/.local/share/swofty/games/overcooked_2/addons/swofty.hello-kitchen",
      "assemblies": ["HelloKitchen.dll"]
    }
  ]
}

Swofty Core loads the addons when the game loads its first scene, Boot, on Unity's main thread. For each addon in order, it loads its assemblies in order, creates every public non-abstract class that implements IAddon, and calls Load. An exception in an addon fails that addon only; the rest load.

Without a session file, or with one it cannot read, Swofty Core writes to Unity's Player.log, loads no addons, and still adds the MODS tab with Addons.

Logs ​

Each session has its own folder, $DATA/games/overcooked_2/sessions/<stamp>/, where <stamp> is the start time in UTC, such as 20261128-131500. Swofty Core appends to core.log in it, one line per message, tagged core or with the addon id:

text
00:15:01 [core] Swofty Core 0.1.0 for Overcooked 2 (std 0.1.0, Harmony 2.3.6, Doorstop 4.5.0)
00:15:01 [core] session /home/you/.local/share/swofty/games/overcooked_2/sessions/20261128-131500/session.json from launcher 1.10.63, 1 addon(s)
00:15:02 [core] Overcooked 2 build 66.678012
00:15:03 [core] first scene Boot; loading addons
00:15:03 [swofty.hello-kitchen] Hello Kitchen 0.1.0 loaded on Overcooked 2 build 66.678012 with Swofty Core 0.1.0
00:15:03 [core] loaded swofty.hello-kitchen 0.1.0
00:15:03 [core] addons: 1 loaded, 0 failed
00:15:03 [swofty.hello-kitchen] scene loaded: Boot
00:15:06 [core] scene Ident loaded (Single)
00:15:06 [swofty.hello-kitchen] scene loaded: Ident
00:15:19 [core] scene StartScreen loaded (Single)
00:15:19 [swofty.hello-kitchen] scene loaded: StartScreen
00:15:20 [core] scene StartScreen_Base loaded (Additive)
00:15:20 [swofty.hello-kitchen] scene loaded: StartScreen_Base
00:15:25 [core] added the MODS tab to the main menu with 2 button(s)
00:15:25 [swofty.hello-kitchen] the front end is up
00:15:25 [core] main menu shown
00:15:25 [swofty.hello-kitchen] the main menu has shown
00:15:50 [core] main menu button swofty.hello-kitchen.hello clicked
00:15:50 [swofty.hello-kitchen] hello number 1

Log.Warn lines start with warning: and Log.Error lines with error:.

Swofty Core writes status.json once the addons have loaded, and again when the main menu first shows:

json
{
  "core": "0.1.0",
  "std": "0.1.0",
  "loaded": ["swofty.hello-kitchen"],
  "failed": [],
  "main_menu": true
}

A failed addon is in failed with its error:

json
{ "id": "yourname.broken", "error": "NullReferenceException: Object reference not set to an instance of an object" }

The launcher also keeps the game's own logs in the session folder: Unity's log in player.log, and what the game prints in output.log.