|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
Go to the source code of this file.
Macros | |
| #define | JUNK_MAP_HEADER_SIZE 8 |
Functions | |
| static uint16_t | read_le16 (const uint8_t *p) |
| static uint32_t | read_le32 (const uint8_t *p) |
| static uint64_t | read_le64 (const uint8_t *p) |
| static void | write_le16 (uint8_t *p, uint16_t v) |
| static void | write_le32 (uint8_t *p, uint32_t v) |
| static void | write_le64 (uint8_t *p, uint64_t v) |
| int32_t | ngcw_serialize_junk_map (const NgcwJunkEntry *entries, uint32_t count, uint8_t **out_data, uint32_t *out_len) |
| Serialize a junk map for storage as a media tag. | |
| int32_t | ngcw_deserialize_junk_map (const uint8_t *data, uint32_t data_len, NgcwJunkEntry **entries, uint32_t *count, uint16_t *seed_size) |
| Deserialize a junk map from a media tag buffer. | |
| int | ngcw_regenerate_junk_sector (const NgcwJunkEntry *entries, uint32_t entry_count, uint64_t disc_offset, uint8_t *output, uint32_t length) |
| Regenerate a junk sector from the junk map. | |
| void | ngcw_junk_lazy_init (aaruformat_context *ctx) |
| Lazy initialization: load junk map from media tags. | |
| #define JUNK_MAP_HEADER_SIZE 8 |
Definition at line 73 of file ngcw_junk.c.
Referenced by ngcw_deserialize_junk_map(), ngcw_junk_lazy_init(), and ngcw_serialize_junk_map().
| int32_t ngcw_deserialize_junk_map | ( | const uint8_t * | data, |
| uint32_t | data_len, | ||
| NgcwJunkEntry ** | entries, | ||
| uint32_t * | count, | ||
| uint16_t * | seed_size ) |
Deserialize a junk map from a media tag buffer.
| data | Serialized data buffer. |
| data_len | Length of the data buffer. |
| entries | Output: malloc'd array of NgcwJunkEntry (caller must free). |
| count | Output: number of entries. |
| seed_size | Output: seed size in uint32 words. |
< Current junk map serialization version.
< Number of uint32 words needed to seed the LFG.
Definition at line 104 of file ngcw_junk.c.
References JUNK_MAP_HEADER_SIZE, NgcwJunkEntry::length, NGC_LFG_SEED_SIZE, ngcw_deserialize_junk_map(), NGCW_JUNK_MAP_VERSION, NgcwJunkEntry::offset, NgcwJunkEntry::partition_index, read_le16(), read_le32(), and read_le64().
Referenced by ngcw_deserialize_junk_map(), and ngcw_junk_lazy_init().
| void ngcw_junk_lazy_init | ( | aaruformat_context * | ctx | ) |
Lazy initialization: load junk map from media tags.
Populates ctx->ngcw_junk_entries from the kMediaTagNgcwJunkMap media tag.
| ctx | AaruFormat context. |
Definition at line 211 of file ngcw_junk.c.
References mediaTagEntry::data, JUNK_MAP_HEADER_SIZE, kMediaTagNgcwJunkMap, mediaTagEntry::length, aaruformat_context::mediaTags, ngcw_deserialize_junk_map(), aaruformat_context::ngcw_junk_entries, aaruformat_context::ngcw_junk_entry_count, ngcw_junk_lazy_init(), and aaruformat_context::ngcw_junk_seed_size.
Referenced by aaruf_read_sector(), and ngcw_junk_lazy_init().
| int ngcw_regenerate_junk_sector | ( | const NgcwJunkEntry * | entries, |
| uint32_t | entry_count, | ||
| uint64_t | disc_offset, | ||
| uint8_t * | output, | ||
| uint32_t | length ) |
Regenerate a junk sector from the junk map.
Looks up the given disc byte offset in the junk map, initializes the LFG with the matching entry's seed, advances to the correct stream position, and generates the requested number of bytes.
| entries | Array of junk entries (sorted by offset). |
| entry_count | Number of entries. |
| disc_offset | Disc byte offset of the sector to regenerate. |
| output | Output buffer to fill. |
| length | Number of bytes to generate. |
< Number of uint32 words needed to seed the LFG.
Definition at line 154 of file ngcw_junk.c.
References NgcwJunkEntry::length, ngc_lfg_get_bytes(), NGC_LFG_SEED_SIZE, ngc_lfg_set_seed(), ngcw_regenerate_junk_sector(), and NgcwJunkEntry::offset.
Referenced by aaruf_read_sector(), and ngcw_regenerate_junk_sector().
| int32_t ngcw_serialize_junk_map | ( | const NgcwJunkEntry * | entries, |
| uint32_t | count, | ||
| uint8_t ** | out_data, | ||
| uint32_t * | out_len ) |
Serialize a junk map for storage as a media tag.
Format (all little-endian): [2 bytes] version (uint16) [4 bytes] entry_count (uint32) [2 bytes] seed_size (uint16) — NGC_LFG_SEED_SIZE For each entry (86 bytes when seed_size=17): [8 bytes] offset (uint64) [8 bytes] length (uint64) [2 bytes] partition_index (uint16) [seed_size * 4 bytes] seed (raw bytes, big-endian uint32 words)
| entries | Array of junk entries. |
| count | Number of entries. |
| out_data | Output: malloc'd buffer (caller must free). |
| out_len | Output: length of the buffer. |
< Number of uint32 words needed to seed the LFG.
< Current junk map serialization version.
< Number of uint32 words needed to seed the LFG.
< Number of uint32 words needed to seed the LFG.
Definition at line 75 of file ngcw_junk.c.
References JUNK_MAP_HEADER_SIZE, NGC_LFG_SEED_SIZE, NGCW_JUNK_MAP_VERSION, ngcw_serialize_junk_map(), write_le16(), write_le32(), and write_le64().
Referenced by ngcw_serialize_junk_map().
|
static |
Definition at line 30 of file ngcw_junk.c.
References read_le16().
Referenced by ngcw_deserialize_junk_map(), and read_le16().
|
static |
Definition at line 32 of file ngcw_junk.c.
References read_le32().
Referenced by ngcw_deserialize_junk_map(), ps3_deserialize_encryption_map(), read_le32(), read_le32(), read_le32(), read_le32(), read_le64(), wii_deserialize_partition_key_map(), and wiiu_deserialize_partition_key_map().
|
static |
Definition at line 35 of file ngcw_junk.c.
References read_le32(), and read_le64().
Referenced by ngcw_deserialize_junk_map(), and read_le64().
|
static |
Definition at line 37 of file ngcw_junk.c.
References write_le16().
Referenced by ngcw_serialize_junk_map(), and write_le16().
|
static |
Definition at line 43 of file ngcw_junk.c.
References write_le32().
Referenced by ngcw_serialize_junk_map(), ps3_serialize_encryption_map(), wii_serialize_partition_key_map(), wiiu_serialize_partition_key_map(), write_le32(), write_le32(), write_le32(), write_le32(), and write_le64().
|
static |
Definition at line 51 of file ngcw_junk.c.
References write_le32(), and write_le64().
Referenced by ngcw_serialize_junk_map(), and write_le64().