idz: Use string I/O helpers

This commit is contained in:
Tau
2021-02-03 23:43:37 +00:00
committed by Tau
parent 8291994c93
commit 3d0bdf25d4
13 changed files with 36 additions and 45 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ import {
LoadProfileRequest3,
} from "../request/loadProfile";
import { AimeId } from "../../../model";
import { readAsciiStr } from "../../util/bin";
loadProfile2.msgCode = 0x0067;
loadProfile2.msgLen = 0x0020;
@@ -12,7 +13,7 @@ export function loadProfile2(buf: Buffer): LoadProfileRequest2 {
type: "load_profile_req",
format: 2,
aimeId: buf.readUInt32LE(0x0004) as AimeId,
luid: buf.slice(0x0008, buf.indexOf("\0", 0x0008)).toString("ascii"),
luid: readAsciiStr(buf, 0x0008, 0x0020),
};
}
@@ -24,6 +25,6 @@ export function loadProfile3(buf: Buffer): LoadProfileRequest3 {
type: "load_profile_req",
format: 3,
aimeId: buf.readUInt32LE(0x0004) as AimeId,
luid: buf.slice(0x0008, buf.indexOf("\0", 0x0008)).toString("ascii"),
luid: readAsciiStr(buf, 0x0008, 0x0020),
};
}