├── namespacer.py ├── ThisCallReplacer.py ├── CreateFunctionsFromArray.py ├── signfunction.py ├── Imports fixer.py ├── FunctionExporter.py ├── StackArgumentsSearcher.py ├── CustomRegisters.py ├── ArgumentsUnifier.py └── ArgumentsRenamer.py /namespacer.py: -------------------------------------------------------------------------------- 1 | #Change namespace in range 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | c = 0 9 | n = currentProgram.functionManager.getFunctionAt(currentAddress).getParentNamespace() 10 | 11 | for f in currentProgram.functionManager.getFunctions(currentAddress, True): 12 | cn = f.getParentNamespace() 13 | if cn == n: 14 | c = c + 1 15 | print(f.getName()) 16 | if c == 2: 17 | break 18 | else: 19 | f.setParentNamespace(n) 20 | -------------------------------------------------------------------------------- /ThisCallReplacer.py: -------------------------------------------------------------------------------- 1 | #Export function addresses and parameters info 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | import json 9 | 10 | from ghidra.util.exception import CancelledException, InvalidInputException 11 | 12 | try: 13 | i = 0 14 | for func in currentProgram.functionManager.getFunctions(1): 15 | if func.getCallingConventionName() == "__thiscall": 16 | i = i + 1 17 | func.setCallingConvention("unknown") 18 | 19 | print("Found {} functions with __thiscall calling convention".format(i)) 20 | 21 | except CancelledException: 22 | pass -------------------------------------------------------------------------------- /CreateFunctionsFromArray.py: -------------------------------------------------------------------------------- 1 | #Create functions from pointers in array and decompile them 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | from ghidra.app.cmd.function import CreateFunctionCmd 9 | from ghidra.app.cmd.disassemble import DisassembleCommand 10 | 11 | 12 | 13 | # helper function to get a Ghidra Address type 14 | # accepts hexstring 15 | def getAddress(addr): 16 | # Address getAddress(java.lang.String addrString) 17 | return currentProgram.getAddressFactory().getAddress(addr) 18 | 19 | base = currentAddress 20 | for i in range(52): 21 | number = currentProgram.getMemory().getInt(base.add(i*4)) 22 | addr = getAddress("{:08X}".format(number)) 23 | 24 | cmd = DisassembleCommand(addr, None, False) 25 | cmd.applyTo(currentProgram, monitor) 26 | 27 | cmd = CreateFunctionCmd(addr) 28 | cmd.applyTo(currentProgram) -------------------------------------------------------------------------------- /signfunction.py: -------------------------------------------------------------------------------- 1 | #Set proper comment on function header with sign 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding F6 5 | #@menupath 6 | #@toolbar 7 | 8 | from ghidra.util.exception import CancelledException, InvalidInputException 9 | from datetime import date 10 | 11 | today = date.today() 12 | nick = ghidra.framework.client.ClientUtil.getUserName() 13 | 14 | def main(): 15 | func = currentProgram.functionManager.getFunctionContaining(currentAddress); 16 | 17 | comment = func.getComment(); 18 | if comment: 19 | comment = filter(lambda x: '@description: ' in x, comment.splitlines()) 20 | if comment and len(comment) > 0: 21 | comment = comment[0].split('@description: ')[1] 22 | else: 23 | comment = "" 24 | 25 | func.setComment("""Diablo 2 1.14d reverse team 26 | https://blizzhackers.dev 27 | 28 | @Date: {} 29 | @Author: {} 30 | @Function: {} 31 | @Address: {}.0x{} 32 | @description: {}""".format(today.strftime("%Y.%m.%d"), nick, func.getName(), currentProgram.getName().rsplit(".",1)[0], func.getEntryPoint(), comment)) 33 | 34 | if func.hasCustomVariableStorage(): 35 | s = "" 36 | for arg in func.getParameters(): 37 | s = s + "\n{}".format(arg) 38 | func.setComment("{}\n\nFunction uses custom registers for function arguments!{}".format(func.getComment(), s)) 39 | 40 | try: 41 | main() 42 | except CancelledException: 43 | pass 44 | -------------------------------------------------------------------------------- /Imports fixer.py: -------------------------------------------------------------------------------- 1 | #Fix D2Common imports 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | import json 9 | import os 10 | import platform 11 | 12 | from ghidra.util.exception import CancelledException, InvalidInputException 13 | from ghidra.app.cmd.function import CreateFunctionCmd 14 | from ghidra.app.cmd.disassemble import DisassembleCommand 15 | 16 | def getExports(): 17 | base = currentProgram.getImageBase() 18 | a = base.add(0x3c) 19 | b = currentProgram.getMemory().getInt(a) 20 | PE = base.add(b) 21 | c = PE.add(0x18 + 0x60) 22 | d = currentProgram.getMemory().getInt(c) 23 | export = base.add(d) 24 | print("Export header {}".format(export)) 25 | e = export.add(0x10) 26 | f = currentProgram.getMemory().getInt(e) 27 | g = export.add(0x14) 28 | h = currentProgram.getMemory().getInt(g) 29 | i = export.add(0x14 + 4 + 4) 30 | j = currentProgram.getMemory().getInt(i) 31 | k = base.add(j) 32 | print("Numer of exported functions is equal to {} and first ordinal number is {}".format(h, f)) 33 | print("Ordinal table is located at address {}".format(k)) 34 | for u in range(h): 35 | x = k.add(u * 4) 36 | y = currentProgram.getMemory().getInt(x) 37 | if y != 0: 38 | z = base.add(y) 39 | p = currentProgram.functionManager.getFunctionAt(z) 40 | if not p: 41 | cmd = CreateFunctionCmd(z) 42 | cmd.applyTo(currentProgram) 43 | cmd = DisassembleCommand(z, None, False) 44 | cmd.applyTo(currentProgram, monitor) 45 | 46 | 47 | 48 | def findImports(name): 49 | i = 0 50 | monitor.setMessage("Finding imported functions") 51 | for func in currentProgram.functionManager.getExternalFunctions(): 52 | if name in func.getExternalLocation().getParentName(): 53 | i = i + 1 54 | 55 | print("Found {} imported functions from {}".format(i, name)) 56 | 57 | try: 58 | findImports(u"D2COMMON.DLL") 59 | findImports(u"D2CMP.DLL") 60 | findImports(u"D2LANG.DLL") 61 | findImports(u"D2NET.DLL") 62 | findImports(u"FOG.DLL") 63 | findImports(u"STORM.DLL") 64 | 65 | getExports() 66 | except CancelledException: 67 | pass -------------------------------------------------------------------------------- /FunctionExporter.py: -------------------------------------------------------------------------------- 1 | #Export function addresses and parameters info 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | import json 9 | 10 | from ghidra.util.exception import CancelledException, InvalidInputException 11 | 12 | def minify(file_name): 13 | file_data = open(file_name, "r", 1).read() # store file info in variable 14 | json_data = json.loads(file_data) # store in json structure 15 | json_string = json.dumps(json_data, separators=(',', ":")) # Compact JSON structure 16 | file_name = str(file_name).replace(".json", "") # remove .json from end of file_name string 17 | new_file_name = "{0}_minify.json".format(file_name) 18 | open(new_file_name, "w+", 1).write(json_string) # open and write json_string to file 19 | 20 | def write_json(data, filename='game.json'): 21 | with open(filename,'w') as f: 22 | json.dump(data, f, indent=2) 23 | 24 | try: 25 | data = [] 26 | o = 0 27 | for func in currentProgram.functionManager.getFunctions(1): 28 | if "{}".format(func.getEntryPoint()) == "00681a48": 29 | break 30 | o = o + 1 31 | e = { 32 | "name" : func.getName(), 33 | "address" : "0x{}".format(func.getEntryPoint()), 34 | "paramcount" : func.getParameterCount(), 35 | "returntype" : "{}".format(func.getReturn().getDataType()), 36 | "ASM" : "", 37 | "jumpback" : "", 38 | "params": [ 39 | ] 40 | } 41 | 42 | #get asm what we replace in case we want to hook function and it's jumpback location 43 | for inst in currentProgram.listing.getInstructions(func.getBody(), True): 44 | if inst.getAddress() >= func.getEntryPoint().add(5): 45 | e["jumpback"] = "0x{}".format(inst.getAddress()) 46 | break 47 | e["ASM"] = e["ASM"] + "{}\n".format(inst) 48 | 49 | i = 0 50 | for p in func.getParameters(): 51 | t = e["params"] 52 | name = p.getName() 53 | type = p.getDataType() 54 | size = type.getLength() 55 | if p.isRegisterVariable(): 56 | loc = p.getRegister() 57 | if p.isStackVariable(): 58 | loc = "Stack[0x{:02X}]".format(p.getStackOffset()) 59 | w = { 60 | "name" : "{}".format(name), 61 | "type" : "{}".format(type), 62 | "location" : "{}".format(loc), 63 | "idx" : i, 64 | "size" : size 65 | } 66 | i = i + 1 67 | t.append(w) 68 | data.append(e) 69 | write_json(data) 70 | minify('game.json') 71 | print("Exported {} functions".format(o)) 72 | except CancelledException: 73 | pass -------------------------------------------------------------------------------- /StackArgumentsSearcher.py: -------------------------------------------------------------------------------- 1 | #Stack arguments searcher 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | import json 9 | import time 10 | 11 | from ghidra.util.exception import CancelledException, InvalidInputException 12 | from ghidra.program.model.listing import VariableFilter 13 | from ghidra.program.model.listing import ParameterImpl 14 | from ghidra.program.model.symbol import SourceType 15 | from ghidra.app.services import DataTypeManagerService 16 | 17 | # thanks weiry6922 18 | def getDataTypeManagerByName(name): 19 | tool = state.getTool() 20 | service = tool.getService(DataTypeManagerService) 21 | dataTypeManagers = service.getDataTypeManagers() 22 | for manager in dataTypeManagers: 23 | managerName = manager.getName() 24 | if name in managerName: 25 | return manager 26 | return None 27 | 28 | # thanks weiry6922 29 | def findDataTypeByNameInDataManager(nameDT, nameDTM): 30 | manager = getDataTypeManagerByName(nameDTM) 31 | allDataTypes = manager.getAllDataTypes() 32 | while allDataTypes.hasNext(): 33 | dataType = allDataTypes.next() 34 | dataTypeName = dataType.getName() 35 | if dataTypeName.startswith(nameDT): 36 | return dataType 37 | return None 38 | 39 | # thanks weiry6922 40 | def findDataTypeByName(name): 41 | dt = findDataTypeByNameInDataManager(name, currentProgram.name) 42 | if dt == None: 43 | dt = findDataTypeByNameInDataManager(name, u"BuiltInTypes") 44 | if dt == None: 45 | dt = findDataTypeByNameInDataManager(name, u"windows_vs12_32") 46 | return dt 47 | 48 | def main(): 49 | start = time.time() 50 | monitor.initialize(currentProgram.getFunctionManager().getFunctionCount()) 51 | c = 0 52 | for func in currentProgram.functionManager.getFunctions(1): 53 | if "{}".format(func.getEntryPoint()) == "00681a48": 54 | break 55 | 56 | if func.hasCustomVariableStorage(): 57 | func.setCallingConvention("unknown") 58 | 59 | monitor.incrementProgress(1) 60 | monitor.setShowProgressValue(True) 61 | 62 | found = False 63 | 64 | args = func.getParameters(VariableFilter.STACK_VARIABLE_FILTER) 65 | 66 | argsSize = 0 67 | for arg in args: 68 | a = arg.getLength() 69 | if a < 4: 70 | a = 4 71 | argsSize = argsSize + a 72 | 73 | argcount = len(args) 74 | retcount = 0 75 | retSize = 0 76 | 77 | for inst in currentProgram.listing.getInstructions(func.getBody(), True): 78 | if '{:02X}'.format(inst.getUnsignedByte(0)) == "C2": 79 | retSize = inst.getUnsignedShort(1) 80 | retcount = retSize / 4 81 | found = True 82 | break; 83 | 84 | if found: 85 | if argsSize != retSize: 86 | if argsSize < retSize: 87 | if not func.hasCustomVariableStorage(): 88 | for i in range(retcount - argcount): 89 | dt = findDataTypeByName("undefined4") 90 | p = ParameterImpl(None, dt, currentProgram) 91 | func.addParameter(p, SourceType.USER_DEFINED) 92 | c = c + 1 93 | print("Function 0x{} has defined {}/{} stack arguments".format(func.getEntryPoint(), argcount, retcount)) 94 | 95 | print("Found {} functions with wrong stack arguments count".format(c)) 96 | end = time.time() 97 | print(end - start) 98 | try: 99 | main() 100 | except CancelledException: 101 | pass -------------------------------------------------------------------------------- /CustomRegisters.py: -------------------------------------------------------------------------------- 1 | #Add custom registers to function argument 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | import json 9 | import os 10 | import platform 11 | import time 12 | 13 | from ghidra.util.exception import CancelledException, InvalidInputException 14 | from ghidra.program.model.symbol import SourceType 15 | from ghidra.app.cmd.label import AddLabelCmd 16 | from ghidra.app.cmd.label import RenameLabelCmd 17 | from ghidra.app.cmd.label import CreateNamespacesCmd 18 | from ghidra.app.cmd.function import CreateFunctionCmd 19 | from ghidra.app.util import NamespaceUtils 20 | from ghidra.app.cmd.disassemble import DisassembleCommand 21 | from ghidra.app.decompiler import DecompileOptions 22 | from ghidra.app.decompiler import DecompInterface 23 | from ghidra.program.model.listing import ParameterImpl 24 | from ghidra.program.model.pcode import HighFunctionDBUtil 25 | from ghidra.app.services import DataTypeManagerService 26 | 27 | def stepFindCustomRegisters(s): 28 | c = 0 29 | monitor.setMessage(s) 30 | print(s) 31 | monitor.initialize(currentProgram.getFunctionManager().getFunctionCount()) 32 | # decompiler setup 33 | options = DecompileOptions() 34 | ifc = DecompInterface() 35 | ifc.setOptions(options) 36 | ifc.openProgram(currentProgram) 37 | for func in currentProgram.functionManager.getFunctions(1): 38 | monitor.incrementProgress(1) 39 | monitor.setShowProgressValue(True) 40 | 41 | # stop on this address - after that we have standard garbage code we dont care about 42 | if "{}".format(func.getEntryPoint()) == "00681a48": 43 | break 44 | 45 | monitor.setMessage("Analyzing 0x{}".format(func.getEntryPoint())) 46 | res = ifc.decompileFunction(func, 60, monitor) 47 | high_func = res.getHighFunction() 48 | if high_func: 49 | lsm = high_func.getLocalSymbolMap() 50 | 51 | hfdb = HighFunctionDBUtil() 52 | hfdb.commitParamsToDatabase(high_func, True, SourceType.USER_DEFINED) 53 | hfdb.commitReturnToDatabase(high_func, SourceType.USER_DEFINED) 54 | hfdb.commitLocalNamesToDatabase(high_func, SourceType.USER_DEFINED) 55 | 56 | symbols = lsm.getSymbols() 57 | update = False 58 | for i, symbol in enumerate(symbols): 59 | if (symbol.name.startswith("in_") or symbol.name.startswith("unaff_")) and not symbol.name.startswith("in_register") and not symbol.name.startswith("in_FS") and symbol.parameter == False and not "{}".format(symbol.storage).startswith("unique") and not "{}".format(symbol.storage).startswith("Stack") and not "{}".format(symbol.storage).startswith("HASH"): 60 | func.setCustomVariableStorage(True) 61 | p = ParameterImpl(None, symbol.dataType, symbol.storage, currentProgram) 62 | print("Adding {} as param for 0x{}".format(symbol.storage, func.getEntryPoint())) 63 | func.addParameter(p, SourceType.USER_DEFINED) 64 | update = True 65 | else: 66 | if symbol.name.startswith("in_stack_000000"): 67 | print("0x{} require stack param {}".format(func.getEntryPoint(), symbol)) 68 | 69 | if update: 70 | #print("Function 0x{} uses custom registers!".format(func.getEntryPoint())) 71 | func.setCallingConvention("unknown") 72 | c = c + 1 73 | monitor.checkCanceled() 74 | print("Found {} functions using custom registers!".format(c)) 75 | 76 | def main(): 77 | start = time.time() 78 | stepFindCustomRegisters("Find functions what uses custom registers as arguments and fix them") 79 | end = time.time() 80 | print(end - start) 81 | 82 | try: 83 | main() 84 | except CancelledException: 85 | pass -------------------------------------------------------------------------------- /ArgumentsUnifier.py: -------------------------------------------------------------------------------- 1 | #Arguments unifier 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | import json 9 | 10 | from ghidra.util.exception import CancelledException, InvalidInputException 11 | from ghidra.program.model.listing import VariableFilter 12 | from ghidra.program.model.symbol import SourceType 13 | from ghidra.util.exception import DuplicateNameException 14 | from ghidra.app.services import DataTypeManagerService 15 | 16 | # thanks weiry6922 17 | def exportParamName(param): 18 | if "(" in param: 19 | #print("Skippping function parameter") 20 | return None, None 21 | elif not " " in param: 22 | #print("Skipping function pointer") 23 | return None, None 24 | elif "unsigned" in param: 25 | sig, strc, name = param.split(" ") 26 | elif "signed" in param: 27 | sig, strc, name = param.split(" ") 28 | elif "const" in param: 29 | sig, strc, name = param.split(" ") 30 | else: 31 | strc, name = param.split(" ") 32 | 33 | return strc, name 34 | 35 | # thanks weiry6922 36 | def getDataTypeManagerByName(name): 37 | tool = state.getTool() 38 | service = tool.getService(DataTypeManagerService) 39 | dataTypeManagers = service.getDataTypeManagers() 40 | for manager in dataTypeManagers: 41 | managerName = manager.getName() 42 | if name in managerName: 43 | return manager 44 | return None 45 | 46 | # thanks weiry6922 47 | def findDataTypeByNameInDataManager(nameDT, nameDTM): 48 | manager = getDataTypeManagerByName(nameDTM) 49 | allDataTypes = manager.getAllDataTypes() 50 | while allDataTypes.hasNext(): 51 | dataType = allDataTypes.next() 52 | dataTypeName = dataType.getName() 53 | if dataTypeName.startswith(nameDT): 54 | return dataType 55 | return None 56 | 57 | # thanks weiry6922 58 | def findDataTypeByName(name): 59 | dt = findDataTypeByNameInDataManager(name, currentProgram.name) 60 | if dt == None: 61 | dt = findDataTypeByNameInDataManager(name, u"BuiltInTypes") 62 | if dt == None: 63 | dt = findDataTypeByNameInDataManager(name, u"windows_vs12_32") 64 | return dt 65 | 66 | def retypeArgs(args): 67 | c = 0 68 | for arg in args: 69 | if "{}".format(arg.getDataType()) == "int": 70 | arg.setDataType(findDataTypeByName("int32_t"), SourceType.USER_DEFINED) 71 | c = c + 1 72 | if "{}".format(arg.getDataType()) == "uint": 73 | arg.setDataType(findDataTypeByName("uint32_t"), SourceType.USER_DEFINED) 74 | c = c + 1 75 | if "{}".format(arg.getDataType()) == "short": 76 | arg.setDataType(findDataTypeByName("int16_t"), SourceType.USER_DEFINED) 77 | c = c + 1 78 | if "{}".format(arg.getDataType()) == "ushort": 79 | arg.setDataType(findDataTypeByName("uint16_t"), SourceType.USER_DEFINED) 80 | c = c + 1 81 | if "{}".format(arg.getDataType()) == "BYTE": 82 | arg.setDataType(findDataTypeByName("int8_t"), SourceType.USER_DEFINED) 83 | c = c + 1 84 | return c 85 | 86 | def main(): 87 | monitor.initialize(currentProgram.getFunctionManager().getFunctionCount()) 88 | c = 0 89 | for func in currentProgram.functionManager.getFunctions(1): 90 | if "{}".format(func.getEntryPoint()) == "00681a48": 91 | break 92 | 93 | monitor.incrementProgress(1) 94 | monitor.setShowProgressValue(True) 95 | 96 | # retype function arguments 97 | args = func.getParameters() 98 | c = c + retypeArgs(args) 99 | 100 | # retype function return 101 | retu = func.getReturn() 102 | c = c + retypeArgs([retu]) 103 | 104 | print("Fixed {} argument types".format(c)) 105 | try: 106 | main() 107 | except CancelledException: 108 | pass -------------------------------------------------------------------------------- /ArgumentsRenamer.py: -------------------------------------------------------------------------------- 1 | #Arguments renamer 2 | #@author dzik 3 | #@category Diablo 2 4 | #@keybinding 5 | #@menupath 6 | #@toolbar 7 | 8 | import json 9 | 10 | from ghidra.util.exception import CancelledException, InvalidInputException 11 | from ghidra.program.model.listing import VariableFilter 12 | from ghidra.program.model.symbol import SourceType 13 | from ghidra.util.exception import DuplicateNameException 14 | 15 | 16 | def main(): 17 | monitor.initialize(currentProgram.getFunctionManager().getFunctionCount()) 18 | c = 0 19 | for func in currentProgram.functionManager.getFunctions(1): 20 | if "{}".format(func.getEntryPoint()) == "00681a48": 21 | break 22 | 23 | monitor.incrementProgress(1) 24 | monitor.setShowProgressValue(True) 25 | 26 | args = func.getParameters() 27 | 28 | for arg in args: 29 | if "{}".format(arg.getDataType()) == "D2GameStrc *": 30 | try: 31 | arg.setName("pGame", SourceType.USER_DEFINED) 32 | except DuplicateNameException: 33 | c = c - 1 34 | c = c + 1 35 | if "{}".format(arg.getDataType()) == "D2ClientStrc *": 36 | try: 37 | arg.setName("pClient", SourceType.USER_DEFINED) 38 | except DuplicateNameException: 39 | c = c - 1 40 | c = c + 1 41 | if "{}".format(arg.getDataType()) == "D2PoolManagerStrc *": 42 | try: 43 | arg.setName("pMemory", SourceType.USER_DEFINED) 44 | except DuplicateNameException: 45 | c = c - 1 46 | c = c + 1 47 | if "{}".format(arg.getDataType()) == "D2RoomStrc *": 48 | try: 49 | arg.setName("pRoom", SourceType.USER_DEFINED) 50 | except DuplicateNameException: 51 | c = c - 1 52 | c = c + 1 53 | if "{}".format(arg.getDataType()) == "D2RoomExStrc *": 54 | try: 55 | arg.setName("pRoomEx", SourceType.USER_DEFINED) 56 | except DuplicateNameException: 57 | c = c - 1 58 | c = c + 1 59 | if "{}".format(arg.getDataType()) == "D2DrlgLevelStrc *": 60 | try: 61 | arg.setName("pLevel", SourceType.USER_DEFINED) 62 | except DuplicateNameException: 63 | c = c - 1 64 | c = c + 1 65 | if "{}".format(arg.getDataType()) == "D2PresetUnitStrc *": 66 | try: 67 | arg.setName("pPresetUnit", SourceType.USER_DEFINED) 68 | except DuplicateNameException: 69 | c = c - 1 70 | c = c + 1 71 | if "{}".format(arg.getDataType()) == "eD2UnitType": 72 | try: 73 | arg.setName("eUnitType", SourceType.USER_DEFINED) 74 | except DuplicateNameException: 75 | c = c - 1 76 | c = c + 1 77 | if "{}".format(arg.getDataType()) == "D2RosterStrc *": 78 | try: 79 | arg.setName("pRoster", SourceType.USER_DEFINED) 80 | except DuplicateNameException: 81 | c = c - 1 82 | c = c + 1 83 | if "{}".format(arg.getDataType()) == "eD2Skills": 84 | try: 85 | arg.setName("eSkill", SourceType.USER_DEFINED) 86 | except DuplicateNameException: 87 | c = c - 1 88 | c = c + 1 89 | if "{}".format(arg.getDataType()) == "eD2States": 90 | try: 91 | arg.setName("eState", SourceType.USER_DEFINED) 92 | except DuplicateNameException: 93 | c = c - 1 94 | c = c + 1 95 | if "{}".format(arg.getDataType()) == "eD2UnitStat": 96 | try: 97 | arg.setName("eUnitStat", SourceType.USER_DEFINED) 98 | except DuplicateNameException: 99 | c = c - 1 100 | c = c + 1 101 | if "{}".format(arg.getDataType()) == "eD2PlayerClassID": 102 | try: 103 | arg.setName("ePlayerClass", SourceType.USER_DEFINED) 104 | except DuplicateNameException: 105 | c = c - 1 106 | c = c + 1 107 | if "{}".format(arg.getDataType()) == "D2InventoryStrc *": 108 | try: 109 | arg.setName("pInventory", SourceType.USER_DEFINED) 110 | except DuplicateNameException: 111 | c = c - 1 112 | c = c + 1 113 | if "{}".format(arg.getDataType()) == "DC6 *": 114 | try: 115 | arg.setName("pDC6", SourceType.USER_DEFINED) 116 | except DuplicateNameException: 117 | c = c - 1 118 | c = c + 1 119 | if "{}".format(arg.getDataType()) == "D2SkillStrc *": 120 | try: 121 | arg.setName("pSkill", SourceType.USER_DEFINED) 122 | except DuplicateNameException: 123 | c = c - 1 124 | c = c + 1 125 | if "{}".format(arg.getDataType()) == "D2DynamicPathStrc *": 126 | try: 127 | arg.setName("pDynamicPath", SourceType.USER_DEFINED) 128 | except DuplicateNameException: 129 | c = c - 1 130 | c = c + 1 131 | if "{}".format(arg.getDataType()) == "D2PlayerListStrc *": 132 | try: 133 | arg.setName("pPlayerList", SourceType.USER_DEFINED) 134 | except DuplicateNameException: 135 | c = c - 1 136 | c = c + 1 137 | if "{}".format(arg.getDataType()) == "D2ParticleStrc *": 138 | try: 139 | arg.setName("pParticle", SourceType.USER_DEFINED) 140 | except DuplicateNameException: 141 | c = c - 1 142 | c = c + 1 143 | if "{}".format(arg.getDataType()) == "D2DrlgStrc *": 144 | try: 145 | arg.setName("pDrlg", SourceType.USER_DEFINED) 146 | except DuplicateNameException: 147 | c = c - 1 148 | c = c + 1 149 | if "{}".format(arg.getDataType()) == "D2DrlgActStrc *": 150 | try: 151 | arg.setName("pDrlgAct", SourceType.USER_DEFINED) 152 | except DuplicateNameException: 153 | c = c - 1 154 | c = c + 1 155 | if "{}".format(arg.getDataType()) == "D2DrlgEnvironmentStrc *": 156 | try: 157 | arg.setName("pDrlgEnvironment", SourceType.USER_DEFINED) 158 | except DuplicateNameException: 159 | c = c - 1 160 | c = c + 1 161 | if "{}".format(arg.getDataType()) == "D2DrlgMapStrc *": 162 | try: 163 | arg.setName("pDrlgMap", SourceType.USER_DEFINED) 164 | except DuplicateNameException: 165 | c = c - 1 166 | c = c + 1 167 | if "{}".format(arg.getDataType()) == "D2TimerQueueStrc *": 168 | try: 169 | arg.setName("pTimerQueue", SourceType.USER_DEFINED) 170 | except DuplicateNameException: 171 | c = c - 1 172 | c = c + 1 173 | if "{}".format(arg.getDataType()) == "D2TimerListStrc *": 174 | try: 175 | arg.setName("pTimerList", SourceType.USER_DEFINED) 176 | except DuplicateNameException: 177 | c = c - 1 178 | c = c + 1 179 | if "{}".format(arg.getDataType()) == "D2BitBufferStrc *": 180 | try: 181 | arg.setName("pBitBuffer", SourceType.USER_DEFINED) 182 | except DuplicateNameException: 183 | c = c - 1 184 | c = c + 1 185 | if "{}".format(arg.getDataType()) == "D2QuestDataStrc *": 186 | try: 187 | arg.setName("pQuestData", SourceType.USER_DEFINED) 188 | except DuplicateNameException: 189 | c = c - 1 190 | c = c + 1 191 | if "{}".format(arg.getDataType()) == "D2SeedStrc *": 192 | try: 193 | arg.setName("pSeed", SourceType.USER_DEFINED) 194 | except DuplicateNameException: 195 | c = c - 1 196 | c = c + 1 197 | if "{}".format(arg.getDataType()) == "D2MonsterRegionStrc *": 198 | try: 199 | arg.setName("pMonsterRegion", SourceType.USER_DEFINED) 200 | except DuplicateNameException: 201 | c = c - 1 202 | c = c + 1 203 | if "{}".format(arg.getDataType()) == "D2MonsterRegionStrc * *": 204 | try: 205 | arg.setName("ppMonsterRegion", SourceType.USER_DEFINED) 206 | except DuplicateNameException: 207 | c = c - 1 208 | c = c + 1 209 | if "{}".format(arg.getDataType()) == "eD2ItemTypes": 210 | try: 211 | arg.setName("eItemType", SourceType.USER_DEFINED) 212 | except DuplicateNameException: 213 | c = c - 1 214 | c = c + 1 215 | if "{}".format(arg.getDataType()) == "D2UnitStrc *": 216 | try: 217 | arg.setName("pUnit", SourceType.USER_DEFINED) 218 | except DuplicateNameException: 219 | c = c - 1 220 | c = c + 1 221 | if "{}".format(arg.getDataType()) == "D2NetDataStrc *": 222 | try: 223 | arg.setName("pNetData", SourceType.USER_DEFINED) 224 | except DuplicateNameException: 225 | c = c - 1 226 | c = c + 1 227 | if "{}".format(arg.getDataType()) == "eD2LevelId": 228 | try: 229 | arg.setName("eLevel", SourceType.USER_DEFINED) 230 | except DuplicateNameException: 231 | c = c - 1 232 | c = c + 1 233 | if "{}".format(arg.getDataType()) == "eD2UIvars": 234 | try: 235 | arg.setName("eUI", SourceType.USER_DEFINED) 236 | except DuplicateNameException: 237 | c = c - 1 238 | c = c + 1 239 | if "{}".format(arg.getDataType()) == "D2GfxInfoStrc *": 240 | try: 241 | arg.setName("pGfxInfo", SourceType.USER_DEFINED) 242 | except DuplicateNameException: 243 | c = c - 1 244 | c = c + 1 245 | if "{}".format(arg.getDataType()) == "eOverlayId": 246 | try: 247 | arg.setName("eOverlay", SourceType.USER_DEFINED) 248 | except DuplicateNameException: 249 | c = c - 1 250 | c = c + 1 251 | print("Renamed {} arguments".format(c)) 252 | try: 253 | main() 254 | except CancelledException: 255 | pass --------------------------------------------------------------------------------