trainerbase 4.9.2__tar.gz → 4.11.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.2 → trainerbase-4.11.0}/PKG-INFO +1 -1
- {trainerbase-4.9.2 → trainerbase-4.11.0}/pyproject.toml +1 -1
- {trainerbase-4.9.2 → trainerbase-4.11.0}/pyproject.toml.orig +1 -1
- trainerbase-4.11.0/trainerbase/speedhack.py +102 -0
- trainerbase-4.11.0/trainerbase/vendor/speedhack32.dll +0 -0
- trainerbase-4.11.0/trainerbase/vendor/speedhack64.dll +0 -0
- trainerbase-4.9.2/trainerbase/speedhack.py +0 -57
- trainerbase-4.9.2/trainerbase/vendor/speedhack32.dll +0 -0
- trainerbase-4.9.2/trainerbase/vendor/speedhack64.dll +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/README.md +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/__init__.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/abc.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/codeinjection.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/common/__init__.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/common/abc.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/common/helpers.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/common/keyboard.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/common/rainbow.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/common/tapper.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/common/teleport.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/config.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gameobject.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/__init__.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/helpers.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/injections.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/misc.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/objects.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/rainbow.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/scripts.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/speedhack.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/tapper.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/teleport.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/gui/types.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/logger.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/main.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/memory.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/process.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/py.typed +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/scriptengine.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/tts.py +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/vendor/FASM.EXE +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/vendor/big_logo.png +0 -0
- {trainerbase-4.9.2 → trainerbase-4.11.0}/trainerbase/vendor/trainerbase.ico +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
UNITY_MONO = auto()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class SpeedHackStatus(IntEnum):
|
|
30
|
+
IDLE = 0 # Initial value in the DLL.
|
|
31
|
+
WAITING_FOR_UNITY = auto()
|
|
32
|
+
READY = auto()
|
|
33
|
+
UNITY_NOT_READY = auto()
|
|
34
|
+
FAILED = auto()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class SpeedHack:
|
|
38
|
+
_instance: Self | None = None
|
|
39
|
+
|
|
40
|
+
def __new__(cls, *, backend: SpeedHackBackend = SpeedHackBackend.WINDOWS) -> Self:
|
|
41
|
+
backend = SpeedHackBackend(backend)
|
|
42
|
+
if cls._instance is not None:
|
|
43
|
+
if cls._instance.backend != backend:
|
|
44
|
+
raise RuntimeError("The speedhack backend was already chosen. Restart the game to change it.")
|
|
45
|
+
return cls._instance
|
|
46
|
+
|
|
47
|
+
instance = super().__new__(cls)
|
|
48
|
+
instance._initialize(backend)
|
|
49
|
+
cls._instance = instance
|
|
50
|
+
return instance
|
|
51
|
+
|
|
52
|
+
def _initialize(self, backend: SpeedHackBackend):
|
|
53
|
+
inject(cast(int, pm.process_id), str(SPEEDHACK_DLL_PATH))
|
|
54
|
+
speed_address = AOBScan(
|
|
55
|
+
SPEED_MODIFIER_ANCHOR,
|
|
56
|
+
add=len(SPEED_MODIFIER_ANCHOR),
|
|
57
|
+
module_name=SPEEDHACK_DLL_MODULE_NAME,
|
|
58
|
+
).resolve()
|
|
59
|
+
backend_address = speed_address + GameDouble.ctype_size
|
|
60
|
+
backend_setting = GameUnsignedInt(backend_address, is_tracked=False)
|
|
61
|
+
selected_backend = backend_setting.value
|
|
62
|
+
if selected_backend == 0:
|
|
63
|
+
backend_setting.value = backend
|
|
64
|
+
elif selected_backend != backend:
|
|
65
|
+
raise RuntimeError("The loaded DLL has a different speedhack backend. Restart the game to change it.")
|
|
66
|
+
self._status = GameUnsignedInt(backend_address + GameUnsignedInt.ctype_size, is_tracked=False)
|
|
67
|
+
self._speed_modifier = GameDouble(speed_address, is_tracked=False)
|
|
68
|
+
self._speed_modifier.value = 1.0
|
|
69
|
+
self._backend = backend
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def backend(self) -> SpeedHackBackend:
|
|
73
|
+
return self._backend
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def status(self) -> SpeedHackStatus:
|
|
77
|
+
return SpeedHackStatus(self._status.value)
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def factor(self):
|
|
81
|
+
return self._speed_modifier.value
|
|
82
|
+
|
|
83
|
+
@factor.setter
|
|
84
|
+
def factor(self, value: float):
|
|
85
|
+
self._speed_modifier.value = value
|
|
86
|
+
if logger.isEnabledFor(DEBUG):
|
|
87
|
+
status = "UNAVAILABLE"
|
|
88
|
+
with suppress(MemoryReadError, ValueError):
|
|
89
|
+
status = self.status.name
|
|
90
|
+
logger.debug(
|
|
91
|
+
"Speedhack snapshot after factor write (requested_factor=%s, backend=%s, status=%s)",
|
|
92
|
+
value,
|
|
93
|
+
self.backend.name,
|
|
94
|
+
status,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def disable(cls):
|
|
99
|
+
instance = cls._instance
|
|
100
|
+
if instance is not None:
|
|
101
|
+
with suppress(MemoryWriteError):
|
|
102
|
+
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|