Subversion Repositories SvarDOS

Rev

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

Rev 62 Rev 65
Line 178... Line 178...
178
  int x;
178
  int x;
179
  char *msg;
179
  char *msg;
180
  char *code;
180
  char *code;
181
  char *langlist[] = {
181
  char *langlist[] = {
182
    "English\0EN",
182
    "English\0EN",
183
    "French\0FR",
183
/*    "French\0FR",*/
184
    "German\0DE",
-
 
185
    "Italian\0IT",
-
 
186
    "Polish\0PL",
184
    "Polish\0PL",
187
    "Russian\0RU",
-
 
188
    "Slovenian\0SL",
-
 
189
    "Spanish\0ES",
-
 
190
    "Turkish\0TR",
185
/*    "Turkish\0TR",*/
191
    NULL
186
    NULL
192
  };
187
  };
193
 
188
 
194
  newscreen();
189
  newscreen();
195
  msg = kittengets(1, 0, "Welcome to Svarog386");
190
  msg = kittengets(1, 0, "Welcome to Svarog386");
196
  x = 40 - (strlen(msg) >> 1);
191
  x = 40 - (strlen(msg) >> 1);
197
  video_putstring(4, x, COLOR_BODY[mono], msg, -1);
192
  video_putstring(4, x, COLOR_BODY[mono], msg, -1);
198
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
193
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
199
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
194
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
200
  choice = menuselect(10, -1, 12, langlist);
195
  choice = menuselect(11, -1, 3, langlist);
201
  if (choice < 0) return(-1);
196
  if (choice < 0) return(-1);
202
  /* write short language code into lang */
197
  /* write short language code into lang */
203
  for (code = langlist[choice]; *code != 0; code++);
198
  for (code = langlist[choice]; *code != 0; code++);
204
  memcpy(lang, code + 1, 2);
199
  memcpy(lang, code + 1, 2);
205
  lang[2] = 0;
200
  lang[2] = 0;
Line 334... Line 329...
334
      return(-1);
329
      return(-1);
335
    }
330
    }
336
    /* is the disk empty? */
331
    /* is the disk empty? */
337
    if (diskempty(selecteddrive) != 0) {
332
    if (diskempty(selecteddrive) != 0) {
338
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
333
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
-
 
334
      int y = 6;
339
      list[0] = kittengets(0, 6, list[0]);
335
      list[0] = kittengets(0, 6, list[0]);
340
      list[1] = kittengets(0, 2, list[1]);
336
      list[1] = kittengets(0, 2, list[1]);
341
      snprintf(buff, sizeof(buff), kittengets(3, 5, "ERROR: Drive %c: is not empty. Svarog386 must be installed on an empty disk.\n\nYou can format the disk now, to make it empty. Note however, that this will ERASE ALL CURRENT DATA on your disk."), cselecteddrive);
337
      snprintf(buff, sizeof(buff), kittengets(3, 5, "ERROR: Drive %c: is not empty. Svarog386 must be installed on an empty disk.\n\nYou can format the disk now, to make it empty. Note however, that this will ERASE ALL CURRENT DATA on your disk."), cselecteddrive);
342
      putstringwrap(7, 1, COLOR_BODY[mono], buff);
338
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
343
      if (menuselect(12, -1, 4, list) != 0) return(-1);
339
      if (menuselect(++y, -1, 4, list) != 0) return(-1);
344
      video_clear(0x0700, 0);
340
      video_clear(0x0700, 0);
345
      video_movecursor(0, 0);
341
      video_movecursor(0, 0);
346
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
342
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
347
      system(buff);
343
      system(buff);
348
      continue;
344
      continue;
Line 483... Line 479...
483
    "FORMAT",
479
    "FORMAT",
484
    "HELP",
480
    "HELP",
485
    "HIMEMX",
481
    "HIMEMX",
486
    "KERNEL",
482
    "KERNEL",
487
    "KEYB",
483
    "KEYB",
-
 
484
    "KEYB_LAY",
488
    "LABEL",
485
    "LABEL",
489
    "LBACACHE",
486
    "LBACACHE",
490
    "MEM",
487
    "MEM",
491
    "MIRROR",
488
    "MIRROR",
492
    "MODE",
489
    "MODE",
Line 556... Line 553...
556
  }
553
  }
557
  system(buff);
554
  system(buff);
558
  snprintf(buff, sizeof(buff), "MODE CON CP SEL=%d > NUL", cp);
555
  snprintf(buff, sizeof(buff), "MODE CON CP SEL=%d > NUL", cp);
559
  system(buff);
556
  system(buff);
560
  /* below I re-init the video controller - apparently this is required if
557
  /* below I re-init the video controller - apparently this is required if
561
   * I want the new glyph symbols to be actually applied */
558
   * I want the new glyph symbols to be actually applied, at least some
-
 
559
   * (broken?) BIOSes, like VBox, apply glyphs only at next video mode change */
562
  {
560
  {
563
  union REGS r;
561
  union REGS r;
564
  r.h.ah = 0x0F; /* get current video mode */
562
  r.h.ah = 0x0F; /* get current video mode */
565
  int86(0x10, &r, &r); /* r.h.al contains the current video mode now */
563
  int86(0x10, &r, &r); /* r.h.al contains the current video mode now */
566
  r.h.al |= 128; /* set the high bit of AL to instruct BIOS not to flush VRAM's content (EGA+) */
564
  r.h.al |= 128; /* set the high bit of AL to instruct BIOS not to flush VRAM's content (EGA+) */
Line 568... Line 566...
568
  int86(0x10, &r, &r);
566
  int86(0x10, &r, &r);
569
  }
567
  }
570
}
568
}
571
 
569
 
572
 
570
 
-
 
571
/* checks CD drive drv for the presence of the Svarog386 install CD
-
 
572
 * returns 0 if found, non-zero otherwise */
-
 
573
static int checkcd(char drv) {
-
 
574
  FILE *fd;
-
 
575
  char fname[32];
-
 
576
  snprintf(fname, sizeof(fname), "%c:\\CORE\\MEM.ZIP", drv);
-
 
577
  fd = fopen(fname, "rb");
-
 
578
  if (fd == NULL) return(-1);
-
 
579
  fclose(fd);
-
 
580
  return(0);
-
 
581
}
-
 
582
 
-
 
583
 
573
int main(void) {
584
int main(void) {
574
  char lang[4];
585
  char lang[4];
575
  int targetdrv;
586
  int targetdrv;
576
  int cdromdrv;
587
  int cdromdrv;
577
 
588
 
Line 580... Line 591...
580
  if (cdromdrv < 0) {
591
  if (cdromdrv < 0) {
581
    printf("ERROR: CD-ROM DRIVE NOT FOUND\r\n");
592
    printf("ERROR: CD-ROM DRIVE NOT FOUND\r\n");
582
    return(1);
593
    return(1);
583
  }
594
  }
584
  cdromdrv += 'A'; /* convert the cdrom 'id' (A=0) to an actual drive letter */
595
  cdromdrv += 'A'; /* convert the cdrom 'id' (A=0) to an actual drive letter */
-
 
596
  if (checkcd(cdromdrv) != 0) {
-
 
597
    printf("ERROR: SVAROG386 INSTALLATION CD NOT FOUND IN THE DRIVE.\r\n");
-
 
598
    return(1);
-
 
599
  }
585
 
600
 
586
  /* init screen and detect mono status */
601
  /* init screen and detect mono status */
587
  mono = video_init();
602
  mono = video_init();
588
 
603
 
589
  for (;;) { /* fake loop, it's here just to break out easily */
604
  for (;;) { /* fake loop, it's here just to break out easily */