-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
82 lines (71 loc) · 2.01 KB
/
Copy pathmain.c
File metadata and controls
82 lines (71 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef MAIN_C
#define MAIN_C
#include "src/boot/EFI_SPEC/efi.h"
#include "src/boot/print.c"
#include "src/boot/mem.c"
#include "src/boot/str.c"
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* EFI_STOP;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL* EFI_STIP;
EFI_HANDLE image_handle;
EFI_BOOT_SERVICES* bs;
EFI_SYSTEM_TABLE* st;
void DrawBox(UINT8 x, UINT8 y, BOOLEAN filled){
EFI_STOP->SetCursorPosition(EFI_STOP, x, y);
if (filled)
EFI_STOP->OutputString(EFI_STOP, u"█");
else
EFI_STOP->OutputString(EFI_STOP, u"░");
}
UINT8 menu_main();
UINT8 system_menu();
UINT8 file_manager();
EFI_STATUS continue_boot();
EFI_INPUT_KEY key;
EFI_STATUS efi_boot_menu(){
UINT8 option = menu_main();
while(TRUE){
EFI_STIP->ReadKeyStroke(EFI_STIP, &key);
switch (option)
{
case 10:
option = menu_main(&key);
break;
case 1:
continue_boot();
st->RuntimeServices->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
break;
case 2:
option = system_menu();
break;
case 3:
return EFI_SUCCESS;
break;
case 4:
st->RuntimeServices->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
break;
case 5:
option = menu_main(&key); // Dose nothing
break;
case 6:
option = file_manager();
break;
default:
break;
}
};
}
EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable){
EFI_STOP = SystemTable->ConOut;
EFI_STIP = SystemTable->ConIn;
image_handle = ImageHandle;
bs = SystemTable->BootServices;
st = SystemTable;
EFI_STIP->ReadKeyStroke(EFI_STIP, &key);
EFI_STOP->Reset(EFI_STOP, FALSE);
return continue_boot();
}
#include "src/boot/boot_menu.c"
#include "src/boot/file_manager.c"
#include "src/boot/gop.c"
#include "src/boot/continue_boot.c"
#endif