trainerbase 4.9.1__tar.gz → 4.10.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.
- {trainerbase-4.9.1 → trainerbase-4.10.0}/PKG-INFO +17 -17
- {trainerbase-4.9.1 → trainerbase-4.10.0}/README.md +16 -16
- {trainerbase-4.9.1 → trainerbase-4.10.0}/pyproject.toml +19 -8
- {trainerbase-4.9.1 → trainerbase-4.10.0}/pyproject.toml.orig +11 -10
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/injections.py +2 -2
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/main.py +12 -5
- trainerbase-4.10.0/trainerbase/speedhack.py +101 -0
- trainerbase-4.10.0/trainerbase/vendor/speedhack32.dll +0 -0
- trainerbase-4.10.0/trainerbase/vendor/speedhack64.dll +0 -0
- trainerbase-4.9.1/trainerbase/speedhack.py +0 -57
- trainerbase-4.9.1/trainerbase/vendor/speedhack32.dll +0 -0
- trainerbase-4.9.1/trainerbase/vendor/speedhack64.dll +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/__init__.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/abc.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/codeinjection.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/common/__init__.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/common/abc.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/common/helpers.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/common/keyboard.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/common/rainbow.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/common/tapper.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/common/teleport.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/config.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gameobject.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/__init__.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/helpers.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/misc.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/objects.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/rainbow.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/scripts.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/speedhack.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/tapper.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/teleport.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/gui/types.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/logger.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/memory.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/process.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/py.typed +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/scriptengine.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/tts.py +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/vendor/FASM.EXE +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/vendor/big_logo.png +0 -0
- {trainerbase-4.9.1 → trainerbase-4.10.0}/trainerbase/vendor/trainerbase.ico +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trainerbase
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.10.0
|
|
4
4
|
Summary: Framework for creating game trainers/mods
|
|
5
5
|
Author: v01d, doomayka
|
|
6
6
|
Author-email: v01d <v01d@v01d.ru>, doomayka <doomaykaka@gmail.com>
|
|
@@ -20,19 +20,19 @@ Project-URL: Homepage, https://gitlab.com/python-trainers/
|
|
|
20
20
|
Project-URL: Repository, https://gitlab.com/python-trainers/trainer-base
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
23
|
-
# Trainer Base
|
|
24
|
-
|
|
25
|
-
[](https://badge.fury.io/py/TrainerBase)
|
|
26
|
-
[](https://pepy.tech/project/trainerbase)
|
|
27
|
-
|
|
28
|
-

|
|
29
|
-
|
|
30
|
-
## To create project from template using cookiecutter
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
[Python Trainers](https://gitlab.com/python-trainers)
|
|
23
|
+
# Trainer Base
|
|
24
|
+
|
|
25
|
+
[](https://badge.fury.io/py/TrainerBase)
|
|
26
|
+
[](https://pepy.tech/project/trainerbase)
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
## To create project from template using cookiecutter
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
[Python Trainers](https://gitlab.com/python-trainers)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Trainer Base
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/py/TrainerBase)
|
|
4
|
-
[](https://pepy.tech/project/trainerbase)
|
|
5
|
-
|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
## To create project from template using cookiecutter
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Examples
|
|
15
|
-
|
|
16
|
-
[Python Trainers](https://gitlab.com/python-trainers)
|
|
1
|
+
# Trainer Base
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/TrainerBase)
|
|
4
|
+
[](https://pepy.tech/project/trainerbase)
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## To create project from template using cookiecutter
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
cookiecutter https://gitlab.com/v01d-gl/basic-project-template.git --checkout trainerbase
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
[Python Trainers](https://gitlab.com/python-trainers)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "trainerbase"
|
|
3
|
-
version = "4.
|
|
3
|
+
version = "4.10.0"
|
|
4
4
|
description = "Framework for creating game trainers/mods"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
requires-python = ">=3.14"
|
|
@@ -32,6 +32,21 @@ email = "doomaykaka@gmail.com"
|
|
|
32
32
|
Homepage = "https://gitlab.com/python-trainers/"
|
|
33
33
|
Repository = "https://gitlab.com/python-trainers/trainer-base"
|
|
34
34
|
|
|
35
|
+
[[tool.poe.tasks.lint]]
|
|
36
|
+
cmd = "ruff format ."
|
|
37
|
+
|
|
38
|
+
[[tool.poe.tasks.lint]]
|
|
39
|
+
cmd = "ruff check --fix ."
|
|
40
|
+
|
|
41
|
+
[[tool.poe.tasks.lint]]
|
|
42
|
+
cmd = "basedpyright"
|
|
43
|
+
|
|
44
|
+
[[tool.poe.tasks.build]]
|
|
45
|
+
script = "poethepoet.scripts:rm('dist')"
|
|
46
|
+
|
|
47
|
+
[[tool.poe.tasks.build]]
|
|
48
|
+
cmd = "uv build"
|
|
49
|
+
|
|
35
50
|
[tool.ruff]
|
|
36
51
|
src = ["trainerbase"]
|
|
37
52
|
line-length = 120
|
|
@@ -72,21 +87,17 @@ typeCheckingMode = "standard"
|
|
|
72
87
|
pythonPlatform = "All"
|
|
73
88
|
pythonVersion = "3.14"
|
|
74
89
|
|
|
75
|
-
[[tool.basedpyright.executionEnvironments]]
|
|
76
|
-
root = "."
|
|
77
|
-
extraPaths = ["src"]
|
|
78
|
-
|
|
79
90
|
[tool.uv.build-backend]
|
|
80
91
|
module-name = "trainerbase"
|
|
81
92
|
module-root = ""
|
|
82
93
|
|
|
83
94
|
[build-system]
|
|
84
|
-
requires = ["uv_build>=0.
|
|
95
|
+
requires = ["uv_build>=0.13.6,<1.0.0"]
|
|
85
96
|
build-backend = "uv_build"
|
|
86
97
|
|
|
87
98
|
[dependency-groups]
|
|
88
99
|
dev = [
|
|
89
100
|
"basedpyright>=1.40.2",
|
|
90
|
-
"
|
|
91
|
-
"ruff>=0.17.
|
|
101
|
+
"poethepoet>=0.49.0",
|
|
102
|
+
"ruff>=0.17.3",
|
|
92
103
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "trainerbase"
|
|
3
|
-
version = "4.
|
|
3
|
+
version = "4.10.0"
|
|
4
4
|
description = "Framework for creating game trainers/mods"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
authors = [
|
|
@@ -29,6 +29,14 @@ classifiers = [
|
|
|
29
29
|
Homepage = "https://gitlab.com/python-trainers/"
|
|
30
30
|
Repository = "https://gitlab.com/python-trainers/trainer-base"
|
|
31
31
|
|
|
32
|
+
[tool.poe.tasks]
|
|
33
|
+
lint = [
|
|
34
|
+
{ cmd = "ruff format ." },
|
|
35
|
+
{ cmd = "ruff check --fix ." },
|
|
36
|
+
{ cmd = "basedpyright" },
|
|
37
|
+
]
|
|
38
|
+
build = [{ script = "poethepoet.scripts:rm('dist')" }, { cmd = "uv build" }]
|
|
39
|
+
|
|
32
40
|
[tool.ruff]
|
|
33
41
|
src = ["trainerbase"]
|
|
34
42
|
line-length = 120
|
|
@@ -68,21 +76,14 @@ include = ["trainerbase"]
|
|
|
68
76
|
typeCheckingMode = "standard"
|
|
69
77
|
pythonPlatform = "All"
|
|
70
78
|
pythonVersion = "3.14"
|
|
71
|
-
executionEnvironments = [
|
|
72
|
-
{ root = ".", extraPaths = ["src"] }
|
|
73
|
-
]
|
|
74
79
|
|
|
75
80
|
[tool.uv.build-backend]
|
|
76
81
|
module-name = "trainerbase"
|
|
77
82
|
module-root = ""
|
|
78
83
|
|
|
79
84
|
[build-system]
|
|
80
|
-
requires = ["uv_build>=0.
|
|
85
|
+
requires = ["uv_build>=0.13.6,<1.0.0"]
|
|
81
86
|
build-backend = "uv_build"
|
|
82
87
|
|
|
83
88
|
[dependency-groups]
|
|
84
|
-
dev = [
|
|
85
|
-
"basedpyright>=1.40.2",
|
|
86
|
-
"invoke>=3.0.3",
|
|
87
|
-
"ruff>=0.17.1",
|
|
88
|
-
]
|
|
89
|
+
dev = ["basedpyright>=1.40.2", "poethepoet>=0.49.0", "ruff>=0.17.3"]
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from traceback import print_exc
|
|
2
1
|
from typing import override
|
|
3
2
|
from uuid import uuid4
|
|
4
3
|
|
|
@@ -8,6 +7,7 @@ from pymem.exception import MemoryReadError, MemoryWriteError
|
|
|
8
7
|
|
|
9
8
|
from trainerbase.codeinjection import AbstractCodeInjection
|
|
10
9
|
from trainerbase.gui.types import AbstractUIComponent
|
|
10
|
+
from trainerbase.logger import logger
|
|
11
11
|
from trainerbase.tts import say
|
|
12
12
|
|
|
13
13
|
|
|
@@ -44,7 +44,7 @@ class CodeInjectionUI(AbstractUIComponent):
|
|
|
44
44
|
change_codeinjection_state()
|
|
45
45
|
except MemoryReadError, MemoryWriteError, ValueError:
|
|
46
46
|
dpg.set_value(self.dpg_tag, not dpg.get_value(self.dpg_tag))
|
|
47
|
-
|
|
47
|
+
logger.exception("Failed to change code injection state: %s", self.pure_label)
|
|
48
48
|
|
|
49
49
|
def on_hotkey_press(self):
|
|
50
50
|
dpg.set_value(self.dpg_tag, not dpg.get_value(self.dpg_tag))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
2
|
from os import _exit as force_exit
|
|
3
|
-
from
|
|
3
|
+
from signal import SIG_IGN, SIGBREAK, SIGINT, SIGTERM, default_int_handler, signal
|
|
4
4
|
from typing import NoReturn
|
|
5
5
|
|
|
6
6
|
from trainerbase.codeinjection import safely_eject_all_code_injections
|
|
@@ -28,6 +28,11 @@ def run(
|
|
|
28
28
|
on_shutdown_hook: Callback | None = None,
|
|
29
29
|
) -> NoReturn:
|
|
30
30
|
def on_shutdown() -> NoReturn:
|
|
31
|
+
# Poe repeats console signals while waiting for cleanup to finish.
|
|
32
|
+
signal(SIGINT, SIG_IGN)
|
|
33
|
+
signal(SIGTERM, SIG_IGN)
|
|
34
|
+
signal(SIGBREAK, SIG_IGN)
|
|
35
|
+
|
|
31
36
|
logger.info("Shutting down...")
|
|
32
37
|
|
|
33
38
|
logger.debug("Ejecting Code Injections.")
|
|
@@ -60,10 +65,12 @@ def run(
|
|
|
60
65
|
try:
|
|
61
66
|
on_gui_initialized_hook()
|
|
62
67
|
except Exception:
|
|
63
|
-
logger.
|
|
64
|
-
print_exc()
|
|
68
|
+
logger.exception("Exception occurred while calling on_gui_initialized_hook.")
|
|
65
69
|
on_shutdown()
|
|
66
70
|
|
|
71
|
+
signal(SIGTERM, default_int_handler)
|
|
72
|
+
signal(SIGBREAK, default_int_handler)
|
|
73
|
+
|
|
67
74
|
logger.info("Starting...")
|
|
68
75
|
logger.debug("Registering core scripts")
|
|
69
76
|
system_script_engine.simple_script(update_frozen_objects, enabled=True)
|
|
@@ -77,8 +84,8 @@ def run(
|
|
|
77
84
|
try:
|
|
78
85
|
run_gui(on_gui_initialized, on_shutdown)
|
|
79
86
|
except Exception:
|
|
80
|
-
|
|
87
|
+
logger.exception("Exception occurred while running GUI.")
|
|
81
88
|
except KeyboardInterrupt:
|
|
82
|
-
logger.info("
|
|
89
|
+
logger.info("Shutdown requested (KeyboardInterrupt)")
|
|
83
90
|
|
|
84
91
|
on_shutdown()
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
from contextlib import suppress
|
|
2
|
+
from enum import IntEnum, auto
|
|
3
|
+
from logging import DEBUG
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Final, Self, cast
|
|
6
|
+
|
|
7
|
+
from pymem.exception import MemoryReadError, MemoryWriteError
|
|
8
|
+
from trainerbase_injector import inject
|
|
9
|
+
|
|
10
|
+
from trainerbase.config import config
|
|
11
|
+
from trainerbase.gameobject import GameDouble, GameUnsignedInt
|
|
12
|
+
from trainerbase.logger import logger
|
|
13
|
+
from trainerbase.memory import ARCH, AOBScan
|
|
14
|
+
from trainerbase.process import pm
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
SPEEDHACK_DLL_MODULE_NAME: Final[str] = f"speedhack{ARCH}.dll"
|
|
18
|
+
SPEEDHACK_DLL_PATH: Final[Path] = config.vendor.folder / SPEEDHACK_DLL_MODULE_NAME
|
|
19
|
+
SPEED_MODIFIER_ANCHOR: Final[bytes] = b"trainerbase__speedhackrs__anchor"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class SpeedHackBackend(IntEnum):
|
|
23
|
+
# Keep the order in sync with the DLL ABI.
|
|
24
|
+
WINDOWS = auto()
|
|
25
|
+
UNITY_IL2CPP = auto()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SpeedHackStatus(IntEnum):
|
|
29
|
+
IDLE = 0 # Initial value in the DLL.
|
|
30
|
+
WAITING_FOR_UNITY = auto()
|
|
31
|
+
READY = auto()
|
|
32
|
+
UNITY_NOT_READY = auto()
|
|
33
|
+
FAILED = auto()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class SpeedHack:
|
|
37
|
+
_instance: Self | None = None
|
|
38
|
+
|
|
39
|
+
def __new__(cls, *, backend: SpeedHackBackend = SpeedHackBackend.WINDOWS) -> Self:
|
|
40
|
+
backend = SpeedHackBackend(backend)
|
|
41
|
+
if cls._instance is not None:
|
|
42
|
+
if cls._instance.backend != backend:
|
|
43
|
+
raise RuntimeError("The speedhack backend was already chosen. Restart the game to change it.")
|
|
44
|
+
return cls._instance
|
|
45
|
+
|
|
46
|
+
instance = super().__new__(cls)
|
|
47
|
+
instance._initialize(backend)
|
|
48
|
+
cls._instance = instance
|
|
49
|
+
return instance
|
|
50
|
+
|
|
51
|
+
def _initialize(self, backend: SpeedHackBackend):
|
|
52
|
+
inject(cast(int, pm.process_id), str(SPEEDHACK_DLL_PATH))
|
|
53
|
+
speed_address = AOBScan(
|
|
54
|
+
SPEED_MODIFIER_ANCHOR,
|
|
55
|
+
add=len(SPEED_MODIFIER_ANCHOR),
|
|
56
|
+
module_name=SPEEDHACK_DLL_MODULE_NAME,
|
|
57
|
+
).resolve()
|
|
58
|
+
backend_address = speed_address + GameDouble.ctype_size
|
|
59
|
+
backend_setting = GameUnsignedInt(backend_address, is_tracked=False)
|
|
60
|
+
selected_backend = backend_setting.value
|
|
61
|
+
if selected_backend == 0:
|
|
62
|
+
backend_setting.value = backend
|
|
63
|
+
elif selected_backend != backend:
|
|
64
|
+
raise RuntimeError("The loaded DLL has a different speedhack backend. Restart the game to change it.")
|
|
65
|
+
self._status = GameUnsignedInt(backend_address + GameUnsignedInt.ctype_size, is_tracked=False)
|
|
66
|
+
self._speed_modifier = GameDouble(speed_address, is_tracked=False)
|
|
67
|
+
self._speed_modifier.value = 1.0
|
|
68
|
+
self._backend = backend
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def backend(self) -> SpeedHackBackend:
|
|
72
|
+
return self._backend
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def status(self) -> SpeedHackStatus:
|
|
76
|
+
return SpeedHackStatus(self._status.value)
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def factor(self):
|
|
80
|
+
return self._speed_modifier.value
|
|
81
|
+
|
|
82
|
+
@factor.setter
|
|
83
|
+
def factor(self, value: float):
|
|
84
|
+
self._speed_modifier.value = value
|
|
85
|
+
if logger.isEnabledFor(DEBUG):
|
|
86
|
+
status = "UNAVAILABLE"
|
|
87
|
+
with suppress(MemoryReadError, ValueError):
|
|
88
|
+
status = self.status.name
|
|
89
|
+
logger.debug(
|
|
90
|
+
"Speedhack snapshot after factor write (requested_factor=%s, backend=%s, status=%s)",
|
|
91
|
+
value,
|
|
92
|
+
self.backend.name,
|
|
93
|
+
status,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def disable(cls):
|
|
98
|
+
instance = cls._instance
|
|
99
|
+
if instance is not None:
|
|
100
|
+
with suppress(MemoryWriteError):
|
|
101
|
+
instance.factor = 1.0
|
|
Binary file
|
|
Binary file
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
from contextlib import suppress
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import Final, Self, cast
|
|
4
|
-
|
|
5
|
-
from pymem.exception import MemoryWriteError
|
|
6
|
-
from trainerbase_injector import inject
|
|
7
|
-
|
|
8
|
-
from trainerbase.config import config
|
|
9
|
-
from trainerbase.gameobject import GameDouble
|
|
10
|
-
from trainerbase.memory import ARCH, AOBScan
|
|
11
|
-
from trainerbase.process import pm
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
SPEEDHACK_DLL_MODULE_NAME: Final[str] = f"speedhack{ARCH}.dll"
|
|
15
|
-
SPEEDHACK_DLL_PATH: Final[Path] = config.vendor.folder / SPEEDHACK_DLL_MODULE_NAME
|
|
16
|
-
SPEED_MODIFIER_ANCHOR: Final[bytes] = b"trainerbase__speedhackrs__anchor"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class SpeedHack:
|
|
20
|
-
_instance: Self | None = None
|
|
21
|
-
|
|
22
|
-
def __new__(cls, *_args, **_kwargs):
|
|
23
|
-
if cls._instance is None:
|
|
24
|
-
cls._instance = super().__new__(cls)
|
|
25
|
-
|
|
26
|
-
return cls._instance
|
|
27
|
-
|
|
28
|
-
def __init__(self):
|
|
29
|
-
self._inject()
|
|
30
|
-
self._speed_modifier = GameDouble(
|
|
31
|
-
AOBScan(
|
|
32
|
-
SPEED_MODIFIER_ANCHOR,
|
|
33
|
-
add=len(SPEED_MODIFIER_ANCHOR),
|
|
34
|
-
module_name=SPEEDHACK_DLL_MODULE_NAME,
|
|
35
|
-
),
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
self.factor = 1.0
|
|
39
|
-
|
|
40
|
-
def _inject(self):
|
|
41
|
-
inject(cast(int, pm.process_id), str(SPEEDHACK_DLL_PATH))
|
|
42
|
-
|
|
43
|
-
@property
|
|
44
|
-
def factor(self):
|
|
45
|
-
return self._speed_modifier.value
|
|
46
|
-
|
|
47
|
-
@factor.setter
|
|
48
|
-
def factor(self, value: float):
|
|
49
|
-
self._speed_modifier.value = value
|
|
50
|
-
|
|
51
|
-
@classmethod
|
|
52
|
-
def disable(cls):
|
|
53
|
-
if cls._instance is None:
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
with suppress(MemoryWriteError):
|
|
57
|
-
cls._instance.factor = 1.0
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|