WorldCodeGenerator.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 "decompiler/decompiler_codegen.h"
  20. namespace FF7{
  21. class WorldCodeGenerator : public CodeGenerator{
  22. public:
  23. /**
  24. * Constructor.
  25. *
  26. * @param engine[in] The engine.
  27. * @param output[out] The generated script.
  28. */
  29. WorldCodeGenerator(Engine *engine, std::ostream &output);
  30. /**
  31. * Finds the first function call.
  32. *
  33. * @return A pointer to the first call instruction.
  34. */
  35. const InstPtr FindFirstCall();
  36. /**
  37. * Finds the last function call.
  38. *
  39. * @return A pointer to the last call instruction.
  40. */
  41. const InstPtr FindLastCall();
  42. /**
  43. * Processes special metadata in an instruction.
  44. *
  45. * @param inst[in] The instruction to process.
  46. * @param c[in]
  47. * @param pos[in]
  48. * @todo understand and document.
  49. */
  50. virtual void ProcessSpecialMetadata(const InstPtr inst, char c, int pos);
  51. protected:
  52. /**
  53. * Constructs the function signature.
  54. *
  55. * The function signature is the LUA function declaration, and it
  56. * looks like this:
  57. *
  58. * <function_name> = function(self)
  59. *
  60. * @param function[in] The function to construct the signature for.
  61. * @return The function signature.
  62. */
  63. std::string ConstructFuncSignature(const Function &function);
  64. };
  65. }