yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::SramViewerPanel Class Reference

Panel for viewing Oracle of Secrets SRAM variables via Mesen2. More...

#include <sram_viewer_panel.h>

Collaboration diagram for yaze::editor::SramViewerPanel:

Public Member Functions

 SramViewerPanel ()
 
 ~SramViewerPanel ()
 
void SetProject (project::YazeProject *project)
 
void Draw ()
 

Private Member Functions

void DrawConnectionHeader ()
 
bool IsConnected () const
 
void Connect ()
 
void ConnectToPath (const std::string &socket_path)
 
void Disconnect ()
 
void RefreshSocketList ()
 
void DrawVariableTable ()
 
void DrawGroupHeader (const char *label, uint32_t range_start, uint32_t range_end)
 
void DrawVariableRow (const core::SramVariable &var)
 
void DrawCrystalBitfield (uint8_t value, uint32_t address)
 
void DrawGameStateDropdown (uint8_t value, uint32_t address)
 
void RefreshValues ()
 
void LoadVariablesFromManifest ()
 
void PokeValue (uint32_t address, uint8_t value)
 

Private Attributes

std::shared_ptr< emu::mesen::MesenSocketClientclient_
 
project::YazeProjectproject_ = nullptr
 
std::vector< core::SramVariablevariables_
 
bool variables_loaded_ = false
 
std::unordered_map< uint32_t, uint8_t > current_values_
 
std::unordered_map< uint32_t, uint8_t > previous_values_
 
std::unordered_map< uint32_t, float > change_timestamps_
 
bool auto_refresh_ = true
 
float refresh_interval_ = 0.2f
 
float time_since_refresh_ = 0.0f
 
std::string connection_error_
 
std::vector< std::string > socket_paths_
 
int selected_socket_index_ = -1
 
char socket_path_buffer_ [256] = {}
 
std::string status_message_
 
char filter_text_ [128] = {}
 
bool editing_active_ = false
 
uint32_t editing_address_ = 0
 
int editing_value_ = 0
 
bool story_expanded_ = true
 
bool dungeon_expanded_ = true
 
bool items_expanded_ = true
 

Detailed Description

Panel for viewing Oracle of Secrets SRAM variables via Mesen2.

Reads SRAM variable definitions from the hack manifest and displays their live values from a running Mesen2 emulator. Supports auto-refresh, value editing (poke), bitfield expansion for key addresses (Crystals, GameState), and change highlighting.

Variable grouping:

  • Story ($7EF3C5-$7EF3D7): GameState, OOSPROG, etc.
  • Dungeon ($7EF374, $7EF37A): Pendants, Crystals
  • Items ($7EF340-$7EF37F): Equipment and item counts

Definition at line 33 of file sram_viewer_panel.h.

Constructor & Destructor Documentation

◆ SramViewerPanel()

yaze::editor::SramViewerPanel::SramViewerPanel ( )

◆ ~SramViewerPanel()

yaze::editor::SramViewerPanel::~SramViewerPanel ( )
default

Member Function Documentation

◆ SetProject()

void yaze::editor::SramViewerPanel::SetProject ( project::YazeProject * project)
inline

Definition at line 38 of file sram_viewer_panel.h.

References project_.

◆ Draw()

◆ DrawConnectionHeader()

◆ IsConnected()

bool yaze::editor::SramViewerPanel::IsConnected ( ) const
private

Definition at line 81 of file sram_viewer_panel.cc.

References client_.

Referenced by Draw(), DrawConnectionHeader(), PokeValue(), and RefreshValues().

◆ Connect()

void yaze::editor::SramViewerPanel::Connect ( )
private

◆ ConnectToPath()

void yaze::editor::SramViewerPanel::ConnectToPath ( const std::string & socket_path)
private

◆ Disconnect()

void yaze::editor::SramViewerPanel::Disconnect ( )
private

Definition at line 113 of file sram_viewer_panel.cc.

References client_.

Referenced by DrawConnectionHeader().

◆ RefreshSocketList()

void yaze::editor::SramViewerPanel::RefreshSocketList ( )
private

◆ DrawVariableTable()

void yaze::editor::SramViewerPanel::DrawVariableTable ( )
private

Definition at line 345 of file sram_viewer_panel.cc.

References DrawVariableRow(), dungeon_expanded_, filter_text_, ICON_MD_AUTO_STORIES, ICON_MD_CASTLE, ICON_MD_INVENTORY_2, ICON_MD_MORE_HORIZ, items_expanded_, story_expanded_, and variables_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawGroupHeader()

void yaze::editor::SramViewerPanel::DrawGroupHeader ( const char * label,
uint32_t range_start,
uint32_t range_end )
private

◆ DrawVariableRow()

◆ DrawCrystalBitfield()

void yaze::editor::SramViewerPanel::DrawCrystalBitfield ( uint8_t value,
uint32_t address )
private

Definition at line 536 of file sram_viewer_panel.cc.

References PokeValue().

Referenced by DrawVariableRow().

Here is the call graph for this function:

◆ DrawGameStateDropdown()

void yaze::editor::SramViewerPanel::DrawGameStateDropdown ( uint8_t value,
uint32_t address )
private

Definition at line 562 of file sram_viewer_panel.cc.

References PokeValue().

Referenced by DrawVariableRow().

Here is the call graph for this function:

◆ RefreshValues()

void yaze::editor::SramViewerPanel::RefreshValues ( )
private

Definition at line 152 of file sram_viewer_panel.cc.

