]>
| Commit | Line | Data |
|---|---|---|
| 1 | # Borderlands 2 — 2-player split-screen / dual-monitor co-op on Linux | |
| 2 | ||
| 3 | Runs **two local instances** of Borderlands 2 that connect to each other over | |
| 4 | Goldberg's emulated Steam LAN, so two people can play co-op on one PC — each with | |
| 5 | their own controller, save, and screen. Tested on **Arch + KDE Plasma 6 (Wayland)**. | |
| 6 | ||
| 7 | - **Two monitors:** one instance fullscreen on each (auto-detected). | |
| 8 | - **One monitor:** side-by-side split. | |
| 9 | - Each Xbox controller drives only its own instance. | |
| 10 | ||
| 11 | > BL2 has no native PC split-screen; this launches two copies networked over LAN. | |
| 12 | > Only legitimate because you own the game. No game files or saves are committed here. | |
| 13 | ||
| 14 |  | |
| 15 | ||
| 16 | ## Requirements | |
| 17 | ||
| 18 | - **Borderlands 2 installed via Steam, forced to the Windows build under Proton** | |
| 19 | (see setup step 1). The native Linux (Aspyr) build is supported as a fallback but | |
| 20 | is crash-prone with two instances — Proton is the recommended path. | |
| 21 | - Packages: `umu-launcher`, `gamescope` *(optional)*, `qt6-tools` (for `qdbus6`), | |
| 22 | `bubblewrap`, `libarchive` (`bsdtar`), `curl`, `binutils` (`strings`). | |
| 23 | ``` | |
| 24 | sudo pacman -S umu-launcher qt6-tools bubblewrap libarchive curl binutils | |
| 25 | ``` | |
| 26 | - Two Xbox controllers (any two distinguishable pads). | |
| 27 | ||
| 28 | ## Setup | |
| 29 | ||
| 30 | 1. **Point Steam at the Windows build.** Steam → *Borderlands 2 → Properties → | |
| 31 | Compatibility →* tick **"Force the use of a specific Steam Play compatibility | |
| 32 | tool"** → pick **Proton Experimental** (or a stable Proton). Steam re-downloads | |
| 33 | the Windows depot. (To use the native Linux build instead, skip this — the script | |
| 34 | auto-detects which is installed.) | |
| 35 | ||
| 36 | 2. **Build the two copies:** | |
| 37 | ``` | |
| 38 | cd bl2-split | |
| 39 | ./bl2-splitscreen.sh check # verifies prerequisites; shows detected mode | |
| 40 | ./bl2-splitscreen.sh setup # downloads Goldberg + builds p1/ and p2/ | |
| 41 | ``` | |
| 42 | `setup` auto-downloads the Goldberg emulator (it is **not** committed to this | |
| 43 | repo) and builds two symlink-mirror copies of the game with per-player Steam | |
| 44 | identities. First `run` also makes umu download Proton + build each prefix (slow, | |
| 45 | one time). | |
| 46 | ||
| 47 | 3. **Play** (turn on both controllers first): | |
| 48 | ``` | |
| 49 | ./bl2-splitscreen.sh run | |
| 50 | ``` | |
| 51 | With two monitors each game opens fullscreen on its own display; with one, they | |
| 52 | tile side-by-side. In-game: **Player 1** *Play → host over LAN*; **Player 2** | |
| 53 | *Play → Join → pick the LAN game*. `Ctrl-C` kills both. | |
| 54 | ||
| 55 | ## Commands | |
| 56 | ||
| 57 | | Command | Does | | |
| 58 | |---|---| | |
| 59 | | `./bl2-splitscreen.sh fetch` | download the Goldberg emulator into `goldberg/` | | |
| 60 | | `./bl2-splitscreen.sh check` | verify prerequisites; print the detected mode | | |
| 61 | | `./bl2-splitscreen.sh setup` | fetch Goldberg + build `p1/`, `p2/` | | |
| 62 | | `./bl2-splitscreen.sh run` | launch both instances + place windows | | |
| 63 | | `./bl2-splitscreen.sh tile` | re-place the two windows | | |
| 64 | | `./bl2-splitscreen.sh kill` | terminate all running Borderlands 2 instances | | |
| 65 | | `./bl2-splitscreen.sh clean` | kill instances, then remove `p1/`, `p2/` (copies + saves + prefixes) | | |
| 66 | ||
| 67 | Useful env overrides: `MODE=native|proton`, `DISPLAY_MODE=dual|split`, | |
| 68 | `ISOLATION=bwrap|sdl`, `SPLASH_WAIT=<secs>`, `STAGGER=<secs>`. | |
| 69 | ||
| 70 | ## How it works | |
| 71 | ||
| 72 | | Concern | Solution | | |
| 73 | |---|---| | |
| 74 | | Two instances at once | Each copy uses **Goldberg** (`steam_api.dll`) instead of real Steam; they connect over emulated LAN | | |
| 75 | | Goldberg actually loads | The `.exe` is copied **real** (not symlinked) so Wine loads DLLs from our dir, not the real install's `steam_api.dll` | | |
| 76 | | Two different LAN players | Per-copy `force_account_name.txt` + `force_steamid.txt` | | |
| 77 | | No startup crash | `steam_interfaces.txt` extracted from the original Steam lib per copy | | |
| 78 | | Separate saves | Each instance has its own Proton prefix (`p1/prefix`, `p2/prefix`) | | |
| 79 | | Co-op finds each other | Goldberg `custom_broadcasts.txt` → `127.0.0.1` (broadcast doesn't cross the two Proton containers) | | |
| 80 | | Skips slow "Creating online session" | Goldberg `configs.main.ini` → `offline=1` | | |
| 81 | | Windowed at the right size | `-windowed -ResX -ResY`; **no gamescope** (it hides raw controllers from nested clients) | | |
| 82 | | One controller per instance | **bwrap** masks the other pad's `/dev/input` nodes (the Xbox pads are evdev-only, no hidraw) | | |
| 83 | | Window placement | KWin script via `qdbus6` — one monitor each (dual) or side-by-side (single) | | |
| 84 | | No intro-logo wait | Intro movies disabled in each prefix's `WillowEngine.ini` | | |
| 85 | | No 13 GB duplication | `cp -as` symlink-mirror; only `steam_api.dll` + the `.exe` are real copies | | |
| 86 | ||
| 87 | ## What's in git (and what isn't) | |
| 88 | ||
| 89 | **Committed** (enough for anyone to reproduce): | |
| 90 | ``` | |
| 91 | bl2-splitscreen.sh the launcher/setup script | |
| 92 | README.md this file | |
| 93 | .gitignore | |
| 94 | goldberg/.gitkeep empty dir; setup downloads binaries into it | |
| 95 | p1/.gitkeep p2/.gitkeep | |
| 96 | ``` | |
| 97 | ||
| 98 | **Never committed** (`.gitignore`): | |
| 99 | - `goldberg/steam_api.dll`, `goldberg/libsteam_api.so` — the Goldberg emulator | |
| 100 | binaries. They implement Steam's proprietary API, so they aren't redistributed | |
| 101 | here; `setup` downloads them from the upstream releases (gbe_fork / Mr_Goldberg). | |
| 102 | - `p1/`, `p2/` (except `.gitkeep`) — the game copies, **your save games**, and Wine | |
| 103 | prefixes. Machine-specific and large. | |
| 104 | - `*.log`. | |
| 105 | ||
| 106 | So another person clones the repo, forces Proton on their own BL2 in Steam, runs | |
| 107 | `./bl2-splitscreen.sh setup`, and everything else is pulled/generated locally. | |
| 108 | ||
| 109 | ## Troubleshooting | |
| 110 | ||
| 111 | - **Both pads control both screens / keyboard controls both:** the games read input | |
| 112 | globally. Controllers are isolated by `bwrap` device-masking (default). Keyboard & | |
| 113 | mouse are *not* isolated — use a controller per player; kb/mouse is only for menus. | |
| 114 | - **A pad drives the wrong screen or none:** ensure `ISOLATION=bwrap` (default). If | |
| 115 | **Steam is running**, its Steam Input virtual pads can interfere — quit Steam. | |
| 116 | - **Stuck on "Creating online session":** should be quick with `offline=1` (set by | |
| 117 | setup). If a co-op *join* ever breaks, remove the offline setting: | |
| 118 | `rm p{1,2}/game/Binaries/Win32/steam_settings/configs.main.ini` | |
| 119 | - **They don't see each other on LAN:** Player 1 hosts first (the script staggers | |
| 120 | launches). Discovery uses `custom_broadcasts.txt` (localhost). | |
| 121 | - **The 2nd instance takes ages to reach the menu:** the two share a DXVK shader | |
| 122 | cache (`dxvk-cache/`) so the 2nd reuses the 1st's shaders; the first-ever run | |
| 123 | still compiles them. If it's still slow, raise the gap between launches so the 1st | |
| 124 | is fully loaded before the 2nd starts: `STAGGER=45 ./bl2-splitscreen.sh run`. | |
| 125 | - **Ctrl-C / kill left something running:** `./bl2-splitscreen.sh kill` tears down | |
| 126 | the whole game + Proton/Wine tree. | |
| 127 | - **A window won't sit on its monitor:** re-run `./bl2-splitscreen.sh tile`; raise | |
| 128 | `SPLASH_WAIT` if it fires before the game settles. | |
| 129 | - **Reset everything:** `./bl2-splitscreen.sh clean` (removes copies + saves; the | |
| 130 | real Steam install is untouched). | |
| 131 | ||
| 132 | ## Native (Aspyr Linux) fallback | |
| 133 | ||
| 134 | If Steam has the native Linux build installed, the script auto-detects `native` mode: | |
| 135 | it uses the **classic Mr_Goldberg** `.so` (gbe_fork crashes that old binary), runs | |
| 136 | inside the Steam scout runtime, and isolates controllers the same way. It works, but | |
| 137 | the second instance is prone to crashing — prefer the Proton path. |