-
Notifications
You must be signed in to change notification settings - Fork 2
/
FreeBlock.cpp
66 lines (53 loc) · 1.9 KB
/
FreeBlock.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "precomp.h"
CKObjectDeclaration *FillBehaviorFreeBlockDecl();
CKERROR CreateFreeBlockProto(CKBehaviorPrototype **);
int FreeBlock(const CKBehaviorContext& behcontext);
CKObjectDeclaration *FillBehaviorFreeBlockDecl()
{
CKObjectDeclaration *od = CreateCKObjectDeclaration("FreeBlock");
od->SetDescription("A block that you can manipulate anything easily.");
/* rem:
<SPAN CLASS=in>In K: </SPAN>any of the inputs will trigger the process.<BR>
<SPAN CLASS=out>Out K: </SPAN>if the building block is activated, all the outputs are then activated.<BR>
<BR>
This convenient building block acts just like an interface object in the schematique.<BR>
You can add as many inputs and outputs as needed.<BR>
<BR>
*/
od->SetType(CKDLL_BEHAVIORPROTOTYPE);
od->SetGuid(CKGUID(0x51f76780, 0x6c896f5b));
od->SetAuthorGuid(VIRTOOLS_GUID);
od->SetAuthorName("BearKidsTeam");
od->SetVersion(0x00010000);
od->SetCreationFunction(CreateFreeBlockProto);
od->SetCompatibleClassId(CKCID_BEOBJECT);
od->SetCategory("Custom/VirtoolsScriptDeobfuscation");
return od;
}
CKERROR CreateFreeBlockProto(CKBehaviorPrototype **pproto)
{
CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("FreeBlock");
if (!proto) return CKERR_OUTOFMEMORY;
// proto->DeclareInput("In 0");
// proto->DeclareOutput("Out 0");
proto->SetBehaviorFlags((CK_BEHAVIOR_FLAGS)(CKBEHAVIOR_VARIABLEINPUTS |
CKBEHAVIOR_VARIABLEOUTPUTS | CKBEHAVIOR_VARIABLEPARAMETERINPUTS |
CKBEHAVIOR_VARIABLEPARAMETEROUTPUTS | CKBEHAVIOR_TARGETABLE));
proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
proto->SetFunction(FreeBlock);
*pproto = proto;
return CK_OK;
}
int FreeBlock(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
int i, count = beh->GetInputCount();
for (i = 0; i<count; ++i) {
beh->ActivateInput(i, FALSE);
}
count = beh->GetOutputCount();
for (i = 0; i<count; ++i) {
beh->ActivateOutput(i);
}
return CKBR_OK;
}