🚧 Prepare argv parsing

This commit is contained in:
C-3PO 2018-07-24 18:17:15 +02:00
parent 866f6afd5a
commit 1638e9047d
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -10,24 +10,34 @@
int main(int argc, unsigned char *argv[]) {
printf("Hello World!\n");
//TODO: verify argv and assign it to variables
char* archiveName = "1234";
const unsigned long archiveOffset = 0UL;
const unsigned long fileLength = 0xffffUL;
uint32_t key0 = 0;
uint32_t key1 = 0;
uint32_t key2 = 0;
//Initialise file reader
initFileReader("1234", 0UL);
initFileReader(archiveName, archiveOffset);
//Skip header (30 bytes + additional length)
char* fileHeader = getBytes(30UL);
printf(fileHeader);
//TODO: check that header is correct
//TODO: read additional length
const unsigned long additionalLength = 0UL;
getBytes(additionalLength);
//Initialise decryption (pass decryption keys)
initDecryptor(0, 0, 0);//TODO
initDecryptor(key0, key1, key2);
//Skip 12-byte encryption header
char* encryptionHeader = getBytes(12UL);
decrypt(encryptionHeader, 12);
const unsigned long encrHeaderLength = 12UL;
char* encrHeader = getBytes(encrHeaderLength);
decrypt(encrHeader, encrHeaderLength);
//Read actual file
unsigned long remainingBytes = 0xFFFF;//TODO
unsigned long remainingBytes = fileLength;
while (remainingBytes > 0) {
const unsigned long chunkSize = min(0xFF, remainingBytes);
char* chunk = getBytes(chunkSize);