enable text mode in f8/f10 menu

This commit is contained in:
a1ive 2025-02-24 09:36:07 +09:00
parent dc5f3c614b
commit b10ef2ef08
No known key found for this signature in database
GPG Key ID: DA9BACF4F462B55D
7 changed files with 14 additions and 3 deletions

View File

@ -55,6 +55,7 @@
#define BCDOPT_GFXMODE L"15000052" // graphicsresolution
#define BCDOPT_ADVOPT L"16000040" // advanced options
#define BCDOPT_OPTEDIT L"16000041" // options edit
#define BCDOPT_TEXT L"16000046" // graphicsmodedisabled
#define BCDOPT_TESTMODE L"16000049" // testsigning
#define BCDOPT_HIGHRES L"16000054" // highest resolution
#define BCDOPT_OSDDEV L"21000001" // os device

View File

@ -228,10 +228,12 @@ void process_cmdline (char *cmdline)
else if (strcmp (key, "f8") == 0)
{
args.advmenu = NTARG_BOOL_TRUE;
args.textmode = NTARG_BOOL_TRUE;
}
else if (strcmp (key, "edit") == 0)
{
args.optedit = NTARG_BOOL_TRUE;
args.textmode = NTARG_BOOL_TRUE;
}
else if (strcmp (key, "nx") == 0)
{

View File

@ -33,6 +33,8 @@
#include "efiboot.h"
#include "efi/Protocol/GraphicsOutput.h"
#ifdef ENABLE_TEXT_DEBUG
/** Original OpenProtocol() method */
static EFI_OPEN_PROTOCOL orig_open_protocol;
@ -94,6 +96,8 @@ efi_open_protocol_wrapper (EFI_HANDLE handle, EFI_GUID *protocol,
return 0;
}
#endif
/**
* Boot from EFI device
*
@ -149,11 +153,13 @@ void efi_boot (EFI_DEVICE_PATH_PROTOCOL *path,
loaded.image->DeviceHandle = device;
}
#ifdef ENABLE_TEXT_DEBUG
/* Intercept calls to OpenProtocol() */
orig_open_protocol =
loaded.image->SystemTable->BootServices->OpenProtocol;
loaded.image->SystemTable->BootServices->OpenProtocol =
efi_open_protocol_wrapper;
#endif
/* Start image */
if ((efirc = bs->StartImage (handle, NULL, NULL)) != 0)

View File

@ -73,7 +73,6 @@ enum
static void call_interrupt_wrapper (struct bootapp_callback_params *params)
{
struct paging_state state;
uint16_t *attributes;
/* Handle/modify/pass-through interrupt as required */
if (params->vector.interrupt == 0x13)
@ -92,8 +91,8 @@ static void call_interrupt_wrapper (struct bootapp_callback_params *params)
(nt_cmdline->textmode))
{
/* Mark all VESA video modes as unsupported */
attributes = REAL_PTR ( params->es, params->di );
call_interrupt ( params );
uint16_t *attributes = REAL_PTR (params->es, params->di);
call_interrupt (params);
*attributes &= ~0x0001;
}
else

View File

@ -307,6 +307,8 @@ bcd_patch_data (void)
BCDOPT_ADVOPT, nt_cmdline->advmenu);
bcd_patch_bool (&hive, objects, GUID_OPTN,
BCDOPT_OPTEDIT, nt_cmdline->optedit);
bcd_patch_bool (&hive, objects, GUID_OPTN,
BCDOPT_TEXT, nt_cmdline->textmode);
bcd_patch_u64 (&hive, objects, GUID_OPTN,
BCDOPT_NX, nt_cmdline->nx);
bcd_patch_u64 (&hive, objects, GUID_OPTN,

BIN
utils/bcd

Binary file not shown.

View File

@ -54,6 +54,7 @@ bcdedit %bcd% /set %guidopt% safeboot minimal
bcdedit %bcd% /set %guidopt% safebootalternateshell yes
bcdedit %bcd% /set %guidopt% graphicsresolution 1024x768
bcdedit %bcd% /set %guidopt% highestmode true
bcdedit %bcd% /set %guidopt% graphicsmodedisabled true
bcdedit %bcd% /create {ramdiskoptions}
bcdedit %bcd% /set {ramdiskoptions} ramdisksdidevice "boot"