aboutsummaryrefslogtreecommitdiffstats
path: root/UefiMonitorTest
diff options
context:
space:
mode:
Diffstat (limited to 'UefiMonitorTest')
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c17
-rw-r--r--UefiMonitorTest/UefiMonitorTest.h24
2 files changed, 37 insertions, 4 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index 09923a1..1ac26e2 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -7,6 +7,9 @@
#include "UefiMonitorTest.h"
+STATIC CONST UMT_STATE_ACTIONS mStateActions[UMT_STATE_END] = {
+ { NULL, NULL, NULL, NULL, NULL }
+};
STATIC
EFI_GRAPHICS_OUTPUT_PROTOCOL *
@@ -53,15 +56,21 @@ Run (
IN GRAPHICS_CONTEXT *Graphics
)
{
- BOOLEAN Running;
+ UMT_CONTEXT Ctx;
- Running = TRUE;
+ Ctx.State = UMT_STATE_MAIN_MENU;
+ Ctx.Running = TRUE;
+ Ctx.ShowTip = FALSE;
+ Ctx.Actions = &mStateActions[Ctx.State];
+ Ctx.Graphics = Graphics;
+ Ctx.Actions->Init (&Ctx);
- while (Running == TRUE)
+ while (Ctx.Running == TRUE)
{
+ Ctx.Actions->Doit (&Ctx);
+
// Buffer swap:
CopyMem (Graphics->FrontBuffer, Graphics->BackBuffer, Graphics->BufferSize);
- Running = FALSE;
}
return EFI_SUCCESS;
diff --git a/UefiMonitorTest/UefiMonitorTest.h b/UefiMonitorTest/UefiMonitorTest.h
index cda5f8a..6c7e0ed 100644
--- a/UefiMonitorTest/UefiMonitorTest.h
+++ b/UefiMonitorTest/UefiMonitorTest.h
@@ -4,4 +4,28 @@
#include "Graphics.h"
+typedef struct _UMT_CONTEXT UMT_CONTEXT;
+
+typedef struct {
+ VOID (*Init)(UMT_CONTEXT *);
+ VOID (*Doit)(UMT_CONTEXT *);
+ VOID (*Tip)(UMT_CONTEXT *);
+
+ VOID (*KeyRight)(UMT_CONTEXT *);
+ VOID (*KeyLeft)(UMT_CONTEXT *);
+} UMT_STATE_ACTIONS;
+
+enum UMT_STATE {
+ UMT_STATE_MAIN_MENU = 0,
+ UMT_STATE_END
+};
+
+struct _UMT_CONTEXT {
+ enum UMT_STATE State;
+ BOOLEAN Running;
+ BOOLEAN ShowTip;
+ CONST UMT_STATE_ACTIONS *Actions;
+ GRAPHICS_CONTEXT *Graphics;
+};
+
#endif /* UEFI_MONITOR_TEST_H */