Skip to content

Commit

Permalink
Fix loading language file on launch
Browse files Browse the repository at this point in the history
  • Loading branch information
maron2000 committed Apr 19, 2024
1 parent 1652704 commit a167e36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/dos/dos_keyboard_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ void DOSBox_SetSysMenu(void);
bool OpenGL_using(void), isDBCSCP(void);
void change_output(int output), UpdateSDLDrawTexture();
void SwitchLanguage(int oldcp, int newcp, bool confirm);
Bitu DOS_ChangeCodepage(int32_t codepage, const char* codepagefile);
void MSG_Init(), JFONT_Init(), runRescan(const char *str);
extern int tryconvertcp, toSetCodePage(DOS_Shell *shell, int newCP, int opt);
extern bool jfont_init;
extern int msgcodepage;

static FILE* OpenDosboxFile(const char* name) {
uint8_t drive;
char fullname[DOS_PATHLENGTH];
Expand Down Expand Up @@ -1735,9 +1738,12 @@ class DOS_KeyboardLayout: public Module_base {
UpdateSDLDrawTexture();
#endif
}
SwitchLanguage(cpbak, dos.loaded_codepage, false);
}
}
if(msgcodepage) {
SwitchLanguage(dos.loaded_codepage, msgcodepage, false);
DOS_ChangeCodepage(msgcodepage, "auto");
}
}

~DOS_KeyboardLayout(){
if ((dos.loaded_codepage!=GetDefaultCP()) && (CurMode->type==M_TEXT)) {
Expand Down
3 changes: 2 additions & 1 deletion src/shell/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,8 @@ void DOS_Shell::Prepare(void) {
} else if (control->opt_langcp && !name && (layout.empty() || layout=="auto"))
SetKEYBCP();
}
if (lastmsgcp && lastmsgcp != dos.loaded_codepage) SwitchLanguage(lastmsgcp, dos.loaded_codepage, true);
//if (lastmsgcp && lastmsgcp != dos.loaded_codepage) SwitchLanguage(lastmsgcp, dos.loaded_codepage, true);
if (msgcodepage && msgcodepage != dos.loaded_codepage) SwitchLanguage(dos.loaded_codepage, msgcodepage, true);
}
if (country>0&&!control->opt_noconfig) {
countryNo = country;
Expand Down

0 comments on commit a167e36

Please sign in to comment.