idz: Split/fix loadGhost encoder

This commit is contained in:
b166fe48b91eb09f279b79a4ecf57b2f8f0d3705
2021-02-03 23:43:44 +00:00
committed by da5669c09fdb0a288ba01e259a609d7779ac7fc9
parent 8b284107b1
commit 4c0e933ea4
2 changed files with 14 additions and 6 deletions
+10 -2
View File
@@ -1,11 +1,11 @@
import { LoadGhostResponse } from "../response/loadGhost";
export function loadGhost(res: LoadGhostResponse): Buffer {
function _loadGhost(msgCode: number, res: LoadGhostResponse): Buffer {
const buf = Buffer.alloc(0x0070);
// No idea what any of this even does.
buf.writeUInt16LE(0x00a1, 0x0000);
buf.writeUInt16LE(msgCode, 0x0000);
buf.writeUInt16LE(0x0005, 0x0002); // Chunk presence flags: 4 | 1
for (let i = 0; i < 2; i++) {
@@ -29,3 +29,11 @@ export function loadGhost(res: LoadGhostResponse): Buffer {
return buf;
}
export function loadGhost1(res: LoadGhostResponse): Buffer {
return _loadGhost(0x00a1, res);
}
export function loadGhost2(res: LoadGhostResponse): Buffer {
return _loadGhost(0x0096, res);
}