--- nono/lib/mainapp.h 2026/04/29 17:04:30 1.1.1.2 +++ nono/lib/mainapp.h 2026/04/29 17:04:48 1.1.1.6 @@ -1,6 +1,7 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once @@ -15,8 +16,12 @@ class MainApp { public: + // Init() の戻り値 + static const int PASS = -1; // 実行を継続 + + public: // 初期化 - bool Init(bool is_cli_, int ac, char *av[]); + int Init(bool is_cli_, int ac, char *av[]); // VM 実行開始 bool Start(); @@ -27,34 +32,38 @@ class MainApp // (Config が持っているのは文字列) vmtype_t GetVMType() const { return vmtype; } + // 現在の VM が指定の feature を持っているか? + bool HasVMFeature(vmf_t flag) const; + public: // -A: ホストファイル名 (とりあえず) - const char *host_file = NULL; + const char *host_file {}; - // -b: ブレークポイント - uint32 debug_breakaddr = 0; + // -b: ブレークポイント "[,]" + std::vector debug_breakaddr {}; // -B: ベンチマークモード - int benchmark_mode = 0; + int benchmark_mode {}; - // -c: VM ディレクトリ + // -c: VM ディレクトリ or 設定ファイル std::string vmdir {}; + std::string vmfile {}; const std::string& GetVMDir() const { return vmdir; } // -C: ログをコンソールに出力 - bool log_to_console = false; + bool log_to_console {}; // -d: 起動時にデバッガで停止 - bool debug_on_start = false; + bool debug_on_start {}; // -D: コンソールをデバッガで使う - bool debug_on_console = false; + bool debug_on_console {}; // -f: 高速モード (XXX 設定ファイルと含めて見直すこと) - bool fast_mode = false; + bool fast_mode {}; // --fontsize: フォントサイズ指定値 (値は fontsize_t ではない) - int fontsize = 0; + int fontsize {}; // -L: ログ指定文字列 char logopt[256] {}; @@ -63,16 +72,16 @@ class MainApp std::string monitor_opt {}; // -s,--scale: 画面スケール - double screen_scale = 0.0; + double screen_scale {}; - // --show-config: 設定内容を表示 - bool show_config {}; + // --show-config: 設定内容を表示 (1なら通常、2ならall) + int show_config {}; // -V: パラメータ指定 - std::vector config_options; + std::vector config_options {}; // -X: Human68k 実行ファイル名と引数 - const char *human68k_file = NULL; + const char *human68k_file {}; char human68k_arg[256] {}; private: @@ -91,7 +100,7 @@ class MainApp // CLI/GUI 区別 bool IsCLI() const { return is_cli; } bool IsGUI() const { return !is_cli; } - bool is_cli; + bool is_cli {}; // VM 種別 vmtype_t vmtype {};