Skip to content

Commit 2ac84d6

Browse files
authored
Merge pull request #2 from Lxeon/master
pull request
2 parents aec2ff5 + abad71c commit 2ac84d6

File tree

7 files changed

+75
-39
lines changed

7 files changed

+75
-39
lines changed

gamedata/core.games/common.games.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
"game" "tf2classic"
197197
"game" "pf2"
198198
"game" "dystopia"
199+
"game" "treason"
199200
}
200201

201202
"Keys"
@@ -252,6 +253,7 @@
252253
"game" "tf2classic"
253254
"game" "pf2"
254255
"game" "dystopia"
256+
"game" "treason"
255257
}
256258

257259
"Keys"
@@ -370,6 +372,7 @@
370372
"engine" "blade"
371373
"engine" "insurgency"
372374
"engine" "mcv"
375+
"engine" "doi"
373376
}
374377

375378
"Keys"

gamedata/sdktools.games/game.cstrike.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,19 @@
147147
"linux64" "212"
148148
}
149149
}
150+
151+
"Signatures"
152+
{
153+
"LookupAttachment"
154+
{
155+
/* CBaseAnimating::LookupAttachment */
156+
/* String: "vehicle_driver_eyes", middle length top function, with 4 calls, pick the first one. */
157+
"library" "server"
158+
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x80\xBE\x2A\x03\x00\x00\x00\x75\x2A\x83\xBE\x2A\x04\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\x86\x2A\x04\x00\x00\x85\xC0\x74\x2A\x83\x38\x00\x74\x2A\xFF\x75\x08\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x08\x40"
159+
"windows64" "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x80\xB9\x55\x04\x00\x00\x00\x48\x8B\xFA\x48\x8B\xD9\x75\x2A\x48\x83\xB9\xB0\x05\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x48\x85\xC0\x74\x2A\x48\x8B\xCB\xE8\x2A\x2A\x2A\x2A\x48\x8B\x8B\xB0\x05\x00\x00\x48\x85\xC9\x74\x2A\x48\x83\x39\x00\x74\x2A\x48\x8B\xD7\xE8"
160+
"linux" "@_ZN14CBaseAnimating16LookupAttachmentEPKc"
161+
"linux64" "@_ZN14CBaseAnimating16LookupAttachmentEPKc"
162+
}
163+
}
150164
}
151165
}

gamedata/sdktools.games/game.dod.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,19 @@
128128
"GameRulesProxy" "CDODGameRulesProxy"
129129
"GameRulesDataTable" "dod_gamerules_data"
130130
}
131+
132+
"Signatures"
133+
{
134+
"LookupAttachment"
135+
{
136+
/* CBaseAnimating::LookupAttachment */
137+
/* String: "vehicle_driver_eyes", middle length top function, with 4 calls, pick the first one. */
138+
"library" "server"
139+
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x80\xBE\x2A\x03\x00\x00\x00\x75\x2A\x83\xBE\x2A\x04\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\x86\x2A\x04\x00\x00\x85\xC0\x74\x2A\x83\x38\x00\x74\x2A\xFF\x75\x08\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x08\x40"
140+
"windows64" "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x80\xB9\x55\x04\x00\x00\x00\x48\x8B\xFA\x48\x8B\xD9\x75\x2A\x48\x83\xB9\xB0\x05\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x48\x85\xC0\x74\x2A\x48\x8B\xCB\xE8\x2A\x2A\x2A\x2A\x48\x8B\x8B\xB0\x05\x00\x00\x48\x85\xC9\x74\x2A\x48\x83\x39\x00\x74\x2A\x48\x8B\xD7\xE8"
141+
"linux" "@_ZN14CBaseAnimating16LookupAttachmentEPKc"
142+
"linux64" "@_ZN14CBaseAnimating16LookupAttachmentEPKc"
143+
}
144+
}
131145
}
132146
}

