mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
Misc.
This commit is contained in:
parent
763f4aeb95
commit
308312f54a
3 changed files with 24 additions and 18 deletions
|
|
@ -19,4 +19,12 @@ struct stream {
|
||||||
p += sizeof(T) * len;
|
p += sizeof(T) * len;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
template <typename T>
|
||||||
|
void operator=(const T &v) {
|
||||||
|
memcpy(p, (uint8_t*)&v, sizeof(v));
|
||||||
|
p += sizeof(v);
|
||||||
|
}
|
||||||
|
void skip(size_t len) {
|
||||||
|
p += len;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,20 @@ struct ModificatorMask
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct pak {
|
struct pak {
|
||||||
|
static constexpr uint32_t default_block_size = 0x4000;
|
||||||
|
|
||||||
|
struct segment {
|
||||||
|
// some file offset? trash? crc? m1 has zlib crc table (png)?
|
||||||
|
uint32_t unk1;
|
||||||
|
uint32_t algorithm;
|
||||||
|
uint32_t offset;
|
||||||
|
};
|
||||||
|
struct file_description {
|
||||||
|
char name[0x50];
|
||||||
|
uint32_t offset;
|
||||||
|
uint32_t size;
|
||||||
|
};
|
||||||
|
|
||||||
uint32_t magic;
|
uint32_t magic;
|
||||||
uint16_t unk0;
|
uint16_t unk0;
|
||||||
uint32_t n_files;
|
uint32_t n_files;
|
||||||
|
|
@ -334,20 +348,4 @@ struct pak {
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
uint32_t unk1;
|
uint32_t unk1;
|
||||||
};
|
};
|
||||||
struct file_description {
|
|
||||||
const char name[0x50];
|
|
||||||
uint32_t offset;
|
|
||||||
uint32_t size;
|
|
||||||
};
|
|
||||||
struct segment {
|
|
||||||
enum decode_algorithm : uint32_t {
|
|
||||||
none = 0x0,
|
|
||||||
// none = 0x1, // ?
|
|
||||||
};
|
|
||||||
|
|
||||||
// some file offset? trash? crc? m1 has zlib crc table (png)?
|
|
||||||
uint32_t unk1;
|
|
||||||
decode_algorithm algorithm;
|
|
||||||
uint32_t offset;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ void unpack_file(path fn) {
|
||||||
primitives::templates2::mmap_file<uint8_t> f{fn};
|
primitives::templates2::mmap_file<uint8_t> f{fn};
|
||||||
stream s{f};
|
stream s{f};
|
||||||
pak p = s;
|
pak p = s;
|
||||||
auto descs = s.span<file_description>(p.n_files);
|
auto descs = s.span<pak::file_description>(p.n_files);
|
||||||
auto segments = s.span<segment>(p.n_blocks);
|
auto segments = s.span<pak::segment>(p.n_blocks);
|
||||||
std::vector<uint8_t> decoded;
|
std::vector<uint8_t> decoded;
|
||||||
decoded.resize((segments.size() + 1) * p.block_size * 4);
|
decoded.resize((segments.size() + 1) * p.block_size * 4);
|
||||||
auto pp = decoded.data();
|
auto pp = decoded.data();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue