Subversion Repositories SvarDOS

Rev

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

Rev 1835 Rev 1908
Line 68... Line 68...
68
#define DBG(x) { video_putstringfix(24, 0, 0x4F00u, x, 80); }
68
#define DBG(x) { video_putstringfix(24, 0, 0x4F00u, x, 80); }
69
 
69
 
70
struct slocales {
70
struct slocales {
71
  char lang[4];
71
  char lang[4];
72
  const char *keybcode;
72
  const char *keybcode;
73
  unsigned int codepage;
73
  unsigned short codepage;
74
  int egafile;
74
  unsigned char egafile;
75
  int keybfile;
75
  unsigned char keybfile;
76
  int keyboff;
76
  short keyboff;
77
  int keyblen;
77
  short keyblen;
78
  unsigned int keybid;
78
  unsigned short keybid;
-
 
79
  unsigned short countryid; /* 1=USA, 33=FR, 48=PL, etc */
79
};
80
};
80
 
81
 
81
 
82
 
82
/* put a string on screen and fill it until w chars with whilte space */
83
/* put a string on screen and fill it until w chars with white space */
83
static void video_putstringfix(unsigned char y, unsigned char x, unsigned char attr, const char *s, unsigned char w) {
84
static void video_putstringfix(unsigned char y, unsigned char x, unsigned char attr, const char *s, unsigned char w) {
84
  unsigned char i;
85
  unsigned char i;
85
 
86
 
86
  /* print the string up to w characters */
87
  /* print the string up to w characters */
87
  i = mdr_cout_str(y, x, s, attr, w);
88
  i = mdr_cout_str(y, x, s, attr, w);
Line 292... Line 293...
292
  mdr_cout_char(24, 0, ' ', COLOR_TITLEBAR);
293
  mdr_cout_char(24, 0, ' ', COLOR_TITLEBAR);
293
  video_putstringfix(24, 1, COLOR_TITLEBAR, msg, 79);
294
  video_putstringfix(24, 1, COLOR_TITLEBAR, msg, 79);
294
  mdr_cout_locate(25,0);
295
  mdr_cout_locate(25,0);
295
}
296
}
296
 
297
 
-
 
298
 
297
/* fills a slocales struct accordingly to the value of its keyboff member */
299
/* fills a slocales struct accordingly to the value of its keyboff member */
298
static void kblay2slocal(struct slocales *locales) {
300
static void kblay2slocal(struct slocales *locales) {
299
  const char *m;
301
  const char *m;
300
  for (m = kblayouts[locales->keyboff]; *m != 0; m++); /* skip layout name */
302
  for (m = kblayouts[locales->keyboff]; *m != 0; m++); /* skip layout name */
301
  m++;
303
  m++;
Line 305... Line 307...
305
  /* */
307
  /* */
306
  locales->codepage = ((unsigned short)m[1] << 8) | m[2];
308
  locales->codepage = ((unsigned short)m[1] << 8) | m[2];
307
  locales->egafile = m[3];
309
  locales->egafile = m[3];
308
  locales->keybfile = m[4];
310
  locales->keybfile = m[4];
309
  locales->keybid = ((unsigned short)m[5] << 8) | m[6];
311
  locales->keybid = ((unsigned short)m[5] << 8) | m[6];
-
 
312
  locales->countryid = ((unsigned short)m[7] << 8) | m[8];
310
}
313
}
311
 
314
 
-
 
315
 
312
static int selectlang(struct slocales *locales) {
316
static int selectlang(struct slocales *locales) {
313
  int choice, x;
317
  int choice, x;
314
  const char *msg;
318
  const char *msg;
315
  const char *langlist[] = {
319
  const char *langlist[] = {
316
    "English",
320
    "English",
Line 324... Line 328...
324
    "Swedish",
328
    "Swedish",
325
    "Turkish",
329
    "Turkish",
326
    NULL
330
    NULL
327
  };
331
  };
328
 
332
 
329
  /* do not ask for language on non-multilang setups */
-
 
330
  if (!fileexists("INSTALL.LNG")) {
-
 
331
    choice = 0;
-
 
332
    goto SkipLangSelect;
-
 
333
  }
-
 
334
 
-
 
335
  newscreen(1);
333
  newscreen(1);
336
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
334
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
337
  x = 40 - (strlen(msg) >> 1);
335
  x = 40 - (strlen(msg) >> 1);
338
  mdr_cout_str(4, x, msg, COLOR_BODY, 80);
336
  mdr_cout_str(4, x, msg, COLOR_BODY, 80);
339
  mdr_cout_char_rep(5, x, '=', COLOR_BODY, strlen(msg));
337
  mdr_cout_char_rep(5, x, '=', COLOR_BODY, strlen(msg));
Line 347... Line 345...
347
  }
345
  }
