yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
sram_viewer_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_AGENT_PANELS_SRAM_VIEWER_PANEL_H_
2#define YAZE_APP_EDITOR_AGENT_PANELS_SRAM_VIEWER_PANEL_H_
3
4#include <cstdint>
5#include <memory>
6#include <string>
7#include <unordered_map>
8#include <vector>
9
11#include "core/hack_manifest.h"
12
13namespace yaze {
14namespace project {
15struct YazeProject;
16}
17
18namespace editor {
19
34 public:
37
38 void SetProject(project::YazeProject* project) { project_ = project; }
39
40 void Draw();
41
42 private:
43 // Connection management (delegates to MesenClientRegistry)
45 bool IsConnected() const;
46 void Connect();
47 void ConnectToPath(const std::string& socket_path);
48 void Disconnect();
49 void RefreshSocketList();
50
51 // Data display
52 void DrawVariableTable();
53 void DrawGroupHeader(const char* label, uint32_t range_start,
54 uint32_t range_end);
55 void DrawVariableRow(const core::SramVariable& var);
56 void DrawCrystalBitfield(uint8_t value, uint32_t address);
57 void DrawGameStateDropdown(uint8_t value, uint32_t address);
58
59 // Data refresh
60 void RefreshValues();
62
63 // Poke (write) support
64 void PokeValue(uint32_t address, uint8_t value);
65
66 // Socket client
67 std::shared_ptr<emu::mesen::MesenSocketClient> client_;
68
69 // Project pointer for manifest access
71
72 // Cached SRAM variable definitions from manifest
73 std::vector<core::SramVariable> variables_;
74 bool variables_loaded_ = false;
75
76 // Live value cache: address -> current byte value
77 std::unordered_map<uint32_t, uint8_t> current_values_;
78
79 // Previous values for change detection
80 std::unordered_map<uint32_t, uint8_t> previous_values_;
81
82 // Timestamp of last value change per address (for highlight fade)
83 std::unordered_map<uint32_t, float> change_timestamps_;
84
85 // UI state
86 bool auto_refresh_ = true;
87 float refresh_interval_ = 0.2f; // 200ms
88 float time_since_refresh_ = 0.0f;
89 std::string connection_error_;
90 std::vector<std::string> socket_paths_;
92 char socket_path_buffer_[256] = {};
93 std::string status_message_;
94 char filter_text_[128] = {};
95
96 // Edit state for poke dialog
97 bool editing_active_ = false;
98 uint32_t editing_address_ = 0;
100
101 // Section expansion state
102 bool story_expanded_ = true;
103 bool dungeon_expanded_ = true;
104 bool items_expanded_ = true;
105};
106
107} // namespace editor
108} // namespace yaze
109
110#endif // YAZE_APP_EDITOR_AGENT_PANELS_SRAM_VIEWER_PANEL_H_
Panel for viewing Oracle of Secrets SRAM variables via Mesen2.
void DrawCrystalBitfield(uint8_t value, uint32_t address)
void DrawGameStateDropdown(uint8_t value, uint32_t address)
std::vector< std::string > socket_paths_
project::YazeProject * project_
void PokeValue(uint32_t address, uint8_t value)
std::vector< core::SramVariable > variables_
std::unordered_map< uint32_t, uint8_t > previous_values_
void SetProject(project::YazeProject *project)
std::unordered_map< uint32_t, uint8_t > current_values_
void DrawGroupHeader(const char *label, uint32_t range_start, uint32_t range_end)
std::unordered_map< uint32_t, float > change_timestamps_
void ConnectToPath(const std::string &socket_path)
std::shared_ptr< emu::mesen::MesenSocketClient > client_
void DrawVariableRow(const core::SramVariable &var)
A custom SRAM variable definition.
Modern project structure with comprehensive settings consolidation.
Definition project.h:120