Skip to content

Commit

Permalink
. 修正切换分辨率花屏问题。
Browse files Browse the repository at this point in the history
. 修正grldr.mbr。 issues #427
. 增加变量menu_tab_ext,避免重入主菜单时重复加载背景图及字库。
  例如:calc *0x8312&2 > nul || splashimage /boot/grub/lt.jpg
        calc *0x8312&4 > nul || font /boot/grub/unifont.hex.gz
  • Loading branch information
yaya2007 committed Sep 22, 2023
1 parent f47d76c commit 5b2435f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
7 changes: 7 additions & 0 deletions ChangeLog_chenall.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
更新说明:
2023-09-22 (yaya)
修正切换分辨率花屏问题。
修正grldr.mbr。 issues #427
增加变量menu_tab_ext,避免重入主菜单时重复加载背景图及字库。
例如:calc *0x8312&2 > nul || splashimage /boot/grub/lt.jpg
calc *0x8312&4 > nul || font /boot/grub/unifont.hex.gz

2023-08-18 (yaya)
修正2023-06-15补丁引入的bug,bootmgr不能加载grldr。
改进grldr.mbr及grldr.pbr对FAT12/FAT16分区的判断。
Expand Down
16 changes: 8 additions & 8 deletions stage2/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -4356,7 +4356,7 @@ splashimage_func(char *arg, int flags)
//graphics_cls();
fontx = backup_x;
fonty = backup_y;
menu_tab_ext |= 2;
menu_tab_ext |= 2; //已加载背景图像
return 1;
}

Expand Down Expand Up @@ -6565,7 +6565,7 @@ font_func (char *arg, int flags)
#endif

*(unsigned long *)(0x1800820) = 1; //2023-03-05
menu_tab_ext |= 4;
menu_tab_ext |= 4; //已加载字库
// if (font_h != 16) //迁就有的16*16字库不带0-0x7f字符(如SISO) 2023-03-01
if (font_h == 16 && *(unsigned long *)(UNIFONT_START+0x820+0x14) == 0) //16*16字库不带0-0x7f字符(优先使用自带字库) 2023-06-22
goto build_default_VGA_font;
Expand Down Expand Up @@ -15622,10 +15622,10 @@ 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_malloc (current_x_resolution * current_y_resolution * current_bytes_per_pixel);//应当在加载图像前设置
IMAGE_BUFFER = grub_zalloc (current_x_resolution * current_y_resolution * current_bytes_per_pixel);//应当在加载图像前设置 使用grub_malloc,切换分辨率可能花屏。2023-08-24
if (!JPG_FILE)
{
JPG_FILE = grub_malloc (0x8000);
JPG_FILE = grub_zalloc (0x8000); //使用grub_malloc,切换分辨率可能花屏。2023-08-24
}

#undef _X_
Expand Down Expand Up @@ -15694,9 +15694,9 @@ graphicsmode_func (char *arg, int flags)

// return old_graphics_mode;
if (graphics_mode > 0xFF)
menu_tab_ext |= 1;
else
menu_tab_ext &= 0xfe;
menu_tab_ext |= 1; //已在图形模式
// else
// menu_tab_ext &= 0xfe; //不在图形模式
return graphics_mode;
#else
return 0x12;
Expand Down Expand Up @@ -16782,7 +16782,7 @@ setmenu_func(char *arg, int flags)
else if (grub_memcmp (arg, "--u", 3) == 0)
{
menu_tab = 0;
menu_tab_ext = 0;
menu_tab_ext = 0; //初始化
num_string = 0;
DateTime_enable = 0;
menu_font_spacing = 0;
Expand Down
22 changes: 13 additions & 9 deletions stage2/grldrstart.S
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ disk_serial_number_structure_end:
#if 1
ljmp $GRLDR_CS, $(1f - _start1)
#else
pushw %ss /* 0x9400 */
pushw %ss /* 0x2000 */

//pushw $(1f - _start1)
.byte 0x6A, (1f - _start1)
Expand Down Expand Up @@ -6133,6 +6133,7 @@ helper_start:
je 1f
orb $0x80, 02(%si) /* force LBA */
1:
/* First, check for ext2 filesystem */
cmpw $0xEF53, 0x438 /* Magic signature */
jnz fat

Expand Down Expand Up @@ -6251,8 +6252,8 @@ fat:
//fat16
jmp 5f
3:
cmpl $0x20202020, 07(%si) /* ntfs Partition? */
jne 1f /* not */
// cmpl $0x20202020, 07(%si) /* ntfs Partition? */
// jne 1f /* not */


/* NTFS */
Expand Down Expand Up @@ -6432,15 +6433,18 @@ fat:
movw $(filename_12_64_ext - _start1), %di
pushw %cs
popw %es
testb $7, 02
// testb $7, 02
pushw %cs
popw %ds
jne 101f

// jne 101f
pushw %di
movb $0x20, %al
movw $12, %cx
repz movsb
jmp 105f
101:
repz stosb
popw %di
// repz movsb
// jmp 105f
//101:
pushw %di
102:
movsb
Expand Down

0 comments on commit 5b2435f

Please sign in to comment.