| 199 | } |
| 200 | |
| 201 | ResultDetails CaptureFile::OpenFile(const rdcstr &filename, const rdcstr &filetype, |
| 202 | RENDERDOC_ProgressCallback progress) |
| 203 | { |
| 204 | CaptureImporter importer = RenderDoc::Inst().GetCaptureImporter(filetype); |
| 205 | |
| 206 | if(importer) |
| 207 | { |
| 208 | ResultDetails ret; |
| 209 | |
| 210 | { |
| 211 | StreamReader reader(FileIO::fopen(filename, FileIO::ReadBinary)); |
| 212 | SAFE_DELETE(m_RDC); |
| 213 | m_RDC = new RDCFile; |
| 214 | ret = importer(filename, reader, m_RDC, m_StructuredData, progress); |
| 215 | } |
| 216 | |
| 217 | if(ret.code != ResultCode::Succeeded) |
| 218 | { |
| 219 | SAFE_DELETE(m_RDC); |
| 220 | return ret; |
| 221 | } |
| 222 | } |
| 223 | else |
| 224 | { |
| 225 | if(filetype != "" && filetype != "rdc") |
| 226 | RDCWARN("Opening file with unrecognised filetype '%s' - treating as 'rdc'", filetype.c_str()); |
| 227 | |
| 228 | if(progress) |
| 229 | progress(0.0f); |
| 230 | |
| 231 | SAFE_DELETE(m_RDC); |
| 232 | m_RDC = new RDCFile; |
| 233 | m_RDC->Open(filename); |
| 234 | |
| 235 | if(progress) |
| 236 | progress(1.0f); |
| 237 | } |
| 238 | |
| 239 | return Init(); |
| 240 | } |
| 241 | |
| 242 | ResultDetails CaptureFile::OpenBuffer(const bytebuf &buffer, const rdcstr &filetype, |
| 243 | RENDERDOC_ProgressCallback progress) |