options.conf_directory = getPath2(base_path, CONF_DIRECTORY);
options.execute_command = NULL;
+ options.tape_log_filename = NULL;
options.special_flags = NULL;
options.debug_mode = NULL;
// when doing batch processing, always enable verbose mode (warnings)
options.verbose = TRUE;
}
+ else if (strncmp(option, "-tape_logfile", option_len) == 0)
+ {
+ if (option_arg == NULL)
+ FailWithHelp("option '%s' requires an argument", option_str);
+
+ options.tape_log_filename = getStringCopy(option_arg);
+ if (option_arg == next_option)
+ options_left++;
+ }
#if defined(PLATFORM_MACOSX)
else if (strPrefix(option, "-psn"))
{
}
}
+static FILE *tape_log_file;
+
+static void OpenTapeLogfile(void)
+{
+ if (!(tape_log_file = fopen(options.tape_log_filename, MODE_WRITE)))
+ Warn("cannot write tape logfile '%s'", options.tape_log_filename);
+}
+
+static void WriteTapeLogfile(byte action[MAX_TAPE_ACTIONS])
+{
+ int i;
+
+ for (i = 0; i < MAX_TAPE_ACTIONS; i++)
+ putFile8Bit(tape_log_file, action[i]);
+}
+
+static void CloseTapeLogfile(void)
+{
+ fclose(tape_log_file);
+}
+
// ============================================================================
// tape control functions
if (tape.auto_play)
PrintTapeReplayProgress(FALSE);
+ if (options.tape_log_filename != NULL)
+ WriteTapeLogfile(action);
+
return action;
}
// just finished auto-playing tape
PrintTapeReplayProgress(TRUE);
+ if (options.tape_log_filename != NULL)
+ CloseTapeLogfile();
+
if (global.autoplay_mode == AUTOPLAY_MODE_SAVE &&
tape.auto_play_level_solved)
{
InitCounter();
+ if (options.tape_log_filename != NULL)
+ OpenTapeLogfile();
+
TapeStartGamePlaying();
TapeStartWarpForward(global.autoplay_mode);