Skip to content

Commit

Permalink
Fix codepage switching of KEYB command
Browse files Browse the repository at this point in the history
  • Loading branch information
maron2000 committed Sep 18, 2024
1 parent 09e750d commit b259046
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/dos/dos_keyboard_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1387,15 +1387,18 @@ Bitu DOS_LoadKeyboardLayout(const char * layoutname, int32_t codepage, const cha
return kerrcode;
}
// ...else keyboard layout loaded successfully, change codepage accordingly
kerrcode=temp_layout->read_codepage_file(codepagefile, codepage);
if (kerrcode) {
delete temp_layout;
return kerrcode;
}
if(!CheckDBCSCP(codepage)){
kerrcode = temp_layout->read_codepage_file(codepagefile, codepage);
if(kerrcode) {
delete temp_layout;
return kerrcode;
}
}
// Everything went fine, switch to new layout
delete loaded_layout;
loaded_layout=temp_layout;
return KEYB_NOERROR;
dos.loaded_codepage = codepage;
return KEYB_NOERROR;
}

Bitu DOS_SwitchKeyboardLayout(const char* new_layout, int32_t& tried_cp) {
Expand All @@ -1421,7 +1424,9 @@ Bitu DOS_ChangeKeyboardLayout(const char* layoutname, int32_t codepage) {
return kerrcode;
}
// Everything went fine, switch to new layout
delete loaded_layout;
loaded_layout = temp_layout;
dos.loaded_codepage = codepage;
return KEYB_NOERROR;
}

Expand All @@ -1432,6 +1437,7 @@ Bitu DOS_ChangeCodepage(int32_t codepage, const char* codepagefile) {
return kerrcode;
}
// Everything went fine
dos.loaded_codepage = codepage;
return KEYB_NOERROR;
}

Expand Down

0 comments on commit b259046

Please sign in to comment.