--- nono/wx/wxapp.cpp 2026/04/29 17:04:45 1.1.1.6 +++ nono/wx/wxapp.cpp 2026/04/29 17:04:53 1.1.1.7 @@ -11,7 +11,7 @@ #include "mainapp.h" #include "mpu680x0.h" #include "mpu88xx0.h" -#include "vm.h" +#include "scheduler.h" #include // イベントタイプの定義 @@ -53,7 +53,7 @@ WXApp::OnRun() { int rv; - rv = gMainApp.Init(false, argc, argv); + rv = gMainApp.Init1(false, argc, argv); if (rv != MainApp::PASS) { return rv; } @@ -83,7 +83,7 @@ WXApp::OnRun() break; default: warnx("invalid fontsize: %d", gMainApp.fontsize); - return false; + return EXIT_FAILURE; } WXTextPanel::global_fontid = fontid; @@ -93,16 +93,22 @@ WXApp::OnRun() // -M 起動時に表示するモニタ if (!gMainApp.monitor_opt.empty()) { if (!ParseMonitors(gMainApp.monitor_opt)) { - return false; + return EXIT_FAILURE; } } // -s screen scale WXMainView::screen_scale = gMainApp.screen_scale; - // 引数処理が終わったので VM 開始。 - if (!gMainApp.Start()) { - return 1; + // 引数処理が終わったので、スレッド作成を伴う初期化。 + if (!gMainApp.Init2()) { + return EXIT_FAILURE; + } + + // VM にコールバックを登録 + gScheduler->SetPowerOffCallback(wxmainframe_poweroff_callback); + if (gMPU680x0) { + gMPU680x0->SetHaltCallback(wxmainframe_halt_callback, this); } // メインウィンドウ