348
 
346
 
349
  choice = menuselect(11, 9, langlist, -1);
347
  choice = menuselect(11, 9, langlist, -1);
350
  if (choice < 0) return(MENUPREV);
348
  if (choice < 0) return(MENUPREV);
351
 
349
 
352
  SkipLangSelect:
-
 
353
 
-
 
354
  /* populate locales with default values */
350
  /* populate locales with default values */
355
  memset(locales, 0, sizeof(struct slocales));
351
  memset(locales, 0, sizeof(struct slocales));
356
  switch (choice) {
352
  switch (choice) {
357
    case 1:
353
    case 1:
358
      strcpy(locales->lang, "BR");
354
      strcpy(locales->lang, "BR");
Line 442... Line 438...
442
  if (c == 0) return(MENUNEXT);
438
  if (c == 0) return(MENUNEXT);
443
  return(MENUQUIT);
439
  return(MENUQUIT);
444
}
440
}
445
 
441
 
446
 
442
 
447
/* returns 1 if drive is removable, 0 if not, -1 on error */
443
/* returns 0 if drive is removable, 1 if fixed, -1 on error */
448
static int isdriveremovable(int drv) {
444
static int isdriveremovable(unsigned char drv);
449
  union REGS r;
445
#pragma aux isdriveremovable = \
450
  r.x.ax = 0x4408;
446
"mov ax, 0x4408" \
451
  r.h.bl = drv;
447
"int 0x21" \
452
  int86(0x21, &r, &r);
448
"jnc DONE" \
453
  /* CF set on error, AX set to 0 if removable, 1 if fixed */
-
 
454
  if (r.x.cflag != 0) return(-1);
449
"xor ax,ax" \
455
  if (r.x.ax == 0) return(1);
450
"dec ax" \
-
 
451
"DONE:" \
456
  return(0);
452
parm [bl] \
457
}
453
value [ax]
458
 
454
 
459
 
455
 
460
/* returns total disk space of drive drv (in MiB, max 2048), or -1 if drive invalid */
456
/* returns total disk space of drive drv (in MiB, max 2048, A=1 B=2 etc), or -1 if drive invalid */
461
static int disksize(int drv) {
457
static int disksize(int drv);
-
 
458
#pragma aux disksize = \
462
  long res;
459
"mov ah, 0x36" \
463
  union REGS r;
460
"int 0x21" \
464
  r.h.ah = 0x36; /* DOS 2+ get free disk space */
461
"cmp ax, 0xffff" /* AX=FFFFh on error */ \
-
 
462
"je FAIL" \
-
 
463
/* AX=sec_per_cluster DX=tot_clusters BX=free_clusters CX=bytes_per_sec */ \
465
  r.h.dl = drv;  /* A=1, B=2, etc */
464
"mul dx"        /* (DX AX) = AX * DX */ \
-
 
465
"mov si,ax" \
-
 
466
"mov di,dx" \
466
  int86(0x21, &r, &r);
467
"mul cx"      /* hi * lo */ \
467
  if (r.x.ax == 0xffffu) return(-1); /* AX set to FFFFh if drive invalid */
468
"xchg ax, di" /* First mul saved, grab orig DX */ \
-
 
469
"mul bx"      /* lo * hi */ \
468
  res = r.x.ax;  /* sectors per cluster */
470
"add di, ax"  /* top word of result */ \
469
  res *= r.x.dx; /* dx contains total clusters, bx contains free clusters */
471
"mov ax, si"  /* retrieve original AX */ \
470
  res *= r.x.cx; /* bytes per sector */
472
"mul bx"      /* lo * lo */ \
-
 
473
"add dx, di"  /* DX:AX has the low 32 bits of the multiplication result */ \
-
 
474
"mov cl, 4" \
471
  res >>= 20;    /* convert bytes to MiB */
475
"shr dx, cl"  /* (DX AX) >> 20 (convert bytes to MiB) */ \
-
 
476
"FAIL:" \
472
  return(res);
477
parm [dl] \
-
 
478
modify [ax bx cx dx si di] \
473
}
479
value [dx]
474
 
480
 
475
 
481
 
476
/* returns 0 if disk is empty, non-zero otherwise */
482
/* returns 0 if disk is empty, non-zero otherwise */
477
static int diskempty(int drv) {
483
static int diskempty(int drv) {
478
  unsigned int rc;
484
  unsigned int rc;
Line 488... Line 494...
488
  }
494
  }
489
  /* _dos_findclose(&fileinfo); */ /* apparently required only on OS/2 */
495
  /* _dos_findclose(&fileinfo); */ /* apparently required only on OS/2 */
490
  return(res);
496
  return(res);
491
}
497
}
492
 
498
 
493
#ifdef DEADCODE
-
 
494
/* set new DOS "current drive" to drv ('A', 'B', etc). returns 0 on success */
-
 
495
static int set_cur_drive(char drv) {
-
 
496
  union REGS r;
-
 
497
  if ((drv < 'A') || (drv > 'Z')) return(-1);
-
 
498
  r.h.ah = 0x0E; /* DOS 1+ SELECT DEFAULT DRIVE */
-
 
499
  r.h.dl = drv - 'A';
-
 
500
  int86(0x21, &r, &r);
-
 
501
  if (r.h.al < drv - 'A') return(-1);
-
 
502
  return(0);
-
 
503
}
-
 
504
#endif
-
 
505
 
-
 
506
 
499
 
507
/* get the DOS "current drive" (0=A:, 1=B:, etc) */
500
/* get the DOS "current drive" (0=A:, 1=B:, etc) */
508
static int get_cur_drive(void) {
501
static unsigned char get_cur_drive(void);
509
  union REGS r;
502
#pragma aux get_cur_drive = \
510
  r.h.ah = 0x19; /* DOS 1+ GET CURRENT DEFAULT DRIVE */
503
"mov ah, 0x19" /* DOS 1+ GET CURRENT DEFAULT DRIVE */ \
511
  int86(0x21, &r, &r);
504
"int 0x21" \
512
  return(r.h.al);
505
modify [ah] \
513
}
506
value [al]
514
 
507
 
515
 
508
 
516
/* tries to write an empty file to drive.
509
/* tries to write an empty file to drive.
517
 * asks DOS to inhibit the int 24h handler for this job, so erros are
510
 * asks DOS to inhibit the int 24h handler for this job, so erros are
518
 * gracefully reported - unfortunately this does not work under FreeDOS because
511
 * gracefully reported - unfortunately this does not work under FreeDOS because
519
 * the DOS-C kernel does not implement the required flag.
512
 * the DOS-C kernel does not implement the required flag.
520
 * returns 0 on success (ie. "disk exists and is writeable"). */
513
 * returns 0 on success (ie. "disk exists and is writeable"). */
521
static unsigned short test_drive_write(char drive, char *buff) {
514
static unsigned short test_drive_write(char drive) {
522
  unsigned short result = 0;
515
  unsigned short result = 0;
523
  sprintf(buff, "%c:\\SVWRTEST.123", drive);
516
  char *buff = "@:\\SVWRTEST.123";
-
 
517
  buff[0] = drive;
524
  _asm {
518
  _asm {
525
    push ax
519
    push ax
526
    push bx
520
    push bx
527
    push cx
521
    push cx
528
    push dx
522
    push dx
Line 571... Line 565...
571
    driveid = 2; /* primary drive is the emulated USB storage */
565
    driveid = 2; /* primary drive is the emulated USB storage */
572
  }
566
  }
573
  cselecteddrive = 'A' + selecteddrive - 1;
567
  cselecteddrive = 'A' + selecteddrive - 1;
574
  for (;;) {
568
  for (;;) {
575
    driveremovable = isdriveremovable(selecteddrive);
569
    driveremovable = isdriveremovable(selecteddrive);
-
 
570
    if (driveremovable == 0) {
-
 
571
      newscreen(2);
-
 
572
      snprintf(buff, sizeof(buff), svarlang_strid(0x0302), cselecteddrive); /* "ERROR: Drive %c: is a removable device */
-
 
573
      mdr_cout_str(9, 1, buff, COLOR_BODY, 80);
-
 
574
      putstringnls(11, 2, COLOR_BODY, 0, 5); /* "Press any key..." */
-
 
575
      mdr_dos_getkey();
-
 
576
      return(MENUQUIT);
-
 
577
    }
-
 
578
 
-
 
579
    /* if C: not found - disk not partitioned? */
576
    if (driveremovable < 0) {
580
    if (driveremovable < 0) {
577
      const char *list[4];
581
      const char *list[4];
578
      newscreen(0);
582
      newscreen(0);
579
      list[0] = svarlang_str(0, 3); /* Create a partition automatically */
583
      list[0] = svarlang_str(0, 3); /* Create a partition automatically */
580
      list[1] = svarlang_str(0, 4); /* Run the FDISK tool */
584
      list[1] = svarlang_str(0, 4); /* Run the FDISK tool */
Line 605... Line 609...
605
      putstringnls(10, 10, COLOR_BODY, 3, 1); /* "Your computer will reboot now." */
609
      putstringnls(10, 10, COLOR_BODY, 3, 1); /* "Your computer will reboot now." */
606
      putstringnls(12, 10, COLOR_BODY, 0, 5); /* "Press any key..." */
610
      putstringnls(12, 10, COLOR_BODY, 0, 5); /* "Press any key..." */
607
      mdr_dos_getkey();
611
      mdr_dos_getkey();
608
      reboot();
612
      reboot();
609
      return(MENUQUIT);
613
      return(MENUQUIT);
610
    } else if (driveremovable > 0) {
-
 
611
      newscreen(2);
-
 
612
      snprintf(buff, sizeof(buff), svarlang_strid(0x0302), cselecteddrive); /* "ERROR: Drive %c: is a removable device */
-
 
613
      mdr_cout_str(9, 1, buff, COLOR_BODY, 80);
-
 
614
      putstringnls(11, 2, COLOR_BODY, 0, 5); /* "Press any key..." */
-
 
615
      return(MENUQUIT);
-
 
616
    }
614
    }
-
 
615
 
617
    /* if not formatted, propose to format it right away (try to create a directory) */
616
    /* if not formatted, propose to format it right away (try to create a directory) */
618
    if (test_drive_write(cselecteddrive, buff) != 0) {
617
    if (test_drive_write(cselecteddrive) != 0) {
619
      const char *list[3];
618
      const char *list[3];
620
      newscreen(0);
619
      newscreen(0);
621
      snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
620
      snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
622
      mdr_cout_str(7, 1, buff, COLOR_BODY, 80);
621
      mdr_cout_str(7, 1, buff, COLOR_BODY, 80);
623
 
622
 
Line 700... Line 699...
700
  if (locales->egafile > 0) {
699
  if (locales->egafile > 0) {
701
    fprintf(fd, "DISPLAY CON=(EGA,,1)\r\n");
700
    fprintf(fd, "DISPLAY CON=(EGA,,1)\r\n");
702
    if (locales->egafile == 1) {
701
    if (locales->egafile == 1) {
703
      fprintf(fd, "MODE CON CP PREPARE=((%u) %%DOSDIR%%\\CPI\\EGA.CPX)\r\n", locales->codepage);
702
      fprintf(fd, "MODE CON CP PREPARE=((%u) %%DOSDIR%%\\CPI\\EGA.CPX)\r\n", locales->codepage);
704
    } else {
703
    } else {
705
      fprintf(fd, "MODE CON CP PREPARE=((%u) %%DOSDIR%%\\CPI\\EGA%d.CPX)\r\n", locales->codepage, locales->egafile);
704
      fprintf(fd, "MODE CON CP PREPARE=((%u) %%DOSDIR%%\\CPI\\EGA%u.CPX)\r\n", locales->codepage, locales->egafile);
706
    }
705
    }
707
    fprintf(fd, "MODE CON CP SELECT=%u\r\n", locales->codepage);
706
    fprintf(fd, "MODE CON CP SELECT=%u\r\n", locales->codepage);
708
  }
707
  }
709
 
708
 
710
  if (locales->keybfile > 0) {
709
  if (locales->keybfile > 0) {
711
    fprintf(fd, "KEYB %s,%d,%%DOSDIR%%\\", locales->keybcode, locales->codepage);
710
    fprintf(fd, "KEYB %s,%d,%%DOSDIR%%\\", locales->keybcode, locales->codepage);
712
    if (locales->keybfile == 1) {
711
    if (locales->keybfile == 1) {
713
      fprintf(fd, "KEYBOARD.SYS");
712
      fprintf(fd, "KEYBOARD.SYS");
714
    } else {
713
    } else {
715
      fprintf(fd, "KEYBRD%d.SYS", locales->keybfile);
714
      fprintf(fd, "KEYBRD%u.SYS", locales->keybfile);
716
    }
715
    }
717
    if (locales->keybid != 0) fprintf(fd, " /ID:%d", locales->keybid);
716
    if (locales->keybid != 0) fprintf(fd, " /ID:%d", locales->keybid);
718
    fprintf(fd, "\r\n");
717
    fprintf(fd, "\r\n");
719
  }
718
  }
720
}
719
}
Line 742... Line 741...
742
              "DOS=UMB,HIGH\r\n");
741
              "DOS=UMB,HIGH\r\n");
743
  fprintf(fd, "\r\n"
742
  fprintf(fd, "\r\n"
744
              "; command interpreter (shell) location and default environment size\r\n"
743
              "; command interpreter (shell) location and default environment size\r\n"
745
              "SHELL=C:\\COMMAND.COM /E:512 /P\r\n");
744
              "SHELL=C:\\COMMAND.COM /E:512 /P\r\n");
746
  fprintf(fd, "\r\n"
745
  fprintf(fd, "\r\n"
747
              "; NLS configuration\r\n"
746
              "; NLS configuration\r\n");
-
 
747
  if (locales != NULL) {
748
              ";COUNTRY=001,%u,C:\\SVARDOS\\CFG\\COUNTRY.SYS\r\n", locales->codepage);
748
    fprintf(fd, "COUNTRY=%03u,%u,C:\\SVARDOS\\COUNTRY.SYS\r\n", locales->countryid, locales->codepage);
-
 
749
  } else {
-
 
750
    fprintf(fd, "COUNTRY=001,437,C:\\SVARDOS\\COUNTRY.SYS\r\n");
-
 
751
  }
749
  fprintf(fd, "\r\n"
752
  fprintf(fd, "\r\n"
750
              "; CD-ROM driver initialization\r\n"
753
              "; CD-ROM driver initialization\r\n"
751
              ";DEVICE=C:\\DRIVERS\\VIDECDD\\VIDE-CDD.SYS /D:SVCD0001\r\n");
754
              ";DEVICE=C:\\DRIVERS\\VIDECDD\\VIDE-CDD.SYS /D:SVCD0001\r\n");
752
  fclose(fd);
755
  fclose(fd);
753
  /*** AUTOEXEC.BAT ***/
756
  /*** AUTOEXEC.BAT ***/
Line 755... Line 758...
755
  fd = fopen(buff, "wb");
758
  fd = fopen(buff, "wb");
756
  if (fd == NULL) return;
759
  if (fd == NULL) return;
757
  fprintf(fd, "@ECHO OFF\r\n");
760
  fprintf(fd, "@ECHO OFF\r\n");
758
  fprintf(fd, "SET TEMP=C:\\TEMP\r\n");
761
  fprintf(fd, "SET TEMP=C:\\TEMP\r\n");
759
  fprintf(fd, "SET DOSDIR=C:\\SVARDOS\r\n");
762
  fprintf(fd, "SET DOSDIR=C:\\SVARDOS\r\n");
760
  fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS;.\r\n");
763
  fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS\r\n");
761
  fprintf(fd, "SET DIRCMD=/O/P\r\n");
764
  fprintf(fd, "SET DIRCMD=/O/P\r\n");
762
  fprintf(fd, "SET WATTCP.CFG=%%DOSDIR%%\\CFG\r\n");
765
  fprintf(fd, "SET WATTCP.CFG=%%DOSDIR%%\\CFG\r\n");
763
  fprintf(fd, "PATH %%DOSDIR%%\r\n");
766
  fprintf(fd, "PATH %%DOSDIR%%\r\n");
764
  fprintf(fd, "PROMPT $P$G\r\n");
767
  fprintf(fd, "PROMPT $P$G\r\n");
765
  fprintf(fd, "\r\n"
768
  fprintf(fd, "\r\n"
766
              "REM enable CPU power saving\r\n"
769
              "REM enable CPU power saving\r\n"
767
              "FDAPM ADV:REG\r\n");
770
              "FDAPM ADV:REG\r\n");
768
  fprintf(fd, "\r\n");
771
  fprintf(fd, "\r\n");
769
  genlocalesconf(fd, locales);
772
  if (locales != NULL) genlocalesconf(fd, locales);
770
  fprintf(fd, "\r\n");
773
  fprintf(fd, "\r\n");
771
  fprintf(fd, "REM Uncomment the line below for CDROM support\r\n");
774
  fprintf(fd, "REM Uncomment the line below for CDROM support\r\n");
772
  fprintf(fd, "REM SHSUCDX /d:SVCD0001\r\n");
775
  fprintf(fd, "REM SHSUCDX /d:SVCD0001\r\n");
773
  fprintf(fd, "\r\n");
776
  fprintf(fd, "\r\n");
774
  fprintf(fd, "ECHO.\r\n");
777
  fprintf(fd, "ECHO.\r\n");
Line 985... Line 988...
985
  snprintf(buff, sizeof(buff), "MODE CON CP SEL=%u > NUL", locales->codepage);
988
  snprintf(buff, sizeof(buff), "MODE CON CP SEL=%u > NUL", locales->codepage);
986
  system(buff);
989
  system(buff);
987
  /* below I re-init the video controller - apparently this is required if
990
  /* below I re-init the video controller - apparently this is required if
988
   * I want the new glyph symbols to be actually applied, at least some
991
   * I want the new glyph symbols to be actually applied, at least some
989
   * (broken?) BIOSes, like VBox, apply glyphs only at next video mode change */
992
   * (broken?) BIOSes, like VBox, apply glyphs only at next video mode change */
990
  {
993
  _asm {
991
  union REGS r;
994
    push bx
992
  r.h.ah = 0x0F; /* get current video mode */
995
    mov ah, 0x0F  /* get current video mode */
993
  int86(0x10, &r, &r); /* r.h.al contains the current video mode now */
996
    int 0x10      /* al contains the current video mode now */
994
  r.h.al |= 128; /* set the high bit of AL to instruct BIOS not to flush VRAM's content (EGA+) */
997
    or al, 128    /* set high bit of AL to instruct BIOS not to flush VRAM's content (EGA+) */
995
  r.h.ah = 0; /* re-set video mode (to whatever is set in AL) */
998
    xor ah, ah    /* re-set video mode (to whatever is set in AL) */
996
  int86(0x10, &r, &r);
999
    int 0x10
-
 
1000
    pop bx
997
  }
1001
  }
998
}
1002
}
999
 
1003
 
1000
 
1004
 
1001
#ifdef DEADCODE
-
 
1002
/* checks that drive drv contains SvarDOS packages
-
 
1003
 * returns 0 if found, non-zero otherwise */
-
 
1004
static int checkinstsrc(char drv) {
-
 
1005
  char fname[16];
-
 
1006
  snprintf(fname, sizeof(fname), "%c:\\ATTRIB.SVP", drv);
-
 
1007
  return(!fileexists(fname));
-
 
1008
}
-
 
1009
#endif
-
 
1010
 
-
 
1011
 
-
 
1012
int main(void) {
1005
int main(void) {
1013
  struct slocales locales;
1006
  struct slocales locales_data;
-
 
1007
  struct slocales *locales = &locales_data;
1014
  int targetdrv;
1008
  int targetdrv;
1015
  int sourcedrv;
1009
  int sourcedrv;
1016
  int action;
1010
  int action;
1017
 
1011
 
1018
  /* setup the internal int 24h handler ("always fail") */
1012
  /* setup the internal int 24h handler ("always fail") */
Line 1054... Line 1048...
1054
    COLOR_BODYWARN = 0x07;
1048
    COLOR_BODYWARN = 0x07;
1055
    COLOR_SELECT = 0x70;
1049
    COLOR_SELECT = 0x70;
1056
    COLOR_SELECTCUR = 0x07;
1050
    COLOR_SELECTCUR = 0x07;
1057
  }
1051
  }
1058
 
1052
 
-
 
1053
  /* am I EN-only? */
-
 
1054
  if (!fileexists("INSTALL.LNG")) locales = NULL;
-
 
1055
 
1059
 SelectLang:
1056
 SelectLang:
-
 
1057
  if (locales == NULL) goto WelcomeScreen;
1060
  action = selectlang(&locales); /* welcome to svardos, select your language */
1058
  action = selectlang(locales); /* welcome to svardos, select your language */
1061
  if (action != MENUNEXT) goto Quit;
1059
  if (action != MENUNEXT) goto Quit;
1062
  loadcp(&locales);
1060
  loadcp(locales);
1063
  svarlang_load("INSTALL.LNG", locales.lang); /* NLS support */
1061
  svarlang_load("INSTALL.LNG", locales->lang); /* NLS support */
1064
 
1062
 
1065
  action = selectkeyb(&locales);  /* what keyb layout should we use? */
1063
  action = selectkeyb(locales);  /* what keyb layout should we use? */
1066
  if (action == MENUQUIT) goto Quit;
1064
  if (action == MENUQUIT) goto Quit;
1067
  if (action == MENUPREV) {
1065
  if (action == MENUPREV) goto SelectLang;
1068
    if (!fileexists("INSTALL.LNG")) goto Quit;
-
 
1069
    goto SelectLang;
-
 
1070
  }
