- Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathFrameScript_Object__FillScriptMethodTable.idc
More file actions
Latest commit
101 lines (83 loc) · 2.9 KB
/
Copy pathFrameScript_Object__FillScriptMethodTable.idc
File metadata and controls
101 lines (83 loc) · 2.9 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include<idc.idc>
/************************************************************************
Desc: Label each lua function based on its appropriate name
Author: kynox
Credit: bobbysing for RenameFunc
Website: http://www.gamedeception.net
*************************************************************************/
// 1 = Success, 0 = Failure
staticRenameFunc(dwAddress, sFunction)
{
auto dwRet;
auto part=substr(GetFunctionName(dwAddress), 0, 7);
if (part!="Script_")
{
auto oldName=GetFunctionName(dwAddress);
dwRet=MakeNameEx(dwAddress, sFunction, SN_NOWARN);
if (dwRet==0)
{
auto sTemp, i;
for (i=1; i<32; i++)
{
sTemp=form("%s_%i", sFunction, i);
if ((dwRet=MakeNameEx(dwAddress, sTemp, SN_NOWARN)) !=0)
{
// Message( "Info: Renamed to %s instead of %s\n", sTemp, sFunction );
break;
}
}
if (i==31)
Message("-- Error --: Failed to rename %s -> %s\n", oldName, sFunction);
}
else
Message("%s 0x%X\n", sFunction, dwAddress);
}
returndwRet;
}
staticLuafunc_GetName(structAddr)
{
returnGetString(Qword(structAddr), -1, ASCSTR_C);
}
staticLuafunc_GetFunc(structAddr)
{
returnQword(structAddr+8);
}
staticHandleLuaFunc(structBase)
{
auto funcName, funcAddr;
funcName=Luafunc_GetName(structBase);
funcAddr=Luafunc_GetFunc(structBase);
RenameFunc(funcAddr, form("CSimpleSlider_%s", funcName));
}
staticmain()
{
auto registerFunc, xRef;
registerFunc=registerFunc=FindBinary(0, SEARCH_DOWN, "45 85 C0 7E 5B 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B DA 49 63 F0 48 8B F9 0F 1F 00 48 8B 13 48 8B CF E8 ? ? ? ? 48 8B 53 08");
Message("FrameScript_Object__FillScriptMethodTable at 0x%X\n", registerFunc);
for (xRef=RfirstB(registerFunc); xRef!=BADADDR; xRef=RnextB(registerFunc, xRef))
{
auto structBase;
auto numFuncs, i, blahh, operandValue;
blahh= (xRef-0xF);
operandValue=GetOperandValue(blahh, 0);
if (operandValue=="0x2")
{
structBase=GetOperandValue(xRef-0xF, 1);
numFuncs=GetOperandValue(xRef-0x15, 1); // 5 works aswell but wrong
}
else
{
structBase=GetOperandValue(xRef-0x7, 1);
numFuncs=GetOperandValue(xRef-0xD, 1);
}
if (numFuncs<2000&&numFuncs>0)
{
//Message( "Found 0x%x, count: 0x%x\n", structBase, numFuncs);
for (i=0; i<numFuncs; i++)
{
HandleLuaFunc(structBase);
structBase=structBase+0x10;
}
}
}
}