WorldEngine.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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/Engine.h"
  22. /**
  23. * Represents the FF7 world map engine.
  24. */
  25. class WorldEngine : public Engine{
  26. public:
  27. /**
  28. * A bank value.
  29. *
  30. * @todo Understand and document.
  31. */
  32. class BankValue : public VarValue{
  33. public:
  34. /**
  35. * Constructor.
  36. *
  37. * @param name[in] Variable name.
  38. */
  39. BankValue(std::string name);
  40. };
  41. /**
  42. * Constructor.
  43. *
  44. * @param script_number[in] The script number.
  45. */
  46. WorldEngine(int script_number);
  47. /**
  48. * Retrieves the disassembler.
  49. *
  50. * @param insts[in] List of instructions.
  51. * @return Pointer to the disassembler.
  52. */
  53. std::unique_ptr<Disassembler> GetDisassembler(InstVec &insts) override;
  54. /**
  55. * Retrieves the code generator.
  56. *
  57. * @param insts[in] List of instructions. Unused.
  58. * @param output[in] Pointer to the output (file, stream...).
  59. * @return Pointer to the generator.
  60. */
  61. std::unique_ptr<CodeGenerator> GetCodeGenerator(
  62. const InstVec& insts, std::ostream &output
  63. ) override;
  64. /**
  65. * Post-processing actions to apply to the scripts.
  66. *
  67. * It actually does nothing. CFG stands for control flow group.
  68. *
  69. * @param insts[in] Instruction list.
  70. * @param graph[in] Code graph.
  71. */
  72. virtual void PostCFG(InstVec &insts, Graph graph) override;
  73. /**
  74. * Retrieves the variants.
  75. *
  76. * @todo Variants of what? What is this supposed to do?
  77. */
  78. virtual void GetVariants(std::vector<std::string> &variants) const override;
  79. /**
  80. * Indicates if instructions are purely grouped.
  81. *
  82. * @return True if instructions are purely grouped. Always false.
  83. */
  84. virtual bool UsePureGrouping() const override;
  85. private:
  86. /**
  87. * The script number.
  88. */
  89. int script_number_;
  90. /**
  91. * Container for strings from the TEXT chunk.
  92. */
  93. std::vector<std::string> text_strings_;
  94. };