Subversion Repositories SvarDOS

Rev

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

Rev 1661 Rev 1662
Line 31... Line 31...
31
#include <stdio.h>   /* printf() and friends */
31
#include <stdio.h>   /* printf() and friends */
32
#include <stdlib.h>  /* system() */
32
#include <stdlib.h>  /* system() */
33
#include <string.h>  /* memcpy() */
33
#include <string.h>  /* memcpy() */
34
#include <unistd.h>
34
#include <unistd.h>
35
 
35
 
-
 
36
#include "mdr\cout.h"
36
#include "mdr\dos.h"
37
#include "mdr\dos.h"
37
#include "svarlang.lib\svarlang.h"
38
#include "svarlang.lib\svarlang.h"
38
 
39
 
39
#include "video.h"
-
 
40
 
-
 
41
/* keyboard layouts and locales */
40
/* keyboard layouts and locales */
42
#include "keylay.h"
41
#include "keylay.h"
43
#include "keyoff.h"
42
#include "keyoff.h"
44
 
43
 
45
/* prototype of the int24hdl() function defined in int24hdl.asm */
44
/* prototype of the int24hdl() function defined in int24hdl.asm */
46
void int24hdl(void);
45
void int24hdl(void);
47
 
46
 
48
 
47
 
49
/* color scheme (color, mono) */
48
/* color scheme (color, mono) */
50
static unsigned short COLOR_TITLEBAR[2] = {0x7000,0x7000};
49
static unsigned char COLOR_TITLEBAR[2] = {0x70,0x70};
51
static unsigned short COLOR_BODY[2] = {0x1700,0x0700};
50
static unsigned char COLOR_BODY[2] = {0x07,0x17};
52
static unsigned short COLOR_SELECT[2] = {0x7000,0x7000};
51
static unsigned char COLOR_SELECT[2] = {0x70,0x70};
53
static unsigned short COLOR_SELECTCUR[2] = {0x1F00,0x0700};
52
static unsigned char COLOR_SELECTCUR[2] = {0x07,0x1F};
54
 
53
 
55
/* mono flag */
54
/* mono flag (0=mono 1=color) */
56
static int mono = 0;
55
static unsigned char mono = 0;
57
 
56
 
58
/* how much disk space does SvarDOS require (in MiB) */
57
/* how much disk space does SvarDOS require (in MiB) */
59
#define SVARDOS_DISK_REQ 8
58
#define SVARDOS_DISK_REQ 8
60
 
59
 
61
/* menu screens can output only one of these: */
60
/* menu screens can output only one of these: */
Line 76... Line 75...
76
  int keyblen;
75
  int keyblen;
77
  unsigned int keybid;
76
  unsigned int keybid;
78
};
77
};
79
 
78
 
80
 
79
 
-
 
80
/* put a string on screen and fill it until w chars with whilte space */
-
 
81
static void video_putstringfix(unsigned char y, unsigned char x, unsigned char attr, const char *s, unsigned char w) {
-
 
82
  unsigned char i;
-
 
83
 
-
 
84
  /* print the string up to w characters */
-
 
85
  i = mdr_cout_str(y, x, s, attr, w);
-
 
86
 
-
 
87
  /* fill in left space (if any) with blanks */
-
 
88
  mdr_cout_char_rep(y, x + i, ' ', attr, w - i);
-
 
89
}
-
 
90
 
-
 
91
 
81
/* reboot the computer */
92
/* reboot the computer */
82
static void reboot(void) {
93
static void reboot(void) {
83
  void ((far *bootroutine)()) = (void (far *)()) 0xFFFF0000L;
94
  void ((far *bootroutine)()) = (void (far *)()) 0xFFFF0000L;
84
  int far *rstaddr = (int far *)0x00400072L; /* BIOS boot flag is at 0040:0072 */
95
  int far *rstaddr = (int far *)0x00400072L; /* BIOS boot flag is at 0040:0072 */
85
  *rstaddr = 0x1234; /* 0x1234 = warm boot, 0 = cold boot */
96
  *rstaddr = 0x1234; /* 0x1234 = warm boot, 0 = cold boot */
86
  (*bootroutine)(); /* jump to the BIOS reboot routine at FFFF:0000 */
97
  (*bootroutine)(); /* jump to the BIOS reboot routine at FFFF:0000 */
87
}
98
}
88
 
99
 
89
 
100
 
90
/* outputs a string to screen with taking care of word wrapping. returns amount of lines. */
101
/* outputs a string to screen with taking care of word wrapping. returns amount of lines. */
91
static int putstringwrap(int y, int x, unsigned short attr, const char *s) {
102
static unsigned char putstringwrap(unsigned char y, unsigned char x, unsigned char attr, const char *s) {
92
  int linew, lincount;
103
  unsigned char linew, lincount;
93
  linew = 80;
-
 
94
  if (x >= 0) linew -= (x << 1);
104
  linew = 80 - (x << 1);
95
 
105
 
96
  for (lincount = 1; y+lincount < 25; lincount++) {
106
  for (lincount = 1; y+lincount < 25; lincount++) {
97
    int i, len = linew;
107
    int i, len = linew;
98
    for (i = 0; i <= linew; i++) {
108
    for (i = 0; i <= linew; i++) {
99
      if (s[i] == ' ') len = i;
109
      if (s[i] == ' ') len = i;
Line 104... Line 114...
104
      if (s[i] == 0) {
114
      if (s[i] == 0) {
105
        len = i;
115
        len = i;
106
        break;
116
        break;
107
      }
117
      }
108
    }
118
    }
109
    video_putstring(y++, x, attr, s, len);
119
    mdr_cout_str(y++, x, s, attr, len);
110
    s += len;
120
    s += len;
111
    if (*s == 0) break;
121
    if (*s == 0) break;
112
    s += 1; /* skip the whitespace char */
122
    s += 1; /* skip the whitespace char */
113
  }
123
  }
114
  return(lincount);
124
  return(lincount);
115
}
125
}
116
 
126
 
117
 
127
 
118
/* an NLS wrapper around video_putstring(), also performs line wrapping when
128
/* an NLS wrapper around video_putstring(), also performs line wrapping when
119
 * needed. returns the amount of lines that were output */
129
 * needed. returns the amount of lines that were output */
120
static int putstringnls(int y, int x, unsigned short attr, int nlsmaj, int nlsmin) {
130
static unsigned char putstringnls(unsigned char y, unsigned char x, unsigned char attr, unsigned char nlsmaj, unsigned char nlsmin) {
121
  const char *s = svarlang_str(nlsmaj, nlsmin);
131
  const char *s = svarlang_str(nlsmaj, nlsmin);
122
  if (s == NULL) s = "";
132
  if (s == NULL) s = "";
123
  return(putstringwrap(y, x, attr, s));
133
  return(putstringwrap(y, x, attr, s));
124
}
134
}
125
 
135
 
Line 153... Line 163...
153
  if (fd2 != NULL) fclose(fd2);
163
  if (fd2 != NULL) fclose(fd2);
154
  return(res);
164
  return(res);
155
}
165
}
156
 
166
 
157
 
167
 
158
static int menuselect(int ypos, int xpos, int height, const char **list, int listlen) {
168
static int menuselect(unsigned char ypos, int xpos, unsigned char height, const char **list, int listlen) {
159
  int i, offset = 0, res = 0, count, width = 0;
169
  int i, offset = 0, res = 0, count, width = 0;
-
 
170
  unsigned char y;
-
 
171
 
160
  /* count how many positions there is, and check their width */
172
  /* count how many positions there is, and check their width */
161
  for (count = 0; (list[count] != NULL) && (count != listlen); count++) {
173
  for (count = 0; (list[count] != NULL) && (count != listlen); count++) {
162
    int len = strlen(list[count]);
174
    int len = strlen(list[count]);
163
    if (len > width) width = len;
175
    if (len > width) width = len;
164
  }
176
  }
165
 
177
 
166
  /* if xpos negative, means 'center out' */
178
  /* if xpos negative, means 'center out' */
167
  if (xpos < 0) xpos = 39 - (width >> 1);
179
  if (xpos < 0) xpos = 39 - (width >> 1);
168
 
180
 
169
  video_putchar(ypos, xpos+width+2, COLOR_SELECT[mono], 0xBF);         /*       \ */
181
  mdr_cout_char(ypos, xpos+width+2, 0xBF, COLOR_SELECT[mono]);         /*       \ */
170
  video_putchar(ypos, xpos-1, COLOR_SELECT[mono], 0xDA);               /*  /      */
182
  mdr_cout_char(ypos, xpos-1, 0xDA, COLOR_SELECT[mono]);               /*  /      */
171
  video_putchar(ypos+height-1, xpos-1, COLOR_SELECT[mono], 0xC0);      /*  \      */
183
  mdr_cout_char(ypos+height-1, xpos-1, 0xC0, COLOR_SELECT[mono]);      /*  \      */
172
  video_putchar(ypos+height-1, xpos+width+2, COLOR_SELECT[mono], 0xD9);/*      /  */
184
  mdr_cout_char(ypos+height-1, xpos+width+2, 0xD9, COLOR_SELECT[mono]);/*      /  */
173
  video_putcharmulti(ypos, xpos, COLOR_SELECT[mono], 0xC4, width + 2, 1);
185
  mdr_cout_char_rep(ypos, xpos, 0xC4, COLOR_SELECT[mono], width + 2);
174
  video_putcharmulti(ypos+height-1, xpos, COLOR_SELECT[mono], 0xC4, width + 2, 1);
186
  mdr_cout_char_rep(ypos+height-1, xpos, 0xC4, COLOR_SELECT[mono], width + 2);
-
 
187
 
-
 
188
  for (y = ypos + 1; y < (ypos + height - 1); y++) {
175
  video_putcharmulti(ypos+1, xpos-1, COLOR_SELECT[mono], 0xB3, height - 2, 80);
189
    mdr_cout_char(y, xpos-1, 0xB3, COLOR_SELECT[mono]);
176
  video_putcharmulti(ypos+1, xpos+width+2, COLOR_SELECT[mono], 0xB3, height - 2, 80);
190
    mdr_cout_char(y, xpos+width+2, 0xB3, COLOR_SELECT[mono]);
-
 
191
  }
177
 
192
 
178
  for (;;) {
193
  for (;;) {
179
    int key;
194
    int key;
180
    /* list of selectable items */
195
    /* list of selectable items */
181
    for (i = 0; i < height - 2; i++) {
196
    for (i = 0; i < height - 2; i++) {
182
      if (i + offset == res) {
197
      if (i + offset == res) {
183
        video_putchar(ypos + 1 + i, xpos, COLOR_SELECTCUR[mono], 16);
198
        mdr_cout_char(ypos + 1 + i, xpos, 16, COLOR_SELECTCUR[mono]);
184
        video_putchar(ypos + 1 + i, xpos+width+1, COLOR_SELECTCUR[mono], 17);
199
        mdr_cout_char(ypos + 1 + i, xpos+width+1, 17, COLOR_SELECTCUR[mono]);
185
        video_movecursor(ypos + 1 + i, xpos);
200
        mdr_cout_locate(ypos + 1 + i, xpos);
186
        video_putstringfix(ypos + 1 + i, xpos+1, COLOR_SELECTCUR[mono], list[i + offset], width);
201
        video_putstringfix(ypos + 1 + i, xpos+1, COLOR_SELECTCUR[mono], list[i + offset], width);
187
      } else if (i + offset < count) {
202
      } else if (i + offset < count) {
188
        video_putchar(ypos + 1 + i, xpos, COLOR_SELECT[mono], ' ');
203
        mdr_cout_char(ypos + 1 + i, xpos, ' ', COLOR_SELECT[mono]);
189
        video_putchar(ypos + 1 + i, xpos+width+1, COLOR_SELECT[mono], ' ');
204
        mdr_cout_char(ypos + 1 + i, xpos+width+1, ' ', COLOR_SELECT[mono]);
190
        video_putstringfix(ypos + 1 + i, xpos+1, COLOR_SELECT[mono], list[i + offset], width);
205
        video_putstringfix(ypos + 1 + i, xpos+1, COLOR_SELECT[mono], list[i + offset], width);
191
      } else {
206
      } else {
192
        video_putcharmulti(ypos + 1 + i, xpos, COLOR_SELECT[mono], ' ', width+2, 1);
207
        mdr_cout_char_rep(ypos + 1 + i, xpos, ' ', COLOR_SELECT[mono], width+2);
193
      }
208
      }
194
    }
209
    }
195
    key = mdr_dos_getkey();
210
    key = mdr_dos_getkey();
196
    if (key == 0x0D) { /* ENTER */
211
    if (key == 0x0D) { /* ENTER */
197
      return(res);
212
      return(res);
Line 219... Line 234...
219
      video_putstring(1, 0, COLOR_BODY[mono], buf, -1);
234
      video_putstring(1, 0, COLOR_BODY[mono], buf, -1);
220
    }*/
235
    }*/
221
  }
236
  }
222
}
237
}
223
 
238
 
224
static void newscreen(int statusbartype) {
239
static void newscreen(unsigned char statusbartype) {
225
  const char *msg;
240
  const char *msg;
-
 
241
  mdr_cout_cls(COLOR_BODY[mono]);
226
  msg = svarlang_strid(0x00); /* "SVARDOS INSTALLATION" */
242
  msg = svarlang_strid(0x00); /* "SVARDOS INSTALLATION" */
227
  video_putcharmulti(0, 0, COLOR_TITLEBAR[mono], ' ', 80, 1);
243
  mdr_cout_char_rep(0, 0, ' ', COLOR_TITLEBAR[mono], 80);
228
  video_putstring(0, 40 - (strlen(msg) >> 1), COLOR_TITLEBAR[mono], msg, -1);
244
  mdr_cout_str(0, 40 - (strlen(msg) >> 1), msg, COLOR_TITLEBAR[mono], 80);
229
  video_clear(COLOR_BODY[mono], 80, -80);
-
 
230
  switch (statusbartype) {
245
  switch (statusbartype) {
231
    case 1:
246
    case 1:
232
      msg = svarlang_strid(0x000B); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Quit to DOS" */
247
      msg = svarlang_strid(0x000B); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Quit to DOS" */
233
      break;
248
      break;
234
    case 2:
249
    case 2:
Line 239... Line 254...
239
      break;
254
      break;
240
    default:
255
    default:
241
      msg = svarlang_strid(0x000A); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Previous screen" */
256
      msg = svarlang_strid(0x000A); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Previous screen" */
242
      break;
257
      break;
243
  }
258
  }
244
  video_putchar(24, 0, COLOR_TITLEBAR[mono], ' ');
259
  mdr_cout_char(24, 0, ' ', COLOR_TITLEBAR[mono]);
245
  video_putstringfix(24, 1, COLOR_TITLEBAR[mono], msg, 79);
260
  video_putstringfix(24, 1, COLOR_TITLEBAR[mono], msg, 79);
246
  video_movecursor(25,0);
261
  mdr_cout_locate(25,0);
247
}
262
}
248
 
263
 
249
/* fills a slocales struct accordingly to the value of its keyboff member */
264
/* fills a slocales struct accordingly to the value of its keyboff member */
250
static void kblay2slocal(struct slocales *locales) {
265
static void kblay2slocal(struct slocales *locales) {
251
  const char *m;
266
  const char *m;
Line 279... Line 294...
279
  };
294
  };
280
 
295
 
281
  newscreen(1);
296
  newscreen(1);
282
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
297
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
283
  x = 40 - (strlen(msg) >> 1);
298
  x = 40 - (strlen(msg) >> 1);
284
  video_putstring(4, x, COLOR_BODY[mono], msg, -1);
299
  mdr_cout_str(4, x, msg, COLOR_BODY[mono], 80);
