--- nono/vm/crtc2.cpp 2026/04/29 17:05:37 1.1.1.14 +++ nono/vm/crtc2.cpp 2026/04/29 17:05:50 1.1.1.16 @@ -9,6 +9,7 @@ // #include "crtc2.h" +#include "event.h" #include "lunafb.h" #include "renderer.h" #include "scheduler.h" @@ -31,9 +32,10 @@ CRTC2Device::Init() lunafb = GetLunafbDevice(); renderer = GetRenderer(); - vdisp_event.func = ToEventCallback(&CRTC2Device::VDispCallback); - vdisp_event.SetName("CRTC2 V-DISP"); - scheduler->RegistEvent(vdisp_event); + auto evman = GetEventManager(); + vdisp_event = evman->Regist(this, + ToEventCallback(&CRTC2Device::VDispCallback), + "CRTC2 V-DISP"); return true; } @@ -52,8 +54,8 @@ CRTC2Device::ResetHard(bool poweron) // XXX 適当 // すぐに垂直帰線期間を開始する - vdisp_event.time = 0; - vdisp_event.code = 1; + vdisp_state = 1; + vdisp_event->time = 0; scheduler->RestartEvent(vdisp_event); } @@ -162,14 +164,12 @@ CRTC2Device::PokePort(uint32 offset, uin } // 垂直表示・帰線イベント -// ev.code が 1 なら表示期間開始(V-disp)、0 なら帰線期間開始(V-blank)。 +// vdisp_state が 1 なら表示期間開始(V-disp)、0 なら帰線期間開始(V-blank)。 void -CRTC2Device::VDispCallback(Event& ev) +CRTC2Device::VDispCallback(Event *ev) { - int& vdisp = ev.code; - // 今はここで1画面まるごと作成 - if (vdisp) { + if (vdisp_state) { // 更新の必要があれば Render に作画指示。 if (lunafb->Snap()) { renderer->NotifyRender(); @@ -178,14 +178,14 @@ CRTC2Device::VDispCallback(Event& ev) // 次のタイミングを計算 // XXX まだ CRTC から計算していない - if (vdisp) { + if (vdisp_state) { // 垂直表示期間 - ev.time = 16234.496_usec; // 1024*Ht - ev.code = 0; + ev->time = 16234.496_usec; // 1024*Ht + vdisp_state = 0; } else { // 垂直帰線期間 - ev.time = 507.328_usec; // 32*Ht - ev.code = 1; + ev->time = 507.328_usec; // 32*Ht + vdisp_state = 1; } scheduler->StartEvent(ev); }