From c6da67a7a37090c931feae0800cee1cf8175bb3b Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 Mar 2023 21:16:02 +0300 Subject: [PATCH] Add SetDoNotScroll --- Core/Video/Display.cpp | 21 +++++++++++++++++++-- Kernel.cpp | 1 + include/display.hpp | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Core/Video/Display.cpp b/Core/Video/Display.cpp index 48be5f5..9d78ce8 100644 --- a/Core/Video/Display.cpp +++ b/Core/Video/Display.cpp @@ -188,6 +188,9 @@ namespace Video return; } + if (this->Buffers[Index].DoNotScroll) + return; + if (Lines == 0) return; @@ -201,6 +204,17 @@ namespace Video } } + void Display::SetDoNotScroll(bool Value, int Index) + { + if (unlikely(this->Buffers[Index].Checksum != 0xDEAD)) + { + debug("Invalid buffer %d", Index); + return; + } + + this->Buffers[Index].DoNotScroll = Value; + } + char Display::Print(char Char, int Index, bool WriteToUART) { if (unlikely(this->Buffers[Index].Checksum != 0xDEAD)) @@ -302,8 +316,11 @@ namespace Video if (this->Buffers[Index].CursorY + FontHeight >= this->Buffers[Index].Height) { - this->Buffers[Index].CursorY -= FontHeight; - this->Scroll(Index, 1); + if (!this->Buffers[Index].DoNotScroll) + { + this->Buffers[Index].CursorY -= FontHeight; + this->Scroll(Index, 1); + } } switch (this->CurrentFont->GetInfo().Type) diff --git a/Kernel.cpp b/Kernel.cpp index e1b8dc6..c136926 100644 --- a/Kernel.cpp +++ b/Kernel.cpp @@ -224,6 +224,7 @@ EXTERNC NIF void Main(BootInfo *Info) { Display->CreateBuffer(0, 0, 1); + Display->SetDoNotScroll(true, 1); Video::ScreenBuffer *buf = Display->GetBuffer(1); Video::FontInfo fi = Display->GetCurrentFont()->GetInfo(); Display->SetBufferCursor(1, 0, buf->Height - fi.Height); diff --git a/include/display.hpp b/include/display.hpp index aae8ee6..bc213a6 100644 --- a/include/display.hpp +++ b/include/display.hpp @@ -84,6 +84,7 @@ namespace Video uint32_t Color; uint32_t CursorX, CursorY; char Brightness; + bool DoNotScroll; long Checksum; }; @@ -135,6 +136,7 @@ namespace Video void SetPixel(uint32_t X, uint32_t Y, uint32_t Color, int Index); uint32_t GetPixel(uint32_t X, uint32_t Y, int Index); void Scroll(int Index, int Lines); + void SetDoNotScroll(bool Value, int Index); char Print(char Char, int Index, bool WriteToUART = false); void DrawString(const char *String, uint32_t X, uint32_t Y, int Index, bool WriteToUART = false);