Skip to content

Instantly share code, notes, and snippets.

@SciresM
Last active July 15, 2023 18:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SciresM/d1af2b73d38fbceee5c848fc9cf641ce to your computer and use it in GitHub Desktop.
Save SciresM/d1af2b73d38fbceee5c848fc9cf641ce to your computer and use it in GitHub Desktop.
Get full symbols for your Fire Emblem If/Fates IDB
import idaapi
import idautils
import idc
import struct
def do_rename(eaaddr, name):
idc.MakeCode(eaaddr)
idc.MakeFunction(eaaddr)
idc.MakeNameEx(eaaddr, name, idc.SN_NOWARN)
if __name__ == "__main__":
# name.stackTrace/addr.stackTrace are in rom:/debug/ for Fire Emblem If/Fates (all regions).
with open('name.StackTrace', 'rb') as f:
names = f.read()
with open('addr.StackTrace', 'rb') as f:
addrs = f.read()
functions = []
while len(addrs) > 0:
addr, name_ofs = struct.unpack('<II', addrs[:8])
addrs = addrs[8:]
name = names[name_ofs:names.index('\x00', name_ofs)]
if '(' in name:
name = name[:name.index('(')]
# TODO: extract input variable type information.
do_rename(addr, name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment