Unity Typetree to Python Module code generator
Project description
UnityPyTypetreeCodegen
(WIP) Static TypeTree code analysis and code generation for UnityPy
Used in
- https://github.com/mos9527/UnityPyLive2DExtractor
- Uses generated classes in https://github.com/mos9527/UnityPyLive2DExtractor/tree/main/UnityPyLive2DExtractor/generated
- https://github.com/mos9527/sssekai/
- Used for AppHash in https://github.com/mos9527/sssekai/tree/main/sssekai/generated
- https://github.com/mos9527/sssekai_blender_io/
- Used for TransportDefine in https://github.com/mos9527/sssekai_blender_io/tree/master/scripts/rla_transport_defines/generated
Usage
Installation
pip install UnityPyTypetreeCodegen
Generating code
- You can generate code from a TypeTree JSON dump generated with https://github.com/K0lb3/TypeTreeGenerator
UnityPyTypetreeCodegen --json "path_to_typetree_json_dump" --output "generated_module_path"
- Or dump the TypeTree from ourselves from Unity assemblies (mono dlls)
UnityPyTypetreeCodegen --asm-dir "path/to/Managed/DLLs" --output "generated_module_path"
# or with IL2CPP
UnityPyTypetreeCodegen --il2cpp "path/to/il2cpp.so" --metadata "path/to/global-metadata.dat" --output "generated_module_path"
- The emitted module will be structured like this
generated
├── __init__.py
└── Live2D
└── Cubism
├── Core
│ ├── __init__.py
│ └── Unmanaged
│ └── __init__.py
├── Framework
│ ├── __init__.py
│ ├── Expression
│ │ └── __init__.py
│ ├── HarmonicMotion
│ │ └── __init__.py
│ ├── Json
│ │ └── __init__.py
│ ├── LookAt
│ │ └── __init__.py
│ ├── Motion
│ │ └── __init__.py
│ ├── MotionFade
│ │ └── __init__.py
│ ├── MouthMovement
│ │ └── __init__.py
│ ├── Physics
│ │ └── __init__.py
│ ├── Pose
│ │ └── __init__.py
│ ├── Raycasting
│ │ └── __init__.py
│ ├── Tasking
│ │ └── __init__.py
│ └── UserData
│ └── __init__.py
└── Rendering
├── __init__.py
└── Masking
└── __init__.py
20 directories, 18 files
Using the generated module
Example usage in rla_transport_defines
env = UnityPy.load(...)
from generated import UTTCGen_AsInstance, UTTCGen_GetClass
for reader in filter(lambda x: x.type == ClassIDType.MonoBehaviour, env.objects):
name = reader.peek_name()
if name.startswith("TransportDefine"):
from generated.Sekai.Streaming import TransportDefine
# ...or TransportDefine = UTTCGen_GetClass("Sekai.Streaming.TransportDefine")
# ...or TransportDefine = UTTCGen_GetClass(reader.read(check_read=False))
instance = UTTCGen_AsInstance(TransportDefine, reader)
print(f'"{name}":({instance.validBones}, {instance.validBlendShapes}),')
# Possibly modify on the instance itself and saving it is also possible
instance.validBones[0] = "BadBone"
instance.save()
env.save()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unitypytypetreecodegen-0.0.13.tar.gz.
File metadata
- Download URL: unitypytypetreecodegen-0.0.13.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e354caeb5c06faa61c6cb6318ac2c36d693fbe87032b1f59d6c1dfe382e35c2
|
|
| MD5 |
58ee1c76779e0328bbd823fc93770045
|
|
| BLAKE2b-256 |
a9410a757e241bc296fa92c01e10e70d1b018f93e40ce7b07126bcfb5a11c099
|
File details
Details for the file unitypytypetreecodegen-0.0.13-py3-none-any.whl.
File metadata
- Download URL: unitypytypetreecodegen-0.0.13-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de0f49de85002aacc52629d017e602b6a5fa34a824ea71c76fcd6fa03b984316
|
|
| MD5 |
6cec8d16ae3d03d303c2990a487fa777
|
|
| BLAKE2b-256 |
edcb7cb7d704ed2c5c830be1d721ab4463c7adf3dd1e967b09d262666f10e798
|