summaryrefslogtreecommitdiff
path: root/src/packets/snes.ts
diff options
context:
space:
mode:
authorTheMas3212 <mas3212@gmail.com>2023-09-25 12:38:37 +1000
committerTheMas3212 <mas3212@gmail.com>2023-09-25 12:38:37 +1000
commitd78b5e9f718b476da74ec67e05def9ceb622270e (patch)
tree1b4ec2789e9763048546607459833110197e5d59 /src/packets/snes.ts
parent16a790a5b27f3d4212f9dd9be49fa33cf97c6b92 (diff)
downloadtasd-js-d78b5e9f718b476da74ec67e05def9ceb622270e.tar.gz
tasd-js-d78b5e9f718b476da74ec67e05def9ceb622270e.zip
Update to match specification as of 2023-09-25
Update TRANSITION Add PORT_OVERREAD Add SNES_LATCH_FILTER Remove SNES_OVERREAD Remove NES_OVERREAD
Diffstat (limited to 'src/packets/snes.ts')
-rw-r--r--src/packets/snes.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/packets/snes.ts b/src/packets/snes.ts
index 07ee91b..5235a79 100644
--- a/src/packets/snes.ts
+++ b/src/packets/snes.ts
@@ -1,46 +1,46 @@
import { PACKET_TYPES } from "../constants";
-import { encodeString, readBoolean, readString, readUint64, readUint8, writeBoolean, writeUint64, writeUint8 } from "../utils";
+import { encodeString, readString, readUint16, readUint64, readUint8, writeUint16, writeUint64, writeUint8 } from "../utils";
import { TASDPacket, buildBuffer } from "./utils";
-export class SNESClockFilterPacket implements TASDPacket {
+export class SNESLatchFilterPacket implements TASDPacket {
constructor(public time: number) {}
get key() {
- return PACKET_TYPES.SNES_CLOCK_FILTER;
+ return PACKET_TYPES.SNES_LATCH_FILTER;
}
get size() {
- return 1;
+ return 2;
}
static fromBuffer(buffer: Uint8Array) {
- return new this(readUint8(buffer, 0));
+ return new this(readUint16(buffer, 0));
}
toBuffer(g_keylen: number): Uint8Array {
- const payload = new Uint8Array(1);
- writeUint8(this.time, payload, 0);
+ const payload = new Uint8Array(2);
+ writeUint16(this.time, payload, 0);
return buildBuffer(g_keylen, this.key, payload);
}
toString(): string {
- return `SNESClockFilter ${this.time}`;
+ return `SNESLatchFilter ${this.time}`;
}
}
-export class SNESOverreadPacket implements TASDPacket {
- constructor(public high: boolean) {}
+export class SNESClockFilterPacket implements TASDPacket {
+ constructor(public time: number) {}
get key() {
- return PACKET_TYPES.SNES_OVERREAD;
+ return PACKET_TYPES.SNES_CLOCK_FILTER;
}
get size() {
return 1;
}
static fromBuffer(buffer: Uint8Array) {
- return new this(readBoolean(buffer, 0));
+ return new this(readUint8(buffer, 0));
}
toBuffer(g_keylen: number): Uint8Array {
const payload = new Uint8Array(1);
- writeBoolean(this.high, payload, 0);
+ writeUint8(this.time, payload, 0);
return buildBuffer(g_keylen, this.key, payload);
}
toString(): string {
- return `SNESOverread ${this.high}`;
+ return `SNESClockFilter ${this.time}`;
}
}