yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::agent::tools::CodeGenEventHandlerTool Class Reference

Generate event handler code. More...

#include <code_gen_tool.h>

Inheritance diagram for yaze::cli::agent::tools::CodeGenEventHandlerTool:
Collaboration diagram for yaze::cli::agent::tools::CodeGenEventHandlerTool:

Public Member Functions

std::string GetName () const override
 Get the command name.
 
std::string GetDescription () const
 
std::string GetUsage () const override
 Get the command usage string.
 
- 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 Descriptor Describe () const
 Provide metadata for TUI/help summaries.
 
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 Member Functions

absl::Status ValidateArgs (const resources::ArgumentParser &parser) override
 Validate command arguments.
 
absl::Status Execute (Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
 Execute the command business logic.
 
bool RequiresRom () const override
 Check if the command requires a loaded ROM.
 
- Protected Member Functions inherited from yaze::cli::agent::tools::CodeGenToolBase
absl::Status ValidateHookAddress (Rom *rom, uint32_t address) const
 Validate that an address is safe for hooking.
 
std::vector< FreeSpaceRegionDetectFreeSpace (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 > &params) const
 Substitute placeholders in template with parameter values.
 
absl::StatusOr< AsmTemplateGetTemplate (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 std::string GetDefaultFormat () const
 Get the default output format ("json" or "text")
 
virtual std::string GetOutputTitle () const
 Get the output title for formatting.
 

Additional Inherited Members

- Protected Attributes inherited from yaze::cli::resources::CommandHandler
Romrom_ = nullptr
 
project::YazeProjectproject_ = nullptr
 
core::AsarWrapperasar_wrapper_ = nullptr
 

Detailed Description

Generate event handler code.

Creates an event handler (NMI, IRQ, etc.) using the appropriate template with hook installation code.

Usage: codegen-event-handler –type=<nmi|irq|reset> –label=MyHandler [–custom-code="..."] [–format=<json|text>]

Definition at line 266 of file code_gen_tool.h.

Member Function Documentation

◆ GetName()

std::string yaze::cli::agent::tools::CodeGenEventHandlerTool::GetName ( ) const
inlineoverridevirtual

Get the command name.

Override this to provide a unique identifier for the command. This is used for command registration and lookup.

Implements yaze::cli::resources::CommandHandler.

Definition at line 268 of file code_gen_tool.h.

◆ GetDescription()

std::string yaze::cli::agent::tools::CodeGenEventHandlerTool::GetDescription ( ) const
inline

Definition at line 270 of file code_gen_tool.h.

◆ GetUsage()

std::string yaze::cli::agent::tools::CodeGenEventHandlerTool::GetUsage ( ) const
inlineoverridevirtual

Get the command usage string.

Implements yaze::cli::resources::CommandHandler.

Definition at line 274 of file code_gen_tool.h.

◆ ValidateArgs()

absl::Status yaze::cli::agent::tools::CodeGenEventHandlerTool::ValidateArgs ( const resources::ArgumentParser & parser)
inlineoverrideprotectedvirtual

Validate command arguments.

Override this to check required arguments and perform custom validation. Called before Execute().

Implements yaze::cli::resources::CommandHandler.

Definition at line 279 of file code_gen_tool.h.

References yaze::cli::resources::ArgumentParser::RequireArgs().

Here is the call graph for this function:

◆ Execute()

absl::Status yaze::cli::agent::tools::CodeGenEventHandlerTool::Execute ( Rom * rom,
const resources::ArgumentParser & parser,
resources::OutputFormatter & formatter )
overrideprotectedvirtual

Execute the command business logic.

Override this to implement command-specific functionality. The ROM is guaranteed to be loaded and labels initialized.

Implements yaze::cli::resources::CommandHandler.

Definition at line 536 of file code_gen_tool.cc.

◆ RequiresRom()

bool yaze::cli::agent::tools::CodeGenEventHandlerTool::RequiresRom ( ) const
inlineoverrideprotectedvirtual

Check if the command requires a loaded ROM.

Override to return false if ROM is not needed (e.g., filesystem tools).

Reimplemented from yaze::cli::resources::CommandHandler.

Definition at line 286 of file code_gen_tool.h.


The documentation for this class was generated from the following files: