3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 PVOID TextVideoBuffer
= NULL
;
25 * printf() - prints formatted text to stdout
26 * originally from GRUB
28 int printf(const char *format
, ... )
32 char c
, *ptr
, str
[16];
34 while ((c
= *(format
++)))
42 switch (c
= *(format
++))
44 case 'd': case 'u': case 'x':
46 *_itoa(va_arg(ap
, unsigned long), str
, 16) = 0;
48 *_itoa(va_arg(ap
, unsigned long), str
, 10) = 0;
54 MachConsPutChar(*(ptr
++));
58 case 'c': MachConsPutChar((va_arg(ap
,int))&0xff); break;
61 ptr
= va_arg(ap
,char *);
63 while ((c
= *(ptr
++)))
72 printf("\nprintf() invalid format specifier - %%%c\n", c
);
83 BOOL
TuiInitialize(VOID
)
85 MachVideoClearScreen(ATTR(COLOR_WHITE
, COLOR_BLACK
));
86 MachVideoHideShowTextCursor(FALSE
);
88 TextVideoBuffer
= VideoAllocateOffScreenBuffer();
89 if (TextVideoBuffer
== NULL
)
97 VOID
TuiUnInitialize(VOID
)
99 if (UiUseSpecialEffects
)
105 MachVideoSetDisplayMode(NULL
, FALSE
);
108 //VideoClearScreen();
109 MachVideoHideShowTextCursor(TRUE
);
112 VOID
TuiDrawBackdrop(VOID
)
115 // Fill in the background (excluding title box & status bar)
118 TUI_TITLE_BOX_CHAR_HEIGHT
,
122 ATTR(UiBackdropFgColor
, UiBackdropBgColor
));
125 // Draw the title box
130 TUI_TITLE_BOX_CHAR_HEIGHT
- 1,
135 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
142 GetFreeLoaderVersionString(),
143 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
151 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
155 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
160 TuiDrawText(UiScreenWidth
- 16, 3, /*"F1 for Help"*/"F8 for Options", ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
165 TuiDrawText( (UiScreenWidth
/ 2) - (strlen(UiTitleBoxTitleText
) / 2),
168 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
173 TuiDrawStatusText("Welcome to FreeLoader!");
176 // Update the date & time
180 VideoCopyOffScreenBufferToVRAM();
185 * This function assumes coordinates are zero-based
187 VOID
TuiFillArea(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, CHAR FillChar
, UCHAR Attr
/* Color Attributes */)
189 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
192 // Clip the area to the screen
193 if ((Left
>= UiScreenWidth
) || (Top
>= UiScreenHeight
))
197 if (Right
>= UiScreenWidth
)
199 Right
= UiScreenWidth
- 1;
201 if (Bottom
>= UiScreenHeight
)
203 Bottom
= UiScreenHeight
- 1;
206 // Loop through each line and fill it in
207 for (i
=Top
; i
<=Bottom
; i
++)
209 // Loop through each character (column) in the line and fill it in
210 for (j
=Left
; j
<=Right
; j
++)
212 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)] = (UCHAR
)FillChar
;
213 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)+1] = Attr
;
220 * This function assumes coordinates are zero-based
222 VOID
TuiDrawShadow(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
)
224 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
227 // Shade the bottom of the area
228 if (Bottom
< (UiScreenHeight
- 1))
230 if (UiScreenHeight
< 34)
239 for (; Idx
<=Right
; Idx
++)
241 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+(Idx
*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
245 // Shade the right of the area
246 if (Right
< (UiScreenWidth
- 1))
248 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
250 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
253 if (UiScreenHeight
< 34)
255 if ((Right
+ 1) < (UiScreenWidth
- 1))
257 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
259 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
264 // Shade the bottom right corner
265 if ((Right
< (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
267 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
269 if (UiScreenHeight
< 34)
271 if (((Right
+ 1) < (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
273 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
280 * This function assumes coordinates are zero-based
282 VOID
TuiDrawBox(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, UCHAR VertStyle
, UCHAR HorzStyle
, BOOL Fill
, BOOL Shadow
, UCHAR Attr
)
284 UCHAR ULCorner
, URCorner
, LLCorner
, LRCorner
;
286 // Calculate the corner values
287 if (HorzStyle
== HORZ
)
289 if (VertStyle
== VERT
)
296 else // VertStyle == D_VERT
304 else // HorzStyle == D_HORZ
306 if (VertStyle
== VERT
)
313 else // VertStyle == D_VERT
322 // Fill in box background
325 TuiFillArea(Left
, Top
, Right
, Bottom
, ' ', Attr
);
329 TuiFillArea(Left
, Top
, Left
, Top
, ULCorner
, Attr
);
330 TuiFillArea(Right
, Top
, Right
, Top
, URCorner
, Attr
);
331 TuiFillArea(Left
, Bottom
, Left
, Bottom
, LLCorner
, Attr
);
332 TuiFillArea(Right
, Bottom
, Right
, Bottom
, LRCorner
, Attr
);
335 TuiFillArea(Left
, Top
+1, Left
, Bottom
-1, VertStyle
, Attr
);
337 TuiFillArea(Left
+1, Top
, Right
-1, Top
, HorzStyle
, Attr
);
338 // Fill in right line
339 TuiFillArea(Right
, Top
+1, Right
, Bottom
-1, VertStyle
, Attr
);
340 // Fill in bottom line
341 TuiFillArea(Left
+1, Bottom
, Right
-1, Bottom
, HorzStyle
, Attr
);
346 TuiDrawShadow(Left
, Top
, Right
, Bottom
);
352 * This function assumes coordinates are zero-based
354 VOID
TuiDrawText(ULONG X
, ULONG Y
, PCSTR Text
, UCHAR Attr
)
356 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
360 for (i
=X
, j
=0; Text
[j
] && i
<UiScreenWidth
; i
++,j
++)
362 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)] = (UCHAR
)Text
[j
];
363 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)+1] = Attr
;
367 VOID
TuiDrawCenteredText(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, PCSTR TextString
, UCHAR Attr
)
372 ULONG LineBreakCount
;
381 TextLength
= strlen(TextString
);
383 // Count the new lines and the box width
387 for (Index
=0; Index
<TextLength
; Index
++)
389 if (TextString
[Index
] == '\n')
396 if ((Index
- LastIndex
) > BoxWidth
)
398 BoxWidth
= (Index
- LastIndex
);
403 BoxHeight
= LineBreakCount
+ 1;
405 RealLeft
= (((Right
- Left
) - BoxWidth
) / 2) + Left
;
406 RealTop
= (((Bottom
- Top
) - BoxHeight
) / 2) + Top
;
409 for (Index
=0; Index
<TextLength
; Index
++)
411 if (TextString
[Index
] == '\n')
418 X
= RealLeft
+ LastIndex
;
421 Temp
[0] = TextString
[Index
];
423 TuiDrawText(X
, Y
, Temp
, Attr
);
428 VOID
TuiDrawStatusText(PCSTR StatusText
)
432 TuiDrawText(0, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
433 TuiDrawText(1, UiScreenHeight
-1, StatusText
, ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
435 for (i
=strlen(StatusText
)+1; i
<UiScreenWidth
; i
++)
437 TuiDrawText(i
, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
440 VideoCopyOffScreenBufferToVRAM();
443 VOID
TuiUpdateDateTime(VOID
)
445 ULONG Year
, Month
, Day
;
446 ULONG Hour
, Minute
, Second
;
452 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
453 if (Year
< 1 || 9999 < Year
|| Month
< 1 || 12 < Month
|| Day
< 1 ||
454 31 < Day
|| 23 < Hour
|| 59 < Minute
|| 59 < Second
)
456 /* This happens on QEmu sometimes. We just skip updating */
459 // Get the month name
460 strcpy(DateString
, UiMonthNames
[Month
- 1]);
462 _itoa(Day
, TempString
, 10);
463 // Get the day postfix
464 if (1 == Day
|| 21 == Day
|| 31 == Day
)
466 strcat(TempString
, "st");
468 else if (2 == Day
|| 22 == Day
)
470 strcat(TempString
, "nd");
472 else if (3 == Day
|| 23 == Day
)
474 strcat(TempString
, "rd");
478 strcat(TempString
, "th");
481 // Add the day to the date
482 strcat(DateString
, TempString
);
483 strcat(DateString
, " ");
485 // Get the year and add it to the date
486 _itoa(Year
, TempString
, 10);
487 strcat(DateString
, TempString
);
490 TuiDrawText(UiScreenWidth
-strlen(DateString
)-2, 1, DateString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
492 // Get the hour and change from 24-hour mode to 12-hour
502 _itoa(Hour
, TempString
, 10);
503 strcpy(TimeString
, " ");
504 strcat(TimeString
, TempString
);
505 strcat(TimeString
, ":");
506 _itoa(Minute
, TempString
, 10);
509 strcat(TimeString
, "0");
511 strcat(TimeString
, TempString
);
512 strcat(TimeString
, ":");
513 _itoa(Second
, TempString
, 10);
516 strcat(TimeString
, "0");
518 strcat(TimeString
, TempString
);
521 strcat(TimeString
, " PM");
525 strcat(TimeString
, " AM");
529 TuiDrawText(UiScreenWidth
-strlen(TimeString
)-2, 2, TimeString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
532 VOID
TuiSaveScreen(PUCHAR Buffer
)
534 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
537 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
539 Buffer
[i
] = ScreenMemory
[i
];
543 VOID
TuiRestoreScreen(PUCHAR Buffer
)
545 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
548 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
550 ScreenMemory
[i
] = Buffer
[i
];
554 VOID
TuiMessageBox(PCSTR MessageText
)
558 // Save the screen contents
559 ScreenBuffer
= MmAllocateMemory(UiScreenWidth
* UiScreenHeight
* 2);
560 TuiSaveScreen(ScreenBuffer
);
562 // Display the message box
563 TuiMessageBoxCritical(MessageText
);
565 // Restore the screen contents
566 TuiRestoreScreen(ScreenBuffer
);
567 MmFreeMemory(ScreenBuffer
);
570 VOID
TuiMessageBoxCritical(PCSTR MessageText
)
573 unsigned int height
= 1;
582 for (i
=0; i
<strlen(MessageText
); i
++)
584 if (MessageText
[i
] == '\n')
589 for (i
=0,j
=0,k
=0; i
<height
; i
++)
591 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
604 // Calculate box area
605 x1
= (UiScreenWidth
- (width
+2))/2;
607 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
608 y2
= y1
+ height
+ 4;
611 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
614 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
616 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
620 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
624 temp
[j
++] = MessageText
[i
];
628 strcpy(temp
, " OK ");
629 UiDrawText(x1
+((x2
-x1
)/2)-3, y2
-2, temp
, ATTR(COLOR_BLACK
, COLOR_GRAY
));
632 UiDrawStatusText("Press ENTER to continue");
634 VideoCopyOffScreenBufferToVRAM();
640 key
= MachConsGetCh();
641 if(key
== KEY_EXTENDED
)
642 key
= MachConsGetCh();
646 else if(key
== KEY_SPACE
)
648 else if(key
== KEY_ESC
)
654 VideoCopyOffScreenBufferToVRAM();
660 VOID
TuiDrawProgressBarCenter(ULONG Position
, ULONG Range
, PCHAR ProgressText
)
662 ULONG Left
, Top
, Right
, Bottom
;
663 ULONG Width
= 50; // Allow for 50 "bars"
666 Left
= (UiScreenWidth
- Width
- 4) / 2;
667 Right
= Left
+ Width
+ 3;
668 Top
= (UiScreenHeight
- Height
- 2) / 2;
670 Bottom
= Top
+ Height
+ 1;
672 TuiDrawProgressBar(Left
, Top
, Right
, Bottom
, Position
, Range
, ProgressText
);
675 VOID
TuiDrawProgressBar(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, ULONG Position
, ULONG Range
, PCHAR ProgressText
)
678 ULONG ProgressBarWidth
= (Right
- Left
) - 3;
680 // First make sure the progress bar text fits
681 UiTruncateStringEllipsis(ProgressText
, ProgressBarWidth
- 4);
683 if (Position
> Range
)
689 TuiDrawBox(Left
, Top
, Right
, Bottom
, VERT
, HORZ
, TRUE
, TRUE
, ATTR(UiMenuFgColor
, UiMenuBgColor
));
691 // Draw the "Loading..." text
692 //TuiDrawText(70/2, Top+1, "Loading...", ATTR(UiTextColor, UiMenuBgColor));
693 TuiDrawCenteredText(Left
+ 2, Top
+ 2, Right
- 2, Top
+ 2, ProgressText
, ATTR(UiTextColor
, UiMenuBgColor
));
695 // Draw the percent complete
696 for (i
=0; i
<(Position
*ProgressBarWidth
)/Range
; i
++)
698 TuiDrawText(Left
+2+i
, Top
+2, "\xDB", ATTR(UiTextColor
, UiMenuBgColor
));
702 for (; i
<ProgressBarWidth
; i
++)
704 TuiDrawText(Left
+2+i
, Top
+2, "\xB2", ATTR(UiTextColor
, UiMenuBgColor
));
709 VideoCopyOffScreenBufferToVRAM();
712 UCHAR
TuiTextToColor(PCSTR ColorText
)
714 if (_stricmp(ColorText
, "Black") == 0)
716 else if (_stricmp(ColorText
, "Blue") == 0)
718 else if (_stricmp(ColorText
, "Green") == 0)
720 else if (_stricmp(ColorText
, "Cyan") == 0)
722 else if (_stricmp(ColorText
, "Red") == 0)
724 else if (_stricmp(ColorText
, "Magenta") == 0)
725 return COLOR_MAGENTA
;
726 else if (_stricmp(ColorText
, "Brown") == 0)
728 else if (_stricmp(ColorText
, "Gray") == 0)
730 else if (_stricmp(ColorText
, "DarkGray") == 0)
731 return COLOR_DARKGRAY
;
732 else if (_stricmp(ColorText
, "LightBlue") == 0)
733 return COLOR_LIGHTBLUE
;
734 else if (_stricmp(ColorText
, "LightGreen") == 0)
735 return COLOR_LIGHTGREEN
;
736 else if (_stricmp(ColorText
, "LightCyan") == 0)
737 return COLOR_LIGHTCYAN
;
738 else if (_stricmp(ColorText
, "LightRed") == 0)
739 return COLOR_LIGHTRED
;
740 else if (_stricmp(ColorText
, "LightMagenta") == 0)
741 return COLOR_LIGHTMAGENTA
;
742 else if (_stricmp(ColorText
, "Yellow") == 0)
744 else if (_stricmp(ColorText
, "White") == 0)
750 UCHAR
TuiTextToFillStyle(PCSTR FillStyleText
)
752 if (_stricmp(FillStyleText
, "Light") == 0)
756 else if (_stricmp(FillStyleText
, "Medium") == 0)
760 else if (_stricmp(FillStyleText
, "Dark") == 0)
768 VOID
TuiFadeInBackdrop(VOID
)
770 PPALETTE_ENTRY TuiFadePalette
= NULL
;
772 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
774 TuiFadePalette
= (PPALETTE_ENTRY
)MmAllocateMemory(sizeof(PALETTE_ENTRY
) * 64);
776 if (TuiFadePalette
!= NULL
)
778 VideoSavePaletteState(TuiFadePalette
, 64);
779 VideoSetAllColorsToBlack(64);
783 // Draw the backdrop and title box
786 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
788 VideoFadeIn(TuiFadePalette
, 64);
789 MmFreeMemory(TuiFadePalette
);
793 VOID
TuiFadeOut(VOID
)
795 PPALETTE_ENTRY TuiFadePalette
= NULL
;
797 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
799 TuiFadePalette
= (PPALETTE_ENTRY
)MmAllocateMemory(sizeof(PALETTE_ENTRY
) * 64);
801 if (TuiFadePalette
!= NULL
)
803 VideoSavePaletteState(TuiFadePalette
, 64);
807 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
812 MachVideoSetDisplayMode(NULL
, FALSE
);
814 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
816 VideoRestorePaletteState(TuiFadePalette
, 64);
817 MmFreeMemory(TuiFadePalette
);
822 BOOL
TuiEditBox(PCSTR MessageText
, PCHAR EditTextBuffer
, ULONG Length
)
825 unsigned int height
= 1;
833 ULONG EditBoxStartX
, EditBoxEndX
;
835 unsigned int EditBoxTextCount
;
836 int EditBoxTextDisplayIndex
;
840 // Save the screen contents
841 ScreenBuffer
= MmAllocateMemory(UiScreenWidth
* UiScreenHeight
* 2);
842 TuiSaveScreen(ScreenBuffer
);
845 for (i
=0; i
<strlen(MessageText
); i
++)
847 if (MessageText
[i
] == '\n')
852 for (i
=0,j
=0,k
=0; i
<height
; i
++)
854 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
867 // Calculate box area
868 x1
= (UiScreenWidth
- (width
+2))/2;
870 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
871 y2
= y1
+ height
+ 4;
874 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
877 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
879 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
883 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
887 temp
[j
++] = MessageText
[i
];
890 EditBoxTextCount
= 0;
891 EditBoxLine
= y2
- 2;
892 EditBoxStartX
= x1
+ 3;
893 EditBoxEndX
= x2
- 3;
894 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
897 EditBoxCursorX
= EditBoxStartX
;
898 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
899 MachVideoHideShowTextCursor(TRUE
);
902 UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
904 VideoCopyOffScreenBufferToVRAM();
910 key
= MachConsGetCh();
911 if(key
== KEY_EXTENDED
)
913 key
= MachConsGetCh();
921 else if(key
== KEY_ESC
)
926 else if (key
== KEY_BACKSPACE
) // Remove a character
928 if (EditBoxTextCount
)
931 EditTextBuffer
[EditBoxTextCount
] = 0;
938 else // Add this key to the buffer
940 if (EditBoxTextCount
< Length
- 1)
942 EditTextBuffer
[EditBoxTextCount
] = key
;
944 EditTextBuffer
[EditBoxTextCount
] = 0;
953 // Draw the edit box background
954 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
957 if (EditBoxTextCount
> (EditBoxEndX
- EditBoxStartX
))
959 EditBoxTextDisplayIndex
= EditBoxTextCount
- (EditBoxEndX
- EditBoxStartX
);
960 EditBoxCursorX
= EditBoxEndX
;
964 EditBoxTextDisplayIndex
= 0;
965 EditBoxCursorX
= EditBoxStartX
+ EditBoxTextCount
;
967 UiDrawText(EditBoxStartX
, EditBoxLine
, &EditTextBuffer
[EditBoxTextDisplayIndex
], ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
970 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
974 VideoCopyOffScreenBufferToVRAM();
977 // Hide the cursor again
978 MachVideoHideShowTextCursor(FALSE
);
980 // Restore the screen contents
981 TuiRestoreScreen(ScreenBuffer
);
982 MmFreeMemory(ScreenBuffer
);