------------------------------------------------------------------------------------------------ TODO: Test FBX Binary files newer than the 7500 version to check if the 64 bits address behaviour is consistent
| 392 | // ------------------------------------------------------------------------------------------------ |
| 393 | // TODO: Test FBX Binary files newer than the 7500 version to check if the 64 bits address behaviour is consistent |
| 394 | void TokenizeBinary(TokenList &output_tokens, const char *input, size_t length, StackAllocator &token_allocator) { |
| 395 | ai_assert(input); |
| 396 | ASSIMP_LOG_DEBUG("Tokenizing binary FBX file"); |
| 397 | |
| 398 | if(length < 0x1b) { |
| 399 | TokenizeError("file is too short",0); |
| 400 | } |
| 401 | |
| 402 | //uint32_t offset = 0x15; |
| 403 | /* const char* cursor = input + 0x15; |
| 404 | |
| 405 | const uint32_t flags = ReadWord(input, cursor, input + length); |
| 406 | |
| 407 | const uint8_t padding_0 = ReadByte(input, cursor, input + length); // unused |
| 408 | const uint8_t padding_1 = ReadByte(input, cursor, input + length); // unused*/ |
| 409 | |
| 410 | if (strncmp(input,"Kaydara FBX Binary",18)) { |
| 411 | TokenizeError("magic bytes not found",0); |
| 412 | } |
| 413 | |
| 414 | const char* cursor = input + 18; |
| 415 | /*Result ignored*/ ReadByte(input, cursor, input + length); |
| 416 | /*Result ignored*/ ReadByte(input, cursor, input + length); |
| 417 | /*Result ignored*/ ReadByte(input, cursor, input + length); |
| 418 | /*Result ignored*/ ReadByte(input, cursor, input + length); |
| 419 | /*Result ignored*/ ReadByte(input, cursor, input + length); |
| 420 | const uint32_t version = ReadWord(input, cursor, input + length); |
| 421 | ASSIMP_LOG_DEBUG("FBX version: ", version); |
| 422 | const bool is64bits = version >= 7500; |
| 423 | const char *end = input + length; |
| 424 | try |
| 425 | { |
| 426 | while (cursor < end ) { |
| 427 | if (!ReadScope(output_tokens, token_allocator, input, cursor, input + length, is64bits)) { |
| 428 | break; |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | catch (const DeadlyImportError& e) |
| 433 | { |
| 434 | if (!is64bits && (length > std::numeric_limits<uint32_t>::max())) { |
| 435 | throw DeadlyImportError("The FBX file is invalid. This may be because the content is too big for this older version (", ai_to_string(version), ") of the FBX format. (", e.what(), ")"); |
| 436 | } |
| 437 | throw; |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | } // !FBX |
| 442 | } // !Assimp |
no test coverage detected