-
 
1071
 
1066
 
1072
 WelcomeScreen:
1067
 WelcomeScreen:
1073
  action = welcomescreen(); /* what svardos is, ask whether to run live dos or install */
1068
  action = welcomescreen(); /* what svardos is, ask whether to run live dos or install */
1074
  if (action == MENUQUIT) goto Quit;
1069
  if (action == MENUQUIT) goto Quit;
1075
  if (action == MENUPREV) goto SelectLang;
1070
  if (action == MENUPREV) {
-
 
1071
    if (locales == NULL) goto Quit;
-
 
1072
    goto SelectLang;
-
 
1073
  }
1076
 
1074
 
1077
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
1075
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
1078
  if (targetdrv == MENUQUIT) goto Quit;
1076
  if (targetdrv == MENUQUIT) goto Quit;
1079
  if (targetdrv == MENUPREV) goto WelcomeScreen;
1077
  if (targetdrv == MENUPREV) goto WelcomeScreen;
1080
  bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */
1078
  bootfilesgen(targetdrv, locales); /* generate boot files and other configurations */
1081
  if (installpackages(targetdrv, sourcedrv, &locales) != 0) goto Quit;    /* install packages */
1079
  if (installpackages(targetdrv, sourcedrv, locales) != 0) goto Quit;    /* install packages */
1082
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
1080
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
1083
  /*netcfg();*/ /* basic networking config */
1081
  /*netcfg();*/ /* basic networking config */
1084
  finalreboot(); /* remove the CD and reboot */
1082
  finalreboot(); /* remove the CD and reboot */
1085
 
1083
 
1086
 Quit:
1084
 Quit: