mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-18 17:32:24 +08:00
TTF output to display Chinese and Korean filenames with code pages 936/949/950
This commit is contained in:
@@ -11,8 +11,9 @@
|
|||||||
4DOS files, text utilties in TEXTUTIL directory and
|
4DOS files, text utilties in TEXTUTIL directory and
|
||||||
TITLE command to change window title. (Wengier)
|
TITLE command to change window title. (Wengier)
|
||||||
- CHCP command in the Truetype font (TTF) output now
|
- CHCP command in the Truetype font (TTF) output now
|
||||||
allows code page 932 for display Japanese filenames
|
allows code page 932, 936, 949, and 950 for display
|
||||||
when DBCS is enabled in non-PC98 mode. (Wengier)
|
Chinese, Japanese and Korean filenames when DBCS is
|
||||||
|
enabled in non-PC98 mode. (Wengier)
|
||||||
- Command-line option -fastlaunch will now suppress
|
- Command-line option -fastlaunch will now suppress
|
||||||
messages by "automountall=true" option. (Wengier)
|
messages by "automountall=true" option. (Wengier)
|
||||||
- The return value of AL in Int21/AX=0Eh is no longer
|
- The return value of AL in Int21/AX=0Eh is no longer
|
||||||
|
22065
contrib/mappings/CP936.TXT
Normal file
22065
contrib/mappings/CP936.TXT
Normal file
File diff suppressed because it is too large
Load Diff
17322
contrib/mappings/CP949.TXT
Normal file
17322
contrib/mappings/CP949.TXT
Normal file
File diff suppressed because it is too large
Load Diff
13777
contrib/mappings/CP950.TXT
Normal file
13777
contrib/mappings/CP950.TXT
Normal file
File diff suppressed because it is too large
Load Diff
@@ -18,4 +18,6 @@
|
|||||||
./sb2u.pl cp872_to_unicode <CP872.TXT >../../include/cp872_uni.h || exit 1
|
./sb2u.pl cp872_to_unicode <CP872.TXT >../../include/cp872_uni.h || exit 1
|
||||||
./sb2u.pl cp874_to_unicode <CP874.TXT >../../include/cp874_uni.h || exit 1
|
./sb2u.pl cp874_to_unicode <CP874.TXT >../../include/cp874_uni.h || exit 1
|
||||||
./sjis2u.pl cp932_to_unicode <CP932.TXT >../../include/cp932_uni.h || exit 1
|
./sjis2u.pl cp932_to_unicode <CP932.TXT >../../include/cp932_uni.h || exit 1
|
||||||
|
./sjis2u.pl cp936_to_unicode <CP936.TXT >../../include/cp936_uni.h || exit 1
|
||||||
|
./sjis2u.pl cp949_to_unicode <CP949.TXT >../../include/cp949_uni.h || exit 1
|
||||||
|
./sjis2u.pl cp950_to_unicode <CP950.TXT >../../include/cp950_uni.h || exit 1
|
||||||
|
@@ -70,7 +70,7 @@ for ($y=0;$y < 65536;$y += $pagesize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "/* double-byte SHIFT-JIS charset to unicode. 0x0000 means no mapping */\n";
|
print "/* DBCS (double-byte) charset to unicode. 0x0000 means no mapping */\n";
|
||||||
print "/* hi = (code >> 6) */\n";
|
print "/* hi = (code >> 6) */\n";
|
||||||
print "/* lo = code & 0x3F */\n";
|
print "/* lo = code & 0x3F */\n";
|
||||||
print "/* rawoff = $arrayname"."_hitbl[hi] */\n";
|
print "/* rawoff = $arrayname"."_hitbl[hi] */\n";
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* double-byte SHIFT-JIS charset to unicode. 0x0000 means no mapping */
|
/* DBCS (double-byte) charset to unicode. 0x0000 means no mapping */
|
||||||
/* hi = (code >> 6) */
|
/* hi = (code >> 6) */
|
||||||
/* lo = code & 0x3F */
|
/* lo = code & 0x3F */
|
||||||
/* rawoff = cp932_to_unicode_hitbl[hi] */
|
/* rawoff = cp932_to_unicode_hitbl[hi] */
|
||||||
|
4273
include/cp936_uni.h
Normal file
4273
include/cp936_uni.h
Normal file
File diff suppressed because it is too large
Load Diff
3886
include/cp949_uni.h
Normal file
3886
include/cp949_uni.h
Normal file
File diff suppressed because it is too large
Load Diff
3382
include/cp950_uni.h
Normal file
3382
include/cp950_uni.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -87,6 +87,9 @@
|
|||||||
#include "cp872_uni.h"
|
#include "cp872_uni.h"
|
||||||
#include "cp874_uni.h"
|
#include "cp874_uni.h"
|
||||||
#include "cp932_uni.h"
|
#include "cp932_uni.h"
|
||||||
|
#include "cp936_uni.h"
|
||||||
|
#include "cp949_uni.h"
|
||||||
|
#include "cp950_uni.h"
|
||||||
|
|
||||||
#if defined(PATH_MAX) && !defined(MAX_PATH)
|
#if defined(PATH_MAX) && !defined(MAX_PATH)
|
||||||
#define MAX_PATH PATH_MAX
|
#define MAX_PATH PATH_MAX
|
||||||
@@ -199,7 +202,7 @@ template <class MT> bool String_DBCS_TO_HOST_SHIFTJIS_uint16(uint16_t *d/*CROSS_
|
|||||||
|
|
||||||
while (*s != 0 && s < sf) {
|
while (*s != 0 && s < sf) {
|
||||||
uint16_t ic = (unsigned char)(*s++);
|
uint16_t ic = (unsigned char)(*s++);
|
||||||
if ((ic & 0xE0) == 0x80 || (ic & 0xE0) == 0xE0) {
|
if ((dos.loaded_codepage==932 &&((ic & 0xE0) == 0x80 || (ic & 0xE0) == 0xE0)) || ((dos.loaded_codepage==936 || dos.loaded_codepage==949 || dos.loaded_codepage==950) && (ic & 0x80) == 0x80)) {
|
||||||
if (*s == 0) return false;
|
if (*s == 0) return false;
|
||||||
ic <<= 8U;
|
ic <<= 8U;
|
||||||
ic += (unsigned char)(*s++);
|
ic += (unsigned char)(*s++);
|
||||||
@@ -229,7 +232,7 @@ template <class MT> bool String_DBCS_TO_HOST_SHIFTJIS(host_cnv_char_t *d/*CROSS_
|
|||||||
|
|
||||||
while (*s != 0 && s < sf) {
|
while (*s != 0 && s < sf) {
|
||||||
uint16_t ic = (unsigned char)(*s++);
|
uint16_t ic = (unsigned char)(*s++);
|
||||||
if ((ic & 0xE0) == 0x80 || (ic & 0xE0) == 0xE0) {
|
if ((dos.loaded_codepage==932 &&((ic & 0xE0) == 0x80 || (ic & 0xE0) == 0xE0)) || ((dos.loaded_codepage==936 || dos.loaded_codepage==949 || dos.loaded_codepage==950) && (ic & 0x80) == 0x80)) {
|
||||||
if (*s == 0) return false;
|
if (*s == 0) return false;
|
||||||
ic <<= 8U;
|
ic <<= 8U;
|
||||||
ic += (unsigned char)(*s++);
|
ic += (unsigned char)(*s++);
|
||||||
@@ -414,6 +417,12 @@ bool CodePageHostToGuest(char *d/*CROSS_LEN*/,const host_cnv_char_t *s/*CROSS_LE
|
|||||||
return String_HOST_TO_SBCS<uint16_t>(d,s,cp874_to_unicode,sizeof(cp874_to_unicode)/sizeof(cp874_to_unicode[0]));
|
return String_HOST_TO_SBCS<uint16_t>(d,s,cp874_to_unicode,sizeof(cp874_to_unicode)/sizeof(cp874_to_unicode[0]));
|
||||||
case 932:
|
case 932:
|
||||||
return String_HOST_TO_DBCS_SHIFTJIS<uint16_t>(d,s,cp932_to_unicode_hitbl,cp932_to_unicode_raw,sizeof(cp932_to_unicode_raw)/sizeof(cp932_to_unicode_raw[0]));
|
return String_HOST_TO_DBCS_SHIFTJIS<uint16_t>(d,s,cp932_to_unicode_hitbl,cp932_to_unicode_raw,sizeof(cp932_to_unicode_raw)/sizeof(cp932_to_unicode_raw[0]));
|
||||||
|
case 936:
|
||||||
|
return String_HOST_TO_DBCS_SHIFTJIS<uint16_t>(d,s,cp936_to_unicode_hitbl,cp936_to_unicode_raw,sizeof(cp936_to_unicode_raw)/sizeof(cp936_to_unicode_raw[0]));
|
||||||
|
case 949:
|
||||||
|
return String_HOST_TO_DBCS_SHIFTJIS<uint16_t>(d,s,cp949_to_unicode_hitbl,cp949_to_unicode_raw,sizeof(cp949_to_unicode_raw)/sizeof(cp949_to_unicode_raw[0]));
|
||||||
|
case 950:
|
||||||
|
return String_HOST_TO_DBCS_SHIFTJIS<uint16_t>(d,s,cp950_to_unicode_hitbl,cp950_to_unicode_raw,sizeof(cp950_to_unicode_raw)/sizeof(cp950_to_unicode_raw[0]));
|
||||||
default:
|
default:
|
||||||
/* at this time, it would be cruel and unusual to not allow any file I/O just because
|
/* at this time, it would be cruel and unusual to not allow any file I/O just because
|
||||||
* our code page support is so limited. */
|
* our code page support is so limited. */
|
||||||
@@ -467,6 +476,12 @@ bool CodePageGuestToHostUint16(uint16_t *d/*CROSS_LEN*/,const char *s/*CROSS_LEN
|
|||||||
return String_SBCS_TO_HOST_uint16<uint16_t>(d,s,cp874_to_unicode,sizeof(cp874_to_unicode)/sizeof(cp874_to_unicode[0]));
|
return String_SBCS_TO_HOST_uint16<uint16_t>(d,s,cp874_to_unicode,sizeof(cp874_to_unicode)/sizeof(cp874_to_unicode[0]));
|
||||||
case 932:
|
case 932:
|
||||||
return String_DBCS_TO_HOST_SHIFTJIS_uint16<uint16_t>(d,s,cp932_to_unicode_hitbl,cp932_to_unicode_raw,sizeof(cp932_to_unicode_raw)/sizeof(cp932_to_unicode_raw[0]));
|
return String_DBCS_TO_HOST_SHIFTJIS_uint16<uint16_t>(d,s,cp932_to_unicode_hitbl,cp932_to_unicode_raw,sizeof(cp932_to_unicode_raw)/sizeof(cp932_to_unicode_raw[0]));
|
||||||
|
case 936:
|
||||||
|
return String_DBCS_TO_HOST_SHIFTJIS_uint16<uint16_t>(d,s,cp936_to_unicode_hitbl,cp936_to_unicode_raw,sizeof(cp936_to_unicode_raw)/sizeof(cp936_to_unicode_raw[0]));
|
||||||
|
case 949:
|
||||||
|
return String_DBCS_TO_HOST_SHIFTJIS_uint16<uint16_t>(d,s,cp949_to_unicode_hitbl,cp949_to_unicode_raw,sizeof(cp949_to_unicode_raw)/sizeof(cp949_to_unicode_raw[0]));
|
||||||
|
case 950:
|
||||||
|
return String_DBCS_TO_HOST_SHIFTJIS_uint16<uint16_t>(d,s,cp950_to_unicode_hitbl,cp950_to_unicode_raw,sizeof(cp950_to_unicode_raw)/sizeof(cp950_to_unicode_raw[0]));
|
||||||
default: // Otherwise just use code page 437
|
default: // Otherwise just use code page 437
|
||||||
return String_SBCS_TO_HOST_uint16<uint16_t>(d,s,cp437_to_unicode,sizeof(cp437_to_unicode)/sizeof(cp437_to_unicode[0]));
|
return String_SBCS_TO_HOST_uint16<uint16_t>(d,s,cp437_to_unicode,sizeof(cp437_to_unicode)/sizeof(cp437_to_unicode[0]));
|
||||||
}
|
}
|
||||||
@@ -514,6 +529,12 @@ bool CodePageGuestToHost(host_cnv_char_t *d/*CROSS_LEN*/,const char *s/*CROSS_LE
|
|||||||
return String_SBCS_TO_HOST<uint16_t>(d,s,cp874_to_unicode,sizeof(cp874_to_unicode)/sizeof(cp874_to_unicode[0]));
|
return String_SBCS_TO_HOST<uint16_t>(d,s,cp874_to_unicode,sizeof(cp874_to_unicode)/sizeof(cp874_to_unicode[0]));
|
||||||
case 932:
|
case 932:
|
||||||
return String_DBCS_TO_HOST_SHIFTJIS<uint16_t>(d,s,cp932_to_unicode_hitbl,cp932_to_unicode_raw,sizeof(cp932_to_unicode_raw)/sizeof(cp932_to_unicode_raw[0]));
|
return String_DBCS_TO_HOST_SHIFTJIS<uint16_t>(d,s,cp932_to_unicode_hitbl,cp932_to_unicode_raw,sizeof(cp932_to_unicode_raw)/sizeof(cp932_to_unicode_raw[0]));
|
||||||
|
case 936:
|
||||||
|
return String_DBCS_TO_HOST_SHIFTJIS<uint16_t>(d,s,cp936_to_unicode_hitbl,cp936_to_unicode_raw,sizeof(cp936_to_unicode_raw)/sizeof(cp936_to_unicode_raw[0]));
|
||||||
|
case 949:
|
||||||
|
return String_DBCS_TO_HOST_SHIFTJIS<uint16_t>(d,s,cp949_to_unicode_hitbl,cp949_to_unicode_raw,sizeof(cp949_to_unicode_raw)/sizeof(cp949_to_unicode_raw[0]));
|
||||||
|
case 950:
|
||||||
|
return String_DBCS_TO_HOST_SHIFTJIS<uint16_t>(d,s,cp950_to_unicode_hitbl,cp950_to_unicode_raw,sizeof(cp950_to_unicode_raw)/sizeof(cp950_to_unicode_raw[0]));
|
||||||
default:
|
default:
|
||||||
/* at this time, it would be cruel and unusual to not allow any file I/O just because
|
/* at this time, it would be cruel and unusual to not allow any file I/O just because
|
||||||
* our code page support is so limited. */
|
* our code page support is so limited. */
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "dosbox.h"
|
#include "dosbox.h"
|
||||||
#include "cross.h"
|
#include "cross.h"
|
||||||
#include "support.h"
|
#include "support.h"
|
||||||
|
#include "dos_inc.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -225,6 +226,7 @@ bool Cross::IsPathAbsolute(std::string const& in) {
|
|||||||
#if defined (WIN32)
|
#if defined (WIN32)
|
||||||
typedef wchar_t host_cnv_char_t;
|
typedef wchar_t host_cnv_char_t;
|
||||||
extern char *CodePageHostToGuest(const host_cnv_char_t *s);
|
extern char *CodePageHostToGuest(const host_cnv_char_t *s);
|
||||||
|
extern bool enable_dbcs_tables;
|
||||||
|
|
||||||
/* does the filename fit the 8.3 format? */
|
/* does the filename fit the 8.3 format? */
|
||||||
static bool is_filename_8by3w(const wchar_t* fname) {
|
static bool is_filename_8by3w(const wchar_t* fname) {
|
||||||
@@ -235,7 +237,7 @@ static bool is_filename_8by3w(const wchar_t* fname) {
|
|||||||
i=0;
|
i=0;
|
||||||
while (*fname != 0 && *fname != L'.') {
|
while (*fname != 0 && *fname != L'.') {
|
||||||
if (*fname<=32||*fname==127||*fname==L'"'||*fname==L'+'||*fname==L'='||*fname==L','||*fname==L';'||*fname==L':'||*fname==L'<'||*fname==L'>'||*fname==L'|'||*fname==L'?'||*fname==L'*') return false;
|
if (*fname<=32||*fname==127||*fname==L'"'||*fname==L'+'||*fname==L'='||*fname==L','||*fname==L';'||*fname==L':'||*fname==L'<'||*fname==L'>'||*fname==L'|'||*fname==L'?'||*fname==L'*') return false;
|
||||||
if (IS_PC98_ARCH && (*fname & 0xFF00u) != 0u && (*fname & 0xFCu) != 0x08u) i++;
|
if ((IS_PC98_ARCH || ((dos.loaded_codepage==932 || dos.loaded_codepage==936 || dos.loaded_codepage==949 || dos.loaded_codepage==950) && enable_dbcs_tables)) && (*fname & 0xFF00u) != 0u && (*fname & 0xFCu) != 0x08u) i++;
|
||||||
fname++; i++;
|
fname++; i++;
|
||||||
}
|
}
|
||||||
if (i > 8) return false;
|
if (i > 8) return false;
|
||||||
@@ -246,7 +248,7 @@ static bool is_filename_8by3w(const wchar_t* fname) {
|
|||||||
i=0;
|
i=0;
|
||||||
while (*fname != 0 && *fname != L'.') {
|
while (*fname != 0 && *fname != L'.') {
|
||||||
if (*fname<=32||*fname==127||*fname==L'"'||*fname==L'+'||*fname==L'='||*fname==L','||*fname==L';'||*fname==L':'||*fname==L'<'||*fname==L'>'||*fname==L'|'||*fname==L'?'||*fname==L'*') return false;
|
if (*fname<=32||*fname==127||*fname==L'"'||*fname==L'+'||*fname==L'='||*fname==L','||*fname==L';'||*fname==L':'||*fname==L'<'||*fname==L'>'||*fname==L'|'||*fname==L'?'||*fname==L'*') return false;
|
||||||
if (IS_PC98_ARCH && (*fname & 0xFF00u) != 0u && (*fname & 0xFCu) != 0x08u) i++;
|
if ((IS_PC98_ARCH || ((dos.loaded_codepage==932 || dos.loaded_codepage==936 || dos.loaded_codepage==949 || dos.loaded_codepage==950) && enable_dbcs_tables)) && (*fname & 0xFF00u) != 0u && (*fname & 0xFCu) != 0x08u) i++;
|
||||||
fname++; i++;
|
fname++; i++;
|
||||||
}
|
}
|
||||||
if (i > 3) return false;
|
if (i > 3) return false;
|
||||||
|
@@ -1514,7 +1514,7 @@ void SHELL_Init() {
|
|||||||
MSG_Add("SHELL_CMD_ALIAS_HELP", "Defines or displays aliases.\n");
|
MSG_Add("SHELL_CMD_ALIAS_HELP", "Defines or displays aliases.\n");
|
||||||
MSG_Add("SHELL_CMD_ALIAS_HELP_LONG", "ALIAS [name[=value] ... ]\n\nType ALIAS without parameters to display the list of aliases in the form:\n`ALIAS NAME = VALUE'\n");
|
MSG_Add("SHELL_CMD_ALIAS_HELP_LONG", "ALIAS [name[=value] ... ]\n\nType ALIAS without parameters to display the list of aliases in the form:\n`ALIAS NAME = VALUE'\n");
|
||||||
MSG_Add("SHELL_CMD_CHCP_HELP", "Displays or changes the current DOS code page.\n");
|
MSG_Add("SHELL_CMD_CHCP_HELP", "Displays or changes the current DOS code page.\n");
|
||||||
MSG_Add("SHELL_CMD_CHCP_HELP_LONG", "CHCP [nnn]\n\n nnn Specifies a code page number.\n\nSupported code pages for changing in the TrueType font output:\n437,808,850,852,853,855,857,858,860,861,862,863,864,865,866,869,872,874,932\n");
|
MSG_Add("SHELL_CMD_CHCP_HELP_LONG", "CHCP [nnn]\n\n nnn Specifies a code page number.\n\nSupported code pages for changing in the TrueType font output:\n437,808,850,852,853,855,857,858,860,861,862,863,864,865,866,869,872,874\n\nAlso double-byte code pages including 932, 936, 949, and 950.\n");
|
||||||
MSG_Add("SHELL_CMD_CHCP_ACTIVE", "Active code page: %d\n");
|
MSG_Add("SHELL_CMD_CHCP_ACTIVE", "Active code page: %d\n");
|
||||||
MSG_Add("SHELL_CMD_CHCP_INVALID", "Invalid code page number - %s\n");
|
MSG_Add("SHELL_CMD_CHCP_INVALID", "Invalid code page number - %s\n");
|
||||||
MSG_Add("SHELL_CMD_COUNTRY_HELP", "Displays or changes the current country.\n");
|
MSG_Add("SHELL_CMD_COUNTRY_HELP", "Displays or changes the current country.\n");
|
||||||
|
@@ -3977,7 +3977,7 @@ void DOS_Shell::CMD_COUNTRY(char * args) {
|
|||||||
int setTTFCodePage(void);
|
int setTTFCodePage(void);
|
||||||
void runRescan(const char *str), SetupDBCSTable();
|
void runRescan(const char *str), SetupDBCSTable();
|
||||||
void toSetCodePage(DOS_Shell *shell, int newCP) {
|
void toSetCodePage(DOS_Shell *shell, int newCP) {
|
||||||
if (newCP == 437 || newCP == 808 || newCP == 850 || newCP == 852 || newCP == 853 || newCP == 855 || newCP == 857 || newCP == 858 || (newCP >= 860 && newCP <= 866) || newCP == 869 || newCP == 872 || newCP == 874 || newCP == 932) {
|
if (newCP == 437 || newCP == 808 || newCP == 850 || newCP == 852 || newCP == 853 || newCP == 855 || newCP == 857 || newCP == 858 || (newCP >= 860 && newCP <= 866) || newCP == 869 || newCP == 872 || newCP == 874 || newCP == 932 || newCP == 936 || newCP == 949 || newCP == 950) {
|
||||||
dos.loaded_codepage = newCP;
|
dos.loaded_codepage = newCP;
|
||||||
int missing = setTTFCodePage();
|
int missing = setTTFCodePage();
|
||||||
shell->WriteOut(MSG_Get("SHELL_CMD_CHCP_ACTIVE"), dos.loaded_codepage);
|
shell->WriteOut(MSG_Get("SHELL_CMD_CHCP_ACTIVE"), dos.loaded_codepage);
|
||||||
|
Reference in New Issue
Block a user