Subversion Repositories SvarDOS

Rev

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

Rev 53 Rev 55
Line 126... Line 126...
126
      if (res > offset + height - 3) offset = res - (height - 3);
126
      if (res > offset + height - 3) offset = res - (height - 3);
127
    } else if (key == 0x1B) {  /* ESC */
127
    } else if (key == 0x1B) {  /* ESC */
128
      return(-1);
128
      return(-1);
129
    } else {
129
    } else {
130
      char buf[8];
130
      char buf[8];
131
      sprintf(buf, "0x%02X ", key);
131
      snprintf(buf, sizeof(buf), "0x%02X ", key);
132
      video_putstring(1, 0, COLOR_BODY[mono], buf);
132
      video_putstring(1, 0, COLOR_BODY[mono], buf);
133
    }
133
    }
134
  }
134
  }
135
}
135
}
136
 
136
 
Line 226... Line 226...
226
static int diskempty(int drv) {
226
static int diskempty(int drv) {
227
  unsigned int rc;
227
  unsigned int rc;
228
  int res;
228
  int res;
229
  char buff[8];
229
  char buff[8];
230
  struct find_t fileinfo;
230
  struct find_t fileinfo;
231
  sprintf(buff, "%c:\\*.*", 'A' + drv - 1);
231
  snprintf(buff, sizeof(buff), "%c:\\*.*", 'A' + drv - 1);
232
  rc = _dos_findfirst(buff, _A_NORMAL | _A_SUBDIR | _A_HIDDEN | _A_SYSTEM, &fileinfo);
232
  rc = _dos_findfirst(buff, _A_NORMAL | _A_SUBDIR | _A_HIDDEN | _A_SYSTEM, &fileinfo);
233
  if (rc == 0) {
233
  if (rc == 0) {
234
    res = 1; /* call successfull means disk is not empty */
234
    res = 1; /* call successfull means disk is not empty */
235
  } else {
235
  } else {
236
    res = 0;
236
    res = 0;
Line 253... Line 253...
253
    if (driveremovable < 0) {
253
    if (driveremovable < 0) {
254
      char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
254
      char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
255
      list[0] = kittengets(0, 3, list[0]);
255
      list[0] = kittengets(0, 3, list[0]);
256
      list[1] = kittengets(0, 4, list[1]);
256
      list[1] = kittengets(0, 4, list[1]);
257
      list[2] = kittengets(0, 2, list[2]);
257
      list[2] = kittengets(0, 2, list[2]);
258
      sprintf(buff, kittengets(3, 0, "ERROR: Drive %c: could not be found. Perhaps your hard disk needs to be"), cselecteddrive);
258
      snprintf(buff, sizeof(buff), kittengets(3, 0, "ERROR: Drive %c: could not be found. Perhaps your hard disk needs to be"), cselecteddrive);
259
      video_putstring(4, 2, COLOR_BODY[mono], buff);
259
      video_putstring(4, 2, COLOR_BODY[mono], buff);
260
      putstringnls(5, 2, COLOR_BODY[mono], 3, 1, "       partitioned first. Please create at least one partition on your");
260
      putstringnls(5, 2, COLOR_BODY[mono], 3, 1, "       partitioned first. Please create at least one partition on your");
261
      putstringnls(6, 2, COLOR_BODY[mono], 3, 2, "       hard disk, so Svarog386 can be installed on it. Note, that");
261
      putstringnls(6, 2, COLOR_BODY[mono], 3, 2, "       hard disk, so Svarog386 can be installed on it. Note, that");
262
      sprintf(buff, kittengets(3, 3, "       Svarog386 requires at least %d MiB of available disk space."), SVAROG_DISK_REQ);
262
      snprintf(buff, sizeof(buff), kittengets(3, 3, "       Svarog386 requires at least %d MiB of available disk space."), SVAROG_DISK_REQ);
263
      video_putstring(7, 2, COLOR_BODY[mono], buff);
263
      video_putstring(7, 2, COLOR_BODY[mono], buff);
264
      putstringnls(9, 2, COLOR_BODY[mono], 3, 4, "You can use the FDISK partitioning tool for creating the required partition");
264
      putstringnls(9, 2, COLOR_BODY[mono], 3, 4, "You can use the FDISK partitioning tool for creating the required partition");
265
      putstringnls(10, 2, COLOR_BODY[mono], 3, 5, "manually, or you can let the installer partitioning your disk");
265
      putstringnls(10, 2, COLOR_BODY[mono], 3, 5, "manually, or you can let the installer partitioning your disk");
266
      putstringnls(11, 2, COLOR_BODY[mono], 3, 6, "automatically. You can also abort the installation to use any other");
266
      putstringnls(11, 2, COLOR_BODY[mono], 3, 6, "automatically. You can also abort the installation to use any other");
267
      putstringnls(12, 2, COLOR_BODY[mono], 3, 7, "partition manager of your choice.");
267
      putstringnls(12, 2, COLOR_BODY[mono], 3, 7, "partition manager of your choice.");
Line 282... Line 282...
282
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5, "Press any key...");
282
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5, "Press any key...");
283
      input_getkey();
283
      input_getkey();
284
      reboot();
284
      reboot();
285
      return(-1);
285
      return(-1);
286
    } else if (driveremovable > 0) {
286
    } else if (driveremovable > 0) {
287
      sprintf(buff, kittengets(3, 9, "ERROR: Drive %c: is a removable device. Installation aborted."), cselecteddrive);
287
      snprintf(buff, sizeof(buff), kittengets(3, 9, "ERROR: Drive %c: is a removable device. Installation aborted."), cselecteddrive);
288
      video_putstring(9, 2, COLOR_BODY[mono], buff);
288
      video_putstring(9, 2, COLOR_BODY[mono], buff);
289
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
289
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
290
      return(-1);
290
      return(-1);
291
    }
291
    }
292
    /* if not formatted, propose to format it right away (try to create a directory) */
292
    /* if not formatted, propose to format it right away (try to create a directory) */
293
    sprintf(buff, "%c:\\SVWRTEST.123", cselecteddrive);
293
    snprintf(buff, sizeof(buff), "%c:\\SVWRTEST.123", cselecteddrive);
294
    if (mkdir(buff) == 0) {
294
    if (mkdir(buff) == 0) {
295
      rmdir(buff);
295
      rmdir(buff);
296
    } else {
296
    } else {
297
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
297
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
298
      list[0] = kittengets(0, 6, list[0]);
298
      list[0] = kittengets(0, 6, list[0]);
299
      list[1] = kittengets(0, 2, list[1]);
299
      list[1] = kittengets(0, 2, list[1]);
300
      sprintf(buff, kittengets(3, 10, "ERROR: Drive %c: seems to be unformated."), cselecteddrive);
300
      snprintf(buff, sizeof(buff), kittengets(3, 10, "ERROR: Drive %c: seems to be unformated."), cselecteddrive);
301
      video_putstring(7, 2, COLOR_BODY[mono], buff);
301
      video_putstring(7, 2, COLOR_BODY[mono], buff);
302
      putstringnls(8, 2, COLOR_BODY[mono], 3, 11, "       Do you wish to format it?");
302
      putstringnls(8, 2, COLOR_BODY[mono], 3, 11, "       Do you wish to format it?");
303
      if (menuselect(12, -1, 4, list) != 0) return(-1);
303
      if (menuselect(12, -1, 4, list) != 0) return(-1);
304
      video_clear(0x0700, 0);
304
      video_clear(0x0700, 0);
305
      video_movecursor(0, 0);
305
      video_movecursor(0, 0);
306
      sprintf(buff, "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
306
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
307
      system(buff);
307
      system(buff);
308
      continue;
308
      continue;
309
    }
309
    }
310
    /* check total disk space */
310
    /* check total disk space */
311
    ds = disksize(selecteddrive);
311
    ds = disksize(selecteddrive);
312
    if (ds < SVAROG_DISK_REQ) {
312
    if (ds < SVAROG_DISK_REQ) {
313
      sprintf(buff, kittengets(3, 12, "ERROR: Drive %c: is not big enough!"), cselecteddrive);
313
      snprintf(buff, sizeof(buff), kittengets(3, 12, "ERROR: Drive %c: is not big enough!"), cselecteddrive);
314
      video_putstring(9, 2, COLOR_BODY[mono], buff);
314
      video_putstring(9, 2, COLOR_BODY[mono], buff);
315
      sprintf(buff, kittengets(3, 13, "      Svarog386 requires a disk of at least %d MiB."), SVAROG_DISK_REQ);
315
      snprintf(buff, sizeof(buff), kittengets(3, 13, "      Svarog386 requires a disk of at least %d MiB."), SVAROG_DISK_REQ);
316
      video_putstring(10, 2, COLOR_BODY[mono], buff);
316
      video_putstring(10, 2, COLOR_BODY[mono], buff);
317
      putstringnls(12, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
317
      putstringnls(12, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
318
      input_getkey();
318
      input_getkey();
319
      return(-1);
319
      return(-1);
320
    }
320
    }
321
    /* is the disk empty? */
321
    /* is the disk empty? */
322
    if (diskempty(selecteddrive) != 0) {
322
    if (diskempty(selecteddrive) != 0) {
323
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
323
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
324
      list[0] = kittengets(0, 6, list[0]);
324
      list[0] = kittengets(0, 6, list[0]);
325
      list[1] = kittengets(0, 2, list[1]);
325
      list[1] = kittengets(0, 2, list[1]);
326
      sprintf(buff, kittengets(3, 14, "ERROR: Drive %c: is not empty. Svarog386 must be installed on an empty disk."), cselecteddrive);
326
      snprintf(buff, sizeof(buff), kittengets(3, 14, "ERROR: Drive %c: is not empty. Svarog386 must be installed on an empty disk."), cselecteddrive);
327
      video_putstring(7, 2, COLOR_BODY[mono], buff);
327
      video_putstring(7, 2, COLOR_BODY[mono], buff);
328
      putstringnls(8, 2, COLOR_BODY[mono], 3, 15, "       You can format the disk now, to make it empty. Note however, that");
328
      putstringnls(8, 2, COLOR_BODY[mono], 3, 15, "       You can format the disk now, to make it empty. Note however, that");
329
      putstringnls(9, 2, COLOR_BODY[mono], 3, 16, "       this will ERASE ALL CURRENT DATA on your disk.");
329
      putstringnls(9, 2, COLOR_BODY[mono], 3, 16, "       this will ERASE ALL CURRENT DATA on your disk.");
330
      if (menuselect(12, -1, 4, list) != 0) return(-1);
330
      if (menuselect(12, -1, 4, list) != 0) return(-1);
331
      video_clear(0x0700, 0);
331
      video_clear(0x0700, 0);
332
      video_movecursor(0, 0);
332
      video_movecursor(0, 0);
333
      sprintf(buff, "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
333
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
334
      system(buff);
334
      system(buff);
335
      continue;
335
      continue;
336
    } else {
336
    } else {
337
      /* final confirmation */
337
      /* final confirmation */
338
      char *list[] = { "Install Svarog386", "Quit to DOS", NULL};
338
      char *list[] = { "Install Svarog386", "Quit to DOS", NULL};
339
      list[0] = kittengets(0, 1, list[0]);
339
      list[0] = kittengets(0, 1, list[0]);
340
      list[1] = kittengets(0, 2, list[1]);
340
      list[1] = kittengets(0, 2, list[1]);
341
      sprintf(buff, kittengets(3, 17, "The installation of Svarog386 to %c: is about to begin."), cselecteddrive);
341
      snprintf(buff, sizeof(buff), kittengets(3, 17, "The installation of Svarog386 to %c: is about to begin."), cselecteddrive);
342
      video_putstring(7, -1, COLOR_BODY[mono], buff);
342
      video_putstring(7, -1, COLOR_BODY[mono], buff);
343
      if (menuselect(10, -1, 4, list) != 0) return(-1);
343
      if (menuselect(10, -1, 4, list) != 0) return(-1);
344
      sprintf(buff, "SYS A: %c:", cselecteddrive);
344
      snprintf(buff, sizeof(buff), "SYS A: %c:", cselecteddrive);
345
      system(buff);
345
      system(buff);
346
      sprintf(buff, "%c:\\TEMP", cselecteddrive);
346
      snprintf(buff, sizeof(buff), "%c:\\TEMP", cselecteddrive);
347
      mkdir(buff);
347
      mkdir(buff);
348
      return(cselecteddrive);
348
      return(cselecteddrive);
349
    }
349
    }
350
  }
350
  }
351
}
351
}
Line 379... Line 379...
379
  char buff[128];
379
  char buff[128];
380
  int cp, egafile;
380
  int cp, egafile;
381
  FILE *fd;
381
  FILE *fd;
382
  cp = getnlscp(lang, &egafile);
382
  cp = getnlscp(lang, &egafile);
383
  /*** CONFIG.SYS ***/
383
  /*** CONFIG.SYS ***/
384
  sprintf(buff, "%c:\\CONFIG.SYS", targetdrv);
384
  snprintf(buff, sizeof(buff), "%c:\\CONFIG.SYS", targetdrv);
385
  fd = fopen(buff, "wb");
385
  fd = fopen(buff, "wb");
386
  if (fd == NULL) return;
386
  if (fd == NULL) return;
387
  fprintf(fd, "DOS=UMB,HIGH\r\n");
387
  fprintf(fd, "DOS=UMB,HIGH\r\n");
388
  fprintf(fd, "FILES=50\r\n");
388
  fprintf(fd, "FILES=50\r\n");
389
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\HIMEMX.EXE\r\n", targetdrv);
389
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\HIMEMX.EXE\r\n", targetdrv);
390
  fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVAROG.386\\BIN\\COMMAND.COM /E:512 /P\r\n", targetdrv);
390
  fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVAROG.386\\BIN\\COMMAND.COM /E:512 /P\r\n", targetdrv);
391
  if (egafile > 0) fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\DISPLAY.SYS\r\n", targetdrv);
-
 
392
  fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\CONF\\COUNTRY.SYS\r\n", targetdrv);
391
  fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\CONF\\COUNTRY.SYS\r\n", targetdrv);
393
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\DRIVERS\\UDVD2\\UDVD2.SYS /D:SVCD0001 /H\r\n", targetdrv);
392
  fprintf(fd, "DEVICE=%c:\\SYSTEM\\DRIVERS\\UDVD2\\UDVD2.SYS /D:SVCD0001 /H\r\n", targetdrv);
394
  fclose(fd);
393
  fclose(fd);
395
  /*** AUTOEXEC.BAT ***/
394
  /*** AUTOEXEC.BAT ***/
396
  sprintf(buff, "%c:\\AUTOEXEC.BAT", targetdrv);
395
  snprintf(buff, sizeof(buff), "%c:\\AUTOEXEC.BAT", targetdrv);
397
  fd = fopen(buff, "wb");
396
  fd = fopen(buff, "wb");
398
  if (fd == NULL) return;
397
  if (fd == NULL) return;
399
  fprintf(fd, "@ECHO OFF\r\n");
398
  fprintf(fd, "@ECHO OFF\r\n");
400
  fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", targetdrv);
399
  fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", targetdrv);
401
  fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
400
  fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
Line 408... Line 407...
408
  fprintf(fd, "PROMPT $P$G\r\n");
407
  fprintf(fd, "PROMPT $P$G\r\n");
409
  fprintf(fd, "ALIAS REBOOT=FDAPM COLDBOOT\r\n");
408
  fprintf(fd, "ALIAS REBOOT=FDAPM COLDBOOT\r\n");
410
  fprintf(fd, "ALIAS HALT=FDAPM POWEROFF\r\n");
409
  fprintf(fd, "ALIAS HALT=FDAPM POWEROFF\r\n");
411
  fprintf(fd, "\r\n");
410
  fprintf(fd, "\r\n");
412
  if (egafile > 0) {
411
  if (egafile > 0) {
-
 
412
    fprintf(fd, "DISPLAY CON=(EGA,,1)\r\n");
413
    if (egafile == 1) {
413
    if (egafile == 1) {
414
      fprintf(fd, "MODE CON CP PREPARE=((%d) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA.CPX)\r\n", cp, targetdrv);
414
      fprintf(fd, "MODE CON CP PREPARE=((%d) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA.CPX)\r\n", cp, targetdrv);
415
    } else {
415
    } else {
416
      fprintf(fd, "MODE CON CP PREPARE=((%d) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA%d.CPX)\r\n", cp, targetdrv, egafile);
416
      fprintf(fd, "MODE CON CP PREPARE=((%d) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA%d.CPX)\r\n", cp, targetdrv, egafile);
417
    }
417
    }
Line 422... Line 422...
422
  fprintf(fd, "\r\n");
422
  fprintf(fd, "\r\n");
423
  fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
423
  fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
424
  fprintf(fd, "REM CTMOUSE\r\n");
424
  fprintf(fd, "REM CTMOUSE\r\n");
425
  fprintf(fd, "\r\n");
425
  fprintf(fd, "\r\n");
426
  fprintf(fd, "ECHO.\r\n");
426
  fprintf(fd, "ECHO.\r\n");
427
  fprintf(fd, "ECHO Welcome to Svarog386! Type 'HELP' if your need help.\r\n");
427
  fprintf(fd, "ECHO Welcome to Svarog386! Type 'HELP' if you need help.\r\n");
428
  fclose(fd);
428
  fclose(fd);
429
  /*** CREATE DIRECTORY FOR OTHER CONFIGURATION FILES ***/
429
  /*** CREATE DIRECTORY FOR OTHER CONFIGURATION FILES ***/
430
  snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\CFG", targetdrv);
430
  snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\CFG", targetdrv);
431
  mkdir(buff);
431
  mkdir(buff);
432
  /*** FDNPKG.CFG ***/
432
  /*** FDNPKG.CFG ***/
Line 438... Line 438...
438
}
438
}
439
 
439
 
440
 
440
 
441
static void installpackages(int targetdrv, int cdromdrv) {
441
static void installpackages(int targetdrv, int cdromdrv) {
442
  char *pkglist[] = {
442
  char *pkglist[] = {
-
 
443
    "A:\\UDVD2", /* this one's not part of CORE, hence it's stored right on the floppy */
443
    "APPEND",
444
    "APPEND",
444
    "ASSIGN",
445
    "ASSIGN",
445
    "ATTRIB",
446
    "ATTRIB",
446
    "CHKDSK",
447
    "CHKDSK",
447
    "CHOICE",
448
    "CHOICE",
Line 506... Line 507...
506
  for (i = 0; pkglist[i] != NULL; i++) {
507
  for (i = 0; pkglist[i] != NULL; i++) {
507
    char buff[128];
508
    char buff[128];
508
    snprintf(buff, sizeof(buff), kittengets(4, 0, "Installing package %d/%d: %s"), i+1, pkglistlen, pkglist[i]);
509
    snprintf(buff, sizeof(buff), kittengets(4, 0, "Installing package %d/%d: %s"), i+1, pkglistlen, pkglist[i]);
509
    strcat(buff, "       ");
510
    strcat(buff, "       ");
510
    video_putstring(10, 2, COLOR_BODY[mono], buff);
511
    video_putstring(10, 2, COLOR_BODY[mono], buff);
-
 
512
    if (pkglist[i][1] == ':') {
-
 
513
      snprintf(buff, sizeof(buff), "FDINST INSTALL %s.ZIP > NUL", pkglist[i]);
-
 
514
    } else {
511
    sprintf(buff, "FDINST INSTALL %c:\\CORE\\%s.ZIP > NUL", cdromdrv, pkglist[i]);
515
      snprintf(buff, sizeof(buff), "FDINST INSTALL %c:\\CORE\\%s.ZIP > NUL", cdromdrv, pkglist[i]);
-
 
516
    }
512
    system(buff);
517
    system(buff);
513
  }
518
  }
514
}
519
}
515
 
520
 
516
 
521
 
Line 529... Line 534...
529
  char buff[64];
534
  char buff[64];
530
  cp = getnlscp(lang, &egafile);
535
  cp = getnlscp(lang, &egafile);
531
  if (cp == 437) return;
536
  if (cp == 437) return;
532
  video_movecursor(1, 0);
537
  video_movecursor(1, 0);
533
  if (egafile == 1) {
538
  if (egafile == 1) {
534
    sprintf(buff, "MODE CON CP PREP=((%d) A:\\EGA.CPX)", cp);
539
    snprintf(buff, sizeof(buff), "MODE CON CP PREP=((%d) A:\\EGA.CPX)", cp);
535
  } else {
540
  } else {
536
    sprintf(buff, "MODE CON CP PREP=((%d) A:\\EGA%d.CPX)", cp, egafile);
541
    snprintf(buff, sizeof(buff), "MODE CON CP PREP=((%d) A:\\EGA%d.CPX)", cp, egafile);
537
  }
542
  }
538
  system(buff);
543
  system(buff);
539
  sprintf(buff, "MODE CON CP SEL=%d", cp);
544
  snprintf(buff, sizeof(buff), "MODE CON CP SEL=%d", cp);
540
  system(buff);
545
  system(buff);
541
  /* below I re-init the video controller - apparently this is required if
546
  /* below I re-init the video controller - apparently this is required if
542
   * I want the new glyph symbols to be actually applied */
547
   * I want the new glyph symbols to be actually applied */
543
  {
548
  {
544
  union REGS r;
549
  union REGS r;