Every fan who has played Legaia with a GameFAQs guide open knows these numbers: what Tornado Flame costs in AP, what the Rim Elm shop sells, what a Gimard drops. The project keeps a typed copy of those numbers - arts, magic, items, equipment, enemies, shops, casino, fishing - mined from public walkthroughs. When a record comes off the disc as anonymous bytes, these tables are the labels it is checked against; where the two disagree, the disc wins.
data/gamedata/ (committed; no Sony bytes)crates/gamedata (legaia_gamedata::Database) + the gamedata-tool CLI; needs no discReverse engineering yields raw records - an art's direction bytes, a spell's MP cost, a monster's stat block - but no names and no second source to check the numbers against. The curated tables supply both.
data/gamedata/*.tomlTyped tables with stable snake_case keys.legaia_gamedataDatabase::load(), no disc needed.| Source | Supplies |
|---|---|
| Tan Yong Hua, Legend of Legaia Walkthrough v6.6 (1999) | Gap-filling; boss-HP estimates from its Master Course commentary |
| Psycho Penguin (mcfaddendaman), Legend of Legaia Walkthrough (2001) | Primary item / art / shop columns; the drop / steal table (PSM Magazine attribution) |
| Meth962, Legend of Legaia 100% Walkthrough v1.11 (FAQ 53721) | Per-enemy stat columns (from RAM dumps, so they outrank the others), boss movesets and rewards, Seru absorb rates, magic-levelling tables |
| Stann0x | The music table, contributed directly - see music tracks |
Only factual columns are committed - names, prices, command sequences, MP costs, locations, drop tables. Guide prose is copyrightable and is never reproduced; Sony-owned bytes stay out of the repo entirely.
| File | Contents |
|---|---|
| arts.toml | Per-character arts: regular / hyper / super / miracle |
| magic.toml | 21 Seru spells + 8 Ra-Seru summons |
| items.toml | Consumables, key items, art books, fishing tackle |
| weapons.toml | 27 weapons |
| armor.toml | 51 entries: body 20, head 15, footwear 16 |
| accessories.toml | 77 accessories with structured effect classes |
| enemies.toml | 177 enemies: location, drop / steal, steal_chance (byte-exact from the SCUS steal table), full stat columns |
| bosses.toml | 22 main-story boss rows over 20 ids (the three Delilas share one) + Lapis + 7 Muscle Dome rounds: attacks, rewards, recommended level |
| shops.toml | Per-town shop inventories by item key |
| casino.toml | Sol / Vidna prize counters, Muscle Dome courses, Baka Fighter |
| sol_tower.toml | Sol Tower floor map + side-quest chains |
| fishing.toml | Vidna / Buma fishing prizes |
| characters.toml | Vahn / Noa / Gala affinities and weapon classes |
| music.toml | 81-track BGM disambiguation (Stann0x) |
| README.md | Source attribution + cross-validation rules |
Implementation: crates/gamedata.
Each art carries a player-facing command (tokens Arms / Ra-Seru / High / Low) and a directions array of raw direction bytes - the prefix that appears in the on-disc art record. The mapping is per character because Noa is left-handed.
| Token | Vahn / Gala | Noa |
|---|---|---|
Arms | L = 1 | R = 2 |
Ra-Seru | R = 2 | L = 1 |
High | U = 4 | U = 4 |
Low | D = 3 | D = 3 |
The action_constant field (0x1B..=0x32) joins the per-character art-name table in crates/art.
21 Seru spells and 8 Ra-Seru summons. element is one of eight lowercase values (fire … evil); target is single_enemy, all_enemies, single_ally, all_allies or self. Seru spells also carry absorb_lv1..3 - the percent chance a kill captures the Lv1 / Lv2 / Lv3 mist variant (Gimard 55/60/80, Gilium 1/1/1). Summons are egg-derived and have no absorb rate.
legaia_gamedata::magic_leveling | Meaning |
|---|---|
XP_TO_LEVEL | 18, 51, 93, 145, 209, 289, 393, 537 - cumulative cost Lv2 → Lv9 |
SCALING_BP | Damage / heal multiplier in basis points: Lv1 = 10000, Lv9 = 20000 |
VERA_HEAL / ORB_HEAL / SPOON_HEAL | Per-level healer output (Vera 256-512, Orb 512-1024 AoE, Spoon 1024-2048 AoE) |
NIGHTO_HIT_PCT | Nighto's Confuse / Death base hit chance per level (fixed 8:1 split) |
xp_single_target / xp_multi_target | Damage-as-fraction-of-HP → XP award (0..=12 single, 0..=4 per enemy multi) |
Every row carries a stable snake_case key that the shop, casino, fishing and enemy tables reference. accessories.toml adds an effect_class (hp_max_pct, ap_accrual_pct, revive_once, elemental_def, …) - a structured re-encoding of the guide's effect text for the engine to dispatch on, and the field the disc's accessory passive index is checked against.
Per enemy: name, location, optional element and boss, optional drop / steal keys, steal_chance, and the stat columns HP / MP / EXP / Gold / ATK / SPD / UDF / LDF / INT / AGL. The stats are the in-battle values the player fights, not the raw disc record - see cross-validation.
One [[shop]] per merchant, inventory as item keys. gamedata-tool shop <town> joins the keys against the four item tables and prints a priced inventory.
| Table | Holds |
|---|---|
[[slot_prize]] | Vidna casino counter and the Sol Tower F4 prize counter (location = "Sol"). Slot machines themselves only pay coins. |
[[muscle_dome_course]] | Beginner / Expert / Master: entry fee, clear reward, restrictions / allowed gating, encounter-order roster. Master's first-clear reward (War God Icon) requires Jette defeated in Absolute Fortress. |
[[muscle_dome_round]] | Normalised (course_key, round, boss_key, seru_level) rows: 8 for Beginner and Expert, 13 for Master |
[[muscle_dome_boss]] | Full per-enemy stat block, drop / steal with chances, attack list, immunities, element and weakness arrays, wiki_path provenance. Seru entries nest Lv1-3 stats as [[muscle_dome_boss.seru_level]]. |
[baka_fighter_meta] / [[baka_fighter]] | All-rounds-clear reward (460 coins), rule sketch, per-round button sequences |
[[muscle_paradise_secret]] | The Chicken King easter egg (run from the first battle in all three difficulties) |
sol_tower.toml is location-scoped: a per-floor map ([[floor]] with named sections) and side-quest chains ([[side_quest]] with ordered steps and reward pointers). scene_label = "town0d" ties it to the scene name map and the field-VM bundle.
Two kinds of check keep the tables honest: internal rules that need no disc, and joins against the matching disc record. The disc is the tie-breaker.
action_constant resolves to a name in crates/art; its direction bytes are in 1..=4 and equal the per-character mapping of its command tokens.slot ∈ {armor, helmet, shoes}; equip ∈ {Vahn, Noa, Gala}; item category ∈ {consumable, permanent_stat, key, art_book, fishing_lure}.| Table | Joined to | Result |
|---|---|---|
| Arts | The SCUS arts-name table by action constant; the Super / Miracle trigger tables | Every art: name, AP, inputs; a Super's input is what the retail tokenizer needs, its AP its chain's |
| Magic | The SCUS spell table and the Seru monster records | MP, target, element plate and absorb chances for all 29 spells |
| Item prices | The SCUS item record's u16 at +2 | Every item, weapon, armour piece and accessory; consumable restore amounts too |
| Equipment | The equipment record: five bonuses, wearer mask, slot | Every weapon and armour piece, byte-exact |
| Accessory passives | The 64-slot passive index (descriptor +3) | Every accessory joins, zero mismatches |
| Enemy stats | The monster archive (PROT 0867), the SCUS steal table | Every enemy: stats through the battle-load boost, EXP, gold, element, drop, steal |
| Bosses and the Muscle Dome | The monster records, the spell table, the arena ladder (PROT 0977) | HP, MP, rewards, attack costs; every dome round and stat block |
| Shop stock | Inline stock records in scene and field scripts | Every shop in on-screen order, Platinum Card rows as featured; Soru's Bakery is disc-only |
| Casino and fishing prizes | The PROT 0899 prize blocks; the fishing exchange rows | Byte-exact both ways; Earth Egg @ 100000 is a separate hidden exchange |
| Characters, music | The element tables (PROT 0898); the music test rows (PROT 0974) | Strong / weak elements; every sound-test ID and title |
The enemy join has a twist: the curated stats are what the player fights, and the NTSC-U loader boosts the disc record at battle load with one of two profiles. A scripted (boss / story) fight installs UDF / LDF ×2, ATK ×5/4, INT ×9/8; a random encounter installs UDF / LDF ×7/4, ATK ×1, INT ×5/4. HP, SPD and AGL are unchanged in both, and rewards scale separately (EXP ×3/4, gold ×1/4 for one enemy without the Golden Book). The curated table is the boss-fight view of every enemy, so for a random native it overstates defence by 8/7 and ATK by 5/4. The JP and PAL executables install the raw record unboosted - a regional difference first surfaced by Zetopheonix; the loader is on the battle page.
Forest / Magic Amulet cost 2000 (guides: 4000); Evil Medallion 9999 (guides: 9998); Healing Flower 400 (guides: 800); Mushura's Crazy Driver targets a single enemy (guides: all); the Gala helmet is spelled "Power Earring", singular; Vahn's Hyper Elbow is Left, Right, Left (guides: Arms, Ra-Seru, High).
The guides printed two armour numbers under UDF / LDF, but a helmet's second is its INT bonus and footwear's first its ATK bonus; the War God Plate is Gala's at 60 / 62; Power and Valor Plate are Gala's; Noa Feral is Noa's alone. Ten enemies were "lightning" for the game's thunder; the enemy and dome gold was the Golden Book figure. Crimson Book doubles EXP (guides: +25%); the Bad Luck Bell and Nemesis Gem quadruple the encounter rate (guides: +50%); Life and Magic Source restore 8 HP and 2 MP at a time (guides: 5 and 1). Gala takes no extra damage from wind or water. The casino prize layout is 8-byte records [u16 item_id][u16 story_gate][u32 coin_price] in 0x60-byte blocks - block 1 Vidna, block 0 the Muscle Dome counter, blocks 2 / 3 short pre-progression states.
use legaia_gamedata::{Database, Character};
let db = Database::load();
for art in db.arts_for(Character::Vahn) {
println!("{:?} {:>3} AP {}", art.kind, art.ap, art.name);
}
let art = db.find_art_by_directions(Character::Vahn, &[1, 2, 1]).unwrap(); // Hyper Elbow
let ap = db.ap_cost_for_action(Character::Gala, 0x1B).unwrap(); // 99, Biron Rage
for entry in db.shop_inventory("Rim Elm", "Variety Shop").unwrap() {
println!(" {:>20} {:>5}G", entry.name, entry.price.unwrap_or(0));
}
gamedata-tool list arts --character Noagamedata-tool list magic --element lightgamedata-tool find "Tornado Flame"gamedata-tool arts-by-command Vahn "Arms,Ra-Seru,Arms"gamedata-tool shop "Sol"gamedata-tool dump-json arts > arts.jsonFrom source: cargo run -p legaia-gamedata --bin gamedata-tool -- <subcommand>.
| Curated table | Grounds |
|---|---|
| Arts | Names for the command-byte sequences crates/art parses from the art records |
| Magic | MP costs, elements and names for the spell-table offsets the damage / MP-cost formulas read |
| Item keys | Stable identifiers, so a disc byte-id is one extra column rather than churn across consumers |
| Enemy + boss stats | Hits-to-kill predictions from the formulas must match Meth's blocks (Jette: HP 34,567 / ATK 277 / UDF 412 / SPD 274) |
| Seru absorb rates | The per-level absorb chances (Spell::absorb_lv1..3) the Seru capture roll is checked against |
| Magic XP curve | Per-cast levelling: xp_*_target award, XP_TO_LEVEL bump, SCALING_BP on the next cast |
| Function / table | Address | What it proves |
|---|---|---|
| Battle-load stat boost | FUN_80054CB0 | The two boost profiles between the disc record and the in-battle stats; the scripted-fight one reproduces the curated table |
| Victory-spoils scaling | FUN_8004E568 | EXP ×3/4, gold ×5/16 |
| Ability bitfield writer | FUN_80042558 | Accessory passive index → bit in char+0xF4 |
| Steal table | DAT_80077828 | steal_chance column is byte-exact |
| Art records | PROT 0x05C4; runtime tables 0x80160EFC / 0x80176998 / 0x8018BA54 | Direction-byte prefix the directions array mirrors |
| Shop stock records | scene MAN op 0x49 sub-op 0 (legaia_scene_formats::shop_stock) | Per-shop inventory join |
| Casino exchange | PROT 0899 (legaia_patcher::casino::CasinoExchange) | Prize-counter join |