Base class for code generation tools. More...
#include <code_gen_tool.h>
Inherits yaze::cli::resources::CommandHandler.
Inherited by yaze::cli::agent::tools::CodeGenAsmHookTool, yaze::cli::agent::tools::CodeGenEventHandlerTool, yaze::cli::agent::tools::CodeGenFreespacePatchTool, and yaze::cli::agent::tools::CodeGenSpriteTemplateTool.

Protected Member Functions | |
| absl::Status | ValidateHookAddress (Rom *rom, uint32_t address) const |
| Validate that an address is safe for hooking. | |
| std::vector< FreeSpaceRegion > | DetectFreeSpace (Rom *rom, size_t min_size=0x100) const |
| Detect available free space regions in ROM. | |
| std::string | SubstitutePlaceholders (const std::string &template_code, const std::map< std::string, std::string > ¶ms) const |
| Substitute placeholders in template with parameter values. | |
| absl::StatusOr< AsmTemplate > | GetTemplate (const std::string &name) const |
| Get a built-in ASM template by name. | |
| const std::vector< AsmTemplate > & | GetAllTemplates () const |
| Get all available built-in templates. | |
| std::string | FormatResultAsJson (const CodeGenerationResult &result) const |
| Format code generation result as JSON. | |
| std::string | FormatResultAsText (const CodeGenerationResult &result) const |
| Format code generation result as text. | |
| bool | IsKnownHookLocation (uint32_t address) const |
| Check if an address is within a known safe hook location. | |
| std::string | GetHookLocationDescription (uint32_t address) const |
| Get description of a known hook location. | |
Protected Member Functions inherited from yaze::cli::resources::CommandHandler | |
| virtual absl::Status | ValidateArgs (const ArgumentParser &parser)=0 |
| Validate command arguments. | |
| virtual absl::Status | Execute (Rom *rom, const ArgumentParser &parser, OutputFormatter &formatter)=0 |
| Execute the command business logic. | |
| virtual std::string | GetDefaultFormat () const |
| Get the default output format ("json" or "text") | |
| virtual std::string | GetOutputTitle () const |
| Get the output title for formatting. | |
Static Private Member Functions | |
| static std::vector< AsmTemplate > | InitializeTemplates () |
Static Private Attributes | |
| static const std::vector< AsmTemplate > | kTemplates |
| static const std::map< std::string, uint32_t > | kKnownHooks |
Additional Inherited Members | |
Public Member Functions inherited from yaze::cli::resources::CommandHandler | |
| virtual | ~CommandHandler ()=default |
| absl::Status | Run (const std::vector< std::string > &args, Rom *rom_context, std::string *captured_output=nullptr) |
| Execute the command. | |
| virtual std::string | GetName () const =0 |
| Get the command name. | |
| virtual Descriptor | Describe () const |
| Provide metadata for TUI/help summaries. | |
| virtual std::string | GetUsage () const =0 |
| Get the command usage string. | |
| virtual bool | RequiresRom () const |
| Check if the command requires a loaded ROM. | |
| virtual bool | RequiresLabels () const |
| Check if the command requires ROM labels. | |
| virtual void | SetProjectContext (project::YazeProject *project) |
| Set the YazeProject context. Default implementation does nothing, override if tool needs project info. | |
| virtual void | SetAsarWrapper (core::AsarWrapper *asar_wrapper) |
| Set the AsarWrapper context. Default implementation does nothing, override if tool needs Asar access. | |
| virtual void | SetRomContext (Rom *rom) |
| Set the ROM context for tools that need ROM access. Default implementation stores the ROM pointer for subclass use. | |
Protected Attributes inherited from yaze::cli::resources::CommandHandler | |
| Rom * | rom_ = nullptr |
| project::YazeProject * | project_ = nullptr |
| core::AsarWrapper * | asar_wrapper_ = nullptr |
Base class for code generation tools.
Provides common functionality for ASM code generation:
Definition at line 106 of file code_gen_tool.h.
|
protected |
Validate that an address is safe for hooking.
Definition at line 84 of file code_gen_tool.cc.
|
protected |
Detect available free space regions in ROM.
Definition at line 121 of file code_gen_tool.cc.
|
protected |
Substitute placeholders in template with parameter values.
Replaces {{PLACEHOLDER}} with corresponding values from params map.
Definition at line 178 of file code_gen_tool.cc.
|
protected |
Get a built-in ASM template by name.
Definition at line 192 of file code_gen_tool.cc.
|
protected |
Get all available built-in templates.
Definition at line 203 of file code_gen_tool.cc.
|
protected |
Format code generation result as JSON.
Definition at line 225 of file code_gen_tool.cc.
References yaze::cli::agent::tools::FreeSpaceRegion::description, yaze::cli::agent::tools::FreeSpaceRegion::end, yaze::cli::agent::tools::FreeSpaceRegion::free_percent, and yaze::cli::agent::tools::FreeSpaceRegion::start.
Referenced by yaze::cli::agent::tools::CodeGenFreespacePatchTool::Execute(), and yaze::cli::agent::tools::CodeGenSpriteTemplateTool::Execute().
|
protected |
Format code generation result as text.
Definition at line 275 of file code_gen_tool.cc.
Referenced by yaze::cli::agent::tools::CodeGenFreespacePatchTool::Execute(), and yaze::cli::agent::tools::CodeGenSpriteTemplateTool::Execute().
|
protected |
Check if an address is within a known safe hook location.
Definition at line 207 of file code_gen_tool.cc.
|
protected |
Get description of a known hook location.
Definition at line 216 of file code_gen_tool.cc.
|
staticprivate |
Definition at line 39 of file code_gen_tool.cc.
|
staticprivate |
Definition at line 159 of file code_gen_tool.h.
|
staticprivate |
Definition at line 162 of file code_gen_tool.h.