Engine for extracting semantic game state from SNES memory. More...
#include <semantic_introspection.h>

Public Member Functions | |
| SemanticIntrospectionEngine (Memory *memory) | |
| Construct a new Semantic Introspection Engine. | |
| ~SemanticIntrospectionEngine ()=default | |
| absl::StatusOr< SemanticGameState > | GetSemanticState () |
| Get the complete semantic game state. | |
| absl::StatusOr< std::string > | GetStateAsJson () |
| Get the semantic state as JSON string. | |
| absl::StatusOr< PlayerState > | GetPlayerState () |
| Get only the player state. | |
| absl::StatusOr< std::vector< SpriteState > > | GetSpriteStates () |
| Get all active sprite states. | |
| absl::StatusOr< LocationContext > | GetLocationContext () |
| Get the current location context. | |
| absl::StatusOr< GameModeState > | GetGameModeState () |
| Get the current game mode state. | |
Private Member Functions | |
| std::string | GetGameModeName (uint8_t mode, uint8_t submodule) |
| std::string | GetPlayerStateName (uint8_t state) |
| std::string | GetPlayerDirectionName (uint8_t direction) |
| std::string | GetSpriteTypeName (uint8_t type) |
| std::string | GetSpriteStateName (uint8_t state) |
| std::string | GetOverworldAreaName (uint8_t area) |
| std::string | GetDungeonRoomName (uint16_t room) |
Private Attributes | |
| Memory * | memory_ |
Engine for extracting semantic game state from SNES memory.
This class provides high-level semantic interpretations of raw SNES RAM values, making it easier for AI agents to understand the game state without needing to know the specific memory addresses or value encodings.
Definition at line 127 of file semantic_introspection.h.
|
explicit |
Construct a new Semantic Introspection Engine.
| memory | Pointer to the SNES memory interface |
Definition at line 14 of file semantic_introspection.cc.
References memory_.
|
default |
| absl::StatusOr< SemanticGameState > yaze::emu::debug::SemanticIntrospectionEngine::GetSemanticState | ( | ) |
Get the complete semantic game state.
Definition at line 21 of file semantic_introspection.cc.
References yaze::emu::debug::SemanticGameState::frame, yaze::emu::debug::FrameInfo::frame_counter, yaze::emu::debug::SemanticGameState::game_mode, GetGameModeState(), GetLocationContext(), GetPlayerState(), GetSpriteStates(), yaze::emu::debug::FrameInfo::is_lag_frame, yaze::emu::debug::alttp::kFrameCounter, yaze::emu::debug::SemanticGameState::location, memory_, yaze::emu::debug::SemanticGameState::player, yaze::emu::Memory::ReadByte(), and yaze::emu::debug::SemanticGameState::sprites.
Referenced by GetStateAsJson().
| absl::StatusOr< std::string > yaze::emu::debug::SemanticIntrospectionEngine::GetStateAsJson | ( | ) |
Get the semantic state as JSON string.
Definition at line 63 of file semantic_introspection.cc.
References GetSemanticState().

| absl::StatusOr< PlayerState > yaze::emu::debug::SemanticIntrospectionEngine::GetPlayerState | ( | ) |
Get only the player state.
Definition at line 116 of file semantic_introspection.cc.
References yaze::emu::debug::PlayerState::direction, yaze::emu::debug::PlayerState::direction_name, GetPlayerDirectionName(), GetPlayerStateName(), yaze::emu::debug::PlayerState::health, yaze::emu::debug::alttp::kLinkDirection, yaze::emu::debug::alttp::kLinkHealth, yaze::emu::debug::alttp::kLinkLayer, yaze::emu::debug::alttp::kLinkMaxHealth, yaze::emu::debug::alttp::kLinkState, yaze::emu::debug::alttp::kLinkXHigh, yaze::emu::debug::alttp::kLinkXLow, yaze::emu::debug::alttp::kLinkYHigh, yaze::emu::debug::alttp::kLinkYLow, yaze::emu::debug::PlayerState::layer, yaze::emu::debug::PlayerState::max_health, memory_, yaze::emu::Memory::ReadByte(), yaze::emu::debug::PlayerState::state, yaze::emu::debug::PlayerState::state_name, yaze::emu::debug::PlayerState::x, and yaze::emu::debug::PlayerState::y.
Referenced by GetSemanticState().

