mirror of
https://github.com/jwetzell/psn-js.git
synced 2026-08-20 14:39:11 +00:00
ENCODING!! and lots of organization
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (packetHeaderChunk, trackerListChunk) =>
|
||||
chunk(0x6755, Buffer.concat([packetHeaderChunk, trackerListChunk]), true);
|
||||
@@ -0,0 +1,9 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (x, y, z) => {
|
||||
const buf = Buffer.alloc(12);
|
||||
buf.writeFloatLE(x);
|
||||
buf.writeFloatLE(y, 4);
|
||||
buf.writeFloatLE(z, 8);
|
||||
return chunk(0x0004, buf, false);
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (trackerId, fieldChunks) => chunk(trackerId, Buffer.concat(fieldChunks), true);
|
||||
@@ -0,0 +1,3 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (trackerChunks) => chunk(0x0001, Buffer.concat(trackerChunks), true);
|
||||
@@ -0,0 +1,9 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (x, y, z) => {
|
||||
const buf = Buffer.alloc(12);
|
||||
buf.writeFloatLE(x);
|
||||
buf.writeFloatLE(y, 4);
|
||||
buf.writeFloatLE(z, 8);
|
||||
return chunk(0x0002, buf, false);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (x, y, z) => {
|
||||
const buf = Buffer.alloc(12);
|
||||
buf.writeFloatLE(x);
|
||||
buf.writeFloatLE(y, 4);
|
||||
buf.writeFloatLE(z, 8);
|
||||
return chunk(0x0000, buf, false);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (x, y, z) => {
|
||||
const buf = Buffer.alloc(12);
|
||||
buf.writeFloatLE(x);
|
||||
buf.writeFloatLE(y, 4);
|
||||
buf.writeFloatLE(z, 8);
|
||||
return chunk(0x0001, buf, false);
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (validity) => {
|
||||
const buf = Buffer.alloc(4);
|
||||
buf.writeFloatLE(validity);
|
||||
return chunk(0x0003, buf, false);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (timestamp) => {
|
||||
const buf = Buffer.alloc(8);
|
||||
const timestampHigh = timestamp.toString(2).padStart(64, '0').substring(0, 32);
|
||||
const timestampLow = timestamp.toString(2).padStart(64, '0').substring(32);
|
||||
buf.writeUInt32LE(parseInt(timestampLow, 2));
|
||||
buf.writeUInt32LE(parseInt(timestampHigh, 2), 4);
|
||||
return chunk(0x0006, buf, false);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
const chunk = require('../chunk');
|
||||
|
||||
module.exports = (x, y, z) => {
|
||||
const buf = Buffer.alloc(12);
|
||||
buf.writeFloatLE(x);
|
||||
buf.writeFloatLE(y, 4);
|
||||
buf.writeFloatLE(z, 8);
|
||||
return chunk(0x0005, buf, false);
|
||||
};
|
||||
Reference in New Issue
Block a user