-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
46 lines (35 loc) · 980 Bytes
/
main.c
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
#include <efi.h>
#include <efilib.h>
#include "tetris.h"
EFI_STATUS
efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
{
EFI_STATUS status;
InitializeLib(image_handle, system_table);
Print(L"Welcome to tetrEFIs!\n");
RNG rng = load_rng(&status);
if(EFI_ERROR(status))
return status;
LFB lfb = load_lfb(&status);
if(EFI_ERROR(status))
return status;
input_manager_t input_manager = load_input_manager(&status);
if(EFI_ERROR(status)) {
return status;
}
Print(L"DEBUG: loaded all services\n");
// fill_rect(
// &lfb,
// (rect) { .x = 0, .y = 0, .w = SCREEN_WIDTH, .h = SCREEN_HEIGHT },
// BLACK);
int ok;
game_state s = make_initial_state(&ok, &lfb, &rng, &input_manager);
if(!ok)
return -1;
// TODO disable the watchdog timer
// not sure if RNG will continue to work after exiting boot services
// (probably not)
// ST->BootServices->ExitBootServices();
game(&s);
return EFI_SUCCESS;
}