From b3acc6a3938d07f7a1854d5077fa40047b892a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 20 Jun 2021 14:21:49 +0200 Subject: [PATCH] Add tool to translate IDA types to real C++ types Currently this only covers agl Parameter classes, but more type names may be added to the mapping in the future. --- tools/translate_ida_types.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 tools/translate_ida_types.py diff --git a/tools/translate_ida_types.py b/tools/translate_ida_types.py new file mode 100755 index 00000000..6320cd13 --- /dev/null +++ b/tools/translate_ida_types.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +from colorama import Back, Fore, Style +import sys + +mapping = { + "agl::utl::Parameter$uint$": "agl::utl::Parameter", + "agl::utl::Parameter$int$": "agl::utl::Parameter", + "agl::utl::Parameter$s32$": "agl::utl::Parameter", + "agl::utl::Parameter$float$": "agl::utl::Parameter", + "agl::utl::Parameter$f32$": "agl::utl::Parameter", + "agl::utl::Parameter$bool$": "agl::utl::Parameter", + "agl::utl::Parameter$sead::SafeString$": "agl::utl::Parameter", + "agl::utl::Parameter$sead::Vector3f$": "agl::utl::Parameter", + "agl::utl::Parameter$sead::FixedSafeString20$": "agl::utl::Parameter>", + "agl::utl::Parameter$sead::FixedSafeString40$": "agl::utl::Parameter>", + "agl::utl::Parameter$sead::FixedSafeString100$": "agl::utl::Parameter>", + "agl::utl::Parameter$sead::Color4f$": "agl::utl::Parameter", + "agl::utl::Parameter_String32": "agl::utl::Parameter>", + "agl::utl::Parameter_String64": "agl::utl::Parameter>", + "agl::utl::Parameter_String256": "agl::utl::Parameter>", +} + +lines = list(sys.stdin) + +sys.stderr.write(Back.BLUE + Fore.WHITE + Style.BRIGHT + "=" * 30 + " output " + "=" * 30 + Style.RESET_ALL + "\n") + +for line in lines: + for from_type, to_type in mapping.items(): + line = line.replace(from_type, to_type) + sys.stdout.write(line)