fix some error message when loading some unhandled keyboard layout combinations
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3542
This commit is contained in:
parent
641160f569
commit
00463f8285
2 changed files with 13 additions and 9 deletions
|
@ -80,7 +80,7 @@ public:
|
|||
// call layout_key to apply the current language layout
|
||||
bool layout_key(Bitu key, Bit8u flags1, Bit8u flags2, Bit8u flags3);
|
||||
|
||||
Bitu switch_keyboard_layout(const char* new_layout, keyboard_layout* &created_layout);
|
||||
Bitu switch_keyboard_layout(const char* new_layout, keyboard_layout* &created_layout, Bit32s& tried_cp);
|
||||
void switch_foreign_layout();
|
||||
const char* get_layout_name();
|
||||
const char* main_language_code();
|
||||
|
@ -951,7 +951,7 @@ Bitu keyboard_layout::read_codepage_file(const char* codepage_file_name, Bit32s
|
|||
return KEYB_INVALIDCPFILE;
|
||||
}
|
||||
|
||||
Bitu keyboard_layout::switch_keyboard_layout(const char* new_layout, keyboard_layout*& created_layout) {
|
||||
Bitu keyboard_layout::switch_keyboard_layout(const char* new_layout, keyboard_layout*& created_layout, Bit32s& tried_cp) {
|
||||
if (strncasecmp(new_layout,"US",2)) {
|
||||
// switch to a foreign layout
|
||||
char tbuf[256];
|
||||
|
@ -977,6 +977,7 @@ Bitu keyboard_layout::switch_keyboard_layout(const char* new_layout, keyboard_la
|
|||
} else {
|
||||
keyboard_layout * temp_layout=new keyboard_layout();
|
||||
Bitu req_codepage=temp_layout->extract_codepage(new_layout);
|
||||
tried_cp = req_codepage;
|
||||
Bitu kerrcode=temp_layout->read_keyboard_file(new_layout, req_codepage);
|
||||
if (kerrcode) {
|
||||
delete temp_layout;
|
||||
|
@ -1059,10 +1060,10 @@ Bitu DOS_LoadKeyboardLayout(const char * layoutname, Bit32s codepage, const char
|
|||
return KEYB_NOERROR;
|
||||
}
|
||||
|
||||
Bitu DOS_SwitchKeyboardLayout(const char* new_layout) {
|
||||
Bitu DOS_SwitchKeyboardLayout(const char* new_layout, Bit32s& tried_cp) {
|
||||
if (loaded_layout) {
|
||||
keyboard_layout* changed_layout=NULL;
|
||||
Bitu ret_code=loaded_layout->switch_keyboard_layout(new_layout, changed_layout);
|
||||
Bitu ret_code=loaded_layout->switch_keyboard_layout(new_layout, changed_layout, tried_cp);
|
||||
if (changed_layout) {
|
||||
// Remove old layout, activate new layout
|
||||
delete loaded_layout;
|
||||
|
|
|
@ -1270,7 +1270,7 @@ void IMGMOUNT_ProgramStart(Program * * make) {
|
|||
}
|
||||
|
||||
|
||||
Bitu DOS_SwitchKeyboardLayout(const char* new_layout);
|
||||
Bitu DOS_SwitchKeyboardLayout(const char* new_layout, Bit32s& tried_cp);
|
||||
Bitu DOS_LoadKeyboardLayout(const char * layoutname, Bit32s codepage, const char * codepagefile);
|
||||
const char* DOS_GetLoadedLayout(void);
|
||||
|
||||
|
@ -1287,9 +1287,10 @@ void KEYB::Run(void) {
|
|||
/* first parameter is layout ID */
|
||||
Bitu keyb_error=0;
|
||||
std::string cp_string;
|
||||
Bit32s tried_cp = -1;
|
||||
if (cmd->FindCommand(2,cp_string)) {
|
||||
/* second parameter is codepage number */
|
||||
Bit32s par_cp=atoi(cp_string.c_str());
|
||||
tried_cp=atoi(cp_string.c_str());
|
||||
char cp_file_name[256];
|
||||
if (cmd->FindCommand(3,cp_string)) {
|
||||
/* third parameter is codepage file */
|
||||
|
@ -1299,8 +1300,10 @@ void KEYB::Run(void) {
|
|||
strcpy(cp_file_name, "auto");
|
||||
}
|
||||
|
||||
keyb_error=DOS_LoadKeyboardLayout(temp_line.c_str(), par_cp, cp_file_name);
|
||||
} else keyb_error=DOS_SwitchKeyboardLayout(temp_line.c_str());
|
||||
keyb_error=DOS_LoadKeyboardLayout(temp_line.c_str(), tried_cp, cp_file_name);
|
||||
} else {
|
||||
keyb_error=DOS_SwitchKeyboardLayout(temp_line.c_str(), tried_cp);
|
||||
}
|
||||
switch (keyb_error) {
|
||||
case KEYB_NOERROR:
|
||||
WriteOut(MSG_Get("PROGRAM_KEYB_NOERROR"),temp_line.c_str(),dos.loaded_codepage);
|
||||
|
@ -1313,7 +1316,7 @@ void KEYB::Run(void) {
|
|||
WriteOut(MSG_Get("PROGRAM_KEYB_INVALIDFILE"),temp_line.c_str());
|
||||
break;
|
||||
case KEYB_LAYOUTNOTFOUND:
|
||||
WriteOut(MSG_Get("PROGRAM_KEYB_LAYOUTNOTFOUND"),temp_line.c_str(),dos.loaded_codepage);
|
||||
WriteOut(MSG_Get("PROGRAM_KEYB_LAYOUTNOTFOUND"),temp_line.c_str(),tried_cp);
|
||||
break;
|
||||
case KEYB_INVALIDCPFILE:
|
||||
WriteOut(MSG_Get("PROGRAM_KEYB_INVCPFILE"),temp_line.c_str());
|
||||
|
|
Loading…
Add table
Reference in a new issue