diff options
| author | TheMas3212 <mas3212@gmail.com> | 2023-09-24 20:57:51 +1000 |
|---|---|---|
| committer | TheMas3212 <mas3212@gmail.com> | 2023-09-24 20:57:51 +1000 |
| commit | 2341a7ec25e85481251d803be42597981d2bb9db (patch) | |
| tree | 0d1f7c40db52a5279deb53d8bfb98e83a78a1849 /src/packets/genesis.ts | |
| parent | 8aea0dba74aecf0846217b5363cd3f9eab543f35 (diff) | |
| download | tasd-js-2341a7ec25e85481251d803be42597981d2bb9db.tar.gz tasd-js-2341a7ec25e85481251d803be42597981d2bb9db.zip | |
NES, SNES, Genesis and Extra Packets
Diffstat (limited to 'src/packets/genesis.ts')
| -rw-r--r-- | src/packets/genesis.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/packets/genesis.ts b/src/packets/genesis.ts new file mode 100644 index 0000000..807cc45 --- /dev/null +++ b/src/packets/genesis.ts @@ -0,0 +1,22 @@ +import { PACKET_TYPES } from "../constants"; +import { encodeString, readString } from "../utils"; +import { TASDPacket, buildBuffer } from "./utils"; + +export class GenesisGameGenieCodePacket implements TASDPacket { + constructor(public code: string) {} + get key() { + return PACKET_TYPES.GENESIS_GAME_GENIE_CODE; + } + get size() { + return this.code.length; + } + static fromBuffer(buffer: Uint8Array) { + return new this(readString(buffer, 0, buffer.length)); + } + toBuffer(g_keylen: number): Uint8Array { + return buildBuffer(g_keylen, this.key, encodeString(this.code)); + } + toString(): string { + return `GenesisGameGenieCode ${this.code}`; + } +}
\ No newline at end of file |
