vbe: Fix bug where the vbe tty double buffer did not properly refresh
This commit is contained in:
parent
a9ff406d31
commit
faae7a002c
2
Makefile
2
Makefile
@ -51,7 +51,7 @@ echfs-test: all limine-install test.hdd
|
|||||||
rm -f limine.cfg.tmp part_guid
|
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 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/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
|
echfs-utils -g -p0 test.hdd import test/font.bin boot/font.bin
|
||||||
./limine-install limine.bin test.hdd
|
./limine-install limine.bin test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
||||||
|
2
bochsrc
2
bochsrc
@ -6,7 +6,7 @@ megs: 512
|
|||||||
|
|
||||||
clock: sync=realtime, time0=local
|
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
|
boot: c
|
||||||
|
|
||||||
|
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
BIN
stage2.map
BIN
stage2.map
Binary file not shown.
@ -166,7 +166,7 @@ void vbe_plot_bg_blent_rect(int x, int y, int width, int height, uint32_t hex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct vbe_char {
|
struct vbe_char {
|
||||||
uint8_t c;
|
uint32_t c;
|
||||||
uint32_t fg;
|
uint32_t fg;
|
||||||
uint32_t bg;
|
uint32_t bg;
|
||||||
};
|
};
|
||||||
@ -278,9 +278,7 @@ void vbe_set_text_bg(int bg) {
|
|||||||
|
|
||||||
void vbe_double_buffer_flush(void) {
|
void vbe_double_buffer_flush(void) {
|
||||||
for (size_t i = 0; i < (size_t)rows * cols; i++) {
|
for (size_t i = 0; i < (size_t)rows * cols; i++) {
|
||||||
struct vbe_char c = grid[i];
|
if (!memcmp(&grid[i], &front_grid[i], sizeof(struct vbe_char)))
|
||||||
|
|
||||||
if (!memcmp(&c, &front_grid[i], sizeof(struct vbe_char)))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
front_grid[i] = grid[i];
|
front_grid[i] = grid[i];
|
||||||
@ -288,20 +286,25 @@ void vbe_double_buffer_flush(void) {
|
|||||||
int x = i % cols;
|
int x = i % cols;
|
||||||
int y = i / cols;
|
int y = i / cols;
|
||||||
|
|
||||||
vbe_plot_char(&c, x * VGA_FONT_WIDTH + frame_width,
|
vbe_plot_char(&grid[i], x * VGA_FONT_WIDTH + frame_width,
|
||||||
y * VGA_FONT_HEIGHT + frame_height);
|
y * VGA_FONT_HEIGHT + frame_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vbe_double_buffer(bool state) {
|
void vbe_double_buffer(bool state) {
|
||||||
double_buffer_enabled = state;
|
|
||||||
if (state) {
|
if (state) {
|
||||||
memset(grid, 0, rows * cols * sizeof(struct vbe_char));
|
memcpy(front_grid, grid, rows * cols * sizeof(struct vbe_char));
|
||||||
memset(front_grid, 0, rows * cols * sizeof(struct vbe_char));
|
double_buffer_enabled = true;
|
||||||
vbe_clear(true);
|
vbe_clear(true);
|
||||||
vbe_double_buffer_flush();
|
vbe_double_buffer_flush();
|
||||||
} else {
|
} else {
|
||||||
|
bool pcs = cursor_status;
|
||||||
|
cursor_status = false;
|
||||||
vbe_clear(true);
|
vbe_clear(true);
|
||||||
|
vbe_double_buffer_flush();
|
||||||
|
cursor_status = pcs;
|
||||||
|
draw_cursor();
|
||||||
|
double_buffer_enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
test/bg.bmp
Normal file
BIN
test/bg.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
@ -10,7 +10,7 @@ STAGE2_MAP=bios://:1/boot/stage2.map
|
|||||||
THEME_COLOURS=60000000;aa0000;00aaff;aa5500;0000aa;aa00aa;9076de;aaaaaa
|
THEME_COLOURS=60000000;aa0000;00aaff;aa5500;0000aa;aa00aa;9076de;aaaaaa
|
||||||
THEME_MARGIN=64
|
THEME_MARGIN=64
|
||||||
|
|
||||||
BACKGROUND_PATH=$bios://:1/boot/bg.bmp.gz
|
BACKGROUND_PATH=bios://:1/boot/bg.bmp
|
||||||
|
|
||||||
:+Legacy
|
:+Legacy
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ KERNEL_CMDLINE=Hi! This is an example!
|
|||||||
MODULE_PATH=bios://:1/boot/test.elf
|
MODULE_PATH=bios://:1/boot/test.elf
|
||||||
MODULE_STRING=yooooo
|
MODULE_STRING=yooooo
|
||||||
|
|
||||||
MODULE_PATH=$bios://:1/boot/bg.bmp.gz
|
MODULE_PATH=bios://:1/boot/bg.bmp
|
||||||
MODULE_STRING=yooooo
|
MODULE_STRING=yooooo
|
||||||
|
|
||||||
:Stivale2 Test
|
:Stivale2 Test
|
||||||
@ -33,5 +33,5 @@ RESOLUTION=640x480x16
|
|||||||
KERNEL_PATH=bios://:1/boot/test.elf
|
KERNEL_PATH=bios://:1/boot/test.elf
|
||||||
KERNEL_CMDLINE=Woah! Another example!
|
KERNEL_CMDLINE=Woah! Another example!
|
||||||
|
|
||||||
MODULE_PATH=$bios://:1/boot/bg.bmp.gz
|
MODULE_PATH=bios://:1/boot/bg.bmp
|
||||||
MODULE_STRING=yooooo
|
MODULE_STRING=yooooo
|
||||||
|
Loading…
Reference in New Issue
Block a user