FieldUncondJumpInstruction.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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/instruction.h"
  20. namespace FF7{
  21. /**
  22. * An unconditional map jump instruction.
  23. */
  24. class FieldUncondJumpInstruction : public UncondJumpInstruction{
  25. public:
  26. /**
  27. * Constructor.
  28. */
  29. FieldUncondJumpInstruction();
  30. /**
  31. * Indicates if the instruction is a function call.
  32. *
  33. * @return true if the instruction is a function call, false if not.
  34. */
  35. virtual bool IsFuncCall() const;
  36. /**
  37. * Indicates if the instruction is an unconditional jump.
  38. *
  39. * @return true if the instruction is an unconditional jump, false
  40. * if it's not.
  41. */
  42. virtual bool IsUncondJump() const;
  43. /**
  44. * Retrieves the destination address of the jump.
  45. *
  46. * @return The offset (number of bytes) to jump from the beginning
  47. * of the instruction.
  48. */
  49. virtual uint32 GetDestAddress() const;
  50. /**
  51. * Processes the instruction.
  52. *
  53. * @param func[in] Function to process.
  54. * @param stack[out] Function stack. Unused.
  55. * @param engine[in] The engine. Unused
  56. * @param codegen[in|out] Code generator to append lines.
  57. */
  58. virtual void ProcessInst(
  59. Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
  60. ) override;
  61. /**
  62. * Prints the instruction
  63. *
  64. * @param[in] output The stream to print the instruction to.
  65. * @return The same output.
  66. */
  67. virtual std::ostream& Print(std::ostream &output) const override;
  68. private:
  69. /**
  70. * Whether or not this is really a call to a script function.
  71. */
  72. bool is_func_call_;
  73. };
  74. }