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 // FIXME: This code seems to have problems... Uncomment and view ;-)
194 /*if ((Left >= UiScreenWidth) || (Top >= UiScreenHeight))
198 if ((Left + Right) >= UiScreenWidth)
200 Right = UiScreenWidth - Left;
202 if ((Top + Bottom) >= UiScreenHeight)
204 Bottom = UiScreenHeight - Top;
207 // Loop through each line and fill it in
208 for (i
=Top
; i
<=Bottom
; i
++)
210 // Loop through each character (column) in the line and fill it in
211 for (j
=Left
; j
<=Right
; j
++)
213 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)] = (UCHAR
)FillChar
;
214 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)+1] = Attr
;
221 * This function assumes coordinates are zero-based
223 VOID
TuiDrawShadow(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
)
225 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
228 // Shade the bottom of the area
229 if (Bottom
< (UiScreenHeight
- 1))
231 if (UiScreenHeight
< 34)
240 for (; Idx
<=Right
; Idx
++)
242 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+(Idx
*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
246 // Shade the right of the area
247 if (Right
< (UiScreenWidth
- 1))
249 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
251 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
254 if (UiScreenHeight
< 34)
256 if ((Right
+ 1) < (UiScreenWidth
- 1))
258 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
260 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
265 // Shade the bottom right corner
266 if ((Right
< (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
268 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
270 if (UiScreenHeight
< 34)
272 if (((Right
+ 1) < (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
274 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
281 * This function assumes coordinates are zero-based
283 VOID
TuiDrawBox(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, UCHAR VertStyle
, UCHAR HorzStyle
, BOOL Fill
, BOOL Shadow
, UCHAR Attr
)
285 UCHAR ULCorner
, URCorner
, LLCorner
, LRCorner
;
287 // Calculate the corner values
288 if (HorzStyle
== HORZ
)
290 if (VertStyle
== VERT
)
297 else // VertStyle == D_VERT
305 else // HorzStyle == D_HORZ
307 if (VertStyle
== VERT
)
314 else // VertStyle == D_VERT
323 // Fill in box background
326 TuiFillArea(Left
, Top
, Right
, Bottom
, ' ', Attr
);
330 TuiFillArea(Left
, Top
, Left
, Top
, ULCorner
, Attr
);
331 TuiFillArea(Right
, Top
, Right
, Top
, URCorner
, Attr
);
332 TuiFillArea(Left
, Bottom
, Left
, Bottom
, LLCorner
, Attr
);
333 TuiFillArea(Right
, Bottom
, Right
, Bottom
, LRCorner
, Attr
);
336 TuiFillArea(Left
, Top
+1, Left
, Bottom
-1, VertStyle
, Attr
);
338 TuiFillArea(Left
+1, Top
, Right
-1, Top
, HorzStyle
, Attr
);
339 // Fill in right line
340 TuiFillArea(Right
, Top
+1, Right
, Bottom
-1, VertStyle
, Attr
);
341 // Fill in bottom line
342 TuiFillArea(Left
+1, Bottom
, Right
-1, Bottom
, HorzStyle
, Attr
);
347 TuiDrawShadow(Left
, Top
, Right
, Bottom
);
353 * This function assumes coordinates are zero-based
355 VOID
TuiDrawText(ULONG X
, ULONG Y
, PCSTR Text
, UCHAR Attr
)
357 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
361 for (i
=X
, j
=0; Text
[j
] && i
<UiScreenWidth
; i
++,j
++)
363 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)] = (UCHAR
)Text
[j
];
364 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)+1] = Attr
;
368 VOID
TuiDrawCenteredText(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, PCSTR TextString
, UCHAR Attr
)
373 ULONG LineBreakCount
;
382 TextLength
= strlen(TextString
);
384 // Count the new lines and the box width
388 for (Index
=0; Index
<TextLength
; Index
++)
390 if (TextString
[Index
] == '\n')
397 if ((Index
- LastIndex
) > BoxWidth
)
399 BoxWidth
= (Index
- LastIndex
);
404 BoxHeight
= LineBreakCount
+ 1;
406 RealLeft
= (((Right
- Left
) - BoxWidth
) / 2) + Left
;
407 RealTop
= (((Bottom
- Top
) - BoxHeight
) / 2) + Top
;
410 for (Index
=0; Index
<TextLength
; Index
++)
412 if (TextString
[Index
] == '\n')
419 X
= RealLeft
+ LastIndex
;
422 Temp
[0] = TextString
[Index
];
424 TuiDrawText(X
, Y
, Temp
, Attr
);
429 VOID
TuiDrawStatusText(PCSTR StatusText
)
433 TuiDrawText(0, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
434 TuiDrawText(1, UiScreenHeight
-1, StatusText
, ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
436 for (i
=strlen(StatusText
)+1; i
<UiScreenWidth
; i
++)
438 TuiDrawText(i
, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
441 VideoCopyOffScreenBufferToVRAM();
444 VOID
TuiUpdateDateTime(VOID
)
446 ULONG Year
, Month
, Day
;
447 ULONG Hour
, Minute
, Second
;
453 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
454 if (Year
< 1 || 9999 < Year
|| Month
< 1 || 12 < Month
|| Day
< 1 ||
455 31 < Day
|| 23 < Hour
|| 59 < Minute
|| 59 < Second
)
457 /* This happens on QEmu sometimes. We just skip updating */
460 // Get the month name
461 strcpy(DateString
, UiMonthNames
[Month
- 1]);
463 _itoa(Day
, TempString
, 10);
464 // Get the day postfix
465 if (1 == Day
|| 21 == Day
|| 31 == Day
)
467 strcat(TempString
, "st");
469 else if (2 == Day
|| 22 == Day
)
471 strcat(TempString
, "nd");
473 else if (3 == Day
|| 23 == Day
)
475 strcat(TempString
, "rd");
479 strcat(TempString
, "th");
482 // Add the day to the date
483 strcat(DateString
, TempString
);
484 strcat(DateString
, " ");
486 // Get the year and add it to the date
487 _itoa(Year
, TempString
, 10);
488 strcat(DateString
, TempString
);
491 TuiDrawText(UiScreenWidth
-strlen(DateString
)-2, 1, DateString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
493 // Get the hour and change from 24-hour mode to 12-hour
503 _itoa(Hour
, TempString
, 10);
504 strcpy(TimeString
, " ");
505 strcat(TimeString
, TempString
);
506 strcat(TimeString
, ":");
507 _itoa(Minute
, TempString
, 10);
510 strcat(TimeString
, "0");
512 strcat(TimeString
, TempString
);
513 strcat(TimeString
, ":");
514 _itoa(Second
, TempString
, 10);
517 strcat(TimeString
, "0");
519 strcat(TimeString
, TempString
);
522 strcat(TimeString
, " PM");
526 strcat(TimeString
, " AM");
530 TuiDrawText(UiScreenWidth
-strlen(TimeString
)-2, 2, TimeString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
533 VOID
TuiSaveScreen(PUCHAR Buffer
)
535 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
538 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
540 Buffer
[i
] = ScreenMemory
[i
];
544 VOID
TuiRestoreScreen(PUCHAR Buffer
)
546 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
549 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
551 ScreenMemory
[i
] = Buffer
[i
];
555 VOID
TuiMessageBox(PCSTR MessageText
)
559 // Save the screen contents
560 ScreenBuffer
= MmAllocateMemory(UiScreenWidth
* UiScreenHeight
* 2);
561 TuiSaveScreen(ScreenBuffer
);
563 // Display the message box
564 TuiMessageBoxCritical(MessageText
);
566 // Restore the screen contents
567 TuiRestoreScreen(ScreenBuffer
);
568 MmFreeMemory(ScreenBuffer
);
571 VOID
TuiMessageBoxCritical(PCSTR MessageText
)
574 unsigned int height
= 1;
583 for (i
=0; i
<strlen(MessageText
); i
++)
585 if (MessageText
[i
] == '\n')
590 for (i
=0,j
=0,k
=0; i
<height
; i
++)
592 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
605 // Calculate box area
606 x1
= (UiScreenWidth
- (width
+2))/2;
608 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
609 y2
= y1
+ height
+ 4;
612 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
615 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
617 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
621 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
625 temp
[j
++] = MessageText
[i
];
629 strcpy(temp
, " OK ");
630 UiDrawText(x1
+((x2
-x1
)/2)-3, y2
-2, temp
, ATTR(COLOR_BLACK
, COLOR_GRAY
));
633 UiDrawStatusText("Press ENTER to continue");
635 VideoCopyOffScreenBufferToVRAM();
641 key
= MachConsGetCh();
642 if(key
== KEY_EXTENDED
)
643 key
= MachConsGetCh();
647 else if(key
== KEY_SPACE
)
649 else if(key
== KEY_ESC
)
655 VideoCopyOffScreenBufferToVRAM();
661 VOID
TuiDrawProgressBarCenter(ULONG Position
, ULONG Range
, PCHAR ProgressText
)
663 ULONG Left
, Top
, Right
, Bottom
;
664 ULONG Width
= 50; // Allow for 50 "bars"
667 Left
= (UiScreenWidth
- Width
- 4) / 2;
668 Right
= Left
+ Width
+ 3;
669 Top
= (UiScreenHeight
- Height
- 2) / 2;
671 Bottom
= Top
+ Height
+ 1;
673 TuiDrawProgressBar(Left
, Top
, Right
, Bottom
, Position
, Range
, ProgressText
);
676 VOID
TuiDrawProgressBar(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, ULONG Position
, ULONG Range
, PCHAR ProgressText
)
679 ULONG ProgressBarWidth
= (Right
- Left
) - 3;
681 // First make sure the progress bar text fits
682 UiTruncateStringEllipsis(ProgressText
, ProgressBarWidth
- 4);
684 if (Position
> Range
)
690 TuiDrawBox(Left
, Top
, Right
, Bottom
, VERT
, HORZ
, TRUE
, TRUE
, ATTR(UiMenuFgColor
, UiMenuBgColor
));
692 // Draw the "Loading..." text
693 //TuiDrawText(70/2, Top+1, "Loading...", ATTR(UiTextColor, UiMenuBgColor));
694 TuiDrawCenteredText(Left
+ 2, Top
+ 2, Right
- 2, Top
+ 2, ProgressText
, ATTR(UiTextColor
, UiMenuBgColor
));
696 // Draw the percent complete
697 for (i
=0; i
<(Position
*ProgressBarWidth
)/Range
; i
++)
699 TuiDrawText(Left
+2+i
, Top
+2, "\xDB", ATTR(UiTextColor
, UiMenuBgColor
));
703 for (; i
<ProgressBarWidth
; i
++)
705 TuiDrawText(Left
+2+i
, Top
+2, "\xB2", ATTR(UiTextColor
, UiMenuBgColor
));
710 VideoCopyOffScreenBufferToVRAM();
713 UCHAR
TuiTextToColor(PCSTR ColorText
)
715 if (_stricmp(ColorText
, "Black") == 0)
717 else if (_stricmp(ColorText
, "Blue") == 0)
719 else if (_stricmp(ColorText
, "Green") == 0)
721 else if (_stricmp(ColorText
, "Cyan") == 0)
723 else if (_stricmp(ColorText
, "Red") == 0)
725 else if (_stricmp(ColorText
, "Magenta") == 0)
726 return COLOR_MAGENTA
;
727 else if (_stricmp(ColorText
, "Brown") == 0)
729 else if (_stricmp(ColorText
, "Gray") == 0)
731 else if (_stricmp(ColorText
, "DarkGray") == 0)
732 return COLOR_DARKGRAY
;
733 else if (_stricmp(ColorText
, "LightBlue") == 0)
734 return COLOR_LIGHTBLUE
;
735 else if (_stricmp(ColorText
, "LightGreen") == 0)
736 return COLOR_LIGHTGREEN
;
737 else if (_stricmp(ColorText
, "LightCyan") == 0)
738 return COLOR_LIGHTCYAN
;
739 else if (_stricmp(ColorText
, "LightRed") == 0)
740 return COLOR_LIGHTRED
;
741 else if (_stricmp(ColorText
, "LightMagenta") == 0)
742 return COLOR_LIGHTMAGENTA
;
743 else if (_stricmp(ColorText
, "Yellow") == 0)
745 else if (_stricmp(ColorText
, "White") == 0)
751 UCHAR
TuiTextToFillStyle(PCSTR FillStyleText
)
753 if (_stricmp(FillStyleText
, "Light") == 0)
757 else if (_stricmp(FillStyleText
, "Medium") == 0)
761 else if (_stricmp(FillStyleText
, "Dark") == 0)
769 VOID
TuiFadeInBackdrop(VOID
)
771 PPALETTE_ENTRY TuiFadePalette
= NULL
;
773 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
775 TuiFadePalette
= (PPALETTE_ENTRY
)MmAllocateMemory(sizeof(PALETTE_ENTRY
) * 64);
777 if (TuiFadePalette
!= NULL
)
779 VideoSavePaletteState(TuiFadePalette
, 64);
780 VideoSetAllColorsToBlack(64);
784 // Draw the backdrop and title box
787 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
789 VideoFadeIn(TuiFadePalette
, 64);
790 MmFreeMemory(TuiFadePalette
);
794 VOID
TuiFadeOut(VOID
)
796 PPALETTE_ENTRY TuiFadePalette
= NULL
;
798 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
800 TuiFadePalette
= (PPALETTE_ENTRY
)MmAllocateMemory(sizeof(PALETTE_ENTRY
) * 64);
802 if (TuiFadePalette
!= NULL
)
804 VideoSavePaletteState(TuiFadePalette
, 64);
808 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
813 MachVideoSetDisplayMode(NULL
, FALSE
);
815 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
817 VideoRestorePaletteState(TuiFadePalette
, 64);
818 MmFreeMemory(TuiFadePalette
);
823 BOOL
TuiEditBox(PCSTR MessageText
, PCHAR EditTextBuffer
, ULONG Length
)
826 unsigned int height
= 1;
834 ULONG EditBoxStartX
, EditBoxEndX
;
836 unsigned int EditBoxTextCount
;
837 int EditBoxTextDisplayIndex
;
841 // Save the screen contents
842 ScreenBuffer
= MmAllocateMemory(UiScreenWidth
* UiScreenHeight
* 2);
843 TuiSaveScreen(ScreenBuffer
);
846 for (i
=0; i
<strlen(MessageText
); i
++)
848 if (MessageText
[i
] == '\n')
853 for (i
=0,j
=0,k
=0; i
<height
; i
++)
855 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
868 // Calculate box area
869 x1
= (UiScreenWidth
- (width
+2))/2;
871 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
872 y2
= y1
+ height
+ 4;
875 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
878 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
880 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
884 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
888 temp
[j
++] = MessageText
[i
];
891 EditBoxTextCount
= 0;
892 EditBoxLine
= y2
- 2;
893 EditBoxStartX
= x1
+ 3;
894 EditBoxEndX
= x2
- 3;
895 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
898 EditBoxCursorX
= EditBoxStartX
;
899 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
900 MachVideoHideShowTextCursor(TRUE
);
903 UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
905 VideoCopyOffScreenBufferToVRAM();
911 key
= MachConsGetCh();
912 if(key
== KEY_EXTENDED
)
914 key
= MachConsGetCh();
922 else if(key
== KEY_ESC
)
927 else if (key
== KEY_BACKSPACE
) // Remove a character
929 if (EditBoxTextCount
)
932 EditTextBuffer
[EditBoxTextCount
] = 0;
939 else // Add this key to the buffer
941 if (EditBoxTextCount
< Length
- 1)
943 EditTextBuffer
[EditBoxTextCount
] = key
;
945 EditTextBuffer
[EditBoxTextCount
] = 0;
954 // Draw the edit box background
955 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
958 if (EditBoxTextCount
> (EditBoxEndX
- EditBoxStartX
))
960 EditBoxTextDisplayIndex
= EditBoxTextCount
- (EditBoxEndX
- EditBoxStartX
);
961 EditBoxCursorX
= EditBoxEndX
;
965 EditBoxTextDisplayIndex
= 0;
966 EditBoxCursorX
= EditBoxStartX
+ EditBoxTextCount
;
968 UiDrawText(EditBoxStartX
, EditBoxLine
, &EditTextBuffer
[EditBoxTextDisplayIndex
], ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
971 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
975 VideoCopyOffScreenBufferToVRAM();
978 // Hide the cursor again
979 MachVideoHideShowTextCursor(FALSE
);
981 // Restore the screen contents
982 TuiRestoreScreen(ScreenBuffer
);
983 MmFreeMemory(ScreenBuffer
);