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

Analyze a memory region with structure awareness. More...

#include <memory_inspector_tool.h>

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

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.
 
bool RequiresLabels () const override
 Check if the command requires ROM labels.
 
- 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 RequiresRom () const
 Check if the command requires a loaded ROM.
 
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.
 
- Protected Member Functions inherited from yaze::cli::agent::tools::MemoryInspectorBase
std::string DescribeAddress (uint32_t address) const
 Get description for a memory address.
 
std::string IdentifyDataType (uint32_t address) const
 Identify data type at address.
 
std::vector< MemoryRegionInfoGetKnownRegions () const
 Get known memory regions.
 
std::string FormatHex (const std::vector< uint8_t > &data, int bytes_per_line=16) const
 Format bytes as hex string.
 
std::string FormatAscii (const std::vector< uint8_t > &data) const
 Format bytes as ASCII (printable chars only)
 
absl::StatusOr< uint32_t > ParseAddress (const std::string &addr_str) const
 Parse address from string (supports hex with $ or 0x prefix)
 
- 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.
 

Private Member Functions

std::map< std::string, std::string > AnalyzeSpriteEntry (int sprite_index, const std::vector< uint8_t > &wram) const
 
std::map< std::string, std::string > AnalyzePlayerState (const std::vector< uint8_t > &wram) const
 
std::map< std::string, std::string > AnalyzeGameMode (const std::vector< uint8_t > &wram) const
 

Additional Inherited Members

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

Detailed Description

Analyze a memory region with structure awareness.

Usage: memory-analyze –address <addr> –length <len> [–format <json|text>]

Provides intelligent analysis of memory regions:

  • Identifies known ALTTP structures (sprites, player state, etc.)
  • Parses structured data into named fields
  • Detects anomalies and potential issues

Definition at line 164 of file memory_inspector_tool.h.

Member Function Documentation

◆ GetName()

std::string yaze::cli::agent::tools::MemoryAnalyzeTool::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 166 of file memory_inspector_tool.h.

◆ GetDescription()

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

Definition at line 168 of file memory_inspector_tool.h.

◆ GetUsage()

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

Get the command usage string.

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

Definition at line 172 of file memory_inspector_tool.h.

◆ RequiresLabels()

bool yaze::cli::agent::tools::MemoryAnalyzeTool::RequiresLabels ( ) const
inlineoverridevirtual

Check if the command requires ROM labels.

Override to return false if labels are not needed.

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

Definition at line 176 of file memory_inspector_tool.h.

◆ ValidateArgs()

absl::Status yaze::cli::agent::tools::MemoryAnalyzeTool::ValidateArgs ( const resources::ArgumentParser & parser)
overrideprotectedvirtual

Validate command arguments.

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

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

Definition at line 233 of file memory_inspector_tool.cc.

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

Here is the call graph for this function:

◆ Execute()

◆ AnalyzeSpriteEntry()

std::map< std::string, std::string > yaze::cli::agent::tools::MemoryAnalyzeTool::AnalyzeSpriteEntry ( int sprite_index,
const std::vector< uint8_t > & wram ) const
private

Definition at line 282 of file memory_inspector_tool.cc.

◆ AnalyzePlayerState()

std::map< std::string, std::string > yaze::cli::agent::tools::MemoryAnalyzeTool::AnalyzePlayerState ( const std::vector< uint8_t > & wram) const
private

Definition at line 316 of file memory_inspector_tool.cc.

◆ AnalyzeGameMode()

std::map< std::string, std::string > yaze::cli::agent::tools::MemoryAnalyzeTool::AnalyzeGameMode ( const std::vector< uint8_t > & wram) const
private

Definition at line 341 of file memory_inspector_tool.cc.


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