From 9da75a0be396b484f11b8f988a3f140b01154fb0 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Thu, 28 Apr 2022 02:54:34 +0300 Subject: main: add the context state changing routine --- UefiMonitorTest/UefiMonitorTest.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'UefiMonitorTest') diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c index 047d14b..86c7f08 100644 --- a/UefiMonitorTest/UefiMonitorTest.c +++ b/UefiMonitorTest/UefiMonitorTest.c @@ -105,6 +105,22 @@ GetGraphicsOutputProtocol ( return Gop; } +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 ( @@ -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) { -- cgit v1.2.3-18-g5258