Instructions for AI coding agents (Claude Code / Claude Agent SDK) working in this
repository. OpenAI Codex and other AGENTS.md-aware tools: see
AGENTS.md — it is the twin of this file. Keep the two in sync when
you change one.
Read this before you write code. The deeper reference docs are in docs/ (linked
throughout).
Garlemald Client is a cross-platform launcher for FINAL FANTASY XIV v1.23b (the
original 2010 1.0 release, not A Realm Reborn). It detects an installed 1.x client,
patches it forward to client version 2012.09.19.0001 (CRC32-verified ZiPatch
apply), runs a WebView login against a private server, and launches ffxivgame.exe —
on macOS (incl. Apple Silicon), Linux, and Windows. On macOS/Linux it downloads and
manages its own Wine runtime. Single Rust crate, edition 2024, Rust 1.95.
cargo build --release
cargo run --release- Windows: build the 32-bit target —
cargo run --release --target i686-pc-windows-msvc(it reads the suspended 32-bitffxivgame.exethread context to patch it). x86_64 Windows builds are rejected at compile time (src/lib.rs); CI, the release workflow, andscripts/package-windows.cmdall build i686. The build needs NASM onPATH(aws-lc-sysassembles its crypto with it). A local, gitignored.cargo/config.tomlwithbuild.target = "i686-pc-windows-msvc"lets plaincargo build/cargo rundefault to 32-bit (a committed pin would break macOS/Linux). Seedocs/dev-environment.md. - Linux: needs the GTK3 / WebKit2GTK / X11 / Wayland / GL dev libraries and
system Wine; see
docs/dev-environment.md. - macOS Apple Silicon: needs Rosetta 2 at run time (the managed Wine engine is x86).
The login WebView runs as a subprocess: cargo run -- --login-webview <url> is the
launcher re-execing itself (src/main.rs → login::run_webview).
- Launcher:
log+env_logger, defaultinfo(src/main.rs). Override withRUST_LOG, e.g.RUST_LOG=garlemald_client::patcher=trace. - Game under Wine (mac/linux):
<data_dir>/logs/wine.log; raiseWINEDEBUGvia Developer Settings. Optional winsock packet tracing via thews2_32-proxy/DLL.
Per-user dirs via directories ProjectDirs::from("me","stegall","garlemald-client")
(src/config/paths.rs): config_dir() holds preferences.toml (the selectable
server list is baked in from src/servers/default_servers.toml); data_dir() holds
the Wine prefix/, runtime/ (macOS), and logs/. Reset = delete
those files; see docs/dev-environment.md.
Single crate, src/:
| Module | Owns |
|---|---|
app/ |
eframe/egui GUI — launcher_window, patcher_window, settings_window, developer_window |
servers/ |
server registry (ServerDefinition { name, address, login_url }; default_servers.toml) |
patcher/ |
apply worker + manifest.rs sizes/CRCs + torrented-archive extraction (extract.rs) |
patch_format/ |
the ZiPatch format (decompress + apply file deltas) |
login/ |
the --login-webview subprocess + the ffxiv://login_success?sessionId= handshake |
crypto/ |
Blowfish encryption of the game launch arguments (build_launch_arguments) |
launcher/ |
GameLaunchRequest + launch_game (game_launch.rs); PE patches (pe_patch.rs) |
platform/ |
per-OS: windows.rs (native Win32), macos.rs/linux.rs + wine.rs (managed Wine) |
torrent/ |
BitTorrent patch transport: magnet endpoint + librqbit download/seed service |
install_check.rs |
1.23b install gate blocking login/launch until patched |
config/ |
paths.rs, preferences.rs |
version.rs |
launcher version + FFXIV_BOOT_VERSION / FFXIV_GAME_VERSION |
Architecture + the client↔server (WebView login / patch / launch handoff) flow:
docs/architecture.md.
Every .rs file (including build.rs, examples, tests) must open with this
header, verbatim — copy it from a sibling file. Markdown / TOML files carry none.
// garlemald-client — cross-platform launcher for FINAL FANTASY XIV 1.x private servers
// Copyright (C) 2026 Samuel Stegall
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: AGPL-3.0-or-laterPorting code from a new upstream? Also credit it in NOTICE.md.
- Branch off
develop(the default/integration branch); never commit todevelop/maindirectly. PR intodevelop. develop→mainis the release path; releases are tag-driven (seedocs/RELEASING.md). Don't hand-bump the version — the release workflow ownsCargo.toml's version.- Link the issue in the PR.
cargo fmt --all --check
cargo clippy --all-targets -- -D warnings
cargo build --all-targets --locked
cargo test --locked--locked means: if you change dependencies, commit the updated Cargo.lock. Do
not open a PR until these are green.
- AGPL header on every new
.rsfile (above). - Never cross-commit between repos. This repo is one of several independent git
repositories in a shared workspace (e.g.
Garlemald-Server); commit here only. - Keep CI green before raising a PR.
- Branch off
develop, PR intodevelop. - Respect the
platform/abstraction — OS-specific code (Wine, Win32, WebView, paths) lives behind it; you can't fully test another OS locally, so lean on CI. - Keep this file and
AGENTS.mdin sync.
docs/architecture.md— pipeline, modules, client↔server flow.docs/dev-environment.md— build/run, logging, state, local-server loop.docs/agents.md— running an agent on an issue (human-facing).CONTRIBUTING.md— the contribution workflow.docs/RELEASING.md— branching & release automation.NOTICE.md— upstream attribution.