FieldCondJumpInstruction.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. * A conditional map jump instruction.
  23. */
  24. class FieldCondJumpInstruction : public CondJumpInstruction{
  25. public:
  26. /**
  27. * Processes a conditional jump instruction.
  28. *
  29. * Checks if the condition is a function or a comparison, and
  30. * adds the function to the stack.
  31. *
  32. * @param function[in] Function to process. Unused.
  33. * @param stack[out] Function stack. The instruction will be added
  34. * here.
  35. * @param engine[in] Engine. Unused.
  36. * @param codegen[in|out] Code generator to append lines.
  37. */
  38. virtual void ProcessInst(
  39. Function& function, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
  40. ) override;
  41. /**
  42. * Retrieves the destination address of the jump.
  43. *
  44. * @return The offset (number of bytes) to jump from the beginning
  45. * of the instruction.
  46. */
  47. virtual uint32 GetDestAddress() const override;
  48. /**
  49. * Prints the instruction
  50. *
  51. * @param output The stream to print the instruction to.
  52. */
  53. virtual std::ostream& Print(std::ostream &output) const override;
  54. };
  55. }