From: David Griffith Date: Wed, 12 Jul 2017 12:31:13 +0000 (-0700) Subject: DOS Frotz restricted mode (not tested yet) and fixed problems in bcsample.c. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=b4b3aab86273028fa96ec506c98961d69aa45127;p=liskon_frotz.git DOS Frotz restricted mode (not tested yet) and fixed problems in bcsample.c. --- diff --git a/src/dos/bcinit.c b/src/dos/bcinit.c index a08e03a..d6addfb 100644 --- a/src/dos/bcinit.c +++ b/src/dos/bcinit.c @@ -21,19 +21,19 @@ static char information[] = "Complies with standard 1.0 of Graham Nelson's specification.\n" "\n" "Syntax: frotz [options] story-file\n" -" -a watch attribute setting \t -o watch object movement\n" -" -A watch attribute testing \t -O watch object locating\n" -" -b # background colour \t -p alter piracy opcode\n" -" -B # reverse background colour\t -r # right margin\n" -" -c # context lines \t -s # random number seed value\n" -" -d # display mode (see below) \t -S # transscript width\n" -" -e # emphasis colour [mode 1] \t -t set Tandy bit\n" -" -f # foreground colour \t -T bold typing [modes 2+4+5]\n" -" -F # reverse foreground colour\t -u # slots for multiple undo\n" -" -g # font [mode 5] (see below)\t -w # screen width\n" -" -h # screen height \t -x expand abbreviations g/x/z\n" -" -i ignore runtime errors \t -Z # error checking (see below)\n" -" -l # left margin" +" -a watch attribute setting \t -o watch object movement\n" +" -A watch attribute testing \t -O watch object locating\n" +" -b # background colour \t -p alter piracy opcode\n" +" -B # reverse background colour \t -r # right margin\n" +" -c # context lines \t -R restricted read/write\n" +" -d # display mode (see below) \t -s # random number seed value\n" +" -e # emphasis colour [mode 1] \t -S # transscript width\n" +" -f # foreground colour \t -t set Tandy bit\n" +" -F # reverse foreground colour \t -T bold typing [modes 2+4+5]\n" +" -g # font [mode 5] (see below) \t -u # slots for multiple undo\n" +" -h # screen height \t -w # screen width\n" +" -i ignore runtime errors \t -x expand abbreviations g/x/z\n" +" -l # left margin \t -Z # error checking (see below)" "\n" "Fonts are 0 (fixed), 1 (sans serif), 2 (comic), 3 (times), 4 (serif).\n" "Display modes are 0 (mono), 1 (text), 2 (CGA), 3 (MCGA), 4 (EGA), 5 (Amiga)." @@ -261,7 +261,7 @@ static void parse_options (int argc, char **argv) int num = 0; - c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpr:s:S:tTu:w:xZ:"); + c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpr:R:s:S:tTu:w:xZ:"); if (optarg != NULL) num = dectoi (optarg); @@ -309,6 +309,8 @@ static void parse_options (int argc, char **argv) f_setup.piracy = 1; if (c == 'r') f_setup.right_margin = num; + if (c == 'R') + f_setup.restricted_path = strdup(optarg); if (c == 's') user_random_seed = num; if (c == 'S') diff --git a/src/dos/bcinput.c b/src/dos/bcinput.c index 87a0361..d4231c0 100644 --- a/src/dos/bcinput.c +++ b/src/dos/bcinput.c @@ -928,6 +928,9 @@ int os_read_file_name (char *file_name, const char *default_name, int flag) bool saved_replay = istream_replay; bool saved_record = ostream_record; + int i; + char *tempname; + /* Turn off playback and recording temporarily */ istream_replay = FALSE; @@ -961,6 +964,23 @@ int os_read_file_name (char *file_name, const char *default_name, int flag) if (strchr (file_name, '.') == NULL) strcat (file_name, extension); + /* FIXME: UNTESTED Check if we're restricted to one directory. */ + + if (f_setup.restricted_path != NULL) { + for (i = strlen(file_name); i > 0; i--) { + if (file_name[i] == PATH_SEPARATOR) { + i++; + break; + } + } + tempname = strdup(file_name + i); + strcpy(file_name, f_setup.restricted_path); + if (file_name[strlen(file_name)-1] != PATH_SEPARATOR) { + strcat(file_name, "\\"); + } + strcat(file_name, tempname); + } + /* Make sure it is safe to use this file name */ result = TRUE; diff --git a/src/dos/bcparams.txt b/src/dos/bcparams.txt index ce3fb59..eb88a20 100644 --- a/src/dos/bcparams.txt +++ b/src/dos/bcparams.txt @@ -15,6 +15,7 @@ -O watch object locating -p alter piracy opcode -r # right margin +-R restricted read/write -s # random number seed value -S # transscript width -t set Tandy bit diff --git a/src/dos/bcsample.c b/src/dos/bcsample.c index 258a972..49e3f5a 100644 --- a/src/dos/bcsample.c +++ b/src/dos/bcsample.c @@ -123,6 +123,23 @@ static void interrupt end_of_dma (void) }/* end_of_dma */ + +/* + * os_init_sound + * + * Dummy function to satisfy the core code. DOS Frotz does its sound + * initialization in bcinit.c in os_init_screen(). + * + * FIXME: Move the sound initlization from os_init_screen() to here and + * somehow work around the ifs. + * + */ +void os_init_sound(void) +{ + /* do nothing */ +} + + /* * dos_init_sound * @@ -332,6 +349,8 @@ void os_start_sample (int number, int volume, int repeats, zword eos) { #ifdef SOUND_SUPPORT + eos=eos; /* not used in DOS Frotz */ + os_stop_sample (); /* Exit if the sound board isn't set up properly */