ScriptFormatter.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears 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. #pragma once
  16. #include <map>
  17. #include <vector>
  18. #include <string>
  19. #include "DecompilerException.h"
  20. class ScriptFormatter{
  21. public:
  22. virtual ~ScriptFormatter() = default;
  23. /**
  24. * Retrieves a friendly name for a variable.
  25. *
  26. * @param bank[in] Variable memory bank.
  27. * @param address[in] Variable memory address.
  28. * @return Friendly name assigned to the variable, or an empty
  29. * string if there is none.
  30. */
  31. virtual std::string GetFriendlyVarName(unsigned int bank, unsigned int addr);
  32. /**
  33. * Retrieves a friendly name for an entity.
  34. *
  35. * @param entity_name[in] Name of the entity.
  36. * @return Friendly name assigned to the entity, or <entity_name>
  37. * if there is none.
  38. */
  39. virtual std::string GetFriendlyEntityName(const std::string& entity_name);
  40. /**
  41. * Retrieves a friendly name for an animation.
  42. *
  43. * @param animation_id[in] ID of the animation.
  44. * @return Friendly name assigned to the animation. If there is
  45. * no one, the ID in string format.
  46. */
  47. virtual std::string GetFriendlyAnimationName(int animation_id, int id);
  48. /**
  49. * Retrieves a friendly name for a character.
  50. *
  51. * @param char_id[in] ID of the character.
  52. * @return Friendly name assigned to the character. If there is
  53. * no one, the ID in string format.
  54. */
  55. virtual std::string GetFriendlyCharName(int char_id);
  56. /**
  57. * Retrieves a friendly name for a function.
  58. *
  59. * @param entity_name[in] Name of the entity.
  60. * @param function_name[in] Name of the function.
  61. * @return Friendly name assigned to the entity, or
  62. * <function_name> if there is none.
  63. */
  64. virtual std::string GetFriendlyFunctionName(
  65. const std::string& entity_name, const std::string& function_name
  66. );
  67. /**
  68. * Retrieves the header comment for a function in an entity.
  69. *
  70. * @param entity_name[in] Name of the entity.
  71. * @param function_name[in] Name of the function.
  72. * @return The function comment. An empty string if the entity or
  73. * the function don't exist.
  74. */
  75. virtual std::string GetFunctionComment(
  76. const std::string& entity_name, const std::string& function_name
  77. );
  78. };