[FREELDR:XBOX/UEFI] No need for a specific ScrollUp routine, just call the VidFb one (#8509)

And use the console `CurrentAttr` for screen filling, instead of
hardcoding it to white-on-black.
This commit is contained in:
Hermès Bélusca-Maïto
2025-12-18 16:54:42 +01:00
parent d1445c8e69
commit ea90485339
8 changed files with 17 additions and 29 deletions

View File

@@ -17,10 +17,13 @@
*/
#include <freeldr.h>
#include "../../vidfb.h"
UCHAR MachDefaultTextColor = COLOR_GRAY;
static unsigned CurrentCursorX = 0;
static unsigned CurrentCursorY = 0;
static unsigned CurrentAttr = 0x0f;
static UCHAR CurrentAttr = ATTR(COLOR_GRAY, COLOR_BLACK);
VOID
XboxConsPutChar(int c)
@@ -33,7 +36,7 @@ XboxConsPutChar(int c)
NeedScroll = (CurrentCursorY >= Height);
if (NeedScroll)
{
XboxVideoScrollUp();
VidFbScrollUp(CurrentAttr);
--CurrentCursorY;
}

View File

@@ -31,16 +31,8 @@ ULONG FrameBufferSize;
extern multiboot_info_t * MultibootInfoPtr;
#define FB_SIZE_MB 4
UCHAR MachDefaultTextColor = COLOR_GRAY;
#define MAKE_COLOR(Red, Green, Blue) (0xff000000 | (((Red) & 0xff) << 16) | (((Green) & 0xff) << 8) | ((Blue) & 0xff))
VOID
XboxVideoScrollUp(VOID)
{
VidFbScrollUp();
}
VOID
XboxVideoClearScreen(UCHAR Attr)
{

View File

@@ -6,13 +6,17 @@
*/
#include <uefildr.h>
#include "../vidfb.h"
/* GLOBALS ********************************************************************/
extern EFI_SYSTEM_TABLE* GlobalSystemTable;
UCHAR MachDefaultTextColor = COLOR_GRAY;
static unsigned CurrentCursorX = 0;
static unsigned CurrentCursorY = 0;
static unsigned CurrentAttr = 0x0f;
static UCHAR CurrentAttr = ATTR(COLOR_GRAY, COLOR_BLACK);
extern EFI_SYSTEM_TABLE* GlobalSystemTable;
static EFI_INPUT_KEY Key;
static BOOLEAN ExtendedKey = FALSE;
static char ExtendedScanCode = 0;
@@ -30,7 +34,7 @@ UefiConsPutChar(int c)
NeedScroll = (CurrentCursorY >= Height);
if (NeedScroll)
{
UefiVideoScrollUp();
VidFbScrollUp(CurrentAttr);
--CurrentCursorY;
}
if (c == '\r')
@@ -40,7 +44,6 @@ UefiConsPutChar(int c)
else if (c == '\n')
{
CurrentCursorX = 0;
if (!NeedScroll)
++CurrentCursorY;
}

View File

@@ -15,8 +15,6 @@ DBG_DEFAULT_CHANNEL(UI);
extern EFI_SYSTEM_TABLE* GlobalSystemTable;
extern EFI_HANDLE GlobalImageHandle;
UCHAR MachDefaultTextColor = COLOR_GRAY;
EFI_GUID EfiGraphicsOutputProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
#define LOWEST_SUPPORTED_RES 1
@@ -109,12 +107,6 @@ UefiVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
VidFbCopyOffScreenBufferToVRAM(Buffer);
}
VOID
UefiVideoScrollUp(VOID)
{
VidFbScrollUp();
}
VOID
UefiVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
{

View File

@@ -247,7 +247,8 @@ VidFbCopyOffScreenBufferToVRAM(
}
VOID
VidFbScrollUp(VOID)
VidFbScrollUp(
_In_ UCHAR Attr)
{
UINT32 BgColor, Dummy;
ULONG PixelCount = framebufInfo.ScreenWidth * CHAR_HEIGHT *
@@ -255,7 +256,7 @@ VidFbScrollUp(VOID)
PUINT32 Src = (PUINT32)((PUCHAR)framebufInfo.BaseAddress + (CHAR_HEIGHT + TOP_BOTTOM_LINES) * framebufInfo.Delta);
PUINT32 Dst = (PUINT32)((PUCHAR)framebufInfo.BaseAddress + TOP_BOTTOM_LINES * framebufInfo.Delta);
VidFbAttrToColors(ATTR(COLOR_WHITE, COLOR_BLACK), &Dummy, &BgColor);
VidFbAttrToColors(Attr, &Dummy, &BgColor);
while (PixelCount--)
*Dst++ = *Src++;

View File

@@ -54,7 +54,8 @@ VidFbCopyOffScreenBufferToVRAM(
_In_ PVOID Buffer);
VOID
VidFbScrollUp(VOID);
VidFbScrollUp(
_In_ UCHAR Attr);
#if 0
VOID

View File

@@ -43,7 +43,6 @@ VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
VOID XboxVideoSync(VOID);
VOID XboxVideoPrepareForReactOS(VOID);
VOID XboxVideoScrollUp(VOID);
VOID XboxPrepareForReactOS(VOID);
VOID XboxMemInit(VOID);

View File

@@ -107,6 +107,3 @@ UefiHwIdle(VOID);
VOID
UefiInitializeFileSystemSupport(_In_ EFI_HANDLE ImageHandle,
_In_ EFI_SYSTEM_TABLE *SystemTable);
VOID
UefiVideoScrollUp(VOID);