--- nono/lib/mainapp.cpp 2026/04/29 17:04:54 1.1.1.8 +++ nono/lib/mainapp.cpp 2026/04/29 17:05:01 1.1.1.10 @@ -23,7 +23,6 @@ MainApp::ShowHelp(bool all) const #define p(msg) printf(" " msg "\n") printf("usage: %s []\n", getprogname()); - p("-A load and execute host binary (a.out or ELF)"); p("-c vm directory or configuration file"); p("-f fast mode"); if (IsGUI()) @@ -36,6 +35,7 @@ MainApp::ShowHelp(bool all) const p("--show-hostnet show list of hostnet drivers"); p("-v show version"); p("-V = overwrite config option"); + p("-X [arg..] load and execute host binary (a.out or ELF)"); if (all) { printf("\n(options for developers)\n"); @@ -44,9 +44,9 @@ MainApp::ShowHelp(bool all) const p("-C output log to console"); p("-d debugger prompt on startup"); p("-D debugger on console"); + p("-H human68k console emulation"); p("-L =[,..] set loglevel (-Lhelp displays names)"); p("-M [,..] monitors to display at startup (-Mhelp displays names)"); - p("-X human68k console emulation"); } } @@ -107,28 +107,24 @@ MainApp::Init1(bool is_cli_, int ac, cha } // 1. VM 種別を決定 - if (IsCLI() && human68k_file) { - vmtype = VMTYPE_RXZ; + // VM 種別文字列から vmtype を決定 + const ConfigItem& item = gConfig->Find("vmtype"); + std::string vmstr = string_tolower(item.AsString()); + if (vmstr == "x68030") { + vmtype = VMTYPE_X68030; + } else if (vmstr == "luna") { + vmtype = VMTYPE_LUNA1; + } else if (vmstr == "luna88k") { + vmtype = VMTYPE_LUNA88K; } else { - // VM 種別文字列から vmtype を決定 - const ConfigItem& item = gConfig->Find("vmtype"); - std::string vmstr = string_tolower(item.AsString()); - if (vmstr == "x68030") { - vmtype = VMTYPE_X68030; - } else if (vmstr == "luna") { - vmtype = VMTYPE_LUNA1; - } else if (vmstr == "luna88k") { - vmtype = VMTYPE_LUNA88K; + if (item.GetFrom() == ConfigItem::FromInitial) { + // 未指定の時 + warnx("vmtype must be specified"); } else { - if (item.GetFrom() == ConfigItem::FromInitial) { - // 未指定の時 - warnx("vmtype must be specified"); - } else { - // ユーザ由来の時 - item.Err("invalid vmtype"); - } - return EXIT_FAILURE; + // ユーザ由来の時 + item.Err("invalid vmtype"); } + return EXIT_FAILURE; } // 2. VM 作成 @@ -141,10 +137,6 @@ MainApp::Init1(bool is_cli_, int ac, cha gVM.reset(new VM_LUNA1()); break; - case VMTYPE_RXZ: - gVM.reset(new VM_RXZ()); - break; - case VMTYPE_LUNA88K: gVM.reset(new VM_LUNA88K()); break; @@ -244,13 +236,9 @@ MainApp::ParseOpt(int ac, char *av[]) screen_scale = 1.0; cpath = "."; - while ((c = getopt_long(ac, av, "A:b:B:c:CdDfhL:M:s:vV:X:", + while ((c = getopt_long(ac, av, "b:B:c:CdDfhHL:M:s:vV:X:", longopts, NULL)) != -1) { switch (c) { - case 'A': - host_file = optarg; - break; - case 'b': debug_breakaddr.push_back(optarg); break; @@ -288,6 +276,10 @@ MainApp::ParseOpt(int ac, char *av[]) fast_mode = true; break; + case 'H': + human_mode = true; + break; + case 'L': if (logopt[0] != '\0') { strlcat(logopt, ",", sizeof(logopt)); @@ -320,12 +312,12 @@ MainApp::ParseOpt(int ac, char *av[]) break; case 'X': - human68k_file = optarg; + exec_file = optarg; for (int i = optind; i < ac; i++) { if (i != optind) { - strlcat(human68k_arg, " ", sizeof(human68k_arg)); + exec_arg += " "; } - strlcat(human68k_arg, av[i], sizeof(human68k_arg)); + exec_arg += av[i]; } optind = ac; break; @@ -409,6 +401,14 @@ MainApp::ParseOpt(int ac, char *av[]) } } + // Human モードでは実行ファイル名が必要 + if (human_mode) { + if (exec_file == NULL) { + warnx("-H option needs -X"); + return false; + } + } + return true; }