FieldDisassembler.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include <array>
  17. #include "decompiler/simple_disassembler.h"
  18. #include "decompiler/sudm.h"
  19. class BinaryReader;
  20. class Function;
  21. /**
  22. * Field opcodes.
  23. */
  24. enum OPCODE{
  25. RET = 0x0,
  26. REQ = 0x01,
  27. REQSW = 0x02,
  28. REQEW = 0x03,
  29. PREQ = 0x04,
  30. PRQSW = 0x05,
  31. PRQEW = 0x06,
  32. RETTO = 0x07,
  33. JOIN = 0x08,
  34. SPLIT = 0x09,
  35. SPTYE = 0x0A,
  36. GTPYE = 0x0B,
  37. DSKCG = 0x0E,
  38. SPECIAL = 0x0F,
  39. JMPF = 0x10,
  40. JMPFL = 0x11,
  41. JMPB = 0x12,
  42. JMPBL = 0x13,
  43. IFUB = 0x14,
  44. IFUBL = 0x15,
  45. IFSW = 0x16,
  46. IFSWL = 0x17,
  47. IFUW = 0x18,
  48. IFUWL = 0x19,
  49. MINIGAME = 0x20,
  50. TUTOR = 0x21,
  51. BTMD2 = 0x22,
  52. BTRLD = 0x23,
  53. WAIT = 0x24,
  54. NFADE = 0x25,
  55. BLINK = 0x26,
  56. BGMOVIE = 0x27,
  57. KAWAI = 0x28,
  58. KAWIW = 0x29,
  59. PMOVA = 0x2A,
  60. SLIP = 0x2B,
  61. BGPDH = 0x2C,
  62. BGSCR = 0x2D,
  63. WCLS = 0x2E,
  64. WSIZW = 0x2F,
  65. IFKEY = 0x30,
  66. IFKEYON = 0x31,
  67. IFKEYOFF = 0x32,
  68. UC = 0x33,
  69. PDIRA = 0x34,
  70. PTURA = 0x35,
  71. WSPCL = 0x36,
  72. WNUMB = 0x37,
  73. STTIM = 0x38,
  74. GOLDU = 0x39,
  75. GOLDD = 0x3A,
  76. CHGLD = 0x3B,
  77. HMPMAX1 = 0x3C,
  78. HMPMAX2 = 0x3D,
  79. MHMMX = 0x3E,
  80. HMPMAX3 = 0x3F,
  81. MESSAGE = 0x40,
  82. MPARA = 0x41,
  83. MPRA2 = 0x42,
  84. MPNAM = 0x43,
  85. MPU = 0x45,
  86. MPD = 0x47,
  87. ASK = 0x48,
  88. MENU = 0x49,
  89. MENU2 = 0x4A,
  90. BTLTB = 0x4B,
  91. HPU = 0x4D,
  92. HPD = 0x4F,
  93. WINDOW = 0x50,
  94. WMOVE = 0x51,
  95. WMODE = 0x52,
  96. WREST = 0x53,
  97. WCLSE = 0x54,
  98. WROW = 0x55,
  99. GWCOL = 0x56,
  100. SWCOL = 0x57,
  101. STITM = 0x58,
  102. DLITM = 0x59,
  103. CKITM = 0x5A,
  104. SMTRA = 0x5B,
  105. DMTRA = 0x5C,
  106. CMTRA = 0x5D,
  107. SHAKE = 0x5E,
  108. NOP = 0x5F,
  109. MAPJUMP = 0x60,
  110. SCRLO = 0x61,
  111. SCRLC = 0x62,
  112. SCRLA = 0x63,
  113. SCR2D = 0x64,
  114. SCRCC = 0x65,
  115. SCR2DC = 0x66,
  116. SCRLW = 0x67,
  117. SCR2DL = 0x68,
  118. MPDSP = 0x69,
  119. VWOFT = 0x6A,
  120. FADE = 0x6B,
  121. FADEW = 0x6C,
  122. IDLCK = 0x6D,
  123. LSTMP = 0x6E,
  124. SCRLP = 0x6F,
  125. BATTLE = 0x70,
  126. BTLON = 0x71,
  127. BTLMD = 0x72,
  128. PGTDR = 0x73,
  129. GETPC = 0x74,
  130. PXYZI = 0x75,
  131. PLUS_ = 0x76, // PLUS!
  132. PLUS2_ = 0x77, // PLUS2!
  133. MINUS_ = 0x78, // MINUS!
  134. MINUS2_ = 0x79, // MINUS2!
  135. INC_ = 0x7A, // INC!
  136. INC2_ = 0x7B, // INC2!
  137. DEC_ = 0x7C, // DEC!
  138. DEC2_ = 0x7D, // DEC2!
  139. TLKON = 0x7E,
  140. RDMSD = 0x7F,
  141. SETBYTE = 0x80,
  142. SETWORD = 0x81,
  143. BITON = 0x82,
  144. BITOFF = 0x83,
  145. BITXOR = 0x84,
  146. PLUS = 0x85,
  147. PLUS2 = 0x86,
  148. MINUS = 0x87,
  149. MINUS2 = 0x88,
  150. MUL = 0x89,
  151. MUL2 = 0x8A,
  152. DIV = 0x8B,
  153. DIV2 = 0x8C,
  154. MOD = 0x8D,
  155. MOD2 = 0x8E,
  156. AND = 0x8F,
  157. AND2 = 0x90,
  158. OR = 0x91,
  159. OR2 = 0x92,
  160. XOR = 0x93,
  161. XOR2 = 0x94,
  162. INC = 0x95,
  163. INC2 = 0x96,
  164. DEC = 0x97,
  165. DEC2 = 0x98,
  166. RANDOM = 0x99,
  167. LBYTE = 0x9A,
  168. HBYTE = 0x9B,
  169. TWOBYTE = 0x9C,
  170. SETX = 0x9D,
  171. GETX = 0x9E,
  172. SEARCHX = 0x9F,
  173. PC = 0xA0,
  174. opCodeCHAR = 0xA1,
  175. DFANM = 0xA2,
  176. ANIME1 = 0xA3,
  177. VISI = 0xA4,
  178. XYZI = 0xA5,
  179. XYI = 0xA6,
  180. XYZ = 0xA7,
  181. MOVE = 0xA8,
  182. CMOVE = 0xA9,
  183. MOVA = 0xAA,
  184. TURA = 0xAB,
  185. ANIMW = 0xAC,
  186. FMOVE = 0xAD,
  187. ANIME2 = 0xAE,
  188. ANIM_1 = 0xAF, // ANIM!1
  189. CANIM1 = 0xB0,
  190. CANM_1 = 0xB1, // CANM!1
  191. MSPED = 0xB2,
  192. DIR = 0xB3,
  193. TURNGEN = 0xB4,
  194. TURN = 0xB5,
  195. DIRA = 0xB6,
  196. GETDIR = 0xB7,
  197. GETAXY = 0xB8,
  198. GETAI = 0xB9,
  199. ANIM_2 = 0xBA, // ANIM!2
  200. CANIM2 = 0xBB,
  201. CANM_2 = 0xBC, // CANM!2
  202. ASPED = 0xBD,
  203. CC = 0xBF,
  204. JUMP = 0xC0,
  205. AXYZI = 0xC1,
  206. LADER = 0xC2,
  207. OFST = 0xC3,
  208. OFSTW = 0xC4,
  209. TALKR = 0xC5,
  210. SLIDR = 0xC6,
  211. SOLID = 0xC7,
  212. PRTYP = 0xC8,
  213. PRTYM = 0xC9,
  214. PRTYE = 0xCA,
  215. IFPRTYQ = 0xCB,
  216. IFMEMBQ = 0xCC,
  217. MMBUD = 0xCD,
  218. MMBLK = 0xCE,
  219. MMBUK = 0xCF,
  220. LINE = 0xD0,
  221. LINON = 0xD1,
  222. MPJPO = 0xD2,
  223. SLINE = 0xD3,
  224. SIN = 0xD4,
  225. COS = 0xD5,
  226. TLKR2 = 0xD6,
  227. SLDR2 = 0xD7,
  228. PMJMP = 0xD8,
  229. PMJMP2 = 0xD9,
  230. AKAO2 = 0xDA,
  231. FCFIX = 0xDB,
  232. CCANM = 0xDC,
  233. ANIMB = 0xDD,
  234. TURNW = 0xDE,
  235. MPPAL = 0xDF,
  236. BGON = 0xE0,
  237. BGOFF = 0xE1,
  238. BGROL = 0xE2,
  239. BGROL2 = 0xE3,
  240. BGCLR = 0xE4,
  241. STPAL = 0xE5,
  242. LDPAL = 0xE6,
  243. CPPAL = 0xE7,
  244. RTPAL = 0xE8,
  245. ADPAL = 0xE9,
  246. MPPAL2 = 0xEA,
  247. STPLS = 0xEB,
  248. LDPLS = 0xEC,
  249. CPPAL2 = 0xED,
  250. RTPAL2 = 0xEE,
  251. ADPAL2 = 0xEF,
  252. MUSIC = 0xF0,
  253. SOUND = 0xF1,
  254. AKAO = 0xF2,
  255. MUSVT = 0xF3,
  256. MUSVM = 0xF4,
  257. MULCK = 0xF5,
  258. BMUSC = 0xF6,
  259. CHMPH = 0xF7,
  260. PMVIE = 0xF8,
  261. MOVIE = 0xF9,
  262. MVIEF = 0xFA,
  263. MVCAM = 0xFB,
  264. FMUSC = 0xFC,
  265. CMUSC = 0xFD,
  266. CHMST = 0xFE,
  267. GAMEOVER = 0xFF
  268. };
  269. /**
  270. * SPECIAL opcodes.
  271. *
  272. * SPECIAL opcode is a special one. It's a multi-purpose opcode, used to
  273. * perform game-specific tasks. It has a sub-opcode, in the next address, that
  274. * determines the operation to perform. This is a list of those sub-opcodes.
  275. */
  276. enum OPCODE_SPECIAL{
  277. ARROW = 0xF5,
  278. PNAME = 0xF6,
  279. GMSPD = 0xF7,
  280. SMSPD = 0xF8,
  281. FLMAT = 0xF9,
  282. FLITM = 0xFA,
  283. BTLCK = 0xFB,
  284. MVLCK = 0xFC,
  285. SPCNM = 0xFD,
  286. RSGLB = 0xFE,
  287. CLITM = 0xFF
  288. };
  289. /**
  290. * KAWAI opcodes.
  291. *
  292. * KAWAI opcode is a special one. It's a multi-purpose opcode, used to perform
  293. * graphics related tasks. It has a sub-opcode, in the next address, that
  294. * determines the operation to perform. This is a list of those sub-opcodes.
  295. */
  296. enum OPCODE_KAWAI{
  297. EYETX = 0x00,
  298. TRNSP = 0x01,
  299. AMBNT = 0x02,
  300. Unknown03 = 0x03, // Makou Reactor can write these unknowns.
  301. Unknown04 = 0x04,
  302. Unknown05 = 0x05,
  303. LIGHT = 0x06,
  304. Unknown07 = 0x07,
  305. Unknown08 = 0x08,
  306. Unknown09 = 0x09,
  307. SBOBJ = 0x0A,
  308. Unknown0B = 0x0B,
  309. Unknown0C = 0x0C,
  310. SHINE = 0x0D,
  311. RESET = 0xFF
  312. };
  313. /**
  314. * Information about an instruction.
  315. */
  316. struct InstructionRecord{
  317. /**
  318. * The size, in bytes, of the opcode.
  319. */
  320. unsigned char opcode_size;
  321. /**
  322. * The opcode code.
  323. */
  324. unsigned int opcode;
  325. /**
  326. * The opcode short name (mnemonic).
  327. */
  328. const char* opcode_name;
  329. /**
  330. * Format of the opcode arguments.
  331. */
  332. const char* argument_format;
  333. /**
  334. * @todo Document.
  335. */
  336. std::function<InstPtr()> factory_function;
  337. };
  338. std::map<std::string, const InstructionRecord*> FieldInstructions();
  339. class FF7FieldEngine;
  340. class FieldDisassembler : public SimpleDisassembler{
  341. public:
  342. /**
  343. * Constructor.
  344. *
  345. * @param formatter[in] The code formatter.
  346. * @param engine[in] The engine to use to disassemble.
  347. * @param insts[in] The list of instructions.
  348. */
  349. FieldDisassembler(SUDM::IScriptFormatter& formatter, FF7FieldEngine* engine, InstVec& insts);
  350. /**
  351. * Constructor.
  352. *
  353. * @param formatter[in] The code formatter.
  354. * @param engine[in] The engine to use to disassemble.
  355. * @param insts[in] The list of instructions.
  356. * @param raw_script_data[in] @todo Understand and document.
  357. */
  358. FieldDisassembler(
  359. SUDM::IScriptFormatter& formatter, FF7FieldEngine* engine,
  360. InstVec& insts, const std::vector<unsigned char>& raw_script_data
  361. );
  362. /**
  363. * Destructor.
  364. */
  365. ~FieldDisassembler();
  366. /**
  367. * Disassembles the instructions.
  368. */
  369. virtual void DoDisassemble() override;
  370. /**
  371. * Retrieves the scale factor for the field.
  372. */
  373. float GetScaleFactor() const;
  374. private:
  375. /**
  376. * Finds the ID of the character a function refers to.
  377. *
  378. * @param start_addr[in] The starting address of the function.
  379. * @param start_addr[in] The starting address of the function.
  380. * @param end_addr[in] The ending address of the instruction.
  381. * @param insts[in] The lsit of instructions to search.
  382. * @return The ID of the character the function refers to, or -1 if
  383. * the function doesn't belong to acharacter.
  384. */
  385. static int FindId(uint32 start_addr, uint32 end_addr, const InstVec& insts);
  386. /**
  387. * Open a file for disassembly.
  388. *
  389. * @param filename[in] The file to disassemble.
  390. * @deprecated Do not use. Load the instructions from the constructor.
  391. */
  392. virtual void Open(const char *filename) override;
  393. /**
  394. * Disassembles a script (function).
  395. *
  396. * @param entity_name[in] Name of the entity the script belongs to.
  397. * @param entity_index[in] Index of the entity the script belongs to.
  398. * @param script_entry_point[in] Address of the first instruction of
  399. * the script to disassemble.
  400. * @param script index[in] Index of the script, relative to the entity
  401. * scripts.
  402. * @param next_script_entry_point[in] Address of the first instruction
  403. * of the script next to the one to disassemble (i.e. the last address
  404. * of the script to disassemble, plus one).
  405. * @param is_start[in] Indicates if the script is the first one for
  406. * it's entity.
  407. * @param is_end[in] Indicates if the script is the last one for it's
  408. * entity.
  409. * @throws InternalDecompilerError for malformed scripts.
  410. */
  411. void DisassembleIndivdualScript(
  412. std::string entity_name, size_t entity_index, size_t script_entry_point,
  413. size_t script_index, uint32 next_script_entry_point, bool is_start, bool is_end
  414. );
  415. /**
  416. * Adds a function to the engine.
  417. *
  418. * @param entity_name[in] Name of the entity that owns the function.
  419. * @param entity_index[in] Index of the entity that owns the function.
  420. * @param script_index[in] Index of the script within the entity.
  421. * @param next_script_entry_point[in] Start position of the next
  422. * script (or the ending position of this one, plus one).
  423. * @param is_start[in] Indicates if the function is the first in a class.
  424. * @param is_end[in] Indicates if the function is the last in a class.
  425. * @param to_return_only[in] True to read the script only until the
  426. * first return.
  427. * @param func_name[in] Name of the function. If the entity is a line,
  428. * the provided name will be overridden and set to the standard line
  429. * entity script names.
  430. */
  431. void AddFunc(
  432. std::string entity_name, size_t entity_index, size_t script_index,
  433. uint32 next_script_entry_point, const bool is_start, const bool is_end,
  434. bool to_return_only, std::string func_name
  435. );
  436. /**
  437. * Reads opcodes from a script, and detects lines.
  438. *
  439. * It stops when it reaches the ending position or a RET opcode,
  440. * whatever comes first. It also detects if one of the read opcodes
  441. * LINE, which means that the entity is a line
  442. *
  443. * @param end_pos[in] The last position to read. Opcodes will be read
  444. * until this, or until a RET is found.
  445. * @param point_a[out] If a LINE opcode is found, the first point will
  446. * be saved here.
  447. * @param point_b[out] If a LINE opcode is found, the second point
  448. * will be saved here.
  449. * @return True if LINE opcode found, false if not.
  450. */
  451. bool ReadOpCodesToPositionOrReturn(
  452. size_t end_pos, std::vector<float>& point_a, std::vector<float>& point_b
  453. );
  454. /**
  455. * Initializes a function for an entity.
  456. *
  457. * @param script_index[in] Index of the script.
  458. */
  459. std::unique_ptr<Function> StartFunction(size_t script_index);
  460. /**
  461. * The engine.
  462. */
  463. FF7FieldEngine* engine_;
  464. /**
  465. * Last address of the header.
  466. */
  467. uint32 header_end_position_ = 0;
  468. /**
  469. * Reads the header.
  470. */
  471. void ReadHeader();
  472. /**
  473. * Reads the header.
  474. *
  475. * @param reader[in] Reader to use to read.
  476. */
  477. void ReadHeader(BinaryReader& reader);
  478. /**
  479. * Field file identification magic number.
  480. */
  481. static const int MAGIC;
  482. /**
  483. * The number of sections in a field.
  484. */
  485. static const int NUM_SECTIONS;
  486. /**
  487. * Size of the pointers to sections.
  488. *
  489. * @todo Understand and document.
  490. */
  491. int16 section_pointers_size_; // = sizeof(uint32) * NUM_SECTIONS;
  492. /**
  493. * The sections of a field.
  494. */
  495. enum SECTIONS{
  496. /**
  497. * The scripts section.
  498. */
  499. SCRIPT = 0,
  500. /**
  501. * The walkmesh section.
  502. */
  503. WALKMESH = 1,
  504. /**
  505. * The tiles section.
  506. */
  507. TILE_MAP = 2,
  508. /**
  509. * The camera section.
  510. */
  511. CAMERA_MATRIX = 3,
  512. /**
  513. * The triggers section.
  514. */
  515. TRIGGERS = 4,
  516. /**
  517. * Encounter data section.
  518. */
  519. ENCOUNTERS = 5,
  520. /**
  521. * Field models section.
  522. */
  523. MODELS = 6
  524. };
  525. /**
  526. * The list of sections.
  527. */
  528. std::array<uint32, 7> sections_;
  529. /**
  530. * Retrieves the offset of the end of a script.
  531. *
  532. * @param cur_entry_point[in] @todo Understand and document.
  533. * @param entity_index[in] Index of the entity the script belongs to.
  534. * @param script_index[in] The script index.
  535. * @return The address of the end of the script.
  536. */
  537. uint32 GetEndOfScriptOffset(
  538. uint16 cur_entry_point, size_t entity_index, size_t script_index
  539. );
  540. /**
  541. * Info about a script.
  542. */
  543. struct ScriptInfo{
  544. /**
  545. * Address of the script entry point.
  546. */
  547. uint16 entry_point;
  548. /**
  549. * Address of the next script entry point.
  550. *
  551. * I.e. The last address of the script, plus one.
  552. */
  553. uint32 next_entry_point;
  554. /**
  555. * Script index.
  556. */
  557. size_t index;
  558. };
  559. /**
  560. * A script header.
  561. */
  562. struct ScriptHeader{
  563. /**
  564. * Field file identification magic number.
  565. */
  566. uint16 magic;
  567. /**
  568. * The number of entities in the field.
  569. */
  570. uint8 number_of_entities;
  571. /**
  572. * The number of models in the field.
  573. */
  574. uint8 number_of_models;
  575. /**
  576. * Offset at which the field text strings begin.
  577. */
  578. uint16 offset_to_strings;
  579. /**
  580. * The number of Akao/tuto blocks/offsets.
  581. */
  582. uint16 number_of_akao_offsets;
  583. /**
  584. * Scale of field.
  585. *
  586. * For move and talk calculation (9bit fixed point).
  587. */
  588. uint16 scale;
  589. /**
  590. * Blank data, unused.
  591. */
  592. std::array<uint16, 3> blank;
  593. /**
  594. * Field creator name.
  595. */
  596. std::array<char, 8> creator;
  597. /**
  598. * The field name.
  599. */
  600. std::array<char, 8> name;
  601. /**
  602. * The list of entity names.
  603. *
  604. * There will be {@see number_of_entities} entities.
  605. */
  606. std::vector<std::array<char, 8>> field_entity_names;
  607. /**
  608. * Akao/Tuto block offsets.
  609. *
  610. * There will be {@see number_of_akao_offsets} offsets.
  611. */
  612. std::vector<uint32> akao_offsets;
  613. /**
  614. * Entity script entry points.
  615. *
  616. * More explicitly, subroutine offsets. There will be
  617. * {@see number_of_entities} entity scripts.
  618. */
  619. std::vector<std::array<uint16, 32>> entity_scripts;
  620. /**
  621. * Reads the header.
  622. *
  623. * @param reader[in] The reader used to read the header.
  624. * @throws FF7ScriptHeaderInvalidException If the magic number for
  625. * the field is wrong.
  626. */
  627. void Read(BinaryReader& reader){
  628. magic = reader.ReadU16();
  629. if (magic != MAGIC) throw FF7ScriptHeaderInvalidException();
  630. number_of_entities = reader.ReadU8();
  631. number_of_models = reader.ReadU8();
  632. offset_to_strings = reader.ReadU16();
  633. number_of_akao_offsets = reader.ReadU16();
  634. scale = reader.ReadU16();
  635. for (int i = 0; i < 3; i ++) blank[i] = reader.ReadU16();
  636. for (int i = 0; i < 8; i ++) creator[i] = reader.ReadU8();
  637. for (int i = 0; i < 8; i ++) name[i] = reader.ReadU8();
  638. for (int i = 0; i < number_of_entities; i ++){
  639. std::array<char, 8> name;
  640. for (int j = 0; j < 8; j ++) name[j] = reader.ReadU8();
  641. field_entity_names.emplace_back(name);
  642. }
  643. for (int i = 0; i < number_of_akao_offsets; i ++)
  644. akao_offsets.emplace_back(reader.ReadU32());
  645. entity_scripts.reserve(number_of_entities);
  646. for (int i = 0; i < number_of_entities; i ++){
  647. std::array<uint16, 32> scripts;
  648. for (int j = 0; j < 32; j ++) scripts[j] = reader.ReadU16();
  649. entity_scripts.push_back(scripts);
  650. }
  651. }
  652. };
  653. /**
  654. * The field header.
  655. */
  656. ScriptHeader header_;
  657. /**
  658. * Indicates if the field has been loaded from raw data.
  659. */
  660. bool loaded_from_raw_ = false;
  661. /**
  662. * The formatter.
  663. */
  664. SUDM::IScriptFormatter& formatter_;
  665. /**
  666. * The scale factor of the field.
  667. */
  668. float scale_factor_ = 1.0f;
  669. };