285
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
300
  mdr_cout_char_rep(5, x, '=', COLOR_BODY[mono], strlen(msg));
-
 
301
 
-
 
302
  /* center out the string "Please select your language..." */
286
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1); /* "Please select your language from the list below:" */
303
  msg = svarlang_str(1, 1); /* "Please select your language from the list below:" */
-
 
304
  if (strlen(msg) > 74) {
-
 
305
    putstringwrap(8, 1, COLOR_BODY[mono], msg);
-
 
306
  } else {
-
 
307
    mdr_cout_str(8, 40 - (strlen(msg) / 2), msg, COLOR_BODY[mono], 80);
-
 
308
  }
-
 
309
 
287
  choice = menuselect(11, -1, 11, langlist, -1);
310
  choice = menuselect(11, -1, 11, langlist, -1);
288
  if (choice < 0) return(MENUPREV);
311
  if (choice < 0) return(MENUPREV);
289
  /* populate locales with default values */
312
  /* populate locales with default values */
290
  memset(locales, 0, sizeof(struct slocales));
313
  memset(locales, 0, sizeof(struct slocales));
291
  switch (choice) {
314
  switch (choice) {
Line 530... Line 553...
530
        case 0:
553
        case 0:
531
          sprintf(buff, "FDISK /PRI:MAX %d", driveid);
554
          sprintf(buff, "FDISK /PRI:MAX %d", driveid);
532
          system(buff);
555
          system(buff);
533
          break;
556
          break;
534
        case 1:
557
        case 1:
535
          video_clear(0x0700, 0, 0);
558
          mdr_cout_cls(0x07);
536
          video_movecursor(0, 0);
559
          mdr_cout_locate(0, 0);
537
          sprintf(buff, "FDISK %d", driveid);
560
          sprintf(buff, "FDISK %d", driveid);
538
          system(buff);
561
          system(buff);
539
          break;
562
          break;
540
        case 2:
563
        case 2:
541
          return(MENUQUIT);
564
          return(MENUQUIT);
Line 553... Line 576...
553
      reboot();
576
      reboot();
554
      return(MENUQUIT);
577
      return(MENUQUIT);
555
    } else if (driveremovable > 0) {
578
    } else if (driveremovable > 0) {
556
      newscreen(2);
579
      newscreen(2);
557
      snprintf(buff, sizeof(buff), svarlang_strid(0x0302), cselecteddrive); /* "ERROR: Drive %c: is a removable device */
580
      snprintf(buff, sizeof(buff), svarlang_strid(0x0302), cselecteddrive); /* "ERROR: Drive %c: is a removable device */
558
      video_putstring(9, 1, COLOR_BODY[mono], buff, -1);
581
      mdr_cout_str(9, 1, buff, COLOR_BODY[mono], 80);
559
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
582
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
560
      return(MENUQUIT);
583
      return(MENUQUIT);
561
    }
584
    }
562
    /* if not formatted, propose to format it right away (try to create a directory) */
585
    /* if not formatted, propose to format it right away (try to create a directory) */
563
    if (test_drive_write(cselecteddrive, buff) != 0) {
586
    if (test_drive_write(cselecteddrive, buff) != 0) {
564
      const char *list[3];
587
      const char *list[3];
565
      newscreen(0);
588
      newscreen(0);
566
      snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
589
      snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
567
      video_putstring(7, 1, COLOR_BODY[mono], buff, -1);
590
      mdr_cout_str(7, 1, buff, COLOR_BODY[mono], 80);
568
 
591
 
569
      snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
592
      snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
570
      list[0] = buff;
593
      list[0] = buff;
571
      list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
594
      list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
572
      list[2] = NULL;
595
      list[2] = NULL;
573
 
596
 
574
      choice = menuselect(12, -1, 4, list, -1);
597
      choice = menuselect(12, -1, 4, list, -1);
575
      if (choice < 0) return(MENUPREV);
598
      if (choice < 0) return(MENUPREV);
576
      if (choice == 1) return(MENUQUIT);
599
      if (choice == 1) return(MENUQUIT);
577
      video_clear(0x0700, 0, 0);
600
      mdr_cout_cls(0x07);
578
      video_movecursor(0, 0);
601
      mdr_cout_locate(0, 0);
579
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
602
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
580
      system(buff);
603
      system(buff);
581
      continue;
604
      continue;
582
    }
605
    }
