bun-memory 1.1.23 → 1.1.25
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 +9 -29
- package/package.json +2 -2
- package/runtime/extensions.ts +86 -864
- package/structs/Memory.ts +152 -134
package/example/trigger-bot.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FFIType, dlopen } from 'bun:ffi';
|
|
2
2
|
import { sleep } from 'bun';
|
|
3
3
|
|
|
4
|
-
import Memory from '
|
|
4
|
+
import Memory from 'bun-memory';
|
|
5
5
|
|
|
6
6
|
// Get the latest client_dll.json and offsets.json from:
|
|
7
7
|
// https://github.com/a2x/cs2-dumper/tree/main/output
|
|
@@ -28,16 +28,15 @@ const { C_BaseEntity, C_BasePlayerPawn, C_BasePlayerWeapon, C_CSPlayerPawn, C_CS
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// Load the needed offsets as bigints…
|
|
31
|
-
const {
|
|
32
|
-
|
|
31
|
+
const {
|
|
32
|
+
'client.dll': { dwEntityList, dwGlobalVars, dwLocalPlayerController, dwLocalPlayerPawn },
|
|
33
|
+
'engine2.dll': {},
|
|
34
|
+
} = Object.fromEntries(
|
|
35
|
+
Object.entries(OffsetsJSON).map(([name, section]) => [name, Object.fromEntries(Object.entries(section).map(([key, value]) => [key, BigInt(value as number)]))]) //
|
|
33
36
|
) as {
|
|
34
|
-
[K in keyof (typeof OffsetsJSON)[
|
|
37
|
+
[M in keyof typeof OffsetsJSON]: { [K in keyof (typeof OffsetsJSON)[M]]: bigint };
|
|
35
38
|
};
|
|
36
39
|
|
|
37
|
-
const a: bigint[] = [1n];
|
|
38
|
-
|
|
39
|
-
console.log(typeof a);
|
|
40
|
-
|
|
41
40
|
// Open a handle to cs2.exe…
|
|
42
41
|
const cs2 = new Memory('cs2.exe');
|
|
43
42
|
|
|
@@ -47,23 +46,6 @@ const ClientPtr = cs2.modules['client.dll']?.base;
|
|
|
47
46
|
if (ClientPtr === undefined) {
|
|
48
47
|
throw new TypeError('ClientPtr must not be undefined.');
|
|
49
48
|
}
|
|
50
|
-
// !
|
|
51
|
-
|
|
52
|
-
console.time('test');
|
|
53
|
-
|
|
54
|
-
// while (true) {
|
|
55
|
-
// for (const pointer of pointers) {
|
|
56
|
-
// const cString = cs2.cString(pointer, 32).toString();
|
|
57
|
-
|
|
58
|
-
// if (cString.length > 32) {
|
|
59
|
-
// console.log(cString);
|
|
60
|
-
// }
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
|
|
64
|
-
console.timeEnd('test');
|
|
65
|
-
|
|
66
|
-
// !
|
|
67
49
|
|
|
68
50
|
// Create a cache for class name strings… 🫠…
|
|
69
51
|
const Cache_Names = new Map<bigint, string>();
|
|
@@ -107,9 +89,7 @@ async function tick(ClientPtr: bigint) {
|
|
|
107
89
|
return;
|
|
108
90
|
} else if (Local_NextPrimaryAttackTick > Local_TickBase) {
|
|
109
91
|
return;
|
|
110
|
-
} else if (Local_WeaponType === 0 || Local_WeaponType === 9) {
|
|
111
|
-
return;
|
|
112
|
-
} else if (Local_WeaponType === 5 && !(Local_IsScoped && Local_ZoomLevel !== 0)) {
|
|
92
|
+
} else if (Local_WeaponType === 0 || (Local_WeaponType === 5 && !(Local_IsScoped && Local_ZoomLevel !== 0)) || Local_WeaponType === 7 || Local_WeaponType === 9) {
|
|
113
93
|
return;
|
|
114
94
|
}
|
|
115
95
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"bugs": {
|
|
4
4
|
"url": "https://github.com/obscuritysrl/bun-memory/issues"
|
|
5
5
|
},
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Blazing fast, high-performance Windows process memory manipulation for Bun.",
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@types/bun": "latest"
|
|
9
9
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "git://github.com/obscuritysrl/bun-memory.git"
|
|
23
23
|
},
|
|
24
24
|
"type": "module",
|
|
25
|
-
"version": "1.1.
|
|
25
|
+
"version": "1.1.25",
|
|
26
26
|
"main": "./index.ts",
|
|
27
27
|
"keywords": [
|
|
28
28
|
"bun",
|