diff --git a/ChangeLog_chenall.txt b/ChangeLog_chenall.txt index 7cd84b6..4356e99 100644 --- a/ChangeLog_chenall.txt +++ b/ChangeLog_chenall.txt @@ -1,9 +1,14 @@ 更新说明: +2023-10-14 (yaya) + 修正增加变量menu_tab_ext引入的问题。 + 修正font函数。 + 2023-09-22 (yaya) 修正切换分辨率花屏问题。 修正grldr.mbr。 issues #427 - 增加变量menu_tab_ext,避免重入主菜单时重复加载背景图及字库。 - 例如:calc *0x8312&2 > nul || splashimage /boot/grub/lt.jpg + 增加变量menu_tab_ext,避免重入主菜单时重复设置图形模式、加载背景图及字库。 + 例如:calc *0x8312&1 > nul || graphicsmode -1 800 + calc *0x8312&2 > nul || splashimage /boot/grub/lt.jpg calc *0x8312&4 > nul || font /boot/grub/unifont.hex.gz 2023-08-18 (yaya) diff --git a/stage2/builtins.c b/stage2/builtins.c index bfea078..67a39ed 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -6468,11 +6468,10 @@ font_func (char *arg, int flags) i=0; while ((len = grub_read((unsigned long long)(unsigned int)(char*)&buf, 1, 0xedde0d90))) { + if (buf[0] == '#') //避免注释中含有'DotSize='字符串,清除已安装字库 2023-09-30 + while (grub_read((unsigned long long)(unsigned int)(char*)&buf, 1, 0xedde0d90) && buf[0] != '\n'); //跳过注释 if (buf[0] == '\n' || buf[0] == '\r') - { -//printf ("goto valid_lines=%d, buf=%s\n", valid_lines, buf); goto redo; /* try the new line */ - } if (buf[0] == '\0') /* NULL encountered ? */ break; /* yes, end */ @@ -15622,7 +15621,13 @@ graphicsmode_func (char *arg, int flags) current_bytes_per_pixel = (z+7)/8; if (IMAGE_BUFFER) //字库位置使用内存分配 2023-02-22 grub_free (IMAGE_BUFFER); - IMAGE_BUFFER = grub_zalloc (current_x_resolution * current_y_resolution * current_bytes_per_pixel);//应当在加载图像前设置 使用grub_malloc,切换分辨率可能花屏。2023-08-24 +// IMAGE_BUFFER = grub_zalloc (current_x_resolution * current_y_resolution * current_bytes_per_pixel);//应当在加载图像前设置 使用grub_malloc,切换分辨率可能花屏。2023-08-24 + IMAGE_BUFFER = grub_malloc (current_bytes_per_scanline * current_y_resolution); //如果设置了返回主菜单不重新加载背景图,背景图会被清除。2023-09-25 + if (graphics_mode != (unsigned int)tmp_graphicsmode) //如果当前图形模式与设置的不同 + { + menu_tab_ext &= 0xfd; //清除背景图已加载标记 + grub_memset (IMAGE_BUFFER, 0, current_bytes_per_scanline * current_y_resolution); //清除背景图,避免切换分辨率可能花屏 2023-09-25 + } if (!JPG_FILE) { JPG_FILE = grub_zalloc (0x8000); //使用grub_malloc,切换分辨率可能花屏。2023-08-24 diff --git a/stage2/stage2.c b/stage2/stage2.c index 21d5907..85a880d 100644 --- a/stage2/stage2.c +++ b/stage2/stage2.c @@ -2870,6 +2870,7 @@ extern int graphicsmode_func (char *, int); menu = "(md)0x880+0x200"; if (font_func (menu, 0)) { + menu_tab_ext &= 0xfb; //清除字库已加载标记 /* font exists, automatically enter graphics mode. */ if (! graphicsmode_in_menu_init) { @@ -2897,7 +2898,8 @@ extern int graphicsmode_func (char *, int); //font_func (NULL, 0); /* clear the font */ /* Clear the narrow_char_indicator for the NULL char only. */ // *(unsigned long *)UNIFONT_START = 0; // Enable next font command. - font_func (config_file, 0); + if (font_func (config_file, 0)) + menu_tab_ext &= 0xfb; //清除字库已加载标记 //font_func (NULL, 0); /* clear the font */ /* Clear the narrow_char_indicator for the NULL char only. */ // *(unsigned long *)UNIFONT_START = 0; // Enable next font command.