Only enter graphical terminal mode for menu
This commit is contained in:
parent
902109ef68
commit
5379787967
2
Makefile
2
Makefile
|
@ -32,7 +32,7 @@ echfs-test: test.img all
|
|||
echfs-utils -m -p0 test.img import test/test.elf boot/test.elf
|
||||
echfs-utils -m -p0 test.img import test/limine.cfg limine.cfg
|
||||
./limine-install src/limine.bin test.img
|
||||
qemu-system-x86_64 -hda test.img -debugcon stdio
|
||||
qemu-system-x86_64 -hda test.img -debugcon stdio -enable-kvm
|
||||
|
||||
ext2-test: test.img all
|
||||
$(MAKE) -C test
|
||||
|
|
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
|
@ -24,6 +24,7 @@ void (*set_text_bg)(int bg);
|
|||
static int rows, cols;
|
||||
|
||||
void term_vbe(void) {
|
||||
term_deinit();
|
||||
vbe_tty_init(&rows, &cols);
|
||||
|
||||
raw_putchar = vbe_putchar;
|
||||
|
@ -39,6 +40,7 @@ void term_vbe(void) {
|
|||
}
|
||||
|
||||
void term_textmode(void) {
|
||||
term_deinit();
|
||||
init_vga_textmode(&rows, &cols);
|
||||
|
||||
raw_putchar = text_putchar;
|
||||
|
|
21
src/main.c
21
src/main.c
|
@ -61,29 +61,22 @@ void main(int boot_drive) {
|
|||
init_e820();
|
||||
init_memmap();
|
||||
|
||||
char buf[32];
|
||||
|
||||
if (config_get_value(buf, 0, 32, "GRAPHICS")) {
|
||||
if (!strcmp(buf, "on")) {
|
||||
term_vbe();
|
||||
}
|
||||
}
|
||||
|
||||
char *cmdline = menu();
|
||||
|
||||
if (!config_get_value(buf, 0, 32, "KERNEL_PROTO")) {
|
||||
if (!config_get_value(buf, 0, 32, "PROTOCOL")) {
|
||||
char proto[32];
|
||||
if (!config_get_value(proto, 0, 32, "KERNEL_PROTO")) {
|
||||
if (!config_get_value(proto, 0, 32, "PROTOCOL")) {
|
||||
panic("PROTOCOL not specified");
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(buf, "stivale")) {
|
||||
if (!strcmp(proto, "stivale")) {
|
||||
stivale_load(cmdline, boot_drive);
|
||||
} else if (!strcmp(buf, "stivale2")) {
|
||||
} else if (!strcmp(proto, "stivale2")) {
|
||||
stivale2_load(cmdline, boot_drive);
|
||||
} else if (!strcmp(buf, "linux")) {
|
||||
} else if (!strcmp(proto, "linux")) {
|
||||
linux_load(cmdline, boot_drive);
|
||||
} else if (!strcmp(buf, "chainload")) {
|
||||
} else if (!strcmp(proto, "chainload")) {
|
||||
chainload();
|
||||
} else {
|
||||
panic("Invalid protocol specified");
|
||||
|
|
20
src/menu.c
20
src/menu.c
|
@ -17,15 +17,21 @@ static char config_entry_name[1024];
|
|||
char *menu(void) {
|
||||
cmdline = balloc(CMDLINE_MAX);
|
||||
|
||||
int timeout; {
|
||||
char buf[32];
|
||||
if (!config_get_value(buf, 0, 32, "TIMEOUT")) {
|
||||
timeout = 5;
|
||||
} else {
|
||||
timeout = (int)strtoui(buf);
|
||||
char buf[16];
|
||||
|
||||
if (config_get_value(buf, 0, 16, "GRAPHICS")) {
|
||||
if (!strcmp(buf, "on")) {
|
||||
term_vbe();
|
||||
}
|
||||
}
|
||||
|
||||
int timeout;
|
||||
if (!config_get_value(buf, 0, 16, "TIMEOUT")) {
|
||||
timeout = 5;
|
||||
} else {
|
||||
timeout = (int)strtoui(buf);
|
||||
}
|
||||
|
||||
disable_cursor();
|
||||
int selected_entry = 0;
|
||||
bool skip_timeout = false;
|
||||
|
@ -85,6 +91,7 @@ refresh:
|
|||
}
|
||||
}
|
||||
clear(true);
|
||||
term_textmode();
|
||||
return cmdline;
|
||||
case 'e':
|
||||
config_set_entry(selected_entry);
|
||||
|
@ -97,6 +104,7 @@ refresh:
|
|||
print("\n\n> ");
|
||||
gets(cmdline, cmdline, CMDLINE_MAX);
|
||||
clear(true);
|
||||
term_textmode();
|
||||
return cmdline;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue