bun-memory 1.1.11 → 1.1.12
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.
- package/example/trigger-bot.ts +14 -2
- package/package.json +1 -1
- package/structs/Memory.ts +1 -1
package/example/trigger-bot.ts
CHANGED
|
@@ -9,6 +9,8 @@ import Memory from '../index.ts';
|
|
|
9
9
|
import ClientDLLJSON from './offsets/client_dll.json';
|
|
10
10
|
import OffsetsJSON from './offsets/offsets.json';
|
|
11
11
|
|
|
12
|
+
const { random } = Math;
|
|
13
|
+
|
|
12
14
|
// !
|
|
13
15
|
const buffer = Buffer.from('Hello world!');
|
|
14
16
|
const bufferPtr = ptr(buffer);
|
|
@@ -20,8 +22,6 @@ console.log(cString.byteLength, cString.byteOffset); // undefined undefined
|
|
|
20
22
|
|
|
21
23
|
const Delay = 2.5;
|
|
22
24
|
|
|
23
|
-
const { random } = Math;
|
|
24
|
-
|
|
25
25
|
// Load user32.dll…
|
|
26
26
|
const {
|
|
27
27
|
symbols: { mouse_event },
|
|
@@ -52,6 +52,18 @@ const ClientPtr = cs2.modules['client.dll']?.base;
|
|
|
52
52
|
if (ClientPtr === undefined) {
|
|
53
53
|
throw new TypeError('ClientPtr must not be undefined.');
|
|
54
54
|
}
|
|
55
|
+
// !
|
|
56
|
+
|
|
57
|
+
console.time('Read test');
|
|
58
|
+
|
|
59
|
+
for (let i = 0; i < 10_000_000; i++) {
|
|
60
|
+
// new Uint8Array((random() * 256 + 1) >> 0);
|
|
61
|
+
Buffer.allocUnsafe((random() * 256 + 1) >> 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.timeEnd('Read test');
|
|
65
|
+
|
|
66
|
+
// !
|
|
55
67
|
|
|
56
68
|
// Create a cache for class name strings… 🫠…
|
|
57
69
|
const Cache_Names = new Map<bigint, string>();
|
package/package.json
CHANGED
package/structs/Memory.ts
CHANGED
|
@@ -459,7 +459,7 @@ class Memory {
|
|
|
459
459
|
public cString(address: bigint, value: CString): this;
|
|
460
460
|
public cString(address: bigint, lengthOrValue: number | CString): CString | this {
|
|
461
461
|
if (typeof lengthOrValue === 'number') {
|
|
462
|
-
const scratch =
|
|
462
|
+
const scratch = new Uint8Array(lengthOrValue);
|
|
463
463
|
|
|
464
464
|
this.read(address, scratch);
|
|
465
465
|
|