⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grub-0.97-patch6-chinese

📁 grub for dos ,people can use it in dos for calling linux
💻 97-PATCH6-CHINESE
📖 第 1 页 / 共 4 页
字号:
+			return 0;	/* graphics_init failure! */+		}     }      font8x16 = (unsigned char*)graphics_get_font();@@ -127,7 +166,7 @@     graphics_highlight_color = ((graphics_normal_color >> 4) |  				((graphics_normal_color & 0xf) << 4)); -    return 1;+    return 1;	/* graphics_init success */ }  /* Leave graphics mode */@@ -136,6 +175,7 @@     if (graphics_inited) {         set_videomode(saved_videomode);         graphics_inited = 0;+        ushFontReaded = 0;     } } @@ -463,21 +503,171 @@ }  +/* This function was modified by Gandalf for Chinese Support + *+ * Change Log:+ *	N/A+ * TODO:+ *      There is a empty line of the center of Chinese Character. !!!+ */ void graphics_cursor(int set) {     unsigned char *pat, *mem, *ptr, chr[16 << 2];-    int i, ch, invert, offset;+    int i, ch, invert, offset, n, ch1, ch2;++    int dotpos;+    unsigned char by[32], chsa[16], chsb[16];      if (set && no_scroll)         return;      offset = cursorY * 80 + fontx;+    fontloaded = 0;++    /* Unicode Support */     ch = text[fonty * 80 + fontx] & 0xff;     invert = (text[fonty * 80 + fontx] & 0xff00) != 0;-    pat = font8x16 + (ch << 4); +    pat = font8x16 + (ch << 4);						/* anscii code */+	+    if(stg2_ptborder)+    {+        if (ch == DISP_VERT  || ch == DISP_UR || ch == DISP_LL+        ||ch == DISP_HORIZ || ch == DISP_LR || ch == DISP_UL || ch <0xa1)+            goto ANSII_CODE;+    }++    if(ch >=0xa1)    /* Unicode - here is one trick, look one line as a string with '\0' ended, so, if the last byte is the 1st byte of a Chinese Character,,, ,,,*/+    {+        for (n = 0; n < fontx; n++)+        {+            ch1 = text[fonty * 80 + n] & 0xff;+            ch2 = text[fonty * 80 + n+1] & 0xff;++            if ((ch1>=0xa1 && ch1<=0xfe)&&(ch2>=0xa1 && ch2<=0xfe))+            {+                if (n == fontx-1)+                {+                    if (!ushFontReaded)+                    goto ANSII_CODE;++                    fontloaded = 1;+                    dotpos = (ch1-0xa1)*94 + ch2 - 0xa1;+                    dotpos<<=5;++                    ++                    grub_memmove(by, (unsigned char *) RAW_ADDR (0x500000 + dotpos), 32);++                    for (i = 0; i <32; i ++)+                    {+                        if (i%2)+                            chsb[i/2] = by[i];+                        else+                            chsa[i/2] = by[i];	+                    }+                }+	n ++;+            }+            else+	continue;			+        }+    }+ANSII_CODE:					/* here is another trick. Although this is maybe complex, it does work! */     mem = (unsigned char*)VIDEOMEM + offset; -    if (!set) {+    /* -------------------------------------------------------------- */+    if( fontloaded )+    {+        /* reset te mem position */+        mem = (unsigned char*)VIDEOMEM + offset -1;+        pat = chsa;++        if (!set) {+            for (i = 0; i < 16; i++) {+                unsigned char mask = pat[i];++            if (!invert) {+                chr[i     ] = ((unsigned char*)VSHADOW1)[offset-1];+                chr[16 + i] = ((unsigned char*)VSHADOW2)[offset-1];+                chr[32 + i] = ((unsigned char*)VSHADOW4)[offset-1];+                chr[48 + i] = ((unsigned char*)VSHADOW8)[offset-1];++                /* FIXME: if (shade) */+                if (1) {+                    if (ch == DISP_VERT || ch == DISP_LL ||+                        ch == DISP_UR || ch == DISP_LR) {+                        unsigned char pmask = ~(pat[i] >> 1);++                        chr[i     ] &= pmask;+                        chr[16 + i] &= pmask;+                        chr[32 + i] &= pmask;+                        chr[48 + i] &= pmask;+                    }+                    if (i > 0 && ch != DISP_VERT) {+                        unsigned char pmask = ~(pat[i - 1] >> 1);++                        chr[i     ] &= pmask;+                        chr[16 + i] &= pmask;+                        chr[32 + i] &= pmask;+                        chr[48 + i] &= pmask;+                        if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) {+                            pmask = ~pat[i - 1];++                            chr[i     ] &= pmask;+                            chr[16 + i] &= pmask;+                            chr[32 + i] &= pmask;+                            chr[48 + i] &= pmask;+                        }+                    }+                }+                chr[i     ] |= mask;+                chr[16 + i] |= mask;+                chr[32 + i] |= mask;+                chr[48 + i] |= mask;++                offset += 80;+            }+            else {+                chr[i     ] = mask;+                chr[16 + i] = mask;+                chr[32 + i] = mask;+                chr[48 + i] = mask;+            }+        }+    }+    else {+        MapMask(15);+        ptr = mem;+        for (i = 0; i < 16; i++, ptr += 80) {+            cursorBuf[i] = pat[i];+            *ptr = ~pat[i];+        }+        return;+    }++    offset = 0;+    for (i = 1; i < 16; i <<= 1, offset += 16) {+        int j;++        MapMask(i);+        ptr = mem;+        for (j = 0; j < 16; j++, ptr += 80)+            *ptr = chr[j + offset];+    }++    MapMask(15);+	}+    /* =================================================================== */+     /* reset te mem position */+		+        if (fontloaded)+        {+            mem += 1;+            pat = chsb;+            offset = cursorY * 80 + fontx;+        }+		+	if (!set) {         for (i = 0; i < 16; i++) {             unsigned char mask = pat[i]; diff -Naur grub-0.97_splash/stage2/shared.h grub-0.97_chinese/stage2/shared.h--- grub-0.97_splash/stage2/shared.h	2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_chinese/stage2/shared.h	2006-10-24 12:28:52.000000000 +0800@@ -388,6 +388,12 @@  *  Below this should be ONLY defines and other constructs for C code.  */ ++extern char fontfile[256];+unsigned short stg2_ptborder;+extern int graphics_inited;+extern unsigned short ushFontReaded;+ /* multiboot stuff */  #include "mb_header.h"@@ -907,6 +913,10 @@   char *short_doc;   /* The long version of the documentation.  */   char *long_doc;+  /* The short-chinese version of the documentation.  */+  char *sc_short_doc;+  /* The long version-chinese of the documentation.  */+  char *sc_long_doc; };  /* All the builtins are registered in this.  */diff -Naur grub-0.97_splash/stage2/stage2.c grub-0.97_chinese/stage2/stage2.c--- grub-0.97_splash/stage2/stage2.c	2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_chinese/stage2/stage2.c	2006-10-24 12:28:52.000000000 +0800@@ -209,6 +209,8 @@      gotoxy (1, y); +  stg2_ptborder = 1;		/* Chinese Season */+     grub_putchar (DISP_UL);   for (i = 0; i < 73; i++)     grub_putchar (DISP_HORIZ);@@ -234,6 +236,8 @@     grub_putchar (DISP_HORIZ);   grub_putchar (DISP_LR); +  stg2_ptborder = 0;+     if (current_term->setcolorstate)     current_term->setcolorstate (COLOR_STATE_STANDARD); }@@ -307,8 +311,17 @@ 	      grub_timeout--; 	       	      /* Print a message.  */+#ifdef SUPPORT_GRAPHICS+		if (graphics_inited && ushFontReaded)+			grub_printf ("\r按下 `ESC' 键进入菜单... %d   ",+			   grub_timeout);+		else 	      grub_printf ("\rPress `ESC' to enter the menu... %d   ", 			   grub_timeout);+#else+	      grub_printf ("\rPress `ESC' to enter the menu... %d   ",+			   grub_timeout);+#endif 	    } 	}     }@@ -324,32 +337,87 @@       else 	print_border (3, 12); +#ifdef SUPPORT_GRAPHICS+	if (graphics_inited && ushFontReaded)+      grub_printf ("\n\+      使用 %c 和 %c 两键将一个菜单项选为高亮状态。\n",+		   DISP_UP, DISP_DOWN);+	else+      grub_printf ("\n\+      Use the %c and %c keys to select which entry is highlighted.\n",+		   DISP_UP, DISP_DOWN);+#else       grub_printf ("\n\       Use the %c and %c keys to select which entry is highlighted.\n", 		   DISP_UP, DISP_DOWN);+#endif              if (! auth && password) 	{+#ifdef SUPPORT_GRAPHICS+	if (graphics_inited && ushFontReaded)+	  printf ("\+      按回车键载入选中的操作系统,或者按 \'p\' 输入\n\+      密码以解开下一个功能集。");+	else+	  printf ("\+      Press enter to boot the selected OS or \'p\' to enter a\n\+      password to unlock the next set of features.");+#else 	  printf ("\       Press enter to boot the selected OS or \'p\' to enter a\n\       password to unlock the next set of features.");+#endif 	}       else 	{ 	  if (config_entries)+#ifdef SUPPORT_GRAPHICS+	if (graphics_inited && ushFontReaded)+	    printf ("\+      按回车键载入选中的操作系统,按 \'e\' 编辑引导参数,\n\+      或者按 \'c\' 转入到命令行中。");		+	else+	    printf ("\+      Press enter to boot the selected OS, \'e\' to edit the\n\+      commands before booting, or \'c\' for a command-line.");+#else 	    printf ("\       Press enter to boot the selected OS, \'e\' to edit the\n\       commands before booting, or \'c\' for a command-line.");+#endif 	  else+#ifdef SUPPORT_GRAPHICS+	if (graphics_inited && ushFontReaded)+	    printf ("\+      按 \'b\' 进行引导, 按 \'e\' 编辑选中者的引导参数,\n\+      按 \'c\' 进入命令行,按 \'o\' 将在当前行之后打开一个\n\+      新行(\'O\' 则为之前),按 \'d\' 删除当前行,\n\+      按 `ESC` 则会返回主菜单。");+	else+	    printf ("\+      Press \'b\' to boot, \'e\' to edit the selected command in the\n\+      boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\+      after (\'O\' for before) the selected line, \'d\' to remove the\n\+      selected line, or escape to go back to the main menu.");+#else 	    printf ("\       Press \'b\' to boot, \'e\' to edit the selected command in the\n\       boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\       after (\'O\' for before) the selected line, \'d\' to remove the\n\       selected line, or escape to go back to the main menu.");+#endif 	}        if (current_term->flags & TERM_DUMB)+#ifdef SUPPORT_GRAPHICS+	if (graphics_inited && ushFontReaded)+		grub_printf ("\n\n当前选中项为:%d ", entryno);+	else+		grub_printf ("\n\nThe selected entry is %d ", entryno);+#else 	grub_printf ("\n\nThe selected entry is %d ", entryno);+#endif       else 	print_entries (3, 12, first_entry, entryno, menu_entries);     }@@ -374,13 +442,31 @@ 	  time2 = time1;  	  if (current_term->flags & TERM_DUMB)+#ifdef SUPPORT_GRAPHICS+	if (graphics_inited && ushFontReaded)+	      grub_printf ("\r    条目 %d 将会自动运行于 %d 秒之后。  ", +			   entryno, grub_timeout);+	else 	      grub_printf ("\r    Entry %d will be booted automatically in %d seconds.   ",  			   entryno, grub_timeout);+#else+	      grub_printf ("\r    Entry %d will be booted automatically in %d seconds.   ", +			   entryno, grub_timeout);+#endif 	  else 	    { 	      gotoxy (3, 22);+#ifdef SUPPORT_GRAPHICS+	if (graphics_inited && ushFontReaded)+	      grub_printf ("高亮选中的条目将会自动运行于 %d 秒之后。  ",+			   grub_timeout);+	else+	      grub_printf ("The highlighted entry will be booted automatically in %d seconds.    ",+			   grub_timeout);+#else 	      grub_printf ("The highlighted entry will be booted automatically in %d seconds.    ", 			   grub_timeout);+#endif 	      gotoxy (74, 4 + entryno); 	  } 	  @@ -398,7 +484,14 @@ 	     since we're comming in here also on GRUB_TIMEOUT == -1 and 	     hang in GETKEY */ 	  if (current_term->flags & TERM_DUMB)+	  {+#ifdef SUPPORT_GRAPHICS+	    if (graphics_inited && ushFontReaded)+		grub_printf ("\r    高亮选中的条目为 %d: ", entryno);+	    else+#endif 	    grub_printf ("\r    Highlighted entry is %d: ", entryno);+	  }  	  c = ASCII_CHAR (getkey ()); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -