From 2df03f10f9dd5f32acc2527d8d382e07836bc39e Mon Sep 17 00:00:00 2001 From: Wengier Date: Sun, 10 Jul 2022 17:51:31 -0400 Subject: [PATCH] update config, CHANGELOG and timestamp --- CHANGELOG | 25 +++++-- .../com.dosbox_x.DOSBox-X.metainfo.xml.in | 2 +- include/build_timestamp.h | 4 +- src/dos/dos_network2.h | 4 +- src/dos/dos_programs.cpp | 75 ++++++++++++------- src/dos/dos_tables.cpp | 6 +- src/dos/drive_fat.cpp | 39 +++++----- src/gui/sdlmain.cpp | 15 ++-- src/ints/bios_disk.cpp | 11 ++- src/misc/programs.cpp | 21 ++++-- src/output/output_ttf.cpp | 2 +- src/shell/shell_cmds.cpp | 16 +++- 12 files changed, 145 insertions(+), 75 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 085fbb86d..72947a6b8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,17 +5,32 @@ systems. A config option "convertdrivefat" (in [dosbox] section) is added to toggle this setting, or you can toggle via BOOT command's -convertfat - and -noconvertfat options. There is also a config - option "drive z convert fat" (in [dos] section) - to control if to convert virtual drive Z:. Much of - the code is imported from DOSBox Pure. (Wengier) + (or -convertfatro option for read-only access) and + -noconvertfat options. There is also a config + option "drive z convert fat" (in [dos] section) to + control whether to convert virtual drive Z:. Much + of the code is imported from DOSBox Pure. (Wengier) - Added config option to allow create of temporary devices for piping operations when a temporary DOS path is not available. (Wengier) + - Added support for ATAPI raw sector reading with + READ CD command. (schellingb) + - Report bad sectors recorded in raw CD images as + ATAPI read errors. (schellingb) - Fixed display of individual/total file sizes with DIR command when they are very large. (Wengier) - - Fixed DBCS code page conversions for mounted FAT + - Fixed non-US code page conversions for mounted FAT drives. (Wengier) + - Fixed possible "Path not found" bug when switching + to code page 950 from another code page. (Wengier) + - Fixed creating directories may not work properly + for overlay drives on Windows systems. (Wengier) + - Fixed -set and -get options of CONFIG command when + there are spaces in property names, without having + to prepend the section names. For example, command + CONFIG -get "synchronize time" is supported just + as CONFIG -get "dosbox synchronize time". Similar + for -SET option when launching DOSBox-X. (Wengier) 0.84.1 - Added dosbox(-x).conf option to enable workaround for errant DOS programs that set the TF (trap flag) diff --git a/contrib/linux/com.dosbox_x.DOSBox-X.metainfo.xml.in b/contrib/linux/com.dosbox_x.DOSBox-X.metainfo.xml.in index 41526e362..f19fc5a82 100644 --- a/contrib/linux/com.dosbox_x.DOSBox-X.metainfo.xml.in +++ b/contrib/linux/com.dosbox_x.DOSBox-X.metainfo.xml.in @@ -10,7 +10,7 @@ Emulation - + diff --git a/include/build_timestamp.h b/include/build_timestamp.h index 34891e93d..687800532 100644 --- a/include/build_timestamp.h +++ b/include/build_timestamp.h @@ -1,4 +1,4 @@ /*auto-generated*/ -#define UPDATED_STR "Jul 9, 2022 9:36:37pm" -#define GIT_COMMIT_HASH "0da7bef" +#define UPDATED_STR "Jul 11, 2022 6:20:51pm" +#define GIT_COMMIT_HASH "a4bdbf8" #define COPYRIGHT_END_YEAR "2022" diff --git a/src/dos/dos_network2.h b/src/dos/dos_network2.h index 4c4de58ba..9c138e4ec 100644 --- a/src/dos/dos_network2.h +++ b/src/dos/dos_network2.h @@ -89,7 +89,7 @@ HANDLE hFind = INVALID_HANDLE_VALUE; DBCS_upcase(sfn); name = sfn; } - if (name.empty() && !uselfn) continue; + if (name.empty()) name = "?"; } date = DOS_PackDate(lt.wYear,lt.wMonth,lt.wDay); time = DOS_PackTime(lt.wHour,lt.wMinute,lt.wSecond); @@ -143,7 +143,7 @@ HANDLE hFind = INVALID_HANDLE_VALUE; DBCS_upcase(sfn); name = sfn; } - if (name.empty() && !uselfn) continue; + if (name.empty()) name = "?"; } date = DOS_PackDate(lt.wYear,lt.wMonth,lt.wDay); time = DOS_PackTime(lt.wHour,lt.wMinute,lt.wSecond); diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 31c4ef7a3..75ea9dd56 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -102,11 +102,12 @@ bool qmount = false; bool nowarn = false; bool CodePageHostToGuestUTF8(char *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/), CodePageHostToGuestUTF16(char *d/*CROSS_LEN*/,const uint16_t *s/*CROSS_LEN*/); extern bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton); -extern bool addovl, addipx, addne2k, prepared, inshell, usecon, uao, morelen, mountfro[26], mountiro[26], resetcolor, staycolors, printfont, internal_program; -extern bool clear_screen(), OpenGL_using(void), DOS_SetAnsiAttr(uint8_t attr); +extern bool addovl, addipx, addne2k, prepared, inshell, usecon, chinasea, uao, morelen, mountfro[26], mountiro[26], resetcolor, staycolors, printfont, internal_program; +extern bool clear_screen(), OpenGL_using(void), DOS_SetAnsiAttr(uint8_t attr), isDBCSCP(); extern int lastcp, FileDirExistCP(const char *name), FileDirExistUTF8(std::string &localname, const char *name); extern uint8_t DOS_GetAnsiAttr(void); -void DOS_EnableDriveMenu(char drv), GFX_SetTitle(int32_t cycles, int frameskip, Bits timing, bool paused), UpdateSDLDrawTexture(); +void MSG_Init(), JFONT_Init(), InitFontHandle(), ShutFontHandle(), DOSBox_SetSysMenu(), makestdcp950table(), makeseacp951table(); +void DOS_EnableDriveMenu(char drv), GFX_SetTitle(int32_t cycles, int frameskip, Bits timing, bool paused), UpdateSDLDrawTexture(), toSetCodePage(DOS_Shell *shell, int newCP, int opt); void runBoot(const char *str), runMount(const char *str), runImgmount(const char *str), runRescan(const char *str), show_prompt(), ttf_reset(void); void getdrivezpath(std::string &path, std::string dirname), drivezRegister(std::string path, std::string dir, bool usecp), UpdateDefaultPrinterFont(void); std::string GetDOSBoxXPath(bool withexe=false); @@ -1294,26 +1295,37 @@ public: if (cp==932||cp==936||cp==949||cp==950||cp==951) #endif { + if (cp == 950 && !chinasea) makestdcp950table(); + if (cp == 951 && chinasea) makeseacp951table(); cpbak = dos.loaded_codepage; dos.loaded_codepage = cp; host_name = CodePageGuestToHost(temp_line.c_str()); char str[150]; - sprintf(str, "Drive %c: appears to require code page %d in order to be accessed.\n\nDo you want to change the current code page to %d now?\n", drive, cp, cp); + sprintf(str, "Drive %c: appears to require code page %d to be accessed.\n\nDo you want to change the current code page to %d now?\n", drive, cp, cp); if (!host_name || ht_stat(host_name, &htest) || _waccess(host_name,0) || !systemmessagebox("Changing code page",str,"yesno","question",1)) dos.loaded_codepage = cpbak; #if defined(USE_TTF) - else if (ttf.inUse&&(cp==932||cp==936||cp==949||cp==950||cp==951)) { - Section_prop * ttf_section = static_cast(control->GetSection("ttf")); - const char *font = ttf_section->Get_string("font"); - if (!font || !*font) { - ttf_reset(); -#if C_PRINTER - if (printfont) UpdateDefaultPrinterFont(); -#endif - } + else if (ttf.inUse) { + dos.loaded_codepage = cpbak; + toSetCodePage(NULL, cp, -1); } #endif + else { + MSG_Init(); + DOSBox_SetSysMenu(); + if (isDBCSCP()) { + ShutFontHandle(); + InitFontHandle(); + JFONT_Init(); + } + SetupDBCSTable(); + runRescan("-A -Q"); +#if C_OPENGL && DOSBOXMENU_TYPE == DOSBOXMENU_SDLDRAW + if (OpenGL_using() && control->opt_lang.size() && lastcp && lastcp != dos.loaded_codepage) + UpdateSDLDrawTexture(); +#endif + } } } #elif defined (OS2) @@ -2507,7 +2519,7 @@ public: char msg[512] = {0}; const uint8_t page=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE); - if ((convimg == 1 || (convertimg && convimg == -1 && !IS_PC98_ARCH))) { // PC-98 image not supported yet + if (!dos_kernel_disabled && (convimg == 1 || (convertimg && convimg == -1 && !IS_PC98_ARCH))) { // PC-98 image not supported yet unsigned int drv = 2, nextdrv = 2; for (unsigned int d=2;dFindCommand(2,cp_string); int tocp=!strcmp(temp_line.c_str(), "jp")?932:(!strcmp(temp_line.c_str(), "ko")?949:(!strcmp(temp_line.c_str(), "tw")||!strcmp(temp_line.c_str(), "hk")||!strcmp(temp_line.c_str(), "zht")||(!strcmp(temp_line.c_str(), "zh")&&((cp_string.size()&&(atoi(cp_string.c_str())==950||atoi(cp_string.c_str())==951))||(!cp_string.size()&&(dos.loaded_codepage==950||dos.loaded_codepage==951))))?((cp_string.size()&&atoi(cp_string.c_str())==951)||(!cp_string.size()&&dos.loaded_codepage==951)?951:950):(!strcmp(temp_line.c_str(), "cn")||!strcmp(temp_line.c_str(), "zhs")||!strcmp(temp_line.c_str(), "zh")?936:0))); if (tocp && !IS_PC98_ARCH) { + uint16_t cpbak = dos.loaded_codepage; dos.loaded_codepage=tocp; const char* layout_name = DOS_GetLoadedLayout(); if (layout_name==NULL) WriteOut(MSG_Get("PROGRAM_KEYB_INFO"),dos.loaded_codepage); else WriteOut(MSG_Get("PROGRAM_KEYB_INFO_LAYOUT"),dos.loaded_codepage,layout_name); - MSG_Init(); - DOSBox_SetSysMenu(); - if (isDBCSCP()) { - ShutFontHandle(); - InitFontHandle(); - JFONT_Init(); - } - SetupDBCSTable(); - runRescan("-A -Q"); -#if C_OPENGL && DOSBOXMENU_TYPE == DOSBOXMENU_SDLDRAW - if (OpenGL_using() && control->opt_lang.size() && lastcp && lastcp != dos.loaded_codepage) - UpdateSDLDrawTexture(); +#if defined(USE_TTF) + if (ttf.inUse) { + dos.loaded_codepage = cpbak; + toSetCodePage(NULL, tocp, -1); + } else #endif + { + MSG_Init(); + DOSBox_SetSysMenu(); + if (isDBCSCP()) { + ShutFontHandle(); + InitFontHandle(); + JFONT_Init(); + } + SetupDBCSTable(); + runRescan("-A -Q"); +#if C_OPENGL && DOSBOXMENU_TYPE == DOSBOXMENU_SDLDRAW + if (OpenGL_using() && control->opt_lang.size() && lastcp && lastcp != dos.loaded_codepage) + UpdateSDLDrawTexture(); +#endif + } return; } if (cp_string.size()) { diff --git a/src/dos/dos_tables.cpp b/src/dos/dos_tables.cpp index c7dbf0b8d..f39608084 100644 --- a/src/dos/dos_tables.cpp +++ b/src/dos/dos_tables.cpp @@ -27,14 +27,14 @@ #include "render.h" #include -extern bool gbk; extern int maxfcb; +extern bool gbk, chinasea; extern Bitu DOS_PRIVATE_SEGMENT_Size; #if defined(USE_TTF) extern bool ttf_dosv; #endif -void CALLBACK_DeAllocate(Bitu in); +void CALLBACK_DeAllocate(Bitu in), makestdcp950table(), makeseacp951table(); std::list DOS_GetMemLog; @@ -216,6 +216,8 @@ PhysPt DOS_Get_DPB(unsigned int dos_drive) { } void SetupDBCSTable() { + if (dos.loaded_codepage==950&&!chinasea) makestdcp950table(); + else if (dos.loaded_codepage==951&&chinasea) makeseacp951table(); if (enable_dbcs_tables) { if (!dos.tables.dbcs) dos.tables.dbcs=RealMake(DOS_GetMemory(12,"dos.tables.dbcs"),0); diff --git a/src/dos/drive_fat.cpp b/src/dos/drive_fat.cpp index 3634aee00..94d453b4c 100644 --- a/src/dos/drive_fat.cpp +++ b/src/dos/drive_fat.cpp @@ -2480,29 +2480,29 @@ nextfile: unsigned int stridx = oidx * 13u, len = 0; uint16_t lchar = 0; char lname[27] = {0}; + char text[10]; + uint16_t uname[4]; for (unsigned int i=0;i < 5;i++) { + text[0] = text[1] = text[2] = 0; lchar = (uint16_t)(dlfn->LDIR_Name1[i]); if (lchar < 0x100 || lchar == 0xFFFF) - lname[len++] = (char)(lchar & 0xFF); + lname[len++] = lchar != 0xFFFF && CodePageHostToGuestUTF16(text,&lchar) && text[0] && !text[1] ? text[0] : (char)(lchar & 0xFF); else { - char text[10]; - uint16_t uname[4]; uname[0]=lchar; uname[1]=0; - text[0] = 0; - text[1] = 0; - text[2] = 0; if (CodePageHostToGuestUTF16(text,uname)) { lname[len++] = (char)(text[0] & 0xFF); lname[len++] = (char)(text[1] & 0xFF); - } + } else + lname[len++] = '_'; } } for (unsigned int i=0;i < 6;i++) { + text[0] = text[1] = text[2] = 0; lchar = (uint16_t)(dlfn->LDIR_Name2[i]); if (lchar < 0x100 || lchar == 0xFFFF) - lname[len++] = (char)(lchar & 0xFF); + lname[len++] = lchar != 0xFFFF && CodePageHostToGuestUTF16(text,&lchar) && text[0] && !text[1] ? text[0] : (char)(lchar & 0xFF); else { char text[10]; uint16_t uname[4]; @@ -2514,13 +2514,15 @@ nextfile: if (CodePageHostToGuestUTF16(text,uname)) { lname[len++] = (char)(text[0] & 0xFF); lname[len++] = (char)(text[1] & 0xFF); - } + } else + lname[len++] = '_'; } } for (unsigned int i=0;i < 2;i++) { + text[0] = text[1] = text[2] = 0; lchar = (uint16_t)(dlfn->LDIR_Name3[i]); if (lchar < 0x100 || lchar == 0xFFFF) - lname[len++] = (char)(lchar & 0xFF); + lname[len++] = lchar != 0xFFFF && CodePageHostToGuestUTF16(text,&lchar) && text[0] && !text[1] ? text[0] : (char)(lchar & 0xFF); else { char text[10]; uint16_t uname[4]; @@ -2532,10 +2534,8 @@ nextfile: if (CodePageHostToGuestUTF16(text,uname)) { lname[len++] = (char)(text[0] & 0xFF); lname[len++] = (char)(text[1] & 0xFF); - } else { - lname[len++] = (char)(lchar / 0x100); - lname[len++] = (char)(lchar % 0x100); - } + } else + lname[len++] = '_'; } } lname[len] = 0; @@ -2770,11 +2770,11 @@ bool fatDrive::addDirectoryEntry(uint32_t dirClustNumber, const direntry& useEnt if (lfn != NULL && *lfn != 0) { /* 13 characters per LFN entry */ bool lead = false; + char text[3]; + uint16_t uname[4]; for (const char *scan = lfn; *scan; scan++) { if (lead) { lead = false; - char text[3]; - uint16_t uname[4]; text[0]=*(scan-1)&0xFF; text[1]=*scan&0xFF; text[2]=0; @@ -2787,7 +2787,12 @@ bool fatDrive::addDirectoryEntry(uint32_t dirClustNumber, const direntry& useEnt if (len < LFN_NAMELENGTH) lfnw[len++] = *scan&0xFF; } } else if (*(scan+1) && ((IS_PC98_ARCH && shiftjis_lead_byte(*scan&0xFF)) || (isDBCSCP() && isKanji1_gbk(*scan&0xFF)))) lead = true; - else lfnw[len++] = (uint16_t)((unsigned char)(*scan)); + else if (dos.loaded_codepage != 437) { + text[0]=*scan&0xFF; + text[1]=0; + lfnw[len++] = CodePageGuestToHostUTF16(uname,text)&&uname[0]!=0&&uname[1]==0 ? uname[0] : (uint16_t)((unsigned char)(*scan)); + } else + lfnw[len++] = (uint16_t)((unsigned char)(*scan)); } lfnw[len] = 0; need = (unsigned int)(1 + (len + 12) / 13); /*round up*/; diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 4d53d1d19..7718762a7 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -8152,21 +8152,26 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT { if (!strlen(pvars[0].c_str())) continue; if (pvars[0][0]=='%'||pvars[0][0]=='\0'||pvars[0][0]=='#'||pvars[0][0]=='\n') continue; - + Section* sec = control->GetSectionFromProperty(pvars[0].c_str()); // attempt to split off the first word std::string::size_type spcpos = pvars[0].find_first_of(' '); if (spcpos>1&&pvars[0].c_str()[spcpos-1]==',') spcpos=pvars[0].find_first_of(' ', spcpos+1); std::string::size_type equpos = pvars[0].find_first_of('='); + if (equpos != std::string::npos) { + std::string p = pvars[0]; + p.erase(equpos); + sec = control->GetSectionFromProperty(p.c_str()); + } if ((equpos != std::string::npos) && - ((spcpos == std::string::npos) || (equpos < spcpos))) { + ((spcpos == std::string::npos) || (equpos < spcpos) || sec)) { // If we have a '=' possibly before a ' ' split on the = pvars.insert(pvars.begin()+1,pvars[0].substr(equpos+1)); pvars[0].erase(equpos); // As we had a = the first thing must be a property now - Section* sec=control->GetSectionFromProperty(pvars[0].c_str()); + sec=control->GetSectionFromProperty(pvars[0].c_str()); if (!sec&&pvars[0].size()>4&&!strcasecmp(pvars[0].substr(0, 4).c_str(), "ttf.")) { pvars[0].erase(0,4); sec = control->GetSectionFromProperty(pvars[0].c_str()); @@ -8184,7 +8189,7 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT { pvars[0].erase(spcpos); } // check if the first parameter is a section or property - Section* sec = control->GetSection(pvars[0].c_str()); + sec = control->GetSection(pvars[0].c_str()); if (!sec) { // not a section: little duplicate from above sec=control->GetSectionFromProperty(pvars[0].c_str()); @@ -8211,7 +8216,7 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT { if (!sec2) { // not a property, Section* sec3 = control->GetSectionFromProperty(pvars[0].c_str()); - if (sec3) { + if (sec3 && !(equpos != std::string::npos && spcpos != std::string::npos && equpos > spcpos)) { // section and property name are identical pvars.insert(pvars.begin(),pvars[0]); } // else has been checked above already diff --git a/src/ints/bios_disk.cpp b/src/ints/bios_disk.cpp index bc2a6c8a8..fbe04781c 100644 --- a/src/ints/bios_disk.cpp +++ b/src/ints/bios_disk.cpp @@ -397,11 +397,11 @@ struct fatFromDOSDrive size_t len = 0, lfnlen = strlen(lname); uint16_t *lfnw = (uint16_t *)malloc((lfnlen + 1) * sizeof(uint16_t)); if (lfnw == NULL) continue; + char text[3]; + uint16_t uname[4]; for (size_t i=0; i < lfnlen; i++) { if (lead) { lead = false; - char text[3]; - uint16_t uname[4]; text[0]=lname[i-1]&0xFF; text[1]=lname[i]&0xFF; text[2]=0; @@ -414,7 +414,12 @@ struct fatFromDOSDrive lfnw[len++] = lname[i]; } } else if (i+1GetSectionFromProperty(pvars[0].c_str()); std::string::size_type spcpos = pvars[0].find_first_of(' '); // split on the ' ' - if (spcpos != std::string::npos) { + if (!sec && spcpos != std::string::npos) { if (spcpos>1&&pvars[0].c_str()[spcpos-1]==',') spcpos=pvars[0].find_first_of(' ', spcpos+1); if (spcpos != std::string::npos) { @@ -1502,7 +1503,7 @@ void CONFIG::Run(void) { case 1: { // property/section only // is it a section? - Section* sec = control->GetSection(pvars[0].c_str()); + sec = control->GetSection(pvars[0].c_str()); if (sec) { // list properties in section int i = 0; @@ -1725,7 +1726,7 @@ void CONFIG::Run(void) { } case 2: { // section + property - Section* sec = control->GetSection(pvars[0].c_str()); + sec = control->GetSection(pvars[0].c_str()); if (!sec) { WriteOut(MSG_Get("PROGRAM_CONFIG_SECTION_ERROR"), pvars[0].c_str()); return; @@ -1797,20 +1798,26 @@ void CONFIG::Run(void) { std::string rest; if (cmd->GetStringRemain(rest)) pvars.push_back(rest); + Section* sec = control->GetSectionFromProperty(pvars[0].c_str()); // attempt to split off the first word std::string::size_type spcpos = pvars[0].find_first_of(' '); if (spcpos>1&&pvars[0].c_str()[spcpos-1]==',') spcpos=pvars[0].find_first_of(' ', spcpos+1); std::string::size_type equpos = pvars[0].find_first_of('='); + if (equpos != std::string::npos) { + std::string p = pvars[0]; + p.erase(equpos); + sec = control->GetSectionFromProperty(p.c_str()); + } if ((equpos != std::string::npos) && - ((spcpos == std::string::npos) || (equpos < spcpos))) { + ((spcpos == std::string::npos) || (equpos < spcpos) || sec)) { // If we have a '=' possibly before a ' ' split on the = pvars.insert(pvars.begin()+1,pvars[0].substr(equpos+1)); pvars[0].erase(equpos); // As we had a = the first thing must be a property now - Section* sec=control->GetSectionFromProperty(pvars[0].c_str()); + sec=control->GetSectionFromProperty(pvars[0].c_str()); if (!sec&&pvars[0].size()>4&&!strcasecmp(pvars[0].substr(0, 4).c_str(), "ttf.")) { pvars[0].erase(0,4); sec = control->GetSectionFromProperty(pvars[0].c_str()); @@ -1828,7 +1835,7 @@ void CONFIG::Run(void) { pvars[0].erase(spcpos); } // check if the first parameter is a section or property - Section* sec = control->GetSection(pvars[0].c_str()); + sec = control->GetSection(pvars[0].c_str()); if (!sec) { // not a section: little duplicate from above sec=control->GetSectionFromProperty(pvars[0].c_str()); @@ -1855,7 +1862,7 @@ void CONFIG::Run(void) { if (!sec2) { // not a property, Section* sec3 = control->GetSectionFromProperty(pvars[0].c_str()); - if (sec3) { + if (sec3 && !(equpos != std::string::npos && spcpos != std::string::npos && equpos > spcpos)) { // section and property name are identical pvars.insert(pvars.begin(),pvars[0]); } // else has been checked above already diff --git a/src/output/output_ttf.cpp b/src/output/output_ttf.cpp index 0c8608b6f..6a5bc272b 100644 --- a/src/output/output_ttf.cpp +++ b/src/output/output_ttf.cpp @@ -123,7 +123,7 @@ static bool blinkstate = false; bool colorChanged = false, justChanged = false, staycolors = false, firstsize = true, ttfswitch=false, switch_output_from_ttf=false; int menuwidth_atleast(int width), FileDirExistCP(const char *name), FileDirExistUTF8(std::string &localname, const char *name); -void AdjustIMEFontSize(void), initcodepagefont(void), change_output(int output), drawmenu(Bitu val), MSG_Init(void), KEYBOARD_Clear(void), RENDER_Reset(void), DOSBox_SetSysMenu(void), GetMaxWidthHeight(unsigned int *pmaxWidth, unsigned int *pmaxHeight), SetWindowTransparency(int trans), resetFontSize(void), RENDER_CallBack( GFX_CallBackFunctions_t function ); +void AdjustIMEFontSize(void), initcodepagefont(void), change_output(int output), drawmenu(Bitu val), KEYBOARD_Clear(void), RENDER_Reset(void), DOSBox_SetSysMenu(void), GetMaxWidthHeight(unsigned int *pmaxWidth, unsigned int *pmaxHeight), SetWindowTransparency(int trans), resetFontSize(void), RENDER_CallBack( GFX_CallBackFunctions_t function ); bool isDBCSCP(void), InitCodePage(void), CodePageGuestToHostUTF16(uint16_t *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/), systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton); std::string GetDOSBoxXPath(bool withexe=false); diff --git a/src/shell/shell_cmds.cpp b/src/shell/shell_cmds.cpp index 2da73fbb7..b7392511c 100644 --- a/src/shell/shell_cmds.cpp +++ b/src/shell/shell_cmds.cpp @@ -4424,7 +4424,7 @@ void toSetCodePage(DOS_Shell *shell, int newCP, int opt) { #endif DOSBox_SetSysMenu(); } - if (opt<1) { + if (opt<1 && shell) { shell->WriteOut(MSG_Get("SHELL_CMD_CHCP_ACTIVE"), dos.loaded_codepage); #if defined(USE_TTF) if (missing > 0) shell->WriteOut(MSG_Get("SHELL_CMD_CHCP_MISSING"), missing); @@ -4437,7 +4437,19 @@ void toSetCodePage(DOS_Shell *shell, int newCP, int opt) { } SetupDBCSTable(); runRescan("-A -Q"); - } else if (opt<1) +#if defined(USE_TTF) + if (opt==-1&&(newCP==932||newCP==936||newCP==949||newCP==950||newCP==951)) { + Section_prop * ttf_section = static_cast(control->GetSection("ttf")); + const char *font = ttf_section->Get_string("font"); + if (!font || !*font) { + ttf_reset(); +#if C_PRINTER + if (printfont) UpdateDefaultPrinterFont(); +#endif + } + } +#endif + } else if (opt<1 && shell) shell->WriteOut(MSG_Get("SHELL_CMD_CHCP_INVALID"), std::to_string(newCP).c_str()); }