浏览代码

fix crashing in DOS version when language file specified (#32)

fix crashing in DOS version when language file specified with method from louyihua
Pal Lockheart 7 年之前
父节点
当前提交
f2734d2e3c
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      font.c

+ 3 - 2
font.c

@@ -85,14 +85,15 @@ static void PAL_LoadEmbeddedFont(void)
 
 
 	//
 	//
 	// Convert characters into unicode
 	// Convert characters into unicode
+	// Explictly specify BIG5 here for compatibility with codepage auto-detection
 	//
 	//
-	nChars = PAL_MultiByteToWideChar(char_buf, nBytes, NULL, 0);
+	nChars = PAL_MultiByteToWideCharCP(CP_BIG5, char_buf, nBytes, NULL, 0);
 	if (NULL == (wchar_buf = (wchar_t *)malloc(nChars * sizeof(wchar_t))))
 	if (NULL == (wchar_buf = (wchar_t *)malloc(nChars * sizeof(wchar_t))))
 	{
 	{
 		free(char_buf);
 		free(char_buf);
 		return;
 		return;
 	}
 	}
-	PAL_MultiByteToWideChar(char_buf, nBytes, wchar_buf, nChars);
+	PAL_MultiByteToWideCharCP(CP_BIG5, char_buf, nBytes, wchar_buf, nChars);
 	free(char_buf);
 	free(char_buf);
 
 
 	//
 	//