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