WorldEngine.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * V-Gears
  3. * Copyright (C) 2022 V-Gears Team
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program 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. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #pragma once
  19. #include <string>
  20. #include <vector>
  21. #include "decompiler/decompiler_engine.h"
  22. namespace FF7{
  23. /**
  24. * Represents the FF7 world map engine.
  25. */
  26. class WorldEngine : public Engine{
  27. public:
  28. /**
  29. * A bank value.
  30. *
  31. * @todo Understand and document.
  32. */
  33. class BankValue : public VarValue{
  34. public:
  35. /**
  36. * Constructor.
  37. *
  38. * @param name[in] Variable name.
  39. */
  40. BankValue(std::string name);
  41. };
  42. /**
  43. * Constructor.
  44. *
  45. * @param script_number[in] The script number.
  46. */
  47. WorldEngine(int script_number);
  48. /**
  49. * Retrieves the disassembler.
  50. *
  51. * @param insts[in] List of instructions.
  52. * @return Pointer to the disassembler.
  53. */
  54. std::unique_ptr<Disassembler> GetDisassembler(InstVec &insts) override;
  55. /**
  56. * Retrieves the code generator.
  57. *
  58. * @param insts[in] List of instructions. Unused.
  59. * @param output[in] Pointer to the output (file, stream...).
  60. * @return Pointer to the generator.
  61. */
  62. std::unique_ptr<CodeGenerator> GetCodeGenerator(
  63. const InstVec& insts, std::ostream &output
  64. ) override;
  65. /**
  66. * Post-processing actions to apply to the scripts.
  67. *
  68. * It actually does nothing. CFG stands for control flow group.
  69. *
  70. * @param insts[in] Instruction list.
  71. * @param graph[in] Code graph.
  72. */
  73. virtual void PostCFG(InstVec &insts, Graph graph) override;
  74. /**
  75. * Retrieves the variants.
  76. *
  77. * @todo Variants of what? What is this supposed to do?
  78. */
  79. virtual void GetVariants(std::vector<std::string> &variants) const override;
  80. /**
  81. * Indicates if instructions are purely grouped.
  82. *
  83. * @return True if instructions are purely grouped. Always false.
  84. * @todo What is pure grouping?
  85. */
  86. virtual bool UsePureGrouping() const override;
  87. private:
  88. /**
  89. * The script number.
  90. */
  91. int script_number_;
  92. /**
  93. * Container for strings from the TEXT chunk.
  94. */
  95. std::vector<std::string> text_strings_;
  96. };
  97. }