1#ifndef YAZE_CLI_SERVICE_AGENT_ROM_DEBUG_AGENT_H_
2#define YAZE_CLI_SERVICE_AGENT_ROM_DEBUG_AGENT_H_
10#include "absl/status/status.h"
11#include "absl/status/statusor.h"
15#include "protos/emulator_service.grpc.pb.h"
62 std::map<std::string, uint32_t>
fields;
117 const yaze::agent::BreakpointHitResponse& hit);
123 uint32_t address,
size_t length);
129 const std::vector<ExecutionTraceBuffer::TraceEntry>& trace);
135 uint32_t address,
size_t length,
const std::vector<uint8_t>& original);
143 uint32_t start_address, uint32_t end_address);
180 absl::Status
LoadSymbols(
const std::string& symbol_file);
250 uint32_t address,
const uint8_t* code,
size_t max_length);
256 uint32_t address,
int before_lines,
int after_lines);
267 uint32_t address,
const uint8_t* code,
size_t length);
ROM Debugging Agent for AI-assisted ROM hacking.
static constexpr uint32_t FRAME_COUNTER
void SetOriginalRom(const std::vector< uint8_t > &rom_data)
Set the original ROM data for comparison.
static constexpr uint32_t OAM_BUFFER
static constexpr uint32_t PLAYER_HEALTH
static constexpr uint32_t SPRITE_X_LOW
static constexpr uint32_t LINK_Y_POS
static constexpr uint32_t OAM_BUFFER_END
static constexpr uint32_t DMA_ENABLE
static constexpr uint32_t SPRITE_X_HIGH
absl::StatusOr< std::string > ExplainExecutionTrace(const std::vector< ExecutionTraceBuffer::TraceEntry > &trace)
Analyze execution trace and explain program flow.
static constexpr uint32_t WRAM_END
absl::StatusOr< BreakpointAnalysis > AnalyzeBreakpoint(const yaze::agent::BreakpointHitResponse &hit)
Analyze a breakpoint hit with full context.
static constexpr uint32_t APU_PORT0
bool IsMemoryWriteSafe(uint32_t address, size_t length) const
Check if memory write is safe.
static constexpr uint32_t PPU_BGMODE
static constexpr uint32_t LINK_X_POS
std::string FormatRegisterState(const std::map< std::string, uint16_t > ®s) const
Format register state for debugging output.
static constexpr uint32_t SPRITE_TABLE_START
bool IsValidJumpTarget(uint32_t address) const
Check if an address is a valid jump target.
static constexpr uint32_t PPU_CGADD
static constexpr uint32_t INVENTORY_START
static constexpr uint32_t GAME_MODE
RomDebugAgent(yaze::agent::EmulatorServiceImpl *emulator_service)
static constexpr uint32_t APU_PORT2
yaze::agent::EmulatorServiceImpl * emulator_service_
static constexpr uint32_t SRAM_END
std::optional< std::string > GetStructureInfo(uint32_t address) const
Get structure information for a memory address.
std::map< uint32_t, std::string > address_description_cache_
std::vector< DetectedIssue > ScanForIssues(uint32_t start_address, uint32_t end_address)
Scan for common ROM hacking issues in a code region.
static constexpr uint32_t SRAM_START
std::vector< std::string > GetDisassemblyContext(uint32_t address, int before_lines, int after_lines)
Get surrounding context for an address.
std::vector< std::string > BuildCallStack(uint32_t current_pc)
Build call stack from execution trace.
bool HasStackImbalance(uint32_t routine_start, uint32_t routine_end)
Detect stack imbalance in a subroutine.
std::vector< uint8_t > original_rom_
std::map< uint32_t, std::string > data_type_cache_
static constexpr uint32_t SPRITE_STATE
static constexpr uint32_t APU_PORT3
absl::Status LoadSymbols(const std::string &symbol_file)
Load symbol table for better disassembly.
static constexpr uint32_t SPRITE_Y_LOW
absl::StatusOr< PatchComparisonResult > ComparePatch(uint32_t address, size_t length, const std::vector< uint8_t > &original)
Compare original ROM code with patched code.
std::unique_ptr< yaze::emu::debug::SymbolProvider > symbol_provider_
std::optional< DetectedIssue > DetectIssuePattern(uint32_t address, const uint8_t *code, size_t length)
Detect pattern of common issues.
static constexpr uint32_t SPRITE_Y_HIGH
static constexpr uint32_t SPRITE_TABLE_END
std::string DescribeMemoryLocation(uint32_t address) const
Get human-readable description of a memory address.
static constexpr uint32_t SUBMODULE
absl::StatusOr< std::string > AnalyzeInstruction(uint32_t address, const uint8_t *code, size_t max_length)
Analyze the instruction at an address.
static constexpr uint32_t PPU_INIDISP
bool IsCriticalMemoryArea(uint32_t address) const
Check if address is in a critical system area.
static constexpr uint32_t NMI_FLAG
absl::StatusOr< MemoryAnalysis > AnalyzeMemory(uint32_t address, size_t length)
Analyze a memory region and identify its purpose.
static constexpr uint32_t LINK_STATE
static constexpr uint32_t PLAYER_NAME
static constexpr uint32_t HDMA_ENABLE
static constexpr uint32_t WRAM_START
static constexpr uint32_t PPU_CGDATA
static constexpr uint32_t PLAYER_MAX_HEALTH
static constexpr uint32_t DMA0_CONTROL
static constexpr uint32_t APU_PORT1
std::unique_ptr< Disassembler65816 > disassembler_
IssueType
Common ROM hacking issue types.
static constexpr uint32_t LINK_DIRECTION
std::string IdentifyDataType(uint32_t address) const
Get the data type at a memory address.
Analysis result for a breakpoint hit.
std::map< std::string, uint16_t > registers
std::string memory_context
std::vector< std::string > context_lines
std::string location_description
std::vector< std::string > suggestions
std::string instruction_explanation
std::vector< std::string > call_stack
Detected issue in ROM execution.
std::string suggested_fix
Analysis of a memory region.
std::string structure_name
std::vector< std::string > anomalies
std::vector< uint8_t > data
std::map< std::string, uint32_t > fields
Results from patch comparison.
std::vector< std::string > differences
std::vector< std::string > potential_issues
std::vector< uint8_t > patched_code
std::vector< uint8_t > original_code
std::string patched_disassembly
std::string original_disassembly