From b7fbbe7299234dbf78ba3259697d6f36551112d2 Mon Sep 17 00:00:00 2001 From: giongto35 Date: Tue, 9 Apr 2019 00:05:43 +0800 Subject: [PATCH] Update gameboy --- main.go | 1 - static/index.html | 0 static/js/const.js | 4 ++-- static/js/gameboy_controller.js | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 static/index.html diff --git a/main.go b/main.go index 9cfa4b95..e9371158 100644 --- a/main.go +++ b/main.go @@ -318,7 +318,6 @@ func faninInput(inputChannel chan int, webRTC *webrtc.WebRTC, playerIndex int) { // encode frame if webRTC.IsConnected() { input := <-webRTC.InputChannel - fmt.Println("received", input) // the first 10 bits belong to player 1 // the next 10 belongs to player 2 ... // We standardize and put it to inputChannel (20 bytes) diff --git a/static/index.html b/static/index.html new file mode 100644 index 00000000..e69de29b diff --git a/static/js/const.js b/static/js/const.js index d8a3465a..157e78d1 100644 --- a/static/js/const.js +++ b/static/js/const.js @@ -78,9 +78,9 @@ KEY_MAP = { 67: "start", // c 86: "select", // v - 81: "quit" // q + 81: "quit", // q 83: "save", // s - 76: "load", // l + 76: "load" // l } /* diff --git a/static/js/gameboy_controller.js b/static/js/gameboy_controller.js index 37349e9a..a921ef28 100644 --- a/static/js/gameboy_controller.js +++ b/static/js/gameboy_controller.js @@ -108,7 +108,7 @@ function sendInput() { // prepare key if (stateUnchange || unchangePacket > 0) { st = ""; - KEY_BIT.reverse().forEach(elem => { + KEY_BIT.slice().reverse().forEach(elem => { st += keyState[elem] ? 1 : 0; }); ss = parseInt(st, 2);