Fusee: Change package2 loading logic (untested)

This commit is contained in:
TuxSH
2018-05-17 15:56:02 +02:00
parent 5088851de4
commit 1b07a07353
5 changed files with 109 additions and 59 deletions

View File

@@ -51,8 +51,19 @@ typedef struct {
package2_meta_t metadata;
uint8_t encrypted_header[0x100];
};
uint8_t data[];
} package2_header_t;
/* Package2 can be encrypted or unencrypted for these functions: */
static inline size_t package2_meta_get_size(const package2_meta_t *metadata) {
return metadata->ctr_dwords[0] ^ metadata->ctr_dwords[2] ^ metadata->ctr_dwords[3];
}
static inline uint8_t package2_meta_get_header_version(const package2_meta_t *metadata) {
return (uint8_t)((metadata->ctr_dwords[1] ^ (metadata->ctr_dwords[1] >> 16) ^ (metadata->ctr_dwords[1] >> 24)) & 0xFF);
}
void package2_rebuild_and_copy(package2_header_t *package2, uint32_t target_firmware);
#endif