We tried to adopt Themida VM macro option. But, our particular problem was performance of the game. It was very critical issue. We hope to know how we improve performance of my game.

<< Click to Display Table of Contents >>

Navigation:  Themida > FAQ > Macros >

We tried to adopt Themida VM macro option. But, our particular problem was performance of the game. It was very critical issue. We hope to know how we improve performance of my game.

Please, notice that when you protect an area of code in a function with a VM or CodeReplace macro, the code is converted into a highly complex and unique opcodes. Those macros are executed under a specific VM (which is included inside your protected application) that is able to understand the virtualized code. Execution of code inside the Virtual Machine is much slower than the original code.

 

Summing up, you have to avoid putting macros in the following cases:

 

1) Functions which are called many times per second

 

2) Functions which has tight loops ("for", "while", "do-while") which iterate multiple times

 

3) Critical code in your application. That is, code that must be executed as soon as possible

 

A real example could be the case that you want to protect a function, but it has a tight loop, so, you just have to put the loop outside of the macro.

 

Example:

 

void MyFunction( )

{

   VM_START

 

   // your code goes here

 

   VM_END

 

   for(i = 0; i < 0x100000; i++)

   {

       // your code

   }

 

   VM_START

 

   // your code goes here

 

   VM_END

}