robloxmemoryapi 0.3.1__cp39-cp39-win_amd64.whl

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.
@@ -0,0 +1,112 @@
1
+ import platform
2
+ import math
3
+
4
+ __all__ = ["RobloxRandom", "RobloxGameClient", "__version__"]
5
+ __version__ = "0.0.2"
6
+
7
+ class RobloxRandom:
8
+ MULT = 6364136223846793005
9
+ INC = 105
10
+ MASK64 = (1 << 64) - 1
11
+
12
+ def __init__(self, seed):
13
+ s = math.floor(seed)
14
+
15
+ self._state = 0
16
+ self._inc = RobloxRandom.INC
17
+ self._next_internal() # warm-up #1
18
+ self._state = (self._state + s) & RobloxRandom.MASK64
19
+ self._next_internal() # warm-up #2
20
+
21
+ def _next_internal(self):
22
+ old = self._state
23
+ self._state = (old * RobloxRandom.MULT + self._inc) & RobloxRandom.MASK64
24
+ x = ((old >> 18) ^ old) >> 27
25
+ r = old >> 59
26
+ return ((x >> r) | (x << ((32 - r) & 31))) & 0xFFFFFFFF
27
+
28
+ def _next_fraction64(self):
29
+ lo = self._next_internal()
30
+ hi = self._next_internal()
31
+ bits = (hi << 32) | lo
32
+ return bits / 2**64
33
+
34
+ def NextNumber(self, minimum=0.0, maximum=1.0):
35
+ frac = self._next_fraction64()
36
+ return minimum + frac * (maximum - minimum)
37
+
38
+ def NextInteger(self, a, b=None):
39
+ if b is None:
40
+ u = a
41
+ r = self._next_internal()
42
+ return ((u * r) >> 32) + 1
43
+ else:
44
+ lo, hi = (a, b) if a <= b else (b, a)
45
+ u = hi - lo + 1
46
+ r = self._next_internal()
47
+ return ((u * r) >> 32) + lo
48
+
49
+ class RobloxGameClient:
50
+ def __init__(
51
+ self,
52
+ pid: int = None,
53
+ process_name: str = "RobloxPlayerBeta.exe",
54
+ allow_write: bool = False,
55
+ ):
56
+ system = platform.system()
57
+ if system not in {"Windows", "Darwin"}:
58
+ self.failed = True
59
+ return
60
+
61
+ from .utils.memory import (
62
+ EvasiveProcess,
63
+ PROCESS_QUERY_INFORMATION,
64
+ PROCESS_VM_READ,
65
+ PROCESS_VM_WRITE,
66
+ PROCESS_VM_OPERATION,
67
+ get_pid_by_name,
68
+ )
69
+
70
+ if system == "Darwin" and process_name == "RobloxPlayerBeta.exe":
71
+ process_name = "RobloxPlayer"
72
+
73
+ if pid is None:
74
+ self.pid = get_pid_by_name(process_name)
75
+ else:
76
+ self.pid = pid
77
+
78
+ if self.pid is None or self.pid == 0:
79
+ raise ValueError("Failed to get PID.")
80
+
81
+ desired_access = PROCESS_VM_READ | PROCESS_QUERY_INFORMATION
82
+ if allow_write:
83
+ desired_access |= PROCESS_VM_WRITE | PROCESS_VM_OPERATION
84
+
85
+ self.memory_module = EvasiveProcess(self.pid, desired_access)
86
+ self.failed = False
87
+ self._fflags = None
88
+
89
+ def close(self):
90
+ self.memory_module.close()
91
+
92
+ @property
93
+ def FFlags(self):
94
+ if platform.system() not in {"Windows", "Darwin"}:
95
+ raise RuntimeError("This module is only compatible with Windows and macOS.")
96
+ elif self.failed:
97
+ raise RuntimeError("There was an error while getting access to memory. Please try again later.")
98
+
99
+ if self._fflags is None:
100
+ from .utils.rbx.fflags import FFlagManager
101
+ self._fflags = FFlagManager(self.memory_module)
102
+ return self._fflags
103
+
104
+ @property
105
+ def DataModel(self):
106
+ if platform.system() not in {"Windows", "Darwin"}:
107
+ raise RuntimeError("This module is only compatible with Windows and macOS.")
108
+ elif self.failed:
109
+ raise RuntimeError("There was an error while getting access to memory. Please try again later.")
110
+
111
+ from .utils.rbx.instance import DataModel
112
+ return DataModel(self.memory_module)
@@ -0,0 +1 @@
1
+ """Native extension package for robloxmemoryapi."""