1#ifndef YAZE_APP_PLATFORM_WASM_SESSION_BRIDGE_H_
2#define YAZE_APP_PLATFORM_WASM_SESSION_BRIDGE_H_
11#include "absl/status/status.h"
32struct SharedSessionState {
36 std::string rom_title;
38 bool rom_dirty =
false;
41 std::string current_editor;
42 int current_editor_type = 0;
43 std::vector<std::string> visible_cards;
46 size_t session_id = 0;
47 size_t session_count = 1;
48 std::string session_name;
51 bool flag_save_all_palettes =
false;
52 bool flag_save_gfx_groups =
false;
53 bool flag_save_overworld_maps =
true;
54 bool flag_load_custom_overworld =
false;
55 bool flag_apply_zscustom_asm =
false;
58 std::string project_name;
59 std::string project_path;
60 bool has_project =
false;
63 std::string last_z3ed_command;
64 std::string last_z3ed_result;
65 bool z3ed_command_pending =
false;
68 std::string
ToJson()
const;
71 static SharedSessionState
FromJson(
const std::string& json);
77 absl::Status ApplyToEditor(editor::EditorManager* manager);
89class WasmSessionBridge {
99 static void Initialize(editor::EditorManager* editor_manager);
119 static std::string
SetState(
const std::string& state_json);
124 static std::string
GetProperty(
const std::string& property_name);
129 static std::string
SetProperty(
const std::string& property_name,
130 const std::string& value);
144 static std::string
SetFeatureFlag(
const std::string& flag_name,
bool value);
197 static editor::EditorManager* editor_manager_;
198 static bool initialized_;
199 static SharedSessionState current_state_;
200 static std::mutex state_mutex_;
201 static std::vector<StateChangeCallback> state_callbacks_;
205 static std::string pending_command_;
206 static std::string pending_result_;
207 static bool command_pending_;
231 std::string
ToJson()
const {
return "{}"; }
245 static std::string
SetState(
const std::string&) {
return "{}"; }
246 static std::string
GetProperty(
const std::string&) {
return "{}"; }
247 static std::string
SetProperty(
const std::string&,
const std::string&) {
return "{}"; }
The EditorManager controls the main editor window and manages the various editor classes.