summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/ability.fspec18
-rw-r--r--spec/eaf.fspec24
-rw-r--r--spec/elf.fspec57
-rw-r--r--spec/emz.fspec10
-rw-r--r--spec/ftable.fspec2
-rw-r--r--spec/item.fspec16
-rw-r--r--spec/model.fspec2
-rw-r--r--spec/name.fspec6
-rw-r--r--spec/spell.fspec34
-rw-r--r--spec/vtable.fspec2
10 files changed, 84 insertions, 87 deletions
diff --git a/spec/ability.fspec b/spec/ability.fspec
index 4498d69..67a9965 100644
--- a/spec/ability.fspec
+++ b/spec/ability.fspec
@@ -1,14 +1,14 @@
struct ability {
- index: u16;
- icon_id: u16;
- mp_cost: u16;
- unknown: u16;
- targets: u16;
- name: u8[32] | encoding('sjis') str; // The encoding actually depends on ROM region
- description: u8[256] | encoding('sjis') str; // ^ Ditto, we can't express this (we need parser options)
- padding: u8[726] nul;
+ u16 index;
+ u16 icon_id;
+ u16 mp_cost;
+ u16 unknown;
+ u16 targets;
+ u8 name[32] | necoding('sjis') str; // The encoding actually depends on ROM region
+ u8 description[256] | encoding('sjis') str; // ^ Ditto, we can't express this (we need parser options)
+ u8 padding[726] nul;
};
struct dat {
- ability: struct ability[$];
+ struct ability ability[$];
};
diff --git a/spec/eaf.fspec b/spec/eaf.fspec
index e9c5702..139539d 100644
--- a/spec/eaf.fspec
+++ b/spec/eaf.fspec
@@ -1,17 +1,17 @@
struct file {
- path: u8[256] | encoding('ascii') str;
- offset: u64;
- size: u64;
- padding: u8[16] nul;
+ u8 path[256] | encoding('ascii') str;
+ u64 offset;
+ u64 size;
+ u8 padding[16] nul;
};
struct eaf {
- header: u8[4] | matches('#EAF') str;
- major: u16;
- minor: u16;
- size: u64;
- count: u32;
- unknown: u64;
- padding: u8[100] nul;
- files: struct file[count];
+ u8 header[4] | matches('#EAF') str;
+ u16 major;
+ u16 minor;
+ u64 size;
+ u32 count;
+ u64 unknown;
+ u8 padding[100] nul;
+ struct file files[count];
};
diff --git a/spec/elf.fspec b/spec/elf.fspec
index e6059c7..5bd9954 100644
--- a/spec/elf.fspec
+++ b/spec/elf.fspec
@@ -1,36 +1,35 @@
-1 + 5 + 2 * 5 / 2;
-
-enum foo {
- foo: 0x1;
- bar: 0x2;
- eaf: 0x3;
- eaf: 0xDEADBEEF;
- bar;
+struct elf32 {
+ u32 e_entry hex;
+ u32 e_phoff;
+ u32 e_shoff;
};
struct elf64 {
- e_entry: u64 hex;
- e_phoff: u64;
- e_shoff: u64;
+ u64 e_entry hex;
+ u64 e_phoff;
+ u64 e_shoff;
};
struct elf {
- ei_magic: u8[4] | matches('\x7fELF') str;
- ei_class: u8 hex; // word size
- ei_data: u8 hex; // endianess
- ei_version: u8;
- ei_osabi: u8;
- ei_abi_version: u8;
- padding: u8[7] nul;
- e_type: u16 hex;
- e_machine: u16 hex;
- e_version: u32;
- elf64: struct elf64; // fspec needs union to parse ei_class != 2 type
- e_flags: u32 hex;
- e_ehsz: u16;
- e_phentsize: u16;
- e_phnum: u16;
- e_shentsize: u16;
- e_shnum: u16;
- e_shstrndx: u16;
+ u8 ei_magic[4] | matches('\x7fELF') str;
+ u8 ei_class hex; // word size
+ u8 ei_data hex; // endianess
+ u8 ei_version;
+ u8 ei_osabi;
+ u8 ei_abi_version;
+ u8 padding[7] nul;
+ u16 e_type hex;
+ u16 e_machine hex;
+ u32 e_version;
+ select (ei_class) {
+ 1) struct elf32 elf32;
+ 2) struct elf64 elf64;
+ } arch;
+ u32 e_flags hex;
+ u16 e_ehsz;
+ u16 e_phentsize;
+ u16 e_phnum;
+ u16 e_shentsize;
+ u16 e_shnum;
+ u16 e_shstrndx;
};
diff --git a/spec/emz.fspec b/spec/emz.fspec
index 0fe02a1..9eb90a4 100644
--- a/spec/emz.fspec
+++ b/spec/emz.fspec
@@ -1,7 +1,7 @@
struct emz {
- header: u8[4] | matches('#EMZ') str;
- unknown: u32 hex; // most likely redunancy check (crc32?)
- size: u32;
- offset: u32; // always 16?
- data: u8[$] | compression('deflate', size) hex;
+ u8 header[4] | matches('#EMZ') str;
+ u32 unknown hex; // most likely redunancy check (crc32?)
+ u32 size;
+ u32 offset; // always 16?
+ u8 data[$] | compression('deflate', size) hex;
};
diff --git a/spec/ftable.fspec b/spec/ftable.fspec
index 39fdd26..c051a6a 100644
--- a/spec/ftable.fspec
+++ b/spec/ftable.fspec
@@ -1,3 +1,3 @@
struct ftable {
- id: u16[$] hex;
+ u16 id[$] hex;
};
diff --git a/spec/item.fspec b/spec/item.fspec
index c4d1767..31bd3f5 100644
--- a/spec/item.fspec
+++ b/spec/item.fspec
@@ -15,14 +15,12 @@ struct item {
u16 type;
u16 resource;
u16 targets;
-
- union data (type) {
- 4 => struct weapon weapon;
- 5 => struct armor armor;
- 7 => struct usable usable;
- 12 => struct puppet puppet;
- * => struct general general;
- };
-
+ select (type) {
+ 4) struct weapon weapon;
+ 5) struct armor armor;
+ 7) struct usable usable;
+ 12) struct puppet puppet;
+ *) struct general general;
+ } data;
struct strings strings;
};
diff --git a/spec/model.fspec b/spec/model.fspec
index afa8281..aade45c 100644
--- a/spec/model.fspec
+++ b/spec/model.fspec
@@ -1,6 +1,6 @@
struct texture {
u8 type;
- u8 name[16] = ascii;
+ u8 name[16] | encoding('ascii') str;
u32 version;
u32 width;
u32 height;
diff --git a/spec/name.fspec b/spec/name.fspec
index d4e0f7c..491c8da 100644
--- a/spec/name.fspec
+++ b/spec/name.fspec
@@ -1,8 +1,8 @@
struct name {
- name: u8[28] | encoding('ascii') str; // The encoding actually depends on ROM region
- id: u32;
+ u8 name[28] | encoding('ascii') str; // The encoding actually depends on ROM region
+ u32 id;
};
struct dat {
- name: struct name[$];
+ struct name name[$];
};
diff --git a/spec/spell.fspec b/spec/spell.fspec
index 68aa5fb..8c9c894 100644
--- a/spec/spell.fspec
+++ b/spec/spell.fspec
@@ -1,22 +1,22 @@
struct spell {
- index: u16;
- type: u16; // 1-6 for White/Black/Summon/Ninja/Bard/Blue
- element: u16;
- targets: u16;
- skill: u16;
- mp_cost: u16;
- casting_time: u8; // in quarter of seconds
- recast_delay: u8; // in quarter of seconds
- level: u8[24] hex; // 1 byte per job, 0xxFF if not learnable, first slot is NONE job so always 0xFF
- id: u16; // 0 for "unused" spells; often, but not always, equal to index
- unknown: u8;
- jp_name: u8[20] | encoding('sjis') str;
- en_name: u8[20] | encoding('ascii') str;
- jp_description: u8[128] | encoding('sjis') str;
- en_description: u8[128] | encoding('ascii') str;
- padding: u8[687] nul;
+ u16 index;
+ u16 type; // 1-6 for White/Black/Summon/Ninja/Bard/Blue
+ u16 element;
+ u16 targets;
+ u16 skill;
+ u16 mp_cost;
+ u8 casting_time; // in quarter of seconds
+ u8 recast_delay; // in quarter of seconds
+ u8 level[24] hex; // 1 byte per job, 0xxFF if not learnable, first slot is NONE job so always 0xFF
+ u16 id; // 0 for "unused" spells; often, but not always, equal to index
+ u8 unknown;
+ u8 jp_name[20] | encoding('sjis') str;
+ u8 en_name[20] | encoding('ascii') str;
+ u8 jp_description[128] | encoding('sjis') str;
+ u8 en_description[128] | encoding('ascii') str;
+ u8 padding[687] nul;
};
struct dat {
- spell: struct spell[$];
+ struct spell spell[$];
};
diff --git a/spec/vtable.fspec b/spec/vtable.fspec
index de281b8..a6be4eb 100644
--- a/spec/vtable.fspec
+++ b/spec/vtable.fspec
@@ -1,3 +1,3 @@
struct vtable {
- exist: u8[$] hex;
+ u8 exist[$] hex;
};