--- nono/vm/console.h 2026/04/29 17:05:33 1.1 +++ nono/vm/console.h 2026/04/29 17:05:46 1.1.1.2 @@ -18,7 +18,7 @@ class BitmapRGBX; class COMDriver; -class COMDriverCons; +class COMDriverConsole; class ConsoleDevice : public Device { @@ -63,12 +63,15 @@ class ConsoleDevice : public Device void ResetHard(bool poweron) override; void Attach(COMDriver *); + void Detach() { Attach(NULL); } + void Putchar(uint32); bool Render(BitmapRGBX& dst); private: void VSyncCallback(Event&); + void SetPalette(bool console_is_active); void ResetTerminal(); void ResetState(); void PutcharPlain(uint32); @@ -130,6 +133,10 @@ class ConsoleDevice : public Device // 現在の属性。 uint32 cur_attr {}; + // パレット。 + // [0..1] だと通常色、[1..2] だと反転色になる。 + Color palette[3] {}; + // 現在の1文字前までのエスケープシーケンス。(現在の文字は ch) std::vector seq {}; // パラメータ部分。 @@ -153,7 +160,6 @@ class ConsoleDevice : public Device COMDriver *comdriver {}; static const uint8 decsg8x16[15 * font_height]; - static const Color palette[3]; }; // 入力担当デバイス @@ -164,12 +170,13 @@ class ConsoleKeyboard : public DumbKeybo ConsoleKeyboard(); ~ConsoleKeyboard() override; - void Attach(COMDriverCons *); + void Attach(COMDriverConsole *); + void Detach() { Attach(NULL); } void CharInput(uint charcode) override; private: - COMDriverCons *comdriver {}; + COMDriverConsole *comdriver {}; }; static inline ConsoleDevice *GetConsoleDevice() {