gamedata/sdktools.games/game.hl2mp.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
{
1717
"Signatures"
1818
{
19-
/* CBaseAnimating::LookupAttachment */
2019
"LookupAttachment"
2120
{
21+
/* CBaseAnimating::LookupAttachment */
22+
/* String: "vehicle_driver_eyes", middle length top function, with 4 calls, pick the first one. */
2223
"library" "server"
23-
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x80\xBE\x31\x03\x00\x00\x00\x75\x2A\x83\xBE\x50\x04\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\x86\x50\x04\x00\x00\x85\xC0\x74\x2A\x83\x38\x00\x74\x2A\xFF\x75\x08\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x08\x40"
24+
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x80\xBE\x2A\x03\x00\x00\x00\x75\x2A\x83\xBE\x2A\x04\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x8B\x86\x2A\x04\x00\x00\x85\xC0\x74\x2A\x83\x38\x00\x74\x2A\xFF\x75\x08\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x08\x40"
25+
"windows64" "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x80\xB9\x55\x04\x00\x00\x00\x48\x8B\xFA\x48\x8B\xD9\x75\x2A\x48\x83\xB9\xB0\x05\x00\x00\x00\x75\x2A\xE8\x2A\x2A\x2A\x2A\x48\x85\xC0\x74\x2A\x48\x8B\xCB\xE8\x2A\x2A\x2A\x2A\x48\x8B\x8B\xB0\x05\x00\x00\x48\x85\xC9\x74\x2A\x48\x83\x39\x00\x74\x2A\x48\x8B\xD7\xE8"
2426
"linux" "@_ZN14CBaseAnimating16LookupAttachmentEPKc"
27+
"linux64" "@_ZN14CBaseAnimating16LookupAttachmentEPKc"
2528
}
2629
"FireOutput"
2730
{

pushbuild.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ travis stole my shoe, once.
7878
I love my anime wife.
7979
Make the world your clam
8080
you guys ever have gay thoughts
81-
quick before sappho gets mad!
81+
quick before sappho gets mad! x2

sourcepawn

tools/ida_scripts/vtable_dump.py

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#from __future__ import print_function
12
"""vtable_dump.py: IDAPython script to dump a linux vtable (and a reconstructed windows one) from a binary."""
23

34
"""
@@ -43,6 +44,7 @@
4344
offsetdata = {}
4445

4546
# Detect address size
47+
__EA64__ = ida_idaapi.BADADDR == 0xFFFFFFFFFFFFFFFF
4648
adr_size = 8 if __EA64__ else 4
4749

4850
def ExtractTypeInfo(ea, level = 0):
@@ -56,14 +58,14 @@ def ExtractTypeInfo(ea, level = 0):
5658
while len(Name(end)) == 0:
5759
end += adr_size
5860

59-
while Dword(end - adr_size) == 0:
61+
while (end - adr_size) == 0:
6062
end -= adr_size
6163

6264
# Skip vtable
6365
ea += adr_size
6466

6567
# Get type name
66-
name = Demangle("_Z" + GetString(Dword(ea)), GetLongPrm(INF_LONG_DN))
68+
name = idc.demangle_name("_Z" + ida_bytes.get_strlit_contents(ea), ida_ida.inf_get_long_demnames())
6769
ea += adr_size
6870

6971
if classname is None and level == 0:
@@ -73,20 +75,20 @@ def ExtractTypeInfo(ea, level = 0):
7375
innerclass = name
7476
catchclass = False
7577

76-
print " %*s%s" % (level, "", name)
78+
print(" %*s%s" % (level, "", name))
7779

7880
if not ea < end: # Base Type
7981
pass
80-
elif Dword(ea) != 0: #elif isData(GetFlags(Dword(ea))): # Single Inheritance
81-
ExtractTypeInfo(Dword(ea), level + 1)
82+
elif ea != 0: #elif isData(GetFlags(ea)): # Single Inheritance
83+
ExtractTypeInfo(ea, level + 1)
8284
ea += adr_size
8385
else: # Multiple Inheritance
8486
ea += 8
8587
while ea < end:
8688
catchclass = True
87-
ExtractTypeInfo(Dword(ea), level + 1)
89+
ExtractTypeInfo(ea, level + 1)
8890
ea += adr_size
89-
offset = Dword(ea)
91+
offset = ea
9092
ea += adr_size
9193
#print "%*s Offset: 0x%06X" % (level, "", offset >> 8)
9294
if (offset >> 8) != 0:
@@ -100,29 +102,29 @@ def twos_comp(val, bits):
100102
return val
101103

102104
def Analyze():
103-
SetStatus(IDA_STATUS_WORK)
105+
ida_auto.set_ida_state(IDA_STATUS_WORK)
104106

105-
if GetLongPrm(INF_COMPILER).id != COMP_GNU:
107+
if ida_ida.inf_get_cc_id() != COMP_GNU:
106108
Warning("This script is for binaries compiled with GCC only.")
107-
SetStatus(IDA_STATUS_READY)
109+
ida_auto.set_ida_state(IDA_STATUS_READY)
108110
return
109111

110-
ea = ScreenEA()
112+
ea = idc.get_screen_ea()
111113

112114
end = ea + adr_size
113-
while Demangle(Name(end), GetLongPrm(INF_LONG_DN)) is None:
115+
while idc.demangle_name(idc.get_name(end, ida_name.GN_VISIBLE), ida_ida.inf_get_long_demnames()) is None:
114116
end += adr_size
115117

116-
while Dword(end - adr_size) == 0:
118+
while (end - adr_size) == 0:
117119
end -= adr_size
118120

119-
while Demangle(Name(ea), GetLongPrm(INF_LONG_DN)) is None:
121+
while idc.demangle_name(idc.get_name(ea, ida_name.GN_VISIBLE), ida_ida.inf_get_long_demnames()) is None:
120122
ea -= adr_size
121123

122-
name = Demangle(Name(ea), GetLongPrm(INF_LONG_DN))
123-
if ea == BADADDR or name is None or not re.search(r"vf?table(?: |'\{)for", name):
124+
name = idc.demangle_name(idc.get_name(ea, ida_name.GN_VISIBLE), ida_ida.inf_get_long_demnames())
125+
if ea == ida_idaapi.BADADDR or name is None or not re.search(r"vf?table(?: |'\{)for", name):
124126
Warning("No vtable selected!\nSelect vtable block first.")
125-
SetStatus(IDA_STATUS_READY)
127+
ida_auto.set_ida_state(IDA_STATUS_READY)
126128
return
127129

128130
linux_vtable = []
@@ -135,22 +137,22 @@ def Analyze():
135137
# Extract vtable
136138
while ea < end:
137139
# Read thisoffs
138-
offset = -twos_comp(Dword(ea), 32)
140+
offset = -twos_comp(ea, 32)
139141
#print "Offset: 0x%08X (%08X)" % (offset, ea)
140142
ea += adr_size
141143

142144
# Read typeinfo address
143-
typeinfo = Dword(ea)
145+
typeinfo = ea
144146
ea += adr_size
145147

146148
if offset == 0: # We only need to read this once
147-
print "Inheritance Tree:"
149+
print("Inheritance Tree:")
148150
ExtractTypeInfo(typeinfo)
149151

150-
while ea < end and (isCode(GetFlags(Dword(ea))) or Name(Dword(ea)) == "___cxa_pure_virtual"):
151-
name = Name(Dword(ea))
152-
demangled = Demangle(name, GetLongPrm(INF_LONG_DN))
153-
#print "Name: %s, Demangled: %s" % (name, demangled)
152+
while (ea < end) and (ida_bytes.is_code(ida_bytes.get_full_flags(ea)) or idc.get_name(ea, ida_name.GN_VISIBLE) == "___cxa_pure_virtual"):
153+
name = idc.get_name(ea, ida_name.GN_VISIBLE)
154+
demangled = idc.demangle_name(name, ida_ida.inf_get_long_demnames())
155+
#print "Name: %s, idc.demangle_named: %s" % (name, demangled)
154156

155157
name = demangled if demangled else name
156158

@@ -216,18 +218,18 @@ def Analyze():
216218
while len(overload_stack) > 0:
217219
windows_vtable.append(overload_stack.pop())
218220

219-
print "\nVTable for %s: (0, 0)" % (classname)
220-
print " Lin Win Function"
221+
print("\nVTable for %s: (0, 0)" % (classname))
222+
print(" Lin Win Function")
221223
for i, v in enumerate(linux_vtable):
222224
if "__cxa_pure_virtual" in v:
223-
print "P%3d" % (i)
225+
print("P%3d" % (i))
224226
continue
225227

226228
winindex = windows_vtable.index(v) if v in windows_vtable else None
227229
if winindex is not None:
228-
print "%4d %4d %s" % (i, winindex, v)
230+
print("%4d %4d %s" % (i, winindex, v))
229231
else:
230-
print "%4d %s" % (i, v)
232+
print("%4d %s" % (i, v))
231233

232234
for k in temp_other_windows_vtables:
233235
for i, v in enumerate(temp_other_windows_vtables[k]):
@@ -260,20 +262,20 @@ def Analyze():
260262
prev_symbol = v
261263

262264
for k in other_linux_vtables:
263-
print "\nVTable for %s: (%d, %d)" % (offsetdata[k], offsetdata.keys().index(k) + 1, k)
264-
print " Lin Win Function"
265+
print("\nVTable for %s: (%d, %d)" % (offsetdata[k], offsetdata.keys().index(k) + 1, k))
266+
print(" Lin Win Function")
265267
for i, v in enumerate(other_linux_vtables[k]):
266268
if "__cxa_pure_virtual" in v:
267-
print "P%3d" % (i)
269+
print("P%3d" % (i))
268270
continue
269271

270272
winindex = other_windows_vtables[k].index(v)
271273
if v not in other_thunk_linux_vtables[k]:
272-
print "%4d %4d %s" % (i, winindex, v)
274+
print("%4d %4d %s" % (i, winindex, v))
273275
else:
274-
print "T%3d %4d %s" % (i, winindex, v)
276+
print("T%3d %4d %s" % (i, winindex, v))
275277

276-
SetStatus(IDA_STATUS_READY)
278+
ida_auto.set_ida_state(IDA_STATUS_READY)
277279

278280
if __name__ == '__main__':
279281
Analyze()

0 commit comments

Comments
 (0)