Overview
ExcelGenerator bridges Excel sheet schemas with C# code by:- Reading YAML schema definitions from EXDSchema repository
- Analyzing Excel header files (
.exh) from game data - Generating properly aligned C# structs with
[StructLayout] - Creating nested types for arrays and sub-structures
- Handling packed boolean bit fields
- Applying
[GenerateInterop]for complex types
FFXIVClientStructs.FFXIV.Component.Exd.Sheets namespace.
Installation
ExcelGenerator is built from source:Usage
Basic Usage
Command Line Arguments
Argument 1: Game Path (required)
Path to FFXIV installation directory:game/sqpack directory with Excel data.
Argument 2: Output Path (optional)
Directory for generated.cs files:
..\..\..\FFXIVClientStructs\FFXIV\Component\Exd\Sheets\
Created automatically if it doesn’t exist.
Argument 3: Schema Path (optional)
Path to schema YAML files:- Try to update from remote repository
- Fall back to latest local schema if update fails
Examples
Minimal invocation (uses defaults):Schema Format
Schemas are YAML files defining sheet structure:Basic Schema
Item.yml:
Field Types
- Scalars:
u8,u16,u32,u64,i8,i16,i32,i64,f32,bool,str - Arrays: Defined with
countparameter - Structs: Nested field definitions
- Packed Bools: Automatically detected from
.exhcolumn types
Array Fields
Nested Structs
Generated Code Structure
Simple Struct
ForAction.yml:
With Arrays
With Bit Fields
Processing Flow
1. Schema Update
- Attempts to pull latest schemas from repository
- Falls back to cached local schemas
- Validates schema directory exists
2. Game Data Loading
- Initializes Lumina GameData with sqpack path
- Loads Excel header files (
.exh) - Provides column definitions and metadata
3. Schema Processing
For each.yml file in schema directory:
- Read YAML schema
- Load corresponding
.exhfrom game data - Match schema fields to column definitions
4. Generator Creation
For each field, create appropriate generator:- ScalarGenerator - Single value fields
- ArrayGenerator - Fixed-size arrays
- StructGenerator - Nested structures
- BitFieldGenerator - Packed boolean fields
5. Code Generation
- Build field declarations
- Build nested struct definitions
- Apply proper indentation
- Add
[GenerateInterop]if needed
6. File Output
Column Type Mapping
Excel column types map to C# types:| Excel Type | C# Type | Size |
|---|---|---|
String | Utf8String | 8 bytes |
Bool | bool | 1 byte |
Int8 | sbyte | 1 byte |
UInt8 | byte | 1 byte |
Int16 | short | 2 bytes |
UInt16 | ushort | 2 bytes |
Int32 | int | 4 bytes |
UInt32 | uint | 4 bytes |
Float32 | float | 4 bytes |
Int64 | long | 8 bytes |
UInt64 | ulong | 8 bytes |
PackedBool0-7 | bool | shares 1 byte |
Alignment and Sizing
Structs are aligned to 4-byte boundaries:- Last field at offset
0x1A, size 2 bytes → end at0x1C - Aligned size:
0x1C(already aligned) - Last field at offset
0x1B, size 1 byte → end at0x1C - Aligned size:
0x20(next 4-byte boundary)
Error Handling
Schema Missing
Item.yml in schema directory
Fix: Update schemas or check spelling
Sheet No Longer Exists
Generation Failed
Unknown Field Type
Configuration
Updater Settings
ModifyUpdater.cs for custom schema sources:
Generator Options
Customize output inGenerator.cs:
Dependencies
NuGet Packages
- Lumina 7.0.0 - FFXIV game data reading
- YamlDotNet 16.3.0 - YAML schema parsing
Project References
- InteropGenerator.Runtime (for
[GenerateInterop]attribute)
Build Configuration
Troubleshooting
Game Path Not Found
Problem:DirectoryNotFoundException: GamePath not Found
Solution: Provide valid FFXIV installation path as first argument
Schema Update Fails
Problem: Network error or repository unavailable Solution: Generator falls back to local schemas automatically. Pre-cache schemas for offline use:Incorrect Field Offsets
Problem: Generated fields at wrong offsets Cause: Schema out of sync with game version Solution: Update schemas to match current game patch:Missing Nested Structs
Problem: Nested struct types not generated Cause: Schema doesn’t define struct fields Fix: Add nested field definitions:Performance Issues
Problem: Slow generation Expected: 200-300 sheets in 10-30 seconds If slower:- Check disk I/O (sqpack reading)
- Verify game files aren’t on network drive
- Monitor memory usage with complex schemas
Advanced Usage
Partial Generation
Generate specific sheets only:Custom Type Mappings
ExtendUtil.cs for custom type conversions:
Integration with Build
Run ExcelGenerator as pre-build step:Output Example
Full generated file for a simple sheet:See Also
- InteropGenerator - Processes
[GenerateInterop]structs - CExporter - Exports to C/C++ headers
- Lumina Documentation - Game data reading library
- EXDSchema Repository - Schema definitions