added MV_CFF, MV_OMIT_CFF & MV_OMIT_VM macros

This commit is contained in:
2025-09-14 20:08:47 -06:00
parent 2d15abca01
commit 5d34ae2cd5
4 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
---
weight: 100
title: "MV_CFF"
description: "Force a CFF pass"
icon: "code_blocks"
date: "2025-05-01T18:47:58-05:00"
lastmod: "2025-05-01T18:47:58-05:00"
---
`declare function MV_CFF<A..., R...>(vmFunction: (A...) -> R..., enableExpressionDecomposition?: boolean): (A...) -> R...`
will force the [CFF](/docs/options/flatten-control-flow) pass onto the passed function. Expression decomposition is enabled by default, but can be disabled with the second argument.
## Valid Usage
```lua
MV_CFF(function()
for i = 0, 10 do
print('this is flattened!', i)
end
MV_OMIT_CFF(function() print('this isnt') end)()
end)()
-- passing false as a second argument will disable expression decomposition, leading to much smaller output
MV_CFF(function()
for i = 0, 10 do
print('this is flattened!', i)
end
MV_OMIT_CFF(function() print('this isnt') end)()
end, false)()
```

View File

@@ -0,0 +1,24 @@
---
weight: 100
title: "MV_OMIT_CFF"
description: "Omit all CFF steps"
icon: "code_blocks"
date: "2025-05-01T18:47:58-05:00"
lastmod: "2025-05-01T18:47:58-05:00"
---
`declare function MV_OMIT_CFF<A..., R...>(cffFunction: (A...) -> R...): (A...) -> R...`
Similar to [MV_OMIT](/docs/macros/MV_OMIT), this will omit only the [CFF](/docs/options/flatten-control-flow) steps from the passed function. This can be useful to keep performance-critical sections unobfuscated but still have other AST passes applied to them.
## Valid Usage
```lua
MV_CFF(function()
for i = 0, 10 do
print('this is flattened!', i)
end
MV_OMIT_CFF(function() print('this isnt') end)()
end)()
```
> Make sure to call the macro result!

View File

@@ -15,6 +15,8 @@ When used in a virtualized block (using the [MV_VM](./MV_VM) or [MV_ENC_FUNC](./
{{% alert context="info" text="**Note**: `MV_OMIT_FUNCTION` && `LPH_NO_VIRTUALIZE` are also available aliases." /%}}
Additionally if you'd only like to only omit the function from certain passes, you can use the [MV_OMIT_CFF](./MV_OMIT_CFF) and [MV_OMIT_VM](./MV_OMIT_VM) macros.
## Valid Usage
```lua
@@ -22,7 +24,7 @@ local dontMangleMe = MV_OMIT(function()
print("this whole function is in plaintext!")
end)
donMangleMe()
dontMangleMe()
local a = MV_OMIT("plaintext string")
print(a .. "im obfuscated")

View File

@@ -0,0 +1,24 @@
---
weight: 100
title: "MV_OMIT_VM"
description: "Omit from VM"
icon: "code_blocks"
date: "2025-05-01T18:47:58-05:00"
lastmod: "2025-05-01T18:47:58-05:00"
---
`declare function MV_OMIT_VM<A..., R...>(vmFunction: (A...) -> R...): (A...) -> R...`
Similar to [MV_OMIT](/docs/macros/MV_OMIT), this will only omit the passed function from the VM. This can be useful to keep performance-critical sections unobfuscated but still have other AST passes applied to them.
## Valid Usage
```lua
MV_VM(function()
for i = 0, 10 do
print('this is virtualized!', i)
end
MV_OMIT_VM(function() print('this isnt') end)()
end)()
```
> Make sure to call the macro result!