Skip to content

Commit ea90485

Browse files
committed
[FREELDR:XBOX/UEFI] No need for a specific ScrollUp routine, just call the VidFb one (reactos#8509)
And use the console `CurrentAttr` for screen filling, instead of hardcoding it to white-on-black.
1 parent d1445c8 commit ea90485

File tree

8 files changed

+17
-29
lines changed

8 files changed

+17
-29
lines changed

boot/freeldr/freeldr/arch/i386/xbox/xboxcons.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
*/
1818

1919
#include <freeldr.h>
20+
#include "../../vidfb.h"
21+
22+
UCHAR MachDefaultTextColor = COLOR_GRAY;
2023

2124
static unsigned CurrentCursorX = 0;
2225
static unsigned CurrentCursorY = 0;
23-
static unsigned CurrentAttr = 0x0f;
26+
static UCHAR CurrentAttr = ATTR(COLOR_GRAY, COLOR_BLACK);
2427

2528
VOID
2629
XboxConsPutChar(int c)
@@ -33,7 +36,7 @@ XboxConsPutChar(int c)
3336
NeedScroll = (CurrentCursorY >= Height);
3437
if (NeedScroll)
3538
{
36-
XboxVideoScrollUp();
39+
VidFbScrollUp(CurrentAttr);
3740
--CurrentCursorY;
3841
}
3942

boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,8 @@ ULONG FrameBufferSize;
3131
extern multiboot_info_t * MultibootInfoPtr;
3232
#define FB_SIZE_MB 4
3333

34-
UCHAR MachDefaultTextColor = COLOR_GRAY;
35-
3634
#define MAKE_COLOR(Red, Green, Blue) (0xff000000 | (((Red) & 0xff) << 16) | (((Green) & 0xff) << 8) | ((Blue) & 0xff))
3735

38-
VOID
39-
XboxVideoScrollUp(VOID)
40-
{
41-
VidFbScrollUp();
42-
}
43-
4436
VOID
4537
XboxVideoClearScreen(UCHAR Attr)
4638
{

boot/freeldr/freeldr/arch/uefi/ueficon.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
*/
77

88
#include <uefildr.h>
9+
#include "../vidfb.h"
910

1011
/* GLOBALS ********************************************************************/
1112

12-
extern EFI_SYSTEM_TABLE* GlobalSystemTable;
13+
UCHAR MachDefaultTextColor = COLOR_GRAY;
14+
1315
static unsigned CurrentCursorX = 0;
1416
static unsigned CurrentCursorY = 0;
15-
static unsigned CurrentAttr = 0x0f;
17+
static UCHAR CurrentAttr = ATTR(COLOR_GRAY, COLOR_BLACK);
18+
19+
extern EFI_SYSTEM_TABLE* GlobalSystemTable;
1620
static EFI_INPUT_KEY Key;
1721
static BOOLEAN ExtendedKey = FALSE;
1822
static char ExtendedScanCode = 0;
@@ -30,7 +34,7 @@ UefiConsPutChar(int c)
3034
NeedScroll = (CurrentCursorY >= Height);
3135
if (NeedScroll)
3236
{
33-
UefiVideoScrollUp();
37+
VidFbScrollUp(CurrentAttr);
3438
--CurrentCursorY;
3539
}
3640
if (c == '\r')
@@ -40,7 +44,6 @@ UefiConsPutChar(int c)
4044
else if (c == '\n')
4145
{
4246
CurrentCursorX = 0;
43-
4447
if (!NeedScroll)
4548
++CurrentCursorY;
4649
}

boot/freeldr/freeldr/arch/uefi/uefivid.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ DBG_DEFAULT_CHANNEL(UI);
1515

1616
extern EFI_SYSTEM_TABLE* GlobalSystemTable;
1717
extern EFI_HANDLE GlobalImageHandle;
18-
19-
UCHAR MachDefaultTextColor = COLOR_GRAY;
2018
EFI_GUID EfiGraphicsOutputProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
2119

2220
#define LOWEST_SUPPORTED_RES 1
@@ -109,12 +107,6 @@ UefiVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
109107
VidFbCopyOffScreenBufferToVRAM(Buffer);
110108
}
111109

112-
VOID
113-
UefiVideoScrollUp(VOID)
114-
{
115-
VidFbScrollUp();
116-
}
117-
118110
VOID
119111
UefiVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
120112
{

boot/freeldr/freeldr/arch/vidfb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,16 @@ VidFbCopyOffScreenBufferToVRAM(
247247
}
248248

249249
VOID
250-
VidFbScrollUp(VOID)
250+
VidFbScrollUp(
251+
_In_ UCHAR Attr)
251252
{
252253
UINT32 BgColor, Dummy;
253254
ULONG PixelCount = framebufInfo.ScreenWidth * CHAR_HEIGHT *
254255
(((framebufInfo.ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT) - 1);
255256
PUINT32 Src = (PUINT32)((PUCHAR)framebufInfo.BaseAddress + (CHAR_HEIGHT + TOP_BOTTOM_LINES) * framebufInfo.Delta);
256257
PUINT32 Dst = (PUINT32)((PUCHAR)framebufInfo.BaseAddress + TOP_BOTTOM_LINES * framebufInfo.Delta);
257258

258-
VidFbAttrToColors(ATTR(COLOR_WHITE, COLOR_BLACK), &Dummy, &BgColor);
259+
VidFbAttrToColors(Attr, &Dummy, &BgColor);
259260

260261
while (PixelCount--)
261262
*Dst++ = *Src++;

boot/freeldr/freeldr/arch/vidfb.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ VidFbCopyOffScreenBufferToVRAM(
5454
_In_ PVOID Buffer);
5555

5656
VOID
57-
VidFbScrollUp(VOID);
57+
VidFbScrollUp(
58+
_In_ UCHAR Attr);
5859

5960
#if 0
6061
VOID

boot/freeldr/freeldr/include/arch/i386/machxbox.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
4343
VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
4444
VOID XboxVideoSync(VOID);
4545
VOID XboxVideoPrepareForReactOS(VOID);
46-
VOID XboxVideoScrollUp(VOID);
4746
VOID XboxPrepareForReactOS(VOID);
4847

4948
VOID XboxMemInit(VOID);

boot/freeldr/freeldr/include/arch/uefi/machuefi.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,3 @@ UefiHwIdle(VOID);
107107
VOID
108108
UefiInitializeFileSystemSupport(_In_ EFI_HANDLE ImageHandle,
109109
_In_ EFI_SYSTEM_TABLE *SystemTable);
110-
111-
VOID
112-
UefiVideoScrollUp(VOID);

0 commit comments

Comments
 (0)