ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Jun 21, 2021 1:24 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Optimize dll
PostPosted: Wed Apr 28, 2021 2:51 pm 

Joined: Thu Aug 07, 2014 10:28 pm
Posts: 379
for some reason when I try to put the dividing number in the dll code it crashes on me.
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?
Quote:
buffer[i] ^= secretKey;
buffer[i] -= seed;

Code:
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


Attachments:
cd_15920.zip [262.92 KiB]
Downloaded 18 times
Top
   
 Post subject: Re: Optimize dll
PostPosted: Wed Apr 28, 2021 5:00 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
Do you mean quickbms.dll crashes when running that script?
Honestly I only compiled it so I can't offer much support about it but it's really weird if a crash happens on a simple instruction.

Luckily you can replace divisions with other solutions, for example "/ 4" -> ">> 2".

For the other question:
buffer[i] = (buffer[i] ^ secretKey) - seed;


Top
   
 Post subject: Re: Optimize dll
PostPosted: Wed Apr 28, 2021 5:23 pm 

Joined: Thu Aug 07, 2014 10:28 pm
Posts: 379
that worked great thanks. :D


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited