Page 1 of 1

VM complexity scripting function

Posted: Wed Jun 11, 2025 4:00 am
by lach
It is possible to set virtualization complexity on per-function basis using GUI, but there is no method to control that in LUA class IntelFunction

Re: VM complexity scripting function

Posted: Fri Jun 13, 2025 5:18 am
by Admin
Added in the 2377 build.

Re: VM complexity scripting function

Posted: Fri Jun 13, 2025 3:09 pm
by lach
IntelFunction:setComplexity, I see, thanks!

Re: VM complexity scripting function

Posted: Mon Sep 08, 2025 2:28 pm
by vmenter
Hey, I just discovered this function, so far it wasn't documented.
I went ahead and tried it, it seems to set a numeric value to the lua bound function variable, but the value has absolutely no impact on the actual complexity. Regardless of what I set the value to, the function runs at the same speed, 1 or 100 doesn't matter.
Doing so in the UI has a drastic affect on the speed so that seems to work (Using 3.9.6).
In case Im using it wrong, heres the 3 lines:

Code: Select all

local Func = File:functions():addByAddress(MapFunc:address(), CompilationType.Virtualization)
assert(Func)
Func:setComplexity(1)

Re: VM complexity scripting function

Posted: Thu Sep 11, 2025 4:06 am
by Admin
The Complexity only affects the size of virtualized code and doesn't affect its speed.

Re: VM complexity scripting function

Posted: Thu Sep 11, 2025 10:02 am
by vmenter
Admin wrote: Thu Sep 11, 2025 4:06 am The Complexity only affects the size of virtualized code and doesn't affect its speed.
Thanks for your answer!
After some debugging I figured out that you are right, the reason the VM is so much slower is that the Import Protection feature is enabled.
Apparently, that makes the vmenter/exit much much slower which leads to bad performance in my code as the function is called VERY frequently but doesn't have much code to execute.
Do you think it would be possible to add an option to generate a different VM for certain functions that doesn't bother with import protection?
The current workaround is to simply apply VMP twice in a row which doesn't feel very robust...

Re: VM complexity scripting function

Posted: Mon Sep 22, 2025 9:21 pm
by bigproblem
а можно такую только для SDK c++
VMProtectBeginVirtualization(__FUNCTION__);
vmp_set_complexity