ScriptFormatter.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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[in] bank Variable memory bank.
  27. * @param[in] addr 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[in] entity_name 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[in] animation_id ID of the animation.
  44. * @param[in] id Unused.
  45. * @return Friendly name assigned to the animation. If there is
  46. * no one, the ID in string format.
  47. */
  48. virtual std::string GetFriendlyAnimationName(int animation_id, int id);
  49. /**
  50. * Retrieves a friendly name for a character.
  51. *
  52. * @param[in] char_id ID of the character.
  53. * @return Friendly name assigned to the character. If there is
  54. * no one, the ID in string format.
  55. */
  56. virtual std::string GetFriendlyCharName(int char_id);
  57. /**
  58. * Retrieves a friendly name for a function.
  59. *
  60. * @param[in] entity_name Name of the entity.
  61. * @param[in] function_name Name of the function.
  62. * @return Friendly name assigned to the entity, or
  63. * function_name if there is none.
  64. */
  65. virtual std::string GetFriendlyFunctionName(
  66. const std::string& entity_name, const std::string& function_name
  67. );
  68. /**
  69. * Retrieves the header comment for a function in an entity.
  70. *
  71. * @param[in] entity_name Name of the entity.
  72. * @param[in] function_name Name of the function.
  73. * @return The function comment. An empty string if the entity or
  74. * the function don't exist.
  75. */
  76. virtual std::string GetFunctionComment(
  77. const std::string& entity_name, const std::string& function_name
  78. );
  79. };