rocketleaguesdk 1.0.1 → 1.0.3
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/examples/basic.ts +22 -34
- package/package.json +1 -1
- package/types/offsets.ts +2 -2
package/examples/basic.ts
CHANGED
|
@@ -7,22 +7,17 @@
|
|
|
7
7
|
* Run with: bun run examples/basic.ts
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import Memory from
|
|
10
|
+
import Memory from 'bun-memory';
|
|
11
11
|
|
|
12
12
|
// Import SDK types and offsets
|
|
13
|
-
import type { Structs } from
|
|
14
|
-
import {
|
|
15
|
-
GNAMES_OFFSET,
|
|
16
|
-
GOBJECTS_OFFSET,
|
|
17
|
-
UObject,
|
|
18
|
-
FNameEntry,
|
|
19
|
-
} from "../types/offsets";
|
|
13
|
+
import type { Structs } from '..';
|
|
14
|
+
import { GNames, GObjects, UObject, FNameEntry } from '../types/offsets';
|
|
20
15
|
|
|
21
16
|
// CarComponent_Boost_TA offsets
|
|
22
17
|
// Found in: classes/TAGame.ts - search for "CarComponent_Boost_TA"
|
|
23
18
|
const BoostOffsets = {
|
|
24
|
-
CurrentBoostAmount: 0x0338,
|
|
25
|
-
MaxBoostAmount: 0x032c,
|
|
19
|
+
CurrentBoostAmount: 0x0338, // float - current boost (0.0 to MaxBoostAmount)
|
|
20
|
+
MaxBoostAmount: 0x032c, // float - maximum boost capacity
|
|
26
21
|
} as const;
|
|
27
22
|
|
|
28
23
|
// =============================================================================
|
|
@@ -30,20 +25,20 @@ const BoostOffsets = {
|
|
|
30
25
|
// =============================================================================
|
|
31
26
|
|
|
32
27
|
// Open the process
|
|
33
|
-
const rl = new Memory(
|
|
34
|
-
const module = rl.modules[
|
|
28
|
+
const rl = new Memory('RocketLeague.exe');
|
|
29
|
+
const module = rl.modules['RocketLeague.exe'];
|
|
35
30
|
|
|
36
31
|
if (!module) {
|
|
37
|
-
throw new Error(
|
|
32
|
+
throw new Error('RocketLeague.exe not found. Is the game running?');
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
const base = module.base;
|
|
41
36
|
|
|
42
37
|
// Calculate absolute addresses from base + offset
|
|
43
|
-
const gNamesPtr = rl.uPtr(base +
|
|
44
|
-
const gObjectsPtr = rl.uPtr(base +
|
|
38
|
+
const gNamesPtr = rl.uPtr(base + GNames);
|
|
39
|
+
const gObjectsPtr = rl.uPtr(base + GObjects);
|
|
45
40
|
|
|
46
|
-
console.log(
|
|
41
|
+
console.log('=== Rocket League SDK Example ===');
|
|
47
42
|
console.log(`Base: 0x${base.toString(16).toUpperCase()}`);
|
|
48
43
|
console.log(`GNames: 0x${gNamesPtr.toString(16).toUpperCase()}`);
|
|
49
44
|
console.log(`GObjects: 0x${gObjectsPtr.toString(16).toUpperCase()}`);
|
|
@@ -73,8 +68,8 @@ function getName(index: number): string {
|
|
|
73
68
|
// Read up to 256 characters (512 bytes for UTF-16)
|
|
74
69
|
const buf = Buffer.allocUnsafe(512);
|
|
75
70
|
rl.read(namePtr, buf);
|
|
76
|
-
const str = buf.toString(
|
|
77
|
-
const nullIdx = str.indexOf(
|
|
71
|
+
const str = buf.toString('utf16le');
|
|
72
|
+
const nullIdx = str.indexOf('\0');
|
|
78
73
|
return nullIdx >= 0 ? str.slice(0, nullIdx) : str;
|
|
79
74
|
} catch {
|
|
80
75
|
return "<error>";
|
|
@@ -132,7 +127,7 @@ function getObjectFullName(objPtr: bigint): string {
|
|
|
132
127
|
outer = rl.uPtr(outer + BigInt(UObject.Outer));
|
|
133
128
|
}
|
|
134
129
|
|
|
135
|
-
const path = outers.length > 0 ? outers.join(
|
|
130
|
+
const path = outers.length > 0 ? outers.join('.') + '.' + name : name;
|
|
136
131
|
return `${className} ${path}`;
|
|
137
132
|
} catch {
|
|
138
133
|
return "<error>";
|
|
@@ -147,9 +142,7 @@ function getObjectFullName(objPtr: bigint): string {
|
|
|
147
142
|
* @param className - The class name to search for
|
|
148
143
|
* @yields Object pointer and full name
|
|
149
144
|
*/
|
|
150
|
-
function* findByClass(
|
|
151
|
-
className: string
|
|
152
|
-
): Generator<{ ptr: bigint; fullName: string }> {
|
|
145
|
+
function* findByClass(className: string): Generator<{ ptr: bigint; fullName: string }> {
|
|
153
146
|
const MAX_OBJECTS = 500_000;
|
|
154
147
|
|
|
155
148
|
for (let i = 0; i < MAX_OBJECTS; i++) {
|
|
@@ -190,32 +183,27 @@ function readFVector(address: bigint): Structs.Core.FVector {
|
|
|
190
183
|
// MAIN: FIND AND DISPLAY BOOST AMOUNTS
|
|
191
184
|
// =============================================================================
|
|
192
185
|
|
|
193
|
-
console.log(
|
|
194
|
-
console.log(
|
|
186
|
+
console.log('Searching for CarComponent_Boost_TA objects...');
|
|
187
|
+
console.log('(Make sure you are in a match to see results)');
|
|
195
188
|
console.log();
|
|
196
189
|
|
|
197
190
|
let found = 0;
|
|
198
|
-
for (const { ptr, fullName } of findByClass(
|
|
191
|
+
for (const { ptr, fullName } of findByClass('CarComponent_Boost_TA')) {
|
|
199
192
|
// Read boost values using the offsets from classes/TAGame.ts
|
|
200
193
|
const currentBoost = rl.f32(ptr + BigInt(BoostOffsets.CurrentBoostAmount));
|
|
201
194
|
const maxBoost = rl.f32(ptr + BigInt(BoostOffsets.MaxBoostAmount));
|
|
202
|
-
const percentage =
|
|
203
|
-
maxBoost > 0 ? ((currentBoost / maxBoost) * 100).toFixed(1) : "0";
|
|
195
|
+
const percentage = maxBoost > 0 ? (currentBoost / maxBoost * 100).toFixed(1) : "0";
|
|
204
196
|
|
|
205
197
|
console.log(`Found: ${fullName}`);
|
|
206
198
|
console.log(` Address: 0x${ptr.toString(16).toUpperCase()}`);
|
|
207
|
-
console.log(
|
|
208
|
-
` Boost: ${currentBoost.toFixed(2)} / ${maxBoost.toFixed(
|
|
209
|
-
2
|
|
210
|
-
)} (${percentage}%)`
|
|
211
|
-
);
|
|
199
|
+
console.log(` Boost: ${currentBoost.toFixed(2)} / ${maxBoost.toFixed(2)} (${percentage}%)`);
|
|
212
200
|
console.log();
|
|
213
201
|
found++;
|
|
214
202
|
}
|
|
215
203
|
|
|
216
204
|
if (found === 0) {
|
|
217
|
-
console.log(
|
|
218
|
-
console.log(
|
|
205
|
+
console.log('No boost components found.');
|
|
206
|
+
console.log('Make sure you are in a match (not main menu or replay).');
|
|
219
207
|
} else {
|
|
220
208
|
console.log(`Total: ${found} boost component(s) found`);
|
|
221
209
|
}
|
package/package.json
CHANGED
package/types/offsets.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/** GNames offset from module base */
|
|
10
|
-
export const
|
|
10
|
+
export const GNames = 0x23ed570n;
|
|
11
11
|
|
|
12
12
|
/** GObjects offset from module base */
|
|
13
|
-
export const
|
|
13
|
+
export const GObjects = 0x23ed5b8n;
|
|
14
14
|
|
|
15
15
|
/** UObject layout offsets */
|
|
16
16
|
export const UObject = {
|