Guest User

pcc header format

a guest
Mar 2nd, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.06 KB | None | 0 0
  1. #ifndef _PKG_H_
  2. #define _PKG_H_
  3.  
  4. #include "libcore/types.h"
  5.  
  6. typedef struct pkg_generation {
  7.   uint32_t export_count;
  8.   uint32_t name_count;
  9.   uint32_t netobject_count;
  10. } pkg_generation_t;
  11.  
  12. typedef struct pkg_compressed_chunk_block {
  13.   uint32_t compressed_size;
  14.   uint32_t uncompressed_size;
  15. } pkg_compressed_chunk_block_t;
  16.  
  17. typedef struct pkg_compressed_chunk {
  18.   // chunk description
  19.   uint32_t uncompressed_offset;
  20.   uint32_t uncompressed_size;
  21.   uint32_t compressed_size;
  22.   uint32_t compressed_offset;
  23.  
  24.   // chunk header
  25.   uint32_t magic;
  26.   uint32_t maxblocksize;
  27.   uint32_t compressed_size2;
  28.   uint32_t uncompressed_size2;
  29.  
  30.   // chunk blocks
  31.   uint32_t nblocks;
  32.   pkg_compressed_chunk_block_t *blocks;
  33. } pkg_compressed_chunk_t;
  34.  
  35. typedef struct pkg {
  36.   uint8_t *raw_data;
  37.   uint32_t raw_data_size;
  38.  
  39.   uint16_t version;
  40.   uint16_t licensee;
  41.  
  42.   uint32_t unkf0;
  43.  
  44.   int32_t dirnamelen;
  45.   uint8_t *dirname;
  46.  
  47.   uint32_t flags;
  48.  
  49.   // read if (flags & 8)
  50.   uint32_t unkf1;
  51.  
  52.   uint32_t name_count;
  53.   uint32_t name_offset;
  54.   uint32_t export_count;
  55.   uint32_t export_offset;
  56.   uint32_t import_count;
  57.   uint32_t import_offset;
  58.   uint32_t unkf2;
  59.  
  60.   // read if version >= 623
  61.   uint32_t unkf3;
  62.   uint32_t unkf4;
  63.   uint32_t unkf5;
  64.  
  65.   // read if version >= 584
  66.   uint32_t unkf6;
  67.  
  68.   // guid
  69.   uint32_t g0, g1, g2, g3;
  70.  
  71.   uint32_t ngenerations;
  72.   pkg_generation_t *generations;
  73.  
  74.   uint32_t enginever;
  75.   uint32_t cookerver;
  76.  
  77.   // read if 0 < licensee < 0x88
  78.   uint32_t unkf7;
  79.  
  80.   // read if licensee > 0
  81.   uint32_t unkf8;
  82.   uint32_t unkf9;
  83.  
  84.   // read if 0 < licensee < 0x88
  85.   uint32_t unkf10;
  86.   uint32_t unkf11;
  87.  
  88.   // compression info
  89.   uint32_t compression_flags;
  90.   uint32_t ncompressed_chunks;
  91.   pkg_compressed_chunk_t *compressed_chunks;
  92.  
  93.   uint32_t unkf12;
  94.  
  95.   // read if 0 <= licensee < 0x88
  96.   uint32_t unkf13;
  97. } pkg_t;
  98.  
  99. typedef enum {
  100.   PKG_E_OK = 0,
  101. } pkg_error_t;
  102.  
  103. pkg_error_t pkg_create(uint8_t *data, uint32_t size, pkg_t **pkgp);
  104. void pkg_destroy(pkg_t *pkg);
  105.  
  106.  
  107. #endif /* _PKG_H_ */
Advertisement
Add Comment
Please, Sign In to add comment