Add ReadKey to wait and actually read a key

This commit is contained in:
Lauri Kenttä
2016-05-14 11:32:54 +03:00
parent 31323a5111
commit 8ed61047dd
2 changed files with 15 additions and 1 deletions

View File

@@ -82,6 +82,13 @@ void WaitKey(void) {
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
}
EFI_INPUT_KEY ReadKey(void) {
WaitKey();
EFI_INPUT_KEY key = {0};
ST->ConIn->ReadKeyStroke(ST->ConIn, &key);
return key;
}
void* LoadFileWithPadding(EFI_FILE_HANDLE dir, const CHAR16* path, UINTN* size_ptr, UINTN padding) {
EFI_STATUS e;
EFI_FILE_HANDLE handle;

View File

@@ -83,10 +83,17 @@ extern void RandomSeed(UINT64 a, UINT64 b);
extern void RandomSeedAuto(void);
/**
* Wait for a key press.
* Wait for a key press. It will still remain in the buffer.
*/
extern void WaitKey(void);
/**
* Wait for a key press and read it.
*
* @return The pressed key.
*/
extern EFI_INPUT_KEY ReadKey(void);
/**
* Load a file, allocate some extra bytes as well.
*/