| absl::StatusOr< std::vector< SpriteState > > yaze::emu::debug::SemanticIntrospectionEngine::GetSpriteStates | ( | ) |
Get all active sprite states.
Definition at line 150 of file semantic_introspection.cc.
References GetSpriteStateName(), GetSpriteTypeName(), yaze::emu::debug::SpriteState::id, yaze::emu::debug::alttp::kSpriteState, yaze::emu::debug::alttp::kSpriteType, yaze::emu::debug::alttp::kSpriteXHigh, yaze::emu::debug::alttp::kSpriteXLow, yaze::emu::debug::alttp::kSpriteYHigh, yaze::emu::debug::alttp::kSpriteYLow, memory_, yaze::emu::Memory::ReadByte(), yaze::emu::debug::SpriteState::state, yaze::emu::debug::SpriteState::state_name, yaze::emu::debug::SpriteState::type, yaze::emu::debug::SpriteState::type_name, yaze::emu::debug::SpriteState::x, and yaze::emu::debug::SpriteState::y.
Referenced by GetSemanticState().

| absl::StatusOr< LocationContext > yaze::emu::debug::SemanticIntrospectionEngine::GetLocationContext | ( | ) |
Get the current location context.
Definition at line 190 of file semantic_introspection.cc.
References yaze::emu::debug::LocationContext::area_name, yaze::emu::debug::LocationContext::dungeon_room, GetDungeonRoomName(), GetOverworldAreaName(), yaze::emu::debug::LocationContext::indoors, yaze::emu::debug::alttp::kDungeonRoomHigh, yaze::emu::debug::alttp::kDungeonRoomLow, yaze::emu::debug::alttp::kIndoorFlag, yaze::emu::debug::alttp::kOverworldArea, memory_, yaze::emu::debug::LocationContext::overworld_area, yaze::emu::Memory::ReadByte(), and yaze::emu::debug::LocationContext::room_name.
Referenced by GetSemanticState().

| absl::StatusOr< GameModeState > yaze::emu::debug::SemanticIntrospectionEngine::GetGameModeState | ( | ) |
Get the current game mode state.
Definition at line 217 of file semantic_introspection.cc.
References GetGameModeName(), yaze::emu::debug::GameModeState::in_game, yaze::emu::debug::GameModeState::in_transition, yaze::emu::debug::alttp::kGameMode, yaze::emu::debug::alttp::kSubmodule, yaze::emu::debug::GameModeState::main_mode, memory_, yaze::emu::debug::GameModeState::mode_name, yaze::emu::Memory::ReadByte(), and yaze::emu::debug::GameModeState::submodule.
Referenced by GetSemanticState().

|
private |
Definition at line 240 of file semantic_introspection.cc.
Referenced by GetGameModeState().
|
private |
Definition at line 274 of file semantic_introspection.cc.
Referenced by GetPlayerState().
|
private |
Definition at line 304 of file semantic_introspection.cc.
Referenced by GetPlayerState().
|
private |
Definition at line 314 of file semantic_introspection.cc.
Referenced by GetSpriteStates().
|
private |
Definition at line 564 of file semantic_introspection.cc.
Referenced by GetSpriteStates().
|
private |
Definition at line 583 of file semantic_introspection.cc.
Referenced by GetLocationContext().
|
private |
Definition at line 659 of file semantic_introspection.cc.
Referenced by GetLocationContext().
|
private |
Definition at line 173 of file semantic_introspection.h.
Referenced by GetGameModeState(), GetLocationContext(), GetPlayerState(), GetSemanticState(), GetSpriteStates(), and SemanticIntrospectionEngine().