--- nono/lib/mainapp.cpp 2026/04/29 17:04:34 1.1.1.3 +++ nono/lib/mainapp.cpp 2026/04/29 17:04:40 1.1.1.5 @@ -25,7 +25,7 @@ MainApp::ShowHelp(bool all) const p("-c vm directory"); p("-f fast mode"); if (IsGUI()) - p("--fontsize fontsize in monitors {12,16,24} (default:12)"); + p("--fontsize fontsize in monitors {12,16} (default:12)"); p("-h show brief help message"); p("--help show all help message including for developers"); if (IsGUI()) @@ -36,7 +36,7 @@ MainApp::ShowHelp(bool all) const if (all) { printf("\n(options for developers)\n"); - p("-b breakpoint"); + p("-b [,] set breakpoint"); p("-B benchmark mode"); p("-C output log to console"); p("-d debugger prompt on startup"); @@ -67,13 +67,16 @@ static struct option longopts[] = { // 起動時の処理、VM の実行開始前まで。 // 所々 CLI と GUI で処理が違う。 -bool +// 戻り値は以下のいずれか。 +// MainApp::PASS .. 実行を継続(通常パス) +// EXIT_SUCCESS / EXIT_FAILURE .. この終了コードでアプリケーションを終了 +int MainApp::Init(bool is_cli_, int ac, char *av[]) { is_cli = is_cli_; if (!ParseOpt(ac, av)) { - return false; + return EXIT_FAILURE; } // ログ機構は引数処理後なるはや @@ -87,14 +90,14 @@ MainApp::Init(bool is_cli_, int ac, char // 引数で指定されたディレクトリの設定ファイルを読み込んで設定を更新 ConfigFile file(vmdir + "nono.cfg"); if (file.Load() == false) { - return false; + return EXIT_FAILURE; } if (gConfig->Update(file) == false) { - return false; + return EXIT_FAILURE; } // 最後にコマンドライン引数で更新 if (gConfig->Update(config_options) == false) { - return false; + return EXIT_FAILURE; } // VM 種別を決定 @@ -118,7 +121,7 @@ MainApp::Init(bool is_cli_, int ac, char // ユーザ由来の時 item.Err("invalid vmtype"); } - return false; + return EXIT_FAILURE; } } @@ -144,25 +147,27 @@ MainApp::Init(bool is_cli_, int ac, char __unreachable(); } - // 設定内容表示 - // (MPU コンストラクタでクロック数の初期値を決めるため、その後で表示) + // 動的なコンストラクション + if (!gVM->Create()) { + return EXIT_FAILURE; + } + + // 設定内容を表示して終了 + // (VM コンストラクタで変数の増減があるのでそれより後、 + // Create() でも SCSI パラメータを減らすので、それより後) gConfig->Fix(); if (show_config) { gConfig->Show(show_config - 1); - } - - // 動的なコンストラクション - if (!gVM->Create()) { - return false; + return EXIT_SUCCESS; } // ログレベルを設定。コンストラクト後すぐに行う。 // -L help もここで処理。 if (!ParseLogopt()) { - return false; + return EXIT_FAILURE; } - return true; + return PASS; } // VM の実行部分。 @@ -198,7 +203,6 @@ MainApp::ParseOpt(int ac, char *av[]) { int b; int c; - uint32 u; fontsize = 12; screen_scale = 1.0; @@ -211,8 +215,7 @@ MainApp::ParseOpt(int ac, char *av[]) break; case 'b': - u = (uint32)strtoul(optarg, NULL, 16); - debug_breakaddr.push_back(u); + debug_breakaddr.push_back(optarg); break; case 'B':