Skip to content

Commit

Permalink
add script to extract uld names to ida folder
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfcomp committed Jul 29, 2024
1 parent 56998cf commit 12b8f3b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,4 @@ MigrationBackup/
# VSCode
.vscode/
ida/errors.txt
ida/uld_names.txt
76 changes: 76 additions & 0 deletions ida/ffxiv_extract_uld_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import idaapi
import ida_bytes
import ida_nalt
import ida_struct
import ida_enum
import ida_kernwin
import ida_search
import ida_ida
import ida_typeinf
import ida_hexrays
import ida_name
import os

patterns = [
"48 8D 15 ?? ?? ?? ?? 41 B9 ?? ?? ?? ?? 45 33 C0 E8 ?? ?? ?? ??",
"48 8D 15 ?? ?? ?? ?? 45 33 C0 48 8B CB 48 83 C4 20 5B E9 ?? ?? ?? ??",
"48 8D 15 ?? ?? ?? ?? 45 33 C0 E9 ?? ?? ?? ??",
]

strings = []


def search_binary(ea, pattern, flag):
return ida_search.find_binary(
ea,
flag & 1 and ida_ida.cvar.inf.max_ea or ida_ida.cvar.inf.min_ea,
pattern,
16,
flag,
)


def get_string(offset):
return ida_bytes.get_strlit_contents(offset, -1, ida_nalt.STRTYPE_TERMCHR).decode(
"UTF-8"
)


def do_pattern(pattern):
ea = 0
while True:
ea = search_binary(
ea + 1,
pattern,
ida_search.SEARCH_DOWN,
)

if ea == 0xFFFFFFFFFFFFFFFF:
break

offset = ida_bytes.get_original_dword(ea + 3)

string = get_string(offset + ea + 0x7)

strings.append(string)


for pattern in patterns:
do_pattern(pattern)

txtFile = os.path.join(os.path.dirname(os.path.realpath(__file__)), "uld_names.txt")

if os.path.exists(txtFile):
os.remove(txtFile)

strings.sort()

filestr = ""

for string in strings:
filestr = f'{filestr},\n"ui/uld/{string}.uld"'

with open(txtFile, "w") as f:
f.write(filestr)

print(strings)

0 comments on commit 12b8f3b

Please sign in to comment.