--- nono/vm/power.h 2026/04/29 17:05:10 1.1 +++ nono/vm/power.h 2026/04/29 17:05:14 1.1.1.2 @@ -11,6 +11,7 @@ #pragma once #include "device.h" +#include "event.h" #include "message.h" class PowerDevice : public Device @@ -20,39 +21,61 @@ class PowerDevice : public Device PowerDevice(); ~PowerDevice() override; - bool Init() override; - - // 電源オンを指示 - // (当然電源オフ時に呼ぶので VM スレッド外から呼ばれることになる) - void MakePowerOn(); + // 電源ボタンを押す + void PowerButton(); // リセットを指示 // (どのスレッドから呼んでもよい) void MakeResetHard(); - // 電源オフして終了を指示 - // (どのスレッドから呼んでもよい) - void MakePowerOffExit(); - // リスタートを指示 // (どのスレッドから呼んでもよい) void MakeRestart(); - // 電源オンなら true を返す。 + // 電源が実際にオンなら true を返す。 bool IsPower() const { return ispower; } + // 電源 LED 点灯なら true を返す。 + bool GetPowerLED() const { return led; } + + // X68030 では電源ボタンが押されていれば true を返す。 + // LUNA では意味を持たないので呼ばないこと。 + bool IsPowerPressed() const { return power_button; } + + void SetAlarmOut(bool alarm_out_); + void SetSystemPowerOn(bool poweron); private: void DoPowerOn(); void DoResetHard(); void DoPowerOff(MessageID); + void DoPowerButton(); // メッセージコールバック - void PowerOnCallback(MessageID, uint32); void ResetCallback(MessageID, uint32); void PowerOffCallback(MessageID, uint32); + void PowerButtonCallback(MessageID, uint32); + + void PowerCallback(Event&); + + void Change(); // 電源オンなら true bool ispower {}; + + // 電源 LED + bool led {}; + + // 電源ボタン状態 + bool power_button {}; + + // ALARM_OUT 信号状態 + bool alarm_out {}; + + // システム内の電源オン信号に相当 + bool system_poweron {}; + + // 電源オフイベント + Event event { this }; }; extern PowerDevice *gPower;