Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 95 → Rev 97

/install/install.c
72,6 → 72,7
int keybfile;
int keyboff;
int keyblen;
unsigned int keybid;
};
 
 
211,6 → 212,21
video_movecursor(25,0);
}
 
/* fills a slocales struct accordingly to the value of its keyboff member */
static void kblay2slocal(struct slocales *locales) {
char *m;
for (m = kblayouts[locales->keyboff]; *m != 0; m++); /* skip layout name */
m++;
/* skip keyb code and copy it to locales.keybcode */
locales->keybcode = m;
for (; *m != 0; m++);
/* */
locales->codepage = ((unsigned short)m[1] << 8) | m[2];
locales->egafile = m[3];
locales->keybfile = m[4];
locales->keybid = ((unsigned short)m[5] << 8) | m[6];
}
 
static int selectlang(struct slocales *locales) {
int choice, x;
char *msg;
254,51 → 270,25
locales->keyblen = OFFCOUNT;
break;
}
/* populate the slocales struct */
for (msg = kblayouts[locales->keyboff]; *msg != 0; msg++); /* skip layout name */
msg++;
/* skip keyb code and copy it to locales.keybcode */
locales->keybcode = msg;
for (; *msg != 0; msg++);
/* populate the slocales struct accordingly to the keyboff member */
kblay2slocal(locales);
/* */
locales->codepage = ((unsigned short)msg[1] << 8) | msg[2];
locales->egafile = msg[3];
locales->keybfile = msg[4];
/* */
return(MENUNEXT);
}
 
 
#define LTODEC(x, y) ((unsigned short)(x << 8) | (y))
static int selectkeyb(struct slocales *locales) {
int keyboff, keyblen, menuheight;
unsigned short lang;
lang = LTODEC(locales->lang[0], locales->lang[1]);
 
switch (lang) {
case LTODEC('F', 'R'):
keyboff = OFFLOC_FR;
keyblen = OFFLEN_FR;
break;
case LTODEC('P', 'L'):
keyboff = OFFLOC_PL;
keyblen = OFFLEN_PL;
break;
case LTODEC('T', 'R'):
keyboff = OFFLOC_TR;
keyblen = OFFLEN_TR;
break;
default: /* otherwise propose all possible keyoard layouts */
keyboff = 0;
keyblen = OFFCOUNT;
break;
}
if (keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
int menuheight, choice;
if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
newscreen(0);
putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "Svarog386 supports the keyboard layouts used in different countries. Choose the keyboard layout you want.");
menuheight = keyblen + 2;
menuheight = locales->keyblen + 2;
if (menuheight > 13) menuheight = 13;
if (menuselect(10, -1, menuheight, &(kblayouts[keyboff]), keyblen) < 0) return(MENUPREV);
choice = menuselect(10, -1, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
if (choice < 0) return(MENUPREV);
/* (re)load the keyboard layout & codepage setup */
locales->keyboff += choice;
kblay2slocal(locales);
return(MENUNEXT);
}
 
504,6 → 494,8
 
static void bootfilesgen(int targetdrv, struct slocales *locales, int cdromdrv) {
char buff[128];
char buff2[16];
char buff3[16];
FILE *fd;
/*** CONFIG.SYS ***/
snprintf(buff, sizeof(buff), "%c:\\CONFIG.SYS", targetdrv);
550,10 → 542,16
}
if (locales->keybfile > 0) {
if (locales->keybfile == 1) {
fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVAROG.386\\BIN\\KEYBOARD.SYS\r\n", locales->keybcode, locales->codepage, targetdrv);
snprintf(buff2, sizeof(buff2), "KEYBOARD.SYS");
} else {
fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVAROG.386\\BIN\\KEYBRD%d.SYS\r\n", locales->keybcode, locales->codepage, targetdrv, locales->keybfile);
snprintf(buff2, sizeof(buff2), "KEYBRD%d.SYS", locales->keybfile);
}
if (locales->keybid > 0) {
buff3[0] = 0;
} else {
snprintf(buff3, sizeof(buff3), " /ID:%d", locales->keybid);
}
fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVAROG.386\\BIN\\%s%s\r\n", locales->keybcode, locales->codepage, targetdrv, buff2, buff3);
fprintf(fd, "\r\n");
}
fprintf(fd, "SHSUCDX /d:SVCD0001\r\n");
/install/keylay.h
1,19 → 1,19
char *kblayouts[] = {
/****** EN ******/
"English (US)\0en\0\1\265\0\0",
"English (UK)\0uk\0\1\265\0\1",
"English (US)\0en\0\1\265\0\0\0\0",
"English (UK)\0uk\0\1\265\0\1\0\0",
/****** FR ******/
"French (France)\0fr\0\3\132\1\1",
"French (Canada, standard)\0cf\0\3\137\11\1",
"French (Canada, legacy)\0cf501\0\3\137\11\1",
"French (France)\0fr\0\3\132\1\1\0\0",
"French (Canada, standard)\0cf\0\3\137\11\1\0\0",
"French (Canada, legacy)\0cf\0\3\137\11\1\1\365",
/****** DE ******/
"German\0de\0\3\132\1\1",
"German\0de\0\3\132\1\1\0\0",
/****** HU ******/
"Hungarian\0hu208\0\3\124\1\1",
"Hungarian\0hu\0\3\124\1\1\0\320",
/****** PL ******/
"Polish\0pl\0\3\337\12\1",
"Polish\0pl\0\3\337\12\1\0\0",
/****** ES ******/
"Spanish\0es\0\3\132\1\1",
"Spanish\0es\0\3\132\1\1\0\0",
/****** TR ******/
"Turkish\0tr\0\3\131\1\2",
"Turkish\0tr\0\3\131\1\2\0\0",
NULL};
/install/locales.c
8,7 → 8,7
 
/* the kblayouts list is a NULL-terminated array that contains entries in the
* following format:
* human description string <0> layout code string <0> <codepage number as a 16bit value> <ega.sys file number as a single byte> <keyboard.sys file number as a single byte>
* human description string <0> layout code string <0> <codepage number as a 16bit value> <ega.sys file number as a single byte> <keyboard.sys file number as a single byte> <sub keyb ID as a 16bit value, zero if none>
 
char *kblayouts[] = {
"English (US)\0xxxx",
37,7 → 37,7
}
 
 
static void addnew(char *countrycode, char *humanlang, char *keybcode, unsigned short cp, unsigned char egafile, unsigned char keybfile) {
static void addnew(char *countrycode, char *humanlang, char *keybcode, unsigned short cp, unsigned char egafile, unsigned char keybfile, unsigned int subid) {
static char lastcountry[4] = {0};
static int curoffset = 0, curcountryoffset = 0;
/* if new country, declare an offset */
60,7 → 60,7
}
/* */
if (countrycode[0] != 0) {
fprintf(fdkeyb, " \"%s\\0%s\\0\\%d\\%d\\%d\\%d\",\r\n", humanlang, keybcode, dec2oct(cp >> 8), dec2oct(cp & 0xff), dec2oct(egafile), dec2oct(keybfile));
fprintf(fdkeyb, " \"%s\\0%s\\0\\%d\\%d\\%d\\%d\\%d\\%d\",\r\n", humanlang, keybcode, dec2oct(cp >> 8), dec2oct(cp & 0xff), dec2oct(egafile), dec2oct(keybfile), dec2oct(subid >> 8), dec2oct(subid & 0xff));
} else {
fprintf(fdkeyb, " NULL};\r\n");
}
77,33 → 77,33
/******************* LAYOUTS LIST START *******************/
 
