| 171 | } |
| 172 | |
| 173 | void CGhostRecorder::Stop(int Ticks, int Time) |
| 174 | { |
| 175 | if(!m_File) |
| 176 | { |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | const bool DiscardFile = Ticks <= 0 || Time <= 0; |
| 181 | |
| 182 | if(!DiscardFile) |
| 183 | { |
| 184 | FlushChunk(); |
| 185 | |
| 186 | // write number of ticks and time |
| 187 | io_seek(m_File, offsetof(CGhostHeader, m_aNumTicks), IOSEEK_START); |
| 188 | |
| 189 | unsigned char aNumTicks[sizeof(int32_t)]; |
| 190 | uint_to_bytes_be(aNumTicks, Ticks); |
| 191 | io_write(m_File, aNumTicks, sizeof(aNumTicks)); |
| 192 | |
| 193 | unsigned char aTime[sizeof(int32_t)]; |
| 194 | uint_to_bytes_be(aTime, Time); |
| 195 | io_write(m_File, aTime, sizeof(aTime)); |
| 196 | } |
| 197 | |
| 198 | io_close(m_File); |
| 199 | m_File = nullptr; |
| 200 | |
| 201 | if(DiscardFile) |
| 202 | { |
| 203 | m_pStorage->RemoveFile(m_aFilename, IStorage::TYPE_SAVE); |
| 204 | } |
| 205 | |
| 206 | log_info_color(LOG_COLOR_GHOST, "ghost_recorder", "Stopped recording to '%s'", m_aFilename); |
| 207 | m_aFilename[0] = '\0'; |
| 208 | } |
| 209 | |
| 210 | CGhostLoader::CGhostLoader() |
| 211 | { |
nothing calls this directly
no test coverage detected