Repository navigation
Home
This wiki collects what is known about the game itself from the xc2-decomp project, a matching decompilation of Xenoblade Chronicles 2 (Nintendo Switch, version 1.0.0). It is written for someone who knows the game and wants to know how it works inside: how the engine is organised, how the data tables are read, what the save file holds, and the rules behind some of the mechanics (Blade creation, Kizuna, chain attacks, mercenary missions, development levels, field gimmicks, cutscenes...).
It is not about how to contribute to the project. For that, see the repository's README, CONTRIBUTING.md and AGENTS.md.
Every claim on these pages comes from code that has been reconstructed and matched: the project compiles its C++ with the game's own compiler and flags and checks, function by function, that the machine code is byte-for-byte the game's. So a function described here behaves as written. Three labels keep the pages honest:
-
Matched (no label): read from a matched function. Function names are cited like this:
gf::GfDataBladeCreate::addAssurePoint, with the source file (relative to the repository root) at least once per topic. -
Inferred: the repository gives a variable or constant a role it deduces from how code uses it. The executable does not contain member names, so such variables are called
unknownXX(XX = byte offset) with a comment. A role marked "inferred" is a good hypothesis, not a fact. Names that come from the game itself are class and function names (the executable still ships its symbol table), BDAT table and column names, and strings inside the code. -
Not decompiled yet / unknown: the function exists in the executable but has no matched source yet, or the code read here does not say. These are listed with address and size so that progress is visible. Pages never fill such a gap with guesses; guesses carry an
[INFERENCE]tag.
The pages describe BDAT tables by name and column only, never by content, and quote no game text or assets.
-
gf::GfBladeCreate::setupAddBoosterisnamespace::Class::function.gfis the game layer,btlbattle,fwthe framework,mlthe engine library,eventcutscenes,gmkfield gimmicks (see Engine-Overview). - A path such as
src/application/BF2/gf/game/blade/gf_blade_manager.cppis relative to the repository root. The tree mirrors the original source layout (C:/Monolithsoft/BF2/prog/application/BF2/..., visible in the game's assertion strings). - Addresses like
0x7100302848are addresses in the game's executable (main, 1.0.0). A size in bytes follows when a function is listed as not decompiled. - Several
.cppfiles that look separate were compiled together by the original build; see "Unity build units" in Engine-Overview. - All pages describe the repository at one snapshot:
mainat commita313ecb66. Functions matched after that may be listed here as "not decompiled yet"; the repository is the reference.
Foundations
- Engine-Overview: libraries and their roles, boot, the framework managers, what one frame does, the game manager and its event bus.
- BDAT-Data: how every table is read: file format, ids and rows, value types, flags, loading, the 413 table ids and the typed accessors.
-
Save-Data: the save records (
SDataGameand friends), game flags, files and slots, saving, loading, new game versus continue. - Random-Numbers: the shared Mersenne Twister, its seeding from the system tick, the per-frame stirring, and why random outcomes such as the rare Blade group cannot be manipulated.
Systems
- Blade-Creation: core crystal resonance, the six-page screen, ideas and boosters, the pity counters in the save, and what is not decompiled yet (the draw itself).
- Battle-System: Kizuna gauge, Blade change cooldown, arts recast, chain attack, elemental combos, hate, reactions, defence, buffs and battle AI scripts.
- Drivers-Blades-Party: drivers, Blades and the party: levels, stats, equip rules, trust rank, Kizuna Rings, the favourite-item pouch.
- World-Progression: development levels and shop prices, mercenary missions, the quest data layer, zones and maps.
- Event-System: cutscenes: the manager, the BDAT tables behind an event, the sequencer, script commands, text, camera and facial animation.
- Field-Gimmicks: spawn and respawn rules for enemies, NPCs, mobs, treasure boxes, collection points, landmarks, doors, damage zones...
- Menus-and-UI: the UI layers, menu objects, the full-screen manager, call contexts, the main menu and the HUD.
- Collision: the collision library, its broad phase, character movement and contact events.
The overall figure is kept in the repository README ("Progress" section), refreshed on main by the project's tooling. At the time of writing it read:
44,664 / 48,739 functions (91.639%), 6,520,768 / 10,024,304 bytes of code (65.050%)
The byte percentage is the representative one: matched functions are mostly the small ones. Per-area figures are in progress/areas.json (for example gf 78%, monolib_mm 48%, gmk 70%, event 73%, framework 63%, battle 23% of code bytes at the snapshot) and on decompilati.onl. The practical effect for this wiki: data layers, accessors, menus, gimmick and event machinery are well covered; core runtime algorithms such as the damage calculation, hate selection, the chain attack flow, the Blade draw and parts of the event loop are not decompiled yet, and the pages say so where it matters.