--- nono/vm/power.cpp 2026/04/29 17:05:24 1.1.1.4 +++ nono/vm/power.cpp 2026/04/29 17:05:37 1.1.1.6 @@ -34,10 +34,6 @@ PowerDevice::~PowerDevice() bool PowerDevice::Init() { - if (inherited::Init() == false) { - return false; - } - syncer = GetSyncer(); scheduler->ConnectMessage(MessageID::RESET, this, @@ -201,7 +197,7 @@ PowerDevice::GetPowerButtonState() const void PowerDevice::SetSystemPowerOn(bool poweron) { - assert("PowerDevice::SetSystemPowerOn should not be called."); + assertmsg(false, "PowerDevice::SetSystemPowerOn should not be called."); } @@ -223,9 +219,6 @@ PowerDevice::SetSystemPowerOn(bool power LunaPowerDevice::LunaPowerDevice() : inherited() { - event.func = ToEventCallback(&LunaPowerDevice::PowerCallback); - event.time = 1_msec; - event.Regist("Power Off"); } // デストラクタ @@ -233,6 +226,22 @@ LunaPowerDevice::~LunaPowerDevice() { } +// 初期化 +bool +LunaPowerDevice::Init() +{ + if (inherited::Init() == false) { + return false; + } + + event.func = ToEventCallback(&LunaPowerDevice::PowerCallback); + event.time = 1_msec; + event.SetName("Power Off"); + scheduler->RegistEvent(event); + + return true; +} + // PIO1 の PC4 が繋がっているということにする。 void LunaPowerDevice::SetSystemPowerOn(bool poweron) @@ -325,7 +334,7 @@ X68030PowerDevice::Change() { bool old_power = ispower; bool new_power = power_button | alarm_out | system_poweron; - putlog(1, "Change: old=%d new=%d (button=%d alarm=%d system=%d)", + putlog(1, "Change: old=%u new=%u (button=%u alarm=%u system=%u)", old_power, new_power, power_button, alarm_out, system_poweron); if (old_power == false && new_power) {