Add embedded resources for universal script handling (ScriptResources)
This commit is contained in:
39
Il2CppInspector.Common/Outputs/ScriptResources/ida-api.py
Normal file
39
Il2CppInspector.Common/Outputs/ScriptResources/ida-api.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# IDA-specific implementation
|
||||
import idaapi
|
||||
|
||||
def SetName(addr, name):
|
||||
ret = idc.set_name(addr, name, SN_NOWARN | SN_NOCHECK)
|
||||
if ret == 0:
|
||||
new_name = name + '_' + str(addr)
|
||||
ret = idc.set_name(addr, new_name, SN_NOWARN | SN_NOCHECK)
|
||||
|
||||
def MakeFunction(start):
|
||||
ida_funcs.add_func(start)
|
||||
|
||||
def DefineCode(code):
|
||||
idc.parse_decls(code)
|
||||
|
||||
def SetFunctionType(addr, sig):
|
||||
SetType(addr, sig)
|
||||
|
||||
def SetType(addr, type):
|
||||
ret = idc.SetType(addr, type)
|
||||
if ret is None:
|
||||
print('SetType(0x%x, %r) failed!' % (addr, type))
|
||||
|
||||
def SetComment(addr, text):
|
||||
idc.set_cmt(addr, text, 1)
|
||||
|
||||
def SetHeaderComment(addr, text):
|
||||
SetComment(addr, text)
|
||||
|
||||
def CustomInitializer():
|
||||
print('Processing Types')
|
||||
|
||||
original_macros = ida_typeinf.get_c_macros()
|
||||
ida_typeinf.set_c_macros(original_macros + ";_IDA_=1")
|
||||
idc.parse_decls("%TYPE_HEADER_RELATIVE_PATH%", idc.PT_FILE)
|
||||
ida_typeinf.set_c_macros(original_macros)
|
||||
|
||||
def GetScriptDirectory():
|
||||
return os.path.dirname(os.path.realpath(__file__))
|
||||
Reference in New Issue
Block a user