unity-helper 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unity_helper-1.0.0/LICENSE +7 -0
- unity_helper-1.0.0/PKG-INFO +145 -0
- unity_helper-1.0.0/README.md +125 -0
- unity_helper-1.0.0/pyproject.toml +27 -0
- unity_helper-1.0.0/src/unity_helper/__init__.py +22 -0
- unity_helper-1.0.0/src/unity_helper/bindings.py +181 -0
- unity_helper-1.0.0/src/unity_helper/main.py +334 -0
- unity_helper-1.0.0/src/unity_helper/mono.py +438 -0
- unity_helper-1.0.0/src/unity_helper/objects.py +498 -0
- unity_helper-1.0.0/src/unity_helper/structures.py +129 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 unity_helper
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unity_helper
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A runtime reflection toolkit for Unity applications, enabling real-time inspection and interaction with classes, methods, and fields and objects.
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Chasss
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Requires-Dist: pylocalmem (>=1.1.1,<2.0.0)
|
|
18
|
+
Project-URL: Repository, http://github.com/chassss/unity_helper
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# unity_helper
|
|
22
|
+
|
|
23
|
+
`unity_helper` is a runtime inspection toolkit for Unity applications, designed to expose reflection data including classes, methods, and fields. It allows you to explore and interact with application internals dynamically and in real time.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
- Support for obtaining unity image data
|
|
27
|
+
- Support for obtaining unity class data
|
|
28
|
+
- Support for obtaining unity method data
|
|
29
|
+
- Support for obtaining unity field data
|
|
30
|
+
- Supports `IL2CPP` scripting backend
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
unity_helper requires Windows Python 3.11+ (64-bit) operating environment, you can complete the installation through pip:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install -U unity_helper
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
```Python
|
|
43
|
+
import ctypes
|
|
44
|
+
from unity_helper import Il2cpp
|
|
45
|
+
|
|
46
|
+
# Initialize the class
|
|
47
|
+
ref = Il2cpp()
|
|
48
|
+
|
|
49
|
+
# Getting a MonoClass object
|
|
50
|
+
time = ref.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Time')
|
|
51
|
+
|
|
52
|
+
# Getting MonoClass info
|
|
53
|
+
print('Time info:', time.name, time.object, time.type, time.instance)
|
|
54
|
+
|
|
55
|
+
# Listing method info in a MonoClass
|
|
56
|
+
for method in time.list_methods():
|
|
57
|
+
print('Method info:', method.name, method.address, method.methodInfo, method.is_static, method.param_count, method.param_info)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# Getting a MonoMethod object based off of name
|
|
61
|
+
set_timeScale = time.find_method('set_timeScale')
|
|
62
|
+
|
|
63
|
+
# Calling the method
|
|
64
|
+
if not set_timeScale.is_static:
|
|
65
|
+
time.instance = 123456789
|
|
66
|
+
|
|
67
|
+
set_timeScale((ctypes.c_float(5)))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# Calling the method with a ctypes functype
|
|
71
|
+
new_set_timeScale = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_float)(set_timeScale.address)
|
|
72
|
+
new_set_timeScale(5.0)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# Listing field info in a MonoClass
|
|
77
|
+
for field in time.list_fields():
|
|
78
|
+
print('Field info:', field.name, field.ptr, field.type, field.is_static)
|
|
79
|
+
|
|
80
|
+
if not field.is_static:
|
|
81
|
+
time.instance = 123456789
|
|
82
|
+
print('Value:', field.value)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# Getting a field from name
|
|
86
|
+
example_field = time.find_field('example_field')
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Setting a field value in a MonoClass
|
|
90
|
+
if not example_field.is_static:
|
|
91
|
+
time.instance = 123456789
|
|
92
|
+
|
|
93
|
+
example_field.value = 9999
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# Getting the main camera and getting a rigidbody
|
|
97
|
+
main_cam = ref.get_main_camera()
|
|
98
|
+
rigidbody = ref.get_RigidBody(123456789)
|
|
99
|
+
|
|
100
|
+
# Getting/editing rigidbody info
|
|
101
|
+
velocity = rigidbody.velocity
|
|
102
|
+
velocity.y = 10
|
|
103
|
+
rigidbody.velocity = velocity
|
|
104
|
+
|
|
105
|
+
pos = rigidbody.position
|
|
106
|
+
|
|
107
|
+
print(pos.x, pos.y, pos.z)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# Getting/editing camera info
|
|
111
|
+
fov = main_cam.fov
|
|
112
|
+
main_cam.fov = fov + 10.0
|
|
113
|
+
|
|
114
|
+
enabled = main_cam.enabled
|
|
115
|
+
main_cam.enabled = not enabled
|
|
116
|
+
|
|
117
|
+
print(main_cam.name)
|
|
118
|
+
|
|
119
|
+
# Finding a object based off name
|
|
120
|
+
player = ref.find_object('Player')
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# Finding a object based off of tag
|
|
124
|
+
player = ref.find_object_with_tag('Player')
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# Listing images
|
|
128
|
+
for image in ref.list_assemblies():
|
|
129
|
+
print(image)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# Listing classes in image
|
|
133
|
+
for clazz in ref.list_classes_in_image('Assembly-CSharp.dll'):
|
|
134
|
+
print(clazz.name)
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## More Features
|
|
140
|
+
|
|
141
|
+
The example above covers some common use cases, but `unity_helper` also enables:
|
|
142
|
+
|
|
143
|
+
- **Inspecting and interacting with Scene objects** to find and manipulate game entities in real time
|
|
144
|
+
- **Accessing and modifying Component objects**, including Rigidbodies, Cameras, scripts and more
|
|
145
|
+
- **Exploring and updating Transform objects**, such as position, rotation, rect and more
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# unity_helper
|
|
2
|
+
|
|
3
|
+
`unity_helper` is a runtime inspection toolkit for Unity applications, designed to expose reflection data including classes, methods, and fields. It allows you to explore and interact with application internals dynamically and in real time.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
- Support for obtaining unity image data
|
|
7
|
+
- Support for obtaining unity class data
|
|
8
|
+
- Support for obtaining unity method data
|
|
9
|
+
- Support for obtaining unity field data
|
|
10
|
+
- Supports `IL2CPP` scripting backend
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
unity_helper requires Windows Python 3.11+ (64-bit) operating environment, you can complete the installation through pip:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install -U unity_helper
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
```Python
|
|
23
|
+
import ctypes
|
|
24
|
+
from unity_helper import Il2cpp
|
|
25
|
+
|
|
26
|
+
# Initialize the class
|
|
27
|
+
ref = Il2cpp()
|
|
28
|
+
|
|
29
|
+
# Getting a MonoClass object
|
|
30
|
+
time = ref.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Time')
|
|
31
|
+
|
|
32
|
+
# Getting MonoClass info
|
|
33
|
+
print('Time info:', time.name, time.object, time.type, time.instance)
|
|
34
|
+
|
|
35
|
+
# Listing method info in a MonoClass
|
|
36
|
+
for method in time.list_methods():
|
|
37
|
+
print('Method info:', method.name, method.address, method.methodInfo, method.is_static, method.param_count, method.param_info)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Getting a MonoMethod object based off of name
|
|
41
|
+
set_timeScale = time.find_method('set_timeScale')
|
|
42
|
+
|
|
43
|
+
# Calling the method
|
|
44
|
+
if not set_timeScale.is_static:
|
|
45
|
+
time.instance = 123456789
|
|
46
|
+
|
|
47
|
+
set_timeScale((ctypes.c_float(5)))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# Calling the method with a ctypes functype
|
|
51
|
+
new_set_timeScale = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_float)(set_timeScale.address)
|
|
52
|
+
new_set_timeScale(5.0)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# Listing field info in a MonoClass
|
|
57
|
+
for field in time.list_fields():
|
|
58
|
+
print('Field info:', field.name, field.ptr, field.type, field.is_static)
|
|
59
|
+
|
|
60
|
+
if not field.is_static:
|
|
61
|
+
time.instance = 123456789
|
|
62
|
+
print('Value:', field.value)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# Getting a field from name
|
|
66
|
+
example_field = time.find_field('example_field')
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# Setting a field value in a MonoClass
|
|
70
|
+
if not example_field.is_static:
|
|
71
|
+
time.instance = 123456789
|
|
72
|
+
|
|
73
|
+
example_field.value = 9999
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# Getting the main camera and getting a rigidbody
|
|
77
|
+
main_cam = ref.get_main_camera()
|
|
78
|
+
rigidbody = ref.get_RigidBody(123456789)
|
|
79
|
+
|
|
80
|
+
# Getting/editing rigidbody info
|
|
81
|
+
velocity = rigidbody.velocity
|
|
82
|
+
velocity.y = 10
|
|
83
|
+
rigidbody.velocity = velocity
|
|
84
|
+
|
|
85
|
+
pos = rigidbody.position
|
|
86
|
+
|
|
87
|
+
print(pos.x, pos.y, pos.z)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# Getting/editing camera info
|
|
91
|
+
fov = main_cam.fov
|
|
92
|
+
main_cam.fov = fov + 10.0
|
|
93
|
+
|
|
94
|
+
enabled = main_cam.enabled
|
|
95
|
+
main_cam.enabled = not enabled
|
|
96
|
+
|
|
97
|
+
print(main_cam.name)
|
|
98
|
+
|
|
99
|
+
# Finding a object based off name
|
|
100
|
+
player = ref.find_object('Player')
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# Finding a object based off of tag
|
|
104
|
+
player = ref.find_object_with_tag('Player')
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# Listing images
|
|
108
|
+
for image in ref.list_assemblies():
|
|
109
|
+
print(image)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# Listing classes in image
|
|
113
|
+
for clazz in ref.list_classes_in_image('Assembly-CSharp.dll'):
|
|
114
|
+
print(clazz.name)
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
## More Features
|
|
120
|
+
|
|
121
|
+
The example above covers some common use cases, but `unity_helper` also enables:
|
|
122
|
+
|
|
123
|
+
- **Inspecting and interacting with Scene objects** to find and manipulate game entities in real time
|
|
124
|
+
- **Accessing and modifying Component objects**, including Rigidbodies, Cameras, scripts and more
|
|
125
|
+
- **Exploring and updating Transform objects**, such as position, rotation, rect and more
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "unity_helper"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "A runtime reflection toolkit for Unity applications, enabling real-time inspection and interaction with classes, methods, and fields and objects."
|
|
5
|
+
authors = ["Chasss"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
|
|
9
|
+
packages = [
|
|
10
|
+
{ include = "unity_helper", from = "src" }
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent"
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
repository = "http://github.com/chassss/unity_helper"
|
|
20
|
+
|
|
21
|
+
[tool.poetry.dependencies]
|
|
22
|
+
python = ">=3.10,<4.0"
|
|
23
|
+
pylocalmem = "^1.1.1"
|
|
24
|
+
|
|
25
|
+
[build-system]
|
|
26
|
+
requires = ["poetry-core"]
|
|
27
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Public API for unity_helper.
|
|
3
|
+
|
|
4
|
+
Il2cpp:
|
|
5
|
+
Main interface for interacting with IL2CPP.
|
|
6
|
+
|
|
7
|
+
structures:
|
|
8
|
+
Contains useful structures such as Vec3, Vec2, Quaternion, etc.
|
|
9
|
+
|
|
10
|
+
objects:
|
|
11
|
+
Provides high-level wrappers for Unity objects, including
|
|
12
|
+
Component-based systems like Transform, Camera, and Scene, etc.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from .main import Il2cpp
|
|
17
|
+
from . import structures
|
|
18
|
+
from . import mono
|
|
19
|
+
from . import bindings
|
|
20
|
+
from . import objects
|
|
21
|
+
|
|
22
|
+
__all__ = ["Il2cpp", "structures", "objects"]
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Reserved for internal use only.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import ctypes
|
|
7
|
+
from .structures import Vec3, Quaternion, Rect, Il2CppAssembly
|
|
8
|
+
from.mono import MonoClass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Bindings():
|
|
12
|
+
def __DO_API(self, api, argtypes, restype):
|
|
13
|
+
try:
|
|
14
|
+
new_api = api
|
|
15
|
+
new_api.argtypes = argtypes
|
|
16
|
+
new_api.restype = restype
|
|
17
|
+
return new_api
|
|
18
|
+
except:
|
|
19
|
+
return None
|
|
20
|
+
|
|
21
|
+
def _initialize(self):
|
|
22
|
+
self._il2cpp_domain_get = self.__DO_API(self.game_asm.il2cpp_domain_get, [], ctypes.c_void_p)
|
|
23
|
+
self._il2cpp_thread_attach = self.__DO_API(self.game_asm.il2cpp_thread_attach, [ctypes.c_void_p], ctypes.c_void_p)
|
|
24
|
+
self._il2cpp_thread_current = self.__DO_API(self.game_asm.il2cpp_thread_current, [], ctypes.c_void_p)
|
|
25
|
+
self._il2cpp_thread_detach = self.__DO_API(self.game_asm.il2cpp_thread_detach, [ctypes.c_void_p], None)
|
|
26
|
+
self._il2cpp_domain_assembly_open = self.__DO_API(self.game_asm.il2cpp_domain_assembly_open, [ctypes.c_void_p, ctypes.c_char_p], ctypes.c_void_p)
|
|
27
|
+
self._il2cpp_class_from_name = self.__DO_API(self.game_asm.il2cpp_class_from_name, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p], ctypes.c_void_p)
|
|
28
|
+
self._il2cpp_class_get_methods = self.__DO_API(self.game_asm.il2cpp_class_get_methods, [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)], ctypes.c_void_p)
|
|
29
|
+
self._il2cpp_class_get_method_from_name = self.__DO_API(self.game_asm.il2cpp_class_get_method_from_name, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int], ctypes.c_void_p)
|
|
30
|
+
self._il2cpp_method_get_name = self.__DO_API(self.game_asm.il2cpp_method_get_name, [ctypes.c_void_p], ctypes.c_char_p)
|
|
31
|
+
self._il2cpp_method_get_param_count = self.__DO_API(self.game_asm.il2cpp_method_get_param_count, [ctypes.c_void_p], ctypes.c_int)
|
|
32
|
+
self._il2cpp_method_get_param = self.__DO_API(self.game_asm.il2cpp_method_get_param, [ctypes.c_void_p, ctypes.c_void_p], ctypes.c_void_p)
|
|
33
|
+
self._il2cpp_runtime_invoke = self.__DO_API(self.game_asm.il2cpp_runtime_invoke, [ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_void_p)], ctypes.c_void_p)
|
|
34
|
+
self._il2cpp_class_get_fields = self.__DO_API(self.game_asm.il2cpp_class_get_fields, [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)], ctypes.c_void_p)
|
|
35
|
+
self._il2cpp_field_get_name = self.__DO_API(self.game_asm.il2cpp_field_get_name, [ctypes.c_void_p], ctypes.c_char_p)
|
|
36
|
+
self._il2cpp_field_get_type = self.__DO_API(self.game_asm.il2cpp_field_get_type, [ctypes.c_void_p], ctypes.c_void_p)
|
|
37
|
+
self._il2cpp_type_get_name = self.__DO_API(self.game_asm.il2cpp_type_get_name, [ctypes.c_void_p], ctypes.c_char_p)
|
|
38
|
+
self._il2cpp_field_get_offset = self.__DO_API(self.game_asm.il2cpp_field_get_offset, [ctypes.c_void_p], ctypes.c_int)
|
|
39
|
+
self._il2cpp_field_get_value = self.__DO_API(self.game_asm.il2cpp_field_get_value, [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p], None)
|
|
40
|
+
self._il2cpp_image_get_class = self.__DO_API(self.game_asm.il2cpp_image_get_class, [ctypes.c_void_p, ctypes.c_int], ctypes.c_void_p)
|
|
41
|
+
self._il2cpp_image_get_class_count = self.__DO_API(self.game_asm.il2cpp_image_get_class_count, [ctypes.c_void_p], ctypes.c_int)
|
|
42
|
+
self._il2cpp_class_get_namespace = self.__DO_API(self.game_asm.il2cpp_class_get_namespace, [ctypes.c_void_p], ctypes.c_char_p)
|
|
43
|
+
self._il2cpp_class_get_name = self.__DO_API(self.game_asm.il2cpp_class_get_name, [ctypes.c_void_p], ctypes.c_char_p)
|
|
44
|
+
self._il2cpp_field_static_get_value = self.__DO_API(self.game_asm.il2cpp_field_static_get_value, [ctypes.c_void_p, ctypes.c_void_p], None)
|
|
45
|
+
self._il2cpp_field_get_flags = self.__DO_API(self.game_asm.il2cpp_field_get_flags, [ctypes.c_void_p], ctypes.c_int)
|
|
46
|
+
self._il2cpp_field_set_value = self.__DO_API(self.game_asm.il2cpp_field_set_value, [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p], None)
|
|
47
|
+
self._il2cpp_object_unbox = self.__DO_API(self.game_asm.il2cpp_object_unbox, [ctypes.c_void_p], ctypes.c_void_p)
|
|
48
|
+
self._il2cpp_type_get_object = self.__DO_API(self.game_asm.il2cpp_type_get_object, [ctypes.c_void_p], ctypes.c_void_p)
|
|
49
|
+
self._il2cpp_class_get_type = self.__DO_API(self.game_asm.il2cpp_class_get_type, [ctypes.c_void_p], ctypes.c_void_p)
|
|
50
|
+
self._il2cpp_object_get_class = self.__DO_API(self.game_asm.il2cpp_object_get_class, [ctypes.c_void_p], ctypes.c_void_p)
|
|
51
|
+
self._il2cpp_string_new = self.__DO_API(self.game_asm.il2cpp_string_new, [ctypes.c_char_p], ctypes.c_void_p)
|
|
52
|
+
self._il2cpp_method_get_return_type = self.__DO_API(self.game_asm.il2cpp_method_get_return_type, [ctypes.c_void_p], ctypes.c_void_p)
|
|
53
|
+
self._il2cpp_method_get_flags = self.__DO_API(self.game_asm.il2cpp_method_get_flags, [ctypes.c_void_p, ctypes.c_int32], ctypes.c_int32)
|
|
54
|
+
self._il2cpp_class_get_field_from_name = self.__DO_API(self.game_asm.il2cpp_class_get_field_from_name, [ctypes.c_void_p, ctypes.c_char_p], ctypes.c_void_p)
|
|
55
|
+
self._il2cpp_domain_get_assemblies = self.__DO_API(self.game_asm.il2cpp_domain_get_assemblies, [ctypes.c_void_p, ctypes.POINTER(ctypes.c_size_t)], ctypes.POINTER(Il2CppAssembly))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
self._domain: int|None = None
|
|
59
|
+
self._attached = False
|
|
60
|
+
self._assembly_cache: dict[str, int] = {}
|
|
61
|
+
self._image_cache: dict[int, int] = {}
|
|
62
|
+
self._class_cache: list[MonoClass] = []
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# Maybe in the future we can get rid of WINFUNCTYPES and just use calling like GetComponent((_il2cpp_string_new(b'Player'))), etc
|
|
66
|
+
|
|
67
|
+
# Get methods based off of signature because they have numerous duplicate names
|
|
68
|
+
self._component = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Component')
|
|
69
|
+
for i in self._component.list_methods():
|
|
70
|
+
if i.name == 'GetComponent' and i.param_count == 1 and i.param_info[0] == 'Parameter 0 type: System.String':
|
|
71
|
+
self._UnityEngine_Component__GetComponent = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(i.address)
|
|
72
|
+
|
|
73
|
+
self._UnityEngine_Component__get_transform = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._component.find_method('get_transform').address)
|
|
74
|
+
self._UnityEngine_Component__get_gameObject = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._component.find_method('get_gameObject').address)
|
|
75
|
+
self._UnityEngine_Component__get_tag = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._component.find_method('get_tag').address)
|
|
76
|
+
self._UnityEngine_Component__set_tag = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p)(self._component.find_method('set_tag').address)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
self._gameobject = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'GameObject')
|
|
80
|
+
for i in self._gameobject.list_methods():
|
|
81
|
+
if i.name == 'GetComponents' and i.param_count == 1 and i.param_info[0] == 'Parameter 0 type: System.Type':
|
|
82
|
+
self._UnityEngine_GameObject__GetComponents = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(i.address)
|
|
83
|
+
elif i.name == 'AddComponent' and i.param_count == 1 and i.param_info[0] == 'Parameter 0 type: System.Type':
|
|
84
|
+
self._UnityEngine_GameObject__AddComponent = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(i.address)
|
|
85
|
+
|
|
86
|
+
self._UnityEngine_GameObject__Find = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._gameobject.find_method('Find').address)
|
|
87
|
+
self._UnityEngine_GameObject__FindGameObjectWithTag = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._gameobject.find_method('FindGameObjectWithTag').address)
|
|
88
|
+
self._UnityEngine_GameObject__SetActive = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_bool, ctypes.c_void_p)(self._gameobject.find_method('SetActive').address)
|
|
89
|
+
self._UnityEngine_GameObject__get_transform = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._gameobject.find_method('get_transform', param_count=0).address)
|
|
90
|
+
self._UnityEngine_GameObject__get_tag = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._gameobject.find_method('get_tag').address)
|
|
91
|
+
self._UnityEngine_GameObject__set_tag = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._gameobject.find_method('set_tag').address)
|
|
92
|
+
self._UnityEngine_GameObject__get_isStatic = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p)(self._gameobject.find_method('get_isStatic').address)
|
|
93
|
+
self._UnityEngine_GameObject__get_scene = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._gameobject.find_method('get_tag').address)
|
|
94
|
+
|
|
95
|
+
self._behaviour = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Behaviour')
|
|
96
|
+
self._UnityEngine_Behaviour__get_enabled = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p)(self._behaviour.find_method('get_enabled').address)
|
|
97
|
+
self._UnityEngine_Behaviour__set_enabled = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_bool, ctypes.c_void_p)(self._behaviour.find_method('set_enabled').address)
|
|
98
|
+
|
|
99
|
+
self._camera = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Camera')
|
|
100
|
+
|
|
101
|
+
self._UnityEngine_Camera_get_current = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)(self._camera.find_method('get_current').address)
|
|
102
|
+
self._UnityEngine_Camera_get_main = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)(self._camera.find_method('get_main').address)
|
|
103
|
+
self._UnityEngine_Camera_get_allCamerasCount = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)(self._camera.find_method('get_allCamerasCount').address)
|
|
104
|
+
self._UnityEngine_Camera_get_allCameras = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)(self._camera.find_method('get_allCameras').address)
|
|
105
|
+
self._UnityEngine_Camera__get_depth = ctypes.WINFUNCTYPE(ctypes.c_float, ctypes.c_void_p, ctypes.c_void_p)(self._camera.find_method('get_depth').address)
|
|
106
|
+
self._UnityEngine_Camera__set_depth = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_float, ctypes.c_void_p)(self._camera.find_method('set_depth').address)
|
|
107
|
+
self._UnityEngine_Camera__get_fieldOfView = ctypes.WINFUNCTYPE(ctypes.c_float, ctypes.c_void_p, ctypes.c_void_p)(self._camera.find_method('get_fieldOfView').address)
|
|
108
|
+
self._UnityEngine_Camera__set_fieldOfView = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_float, ctypes.c_void_p)(self._camera.find_method('set_fieldOfView').address)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
self._object = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Object')
|
|
112
|
+
|
|
113
|
+
self._UnityEngine_Object__FindObjectOfType = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_bool, ctypes.c_void_p)(self._object.find_method('FindObjectOfType', param_count=2).address)
|
|
114
|
+
self._UnityEngine_Object__FindObjectsOfType = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_bool, ctypes.c_void_p)(self._object.find_method('FindObjectsOfType', param_count=2).address)
|
|
115
|
+
self._UnityEngine_Object__get_name = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._object.find_method('get_name').address)
|
|
116
|
+
self._UnityEngine_Object__set_name = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._object.find_method('set_name').address)
|
|
117
|
+
self._UnityEngine_Object__Destroy = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_float, ctypes.c_void_p)(self._object.find_method('Destroy', param_count=1).address)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
self._transform = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Transform')
|
|
121
|
+
|
|
122
|
+
self._UnityEngine_Transform__IsChildOf = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('IsChildOf').address)
|
|
123
|
+
self._UnityEngine_Transform__get_childCount = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('get_childCount').address)
|
|
124
|
+
self._UnityEngine_Transform__GetChild = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p)(self._transform.find_method('GetChild').address)
|
|
125
|
+
self._UnityEngine_Transform__LookAt_transform = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('LookAt', param_count=1).address)
|
|
126
|
+
self._UnityEngine_Transform__LookAt_pos = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Vec3), ctypes.POINTER(Vec3), ctypes.c_void_p)(self._transform.find_method('LookAt', param_count=2).address)
|
|
127
|
+
self._UnityEngine_Transform__Find = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('Find').address)
|
|
128
|
+
self._UnityEngine_Transform__translate = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Vec3), ctypes.c_int32, ctypes.c_void_p)(self._transform.find_method('Translate').address)
|
|
129
|
+
self._UnityEngine_Transform__set_position = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Vec3), ctypes.c_void_p)(self._transform.find_method('set_position').address)
|
|
130
|
+
self._UnityEngine_Transform__get_position = ctypes.WINFUNCTYPE(None, ctypes.POINTER(Vec3), ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('get_position').address)
|
|
131
|
+
self._UnityEngine_Transform__set_rotation = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Quaternion), ctypes.c_void_p)(self._transform.find_method('set_rotation').address)
|
|
132
|
+
self._UnityEngine_Transform__get_rotation = ctypes.WINFUNCTYPE(None, ctypes.POINTER(Quaternion), ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('get_rotation').address)
|
|
133
|
+
self._UnityEngine_Transform__get_rect = ctypes.WINFUNCTYPE(None, ctypes.POINTER(Rect), ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('get_rotation').address)
|
|
134
|
+
self._UnityEngine_Transform__get_parent = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('get_parent').address)
|
|
135
|
+
self._UnityEngine_Transform__set_parent = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('set_parent').address)
|
|
136
|
+
self._UnityEngine_Transform__get_root = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._transform.find_method('get_parent').address)
|
|
137
|
+
|
|
138
|
+
self._rigidbody = self.get_class_from_name('UnityEngine.PhysicsModule.dll', 'UnityEngine', 'Rigidbody')
|
|
139
|
+
|
|
140
|
+
self._UnityEngine_Rigidbody_set_velocity = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Vec3), ctypes.c_void_p)(self._rigidbody.find_method('set_velocity').address)
|
|
141
|
+
self._UnityEngine_Rigidbody_get_velocity = ctypes.WINFUNCTYPE(None, ctypes.POINTER(Vec3), ctypes.c_void_p, ctypes.c_void_p)(self._rigidbody.find_method('get_velocity').address)
|
|
142
|
+
self._UnityEngine_Rigidbody_AddForce = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Vec3), ctypes.c_int32, ctypes.c_void_p)(self._rigidbody.find_method('AddForce').address)
|
|
143
|
+
self._UnityEngine_Rigidbody_get_centerOfMass = ctypes.WINFUNCTYPE(None, ctypes.POINTER(Vec3), ctypes.c_void_p, ctypes.c_void_p)(self._rigidbody.find_method('get_centerOfMass').address)
|
|
144
|
+
self._UnityEngine_Rigidbody_set_detectCollisions = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_bool, ctypes.c_void_p)(self._rigidbody.find_method('set_detectCollisions').address)
|
|
145
|
+
self._UnityEngine_Rigidbody_get_position = ctypes.WINFUNCTYPE(None, ctypes.POINTER(Vec3), ctypes.c_void_p, ctypes.c_void_p)(self._rigidbody.find_method('get_position').address)
|
|
146
|
+
self._UnityEngine_Rigidbody_set_position = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Vec3), ctypes.c_void_p)(self._rigidbody.find_method('set_position').address)
|
|
147
|
+
self._UnityEngine_Rigidbody_set_useGravity = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_bool, ctypes.c_void_p)(self._rigidbody.find_method('set_useGravity').address)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
self._scene = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine.SceneManagement', 'Scene')
|
|
151
|
+
|
|
152
|
+
self._UnityEngine_Scene__get_name = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('get_name').address)
|
|
153
|
+
self._UnityEngine_Scene__get_path = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('get_path').address)
|
|
154
|
+
self._UnityEngine_Scene__get_rootCount = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('get_rootCount').address)
|
|
155
|
+
self._UnityEngine_Scene__get_isLoaded = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('get_isLoaded').address)
|
|
156
|
+
self._UnityEngine_Scene__get_guid = ctypes.WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('get_guid').address)
|
|
157
|
+
self._UnityEngine_Scene__get_buildIndex = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('get_buildIndex').address)
|
|
158
|
+
self._UnityEngine_Scene__get_handle = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('get_handle').address)
|
|
159
|
+
self._UnityEngine_Scene__IsValid = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p)(self._scene.find_method('IsValid').address)
|
|
160
|
+
|
|
161
|
+
# self._gizmos = self.get_class_by_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Gizmos')
|
|
162
|
+
|
|
163
|
+
# self._UnityEngine_Gizmos__DrawCube = ctypes.WINFUNCTYPE(None, Vec3, Vec3, ctypes.c_void_p)(self._gizmos.find_method('DrawCube').address)
|
|
164
|
+
# self._UnityEngine_Gizmos__DrawLine = ctypes.WINFUNCTYPE(None, Vec3, Vec3, ctypes.c_void_p)(self._gizmos.find_method('DrawLine').address)
|
|
165
|
+
# self._UnityEngine_Gizmos__DrawRay = ctypes.WINFUNCTYPE(None, Vec3, Vec3, ctypes.c_void_p)(self._gizmos.find_method('DrawRay').address)
|
|
166
|
+
# self._UnityEngine_Gizmos__DrawSphere = ctypes.WINFUNCTYPE(None, Vec3, ctypes.c_float, ctypes.c_void_p)(self._gizmos.find_method('DrawSphere').address)
|
|
167
|
+
# self._UnityEngine_Gizmos__DrawWireCube = ctypes.WINFUNCTYPE(None, Vec3, Vec3, ctypes.c_void_p)(self._gizmos.find_method('DrawWireCube').address)
|
|
168
|
+
# self._UnityEngine_Gizmos__DrawWireSphere = ctypes.WINFUNCTYPE(None, Vec3, ctypes.c_float, ctypes.c_void_p)(self._gizmos.find_method('DrawWireSphere').address)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# self._debug = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'Debug')
|
|
172
|
+
|
|
173
|
+
# self._UnityEngine_Debug__DrawLine = ctypes.WINFUNCTYPE(None, Vec3, Vec3, Color, ctypes.c_void_p)(self._debug.find_method('DrawLine', param_count=3).address)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# self._gl = self.get_class_from_name('UnityEngine.CoreModule.dll', 'UnityEngine', 'GL')
|
|
177
|
+
|
|
178
|
+
# self._UnityEngine_GL__Begin = ctypes.WINFUNCTYPE(None, ctypes.c_int32, ctypes.c_void_p)(self._gl.find_method('Begin').address)
|
|
179
|
+
# self._UnityEngine_GL__End = ctypes.WINFUNCTYPE(None, ctypes.c_void_p)(self._gl.find_method('End').address)
|
|
180
|
+
# self._UnityEngine_GL__Vertex3 = ctypes.WINFUNCTYPE(None, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_void_p)(self._gl.find_method('Vertex3').address)
|
|
181
|
+
# self._UnityEngine_GL__Color = ctypes.WINFUNCTYPE(None, Color, ctypes.c_void_p)(self._gl.find_method('Color').address)
|