SHOW:
|
|
- or go back to the newest paste.
| 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; |
| 36 | + | |
| 37 | - | uint32_t raw_data_size; |
| 37 | + | |
| 38 | ||
| 39 | uint32_t unkf0; | |
| 40 | ||
| 41 | int32_t dirnamelen; | |
| 42 | uint8_t *dirname; | |
| 43 | ||
| 44 | uint32_t flags; | |
| 45 | ||
| 46 | // read if (flags & 8) | |
| 47 | uint32_t unkf1; | |
| 48 | ||
| 49 | uint32_t name_count; | |
| 50 | uint32_t name_offset; | |
| 51 | uint32_t export_count; | |
| 52 | uint32_t export_offset; | |
| 53 | uint32_t import_count; | |
| 54 | uint32_t import_offset; | |
| 55 | uint32_t unkf2; | |
| 56 | ||
| 57 | // read if version >= 623 | |
| 58 | uint32_t unkf3; | |
| 59 | uint32_t unkf4; | |
| 60 | uint32_t unkf5; | |
| 61 | ||
| 62 | // read if version >= 584 | |
| 63 | uint32_t unkf6; | |
| 64 | ||
| 65 | // guid | |
| 66 | uint32_t g0, g1, g2, g3; | |
| 67 | ||
| 68 | uint32_t ngenerations; | |
| 69 | pkg_generation_t *generations; | |
| 70 | ||
| 71 | uint32_t enginever; | |
| 72 | uint32_t cookerver; | |
| 73 | ||
| 74 | // read if 0 < licensee < 0x88 | |
| 75 | uint32_t unkf7; | |
| 76 | ||
| 77 | // read if licensee > 0 | |
| 78 | uint32_t unkf8; | |
| 79 | uint32_t unkf9; | |
| 80 | ||
| 81 | // read if 0 < licensee < 0x88 | |
| 82 | uint32_t unkf10; | |
| 83 | uint32_t unkf11; | |
| 84 | ||
| 85 | // compression info | |
| 86 | uint32_t compression_flags; | |
| 87 | uint32_t ncompressed_chunks; | |
| 88 | pkg_compressed_chunk_t *compressed_chunks; | |
| 89 | ||
| 90 | uint32_t unkf12; | |
| 91 | ||
| 92 | // read if 0 <= licensee < 0x88 | |
| 93 | uint32_t unkf13; | |
| 94 | } pkg_t; | |
| 95 | ||
| 96 | typedef enum {
| |
| 97 | PKG_E_OK = 0, | |
| 98 | } pkg_error_t; | |
| 99 | ||
| 100 | pkg_error_t pkg_create(uint8_t *data, uint32_t size, pkg_t **pkgp); | |
| 101 | void pkg_destroy(pkg_t *pkg); | |
| 102 | ||
| 103 | ||
| 104 | #endif /* _PKG_H_ */ |