Skip to content

Commit

Permalink
+ texture-related mod finding script
Browse files Browse the repository at this point in the history
  • Loading branch information
redsuns-chan committed Aug 4, 2022
1 parent 000fa58 commit e613a3e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions sdgo-mod-finder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# use texture number to find related .mod

import os
from pathlib import Path
import sys

sdgo_data_path = "G:\\Games\\SDGO_DEV\\data_dev\\"

def main(tex: str):
os.chdir(sdgo_data_path)
search = "Txrs\\" + tex + ".txr"
print("searching related mod of '" + search + "'")
search = search.encode("UTF-8").hex("|").replace("|", "00").upper() + "00"
print("hex: '" + search + "'")
file_list = os.listdir(sdgo_data_path + "mdrs")
file_list.sort()
related_mods = []
for file_name in file_list:
if (file_name.endswith(".mod")):
f = open(sdgo_data_path + "mdrs/" + file_name, "rb")
file_size = os.path.getsize(sdgo_data_path + "mdrs/" + file_name)
fhex = f.read(file_size).hex().upper()
found = fhex.find(search) > -1
if found:
related_mods.append(file_name)
print(related_mods)
return

main(sys.argv[1])

0 comments on commit e613a3e

Please sign in to comment.