- Go 84.9%
- HTML 12.7%
- NSIS 1.2%
- Makefile 1.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| cmd/neocron-launcher | ||
| internal | ||
| packaging/windows | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
gameserver-neocron-launcher
Neocron launcher for hauke.cloud. A small Go CLI that signs users in with OIDC (authorization code + PKCE), keeps the game files downloaded and integrity-verified against a checksum manifest, and starts the game - directly or through Wine/Proton.
Features
- OIDC login - authorization code flow with PKCE (RFC 7636) for
public clients, loopback callback, silent refresh, local token store
(
~/.local/state/neocron-launcher/session.json, mode 0600). - Game file distribution - the server advertises one version with
a
SHA-256manifest; the launcher downloads only missing/changed files, with parallel workers, atomic (temp file + rename) writes and a per-file retry when a transfer breaks. - Game server - before every start
game.serveris resolved and written asGAMESERVERIPintoini/updater.ini(login port 7000). - Fast pre-launch check - the launcher remembers size,
modification time and hash of every file it verified, so a routine
update/launchonly re-reads files that changed. - Integrity check -
verifyre-hashes the install tree against the manifest and exits non-zero on any deviation;update --prunealso removes unknown files. User data (ini/,logs/, ...) is excluded and never touched. - Proton launch - on Linux the game starts through Steam's Proton, found automatically and run without the Steam client; a custom wrapper command (plain Wine, ...) is possible too.
- GUI -
guiopens a small themed window on top of the same commands; no toolkit or cgo involved. - Publish tooling -
publishturns a staged game directory into the webroot your distribution server serves.
Quick start
neocron-launcher init-config # writes ~/.config/neocron-launcher/config.yaml
$EDITOR ~/.config/neocron-launcher/config.yaml
neocron-launcher login # opens the browser, OIDC code+PKCE
neocron-launcher update # download / repair game files
neocron-launcher verify # integrity check (exit 1 on damage)
neocron-launcher launch # update, then start the game
Global flags go before the command: neocron-launcher -config ./cfg.yaml update.
Graphical launcher
neocron-launcher # same as: neocron-launcher gui
Without a command the launcher opens its window, so it can be started from a desktop entry or by double click:
[Desktop Entry]
Type=Application
Name=Neocron
Exec=neocron-launcher
Categories=Game;
On first start, when no configuration exists, the window offers a
Set up button that writes the default configuration (the same
file init-config writes, pointing at neocron.hauke.cloud). A
broken configuration is shown with a Retry button that re-reads
it after you fixed the file.
It opens a small window with sign-in, build status, verify/repair and a launch button that updates before starting the game. Progress is shown per byte while downloading and per file while verifying.
The window is an embedded HTML page served on a loopback port and
shown in a chromeless window when a Chromium-family browser is
installed (--open app, the default), otherwise in a tab of the
default browser (--open browser). --open none only prints the
URL. Closing the window ends the launcher and aborts a running
download (finished files are kept); while the game runs the launcher
waits for it.
The page is reachable only with the random token in the start URL:
the server binds 127.0.0.1, answers no other Host, and guards
every request with a SameSite=Strict session cookie. It adds no
dependencies - the binary stays static and cross-compilable.
Configuration
server:
base_url: https://neocron.hauke.cloud/ # distribution server root
auth: bearer # "bearer" sends the OIDC token, "none" for anonymous
oidc:
issuer: https://id.hauke.cloud/realms/neocron
client_id: neocron-launcher # public client, no secret (PKCE)
scopes: [openid, profile, email]
redirect_port: 8420 # loopback callback port
game:
install_dir: ~/.local/share/neocron/game
executable: neocronclient.exe
server: neocron.test.gaming.hauke.cloud # -> GAMESERVERIP in ini/updater.ini
runner: auto # auto | proton | native, see "Starting the game"
proton:
version: "11.0"
args: [] # extra arguments for the game
env: {} # extra environment, e.g. PROTON_LOG: "1"
update:
workers: 4
excludes: ["ini/**", "logs/**", "screens/**", "*.log", "*.tmp", "*.dmp"]
accounts:
api_url: https://neocron.test.gaming.hauke.cloud/ # account API root (before /v1); "" = no hand-over
Exclude rules: dir/** or dir/ matches a subtree; patterns without
/ match file names anywhere; anything else is a filepath.Match
glob against the install-relative path. Matching is case-insensitive.
.neocron/ (launcher state) and _version._ are always excluded.
Starting the game
game.runner decides how the executable is started:
| Runner | Behaviour |
|---|---|
auto |
Windows: start the executable directly. Elsewhere: proton, unless game.command is set (then native). |
proton |
Start through an installed Steam Proton. |
native |
Start directly, or through game.command when set. |
Proton
The launcher runs Proton itself - Steam does not have to be running and no non-Steam shortcut is needed. Steam only has to be installed, because it delivers Proton and the Steam Linux Runtime: install "Proton 11.0" under Library > Tools (enable the Tools filter).
At launch the launcher locates the Steam installation and all its
library folders, finds the Proton build, reads its toolmanifest.vdf
and wraps it in the runtime container that manifest requires - the
same chain the Steam client builds:
SteamLinuxRuntime_4/_v2-entry-point --verb=waitforexitandrun -- \
"Proton 11.0/proton" waitforexitandrun <install_dir>/neocronclient.exe
The Wine prefix is created on first launch in
~/.local/share/neocron/prefix. All of it can be overridden:
game:
runner: proton
proton:
version: "Experimental" # or "10.0", or a custom build's directory
# name in compatibilitytools.d ("GE-Proton10-4")
path: ~/proton/my-build # a Proton directory, instead of version
steam_root: ~/.local/share/Steam
prefix: ~/.local/share/neocron/prefix
A missing Steam, Proton build or runtime is reported with what to install, in the terminal and in the GUI.
Custom wrapper
For plain Wine or anything else, set game.command; with auto that
selects the native runner. game.args then go before the
executable, and {dir}/{exe} are expanded in command, args and env
(without {exe} the executable path is appended):
game:
command: [wine]
env:
WINEPREFIX: /home/user/.wine-neocron
Game accounts and sign-in hand-over
One OIDC identity can own several game accounts (the names the client
logs in with). With accounts.api_url set, the launcher lists them
from the account API and lets the player pick one: the GUI shows a
selector (with a field to create a new account) above the Launch
button; on the command line:
neocron-launcher accounts # list, * marks the one used last
neocron-launcher accounts create Runner # create a game account
neocron-launcher launch --account Runner # default: last used, or the only one
On launch the launcher asks the API for a one-time launch password
for the chosen account and writes name and password into the client's
saved-login entries (HKCU\Software\Reakktor\Neocron: UserName,
Password, SaveLogin=ON). The client pre-fills its login form from
them, and the player presses Enter once. Password is not plain
text: the client stores it TEA-encrypted under a key bound to the
volume serial number of the drive it runs from, so the launcher
first determines that serial:
- Windows:
GetVolumeInformationof the install directory's drive; the registry is written directly. - Proton: Wine's
cmd /c vol, run in the install directory inside the prefix; the values are imported with Wine'sregeditfrom a short-lived.regfile in the prefix'sdrive_c(never on a command line).
After the game exits the saved password is cleared. Runners without a
registry path (native with a custom game.command on Linux) show
account and password in the launcher to type in by hand.
Distribution server API
The launcher expects three resources below server.base_url:
| Resource | Response |
|---|---|
GET /version |
plain text version string (e.g. 2.5.904) |
GET /manifest.json.gz |
gzip JSON: {"version": "...", "files": [{"path", "size", "sha256"}]} |
GET /files/<path> |
raw bytes of the current version's file |
With auth: bearer every request carries
Authorization: Bearer <access token>; the server must enforce it.
Static files plus a small auth proxy is enough - the publish
subcommand generates version, manifest.json.gz and (with
--copy) the whole files/ tree:
neocron-launcher publish \
--source /srv/neocron/staging \
--output /var/www/neocron \
--version 2.5.904 \
--copy \
--exclude 'ini/**' --exclude 'logs/**'
A file whose transfer breaks (connection reset, short or corrupt
body) is fetched again from the start, up to three more times;
refusals such as 401/403/404 fail immediately. Temp files
(.neocron-dl-*) left behind by a killed run are removed by the next
update or launch.
Only one launcher instance works on an installation at a time: a
second update, verify or launch fails right away while the
first is running (lock on .neocron/lock, released automatically
even if the launcher crashes).
update and launch trust a file whose size and modification time
are unchanged since the launcher last hashed it (cache in
.neocron/filestate.json). verify, update --force and the GUI's
Verify/Repair buttons ignore the cache and read every file.
Updates are atomic from the client's perspective: the launcher only applies the new version pointer after all files downloaded and verified, and each file is checked against its manifest hash while streaming.
Session handling
- Tokens are stored locally and refreshed silently via the refresh
token; when refreshing fails the launcher tells the user to
loginagain. - The token authenticates the launcher against the distribution server only. Consistent with the original 2.5 client analysis, the game executable receives no token - the game client authenticates itself over its own native login protocol.
Security notes
- Run server and IdP over HTTPS; the manifest's integrity is only as strong as the transport.
- ID token claims are parsed unverified for display only
(
whoami); the resource server validates tokens themselves. verifydetects accidental corruption and casual tampering; it is not an anti-cheat measure. The pre-launch check is weaker still: an edit that preserves size and modification time passes it until the nextverify. Server-side authority is required for that.
Development
make build # bin/neocron-launcher
make test # unit tests (also: make race, make lint)
make cross # static Linux binaries for amd64 and arm64
make installer # Windows installer (needs makensis from the nsis package)
Releases
.forgejo/workflows/build.yml runs on every push to main and on
pull requests: it vets, tests and builds, and keeps the results as a
workflow artifact. Pushing a v* tag additionally publishes a
release with:
| File | For |
|---|---|
neocron-launcher-linux-amd64 |
Linux, x86-64 |
neocron-launcher-linux-arm64 |
Linux, ARM64 |
neocron-launcher-setup-windows-amd64.exe |
Windows installer |
SHA256SUMS |
checksums of the above |
git tag v1.0.0 && git push origin v1.0.0
The Windows installer (packaging/windows/installer.nsi, built with
NSIS on the Linux runner) installs per user without administrator
rights into %LocalAppData%\Programs\Neocron Launcher, adds Start
menu and desktop shortcuts and an uninstaller. Uninstalling removes
the launcher only - configuration, session and game files stay.
On Windows the launcher is built without a console window, so
double-clicking it opens the GUI straight away; the price is that
the command-line subcommands print nothing there. Configuration
lives in %AppData%\neocron-launcher\config.yaml, the session in
%LocalAppData%\neocron-launcher\session.json.
Only runtime dependency: gopkg.in/yaml.v3. Everything else is the
Go standard library.
Background
This launcher replaces the proprietary WPF launcher
(PegasusDistributionSystem) shipped with Neocron Evolution 2.5. The
reverse engineering of the original launcher and the native client
protocol (including why the original launcher passes no token to the
game) is documented in the sibling neocron analysis repository.
License: GPLv3 (see LICENSE).