Replies: 1 comment
-
This script extracts Unity objects with strings for translation. Just wanted to share it here: #!/usr/bin/env python3
# MonoBehavior of Borg Unpacker
# Scans through a Unity assets dir and unpacks all MonoBehavior m_Text.
import os
import UnityPy as U
import json
def map_mbehaviors(do, where: str, out: str):
for root, dirs, files in os.walk(where):
for f in files:
fpath = os.path.join(root, f)
print(f"##### In {fpath}:")
env = U.load(fpath)
scanned = 0
matched = 0
for n in range(len(env.objects)):
if env.objects[n].type.name == "MonoBehaviour" and env.objects[n].serialized_type.nodes:
os.makedirs(
os.path.join(os.path.join(out, root), f), exist_ok=True)
json.dump(env.objects[n].read_typetree(),
open(os.path.join(
os.path.join(os.path.join(out, root), f),
f"{n}.json"), "w+"), ensure_ascii=False)
#obj.save_typetree(tree)
matched += 1
print(f"##### Found {scanned} MonoBehaviours, matched {matched}.")
def ttree_print_mText(tree):
print(f"m_Text: {tree['m_Text']}")
def ttree_print_omakeTitle(tree):
for page in tree['pages']:
for item in page['items']:
print(f"omakeTitle: {item['title']}")
def main():
map_mbehaviors(ttree_print_mText, "./romfs/Data", "./out")
if __name__ == "__main__":
main() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I enabled the Discussions feature to allow aspiring reverse-engineers to share the fruits of their research on the VN's game data!
DO NOT POST VERBATIM GAME DATA OR FILES. DO NOT CONTRIBUTE VERBATIM GAME DATA OR FILES TO THIS REPOSITORY.
Beta Was this translation helpful? Give feedback.
All reactions