This is working code but I was wondering how I could do the / 4 inside the dll.
also is there a way to combine these lines?
buffer[i] ^= secretKey;
buffer[i] -= seed;
Code: Select all
set MEMORY_FILE10 string "
typedef unsigned char u8;
typedef unsigned int u32;
static u32 secretKey = 0x45AF6E5D;
void Decrypt(u8* data, int data_size, int seed, int xored_size)
{
u32* buffer = (u32*)(data);
int remained = data_size % 4;
u8* remained_data = (u8*)(buffer);
if (xored_size > 0)
{
for (int i = 0; i < xored_size; i++)
{
buffer[i] ^= secretKey;
buffer[i] -= seed;
}
}
}
"
idstring "\x43\x4F\x44\x45\x00\x01\x55\x77"
get CRC32 long
get SEED long
get SIZE asize
math SIZE - 16
set LOOP SIZE
math LOOP / 4
get NAME basename
string NAME + .png
log MEMORY_FILE 16 SIZE
calldll MEMORY_FILE10 "Decrypt" "tcc" RET MEMORY_FILE TABLE_SIZE SEED LOOP
log NAME 0 SIZE MEMORY_FILE