bun-memory 1.0.2 → 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/package.json +1 -1
- package/structs/Memory.ts +27 -0
package/package.json
CHANGED
package/structs/Memory.ts
CHANGED
|
@@ -1296,6 +1296,33 @@ class Memory {
|
|
|
1296
1296
|
|
|
1297
1297
|
return this;
|
|
1298
1298
|
}
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Write a {@link Vector3} as three consecutive 32-bit little-endian floats at the target address.
|
|
1302
|
+
*
|
|
1303
|
+
* Layout:
|
|
1304
|
+
* - +0x00 = x (float32)
|
|
1305
|
+
* - +0x04 = y (float32)
|
|
1306
|
+
* - +0x08 = z (float32)
|
|
1307
|
+
*
|
|
1308
|
+
* Uses `Memory.Scratch12` to avoid allocations and delegates to {@link writeBuffer}.
|
|
1309
|
+
*
|
|
1310
|
+
* @param address Destination address.
|
|
1311
|
+
* @param value Vector with `x`, `y`, and `z` components to write.
|
|
1312
|
+
* @param force When true, temporarily enables `PAGE_EXECUTE_READWRITE` to bypass protection.
|
|
1313
|
+
* @returns `this` for chaining.
|
|
1314
|
+
* @throws {Win32Error} If the underlying write or protection change fails.
|
|
1315
|
+
*/
|
|
1316
|
+
|
|
1317
|
+
public writeVector3(address: bigint | number, value: Vector3, force = false): this {
|
|
1318
|
+
Memory.Scratch12.writeFloatLE(value.x);
|
|
1319
|
+
Memory.Scratch12.writeFloatLE(value.y, 0x04);
|
|
1320
|
+
Memory.Scratch12.writeFloatLE(value.z, 0x08);
|
|
1321
|
+
|
|
1322
|
+
this.writeBuffer(address, Memory.Scratch12, force);
|
|
1323
|
+
|
|
1324
|
+
return this;
|
|
1325
|
+
}
|
|
1299
1326
|
}
|
|
1300
1327
|
|
|
1301
1328
|
export default Memory;
|