From: David Griffith Date: Fri, 28 Apr 2023 20:10:12 +0000 (-0700) Subject: Preparing for Z-machine standard 1.1 of not prompting on save/restore. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=e862aabf7864726399e9046889bd255d5600b5b9;p=liskon_frotz.git Preparing for Z-machine standard 1.1 of not prompting on save/restore. Copied from the Z-machine Standard 1.1 document: As of Standard 1.1 an additional optional parameter, prompt, is allowed on Version 5 extended save/restore. This allows a game author to tell the interpreter whether it should ask for confirmation of the provided file name (prompt is 1), or just silently save/restore using the provided filename (prompt is 0). If the parameter is not provided, whether to prompt or not is a matter for the interpreter - this might be globally user-configurable. Infocom's interpreters do prompt for filenames, many modern ones do not. --- diff --git a/src/common/frotz.h b/src/common/frotz.h index ccae2de..82a688a 100644 --- a/src/common/frotz.h +++ b/src/common/frotz.h @@ -414,6 +414,7 @@ extern const char build_timestamp[]; #define FILE_RECORD 4 #define FILE_LOAD_AUX 5 #define FILE_SAVE_AUX 6 +#define FILE_NO_PROMPT 7 /*** Data access macros ***/ #ifdef TOPS20 diff --git a/src/curses/ux_input.c b/src/curses/ux_input.c index b94a938..e725af3 100644 --- a/src/curses/ux_input.c +++ b/src/curses/ux_input.c @@ -970,13 +970,14 @@ zchar os_read_key (int timeout, int cursor) * * Return the name of a file. Flag can be one of: * - * FILE_SAVE - Save game file - * FILE_RESTORE - Restore game file - * FILE_SCRIPT - Transcript file - * FILE_RECORD - Command file for recording - * FILE_PLAYBACK - Command file for playback - * FILE_SAVE_AUX - Save auxilary ("preferred settings") file - * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_SAVE - Save game file + * FILE_RESTORE - Restore game file + * FILE_SCRIPT - Transcript file + * FILE_RECORD - Command file for recording + * FILE_PLAYBACK - Command file for playback + * FILE_SAVE_AUX - Save auxilary ("preferred settings") file + * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_NO_PROMPT - Return file without prompting the user * * The length of the file name is limited by MAX_FILE_NAME. Ideally * an interpreter should open a file requester to ask for the file diff --git a/src/dos/dosinput.c b/src/dos/dosinput.c index 8f666a9..02066a4 100644 --- a/src/dos/dosinput.c +++ b/src/dos/dosinput.c @@ -860,13 +860,14 @@ zchar os_read_key(int timeout, bool cursor) * * Return the name of a file. Flag can be one of: * - * FILE_SAVE - Save game file - * FILE_RESTORE - Restore game file - * FILE_SCRIPT - Transscript file - * FILE_RECORD - Command file for recording - * FILE_PLAYBACK - Command file for playback - * FILE_SAVE_AUX - Save auxilary ("preferred settings") file - * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_SAVE - Save game file + * FILE_RESTORE - Restore game file + * FILE_SCRIPT - Transcript file + * FILE_RECORD - Command file for recording + * FILE_PLAYBACK - Command file for playback + * FILE_SAVE_AUX - Save auxilary ("preferred settings") file + * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_NO_PROMPT - Return file without prompting the user * * The length of the file name is limited by MAX_FILE_NAME. Ideally * an interpreter should open a file requester to ask for the file diff --git a/src/dumb/dinput.c b/src/dumb/dinput.c index eb2a950..7fc642d 100644 --- a/src/dumb/dinput.c +++ b/src/dumb/dinput.c @@ -496,7 +496,27 @@ zchar os_read_line (int UNUSED (max), zchar *buf, int timeout, int UNUSED(width) return terminator; } - +/* + * os_read_file_name + * + * Return the name of a file. Flag can be one of: + * + * FILE_SAVE - Save game file + * FILE_RESTORE - Restore game file + * FILE_SCRIPT - Transcript file + * FILE_RECORD - Command file for recording + * FILE_PLAYBACK - Command file for playback + * FILE_SAVE_AUX - Save auxilary ("preferred settings") file + * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_NO_PROMPT - Return file without prompting the user + * + * The length of the file name is limited by MAX_FILE_NAME. Ideally + * an interpreter should open a file requester to ask for the file + * name. If it is unable to do that then this function should call + * print_string and read_string to ask for a file name. + * + * Return value is NULL if there was a problem. + */ char *os_read_file_name (const char *default_name, int flag) { char file_name[FILENAME_MAX + 1]; diff --git a/src/sdl/sf_util.c b/src/sdl/sf_util.c index ef5644e..ff1d920 100644 --- a/src/sdl/sf_util.c +++ b/src/sdl/sf_util.c @@ -629,13 +629,14 @@ static int dialog_read_file_name(char *file_name, const char *default_name, * * Return the name of a file. Flag can be one of: * - * FILE_SAVE - Save game file - * FILE_RESTORE - Restore game file - * FILE_SCRIPT - Transscript file - * FILE_RECORD - Command file for recording - * FILE_PLAYBACK - Command file for playback - * FILE_SAVE_AUX - Save auxilary ("preferred settings") file - * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_SAVE - Save game file + * FILE_RESTORE - Restore game file + * FILE_SCRIPT - Transcript file + * FILE_RECORD - Command file for recording + * FILE_PLAYBACK - Command file for playback + * FILE_SAVE_AUX - Save auxilary ("preferred settings") file + * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_NO_PROMPT - Return file without prompting the user * * The length of the file name is limited by MAX_FILE_NAME. Ideally * an interpreter should open a file requester to ask for the file diff --git a/src/x11/x_input.c b/src/x11/x_input.c index b7e4506..44f48aa 100644 --- a/src/x11/x_input.c +++ b/src/x11/x_input.c @@ -215,13 +215,14 @@ zchar os_read_key(int timeout, int cursor) * * Return the name of a file. Flag can be one of: * - * FILE_SAVE - Save game file - * FILE_RESTORE - Restore game file - * FILE_SCRIPT - Transscript file - * FILE_RECORD - Command file for recording - * FILE_PLAYBACK - Command file for playback - * FILE_SAVE_AUX - Save auxilary ("preferred settings") file - * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_SAVE - Save game file + * FILE_RESTORE - Restore game file + * FILE_SCRIPT - Transcript file + * FILE_RECORD - Command file for recording + * FILE_PLAYBACK - Command file for playback + * FILE_SAVE_AUX - Save auxilary ("preferred settings") file + * FILE_LOAD_AUX - Load auxilary ("preferred settings") file + * FILE_NO_PROMPT - Return file without prompting the use * * The length of the file name is limited by MAX_FILE_NAME. Ideally * an interpreter should open a file requester to ask for the file