switch WebRTC to BigEndian.

This commit is contained in:
Miroslav Šedivý 2021-02-13 00:02:35 +01:00
parent fbec6cee63
commit 3423cbc3b2

View File

@ -168,33 +168,33 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
buffer = new ArrayBuffer(7) buffer = new ArrayBuffer(7)
payload = new DataView(buffer) payload = new DataView(buffer)
payload.setUint8(0, OPCODE.MOVE) payload.setUint8(0, OPCODE.MOVE)
payload.setUint16(1, 4, true) payload.setUint16(1, 4)
payload.setUint16(3, data.x, true) payload.setUint16(3, data.x)
payload.setUint16(5, data.y, true) payload.setUint16(5, data.y)
break break
case 'wheel': case 'wheel':
buffer = new ArrayBuffer(7) buffer = new ArrayBuffer(7)
payload = new DataView(buffer) payload = new DataView(buffer)
payload.setUint8(0, OPCODE.SCROLL) payload.setUint8(0, OPCODE.SCROLL)
payload.setUint16(1, 4, true) payload.setUint16(1, 4)
payload.setInt16(3, data.x, true) payload.setInt16(3, data.x)
payload.setInt16(5, data.y, true) payload.setInt16(5, data.y)
break break
case 'keydown': case 'keydown':
case 'mousedown': case 'mousedown':
buffer = new ArrayBuffer(11) buffer = new ArrayBuffer(11)
payload = new DataView(buffer) payload = new DataView(buffer)
payload.setUint8(0, OPCODE.KEY_DOWN) payload.setUint8(0, OPCODE.KEY_DOWN)
payload.setUint16(1, 8, true) payload.setUint16(1, 8)
payload.setBigUint64(3, BigInt(data.key), true) payload.setBigUint64(3, BigInt(data.key))
break break
case 'keyup': case 'keyup':
case 'mouseup': case 'mouseup':
buffer = new ArrayBuffer(11) buffer = new ArrayBuffer(11)
payload = new DataView(buffer) payload = new DataView(buffer)
payload.setUint8(0, OPCODE.KEY_UP) payload.setUint8(0, OPCODE.KEY_UP)
payload.setUint16(1, 8, true) payload.setUint16(1, 8)
payload.setBigUint64(3, BigInt(data.key), true) payload.setBigUint64(3, BigInt(data.key))
break break
default: default:
this._log.warn(`unknown data event: ${event}`) this._log.warn(`unknown data event: ${event}`)