Advertisement
Guest User

catlify

a guest
Mar 12th, 2013
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.42 KB | None | 0 0
  1. toc:
  2.  
  3. noncas:
  4. tag 0f #optional
  5. bundles 01
  6. id 07
  7. offset 09
  8. size 09
  9. chunks 01
  10. name 07 #optional
  11. alwaysEmitSuperbundle 06 #optional, True or False both work
  12.  
  13. cas:
  14. bundles 01
  15. id 07
  16. offset 09
  17. size 08
  18. chunks 01
  19. cas 06
  20. name 07
  21. alwaysEmitSuperbundle 06
  22.  
  23. sb:
  24.  
  25. noncas (my own object names):
  26. ebxEntries
  27. name
  28. sha1
  29. size
  30. originalSize
  31. resEntries
  32. name
  33. sha1
  34. size
  35. originalSize
  36. resType
  37. resMeta
  38. chunkEntries
  39. id
  40. size
  41. sha1
  42. v1
  43. v2
  44. chunkMeta # this can be copied directly between cas and noncas
  45. h32 08
  46. meta 02
  47.  
  48.  
  49. cas:
  50. path 07, the name of the bundle itself (found in the toc already)
  51. magicSalt 08 #no idea, this is always the same in all files
  52. ebx 01
  53. name 07
  54. sha1 10
  55. size 09 #this is the exact payload size found in cascat too
  56. originalSize 09
  57. (idata) 13
  58. dbx 01 # are these necessary?
  59. name 07
  60. sha1 10
  61. size 09
  62. originalSize 09
  63. (idata) 13
  64. res 01
  65. name 07
  66. sha1 10
  67. size 09
  68. originalSize 09
  69. resType 08
  70. resMeta 13
  71. (idata) 13
  72. chunks 01
  73. id 0f
  74. sha1 10
  75. size 09
  76. (rangeStart) 08
  77. (rangeEnd) 08
  78. (logicalOffset) 08
  79. (idata) 13
  80. chunkMeta # this can be copied directly between cas and noncas
  81. h32 08 #hash32. This is found in ebx files to access chunks?
  82. meta 02
  83. alignMembers 06, True
  84. totalSize 09, sum of payload sizes (i.e. "size") from ebx+dbx+res+chunks
  85.  
  86. note: essential are only
  87. path 07
  88. magicSalt 08
  89. alignMembers 06
  90. totalSize 09
  91.  
  92. for sbcas:
  93. When idata exists, it contains the entire payload (always zlib?)! The file still exists in the
  94. cascat archive, and the data there is EXACTLY the same as given in idata.
  95. This hopefully means that idata is completely optional and can be omitted.
  96. size is exactly the size of the payload found in cascat. Additionally the given sha1 matches the sha1 of the payload.
  97.  
  98.  
  99. rangeStart, rangeEnd, logicalOffset always appear together.
  100. chunk.meta is not nullbyte <=> chunk has range entries. This is false for noncas.
  101. ALWAYS:
  102. rangeEnd = size
  103. rangeStart < size
  104. rangeStart=0 <=> logicalOffset=0
  105.  
  106. rangeStart is the start of one zlib component (i.e. right before the two size ints). At rangeStart+8 there is the zlib header 78da.
  107. logicalOffset is the position in the unzipped file for that.
  108. The two separate parts divided by rangeStart/logicalOffset appear to be the same kind of file.
  109. possible logicalOffset values:
  110. 0, 1024, 2048, 2560, 5120, 8192, 10240, 16384, 20480, 32768, 40960, 65536, 81920, 131072, 163840, 262144, 327680,
  111. 524288, 655360, 1048576, 1310720, 2097152, 2621440, 4194304, 5242880, 8388608, 10485760, 20971520
  112.  
  113.  
  114. for sbnoncas:
  115. chunks have three fields
  116. v1, v2, logicalOffset
  117. the payload size is v2-v1. If v1==0: sha1 matches the given sha1. else: SHA1 DOES NOT MATCH.
  118. v1=0 <=> logicalOffset=0
  119. v1 < v2
  120. v1 <= logicalOffset
  121. v2 can be larger or smaller than logicalOffset.
  122. possible logicalOffset values:
  123. 0, 1024, 5120, 8192, 10240, 16384, 20480, 32768, 40960, 65536, 81920, 131072, 163840, 262144, 327680,
  124. 524288, 655360, 1048576, 1310720, 2097152, 2621440, 2752512, 4194304, 5242880, 8388608, 10485760, 20971520
  125.  
  126.  
  127. unzipped => v1=0, v1!=0 => zipped
  128. zipped:
  129. 34159 v1=0
  130. 29788 v1!=0
  131.  
  132. zipped:
  133. 38340 meta=0
  134. 25607 meta!=0
  135. unzipped:
  136. 11300 meta=0
  137. 10593 meta!=0
  138.  
  139. v1!=0 => zlib format (recall v1!=0 => zipped) consists of several parts (and is never just one part)
  140.  
  141. logicalOffset!=0 => logicalOffset = (unzipped file size)*3 - 40 #many exceptions for this
  142.  
  143.  
  144. noncas. Total number of steps in the file depending on logicalOffset
  145. {392: 8, 43692: 9, 43792: 11, 520: 9, 10952: 10, 21896: 11, 10924: 8, 11024: 10, 11016: 11, 87440: 11, 22032: 11, 5488: 8, 174800: 12, 87408: 10, 87432: 12, 1544: 10,
  146. 174792: 13, 5468: 8, 21872: 9, 2796204: 51, 349584: 15, 5512: 10, 1416: 9, 349544: 15, 10960: 9, 2796216: 52, 2832: 9, 87400: 11, 2768: 8, 174864: 13, 174776: 12,
  147. 43720: 11, 3088: 10, 712: 8, 699080: 21, 1424: 8, 2824: 10, 699088: 20, 10936: 9, 21844: 8, 43728: 10, 349552: 14, 21852: 9, 5520: 9, 44048: 12, 699064: 20, 1384: 8,
  148. 1398120: 31, 2744: 8, 1398128: 30, 5480: 9, 5648: 10, 21904: 10, 43784: 12, 87380: 9, 21864: 10, 43704: 10, 349524: 13, 2760: 9}
  149.  
  150.  
  151.  
  152.  
  153. NONCAS
  154. ##########################
  155. sha1 does not match for v1!=0
  156. meta has nothing to do with zip status
  157. meta has nothing to do with v1
  158. v1!=0 => zipped, unzipped => v1=0
  159. ##########################
  160.  
  161.  
  162. CAS
  163. ##########################
  164. meta=None <=> unranged, meta!=None <=> ranged.
  165. ranged => zipped, unzipped => unranged
  166. ##########################
  167.  
  168.  
  169.  
  170. cas:
  171. 2801 chunks
  172. 971 chunks with range entries
  173. 463 nonzlib chunks (many audio 4800000c, some others too). For these chunks chunkMeta.meta="\x00"
  174. 0 nonzlib chunks with range
  175. 70 chunks with idata
  176. 1830 chunks with chunkMeta.meta="\x00"
  177.  
  178. 1830+971=2801 => range entries <=> chunkMeta.meta!="\x00"
  179.  
  180. chunkMeta.meta values
  181. 00 => None
  182. 0866697273744d6970000000000000 => 0
  183. 0866697273744d6970000100000000 => 1
  184. 0866697273744d6970000200000000 => 2
  185. f i r s t m i p
  186.  
  187.  
  188.  
  189.  
  190. chunkMeta.h32: 32bit hash.
  191.  
  192.  
  193.  
  194. If rangeStart is defined, then meta != \x00. If rangeStart is undefined, then meta = \x00
  195. The size given in sb is the same size found in cascat. The sha1 is always the sha1 of the payload.
  196. The ranged chunks are always in zlib format (sometimes uncompressed). Some unranged chunks are audio in non-zlib format.
  197.  
  198.  
  199. logicalOffset vs steps in ranged chunks: Recall that ranged chunks are always zlib.
  200.  
  201. To obtain the number of steps I do the following:
  202. Read the uncompressed and compressed size. Add uncompressed size to the total uncompressed size.
  203. If the total uncompressed size == logicalOffset, return the number of steps so far. Otherwise jump over compressed size in the payload and repeat.
  204.  
  205.  
  206.  
  207. There is exactly one specific number of steps for each logicalOffset. It's the same even between bf3 and mohw.
  208. [(0, 0), (1024, 1), (2048, 1), (2560, 2), (5120, 2), (8192, 1), (10240, 2), (10752, 3), (16384, 1), (20480, 2), (21504, 3), (32768, 1), (40960, 2), (43008, 3),
  209. (43520, 4), (65536, 1), (81920, 2), (86016, 3), (87040, 4), (131072, 2), (163840, 3), (172032, 4), (174080, 5), (262144, 4), (327680, 5), (344064, 6),
  210. (348160, 7), (349184, 8), (524288, 8), (655360, 10), (688128, 11), (696320, 12), (1048576, 16), (1310720, 20), (1376256, 21), (1392640, 22),
  211. (2097152, 32), (2621440, 40), (2752512, 42), (2785280, 43), (4194304, 64), (5242880, 80), (5505024, 84), (5570560, 85), (8388608, 128), (10485760, 160),
  212. (11010048, 168), (20971520, 320), (22020096, 336)]
  213.  
  214. There are several stepnumbers to read the complete chunk.
  215. {655360: set([20, 21]), 163840: set([11, 12, 13, 14]), 262144: set([13, 14, 15]), 4194304: set([94]), 1310720: set([30, 31]), 131072: set([12]), 1024: set([10]), 8192: set([10]), 524288: set([20]), 16384: set([10]), 5242880: set([94, 95]), 20480: set([10, 11]), 1048576: set([30, 31]), 32768: set([10, 11]), 5120: set([11]), 10240: set([10]), 40960: set([10, 11, 12]), 2097152: set([52, 53]), 10485760: set([180, 181]), 65536: set([11]), 327680: set([16, 13, 14, 15]), 2621440: set([52, 53]), 81920: set([10, 11, 12])}
  216.  
  217.  
  218. meta=0 <=> unranged, meta!=0 <=> ranged.
  219.  
  220. ranged => zipped only (56017)
  221. unranged:
  222. 33615 zipped
  223. 53041 unzipped
  224.  
  225.  
  226. ##########################
  227. meta=0 <=> unranged, meta!=0 <=> ranged.
  228. ranged => zipped
  229. ##########################
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238. ##################
  239. 65536 65335 78da
  240. 65536 65423 78da
  241. 65536 65440 78da
  242. 65536 65437 78da
  243. 65536 65387 78da
  244. 65536 65380 78da
  245. 65536 65481 78da
  246. 65536 65401 78da
  247. 65536 65415 78da
  248. 65536 65377 78da
  249. 65536 65381 78da
  250. 65536 65390 78da
  251. 65536 65379 78da
  252. 65536 65445 78da
  253. 65536 65391 78da
  254. 65536 65395 78da
  255. 65536 65536 b44f
  256.  
  257. Traceback (most recent call last):
  258. File "D:\TOCSB FILES\cas vs noncas\bundles cas.py", line 186, in <module>
  259. ha()
  260. File "D:\TOCSB FILES\cas vs noncas\bundles cas.py", line 151, in ha
  261. data,data2=cat.grabPayload(sha1)
  262. File "D:\TOCSB FILES\cas vs noncas\bundles cas.py", line 45, in grabPayload
  263. payload2=self.zlibb(cas,entry)
  264. File "D:\TOCSB FILES\cas vs noncas\bundles cas.py", line 73, in zlibb
  265. tr=zlib.decompress(tr0)
  266. error: Error -3 while decompressing data: unknown compression method
  267. ############
  268.  
  269.  
  270.  
  271.  
  272.  
  273. files without 78da magic:
  274.  
  275. sha1 60f9416124ac9384abf18b3cad5b4b52dcec9ddf
  276. size 349577
  277. rangeStart 0
  278. rangeEnd 349577
  279. dif 349577
  280. meta 0
  281. logicalOffset 0
  282.  
  283. sha1 7415170f48f0e79ccb2b881e20116079d49169cd
  284. size 1395961
  285. rangeStart 1309917
  286. rangeEnd 1395961
  287. dif 86044
  288. meta 2
  289. logicalOffset 1310720
  290.  
  291.  
  292. sha1 8dbc4e03fc44d9c01f2694cc5f56db89ce8d636a
  293. size 1397590
  294. rangeStart 1310100
  295. rangeEnd 1397590
  296. dif 87490
  297. meta 2
  298. logicalOffset 1310720
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306. cascat archives:
  307. cat:
  308. The size must be >= the actual size of the payload.
  309. 1<=casnum<=255
  310.  
  311. cas:
  312. The faceoff header might as well be omitted entirely, the game does not mind it being replaced with ff bytes.
  313. zlib texture with rangeStart!=0 and firstMip 1: the uncompressed size of the first piece may be larger or smaller than the actual uncompressed size. The uncompressed size late in the file may be >= the actual uncompressed size. The game gets stuck in the loading screen with smaller sizes. => The game only decompresses the pieces starting from logicalOffset and skips the highres texture unless told otherwise.
  314.  
  315.  
  316.  
  317.  
  318.  
  319. D:\TOCSB FILES\cas vs noncas\casbundles\COOP_007\bundles\Win32\levels\coop_007\coop_007.bundle
  320. dc16ae4638d8bc91588e611ea0ecd833e820b8b5
  321. 9
  322. 08594588225c143bcaadfc57f6918636f36166d4
  323. 17
  324.  
  325. D:\TOCSB FILES\cas vs noncas\casbundles\MP_013\bundles\Win32\levels\mp_013\mp_013.bundle
  326. 75d0530106c5cb473e274cd111cc5842b08951df
  327. 35
  328.  
  329. D:\TOCSB FILES\cas vs noncas\casbundles\SP_Bank\bundles\Win32\levels\sp_bank\highway_03_props.bundle
  330. 104bb008799c07ddb0816d49a25a195992e475fa
  331. 5
  332.  
  333. D:\TOCSB FILES\cas vs noncas\casbundles\SP_Earthquake\bundles\Win32\levels\sp_earthquake\meatmarket.bundle
  334. 7474364d2b7a74032fbac73139dac01033f20a98
  335. 2
  336.  
  337. D:\TOCSB FILES\cas vs noncas\casbundles\SP_Earthquake\bundles\Win32\levels\sp_earthquake\sp_earthquake.bundle
  338. d0932a5c7643627e4df0e4712af90a73f7f1674d
  339. 17
  340.  
  341. D:\TOCSB FILES\cas vs noncas\casbundles\SP_Paris\bundles\Win32\levels\sp_paris\street.bundle
  342. 3e18daf5392a18d895d38182ce8d18c6b0a97589
  343. 325
  344.  
  345. D:\TOCSB FILES\cas vs noncas\casbundles\SP_Tank_b\bundles\Win32\levels\sp_tank_b\ambush.bundle
  346. 7682297a175a1717702369c5bd75497d7fd9d93a
  347. 17
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement