I want to open binary file using Qt. I dave a description of file:
Qt Code:
  1. =================================================================
  2. IFP file format for Grand Theft Auto III and Vice City animation
  3. Written by Hollower (hollower@hotmail.com)
  4. =================================================================
  5. (updated Jan 2004)
  6.  
  7. This file is intended for programmers only.
  8.  
  9. First column is the number of bytes. V means that the length varies.
  10. Second column is the suggested data type (C/C++).
  11. Third column is a brief description of the data.
  12. Strings are padded to 4-byte alignment.
  13.  
  14. This is how I broke up the file for reading in. The section markers
  15. indicate the more "correct" way, but I used this simpler grouping
  16. (ie. why worry about the parent section of "INFO" blocks when they
  17. should always be in this order anyway), and I used the section markers
  18. for error checking. Using my grouping also makes it easier to output
  19. an IFP file that is valid for GTA3/GTA:VC. This may change in future
  20. GTA games.
  21.  
  22.  
  23. IFP FILE HEADER
  24. ----------------
  25. 4 (char[4]) "ANPK" --- section marker
  26. 4 (int) Offset to end of file
  27. 4 (char[4]) "INFO" --- section marker
  28. 4 (int) Offset to end of header
  29. 4 (int) Number of anims
  30. V (char[V]) Internal file name (null terminated string)
  31.  
  32. ANIMATION INFO
  33. ----------------
  34. 4 (char[4]) "NAME" --- section marker
  35. 4 (int) Length of anim name string
  36. V (char[V]) Anim name (null terminated string)
  37. 4 (char[4]) "DGAN" --- section marker
  38. 4 (int) Offset to end of animation
  39. 4 (char[4]) "INFO" --- section marker
  40. 4 (int) Offset to first object (usually 8)
  41. 4 (int) Number of objects
  42. 4 (int) NULL
  43.  
  44. OBJECT INFO
  45. ----------------
  46. 4 (char[4]) "CPAN" --- section marker
  47. 4 (int) Offset to end of object
  48. 4 (char[4]) "ANIM" --- section marker
  49. 4 (int) Offset to frame info (usually 48)
  50. 28 (char[28]) Object name (null terminated string, padded to 28 bytes)
  51. 4 (int) Number of frames
  52. 4 (int) NULL
  53. 4 (int) Index of last frame (Number of frames - 1)
  54. 4 (int) Index of next sibling (-1 if none)
  55. 4 (int) Index of previous sibling (-1 if none)
  56.  
  57. FRAME INFO
  58. ----------------
  59. 4 (char[4]) Frame type (see below)
  60. 4 (int) Length of frame data
  61.  
  62. FRAME DATA
  63. ----------------
  64. Frame data is all floats. Structure depends on frame type.
  65.  
  66. Frame types:
  67.  
  68. "KRT0" Root quaternion rotation (float x,y,z,w),
  69. vector translation (float x,y,z),
  70. time (float seconds)
  71.  
  72. "KR00" Child rotation, time
  73.  
  74. "KRTS" Scaled rotation, translation, scale (float x,y,z), time
  75.  
  76.  
  77. Root frames contain extra data for translating the model in the
  78. world. Child frames are simply rotations, concatenated as they
  79. go up the hierarchy.
  80.  
  81. You can probably guess, the letters here stand for
  82. (K)eyframe, ®otation, (T)ranslation, (S)cale, (0)None
  83. so presumably there could also be other combinations like "K0T0" but
  84. the above are the only ones found in all of the files I studied.
  85.  
  86.  
  87. Notes
  88. ----------------
  89.  
  90. Overall file structure looks like this:
  91.  
  92. Header
  93. |
  94. +-Animation
  95. | |
  96. | +-Object
  97. | | |
  98. | | +-Frame
  99. | | +-Frame
  100. | | +-Frame
  101. | | +- ...
  102. | |
  103. | +-Object
  104. | | |
  105. | | +-Frame
  106. | | +-Frame
  107. | | +-Frame
  108. | | +- ...
  109. | |
  110. | +- ...
  111. |
  112. +-Animation
  113. | |
  114. | +-Object
  115. | | |
  116.  
  117. ...and so on.
  118.  
  119. Object names are a reference to the DFF mesh or bone
  120. which will be rotated with the frame data. The string
  121. is not case sensitive.
  122.  
  123. An animation does not need to reference every part of a
  124. model, only the ones that will move. They also do not
  125. require an equal number of frames or matching time index.
  126.  
  127. There are sometimes anomalies like anims with 0 objects
  128. or objects with 0 frames.
  129.  
  130. For reference, the base pose can be viewed by creating
  131. animations with Rotation = {0.0f, 0.0f, 0.0f, 1.0f}.
  132.  
  133.  
  134.  
  135. I hope this file has been helpful. Now let's see some editors!
  136.  
  137. - Hollower
To copy to clipboard, switch view to plain text mode 

Ok, how to open it??

My code:
Qt Code:
  1. QString str = QFileDialog::getOpenFileName(0, "Open IFP", "", "*.ifp");
  2. QFile file(str);
  3. if(file.open(QIODevice::ReadOnly)) {
  4. QDataStream stream(&file);
  5. qDebug() << stream;
To copy to clipboard, switch view to plain text mode 

What i must do next??