yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
mesen_screenshot_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_AGENT_PANELS_MESEN_SCREENSHOT_PANEL_H_
2#define YAZE_APP_EDITOR_AGENT_PANELS_MESEN_SCREENSHOT_PANEL_H_
3
4#include <memory>
5#include <string>
6#include <vector>
7
10
11namespace yaze {
12namespace editor {
13
23 public:
26
27 // Non-copyable, non-movable (owns GPU texture)
30
31 void Draw();
32
33 void SetClient(std::shared_ptr<emu::mesen::MesenSocketClient> client);
34 bool IsConnected() const;
35 void Connect();
36 void ConnectToPath(const std::string& socket_path);
37 void Disconnect();
38
39 private:
42 void DrawPreviewArea();
43 void DrawStatusBar();
44
45 void RefreshSocketList();
46 void CaptureScreenshot();
47 void UpdateTexture(const std::vector<uint8_t>& rgba, int width, int height);
48 void EnsureTexture(int width, int height);
49 void DestroyTexture();
50
51 // Base64 + PNG decode pipeline
52 static std::vector<uint8_t> DecodeBase64(const std::string& encoded);
53 static bool DecodePngToRgba(const std::vector<uint8_t>& png_data,
54 std::vector<uint8_t>& rgba_out, int& width_out,
55 int& height_out);
56
57 std::shared_ptr<emu::mesen::MesenSocketClient> client_;
58
59 // Texture state
60 SDL_Texture* texture_ = nullptr;
63
64 // Captured frame state
65 int frame_width_ = 0;
67 uint64_t frame_counter_ = 0;
69 bool frame_stale_ = false;
70
71 // UI controls
72 bool streaming_ = false;
73 float target_fps_ = 10.0f;
74 float time_accumulator_ = 0.0f;
75
76 // Connection UI state
77 std::string connection_error_;
78 std::vector<std::string> socket_paths_;
80 char socket_path_buffer_[256] = {};
81 std::string status_message_;
82};
83
84} // namespace editor
85} // namespace yaze
86
87#endif // YAZE_APP_EDITOR_AGENT_PANELS_MESEN_SCREENSHOT_PANEL_H_
ImGui panel that streams live screenshots from a running Mesen2 emulator via socket and displays them...
static std::vector< uint8_t > DecodeBase64(const std::string &encoded)
void SetClient(std::shared_ptr< emu::mesen::MesenSocketClient > client)
std::vector< std::string > socket_paths_
MesenScreenshotPanel & operator=(const MesenScreenshotPanel &)=delete
std::shared_ptr< emu::mesen::MesenSocketClient > client_
void EnsureTexture(int width, int height)
static bool DecodePngToRgba(const std::vector< uint8_t > &png_data, std::vector< uint8_t > &rgba_out, int &width_out, int &height_out)
void ConnectToPath(const std::string &socket_path)
void UpdateTexture(const std::vector< uint8_t > &rgba, int width, int height)
MesenScreenshotPanel(const MesenScreenshotPanel &)=delete
SDL2/SDL3 compatibility layer.