/* English */
addnew("EN", "English (US)", "en", 437, 0, 0);
addnew("EN", "English (UK)", "uk", 437, 0, 1);
addnew("EN", "English (US)", "en", 437, 0, 0, 0);
addnew("EN", "English (UK)", "uk", 437, 0, 1, 0);
 
/* French */
addnew("FR", "French (France)", "fr", 858, 1, 1);
addnew("FR", "French (Canada, standard)", "cf", 863, 9, 1);
addnew("FR", "French (Canada, legacy)", "cf501", 863, 9, 1);
addnew("FR", "French (France)", "fr", 858, 1, 1, 0);
addnew("FR", "French (Canada, standard)", "cf", 863, 9, 1, 0);
addnew("FR", "French (Canada, legacy)", "cf", 863, 9, 1, 501);
 
/* German */
addnew("DE", "German", "de", 858, 1, 1);
addnew("DE", "German", "de", 858, 1, 1, 0);
 
/* Hungarian */
addnew("HU", "Hungarian", "hu208", 852, 1, 1);
addnew("HU", "Hungarian", "hu", 852, 1, 1, 208);
 
/* Polish */
addnew("PL", "Polish", "pl", 991, 10, 1);
addnew("PL", "Polish", "pl", 991, 10, 1, 0);
 
/* Spanish */
addnew("ES", "Spanish", "es", 858, 1, 1);
addnew("ES", "Spanish", "es", 858, 1, 1, 0);
 
/* Turkish */
addnew("TR", "Turkish", "tr", 857, 1, 2);
addnew("TR", "Turkish", "tr", 857, 1, 2, 0);
 
/******************* LAYOUTS LIST STOP *******************/
 
/* end of list - DO NOT REMOVE */
addnew("", "", "", 0, 0, 0);
addnew("", "", "", 0, 0, 0, 0);
 
/* close files */
fclose(fdoff);