--- nono/cli/cli_app.cpp 2026/04/29 17:04:48 1.1.1.5 +++ nono/cli/cli_app.cpp 2026/04/29 17:04:53 1.1.1.7 @@ -8,6 +8,7 @@ #include "mainapp.h" #include "mpu680x0.h" #include "pluto.h" +#include "scheduler.h" #include "vm.h" void cli_halt_callback(void *); @@ -18,7 +19,7 @@ class CLIApp public: int OnInit(); bool Parse(); - [[noreturn]] void OnCreate(); + int OnCreate(); int ac; char **av; @@ -41,14 +42,20 @@ CLIApp::OnInit() { int rv; - rv = gMainApp.Init(true, ac, av); + // CLI 側では関係ないが wx 側で必要なので初期化は2ステージに分かれている + rv = gMainApp.Init1(true, ac, av); if (rv != MainApp::PASS) { return rv; } - if (!gMainApp.Start()) { + if (!gMainApp.Init2()) { return EXIT_FAILURE; } + // VM にコールバックを登録 + if (gMPU680x0) { + gMPU680x0->SetHaltCallback(cli_halt_callback, NULL); + } + // メインウィンドウに相当するところ OnCreate(); @@ -56,21 +63,17 @@ CLIApp::OnInit() } // メインウィンドウ作成後のイベントに相当するところ -void +int CLIApp::OnCreate() { - // VM にコールバックを登録 - if (gMPU680x0) { - gMPU680x0->SetHaltCallback(cli_halt_callback, NULL); - } - - // VM 実行開始 + // 電源投入 gVM->PowerButton(); - // ? - for (;;) { - sleep(1); - } + // スケジューラの終了を待つ + + gScheduler->Wait(); + + return 0; } // m680x0 ダブルバスフォールト時に呼ばれるコールバック。