Base class for visual analysis tools. More...
#include <visual_analysis_tool.h>
Inherits yaze::cli::resources::CommandHandler.
Inherited by yaze::cli::agent::tools::PaletteUsageTool, yaze::cli::agent::tools::SpritesheetAnalysisTool, yaze::cli::agent::tools::TileHistogramTool, and yaze::cli::agent::tools::TileSimilarityTool.

Static Public Attributes | |
| static constexpr int | kTileWidth = 8 |
| static constexpr int | kTileHeight = 8 |
| static constexpr int | kTilePixels = kTileWidth * kTileHeight |
| static constexpr int | kSheetWidth = 128 |
| static constexpr int | kSheetHeight = 32 |
| static constexpr int | kTilesPerRow = kSheetWidth / kTileWidth |
| static constexpr int | kMaxSheets = 223 |
Protected Member Functions | |
| double | ComputePixelDifference (const std::vector< uint8_t > &tile_a, const std::vector< uint8_t > &tile_b) const |
| Compute simple pixel difference (Mean Absolute Error) | |
| double | ComputeStructuralSimilarity (const std::vector< uint8_t > &tile_a, const std::vector< uint8_t > &tile_b) const |
| Compute structural similarity index (SSIM-like) | |
| absl::StatusOr< std::vector< uint8_t > > | ExtractTile (Rom *rom, int sheet_index, int tile_index) const |
| Extract 8x8 tile data from ROM graphics. | |
| absl::StatusOr< std::vector< uint8_t > > | ExtractTileAtPosition (Rom *rom, int sheet_index, int x, int y) const |
| Extract 8x8 tile at specific pixel coordinates. | |
| bool | IsRegionEmpty (const std::vector< uint8_t > &data) const |
| Check if a tile region is empty (all 0x00 or 0xFF) | |
| int | GetTileCountForSheet (int sheet_index) const |
| Get the number of tiles in a graphics sheet. | |
| std::string | FormatMatchesAsJson (const std::vector< TileSimilarityMatch > &matches) const |
| Format similarity matches as JSON. | |
| std::string | FormatRegionsAsJson (const std::vector< UnusedRegion > ®ions) const |
| Format unused regions as JSON. | |
| std::string | FormatPaletteUsageAsJson (const std::vector< PaletteUsageStats > &stats) const |
| Format palette usage as JSON. | |
| std::string | FormatHistogramAsJson (const std::vector< TileUsageEntry > &entries) const |
| Format tile histogram as JSON. | |
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. | |
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 visual analysis tools.
Provides common functionality for tile and graphics analysis:
Definition at line 81 of file visual_analysis_tool.h.
|
protected |
Compute simple pixel difference (Mean Absolute Error)
| tile_a | First tile data (64 bytes for 8x8) |
| tile_b | Second tile data (64 bytes for 8x8) |
Definition at line 32 of file visual_analysis_tool.cc.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute().
|
protected |
Compute structural similarity index (SSIM-like)
| tile_a | First tile data |
| tile_b | Second tile data |
More robust than MAE for tiles with similar structure but different colors.
Definition at line 54 of file visual_analysis_tool.cc.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute().
|
protected |
Extract 8x8 tile data from ROM graphics.
| rom | ROM to extract from |
| sheet_index | Graphics sheet index (0-222) |
| tile_index | Tile index within sheet |
Definition at line 99 of file visual_analysis_tool.cc.
References ExtractTileAtPosition(), kMaxSheets, kSheetHeight, kSheetWidth, kTileHeight, kTilesPerRow, and kTileWidth.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute().

|
protected |
Extract 8x8 tile at specific pixel coordinates.
| rom | ROM to extract from |
| sheet_index | Graphics sheet index |
| x | X coordinate in pixels |
| y | Y coordinate in pixels |
Definition at line 123 of file visual_analysis_tool.cc.
References yaze::gfx::Arena::Get(), yaze::gfx::Arena::gfx_sheets(), kSheetWidth, kTileHeight, kTilePixels, and kTileWidth.
Referenced by ExtractTile(), and yaze::cli::agent::tools::SpritesheetAnalysisTool::FindUnusedRegions().

|
protected |
Check if a tile region is empty (all 0x00 or 0xFF)
| data | Tile data to check |
Definition at line 178 of file visual_analysis_tool.cc.
Referenced by yaze::cli::agent::tools::SpritesheetAnalysisTool::FindUnusedRegions().
|
protected |
Get the number of tiles in a graphics sheet.
| sheet_index | Graphics sheet index |
Definition at line 207 of file visual_analysis_tool.cc.
References kSheetHeight, kSheetWidth, kTileHeight, and kTileWidth.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute().
|
protected |
Format similarity matches as JSON.
Definition at line 212 of file visual_analysis_tool.cc.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute().
|
protected |
Format unused regions as JSON.
Definition at line 238 of file visual_analysis_tool.cc.
Referenced by yaze::cli::agent::tools::SpritesheetAnalysisTool::Execute().
|
protected |
Format palette usage as JSON.
Definition at line 270 of file visual_analysis_tool.cc.
Referenced by yaze::cli::agent::tools::PaletteUsageTool::Execute().
|
protected |
Format tile histogram as JSON.
Definition at line 299 of file visual_analysis_tool.cc.
Referenced by yaze::cli::agent::tools::TileHistogramTool::Execute().
|
staticconstexpr |
Definition at line 84 of file visual_analysis_tool.h.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute(), ExtractTile(), ExtractTileAtPosition(), and GetTileCountForSheet().
|
staticconstexpr |
Definition at line 85 of file visual_analysis_tool.h.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute(), ExtractTile(), ExtractTileAtPosition(), and GetTileCountForSheet().
|
staticconstexpr |
Definition at line 86 of file visual_analysis_tool.h.
Referenced by ExtractTileAtPosition().
|
staticconstexpr |
Definition at line 87 of file visual_analysis_tool.h.
Referenced by ExtractTile(), ExtractTileAtPosition(), yaze::cli::agent::tools::SpritesheetAnalysisTool::FindUnusedRegions(), and GetTileCountForSheet().
|
staticconstexpr |
Definition at line 88 of file visual_analysis_tool.h.
Referenced by ExtractTile(), yaze::cli::agent::tools::SpritesheetAnalysisTool::FindUnusedRegions(), and GetTileCountForSheet().
|
staticconstexpr |
Definition at line 89 of file visual_analysis_tool.h.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute(), and ExtractTile().
|
staticconstexpr |
Definition at line 90 of file visual_analysis_tool.h.
Referenced by yaze::cli::agent::tools::TileSimilarityTool::Execute(), yaze::cli::agent::tools::SpritesheetAnalysisTool::Execute(), and ExtractTile().