583
    /* check total disk space */
606
    /* check total disk space */
Line 605... Line 628...
605
      list[2] = NULL;
628
      list[2] = NULL;
606
 
629
 
607
      choice = menuselect(++y, -1, 4, list, -1);
630
      choice = menuselect(++y, -1, 4, list, -1);
608
      if (choice < 0) return(MENUPREV);
631
      if (choice < 0) return(MENUPREV);
609
      if (choice == 1) return(MENUQUIT);
632
      if (choice == 1) return(MENUQUIT);
610
      video_clear(0x0700, 0, 0);
633
      mdr_cout_cls(0x07);
611
      video_movecursor(0, 0);
634
      mdr_cout_locate(0, 0);
612
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
635
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
613
      system(buff);
636
      system(buff);
614
      continue;
637
      continue;
615
    } else {
638
    } else {
616
      /* final confirmation */
639
      /* final confirmation */
617
      const char *list[3];
640
      const char *list[3];
618
      list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
641
      list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
619
      list[1] = svarlang_strid(0x0002); /* Quit to DOS */
642
      list[1] = svarlang_strid(0x0002); /* Quit to DOS */
620
      list[2] = NULL;
643
      list[2] = NULL;
621
      snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
644
      snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
622
      video_putstring(7, -1, COLOR_BODY[mono], buff, -1);
645
      mdr_cout_str(7, 40 - strlen(buff), buff, COLOR_BODY[mono], 80);
623
      choice = menuselect(10, -1, 4, list, -1);
646
      choice = menuselect(10, -1, 4, list, -1);
624
      if (choice < 0) return(MENUPREV);
647
      if (choice < 0) return(MENUPREV);
625
      if (choice == 1) return(MENUQUIT);
648
      if (choice == 1) return(MENUQUIT);
626
      snprintf(buff, sizeof(buff), "SYS %c: %c: > NUL", sourcedrv, cselecteddrive);
649
      snprintf(buff, sizeof(buff), "SYS %c: %c: > NUL", sourcedrv, cselecteddrive);
627
      system(buff);
650
      system(buff);
Line 753... Line 776...
753
  char *pkgptr;
776
  char *pkgptr;
754
  newscreen(3);
777
  newscreen(3);
755
  /* load pkg list */
778
  /* load pkg list */
756
  fd = fopen("install.lst", "rb");
779
  fd = fopen("install.lst", "rb");
757
  if (fd == NULL) {
780
  if (fd == NULL) {
758
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST NOT FOUND", -1);
781
    mdr_cout_str(10, 30, "ERROR: INSTALL.LST NOT FOUND", COLOR_BODY[mono], 80);
759
    mdr_dos_getkey();
782
    mdr_dos_getkey();
760
    return(-1);
783
    return(-1);
761
  }
784
  }
762
  pkglistflen = fread(pkglist, 1, sizeof(pkglist) - 2, fd);
785
  pkglistflen = fread(pkglist, 1, sizeof(pkglist) - 2, fd);
763
  fclose(fd);
786
  fclose(fd);
764
  if (pkglistflen == sizeof(pkglist) - 2) {
787
  if (pkglistflen == sizeof(pkglist) - 2) {
765
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST TOO LARGE", -1);
788
    mdr_cout_str(10, 30, "ERROR: INSTALL.LST TOO LARGE", COLOR_BODY[mono], 80);
766
    mdr_dos_getkey();
789
    mdr_dos_getkey();
767
    return(-1);
790
    return(-1);
768
  }
791
  }
769
  /* mark the end of list */
792
  /* mark the end of list */
770
  pkglist[pkglistflen] = 0;
793
  pkglist[pkglistflen] = 0;
Line 822... Line 845...
822
    }
