aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-04-28 02:54:34 +0300
committerJoursoir <chat@joursoir.net>2022-04-28 02:54:34 +0300
commit9da75a0be396b484f11b8f988a3f140b01154fb0 (patch)
treee10b65779403a6cfd52778ebb2e2c55fdc8eb3d6
parented16f7bcc206125924de6dbe20ebed723459962b (diff)
downloadumt-9da75a0be396b484f11b8f988a3f140b01154fb0.tar.gz
umt-9da75a0be396b484f11b8f988a3f140b01154fb0.tar.bz2
umt-9da75a0be396b484f11b8f988a3f140b01154fb0.zip
main: add the context state changing routine
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index 047d14b..86c7f08 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -106,6 +106,22 @@ GetGraphicsOutputProtocol (
}
STATIC
+VOID
+ChangeCtxState (
+ IN UMT_CONTEXT *Ctx,
+ IN enum UMT_STATE State
+ )
+{
+ if (State >= UMT_STATE_END)
+ return;
+
+ Ctx->State = State;
+ Ctx->ShowTip = FALSE;
+ Ctx->Actions = &mStateActions[State];
+ Ctx->Actions->Init (Ctx);
+}
+
+STATIC
EFI_STATUS
Run (
IN GRAPHICS_CONTEXT *Graphics
@@ -113,12 +129,9 @@ Run (
{
UMT_CONTEXT Ctx;
- Ctx.State = UMT_STATE_MAIN_MENU;
Ctx.Running = TRUE;
- Ctx.ShowTip = FALSE;
- Ctx.Actions = &mStateActions[Ctx.State];
Ctx.Graphics = Graphics;
- Ctx.Actions->Init (&Ctx);
+ ChangeCtxState (&Ctx, UMT_STATE_MAIN_MENU);
while (Ctx.Running == TRUE)
{