Skip to content

Commit

Permalink
Change packer to pkg
Browse files Browse the repository at this point in the history
Fix Crash
  • Loading branch information
hjmmc committed May 22, 2018
1 parent cd55a31 commit 218b6d6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ Load the game and enjoy it~

> [iOSGyroForCemuhook](https://github.com/denismr/iOSGyroForCemuhook)
> [jxcore](https://github.com/jxcore)
> [babeljs](http://babeljs.io/)
> [pkg](https://github.com/zeit/pkg)
27 changes: 17 additions & 10 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require("babel-polyfill");
const WebSocket = require("ws");
const dgram = require("dgram");
const crc = require("crc");
Expand Down Expand Up @@ -99,14 +98,12 @@ server.on("listening", () => {
});

server.on("message", (data, rinfo) => {
if (
!(
if (!(
data[0] === char("D") &&
data[1] === char("S") &&
data[2] === char("U") &&
data[3] === char("C")
)
)
))
return;
let index = 4;

Expand Down Expand Up @@ -295,15 +292,21 @@ server.bind(26760);

/////////////////////////////////////////////////

const wss = new WebSocket.Server({ port: 1337 });
const wss = new WebSocket.Server({
port: 1337
});

wss.on("connection", function connection(ws) {
console.log("WS Connected");
phoneIsConnected = true;
ws.on("message", function incoming(message) {
// console.log(message);
data = JSON.parse(message);
Report(long.fromNumber(data.ts, true), { x: 0, y: 0, z: 0 }, data.gyro);
Report(long.fromNumber(data.ts, true), {
x: 0,
y: 0,
z: 0
}, data.gyro);
});
ws.on("error", () => {
phoneIsConnected = false;
Expand All @@ -317,8 +320,7 @@ wss.on("connection", function connection(ws) {

/////////////////////////////////////////////////

http
.createServer(function(request, response) {
http.createServer(function(request, response) {
var filePath = path.join(__dirname, "static.html");
var stat = fs.statSync(filePath);

Expand All @@ -333,7 +335,7 @@ http
.listen(8080, function() {
console.log(`
----------------------------------------
Version 1.4 by hjmmc
Version 1.5 by hjmmc
-----------------------------------------
##Usage
Expand All @@ -353,3 +355,8 @@ http
}
}
});


require('process').on('uncaughtException', function(err) {
console.log(err)
});
4 changes: 1 addition & 3 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
del Gyro.jxp
del Gyro.exe
jx package app.js Gyro --native
pkg -t node9-win-x86 .
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "web-gyro-for-cemuhook",
"version": "1.0.0",
"description": "Use web ondevicemotion event data provided to cemuhook",
"main": "app.js",
"bin": "app.js",
"scripts": {
"start": "node app.js"
},
Expand All @@ -24,7 +24,6 @@
},
"homepage": "https://github.com/hjmmc/WebGyroForCemuhook#readme",
"dependencies": {
"babel-polyfill": "^6.26.0",
"crc": "^3.5.0",
"long": "^3.2.0",
"ws": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion static.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>Gyro Client</title>
</head>
<body>
<p>Version: 1.4 (by hjmmc)</p>
<p>Version: 1.5 (by hjmmc)</p>
<p>Tips:Please keep the screen bright when you use it.</p>
<div>
Sensitivity:<input id="scale" type="number" onchange="scaleChange(this.value)" value="1"><br>
Expand Down
Binary file removed ws_for_nodeV4.rar
Binary file not shown.

0 comments on commit 218b6d6

Please sign in to comment.