based on florin's CDVDbin detection code :) Parameter: Returns true if the image is valid/known/supported, or false if not (type == ISOTYPE_ILLEGAL).
| 270 | // |
| 271 | // Returns true if the image is valid/known/supported, or false if not (type == ISOTYPE_ILLEGAL). |
| 272 | bool InputIsoFile::Detect(bool readType) |
| 273 | { |
| 274 | m_type = ISOTYPE_ILLEGAL; |
| 275 | |
| 276 | // First sanity check: no sane CD image has less than 16 sectors, since that's what |
| 277 | // we need simply to contain a TOC. So if the file size is not large enough to |
| 278 | // accommodate that, it is NOT a CD image ---> |
| 279 | |
| 280 | int sectors = m_reader->GetBlockCount(); |
| 281 | |
| 282 | if (sectors < 17) |
| 283 | return false; |
| 284 | |
| 285 | m_blocks = 17; |
| 286 | |
| 287 | if (tryIsoType(2048, 0, 24)) |
| 288 | return true; // ISO 2048 |
| 289 | if (tryIsoType(2336, 0, 16)) |
| 290 | return true; // RAW 2336 |
| 291 | if (tryIsoType(2352, 0, 0)) |
| 292 | return true; // RAW 2352 |
| 293 | if (tryIsoType(2448, 0, 0)) |
| 294 | return true; // RAWQ 2448 |
| 295 | |
| 296 | if (tryIsoType(2048, 150 * 2048, 24)) |
| 297 | return true; // NERO ISO 2048 |
| 298 | if (tryIsoType(2352, 150 * 2048, 0)) |
| 299 | return true; // NERO RAW 2352 |
| 300 | if (tryIsoType(2448, 150 * 2048, 0)) |
| 301 | return true; // NERO RAWQ 2448 |
| 302 | |
| 303 | m_offset = 0; |
| 304 | m_blocksize = CD_FRAMESIZE_RAW; |
| 305 | m_blockofs = 0; |
| 306 | m_type = ISOTYPE_AUDIO; |
| 307 | |
| 308 | m_reader->SetDataOffset(m_offset); |
| 309 | m_reader->SetBlockSize(m_blocksize); |
| 310 | |
| 311 | //BUG: This also detects a memory-card-file as a valid Audio-CD ISO... -avih |
| 312 | return true; |
| 313 | } |
nothing calls this directly
no test coverage detected