845
    }
823
 
846
 
824
    /* install the package */
847
    /* install the package */
825
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Installing package %d/%d: %s" */
848
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Installing package %d/%d: %s" */
826
    strcat(buff, "       ");
849
    strcat(buff, "       ");
827
    video_putstringfix(10, 1, COLOR_BODY[mono], buff, sizeof(buff));
850
    mdr_cout_str(10, 1, buff, COLOR_BODY[mono], 40);
828
 
851
 
829
    /* proceed with package copy */
852
    /* proceed with package copy */
830
    sprintf(buff, "%c:\\temp\\%s.svp", targetdrv, pkgptr);
853
    sprintf(buff, "%c:\\temp\\%s.svp", targetdrv, pkgptr);
831
    if (fcopy(buff, buff + 7, buff, sizeof(buff)) != 0) {
854
    if (fcopy(buff, buff + 7, buff, sizeof(buff)) != 0) {
832
      video_putstring(10, 30, COLOR_BODY[mono], "READ ERROR", -1);
855
      mdr_cout_str(10, 30, "READ ERROR", COLOR_BODY[mono], 80);
833
      mdr_dos_getkey();
856
      mdr_dos_getkey();
834
      fclose(fd);
857
      fclose(fd);
835
      return(-1);
858
      return(-1);
836
    }
859
    }
837
    /* write install instruction to post-install script */
860
    /* write install instruction to post-install script */
Line 888... Line 911...
888
 
911
 
889
 
912
 
890
static void loadcp(const struct slocales *locales) {
913
static void loadcp(const struct slocales *locales) {
891
  char buff[64];
914
  char buff[64];
892
  if (locales->codepage == 437) return;
915
  if (locales->codepage == 437) return;
893
  video_movecursor(1, 0);
916
  mdr_cout_locate(1, 0);
894
  if (locales->egafile == 1) {
917
  if (locales->egafile == 1) {
895
    snprintf(buff, sizeof(buff), "MODE CON CP PREP=((%u) EGA.CPX) > NUL", locales->codepage);
918
    snprintf(buff, sizeof(buff), "MODE CON CP PREP=((%u) EGA.CPX) > NUL", locales->codepage);
896
  } else {
919
  } else {
897
    snprintf(buff, sizeof(buff), "MODE CON CP PREP=((%u) EGA%d.CPX) > NUL", locales->codepage, locales->egafile);
920
    snprintf(buff, sizeof(buff), "MODE CON CP PREP=((%u) EGA%d.CPX) > NUL", locales->codepage, locales->egafile);
898
  }
921
  }
Line 937... Line 960...
937
  if (argc != 1) buildstring = argv[1];
960
  if (argc != 1) buildstring = argv[1];
938
 
961
 
939
  sourcedrv = get_cur_drive() + 'A';
962
  sourcedrv = get_cur_drive() + 'A';
940
 
963
 
941
  /* init screen and detect mono status */
964
  /* init screen and detect mono status */
942
  mono = video_init();
965
  mono = mdr_cout_init(NULL, NULL);
943
 
966
 
944
 SelectLang:
967
 SelectLang:
945
  action = selectlang(&locales); /* welcome to svardos, select your language */
968
  action = selectlang(&locales); /* welcome to svardos, select your language */
946
  if (action != MENUNEXT) goto Quit;
969
  if (action != MENUNEXT) goto Quit;
947
  loadcp(&locales);
970
  loadcp(&locales);
Line 967... Line 990...
967
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
990
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
968
  /*netcfg();*/ /* basic networking config */
991
  /*netcfg();*/ /* basic networking config */
969
  finalreboot(); /* remove the CD and reboot */
992
  finalreboot(); /* remove the CD and reboot */
970
 
993
 
971
 Quit:
994
 Quit:
972
  video_clear(0x0700, 0, 0);
995
  mdr_cout_locate(0, 0);
973
  video_movecursor(0, 0);
996
  mdr_cout_close();
974
  return(0);
997
  return(0);
975
}
998
}