--- nono/wx/wxstatuspanel.cpp 2026/04/29 17:05:44 1.1.1.13 +++ nono/wx/wxstatuspanel.cpp 2026/04/29 17:05:53 1.1.1.15 @@ -25,6 +25,7 @@ #include "wxuimessage.h" #include "fdc.h" #include "hostnet.h" +#include "mpu.h" #include "newsctlr.h" #include "power.h" #include "scsi.h" @@ -237,6 +238,28 @@ WXStatusPanel::~WXStatusPanel() wxCommandEventHandler(WXStatusPanel::OnLEDChanged)); } +// 初期化 +void +WXStatusPanel::Init() +{ + // ここで最初に一回、全メディアの状態更新を能動的に行う。 + for (const auto ind : indicators) { + int id; + id = ind->GetSCSIID(); + if (id >= 0) { + wxCommandEvent event(NONO_EVT_UIMESSAGE); + event.SetInt(id); + OnSCSIMediaChanged(event); + } + id = ind->GetFDUnit(); + if (id >= 0) { + wxCommandEvent event(NONO_EVT_UIMESSAGE); + event.SetInt(id); + OnFDDMediaChanged(event); + } + } +} + // クローズイベント void WXStatusPanel::OnClose(wxCloseEvent& event) @@ -584,8 +607,12 @@ WXStatusPanel::InitIndicators() Indicator *ind; // パフォーマンスカウンタ - ind = new Indicator(Indicator::PERF, &WXStatusPanel::DrawPerf, - 8/* >>>9999% */, NULL); + // 0123456789012345 + // >>> 99.9x 100MHz + auto mpu = gMainApp.FindObject(OBJ_MPU); + assert(mpu); + clock_khz = mpu->GetClockSpeed(); + ind = new Indicator(Indicator::PERF, &WXStatusPanel::DrawPerf, 15, NULL); ind->dclick = &WXStatusPanel::DClickPerf; indicators.emplace_back(ind); @@ -932,6 +959,10 @@ WXStatusPanel::DrawPerf(const Indicator snprintf(text, sizeof(text), "%4u%%", perf_rate); } + // クロックスピード(MHz)も四捨五入。 + uint eff_khz = (clock_khz * perf_rate + 50) / 100; + snprintf(text + 5, sizeof(text) - 5, "%4uMHz", (eff_khz + 500) / 1000); + DrawStringSJIS(UD_RED, rect.x + 2, rect.y + 2, ffmark); DrawStringSJIS(rect.x + 2 + font_width * 3, rect.y + 2, text); } @@ -1250,7 +1281,7 @@ void WXStatusPanel::DClickPerf(const Indicator *ind) { // モードを切り替える - syncer->RequestFullSpeed(!syncer->GetFullSpeed()); + syncer->NotifyFullSpeed(!syncer->GetFullSpeed()); } // コンテキストメニューイベント