yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
application.h
Go to the documentation of this file.
1#ifndef YAZE_APP_APPLICATION_H_
2#define YAZE_APP_APPLICATION_H_
3
4#include <memory>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "app/controller.h"
10#include "app/startup_flags.h"
11#include "yaze_config.h"
12
13#ifdef YAZE_WITH_GRPC
17#endif
18
19namespace yaze {
20
24struct AppConfig {
25 // File loading
26 std::string rom_file;
27 std::string log_file;
28 bool debug = false;
29 std::string log_categories;
33
34 // Startup navigation
35 std::string startup_editor; // Editor to open (e.g., "Dungeon")
36 std::vector<std::string> open_panels; // Panel IDs to show (e.g., "dungeon.room_list")
37
38 // Jump targets
39 int jump_to_room = -1; // Dungeon room ID (-1 to ignore)
40 int jump_to_map = -1; // Overworld map ID (-1 to ignore)
41
42 // Services
43 bool enable_api = false;
44 int api_port = 8080;
45 bool enable_test_harness = false;
46 int test_harness_port = 50052; // GUI automation (50052), AgentControlServer uses 50051
47};
48
54 public:
55 static Application& Instance();
56
57 // Initialize the application with configuration
58 void Initialize(const AppConfig& config);
59
60 // Default initialization (empty config)
62
63 // Main loop tick
64 void Tick();
65
66 // Shutdown application
67 void Shutdown();
68
69 // Unified ROM loading
70 void LoadRom(const std::string& path);
71
72 // Accessors
74 bool IsReady() const { return controller_ != nullptr; }
75 const AppConfig& GetConfig() const { return config_; }
76
77 private:
78 Application() = default;
79 ~Application() = default;
80
81 // Non-copyable
82 Application(const Application&) = delete;
84
85 std::unique_ptr<Controller> controller_;
87
88#ifndef __EMSCRIPTEN__
89 // For non-WASM builds, we need a local queue for ROMs requested before
90 // the controller is initialized.
91 std::string pending_rom_;
92#endif
93
94 // Helper to run startup actions (jumps, card opening) after ROM load
95 void RunStartupActions();
96
97#ifdef YAZE_WITH_GRPC
98 std::unique_ptr<YazeGRPCServer> grpc_server_;
99 std::unique_ptr<CanvasAutomationServiceImpl> canvas_automation_service_;
100 std::unique_ptr<yaze::agent::AgentControlServer> agent_control_server_;
101#endif
102};
103
104} // namespace yaze
105
106#endif // YAZE_APP_APPLICATION_H_
Main application singleton managing lifecycle and global state.
Definition application.h:53
Application & operator=(const Application &)=delete
std::string pending_rom_
Definition application.h:91
Application(const Application &)=delete
AppConfig config_
Definition application.h:86
Controller * GetController()
Definition application.h:73
static Application & Instance()
Application()=default
std::unique_ptr< Controller > controller_
Definition application.h:85
~Application()=default
const AppConfig & GetConfig() const
Definition application.h:75
void LoadRom(const std::string &path)
bool IsReady() const
Definition application.h:74
Main controller for the application.
Definition controller.h:32
StartupVisibility
Tri-state toggle used for startup UI visibility controls.
Configuration options for the application startup.
Definition application.h:24
std::string rom_file
Definition application.h:26
std::string startup_editor
Definition application.h:35
std::string log_categories
Definition application.h:29
StartupVisibility welcome_mode
Definition application.h:30
std::vector< std::string > open_panels
Definition application.h:36
StartupVisibility sidebar_mode
Definition application.h:32
bool enable_test_harness
Definition application.h:45
std::string log_file
Definition application.h:27
StartupVisibility dashboard_mode
Definition application.h:31