mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 13:11:22 +00:00
[FREELDR:UI] Clean-up when uninitializing the UI.
- If the started OS loader failed and we are back to the OS selection menu, re-initialize the UI as the loader may have messed up the display in the meantime. - Tear down allocated off-screen back-buffer when uninitializing the TUI. - Clear up the screen when initializing the direct-UI.
This commit is contained in:
parent
e2daca3f60
commit
313e6b6cbb
5 changed files with 30 additions and 6 deletions
|
@ -401,6 +401,13 @@ VOID RunLoader(VOID)
|
|||
|
||||
/* Load the chosen operating system */
|
||||
LoadOperatingSystem(&OperatingSystemList[SelectedOperatingSystem]);
|
||||
|
||||
/* If we get there, the OS loader failed. As it may have
|
||||
* messed up the display, re-initialize the UI. */
|
||||
#ifndef _M_ARM
|
||||
UiVtbl.UnInitialize();
|
||||
#endif
|
||||
UiInitialize(TRUE);
|
||||
}
|
||||
|
||||
Reboot:
|
||||
|
|
|
@ -19,7 +19,9 @@ typedef struct _PALETTE_ENTRY
|
|||
// extern PVOID VideoOffScreenBuffer;
|
||||
|
||||
PVOID VideoAllocateOffScreenBuffer(VOID); // Returns a pointer to an off-screen buffer sufficient for the current video mode
|
||||
VOID VideoCopyOffScreenBufferToVRAM(VOID);
|
||||
|
||||
VOID VideoFreeOffScreenBuffer(VOID);
|
||||
VOID VideoCopyOffScreenBufferToVRAM(VOID);
|
||||
|
||||
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount);
|
||||
VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount);
|
||||
|
|
|
@ -34,6 +34,9 @@ UiInitialize(IN BOOLEAN ShowUi)
|
|||
/* Set mode and query size */
|
||||
MachVideoSetDisplayMode(NULL, TRUE);
|
||||
MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth);
|
||||
|
||||
/* Clear the screen */
|
||||
UiDrawBackdrop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,6 +210,10 @@ BOOLEAN TuiInitialize(VOID)
|
|||
|
||||
VOID TuiUnInitialize(VOID)
|
||||
{
|
||||
/* Do nothing if already uninitialized */
|
||||
if (!TextVideoBuffer)
|
||||
return;
|
||||
|
||||
if (UiUseSpecialEffects)
|
||||
{
|
||||
TuiFadeOut();
|
||||
|
@ -219,6 +223,9 @@ VOID TuiUnInitialize(VOID)
|
|||
MachVideoSetDisplayMode(NULL, FALSE);
|
||||
}
|
||||
|
||||
VideoFreeOffScreenBuffer();
|
||||
TextVideoBuffer = NULL;
|
||||
|
||||
MachVideoClearScreen(ATTR(COLOR_GRAY, COLOR_BLACK));
|
||||
MachVideoSetTextCursorPosition(0, 0);
|
||||
MachVideoHideShowTextCursor(TRUE);
|
||||
|
|
|
@ -18,11 +18,7 @@ PVOID VideoAllocateOffScreenBuffer(VOID)
|
|||
{
|
||||
ULONG BufferSize;
|
||||
|
||||
if (VideoOffScreenBuffer != NULL)
|
||||
{
|
||||
MmFreeMemory(VideoOffScreenBuffer);
|
||||
VideoOffScreenBuffer = NULL;
|
||||
}
|
||||
VideoFreeOffScreenBuffer();
|
||||
|
||||
BufferSize = MachVideoGetBufferSize();
|
||||
|
||||
|
@ -31,6 +27,15 @@ PVOID VideoAllocateOffScreenBuffer(VOID)
|
|||
return VideoOffScreenBuffer;
|
||||
}
|
||||
|
||||
VOID VideoFreeOffScreenBuffer(VOID)
|
||||
{
|
||||
if (!VideoOffScreenBuffer)
|
||||
return;
|
||||
|
||||
MmFreeMemory(VideoOffScreenBuffer);
|
||||
VideoOffScreenBuffer = NULL;
|
||||
}
|
||||
|
||||
VOID VideoCopyOffScreenBufferToVRAM(VOID)
|
||||
{
|
||||
MachVideoCopyOffScreenBufferToVRAM(VideoOffScreenBuffer);
|
||||
|
|
Loading…
Reference in a new issue