ScriptFormatter.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #include "decompiler/ScriptFormatter.h"
  16. /**
  17. * Retrieves a friendly name for a variable.
  18. *
  19. * @param bank[in] Variable memory bank.
  20. * @param address[in] Variable memory address.
  21. * @return Friendly name assigned to the variable, or an empty
  22. * string if there is none.
  23. */
  24. std::string ScriptFormatter::GetFriendlyVarName(unsigned int bank, unsigned int addr){return "";}
  25. /**
  26. * Retrieves a friendly name for an entity.
  27. *
  28. * @param entity_name[in] Name of the entity.
  29. * @return Friendly name assigned to the entity, or <entity_name>
  30. * if there is none.
  31. */
  32. std::string ScriptFormatter::GetFriendlyEntityName(const std::string& entity_name){return entity_name;}
  33. /**
  34. * Retrieves a friendly name for an animation.
  35. *
  36. * @param animation_id[in] ID of the animation.
  37. * @return Friendly name assigned to the animation. If there is
  38. * no one, the ID in string format.
  39. */
  40. std::string ScriptFormatter::GetFriendlyAnimationName(int animation_id, int id){
  41. return std::to_string(animation_id);
  42. }
  43. /**
  44. * Retrieves a friendly name for a character.
  45. *
  46. * @param char_id[in] ID of the character.
  47. * @return Friendly name assigned to the character. If there is
  48. * no one, the ID in string format.
  49. */
  50. std::string ScriptFormatter::GetFriendlyCharName(int char_id){return std::to_string(char_id);}
  51. /**
  52. * Retrieves a friendly name for a function.
  53. *
  54. * @param entity_name[in] Name of the entity.
  55. * @param function_name[in] Name of the function.
  56. * @return Friendly name assigned to the entity, or
  57. * <function_name> if there is none.
  58. */
  59. std::string ScriptFormatter::GetFriendlyFunctionName(
  60. const std::string& entity_name, const std::string& function_name
  61. ){return function_name;}
  62. /**
  63. * Retrieves the header comment for a function in an entity.
  64. *
  65. * @param entity_name[in] Name of the entity.
  66. * @param function_name[in] Name of the function.
  67. * @return The function comment. An empty string if the entity or
  68. * the function don't exist.
  69. */
  70. std::string ScriptFormatter::GetFunctionComment(
  71. const std::string& entity_name, const std::string& function_name
  72. ){return "";}