Subversion Repositories SvarDOS

Rev

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

Rev 48 Rev 49
Line 164... Line 164...
164
  newscreen();
164
  newscreen();
165
  msg = kittengets(1, 0, "Welcome to Svarog386");
165
  msg = kittengets(1, 0, "Welcome to Svarog386");
166
  x = 40 - (strlen(msg) >> 1);
166
  x = 40 - (strlen(msg) >> 1);
167
  video_putstring(4, x, COLOR_BODY[mono], msg);
167
  video_putstring(4, x, COLOR_BODY[mono], msg);
168
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
168
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
169
  putstringnls(8, 2, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
169
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
170
  choice = menuselect(10, -1, 12, langlist);
170
  choice = menuselect(10, -1, 12, langlist);
171
  if (choice < 0) return(-1);
171
  if (choice < 0) return(-1);
172
  /* write short language code into lang */
172
  /* write short language code into lang */
173
  for (code = langlist[choice]; *code != 0; code++);
173
  for (code = langlist[choice]; *code != 0; code++);
174
  memcpy(lang, code + 1, 2);
174
  memcpy(lang, code + 1, 2);
Line 211... Line 211...
211
  union REGS r;
211
  union REGS r;
212
  r.h.ah = 0x36; /* DOS 2+ get free disk space */
212
  r.h.ah = 0x36; /* DOS 2+ get free disk space */
213
  r.h.dl = drv;
213
  r.h.dl = drv;
214
  int86(0x21, &r, &r);
214
  int86(0x21, &r, &r);
215
  if (r.x.ax == 0xffffu) return(-1); /* AX set to FFFFh if drive invalid */
215
  if (r.x.ax == 0xffffu) return(-1); /* AX set to FFFFh if drive invalid */
216
  res = r.x.ax;
216
  res = r.x.ax;  /* sectors per cluster */
217
  res *= r.x.bx;
217
  res *= r.x.dx; /* dx contains total clusters, bx contains free clusters */
218
  res *= r.x.cx;
218
  res *= r.x.cx; /* bytes per sector */
219
  return(res >> 20); /* return result after converting bytes to MiB */
219
  res >>= 20;    /* convert bytes to MiB */
-
 
220
  return(res);
220
}
221
}
221
 
222
 
222
 
223
 
223
/* returns 0 if disk is empty, non-zero otherwise */
224
/* returns 0 if disk is empty, non-zero otherwise */
224
static int diskempty(int drv) {
225
static int diskempty(int drv) {
Line 247... Line 248...
247
  cselecteddrive = 'A' + selecteddrive - 1;
248
  cselecteddrive = 'A' + selecteddrive - 1;
248
  for (;;) {
249
  for (;;) {
249
    newscreen();
250
    newscreen();
250
    driveremovable = isdriveremovable(selecteddrive);
251
    driveremovable = isdriveremovable(selecteddrive);
251
    if (driveremovable < 0) {
252
    if (driveremovable < 0) {
252
      char *list[] = { "Create an automatic partition", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
253
      char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
253
      list[0] = kittengets(0, 3, list[0]);
254
      list[0] = kittengets(0, 3, list[0]);
254
      list[1] = kittengets(0, 4, list[1]);
255
      list[1] = kittengets(0, 4, list[1]);
255
      list[2] = kittengets(0, 2, list[2]);
256
      list[2] = kittengets(0, 2, list[2]);
256
      sprintf(buff, kittengets(3, 0, "ERROR: Drive %c: could not be found. Perhaps your hard disk needs to be"), cselecteddrive);
257
      sprintf(buff, kittengets(3, 0, "ERROR: Drive %c: could not be found. Perhaps your hard disk needs to be"), cselecteddrive);
257
      video_putstring(4, 2, COLOR_BODY[mono], buff);
258
      video_putstring(4, 2, COLOR_BODY[mono], buff);
Line 335... Line 336...
335
      /* final confirmation */
336
      /* final confirmation */
336
      char *list[] = { "Install Svarog386", "Quit to DOS", NULL};
337
      char *list[] = { "Install Svarog386", "Quit to DOS", NULL};
337
      list[0] = kittengets(0, 1, list[0]);
338
      list[0] = kittengets(0, 1, list[0]);
338
      list[1] = kittengets(0, 2, list[1]);
339
      list[1] = kittengets(0, 2, list[1]);
339
      sprintf(buff, kittengets(3, 17, "The installation of Svarog386 to %c: is about to begin."), cselecteddrive);
340
      sprintf(buff, kittengets(3, 17, "The installation of Svarog386 to %c: is about to begin."), cselecteddrive);
340
      video_putstring(7, 2, COLOR_BODY[mono], buff);
341
      video_putstring(7, -1, COLOR_BODY[mono], buff);
341
      if (menuselect(10, -1, 4, list) != 0) return(-1);
342
      if (menuselect(10, -1, 4, list) != 0) return(-1);
342
      sprintf(buff, "SYS A: %c:", cselecteddrive);
343
      sprintf(buff, "SYS A: %c:", cselecteddrive);
343
      system(buff);
344
      system(buff);
344
      sprintf(buff, "%c:\\TEMP", cselecteddrive);
345
      sprintf(buff, "%c:\\TEMP", cselecteddrive);
345
      mkdir(buff);
346
      mkdir(buff);
Line 349... Line 350...
349
}
350
}
350
 
351
 
351
 
352
 
352
static void bootfilesgen(int targetdrv, char *lang) {
353
static void bootfilesgen(int targetdrv, char *lang) {
353
  char buff[128];
354
  char buff[128];
-
 
355
  int cp, egafile;
354
  FILE *fd;
356
  FILE *fd;
-
 
357
  cp = getnlscp(lang, &egafile);
355
  /*** AUTOEXEC.BAT ***/
358
  /*** AUTOEXEC.BAT ***/
356
  sprintf(buff, "%c:\\AUTOEXEC.BAT", targetdrv);
359
  sprintf(buff, "%c:\\AUTOEXEC.BAT", targetdrv);
357
  fd = fopen(buff, "wb");
360
  fd = fopen(buff, "wb");
358
  if (fd == NULL) return;
361
  if (fd == NULL) return;
359
  fprintf(fd, "@ECHO OFF\r\n");
362
  fprintf(fd, "@ECHO OFF\r\n");
360
  fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", targetdrv);
363
  fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", targetdrv);
361
  fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
364
  fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
362
  fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS\r\n", targetdrv);
365
  fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS\r\n");
363
  fprintf(fd, "SET LANG=%s\r\n", lang);
366
  fprintf(fd, "SET LANG=%s\r\n", lang);
364
  fprintf(fd, "SET DIRCMD=/OGNE/P\r\n");
367
  fprintf(fd, "SET DIRCMD=/OGNE/P\r\n");
365
  fprintf(fd, "SET FDNPKG.CFG=%c:\\SYSTEM\\CFG\\FDNPKG.CFG\r\n");
368
  fprintf(fd, "SET FDNPKG.CFG=%c:\\SYSTEM\\CFG\\FDNPKG.CFG\r\n");
366
  fprintf(fd, "SET WATTCP.CFG=%c:\\SYSTEM\\CFG\\WATTCP.CFG\r\n");
369
  fprintf(fd, "SET WATTCP.CFG=%c:\\SYSTEM\\CFG\\WATTCP.CFG\r\n");
367
  fprintf(fd, "PATH %%DOSDIR%%\\BIN;%%DOSDIR%%\\LINKS\r\n");
370
  fprintf(fd, "PATH %%DOSDIR%%\\BIN;%%DOSDIR%%\\LINKS\r\n");
368
  fprintf(fd, "PROMPT $P$G\r\n");
371
  fprintf(fd, "PROMPT $P$G\r\n");
369
  fprintf(fd, "ALIAS REBOOT=FDAPM COLDBOOT\r\n");
372
  fprintf(fd, "ALIAS REBOOT=FDAPM COLDBOOT\r\n");
370
  fprintf(fd, "ALIAS HALT=FDAPM POWEROFF\r\n");
373
  fprintf(fd, "ALIAS HALT=FDAPM POWEROFF\r\n");
371
  fprintf(fd, "\r\n\r\n");
-
 
372
  fprintf(fd, "MODE CON CP PREPARE=((991) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA10.CPX)\r\n");
-
 
373
  fprintf(fd, "MODE CON CP SELECT=991\r\n");
-
 
374
  fprintf(fd, "\r\n");
374
  fprintf(fd, "\r\n");
-
 
375
  if (egafile > 0) {
-
 
376
    if (egafile == 1) {
-
 
377
      fprintf(fd, "MODE CON CP PREPARE=((%d) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA.CPX)\r\n", cp, targetdrv);
-
 
378
    } else {
-
 
379
      fprintf(fd, "MODE CON CP PREPARE=((%d) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA%d.CPX)\r\n", cp, targetdrv, egafile);
-
 
380
    }
-
 
381
    fprintf(fd, "MODE CON CP SELECT=%d\r\n", cp);
-
 
382
    fprintf(fd, "\r\n");
-
 
383
  }
375
  fprintf(fd, "SHSUCDX /d:FDCD0001\r\n");
384
  fprintf(fd, "SHSUCDX /d:SVCD0001\r\n");
-
 
385
  fprintf(fd, "\r\n");
-
 
386
  fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
-
 
387
  fprintf(fd, "REM CTMOUSE\r\n");
-
 
388
  fprintf(fd, "\r\n");
-
 
389
  fprintf(fd, "ECHO.");
-
 
390
  fprintf(fd, "ECHO WELCOME TO SVAROG386! TYPE 'HELP' IF YOU NEED HELP.\r\n");
376
  fclose(fd);
391
  fclose(fd);
377
  /*** CONFIG.SYS ***/
392
  /*** CONFIG.SYS ***/
378
  sprintf(buff, "%c:\\CONFIG.SYS", targetdrv);
393
  sprintf(buff, "%c:\\CONFIG.SYS", targetdrv);
379
  fd = fopen(buff, "wb");
394
  fd = fopen(buff, "wb");
380
  if (fd == NULL) return;
395
  if (fd == NULL) return;
381
  fprintf(fd, "DOS=UMB,HIGH\r\n");
396
  fprintf(fd, "DOS=UMB,HIGH\r\n");
382
  fprintf(fd, "FILES=50\r\n");
397
  fprintf(fd, "FILES=50\r\n");
383
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\HIMEM.EXE\r\n", targetdrv);
398
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\HIMEMX.EXE\r\n", targetdrv);
384
  fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVAROG.386\\BIN\\COMMAND.COM /E:512\r\n", targetdrv);
399
  fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVAROG.386\\BIN\\COMMAND.COM /E:512 /P\r\n", targetdrv);
385
  fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
400
  fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
386
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\CDROM.SYS /D:FDCD0001\r\n", targetdrv);
401
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\DRIVERS\\UDVD2\\UDVD2.SYS /D:SVCD0001 /H\r\n", targetdrv);
387
  fclose(fd);
402
  fclose(fd);
388
}
403
}
389
 
404
 
390
 
405
 
391
static void installpackages(int targetdrv) {
406
static void installpackages(int targetdrv) {
Line 456... Line 471...
456
  for (i = 0; pkglist[i] != NULL; i++) {
471
  for (i = 0; pkglist[i] != NULL; i++) {
457
    char buff[128];
472
    char buff[128];
458
    snprintf(buff, sizeof(buff), kittengets(4, 0, "Installing package %d/%d: %s"), i+1, pkglistlen, pkglist[i]);
473
    snprintf(buff, sizeof(buff), kittengets(4, 0, "Installing package %d/%d: %s"), i+1, pkglistlen, pkglist[i]);
459
    strcat(buff, "       ");
474
    strcat(buff, "       ");
460
    video_putstring(10, 2, COLOR_BODY[mono], buff);
475
    video_putstring(10, 2, COLOR_BODY[mono], buff);
461
    sprintf(buff, "FDINST INSTALL X:\\BASE\\%s.ZIP > NUL", pkglist[i]);
476
    sprintf(buff, "FDINST INSTALL X:\\CORE\\%s.ZIP > NUL", pkglist[i]);
462
    system(buff);
477
    system(buff);
463
  }
478
  }
464
}
479
}
465
 
480
 
466
 
481
 
467
static void finalreboot(void) {
482
static void finalreboot(void) {
468
  newscreen();
483
  newscreen();
469
  putstringnls(10, 2, COLOR_BODY[mono], 5, 0, "Svarog386 installation is over. Your computer will reboot now.");
484
  putstringnls(9, 2, COLOR_BODY[mono], 5, 0, "Svarog386 installation is over. Your computer will reboot now.");
470
  putstringnls(11, 2, COLOR_BODY[mono], 5, 1, "Please remove the installation disk from your drive.");
485
  putstringnls(10, 2, COLOR_BODY[mono], 5, 1, "Please remove the installation disk from your drive.");
471
  putstringnls(13, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
486
  putstringnls(12, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
472
  input_getkey();
487
  input_getkey();
473
  reboot();
488
  reboot();
474
}
489
}
475
 
490
 
476
 
491