From 1768abb217f974cf96448ee847453b604800c546 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 4 Sep 2026 19:18:23 -0400 Subject: add generic initrd seek function. begin work on init loading --- lib/virtterm.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/virtterm.c b/lib/virtterm.c index de43c51..fddd4d1 100644 --- a/lib/virtterm.c +++ b/lib/virtterm.c @@ -93,30 +93,26 @@ vt_init() return; } - jove_owned_obj_t *file_obj; - size_t file_i = 0; - while((file_obj = obj_take(objdir_getlocal(initrd_obj, file_i++)))) { - const char *filename = NULL; - if(initrd_file_name(file_obj, &filename) != 0) { - break; - } - if(strncmp(font_path, filename, strlen(font_path)) == 0) { - initrd_file_data(file_obj, (uintptr_t*)&s_font); - break; - } + jove_owned_obj_t *file_obj = initrd_seek(initrd_obj, font_path); + if(file_obj != NULL) { + s_font = initrd_file_data(file_obj); obj_release(file_obj); } - obj_release(file_obj); + obj_release(initrd_obj); if(s_font == NULL) { kprintf("Could not find file %s in initrd. VTT is disabled.\n", font_path); return; } + if(s_font->magic != PSF1_FONT_MAGIC) { + kprintf("Font '%s' does not match magic number! VTT is disabled.\n", font_path); + return; + } + s_init_vtty.fb_obj = ROOTDIR_FRAMEBUFFER_I; s_init_vtty.cursor_fg = 0x00FFFFFF; - { jove_owned_obj_t *fb_obj = obj_take(objdir_getlocal(_rootdir_obj, ROOTDIR_FRAMEBUFFER_I)); s_init_vtty.width = fb_width(fb_obj) / 9; -- cgit v1.2.3