bool setup_for_replay_from_file( FileSpecifier& File, uint32 map_checksum, bool prompt_to_export) { bool successful= false; (void)(map_checksum); FilmFileSpec = File; if (FilmFileSpec.Open(FilmFile)) { replay.valid= true; replay.have_read_last_chunk = false; replay.game_is_being_replayed = true; assert(!replay.resource_data); replay.resource_data= NULL; replay.resource_data_size= 0l; replay.film_resource_offset= NONE; byte Header[SIZEOF_recording_header]; FilmFile.Read(SIZEOF_recording_header,Header); unpack_recording_header(Header,&replay.header,1); replay.header.game_information.cheat_flags = _allow_crosshair | _allow_tunnel_vision | _allow_behindview | _allow_overlay_map; /* Set to the mapfile this replay came from.. */ if(use_map_file(replay.header.map_checksum)) { replay.fsread_buffer= new char[DISK_CACHE_SIZE]; assert(replay.fsread_buffer); replay.location_in_cache= NULL; replay.bytes_in_cache= 0; replay.replay_speed= 1; #ifdef DEBUG_REPLAY open_stream_file(); #endif if (prompt_to_export) Movie::instance()->PromptForRecording(); successful= true; } else { /* Tell them that this map wasn't found. They lose. */ alert_user(infoError, strERRORS, cantFindReplayMap, 0); replay.valid= false; replay.game_is_being_replayed= false; FilmFile.Close(); } } return successful; }
boolean setup_for_replay_from_file( FileDesc *file, unsigned long map_checksum) { boolean successful= FALSE; #pragma unused(map_checksum) replay.recording_file_refnum= open_file_for_reading(file); if(replay.recording_file_refnum > 0) { replay.valid= TRUE; replay.have_read_last_chunk = FALSE; replay.game_is_being_replayed = TRUE; assert(!replay.resource_data); replay.resource_data= NULL; replay.resource_data_size= 0l; replay.film_resource_offset= NONE; read_file(replay.recording_file_refnum, sizeof(struct recording_header), &replay.header); /* Set to the mapfile this replay came from.. */ if(use_map_file(replay.header.map_checksum)) { replay.fsread_buffer= (char *)malloc(DISK_CACHE_SIZE); assert(replay.fsread_buffer); if(!replay.fsread_buffer) alert_user(fatalError, strERRORS, outOfMemory, memory_error()); replay.location_in_cache= NULL; replay.bytes_in_cache= 0; replay.replay_speed= 1; #ifdef DEBUG_REPLAY open_stream_file(); #endif successful= TRUE; } else { /* Tell them that this map wasn't found. They lose. */ alert_user(infoError, strERRORS, cantFindReplayMap, 0); } } return successful; }