Subversion Repositories SvarDOS

Rev

Rev 95 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 95 Rev 96
Line 70... Line 70...
70
  unsigned int codepage;
70
  unsigned int codepage;
71
  int egafile;
71
  int egafile;
72
  int keybfile;
72
  int keybfile;
73
  int keyboff;
73
  int keyboff;
74
  int keyblen;
74
  int keyblen;
-
 
75
  unsigned int keybid;
75
};
76
};
76
 
77
 
77
 
78
 
78
/* reboot the computer */
79
/* reboot the computer */
79
static void reboot(void) {
80
static void reboot(void) {
Line 209... Line 210...
209
  video_putchar(24, 0, COLOR_TITLEBAR[mono], ' ');
210
  video_putchar(24, 0, COLOR_TITLEBAR[mono], ' ');
210
  video_putstringfix(24, 1, COLOR_TITLEBAR[mono], msg, 79);
211
  video_putstringfix(24, 1, COLOR_TITLEBAR[mono], msg, 79);
211
  video_movecursor(25,0);
212
  video_movecursor(25,0);
212
}
213
}
213
 
214
 
-
 
215
/* fills a slocales struct accordingly to the value of its keyboff member */
-
 
216
static void kblay2slocal(struct slocales *locales) {
-
 
217
  char *m;
-
 
218
  for (m = kblayouts[locales->keyboff]; *m != 0; m++); /* skip layout name */
-
 
219
  m++;
-
 
220
  /* skip keyb code and copy it to locales.keybcode */
-
 
221
  locales->keybcode = m;
-
 
222
  for (; *m != 0; m++);
-
 
223
  /* */
-
 
224
  locales->codepage = ((unsigned short)m[1] << 8) | m[2];
-
 
225
  locales->egafile = m[3];
-
 
226
  locales->keybfile = m[4];
-
 
227
  locales->keybid = ((unsigned short)m[5] << 8) | m[6];
-
 
228
}
-
 
229
 
214
static int selectlang(struct slocales *locales) {
230
static int selectlang(struct slocales *locales) {
215
  int choice, x;
231
  int choice, x;
216
  char *msg;
232
  char *msg;
217
  char *langlist[] = {
233
  char *langlist[] = {
218
    "English",
234
    "English",
Line 252... Line 268...
252
      strcpy(locales->lang, "EN");
268
      strcpy(locales->lang, "EN");
253
      locales->keyboff = 0;
269
      locales->keyboff = 0;
254
      locales->keyblen = OFFCOUNT;
270
      locales->keyblen = OFFCOUNT;
255
      break;
271
      break;
256
  }
272
  }
257
  /* populate the slocales struct */
273
  /* populate the slocales struct accordingly to the keyboff member */
258
  for (msg = kblayouts[locales->keyboff]; *msg != 0; msg++); /* skip layout name */
-
 
259
  msg++;
-
 
260
  /* skip keyb code and copy it to locales.keybcode */
-
 
261
  locales->keybcode = msg;
274
  kblay2slocal(locales);
262
  for (; *msg != 0; msg++);
-
 
263
  /* */
-
 
264
  locales->codepage = ((unsigned short)msg[1] << 8) | msg[2];
-
 
265
  locales->egafile = msg[3];
-
 
266
  locales->keybfile = msg[4];
-
 
267
  /* */
275
  /* */
268
  return(MENUNEXT);
276
  return(MENUNEXT);
269
}
277
}
270
 
278
 
271
 
279
 
272
#define LTODEC(x, y) ((unsigned short)(x << 8) | (y))
-
 
273
static int selectkeyb(struct slocales *locales) {
280
static int selectkeyb(struct slocales *locales) {
274
  int keyboff, keyblen, menuheight;
281
  int menuheight, choice;
275
  unsigned short lang;
-
 
276
  lang = LTODEC(locales->lang[0], locales->lang[1]);
-
 
277
 
-
 
278
  switch (lang) {
-
 
279
    case LTODEC('F', 'R'):
-
 
280
      keyboff = OFFLOC_FR;
-
 
281
      keyblen = OFFLEN_FR;
-
 
282
      break;
-
 
283
    case LTODEC('P', 'L'):
-
 
284
      keyboff = OFFLOC_PL;
-
 
285
      keyblen = OFFLEN_PL;
-
 
286
      break;
-
 
287
    case LTODEC('T', 'R'):
-
 
288
      keyboff = OFFLOC_TR;
-
 
289
      keyblen = OFFLEN_TR;
-
 
290
      break;
-
 
291
    default: /* otherwise propose all possible keyoard layouts */
-
 
292
      keyboff = 0;
-
 
293
      keyblen = OFFCOUNT;
-
 
294
      break;
-
 
295
  }
-
 
296
  if (keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
282
  if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
297
  newscreen(0);
283
  newscreen(0);
298
  putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "Svarog386 supports the keyboard layouts used in different countries. Choose the keyboard layout you want.");
284
  putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "Svarog386 supports the keyboard layouts used in different countries. Choose the keyboard layout you want.");
299
  menuheight = keyblen + 2;
285
  menuheight = locales->keyblen + 2;
300
  if (menuheight > 13) menuheight = 13;
286
  if (menuheight > 13) menuheight = 13;
301
  if (menuselect(10, -1, menuheight, &(kblayouts[keyboff]), keyblen) < 0) return(MENUPREV);
287
  choice = menuselect(10, -1, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
-
 
288
  if (choice < 0) return(MENUPREV);
-
 
289
  /* (re)load the keyboard layout & codepage setup */
-
 
290
  locales->keyboff += choice;
-
 
291
  kblay2slocal(locales);
302
  return(MENUNEXT);
292
  return(MENUNEXT);
303
}
293
}
304
 
294
 
305
 
295
 
306
/* returns 0 if installation must proceed, non-zero otherwise */
296
/* returns 0 if installation must proceed, non-zero otherwise */
Line 502... Line 492...
502
}
492
}
503
 
493
 
504
 
494
 
505
static void bootfilesgen(int targetdrv, struct slocales *locales, int cdromdrv) {
495
static void bootfilesgen(int targetdrv, struct slocales *locales, int cdromdrv) {
506
  char buff[128];
496
  char buff[128];
-
 
497
  char buff2[16];
-
 
498
  char buff3[16];
507
  FILE *fd;
499
  FILE *fd;
508
  /*** CONFIG.SYS ***/
500
  /*** CONFIG.SYS ***/
509
  snprintf(buff, sizeof(buff), "%c:\\CONFIG.SYS", targetdrv);
501
  snprintf(buff, sizeof(buff), "%c:\\CONFIG.SYS", targetdrv);
510
  fd = fopen(buff, "wb");
502
  fd = fopen(buff, "wb");
511
  if (fd == NULL) return;
503
  if (fd == NULL) return;
Line 548... Line 540...
548
    }
540
    }
549
    fprintf(fd, "MODE CON CP SELECT=%u\r\n", locales->codepage);
541
    fprintf(fd, "MODE CON CP SELECT=%u\r\n", locales->codepage);
550
  }
542
  }
551
  if (locales->keybfile > 0) {
543
  if (locales->keybfile > 0) {
552
    if (locales->keybfile == 1) {
544
    if (locales->keybfile == 1) {
-
 
545
      snprintf(buff2, sizeof(buff2), "KEYBOARD.SYS");
-
 
546
    } else {
553
      fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVAROG.386\\BIN\\KEYBOARD.SYS\r\n", locales->keybcode, locales->codepage, targetdrv);
547
      snprintf(buff2, sizeof(buff2), "KEYBRD%d.SYS", locales->keybfile);
-
 
548
    }
-
 
549
    if (locales->keybid > 0) {
-
 
550
      buff3[0] = 0;
554
    } else {
551
    } else {
555
      fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVAROG.386\\BIN\\KEYBRD%d.SYS\r\n", locales->keybcode, locales->codepage, targetdrv, locales->keybfile);
552
      snprintf(buff3, sizeof(buff3), " /ID:%d", locales->keybid);
556
    }
553
    }
-
 
554
    fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVAROG.386\\BIN\\%s%s\r\n", locales->keybcode, locales->codepage, targetdrv, buff2, buff3);
557
    fprintf(fd, "\r\n");
555
    fprintf(fd, "\r\n");
558
  }
556
  }
559
  fprintf(fd, "SHSUCDX /d:SVCD0001\r\n");
557
  fprintf(fd, "SHSUCDX /d:SVCD0001\r\n");
560
  fprintf(fd, "\r\n");
558
  fprintf(fd, "\r\n");
561
  fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
559
  fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");