References change_timestamps_, client_, current_values_, IsConnected(), previous_values_, and variables_.

Referenced by Connect(), ConnectToPath(), Draw(), and DrawConnectionHeader().

Here is the call graph for this function:

◆ LoadVariablesFromManifest()

void yaze::editor::SramViewerPanel::LoadVariablesFromManifest ( )
private

◆ PokeValue()

void yaze::editor::SramViewerPanel::PokeValue ( uint32_t address,
uint8_t value )
private

Definition at line 177 of file sram_viewer_panel.cc.

References client_, current_values_, IsConnected(), and status_message_.

Referenced by DrawCrystalBitfield(), and DrawGameStateDropdown().

Here is the call graph for this function:

Member Data Documentation

◆ client_

std::shared_ptr<emu::mesen::MesenSocketClient> yaze::editor::SramViewerPanel::client_
private

◆ project_

project::YazeProject* yaze::editor::SramViewerPanel::project_ = nullptr
private

Definition at line 70 of file sram_viewer_panel.h.

Referenced by Draw(), LoadVariablesFromManifest(), and SetProject().

◆ variables_

std::vector<core::SramVariable> yaze::editor::SramViewerPanel::variables_
private

◆ variables_loaded_

bool yaze::editor::SramViewerPanel::variables_loaded_ = false
private

Definition at line 74 of file sram_viewer_panel.h.

Referenced by Draw(), and LoadVariablesFromManifest().

◆ current_values_

std::unordered_map<uint32_t, uint8_t> yaze::editor::SramViewerPanel::current_values_
private

Definition at line 77 of file sram_viewer_panel.h.

Referenced by DrawVariableRow(), PokeValue(), and RefreshValues().

◆ previous_values_

std::unordered_map<uint32_t, uint8_t> yaze::editor::SramViewerPanel::previous_values_
private

Definition at line 80 of file sram_viewer_panel.h.

Referenced by RefreshValues().

◆ change_timestamps_

std::unordered_map<uint32_t, float> yaze::editor::SramViewerPanel::change_timestamps_
private

Definition at line 83 of file sram_viewer_panel.h.

Referenced by DrawVariableRow(), and RefreshValues().

◆ auto_refresh_

bool yaze::editor::SramViewerPanel::auto_refresh_ = true
private

Definition at line 86 of file sram_viewer_panel.h.

Referenced by Draw(), and DrawConnectionHeader().

◆ refresh_interval_

float yaze::editor::SramViewerPanel::refresh_interval_ = 0.2f
private

Definition at line 87 of file sram_viewer_panel.h.

Referenced by Draw(), and DrawConnectionHeader().

◆ time_since_refresh_

float yaze::editor::SramViewerPanel::time_since_refresh_ = 0.0f
private

Definition at line 88 of file sram_viewer_panel.h.

Referenced by Draw().

◆ connection_error_

std::string yaze::editor::SramViewerPanel::connection_error_
private

Definition at line 89 of file sram_viewer_panel.h.

Referenced by Connect(), ConnectToPath(), and DrawConnectionHeader().

◆ socket_paths_

std::vector<std::string> yaze::editor::SramViewerPanel::socket_paths_
private

Definition at line 90 of file sram_viewer_panel.h.

Referenced by DrawConnectionHeader(), RefreshSocketList(), and SramViewerPanel().

◆ selected_socket_index_

int yaze::editor::SramViewerPanel::selected_socket_index_ = -1
private

Definition at line 91 of file sram_viewer_panel.h.

Referenced by DrawConnectionHeader(), RefreshSocketList(), and SramViewerPanel().

◆ socket_path_buffer_

char yaze::editor::SramViewerPanel::socket_path_buffer_[256] = {}
private

Definition at line 92 of file sram_viewer_panel.h.

Referenced by DrawConnectionHeader(), RefreshSocketList(), and SramViewerPanel().

◆ status_message_

std::string yaze::editor::SramViewerPanel::status_message_
private

Definition at line 93 of file sram_viewer_panel.h.

Referenced by DrawConnectionHeader(), and PokeValue().

◆ filter_text_

char yaze::editor::SramViewerPanel::filter_text_[128] = {}
private

Definition at line 94 of file sram_viewer_panel.h.

Referenced by Draw(), and DrawVariableTable().

◆ editing_active_

bool yaze::editor::SramViewerPanel::editing_active_ = false
private

Definition at line 97 of file sram_viewer_panel.h.

Referenced by DrawVariableRow().

◆ editing_address_

uint32_t yaze::editor::SramViewerPanel::editing_address_ = 0
private

Definition at line 98 of file sram_viewer_panel.h.

Referenced by DrawVariableRow().

◆ editing_value_

int yaze::editor::SramViewerPanel::editing_value_ = 0
private

Definition at line 99 of file sram_viewer_panel.h.

Referenced by DrawVariableRow().

◆ story_expanded_

bool yaze::editor::SramViewerPanel::story_expanded_ = true
private

Definition at line 102 of file sram_viewer_panel.h.

Referenced by DrawVariableTable().

◆ dungeon_expanded_

bool yaze::editor::SramViewerPanel::dungeon_expanded_ = true
private

Definition at line 103 of file sram_viewer_panel.h.

Referenced by DrawVariableTable().

◆ items_expanded_

bool yaze::editor::SramViewerPanel::items_expanded_ = true
private

Definition at line 104 of file sram_viewer_panel.h.

Referenced by DrawVariableTable().


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