#include <set>#include <thread>#include <chrono>#include <fstream>#include <iostream>#include "absl/debugging/symbolize.h"#include "absl/strings/ascii.h"#include "absl/strings/str_split.h"#include "absl/strings/strip.h"#include "app/application.h"#include "app/startup_flags.h"#include "app/controller.h"#include "app/editor/editor_manager.h"#include "app/emu/debug/symbol_provider.h"#include "core/features.h"#include "util/crash_handler.h"#include "util/flag.h"#include "util/log.h"#include "util/platform_paths.h"#include "yaze.h"Go to the source code of this file.
Namespaces | |
| namespace | yaze |
| namespace | yaze::emu |
| SNES Emulation and debugging tools. | |
| namespace | yaze::editor |
| Editors are the view controllers for the application. | |
| namespace | yaze::app |
| namespace | anonymous_namespace{main.cc} |
Macros | |
| #define | IMGUI_DEFINE_MATH_OPERATORS |
Functions | |
| DEFINE_FLAG (std::string, log_file, "", "Output log file path for debugging.") | |
| DEFINE_FLAG (std::string, rom_file, "", "ROM file to load on startup.") | |
| DEFINE_FLAG (bool, debug, false, "Enable debug logging and verbose output.") | |
| DEFINE_FLAG (std::string, log_level, "info", "Minimum log level: debug, info, warn, error, or fatal.") | |
| DEFINE_FLAG (bool, log_to_console, false, "Mirror logs to stderr even when writing to a file.") | |
| DEFINE_FLAG (std::string, log_categories, "", "Comma-separated list of log categories to enable or disable. " "Prefix with '-' to disable a category. " "Example: \"Room,DungeonEditor\" (allowlist) or \"-Input,-Graphics\" " "(blocklist).") | |
| DEFINE_FLAG (std::string, editor, "", "The editor to open on startup (e.g., Dungeon, Overworld, Assembly).") | |
| DEFINE_FLAG (std::string, open_panels, "", "Comma-separated list of panel IDs to open (e.g. 'dungeon.room_list,emulator.cpu_debugger')") | |
| DEFINE_FLAG (std::string, startup_welcome, "auto", "Welcome screen behavior at startup: auto, show, or hide.") | |
| DEFINE_FLAG (std::string, startup_dashboard, "auto", "Dashboard panel behavior at startup: auto, show, or hide.") | |
| DEFINE_FLAG (std::string, startup_sidebar, "auto", "Panel sidebar visibility at startup: auto, show, or hide.") | |
| DEFINE_FLAG (std::string, asset_mode, "auto", "Asset load mode: auto, full, or lazy.") | |
| DEFINE_FLAG (int, room, -1, "Open Dungeon Editor at specific room ID (0-295).") | |
| DEFINE_FLAG (int, map, -1, "Open Overworld Editor at specific map ID (0-159).") | |
| DEFINE_FLAG (bool, enable_api, false, "Enable the AI Agent API server.") | |
| DEFINE_FLAG (int, api_port, 8080, "Port for the AI Agent API server.") | |
| DEFINE_FLAG (bool, headless, false, "Run in headless mode without a GUI window.") | |
| DEFINE_FLAG (bool, service, false, "Run in service mode (GUI backend initialized but window hidden).") | |
| DEFINE_FLAG (bool, server, false, "Run in server mode (implies --enable_api, --enable_test_harness). Defaults to --headless unless --service or --no-headless is specified.") | |
| DEFINE_FLAG (std::string, export_symbols, "", "Export symbols to file (requires --rom_file).") | |
| DEFINE_FLAG (std::string, symbol_format, "mesen", "Format for symbol export: mesen, wla, asar, bsnes.") | |
| DEFINE_FLAG (std::string, load_symbols, "", "Load symbol file (.mlb, .sym, .asm) on startup.") | |
| DEFINE_FLAG (std::string, load_asar_symbols, "", "Load Asar symbols from directory on startup.") | |
| DEFINE_FLAG (bool, export_symbols_fast, false, "Export symbols without initializing UI. Requires --load_symbols or --load_asar_symbols.") | |
| yaze::emu::Emulator * | yaze::app::GetGlobalEmulator () |
| yaze::editor::EditorManager * | yaze::app::GetGlobalEditorManager () |
| yaze::util::LogLevel | anonymous_namespace{main.cc}::ParseLogLevelFlag (const std::string &raw_level, bool debug_flag) |
| std::set< std::string > | anonymous_namespace{main.cc}::ParseLogCategories (const std::string &raw) |
| const char * | anonymous_namespace{main.cc}::LogLevelToString (yaze::util::LogLevel level) |
| std::vector< std::string > | anonymous_namespace{main.cc}::ParseCommaList (const std::string &raw) |
| void | TickFrame () |
| void | SetupCrashHandling () |
| yaze::util::LogLevel | ResolveLogConfig (bool debug_flag, bool log_to_console_flag) |
| yaze::AppConfig | BuildAppConfig (yaze::util::LogLevel log_level, std::string log_path) |
| bool | RunSymbolExportFastPath () |
| int | main (int argc, char **argv) |
| DEFINE_FLAG | ( | std::string | , |
| log_file | , | ||
| "" | , | ||
| "Output log file path for debugging." | ) |
| DEFINE_FLAG | ( | std::string | , |
| rom_file | , | ||
| "" | , | ||
| "ROM file to load on startup." | ) |
| DEFINE_FLAG | ( | bool | , |
| debug | , | ||
| false | , | ||
| "Enable debug logging and verbose output." | ) |
| DEFINE_FLAG | ( | std::string | , |
| log_level | , | ||
| "info" | , | ||
| "Minimum log level: | debug, | ||
| info | , | ||
| warn | , | ||
| error | , | ||
| or fatal." | ) |
| DEFINE_FLAG | ( | bool | , |
| log_to_console | , | ||
| false | , | ||
| "Mirror logs to stderr even when writing to a file." | ) |
| DEFINE_FLAG | ( | std::string | , |
| log_categories | , | ||
| "" | , | ||
| "Comma-separated list of log categories to enable or disable. " "Prefix with '-' to disable a category. " "Example: \" | Room, | ||
| DungeonEditor\" (allowlist) or \"- | Input, | ||
| -Graphics\" " "(blocklist)." | ) |
| DEFINE_FLAG | ( | std::string | , |
| editor | , | ||
| "" | , | ||
| "The editor to open on startup (e.g., Dungeon, Overworld, Assembly)." | ) |
| DEFINE_FLAG | ( | std::string | , |
| open_panels | , | ||
| "" | , | ||
| "Comma-separated list of panel IDs to open (e.g. 'dungeon.room_list,emulator.cpu_debugger')" | ) |
| DEFINE_FLAG | ( | std::string | , |
| startup_welcome | , | ||
| "auto" | , | ||
| "Welcome screen behavior at startup: | auto, | ||
| show | , | ||
| or hide." | ) |
| DEFINE_FLAG | ( | std::string | , |
| startup_dashboard | , | ||
| "auto" | , | ||
| "Dashboard panel behavior at startup: | auto, | ||
| show | , | ||
| or hide." | ) |
| DEFINE_FLAG | ( | std::string | , |
| startup_sidebar | , | ||
| "auto" | , | ||
| "Panel sidebar visibility at startup: | auto, | ||
| show | , | ||
| or hide." | ) |
| DEFINE_FLAG | ( | std::string | , |
| asset_mode | , | ||
| "auto" | , | ||
| "Asset load mode: | auto, | ||
| full | , | ||
| or lazy." | ) |
| DEFINE_FLAG | ( | int | , |
| room | , | ||
| - | 1, | ||
| "Open Dungeon Editor at specific room ID (0-295)." | ) |
| DEFINE_FLAG | ( | int | , |
| map | , | ||
| - | 1, | ||
| "Open Overworld Editor at specific map ID (0-159)." | ) |
| DEFINE_FLAG | ( | bool | , |
| enable_api | , | ||
| false | , | ||
| "Enable the AI Agent API server." | ) |
| DEFINE_FLAG | ( | int | , |
| api_port | , | ||
| 8080 | , | ||
| "Port for the AI Agent API server." | ) |
| DEFINE_FLAG | ( | bool | , |
| headless | , | ||
| false | , | ||
| "Run in headless mode without a GUI window." | ) |
| DEFINE_FLAG | ( | bool | , |
| service | , | ||
| false | , | ||
| "Run in service mode (GUI backend initialized but window hidden)." | ) |
| DEFINE_FLAG | ( | bool | , |
| server | , | ||
| false | , | ||
| "Run in server mode (implies --enable_api, --enable_test_harness). Defaults to --headless unless --service or --no-headless is specified." | ) |
| DEFINE_FLAG | ( | std::string | , |
| export_symbols | , | ||
| "" | , | ||
| "Export symbols to file (requires --rom_file)." | ) |
| DEFINE_FLAG | ( | std::string | , |
| symbol_format | , | ||
| "mesen" | , | ||
| "Format for symbol export: | mesen, | ||
| wla | , | ||
| asar | , | ||
| bsnes." | ) |
| DEFINE_FLAG | ( | std::string | , |
| load_symbols | , | ||
| "" | , | ||
| "Load symbol file (.mlb, .sym, .asm) on startup." | ) |
| DEFINE_FLAG | ( | std::string | , |
| load_asar_symbols | , | ||
| "" | , | ||
| "Load Asar symbols from directory on startup." | ) |
| DEFINE_FLAG | ( | bool | , |
| export_symbols_fast | , | ||
| false | , | ||
| "Export symbols without initializing UI. Requires --load_symbols or --load_asar_symbols." | ) |
| void TickFrame | ( | ) |
Definition at line 197 of file main.cc.
References yaze::Application::Instance(), and yaze::Application::Tick().
Referenced by main().

| void SetupCrashHandling | ( | ) |
Definition at line 203 of file main.cc.
References yaze::util::CrashHandler::CleanupOldLogs(), yaze::util::CrashHandler::Initialize(), and YAZE_VERSION_STRING.
Referenced by main().

| yaze::util::LogLevel ResolveLogConfig | ( | bool | debug_flag, |
| bool | log_to_console_flag ) |
Definition at line 210 of file main.cc.
References yaze::util::LogManager::configure(), yaze::core::FeatureFlags::get(), yaze::util::PlatformPaths::GetAppDataSubdirectory(), yaze::util::LogManager::instance(), yaze::core::FeatureFlags::Flags::kLogToConsole, LOG_INFO, anonymous_namespace{main.cc}::LogLevelToString(), anonymous_namespace{main.cc}::ParseLogCategories(), and anonymous_namespace{main.cc}::ParseLogLevelFlag().
Referenced by main().
| yaze::AppConfig BuildAppConfig | ( | yaze::util::LogLevel | log_level, |
| std::string | log_path ) |
Definition at line 242 of file main.cc.
References yaze::AppConfig::api_port, yaze::AppConfig::asset_load_mode, yaze::AssetLoadModeFromString(), yaze::AppConfig::backend, yaze::AppConfig::dashboard_mode, yaze::AppConfig::debug, yaze::AppConfig::enable_api, yaze::AppConfig::enable_test_harness, yaze::AppConfig::headless, yaze::AppConfig::jump_to_map, yaze::AppConfig::jump_to_room, yaze::kAuto, yaze::kFull, yaze::kLazy, yaze::AppConfig::log_categories, yaze::AppConfig::log_file, yaze::AppConfig::open_panels, anonymous_namespace{main.cc}::ParseCommaList(), yaze::AppConfig::rom_file, yaze::AppConfig::service_mode, yaze::AppConfig::sidebar_mode, yaze::AppConfig::startup_editor, yaze::StartupVisibilityFromString(), yaze::AppConfig::test_harness_port, yaze::AppConfig::welcome_mode, and yaze::util::YAZE_DEBUG.
Referenced by main().

| bool RunSymbolExportFastPath | ( | ) |
Definition at line 287 of file main.cc.
References yaze::emu::debug::SymbolProvider::ExportSymbols(), yaze::emu::debug::kAsar, yaze::emu::debug::kBsnes, yaze::emu::debug::kMesen, yaze::emu::debug::kWlaDx, yaze::emu::debug::SymbolProvider::LoadAsarAsmDirectory(), yaze::emu::debug::SymbolProvider::LoadSymbolFile(), LOG_ERROR, and LOG_INFO.
Referenced by main().

| int main | ( | int | argc, |
| char ** | argv ) |
Definition at line 383 of file main.cc.
References BuildAppConfig(), yaze::Controller::editor_manager(), yaze::editor::EditorManager::emulator(), yaze::AppConfig::enable_api, yaze::util::PlatformPaths::GetAppDataSubdirectory(), yaze::Application::GetController(), yaze::util::global_flag_registry(), yaze::AppConfig::headless, yaze::Application::Initialize(), yaze::Application::Instance(), yaze::emu::debug::kAsar, yaze::emu::debug::kBsnes, yaze::emu::debug::kMesen, yaze::emu::debug::kWlaDx, LOG_ERROR, LOG_INFO, LOG_WARN, yaze::util::FlagParser::Parse(), ResolveLogConfig(), RETURN_IF_EXCEPTION, RunSymbolExportFastPath(), yaze::AppConfig::service_mode, SetupCrashHandling(), yaze::Application::Shutdown(), yaze::Application::Tick(), and TickFrame().