vbe: Fix bug where the vbe tty double buffer did not properly refresh
diff --git a/Makefile b/Makefile
index 70ca9c15..4969da33 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ echfs-test: all limine-install test.hdd
rm -f limine.cfg.tmp part_guid
echfs-utils -g -p0 test.hdd import stage2.map boot/stage2.map
echfs-utils -g -p0 test.hdd import test/test.elf boot/test.elf
- echfs-utils -g -p0 test.hdd import test/bg.bmp.gz boot/bg.bmp.gz
+ echfs-utils -g -p0 test.hdd import test/bg.bmp boot/bg.bmp
echfs-utils -g -p0 test.hdd import test/font.bin boot/font.bin
./limine-install limine.bin test.hdd
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
diff --git a/bochsrc b/bochsrc
index 8b69e354..0eedd17c 100644
--- a/bochsrc
+++ b/bochsrc
@@ -6,7 +6,7 @@ megs: 512
clock: sync=realtime, time0=local
-ata0-master: type=disk, path="test.img", mode=flat
+ata0-master: type=disk, path="test.hdd", mode=flat
boot: c
diff --git a/limine-pxe.bin b/limine-pxe.bin
index 30de5b01..74c81b60 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 4b923158..ad9cdc3d 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index f3911588..501f70b9 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/drivers/vbe.c b/stage2/drivers/vbe.c
index 6414a557..d5b2f5cf 100644
--- a/stage2/drivers/vbe.c
+++ b/stage2/drivers/vbe.c
@@ -166,7 +166,7 @@ void vbe_plot_bg_blent_rect(int x, int y, int width, int height, uint32_t hex) {
}
struct vbe_char {
- uint8_t c;
+ uint32_t c;
uint32_t fg;
uint32_t bg;
};
@@ -278,9 +278,7 @@ void vbe_set_text_bg(int bg) {
void vbe_double_buffer_flush(void) {
for (size_t i = 0; i < (size_t)rows * cols; i++) {
- struct vbe_char c = grid[i];
-
- if (!memcmp(&c, &front_grid[i], sizeof(struct vbe_char)))
+ if (!memcmp(&grid[i], &front_grid[i], sizeof(struct vbe_char)))
continue;
front_grid[i] = grid[i];
@@ -288,20 +286,25 @@ void vbe_double_buffer_flush(void) {
int x = i % cols;
int y = i / cols;
- vbe_plot_char(&c, x * VGA_FONT_WIDTH + frame_width,
- y * VGA_FONT_HEIGHT + frame_height);
+ vbe_plot_char(&grid[i], x * VGA_FONT_WIDTH + frame_width,
+ y * VGA_FONT_HEIGHT + frame_height);
}
}
void vbe_double_buffer(bool state) {
- double_buffer_enabled = state;
if (state) {
- memset(grid, 0, rows * cols * sizeof(struct vbe_char));
- memset(front_grid, 0, rows * cols * sizeof(struct vbe_char));
+ memcpy(front_grid, grid, rows * cols * sizeof(struct vbe_char));
+ double_buffer_enabled = true;
vbe_clear(true);
vbe_double_buffer_flush();
} else {
+ bool pcs = cursor_status;
+ cursor_status = false;
vbe_clear(true);
+ vbe_double_buffer_flush();
+ cursor_status = pcs;
+ draw_cursor();
+ double_buffer_enabled = false;
}
}
diff --git a/test/bg.bmp b/test/bg.bmp
new file mode 100644
index 00000000..37d8026e
Binary files /dev/null and b/test/bg.bmp differ
diff --git a/test/limine.cfg b/test/limine.cfg
index 0f5d7e22..5b974048 100644
--- a/test/limine.cfg
+++ b/test/limine.cfg
@@ -10,7 +10,7 @@ STAGE2_MAP=bios://:1/boot/stage2.map
THEME_COLOURS=60000000;aa0000;00aaff;aa5500;0000aa;aa00aa;9076de;aaaaaa
THEME_MARGIN=64
-BACKGROUND_PATH=$bios://:1/boot/bg.bmp.gz
+BACKGROUND_PATH=bios://:1/boot/bg.bmp
:+Legacy
@@ -23,7 +23,7 @@ KERNEL_CMDLINE=Hi! This is an example!
MODULE_PATH=bios://:1/boot/test.elf
MODULE_STRING=yooooo
-MODULE_PATH=$bios://:1/boot/bg.bmp.gz
+MODULE_PATH=bios://:1/boot/bg.bmp
MODULE_STRING=yooooo
:Stivale2 Test
@@ -33,5 +33,5 @@ RESOLUTION=640x480x16
KERNEL_PATH=bios://:1/boot/test.elf
KERNEL_CMDLINE=Woah! Another example!
-MODULE_PATH=$bios://:1/boot/bg.bmp.gz
+MODULE_PATH=bios://:1/boot/bg.bmp
MODULE_STRING=yooooo
