Dah super duper update, WIP

This commit is contained in:
DevL0rd 2022-03-03 21:14:33 +07:00
parent 2ae66ce703
commit c25452aa7d
40 changed files with 2458 additions and 1823 deletions

View file

@ -7,11 +7,12 @@ function load(path) {
var contents = fs.readFileSync(path).toString('utf-8'); var contents = fs.readFileSync(path).toString('utf-8');
return JSON.parse(contents) return JSON.parse(contents)
} }
function save(path, obj) { function save(path, obj) {
var contents = JSON.stringify(obj, null, "\t") var contents = JSON.stringify(obj, null, "\t")
fs.mkdir(getDirName(path), { recursive: true }, function (err) { fs.mkdir(getDirName(path), { recursive: true }, function (err) {
if (err) throw err; if (err) throw err;
fs.writeFile(path, contents, function (err) { fs.writeFileSync(path, contents, function (err) {
if (err) throw err; if (err) throw err;
}); });
}); });

View file

@ -1,5 +0,0 @@
@echo off
Title Building...
Echo Building...
nexe main.js -t win32-x86 -o "./NxStreamingService.exe"
pause

View file

@ -1,21 +0,0 @@
//Authour: Dustin Harris
//GitHub: https://github.com/DevL0rd
var fs = require('fs');
var getDirName = require('path').dirname;
function load(path) {
var contents = fs.readFileSync(path).toString('utf-8');
return JSON.parse(contents)
}
function save(path, obj) {
var contents = JSON.stringify(obj, null, "\t")
fs.mkdir(getDirName(path), { recursive: true }, function (err) {
if (err) throw err;
fs.writeFileSync(path, contents, function (err) {
if (err) throw err;
});
});
}
exports.load = load;
exports.save = save;

View file

@ -1,4 +0,0 @@
@echo off
cls
npm install --arch=ia32
pause

View file

@ -1,4 +0,0 @@
@echo off
cls
npm start main.js /ip 172.16.0.12 /q 10
pause

View file

@ -1,611 +0,0 @@
//Authour: Dustin Harris
//GitHub: https://github.com/DevL0rd
const { spawn } = require("child_process");
const DB = require('./Devlord_modules/DB.js');
const Struct = require('struct');
const net = require('net');
const robot = require("robotjs");
const VGen = require("vgen-xbox")
const vgen = new VGen();
const GyroServ = require("./Devlord_modules/GyroServ.js");
var ip = "0.0.0.0"
var quality = 5;
var hidStreamClient = new net.Socket();
var usingVideo = true;
var usingAudio = true;
var abxySwap = false;
var limitFPS = false;
var encoding = "CPU";
var screenWidth = 1280;
var screenHeight = 720;
var screenScale = 1;
var mouseControl = "ANALOG";
function connect() {
hidStreamClient.connect({
host: ip,
port: 2223
});
}
var ffmpegProcess;
var ffmpegAudioProcess;
hidStreamClient.on('error', function (ex) {
if (ex) {
console.log("Could not connect to Switch. Connection timed out...");
setTimeout(connect, 1000);
}
});
var controllerIds = [];
function plugControllerIn() {
try {
var nCid = vgen.pluginNext();
controllerIds.push(nCid);
console.log("Plugged in controller " + nCid + ".");
}
catch (e) {
console.log("Could not plug in virtual controller. Make sure the driver is installed.");
setTimeout(plugControllerIn, 3000);
}
}
function startAudioProcess() {
ffmpegAudioProcess = spawn(
"./lib/ffmpeg.exe",
["-y", "-f", "dshow", "-i", 'audio=virtual-audio-capturer', "-f", "s16le", "-ar", "16000", "-ac", "2", "-c:a", "pcm_s16le", "udp://" + ip + ":2224?pkt_size=640"],
{ detached: false }
);
ffmpegAudioProcess.stdout.on("data", data => {
console.log(`${data}`);
});
ffmpegAudioProcess.stderr.on('data', (data) => {
console.error(`${data}`);
});
ffmpegAudioProcess.on('close', (code) => {
console.log(`AudioProcess process exited with code ${code}`);
});
}
function startVideoProcess() {
var fps = 60;
if (limitFPS) {
fps = 30;
}
var ffmpegVideoArgs = [];
if (encoding == "NVENC") { //Nvidia Encoding
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-c:v", "h264_nvenc", "-gpu", "0", "-rc", "cbr_ld_hq", "-zerolatency", "1", "-f", "h264", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-cq:v", "19", "-g", "999999", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
console.log("Using Nvidia Encoding");
} else if (encoding == "AMDVCE") { //AMD Video Coding Engine
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-c:v", "h264_amf", "-usage", "1", "-rc", "cbr", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
console.log("Using AMD Video Coding Engine");
} else if (encoding == "QSV") {
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-c:v", "h264_qsv", "-preset", "faster", "-profile", "baseline", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
console.log("Using Intel QSV Encoding");
} else { //CPU Software Encoding
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-vf", "scale=1280x720", "-preset", "ultrafast", "-tune", "zerolatency", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-x264-params", "nal-hrd=cbr", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / 2) + "M", "tcp://" + ip + ":2222"];
console.log("Using CPU Encoding");
}
ffmpegProcess = spawn(
"./lib/ffmpeg.exe",
ffmpegVideoArgs,
{
detached: false
}
);
ffmpegProcess.stdout.on("data", data => {
console.log(`${data}`);
});
ffmpegProcess.stderr.on('data', (data) => {
console.error(`${data}`);
});
ffmpegProcess.on('close', (code) => {
console.log(`VideoProcess process exited with code ${code}`);
});
}
hidStreamClient.on('connect', function () {
hidStreamClient.setNoDelay(true);
console.log('Connected to Switch!');
if (usingVideo) {
startVideoProcess();
}
if (usingAudio) {
startAudioProcess();
}
});
function parseInputStruct(buff) {
var input = Struct()
.word32Ule('HeldKeys1')
.word32Sle('LJoyX1')
.word32Sle('LJoyY1')
.word32Sle('RJoyX1')
.word32Sle('RJoyY1')
.word32Ule('HeldKeys2')
.word32Sle('LJoyX2')
.word32Sle('LJoyY2')
.word32Sle('RJoyX2')
.word32Sle('RJoyY2')
.word32Ule('HeldKeys3')
.word32Sle('LJoyX3')
.word32Sle('LJoyY3')
.word32Sle('RJoyX3')
.word32Sle('RJoyY3')
.word32Ule('HeldKeys4')
.word32Sle('LJoyX4')
.word32Sle('LJoyY4')
.word32Sle('RJoyX4')
.word32Sle('RJoyY4')
.word32Ule('HeldKeys5')
.word32Sle('LJoyX5')
.word32Sle('LJoyY5')
.word32Sle('RJoyX5')
.word32Sle('RJoyY5')
.word32Ule('HeldKeys6')
.word32Sle('LJoyX6')
.word32Sle('LJoyY6')
.word32Sle('RJoyX6')
.word32Sle('RJoyY6')
.word32Ule('HeldKeys7')
.word32Sle('LJoyX7')
.word32Sle('LJoyY7')
.word32Sle('RJoyX7')
.word32Sle('RJoyY7')
.word32Ule('HeldKeys8')
.word32Sle('LJoyX8')
.word32Sle('LJoyY8')
.word32Sle('RJoyX8')
.word32Sle('RJoyY8')
.word32Ule('touchX1')
.word32Ule('touchY1')
.word32Ule('touchX2')
.word32Ule('touchY2')
.floatle('accelX')
.floatle('accelY')
.floatle('accelZ')
.floatle('gyroX')
.floatle('gyroY')
.floatle('gyroZ')
.word32Ule('controllerCount')
.word32Ule('frameRate')
input._setBuff(buff);
return input;
};
function isOdd(int) {
return (int & 1) === 1;
}
function heldKeysBitmask(HeldKeys) {
return {
A: isOdd(HeldKeys >> 0),
B: isOdd(HeldKeys >> 1),
X: isOdd(HeldKeys >> 2),
Y: isOdd(HeldKeys >> 3),
LS: isOdd(HeldKeys >> 4),
RS: isOdd(HeldKeys >> 5),
L: isOdd(HeldKeys >> 6),
R: isOdd(HeldKeys >> 7),
ZL: isOdd(HeldKeys >> 8),
ZR: isOdd(HeldKeys >> 9),
Plus: isOdd(HeldKeys >> 10),
Minus: isOdd(HeldKeys >> 11),
Left: isOdd(HeldKeys >> 12),
Up: isOdd(HeldKeys >> 13),
Right: isOdd(HeldKeys >> 14),
Down: isOdd(HeldKeys >> 15)
}
}
function convertAnalog(axis) {
var na;
if (axis) {
na = axis / 32767.5
}
if (na > 1) {
na = 2 - na
na = -na
}
return na;
}
function convertAnalogXY(x, y) {
return { x: convertAnalog(x), y: convertAnalog(y) };
}
function handleControllerInput(hid, controllerId, playerNumber) {
var heldKeys = hid.get("HeldKeys" + playerNumber);
var LJoyX = convertAnalog(hid.get("LJoyX" + playerNumber));
var LJoyY = convertAnalog(hid.get("LJoyY" + playerNumber));
var RJoyX = convertAnalog(hid.get("RJoyX" + playerNumber));
var RJoyY = convertAnalog(hid.get("RJoyY" + playerNumber));
vgen.setAxisL(controllerId, LJoyX, LJoyY);
vgen.setAxisR(controllerId, RJoyX, RJoyY);
var inputStates = heldKeysBitmask(heldKeys);
//Button mapping
if (!abxySwap) {
vgen.setButton(controllerId, vgen.Buttons.B, inputStates.A);
vgen.setButton(controllerId, vgen.Buttons.A, inputStates.B);
vgen.setButton(controllerId, vgen.Buttons.X, inputStates.Y);
vgen.setButton(controllerId, vgen.Buttons.Y, inputStates.X);
} else {
vgen.setButton(controllerId, vgen.Buttons.B, inputStates.B);
vgen.setButton(controllerId, vgen.Buttons.A, inputStates.A);
vgen.setButton(controllerId, vgen.Buttons.X, inputStates.X);
vgen.setButton(controllerId, vgen.Buttons.Y, inputStates.Y);
}
vgen.setButton(controllerId, vgen.Buttons.BACK, inputStates.Minus);
vgen.setButton(controllerId, vgen.Buttons.START, inputStates.Plus);
vgen.setButton(controllerId, vgen.Buttons.LEFT_SHOULDER, inputStates.L);
vgen.setButton(controllerId, vgen.Buttons.RIGHT_SHOULDER, inputStates.R);
vgen.setButton(controllerId, vgen.Buttons.LEFT_THUMB, inputStates.LS);
vgen.setButton(controllerId, vgen.Buttons.RIGHT_THUMB, inputStates.RS);
//Trigger Mapping
if (inputStates.ZL) {
vgen.setTriggerL(controllerId, 1);
} else {
vgen.setTriggerL(controllerId, 0);
}
if (inputStates.ZR) {
vgen.setTriggerR(controllerId, 1);
} else {
vgen.setTriggerR(controllerId, 0);
}
//Dpad mapping
if (inputStates.Up || inputStates.Down || inputStates.Left || inputStates.Right) {
if (inputStates.Up) {
if (inputStates.Left || inputStates.Right) {
if (inputStates.Left) {
vgen.setDpad(controllerId, vgen.Dpad.UP_LEFT);
} else {
vgen.setDpad(controllerId, vgen.Dpad.UP_RIGHT);
}
} else {
vgen.setDpad(controllerId, vgen.Dpad.UP);
}
} else if (inputStates.Down) {
if (inputStates.Left || inputStates.Right) {
if (inputStates.Left) {
vgen.setDpad(controllerId, vgen.Dpad.DOWN_LEFT);
} else {
vgen.setDpad(controllerId, vgen.Dpad.DOWN_RIGHT);
}
} else {
vgen.setDpad(controllerId, vgen.Dpad.DOWN);
}
} else if (inputStates.Left) {
vgen.setDpad(controllerId, vgen.Dpad.LEFT);
} else if (inputStates.Right) {
vgen.setDpad(controllerId, vgen.Dpad.RIGHT);
}
} else {
vgen.setDpad(controllerId, vgen.Dpad.NONE);
}
}
var touchX1old = 0;
var touchY1old = 0;
var leftClicking = false;
var rightTouchTime = 0;
var leftTouchTime = 0;
var rightClicking = false;
var scrolling = false;
var toggledMouseInput = false;
var mouseInput = false;
var touchLeftClicking = false;
var touchRightClicking = false;
function handleMouseInputToggling(hid, playerNumber) {
var heldKeys = hid.get("HeldKeys" + playerNumber);
var inputStates = heldKeysBitmask(heldKeys);
if (inputStates.LS && inputStates.RS) {
if (!toggledMouseInput) {
if (mouseInput) {
mouseInput = false;
} else {
mouseInput = true;
}
toggledMouseInput = true;
}
} else {
toggledMouseInput = false;
}
}
function handleAnalogMouse(hid, playerNumber) {
var RJoyX = convertAnalog(hid.get("RJoyX" + playerNumber));
var RJoyY = convertAnalog(hid.get("RJoyY" + playerNumber));
var LJoyX = convertAnalog(hid.get("LJoyX" + playerNumber));
var LJoyY = convertAnalog(hid.get("LJoyY" + playerNumber));
var heldKeys = hid.get("HeldKeys" + playerNumber);
var inputStates = heldKeysBitmask(heldKeys);
var mouse = robot.getMousePos();
mx = mouse.x + (RJoyX * 25);
my = mouse.y - (RJoyY * 25);
if (mx && my) {
robot.moveMouse(mx, my);
}
if (LJoyX || LJoyY) {
robot.scrollMouse(LJoyX, LJoyY);
}
if (inputStates.ZR) {
if (!leftClicking) {
robot.mouseToggle("down");
leftClicking = true;
}
} else {
if (leftClicking) {
robot.mouseToggle("up");
leftClicking = false;
}
}
if (inputStates.ZL) {
if (!rightClicking) {
robot.mouseToggle("down", "right");
rightClicking = true;
}
} else {
if (rightClicking) {
robot.mouseToggle("up", "right");
rightClicking = false;
}
}
}
var gyroHistory = [];
function smoothGyroMouse(gyro) {
if (gyroHistory.length < 3) {
gyroHistory.push(gyro);
return gyro; //smoothing not ready
} else {
gyroHistory.shift();
gyroHistory.push(gyro);
gyro.x = ((gyroHistory[0].x * 1) + (gyroHistory[1].x * 3) + (gyroHistory[2].x * 5)) / 9;
gyro.y = ((gyroHistory[0].y * 1) + (gyroHistory[1].y * 3) + (gyroHistory[2].y * 5)) / 9;
gyro.z = ((gyroHistory[0].z * 1) + (gyroHistory[1].z * 3) + (gyroHistory[2].z * 5)) / 9;
if (gyro.x < 0.005 && gyro.x > 0) {
gyro.x = 0;
} else if (gyro.x > -0.005 && gyro.x < 0) {
gyro.x = 0;
}
if (gyro.y < 0.005 && gyro.y > 0) {
gyro.y = 0;
} else if (gyro.y > -0.005 && gyro.y < 0) {
gyro.y = 0;
}
if (gyro.z < 0.005 && gyro.z > 0) {
gyro.z = 0;
} else if (gyro.z > -0.005 && gyro.z < 0) {
gyro.z = 0;
}
return gyro;
}
}
var touchX1Old = 0;
var touchY1Old = 0;
function handleGyroMouse(hid, playerNumber) {
var RJoyX = convertAnalog(hid.get("RJoyX" + playerNumber));
var RJoyY = convertAnalog(hid.get("RJoyY" + playerNumber));
var heldKeys = hid.get("HeldKeys" + playerNumber);
var inputStates = heldKeysBitmask(heldKeys);
var gyro = { x: hid.get("gyroX"), y: hid.get("gyroY"), z: hid.get("gyroZ") }
smoothGyroMouse(gyro);
var mouse = robot.getMousePos();
var ngx = gyro.x * -1;
var ngz = gyro.z * -1
mx = mouse.x + (ngz * ((screenWidth) / 3));
my = mouse.y + (ngx * ((screenHeight) / 2));
if (mx && my) {
robot.moveMouse(mx, my);
}
if (RJoyX || RJoyY) {
robot.scrollMouse(RJoyX, RJoyY);
}
if (inputStates.ZR) {
if (!leftClicking) {
robot.mouseToggle("down");
leftClicking = true;
}
} else {
if (leftClicking) {
robot.mouseToggle("up");
leftClicking = false;
}
}
if (inputStates.R) {
if (!rightClicking) {
robot.mouseToggle("down", "right");
rightClicking = true;
}
} else {
if (rightClicking) {
robot.mouseToggle("up", "right");
rightClicking = false;
}
}
}
function handleTouchInput(hid) {
var touchX1 = hid.get("touchX1");
var touchY1 = hid.get("touchY1");
if (touchX1 && touchY1) {
touchX1 -= 15;
touchY1 -= 15;
touchX1 = Math.floor(screenWidth * (touchX1 / 1280))
touchY1 = Math.floor(screenHeight * (touchY1 / 720))
if (!touchX1old) touchX1old = touchX1;
if (!touchY1old) touchY1old = touchY1;
var touchX2 = hid.get("touchX2");
var touchY2 = hid.get("touchY2");
if (touchX2 && touchY2) {
rightTouchTime++;
if (rightTouchTime > 5) { //Handle scrolling
var xDiff = touchX1old - touchX1;
var yDiff = touchY1old - touchY1;
robot.scrollMouse(xDiff, yDiff);
scrolling = true;
touchRightClicking = false;
} else { //Handle left click
touchRightClicking = true;
}
} else {
if (touchRightClicking) {
robot.mouseClick("right");
touchRightClicking = false
}
scrolling = false;
rightTouchTime = 0;
}
if (!scrolling) {
leftTouchTime++;
if (Math.abs(touchX1 - touchX1old) > 5 || Math.abs(touchY1 - touchY1old) > 5) {
robot.moveMouse(touchX1 / screenScale, touchY1 / screenScale);
}
if (!touchLeftClicking) {
robot.mouseToggle("down");
touchLeftClicking = true;
}
} else {
robot.mouseToggle("up");
touchLeftClicking = false;
}
touchX1old = touchX1;
touchY1old = touchY1;
} else {
if (touchLeftClicking) { //release left click
robot.mouseToggle("up");
touchLeftClicking = false;
}
leftTouchTime = 0;
rightTouchTime = 0;
}
}
function handleGyroAndAccel(hid) {
var gyro = { x: hid.get("gyroX"), y: hid.get("gyroY"), z: hid.get("gyroZ") }
var accel = { x: hid.get("accelX"), y: hid.get("accelY"), z: hid.get("accelZ") }
for (axis in gyro) {
gyro[axis] *= 250;
}
gyro.y *= -1;
GyroServ.sendMotionData(gyro, accel);
}
var fpsPrintTimer = 0;
var hidDataBuffer = "";
hidStreamClient.on('data', function (chunk) {
hidDataBuffer += chunk.toString("hex");
var completeData = "";
if (hidDataBuffer.includes("ffffffffffffffff") && hidDataBuffer.includes("ffffffffffffff7")) {
completeData = hidDataBuffer.split("ffffffffffffffff")[1].split("ffffffffffffff7")[0];
hidDataBuffer = "";
if (completeData.length != 416) {
console.log("Incorrect data length: " + completeData.length + " - " + completeData);
return
}
} else {
return;
}
var data = Buffer.from(completeData, 'hex');
var hid = parseInputStruct(data);
var controllerCount = hid.get("controllerCount");
if (controllerCount > controllerIds.length) {
plugControllerIn();
}
fpsPrintTimer++;
if (fpsPrintTimer == 10) {
console.log("switchFps=" + hid.get("frameRate"))
fpsPrintTimer = 0;
}
var playerNumber;
for (i in controllerIds) {
playerNumber = parseInt(i) + 1;
handleControllerInput(hid, controllerIds[i], playerNumber);
}
handleMouseInputToggling(hid, 1);
if (mouseControl == "ANALOG" && mouseInput) {
handleAnalogMouse(hid, 1);
} else if (mouseControl == "GYRO" && mouseInput) {
handleGyroMouse(hid, 1);
}
handleTouchInput(hid);
handleGyroAndAccel(hid);
});
hidStreamClient.on('end', function () {
console.log('hidStreamClient Disconnected.');
try {
for (i in controllerIds) {
vgen.unplug(controllerIds[i]);
}
controllerIds = [];
} catch (error) {
}
if (usingVideo) {
ffmpegProcess.kill();
}
if (usingAudio) {
ffmpegAudioProcess.kill();
}
setTimeout(connect, 1000);
});
var args = process.argv.slice(" ");
if (args.length > 1) {
if (args.includes("/ip") && args[args.indexOf("/ip") + 1]) {
ip = args[args.indexOf("/ip") + 1];
console.log('Waiting for connection...');
if (args.includes("/q") && args[args.indexOf("/q") + 1]) {
quality = args[args.indexOf("/q") + 1];
} else {
quality = 5;
}
if (args.includes("/w") && args[args.indexOf("/w") + 1]) {
screenWidth = args[args.indexOf("/w") + 1];
} else {
screenWidth = 1280;
}
if (args.includes("/h") && args[args.indexOf("/h") + 1]) {
screenHeight = args[args.indexOf("/h") + 1];
} else {
screenHeight = 720;
}
if (args.includes("/s") && args[args.indexOf("/s") + 1]) {
screenScale = args[args.indexOf("/s") + 1];
} else {
screenScale = 1;
}
if (args.includes("/m") && args[args.indexOf("/m") + 1]) {
mouseControl = args[args.indexOf("/m") + 1];
} else {
mouseControl = "ANALOG";
}
if (args.includes("/noVideo")) {
usingVideo = false;
} else {
usingVideo = true;
}
if (args.includes("/noAudio")) {
usingAudio = false;
} else {
usingAudio = true;
}
if (args.includes("/abxySwap")) {
abxySwap = true;
} else {
abxySwap = false;
}
if (args.includes("/abxySwap")) {
abxySwap = true;
} else {
abxySwap = false;
}
if (args.includes("/limitFPS")) {
limitFPS = true;
} else {
limitFPS = false;
}
if (args.includes("/e") && args[args.indexOf("/e") + 1]) {
encoding = args[args.indexOf("/e") + 1];
} else {
encoding = "CPU";
}
connect();
} else {
console.log('Error: Usage NXStreamer.exe ip 0.0.0.0 q 10 /noVideo /noAudio /abxySwap /e NVCENC');
}
} else {
console.log('Error: Usage NXStreamer.exe ip 0.0.0.0 q 10 /noVideo /noAudio /abxySwap /e NVCENC');
}

View file

@ -1,635 +0,0 @@
{
"name": "Base-Electron-App",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"aproba": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
},
"are-we-there-yet": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
}
},
"assert": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
"integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==",
"requires": {
"object-assign": "^4.1.1",
"util": "0.10.3"
}
},
"base64-js": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bl": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
"requires": {
"buffer": "^5.5.0",
"inherits": "^2.0.4",
"readable-stream": "^3.4.0"
},
"dependencies": {
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
}
}
},
"buffer": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"chownr": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
},
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
},
"console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"crc": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz",
"integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==",
"requires": {
"buffer": "^5.1.0"
}
},
"decompress-response": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",
"integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
"requires": {
"mimic-response": "^2.0.0"
}
},
"deep-extend": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
},
"delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
},
"detect-libc": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
},
"dgram": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dgram/-/dgram-1.0.1.tgz",
"integrity": "sha1-N/OyAPgDOl/3WTAwicgc42G2UcM="
},
"end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"requires": {
"once": "^1.4.0"
}
},
"expand-template": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="
},
"ffi": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/ffi/-/ffi-2.3.0.tgz",
"integrity": "sha512-vkPA9Hf9CVuQ5HeMZykYvrZF2QNJ/iKGLkyDkisBnoOOFeFXZQhUPxBARPBIZMJVulvBI2R+jgofW03gyPpJcQ==",
"requires": {
"bindings": "~1.2.0",
"debug": "2",
"nan": "2",
"ref": "1",
"ref-struct": "1"
},
"dependencies": {
"bindings": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz",
"integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
},
"formidable": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz",
"integrity": "sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q=="
},
"fs-constants": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
},
"gauge": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"requires": {
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
"has-unicode": "^2.0.0",
"object-assign": "^4.1.0",
"signal-exit": "^3.0.0",
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1",
"wide-align": "^1.1.0"
}
},
"github-from-package": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
"integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4="
},
"has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk="
},
"ieee754": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ini": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"requires": {
"number-is-nan": "^1.0.0"
}
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"long": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
},
"mimic-response": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz",
"integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA=="
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"mkdirp-classic": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"napi-build-utils": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
},
"node-abi": {
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.16.0.tgz",
"integrity": "sha512-+sa0XNlWDA6T+bDLmkCUYn6W5k5W6BPRL6mqzSCs6H/xUgtl4D5x2fORKDzopKiU6wsyn/+wXlRXwXeSp+mtoA==",
"requires": {
"semver": "^5.4.1"
}
},
"noop-logger": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz",
"integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI="
},
"npmlog": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
"requires": {
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
"gauge": "~2.7.3",
"set-blocking": "~2.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1"
}
},
"picomatch": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg=="
},
"prebuild-install": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.3.tgz",
"integrity": "sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g==",
"requires": {
"detect-libc": "^1.0.3",
"expand-template": "^2.0.3",
"github-from-package": "0.0.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"napi-build-utils": "^1.0.1",
"node-abi": "^2.7.0",
"noop-logger": "^0.1.1",
"npmlog": "^4.0.1",
"pump": "^3.0.0",
"rc": "^1.2.7",
"simple-get": "^3.0.3",
"tar-fs": "^2.0.0",
"tunnel-agent": "^0.6.0",
"which-pm-runs": "^1.0.0"
}
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"pump": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"rc": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
"requires": {
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
}
},
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"readdirp": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz",
"integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==",
"requires": {
"picomatch": "^2.2.1"
}
},
"ref": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ref/-/ref-1.3.5.tgz",
"integrity": "sha512-2cBCniTtxcGUjDpvFfVpw323a83/0RLSGJJY5l5lcomZWhYpU2cuLdsvYqMixvsdLJ9+sTdzEkju8J8ZHDM2nA==",
"requires": {
"bindings": "1",
"debug": "2",
"nan": "2"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"ref-struct": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/ref-struct/-/ref-struct-1.1.0.tgz",
"integrity": "sha1-XV7mWtQc78Olxf60BYcmHkee3BM=",
"requires": {
"debug": "2",
"ref": "1"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"robotjs": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/robotjs/-/robotjs-0.6.0.tgz",
"integrity": "sha512-6pRWI3d+CBZqCXT/rsJfabbZoELua+jTeXilG27F8Jvix/J2BYZ0O7Tly2WCmXyqw5xYdCvOwvCeLRHEtXkt4w==",
"requires": {
"nan": "^2.14.0",
"node-abi": "^2.13.0",
"prebuild-install": "^5.3.3"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
},
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"signal-exit": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
},
"simple-concat": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz",
"integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY="
},
"simple-get": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz",
"integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==",
"requires": {
"decompress-response": "^4.2.0",
"once": "^1.3.1",
"simple-concat": "^1.0.0"
}
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "^2.0.0"
}
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
},
"struct": {
"version": "0.0.12",
"resolved": "https://registry.npmjs.org/struct/-/struct-0.0.12.tgz",
"integrity": "sha1-gzCvhyZk6aW9Z4ZkUkhXxQkIA4o="
},
"tar-fs": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz",
"integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==",
"requires": {
"chownr": "^1.1.1",
"mkdirp-classic": "^0.5.2",
"pump": "^3.0.0",
"tar-stream": "^2.0.0"
}
},
"tar-stream": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz",
"integrity": "sha512-UaF6FoJ32WqALZGOIAApXx+OdxhekNMChu6axLJR85zMMjXKWFGjbIRe+J6P4UnRGg9rAwWvbTT0oI7hD/Un7Q==",
"requires": {
"bl": "^4.0.1",
"end-of-stream": "^1.4.1",
"fs-constants": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^3.1.1"
},
"dependencies": {
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
}
}
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"requires": {
"safe-buffer": "^5.0.1"
}
},
"util": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"requires": {
"inherits": "2.0.1"
},
"dependencies": {
"inherits": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE="
}
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"vgen-xbox": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/vgen-xbox/-/vgen-xbox-1.0.1.tgz",
"integrity": "sha1-SJo9R92BujIBUxKyg0FaoS3rGk4=",
"requires": {
"assert": "^1.4.1",
"ffi": "^2.2.0",
"ref": "^1.3.4",
"windows-elevate": "^1.0.1"
}
},
"which-pm-runs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz",
"integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs="
},
"wide-align": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
"requires": {
"string-width": "^1.0.2 || 2"
}
},
"windows-elevate": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/windows-elevate/-/windows-elevate-1.0.1.tgz",
"integrity": "sha1-kBEtr4cwoQ9lGKPH5Z91YcZyXWQ="
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"ws": {
"version": "7.4.6",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A=="
}
}
}

View file

@ -1,23 +0,0 @@
{
"name": "Base-Electron-App",
"version": "1.0.0",
"description": "The bestest Electron window.",
"repository": "https://github.com/delv0rd/modular-web-server",
"keywords": [],
"author": "Dustin Harris",
"license": "",
"dependencies": {
"crc": "^3.8.0",
"dgram": "^1.0.1",
"formidable": "latest",
"long": "^4.0.0",
"readdirp": "latest",
"robotjs": "latest",
"struct": "latest",
"vgen-xbox": "^1.0.1",
"ws": "latest"
},
"scripts": {
"start": "node main.js"
}
}

View file

@ -1,4 +0,0 @@
@echo off
cd lib
ffmpeg.exe -y -f dshow -i audio=virtual-audio-capturer -af equalizer=f=100:t=h:width=200:g=-64 -f s16le -ar 16000 -ac 2 -c:a pcm_s16le udp://172.16.0.12:2224?pkt_size=640
pause

View file

@ -19,7 +19,7 @@
<button id="rld-btn" class="title-bar-tools" style="display: none;"><i class="fas fa-sync-alt"></i></button> <button id="rld-btn" class="title-bar-tools" style="display: none;"><i class="fas fa-sync-alt"></i></button>
<button id="dev-btn" class="title-bar-tools" style="display: none;"><i class="fab fa-dev"></i></button> <button id="dev-btn" class="title-bar-tools" style="display: none;"><i class="fab fa-dev"></i></button>
<button id="min-btn" class="title-bar-btns"><i class="fas fa-window-minimize"></i></button> <button id="min-btn" class="title-bar-btns"><i class="fas fa-window-minimize"></i></button>
<button id="max-btn" class="title-bar-btns"><i class="fas fa-window-maximize"></i></button> <!-- <button id="max-btn" class="title-bar-btns"><i class="fas fa-window-maximize"></i></button> -->
<button id="close-btn" class="title-bar-btns"><i class="fas fa-window-close"></i></button> <button id="close-btn" class="title-bar-btns"><i class="fas fa-window-close"></i></button>
</div> </div>
</nav> </nav>
@ -245,18 +245,23 @@
</div> </div>
</div> </div>
</div> </div>
<script src="js/fontawesome-all.min.js"></script> <script src="./js/jquery.min.js"></script>
<script src="js/Chart.min.js"></script> <script src="./js/jquery.min.js"></script>
<script src="./js/popper.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/fontawesome-all.min.js"></script>
<script src="./js/Chart.min.js"></script>
<script> <script>
let $ = require('jquery'); const { remote, ipcRenderer } = require("electron");
require('popper.js'); const fs = require('fs');
require('bootstrap'); var DB = require('./Devlord_modules/DB.js');
// require('popper.js');
$(function () { $(function () {
$('[data-toggle="tooltip"]').tooltip({ boundary: 'window' }) $('[data-toggle="tooltip"]').tooltip({ boundary: 'window' })
}) })
</script> </script>
<script src="./js/animations.js"></script>
<script src="./js/window.js"></script> <script src="./js/window.js"></script>
<script src="./js/animations.js"></script>
<script src="./js/settings.js"></script> <script src="./js/settings.js"></script>
<script src="./js/main.js"></script> <script src="./js/main.js"></script>
<script src="./js/stats.js"></script> <script src="./js/stats.js"></script>

File diff suppressed because one or more lines are too long

2
SkyNX-Streamer/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -126,7 +126,7 @@ function applyClientSettings() {
if (!clientSettings.firstInstall) { if (!clientSettings.firstInstall) {
ipcRenderer.send('installScpVBus'); ipcRenderer.send('installScpVBus');
ipcRenderer.send('installAudioDriver'); ipcRenderer.send('installAudioDriver');
$('#restartModal').modal('show'); // $('#restartModal').modal('show');
clientSettings.firstInstall = true; clientSettings.firstInstall = true;
saveClientSettings(); saveClientSettings();
} }

View file

@ -1,39 +1,22 @@
//Authour: Dustin Harris //Authour: Dustin Harris
//GitHub: https://github.com/DevL0rd //GitHub: https://github.com/DevL0rd
const remote = require('electron').remote;
const ipcRenderer = require('electron').ipcRenderer;
const dialog = remote.dialog;
const fs = require('fs')
var DB = require('./Devlord_modules/DB.js');
document.getElementById("min-btn").addEventListener("click", function (e) { document.getElementById("min-btn").addEventListener("click", function (e) {
var window = remote.getCurrentWindow(); ipcRenderer.send('min');
window.minimize();
});
var isMaximized = false;
document.getElementById("max-btn").addEventListener("click", function (e) {
var window = remote.getCurrentWindow();
// !window.isMaximized()
if (!isMaximized) {
isMaximized = true;
window.maximize();
} else {
isMaximized = false;
window.unmaximize();
}
}); });
// document.getElementById("max-btn").addEventListener("click", function (e) {
// ipcRenderer.send('max');
// });
document.getElementById("close-btn").addEventListener("click", function (e) { document.getElementById("close-btn").addEventListener("click", function (e) {
var window = remote.getCurrentWindow(); ipcRenderer.send('close');
window.close();
}); });
document.getElementById("dev-btn").addEventListener("click", function (e) { document.getElementById("dev-btn").addEventListener("click", function (e) {
openDevTools(); openDevTools();
}); });
function openDevTools() { function openDevTools() {
var window = remote.getCurrentWindow(); ipcRenderer.send('devTools');
window.webContents.openDevTools();
} }
document.getElementById("rld-btn").addEventListener("click", function (e) { document.getElementById("rld-btn").addEventListener("click", function (e) {
location.reload(); location.reload();

View file

@ -1,4 +1,4 @@
const { app, BrowserWindow, ipcMain, screen } = require('electron')
const { spawn } = require("child_process"); const { spawn } = require("child_process");
const { exec } = require('child_process'); const { exec } = require('child_process');
const elevate = require("windows-elevate"); const elevate = require("windows-elevate");
@ -6,17 +6,42 @@ const windowStateKeeper = require('electron-window-state');
const fs = require('fs'); const fs = require('fs');
const DB = require('./Devlord_modules/DB.js'); const DB = require('./Devlord_modules/DB.js');
const isDev = require('electron-is-dev'); const isDev = require('electron-is-dev');
const Struct = require('struct');
const net = require('net');
// const robot = require("robotjs");
const VGen = require("vgen-xbox")
const vgen = new VGen();
const GyroServ = require("./Devlord_modules/GyroServ.js");
var AutoLaunch = require('auto-launch'); var AutoLaunch = require('auto-launch');
var AU = require('ansi_up'); var AU = require('ansi_up');
var ansi_up = new AU.default; var ansi_up = new AU.default;
const { app, BrowserWindow, ipcMain, Menu, Tray, screen } = require('electron')
let mainWindow let mainWindow
var usingUI = true;
var minimizeToTray = false; var minimizeToTray = false;
var autoChangeResolution = false; var autoChangeResolution = false;
var ip = "0.0.0.0"
var quality = 5;
var hidStreamClient = new net.Socket();
var usingVideo = true;
var usingAudio = true;
var abxySwap = false;
var limitFPS = false;
var encoding = "CPU";
var screenWidth = 1280;
var screenHeight = 720;
var screenScale = 1;
var mouseControl = "ANALOG";
var ffmpegProcess;
var ffmpegAudioProcess;
var clientSender;
var restartingStream = false;
var autoLauncher = new AutoLaunch({
name: 'SkyNX',
path: __dirname.replace("resources\\app\\", "") + '\\SkyNXStreamer.exe',
});
app.commandLine.appendSwitch('high-dpi-support', 'true'); app.commandLine.appendSwitch('high-dpi-support', 'true');
//var sr = require('screenres');
// sr.set(800, 600);
function createWindow() { function createWindow() {
let mainWindowState = windowStateKeeper({ let mainWindowState = windowStateKeeper({
defaultWidth: 500, defaultWidth: 500,
@ -24,20 +49,23 @@ function createWindow() {
}); });
// Create the browser window. // Create the browser window.
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
x: mainWindowState.x, title: "SkyNX",
y: mainWindowState.y, x: mainWindowState.x,
// width: mainWindowState.width, y: mainWindowState.y,
// height: mainWindowState.height, // width: mainWindowState.width,
// height: mainWindowState.height,
show: true,
width: 500, width: 500,
height: 320, height: 320,
// minWidth: 350, frame: false,
// minHeight: 300, transparent: true, // needed for windows rounded edges
webPreferences: { resizable: false,
nodeIntegration: true webPreferences: {
}, nodeIntegration: true,
transparent: true, enableRemoteModule: true,
resizable: false, contextIsolation: false,
frame: false devTools: true
}
}) })
mainWindowState.manage(mainWindow); mainWindowState.manage(mainWindow);
mainWindow.setMenu(null); mainWindow.setMenu(null);
@ -45,50 +73,15 @@ function createWindow() {
mainWindow.loadFile('index.html'); mainWindow.loadFile('index.html');
//fix transparency bug in windows 10 //fix transparency bug in windows 10
mainWindow.reload(); mainWindow.reload();
mainWindow.webContents.openDevTools();
// Emitted when the window is closed.
mainWindow.on('closed', function () {
mainWindow = null
try {
streamerProcess.kill();
} catch (error) {
}
});
// mainWindow.on('minimize', function (event) {
// if (minimizeToTray) {
// event.preventDefault();
// mainWindow.hide();
// }
// })
// var iconPath = "icon.ico";
// if (isDev) {
// iconPath = __dirname + "/resources/app/icon.ico"
// }
// var appIcon = new Tray(iconPath)
// var contextMenu = Menu.buildFromTemplate([
// {
// label: 'Show App', click: function () {
// mainWindow.show();
// }
// },
// {
// label: 'Quit', click: function () {
// application.isQuiting = true;
// application.quit();
// }
// }
// ]);
// appIcon.setContextMenu(contextMenu);
mainWindow.on('show', function () {
appIcon.setHighlightMode('always');
});
} }
var mainScreen; var mainScreen;
var originalW; var originalW;
var originalH; var originalH;
app.on('ready', function () { app.on('ready', function () {
if (usingUI) setTimeout(createWindow, 300); setTimeout(createWindow, 300);
mainScreen = screen.getPrimaryDisplay(); mainScreen = screen.getPrimaryDisplay();
originalW = mainScreen.bounds.width * screen.getPrimaryDisplay().scaleFactor; originalW = mainScreen.bounds.width * screen.getPrimaryDisplay().scaleFactor;
originalH = mainScreen.bounds.height * screen.getPrimaryDisplay().scaleFactor; originalH = mainScreen.bounds.height * screen.getPrimaryDisplay().scaleFactor;
@ -96,11 +89,16 @@ app.on('ready', function () {
// Quit when all windows are closed. // Quit when all windows are closed.
app.on('window-all-closed', function () { app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit() if (ffmpegAudioProcess) {
streamerProcess.kill(); ffmpegAudioProcess.kill();
}
if (ffmpegProcess) {
ffmpegProcess.kill();
}
if (autoChangeResolution) { if (autoChangeResolution) {
changeScreenRes(originalW, originalH); changeScreenRes(originalW, originalH);
} }
if (process.platform !== 'darwin') app.quit()
}) })
app.on('activate', function () { app.on('activate', function () {
@ -112,154 +110,13 @@ app.on('activate', function () {
app.on('browser-window-created', function (e, window) { app.on('browser-window-created', function (e, window) {
window.setMenu(null); window.setMenu(null);
}); });
var streamerProcess;
var clientSender;
var streamerProcessIsRunning = false;
function startStreamer(arg) {
var captureW = mainScreen.bounds.width * screen.getPrimaryDisplay().scaleFactor;
var captureH = mainScreen.bounds.height * screen.getPrimaryDisplay().scaleFactor;
if (autoChangeResolution && !restartingStream) {
changeScreenRes("1280", "720");
captureW = "1280";
captureH = "720";
}
var cwd = './NxStreamingService/';
if (!isDev) {
cwd = "./resources/app/NxStreamingService"
}
var args = ["/ip", arg.ip, "/q", arg.q, "/w", captureW, "/h", captureH, "/s", screen.getPrimaryDisplay().scaleFactor];
if (arg.disableVideo) {
args.push("/noVideo");
}
if (arg.disableAudio) {
args.push("/noAudio");
}
if (arg.abxySwap) {
args.push("/abxySwap");
}
if (arg.encoding == "NVENC" || arg.encoding == "AMDVCE" || arg.encoding == "QSV") {
args.push("/e");
args.push(arg.encoding);
}
if (arg.limitFPS) {
args.push("/limitFPS");
}
args.push("/m");
if (arg.mouseControl == "ANALOG") {
args.push("ANALOG");
} else if (arg.mouseControl == "GYRO") {
args.push("GYRO");
} else {
args.push("ANALOG");
}
streamerProcess = spawn(
"./NxStreamingService.exe",
args,
{ cwd: cwd, stdio: "pipe" }
);
streamerProcess.stdout.on("data", data => {
log(`${data}`);
if (!streamerProcessIsRunning) {
streamerProcessIsRunning = true;
restartingStream = false;
clientSender.send("started");
}
});
streamerProcess.stderr.on('data', (data) => {
log(`${data}`);
if (!streamerProcessIsRunning) {
streamerProcessIsRunning = true;
restartingStream = false;
clientSender.send("started");
}
});
streamerProcess.on('close', (code) => {
clientSender.send("close");
log(`streamerProcess process exited with code ${code}`);
streamerProcessIsRunning = false;
if (autoChangeResolution && !restartingStream) {
changeScreenRes(originalW, originalH);
}
});
}
ipcMain.on('connect', (event, arg) => {
clientSender = event.sender;
startStreamer(arg);
})
var restartingStream = false;
ipcMain.on('restart', (event, arg) => {
streamerProcess.kill();
restartingStream = true;
startStreamer(arg);
});
ipcMain.on('kill', (event, arg) => {
streamerProcess.kill();
});
ipcMain.on('installScpVBus', (event, arg) => {
log("Installing ScpVBus driver..")
var df = __dirname + "\\NxStreamingService\\lib\\"
elevate.exec(df + "devcon.exe", ["install", df + "ScpVBus.inf", "Root\\ScpVBus"],
function (error, stdout, stderr) {
log(`${stdout}`);
log(`${stderr}`);
if (error) {
log("driver install error: " + error);
} else {
log("Driver installed!");
}
});
});
ipcMain.on('unInstallScpVBus', (event, arg) => {
log("Un-Installing ScpVBus driver..")
var df = __dirname + "\\NxStreamingService\\lib\\"
elevate.exec(df + "devcon.exe", ["remove", "Root\\ScpVBus"],
function (error, stdout, stderr) {
if (error !== null) {
log('driver uninstall error: ' + error);
} else {
log("Driver un-installed!");
}
});
});
ipcMain.on('installAudioDriver', (event, arg) => {
log("Installing audio driver..")
var df = __dirname + "\\NxStreamingService\\lib\\"
elevate.exec("regsvr32", [df + "audio_sniffer.dll"],
function (error, stdout, stderr) {
if (error !== null) {
log('driver install error: ' + error);
} else {
log("Driver installed!");
}
});
});
ipcMain.on('unInstallAudioDriver', (event, arg) => {
log("Un-Installing audio driver..")
var df = __dirname + "\\NxStreamingService\\lib\\"
elevate.exec("regsvr32", ["/u", df + "audio_sniffer.dll"],
function (error, stdout, stderr) {
if (error !== null) {
log('driver uninstall error: ' + error);
} else {
log("Driver un-installed!");
}
});
});
var htmlLoggingSender var htmlLoggingSender
ipcMain.on('registerForHTMLLogging', (event, arg) => { ipcMain.on('registerForHTMLLogging', (event, arg) => {
htmlLoggingSender = event.sender htmlLoggingSender = event.sender
}) })
ipcMain.on('consoleCommand', (event, fullMessage) => {
var args = fullMessage.split(" ");
var command = args.shift().toLowerCase();
//Will add later
})
function log(str) { function log(str) {
console.log(str); console.log(str);
if (htmlLoggingSender) { if (htmlLoggingSender) {
@ -267,15 +124,30 @@ function log(str) {
} }
} }
// Emitted when the window is closed.
ipcMain.on('close', function () {
mainWindow.destroy();
});
ipcMain.on('min', function () {
mainWindow.minimize();
});
ipcMain.on('max', function () {
mainWindow.maximize();
});
ipcMain.on('consoleCommand', (event, fullMessage) => {
var args = fullMessage.split(" ");
var command = args.shift().toLowerCase();
//Will add later
})
ipcMain.on('donate', (event, fullMessage) => { ipcMain.on('donate', (event, fullMessage) => {
var url = 'https://www.paypal.me/SkyNX'; var url = 'https://www.paypal.me/SkyNX';
var start = (process.platform == 'darwin' ? 'open' : process.platform == 'win32' ? 'start' : 'xdg-open'); var start = (process.platform == 'darwin' ? 'open' : process.platform == 'win32' ? 'start' : 'xdg-open');
exec(start + ' ' + url); exec(start + ' ' + url);
}) })
var autoLauncher = new AutoLaunch({
name: 'SkyNX',
path: __dirname.replace("resources\\app\\", "") + '\\SkyNXStreamer.exe',
});
ipcMain.on('autoStartupOn', (event, fullMessage) => { ipcMain.on('autoStartupOn', (event, fullMessage) => {
if (!autoLauncher.isEnabled) { if (!autoLauncher.isEnabled) {
autoLauncher.enable(); autoLauncher.enable();
@ -289,6 +161,12 @@ ipcMain.on('autoStartupOff', (event, fullMessage) => {
ipcMain.on('autoChangeResolutionOn', (event, fullMessage) => { ipcMain.on('autoChangeResolutionOn', (event, fullMessage) => {
autoChangeResolution = true; autoChangeResolution = true;
}); });
function changeScreenRes(width, height) {
var df = __dirname + "\\lib\\ChangeScreenResolution.exe"
exec(df + " /w=" + width + " /h=" + height + " /d=0");
}
ipcMain.on('autoChangeResolutionOff', (event, fullMessage) => { ipcMain.on('autoChangeResolutionOff', (event, fullMessage) => {
if (autoChangeResolution) { if (autoChangeResolution) {
changeScreenRes(originalW, originalH); changeScreenRes(originalW, originalH);
@ -299,7 +177,634 @@ ipcMain.on('autoChangeResolutionOff', (event, fullMessage) => {
ipcMain.on("restartComputer", (event, fullMessage) => { ipcMain.on("restartComputer", (event, fullMessage) => {
exec("shutdown -r -t 0"); exec("shutdown -r -t 0");
}); });
function changeScreenRes(width, height) {
var df = __dirname + "\\NxStreamingService\\lib\\ChangeScreenResolution.exe"
exec(df + " /w=" + width + " /h=" + height + " /d=0");
}
//***************************************************************/
//Streaming
//***************************************************************/
function startStreamer(arg) {
screenWidth = mainScreen.bounds.width * screen.getPrimaryDisplay().scaleFactor;
screenHeight = mainScreen.bounds.height * screen.getPrimaryDisplay().scaleFactor;
ip = arg.ip
quality = arg.q;
hidStreamClient = new net.Socket();
usingVideo = !arg.disableVideo;
usingAudio = !arg.disableAudio;
abxySwap = arg.abxySwap;
limitFPS = arg.limitFPS;
screenScale = screen.getPrimaryDisplay().scaleFactor;
mouseControl = arg.mouseControl;
encoding = arg.encoding
connectHID()
if (usingVideo) {
if (autoChangeResolution && !restartingStream) {
changeScreenRes("1280", "720");
screenWidth = "1280";
screenHeight = "720";
}
var fps = 60;
if (limitFPS) {
fps = 30;
}
var ffmpegVideoArgs = [];
if (encoding == "NVENC") { //Nvidia Encoding
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-c:v", "h264_nvenc", "-gpu", "0", "-rc", "cbr_ld_hq", "-zerolatency", "1", "-f", "h264", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-cq:v", "19", "-g", "999999", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
log("Using Nvidia Encoding");
} else if (encoding == "AMDVCE") { //AMD Video Coding Engine
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-c:v", "h264_amf", "-usage", "1", "-rc", "cbr", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
log("Using AMD Video Coding Engine");
} else if (encoding == "QSV") {
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-c:v", "h264_qsv", "-preset", "faster", "-profile", "baseline", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
log("Using Intel QSV Encoding");
} else { //CPU Software Encoding
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-vf", "scale=1280x720", "-preset", "ultrafast", "-tune", "zerolatency", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-x264-params", "nal-hrd=cbr", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / 2) + "M", "tcp://" + ip + ":2222"];
log("Using CPU Encoding");
}
ffmpegProcess = spawn(
"./lib/ffmpeg.exe",
ffmpegVideoArgs,
{
detached: false
}
);
ffmpegProcess.stdout.on("data", data => {
log(`${data}`);
clientSender.send("started");
restartingStream = false;
});
ffmpegProcess.stderr.on('data', (data) => {
log(`${data}`);
});
ffmpegProcess.on('close', (code) => {
log(`VideoProcess process exited with code ${code}`);
if (autoChangeResolution && !restartingStream) {
changeScreenRes(originalW, originalH);
}
if (restartingStream) {
startStreamer(arg);
}
clientSender.send("close");
});
}
if (usingAudio) {
ffmpegAudioProcess = spawn(
"./lib/ffmpeg.exe",
["-y", "-f", "dshow", "-i", 'audio=virtual-audio-capturer', "-f", "s16le", "-ar", "16000", "-ac", "2", "-c:a", "pcm_s16le", "udp://" + ip + ":2224?pkt_size=640"],
{ detached: false }
);
ffmpegAudioProcess.stdout.on("data", data => {
log(`${data}`);
});
ffmpegAudioProcess.stderr.on('data', (data) => {
log(`${data}`);
});
ffmpegAudioProcess.on('close', (code) => {
log(`AudioProcess process exited with code ${code}`);
});
}
}
ipcMain.on('connect', (event, arg) => {
clientSender = event.sender;
startStreamer(arg);
})
ipcMain.on('restart', (event, arg) => {
restartingStream = true;
if (ffmpegAudioProcess) {
ffmpegAudioProcess.kill();
}
if (ffmpegProcess) {
ffmpegProcess.kill();
}
});
ipcMain.on('kill', (event, arg) => {
if (ffmpegAudioProcess) {
ffmpegAudioProcess.kill();
}
if (ffmpegProcess) {
ffmpegProcess.kill();
}
});
//***************************************************************/
//INPUT
//***************************************************************/
var controllerIds = [];
function plugControllerIn() {
try {
var nCid = vgen.pluginNext();
controllerIds.push(nCid);
log("Plugged in controller " + nCid + ".");
}
catch (e) {
log("Could not plug in virtual controller. Make sure the driver is installed.");
setTimeout(plugControllerIn, 3000);
}
}
function parseInputStruct(buff) {
var input = Struct()
.word32Ule('HeldKeys1')
.word32Sle('LJoyX1')
.word32Sle('LJoyY1')
.word32Sle('RJoyX1')
.word32Sle('RJoyY1')
.word32Ule('HeldKeys2')
.word32Sle('LJoyX2')
.word32Sle('LJoyY2')
.word32Sle('RJoyX2')
.word32Sle('RJoyY2')
.word32Ule('HeldKeys3')
.word32Sle('LJoyX3')
.word32Sle('LJoyY3')
.word32Sle('RJoyX3')
.word32Sle('RJoyY3')
.word32Ule('HeldKeys4')
.word32Sle('LJoyX4')
.word32Sle('LJoyY4')
.word32Sle('RJoyX4')
.word32Sle('RJoyY4')
.word32Ule('touchX1')
.word32Ule('touchY1')
.word32Ule('touchX2')
.word32Ule('touchY2')
.floatle('accelX')
.floatle('accelY')
.floatle('accelZ')
.floatle('gyroX')
.floatle('gyroY')
.floatle('gyroZ')
.word32Ule('controllerCount')
input._setBuff(buff);
return input;
};
function isOdd(int) {
return (int & 1) === 1;
}
function heldKeysBitmask(HeldKeys) {
return {
A: isOdd(HeldKeys >> 0),
B: isOdd(HeldKeys >> 1),
X: isOdd(HeldKeys >> 2),
Y: isOdd(HeldKeys >> 3),
LS: isOdd(HeldKeys >> 4),
RS: isOdd(HeldKeys >> 5),
L: isOdd(HeldKeys >> 6),
R: isOdd(HeldKeys >> 7),
ZL: isOdd(HeldKeys >> 8),
ZR: isOdd(HeldKeys >> 9),
Plus: isOdd(HeldKeys >> 10),
Minus: isOdd(HeldKeys >> 11),
Left: isOdd(HeldKeys >> 12),
Up: isOdd(HeldKeys >> 13),
Right: isOdd(HeldKeys >> 14),
Down: isOdd(HeldKeys >> 15)
}
}
function convertAnalog(axis) {
var na;
if (axis) {
na = axis / 32767.5
}
if (na > 1) {
na = 2 - na
na = -na
}
return na;
}
function convertAnalogXY(x, y) {
return { x: convertAnalog(x), y: convertAnalog(y) };
}
function handleControllerInput(hid, controllerId, playerNumber) {
var heldKeys = hid.get("HeldKeys" + playerNumber);
var LJoyX = convertAnalog(hid.get("LJoyX" + playerNumber));
var LJoyY = convertAnalog(hid.get("LJoyY" + playerNumber));
var RJoyX = convertAnalog(hid.get("RJoyX" + playerNumber));
var RJoyY = convertAnalog(hid.get("RJoyY" + playerNumber));
vgen.setAxisL(controllerId, LJoyX, LJoyY);
vgen.setAxisR(controllerId, RJoyX, RJoyY);
var inputStates = heldKeysBitmask(heldKeys);
//Button mapping
if (!abxySwap) {
vgen.setButton(controllerId, vgen.Buttons.B, inputStates.A);
vgen.setButton(controllerId, vgen.Buttons.A, inputStates.B);
vgen.setButton(controllerId, vgen.Buttons.X, inputStates.Y);
vgen.setButton(controllerId, vgen.Buttons.Y, inputStates.X);
} else {
vgen.setButton(controllerId, vgen.Buttons.B, inputStates.B);
vgen.setButton(controllerId, vgen.Buttons.A, inputStates.A);
vgen.setButton(controllerId, vgen.Buttons.X, inputStates.X);
vgen.setButton(controllerId, vgen.Buttons.Y, inputStates.Y);
}
vgen.setButton(controllerId, vgen.Buttons.BACK, inputStates.Minus);
vgen.setButton(controllerId, vgen.Buttons.START, inputStates.Plus);
vgen.setButton(controllerId, vgen.Buttons.LEFT_SHOULDER, inputStates.L);
vgen.setButton(controllerId, vgen.Buttons.RIGHT_SHOULDER, inputStates.R);
vgen.setButton(controllerId, vgen.Buttons.LEFT_THUMB, inputStates.LS);
vgen.setButton(controllerId, vgen.Buttons.RIGHT_THUMB, inputStates.RS);
//Trigger Mapping
if (inputStates.ZL) {
vgen.setTriggerL(controllerId, 1);
} else {
vgen.setTriggerL(controllerId, 0);
}
if (inputStates.ZR) {
vgen.setTriggerR(controllerId, 1);
} else {
vgen.setTriggerR(controllerId, 0);
}
//Dpad mapping
if (inputStates.Up || inputStates.Down || inputStates.Left || inputStates.Right) {
if (inputStates.Up) {
if (inputStates.Left || inputStates.Right) {
if (inputStates.Left) {
vgen.setDpad(controllerId, vgen.Dpad.UP_LEFT);
} else {
vgen.setDpad(controllerId, vgen.Dpad.UP_RIGHT);
}
} else {
vgen.setDpad(controllerId, vgen.Dpad.UP);
}
} else if (inputStates.Down) {
if (inputStates.Left || inputStates.Right) {
if (inputStates.Left) {
vgen.setDpad(controllerId, vgen.Dpad.DOWN_LEFT);
} else {
vgen.setDpad(controllerId, vgen.Dpad.DOWN_RIGHT);
}
} else {
vgen.setDpad(controllerId, vgen.Dpad.DOWN);
}
} else if (inputStates.Left) {
vgen.setDpad(controllerId, vgen.Dpad.LEFT);
} else if (inputStates.Right) {
vgen.setDpad(controllerId, vgen.Dpad.RIGHT);
}
} else {
vgen.setDpad(controllerId, vgen.Dpad.NONE);
}
}
var touchX1old = 0;
var touchY1old = 0;
var leftClicking = false;
var rightTouchTime = 0;
var leftTouchTime = 0;
var rightClicking = false;
var scrolling = false;
var toggledMouseInput = false;
var mouseInput = false;
var touchLeftClicking = false;
var touchRightClicking = false;
function handleMouseInputToggling(hid, playerNumber) {
var heldKeys = hid.get("HeldKeys" + playerNumber);
var inputStates = heldKeysBitmask(heldKeys);
if (inputStates.LS && inputStates.RS) {
if (!toggledMouseInput) {
if (mouseInput) {
mouseInput = false;
} else {
mouseInput = true;
}
toggledMouseInput = true;
}
} else {
toggledMouseInput = false;
}
}
// function handleAnalogMouse(hid, playerNumber) {
// var RJoyX = convertAnalog(hid.get("RJoyX" + playerNumber));
// var RJoyY = convertAnalog(hid.get("RJoyY" + playerNumber));
// var LJoyX = convertAnalog(hid.get("LJoyX" + playerNumber));
// var LJoyY = convertAnalog(hid.get("LJoyY" + playerNumber));
// var heldKeys = hid.get("HeldKeys" + playerNumber);
// var inputStates = heldKeysBitmask(heldKeys);
// var mouse = robot.getMousePos();
// mx = mouse.x + (RJoyX * 25);
// my = mouse.y - (RJoyY * 25);
// if (mx && my) {
// robot.moveMouse(mx, my);
// }
// if (LJoyX || LJoyY) {
// robot.scrollMouse(LJoyX, LJoyY);
// }
// if (inputStates.ZR) {
// if (!leftClicking) {
// robot.mouseToggle("down");
// leftClicking = true;
// }
// } else {
// if (leftClicking) {
// robot.mouseToggle("up");
// leftClicking = false;
// }
// }
// if (inputStates.ZL) {
// if (!rightClicking) {
// robot.mouseToggle("down", "right");
// rightClicking = true;
// }
// } else {
// if (rightClicking) {
// robot.mouseToggle("up", "right");
// rightClicking = false;
// }
// }
// }
var gyroHistory = [];
function smoothGyroMouse(gyro) {
if (gyroHistory.length < 3) {
gyroHistory.push(gyro);
return gyro; //smoothing not ready
} else {
gyroHistory.shift();
gyroHistory.push(gyro);
gyro.x = ((gyroHistory[0].x * 1) + (gyroHistory[1].x * 3) + (gyroHistory[2].x * 5)) / 9;
gyro.y = ((gyroHistory[0].y * 1) + (gyroHistory[1].y * 3) + (gyroHistory[2].y * 5)) / 9;
gyro.z = ((gyroHistory[0].z * 1) + (gyroHistory[1].z * 3) + (gyroHistory[2].z * 5)) / 9;
if (gyro.x < 0.005 && gyro.x > 0) {
gyro.x = 0;
} else if (gyro.x > -0.005 && gyro.x < 0) {
gyro.x = 0;
}
if (gyro.y < 0.005 && gyro.y > 0) {
gyro.y = 0;
} else if (gyro.y > -0.005 && gyro.y < 0) {
gyro.y = 0;
}
if (gyro.z < 0.005 && gyro.z > 0) {
gyro.z = 0;
} else if (gyro.z > -0.005 && gyro.z < 0) {
gyro.z = 0;
}
return gyro;
}
}
var touchX1Old = 0;
var touchY1Old = 0;
// function handleGyroMouse(hid, playerNumber) {
// var RJoyX = convertAnalog(hid.get("RJoyX" + playerNumber));
// var RJoyY = convertAnalog(hid.get("RJoyY" + playerNumber));
// var heldKeys = hid.get("HeldKeys" + playerNumber);
// var inputStates = heldKeysBitmask(heldKeys);
// var gyro = { x: hid.get("gyroX"), y: hid.get("gyroY"), z: hid.get("gyroZ") }
// smoothGyroMouse(gyro);
// var mouse = robot.getMousePos();
// var ngx = gyro.x * -1;
// var ngz = gyro.z * -1
// mx = mouse.x + (ngz * ((screenWidth) / 3));
// my = mouse.y + (ngx * ((screenHeight) / 2));
// if (mx && my) {
// robot.moveMouse(mx, my);
// }
// if (RJoyX || RJoyY) {
// robot.scrollMouse(RJoyX, RJoyY);
// }
// if (inputStates.ZR) {
// if (!leftClicking) {
// robot.mouseToggle("down");
// leftClicking = true;
// }
// } else {
// if (leftClicking) {
// robot.mouseToggle("up");
// leftClicking = false;
// }
// }
// if (inputStates.R) {
// if (!rightClicking) {
// robot.mouseToggle("down", "right");
// rightClicking = true;
// }
// } else {
// if (rightClicking) {
// robot.mouseToggle("up", "right");
// rightClicking = false;
// }
// }
// }
// function handleTouchInput(hid) {
// var touchX1 = hid.get("touchX1");
// var touchY1 = hid.get("touchY1");
// if (touchX1 && touchY1) {
// touchX1 -= 15;
// touchY1 -= 15;
// touchX1 = Math.floor(screenWidth * (touchX1 / 1280))
// touchY1 = Math.floor(screenHeight * (touchY1 / 720))
// if (!touchX1old) touchX1old = touchX1;
// if (!touchY1old) touchY1old = touchY1;
// var touchX2 = hid.get("touchX2");
// var touchY2 = hid.get("touchY2");
// if (touchX2 && touchY2) {
// rightTouchTime++;
// if (rightTouchTime > 5) { //Handle scrolling
// var xDiff = touchX1old - touchX1;
// var yDiff = touchY1old - touchY1;
// robot.scrollMouse(xDiff, yDiff);
// scrolling = true;
// touchRightClicking = false;
// } else { //Handle left click
// touchRightClicking = true;
// }
// } else {
// if (touchRightClicking) {
// robot.mouseClick("right");
// touchRightClicking = false
// }
// scrolling = false;
// rightTouchTime = 0;
// }
// if (!scrolling) {
// leftTouchTime++;
// if (Math.abs(touchX1 - touchX1old) > 5 || Math.abs(touchY1 - touchY1old) > 5) {
// robot.moveMouse(touchX1 / screenScale, touchY1 / screenScale);
// }
// if (!touchLeftClicking) {
// robot.mouseToggle("down");
// touchLeftClicking = true;
// }
// } else {
// robot.mouseToggle("up");
// touchLeftClicking = false;
// }
// touchX1old = touchX1;
// touchY1old = touchY1;
// } else {
// if (touchLeftClicking) { //release left click
// robot.mouseToggle("up");
// touchLeftClicking = false;
// }
// leftTouchTime = 0;
// rightTouchTime = 0;
// }
// }
function handleGyroAndAccel(hid) {
var gyro = { x: hid.get("gyroX"), y: hid.get("gyroY"), z: hid.get("gyroZ") }
var accel = { x: hid.get("accelX"), y: hid.get("accelY"), z: hid.get("accelZ") }
for (axis in gyro) {
gyro[axis] *= 250;
}
gyro.y *= -1;
GyroServ.sendMotionData(gyro, accel);
}
var fpsPrintTimer = 0;
var hidDataBuffer = "";
function connectHID() {
hidStreamClient.connect({
host: ip,
port: 2223
});
}
hidStreamClient.on('error', function (ex) {
if (ex) {
log("Could not connect to Switch. Connection timed out...");
setTimeout(connectHID, 1000);
}
});
hidStreamClient.on('connect', function () {
hidStreamClient.setNoDelay(true);
log('Connected to Switch!');
});
hidStreamClient.on('data', function (chunk) {
hidDataBuffer += chunk.toString("hex");
var completeData = "";
if (hidDataBuffer.includes("ffffffffffffffff") && hidDataBuffer.includes("ffffffffffffff7")) {
completeData = hidDataBuffer.split("ffffffffffffffff")[1].split("ffffffffffffff7")[0];
hidDataBuffer = "";
if (completeData.length != 416) {
log("Incorrect data length: " + completeData.length + " - " + completeData);
return
}
} else {
return;
}
var data = Buffer.from(completeData, 'hex');
var hid = parseInputStruct(data);
var controllerCount = hid.get("controllerCount");
if (controllerCount > controllerIds.length) {
plugControllerIn();
}
fpsPrintTimer++;
if (fpsPrintTimer == 10) {
log("switchFps=" + hid.get("frameRate"))
fpsPrintTimer = 0;
}
var playerNumber;
for (i in controllerIds) {
playerNumber = parseInt(i) + 1;
handleControllerInput(hid, controllerIds[i], playerNumber);
}
handleMouseInputToggling(hid, 1);
if (mouseControl == "ANALOG" && mouseInput) {
// handleAnalogMouse(hid, 1);
} else if (mouseControl == "GYRO" && mouseInput) {
// handleGyroMouse(hid, 1);
}
// handleTouchInput(hid);
handleGyroAndAccel(hid);
});
hidStreamClient.on('end', function () {
log('hidStreamClient Disconnected.');
try {
for (i in controllerIds) {
vgen.unplug(controllerIds[i]);
}
controllerIds = [];
} catch (error) {
}
if (usingVideo) {
ffmpegProcess.kill();
}
if (usingAudio) {
ffmpegAudioProcess.kill();
}
setTimeout(connectHID, 1000);
});
//***************************************************************/
//DRIVERS
//***************************************************************/
ipcMain.on('installScpVBus', (event, arg) => {
log("Installing ScpVBus driver..")
var df = __dirname + "\\lib\\"
elevate.exec(df + "devcon.exe", ["install", df + "ScpVBus.inf", "Root\\ScpVBus"],
function (error, stdout, stderr) {
log(`${stdout}`);
log(`${stderr}`);
if (error) {
log("driver install error: " + error);
} else {
log("Driver installed!");
}
});
});
ipcMain.on('unInstallScpVBus', (event, arg) => {
log("Un-Installing ScpVBus driver..")
var df = __dirname + "\\lib\\"
elevate.exec(df + "devcon.exe", ["remove", "Root\\ScpVBus"],
function (error, stdout, stderr) {
if (error !== null) {
log('driver uninstall error: ' + error);
} else {
log("Driver un-installed!");
}
});
});
ipcMain.on('installAudioDriver', (event, arg) => {
log("Installing audio driver..")
var df = __dirname + "\\lib\\"
elevate.exec("regsvr32", [df + "audio_sniffer.dll"],
function (error, stdout, stderr) {
if (error !== null) {
log('driver install error: ' + error);
} else {
log("Driver installed!");
}
});
});
ipcMain.on('unInstallAudioDriver', (event, arg) => {
log("Un-Installing audio driver..")
var df = __dirname + "\\lib\\"
elevate.exec("regsvr32", ["/u", df + "audio_sniffer.dll"],
function (error, stdout, stderr) {
if (error !== null) {
log('driver uninstall error: ' + error);
} else {
log("Driver un-installed!");
}
});
});

File diff suppressed because it is too large Load diff

View file

@ -11,17 +11,23 @@
"author": "Dustin Harris", "author": "Dustin Harris",
"license": "", "license": "",
"dependencies": { "dependencies": {
"ansi_up": "^5.0.0", "ansi_up": "latest",
"auto-launch": "^5.0.5", "auto-launch": "latest",
"bootstrap": "latest", "crc": "latest",
"electron": "latest", "dgram": "latest",
"electron-is-dev": "^1.2.0", "electron": "^17.1.0",
"electron-is-dev": "latest",
"electron-window-state": "latest", "electron-window-state": "latest",
"formidable": "latest", "formidable": "latest",
"jquery": "latest", "jquery": "latest",
"popper.js": "latest", "long": "latest",
"readdirp": "latest", "popper.js": "^1.16.1",
"screenres": "^2.0.1", "struct": "latest",
"windows-elevate": "^1.0.1" "vgen-xbox": "git+https://github.com/JAMesserman/vgen-xbox.git",
"windows-elevate": "^1.0.1",
"ws": "^8.5.0"
},
"devDependencies": {
"electron-rebuild": "^3.2.7"
} }
} }

View file

@ -3,6 +3,6 @@
cls cls
Title nxLink Title nxLink
echo Sending compiled homebrew to switch. echo Sending compiled homebrew to switch.
C:\devkitPro\tools\bin\nxlink.exe -a 172.16.0.12 -s SkyNX.nro C:\devkitPro\tools\bin\nxlink.exe -a 192.168.1.111 -s SkyNX.nro
pause pause
goto 1 goto 1

Binary file not shown.

12
SkyNX/setup.bat Normal file
View file

@ -0,0 +1,12 @@
@echo off
cls
pacman -S switch-sdl2
pacman -S switch-sdl2_ttf
pacman -S switch-ffmpeg
pacman -S switch-sdl2_image
pacman -S switch-sdl2_gfx
pacman -S switch-sdl2_mixer
pacman -S switch-glad
pacman -S switch-libvpx
pacman -S switch-libtheora
pacman -S switch-libvorbis

26
SkyNX/source/.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,26 @@
{
"Lua.diagnostics.disable": [
"lowercase-global",
"undefined-doc-name"
],
"Lua.diagnostics.globals": [
"__simulator",
"print",
"simulator"
],
"Lua.runtime.version": "Lua 5.3",
"Lua.runtime.builtin": {
"coroutine": "enable",
"bit32": "enable",
"bit": "enable",
"builtin": "enable",
"utf8": "enable",
"package": "enable",
"os": "enable",
"jit": "enable",
"io": "enable",
"ffi": "enable",
"debug": "enable",
"basic": "enable"
}
}

View file

@ -4,125 +4,96 @@
#include "input.h" #include "input.h"
#include "network.h" #include "network.h"
#include "renderer.h" #include "renderer.h"
PadState pad;
HiddbgAbstractedPadHandle pads[4]={0};
HiddbgAbstractedPadState states[4]={0};
HidSixAxisSensorHandle handles[4];
s32 tmpout=0;
Result rc=0;
void gamePadSend(JoyConSocket *connection) void gamePadSend(JoyConSocket *connection)
{ {
JoystickPosition lJoy;
JoystickPosition rJoy;
JoyPkg pkg; JoyPkg pkg;
/* Recieve switch input and generate the package */
hidScanInput();
uint32_t controllersConnected = 0;
HidControllerID player1Id;
if (hidGetHandheldMode())
{
player1Id = CONTROLLER_HANDHELD;
controllersConnected++;
}
else
{
player1Id = CONTROLLER_PLAYER_1;
}
for (short i = 0; i < 4; i++)
{
if (hidIsControllerConnected(i))
{
controllersConnected++;
}
}
pkg.streamStart = (uint64_t)UINT64_MAX; //easy identifiers for the start and stop of tcp stream pkg.streamStart = (uint64_t)UINT64_MAX; //easy identifiers for the start and stop of tcp stream
pkg.streamEnd = (uint64_t)UINT64_MAX / 2; pkg.streamEnd = (uint64_t)UINT64_MAX / 2;
pkg.frameRate = (uint32_t)frameRate; pkg.controllerCount = (uint32_t)1;
pkg.controllerCount = (uint32_t)controllersConnected;
pkg.heldKeys1 = (uint32_t)hidKeysHeld(player1Id);
hidJoystickRead(&lJoy, player1Id, JOYSTICK_LEFT);
hidJoystickRead(&rJoy, player1Id, JOYSTICK_RIGHT);
pkg.lJoyX1 = (int32_t)lJoy.dx;
pkg.lJoyY1 = (int32_t)lJoy.dy;
pkg.rJoyX1 = (int32_t)rJoy.dx;
pkg.rJoyY1 = (int32_t)rJoy.dy;
pkg.heldKeys2 = (uint32_t)hidKeysHeld(CONTROLLER_PLAYER_2); tmpout = 0;
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_2, JOYSTICK_LEFT); rc = hiddbgGetAbstractedPadsState(pads, states, sizeof(pads)/sizeof(u64), &tmpout);
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_2, JOYSTICK_RIGHT);
pkg.lJoyX2 = (int32_t)lJoy.dx;
pkg.lJoyY2 = (int32_t)lJoy.dy;
pkg.rJoyX2 = (int32_t)rJoy.dx;
;
pkg.rJoyY2 = (int32_t)rJoy.dy;
pkg.heldKeys3 = (uint32_t)hidKeysHeld(CONTROLLER_PLAYER_3); // if (tmpout>=1) {
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_3, JOYSTICK_LEFT); // s8 AbstractedVirtualPadId=0;
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_3, JOYSTICK_RIGHT);
pkg.lJoyX3 = (int32_t)lJoy.dx;
pkg.lJoyY3 = (int32_t)lJoy.dy;
pkg.rJoyX3 = (int32_t)rJoy.dx;
;
pkg.rJoyY3 = (int32_t)rJoy.dy;
pkg.heldKeys4 = (uint32_t)hidKeysHeld(CONTROLLER_PLAYER_4); // // Setup state. You could also construct it without using hiddbgGetAbstractedPadsState, if preferred.
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_4, JOYSTICK_LEFT);
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_4, JOYSTICK_RIGHT);
pkg.lJoyX4 = (int32_t)lJoy.dx;
pkg.lJoyY4 = (int32_t)lJoy.dy;
pkg.rJoyX4 = (int32_t)rJoy.dx;
;
pkg.rJoyY4 = (int32_t)rJoy.dy;
pkg.heldKeys5 = (uint32_t)hidKeysHeld(CONTROLLER_PLAYER_5); // // Set type to one that's usable with state-merge. Note that this is also available with Hdls.
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_5, JOYSTICK_LEFT); // states[0].type = BIT(1);
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_5, JOYSTICK_RIGHT); // // Use state-merge for the above controller, the state will be merged with an existing controller.
// // For a plain virtual controller, use NpadInterfaceType_Bluetooth, and update the above type value.
// states[0].npadInterfaceType = HidNpadInterfaceType_Rail;
pkg.lJoyX5 = (int32_t)lJoy.dx; // states[0].state.buttons |= HidNpadButton_ZL;
pkg.lJoyY5 = (int32_t)lJoy.dy;
pkg.rJoyX5 = (int32_t)rJoy.dx;
;
pkg.rJoyY5 = (int32_t)rJoy.dy;
pkg.heldKeys6 = (uint32_t)hidKeysHeld(CONTROLLER_PLAYER_6); // rc = hiddbgSetAutoPilotVirtualPadState(AbstractedVirtualPadId, &states[0]);
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_6, JOYSTICK_LEFT); // printf("hiddbgSetAutoPilotVirtualPadState(): 0x%x\n", rc);
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_6, JOYSTICK_RIGHT); // }
pkg.lJoyX6 = (int32_t)lJoy.dx;
pkg.lJoyY6 = (int32_t)lJoy.dy;
pkg.rJoyX6 = (int32_t)rJoy.dx;
;
pkg.rJoyY6 = (int32_t)rJoy.dy;
pkg.heldKeys7 = (uint32_t)hidKeysHeld(CONTROLLER_PLAYER_7);
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_7, JOYSTICK_LEFT);
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_7, JOYSTICK_RIGHT);
pkg.lJoyX7 = (int32_t)lJoy.dx;
pkg.lJoyY7 = (int32_t)lJoy.dy;
pkg.rJoyX7 = (int32_t)rJoy.dx;
;
pkg.rJoyY7 = (int32_t)rJoy.dy;
pkg.heldKeys8 = (uint32_t)hidKeysHeld(CONTROLLER_PLAYER_8);
hidJoystickRead(&lJoy, CONTROLLER_PLAYER_8, JOYSTICK_LEFT);
hidJoystickRead(&rJoy, CONTROLLER_PLAYER_8, JOYSTICK_RIGHT);
pkg.lJoyX8 = (int32_t)lJoy.dx;
pkg.lJoyY8 = (int32_t)lJoy.dy;
pkg.rJoyX8 = (int32_t)rJoy.dx;
;
pkg.rJoyY8 = (int32_t)rJoy.dy;
touchPosition touch; pkg.heldKeys1 = (uint32_t)states[0].state.buttons;
hidTouchRead(&touch, 0); pkg.lJoyX1 = (int32_t)states[0].state.analog_stick_l.x;
pkg.touchX1 = (uint32_t)touch.px; pkg.lJoyY1 = (int32_t)states[0].state.analog_stick_l.y;
pkg.touchY1 = (uint32_t)touch.py; pkg.rJoyX1 = (int32_t)states[0].state.analog_stick_r.x;
hidTouchRead(&touch, 1); pkg.rJoyY1 = (int32_t)states[0].state.analog_stick_r.y;
pkg.touchX2 = (uint32_t)touch.px;
pkg.touchY2 = (uint32_t)touch.py;
SixAxisSensorValues sixaxis; pkg.heldKeys2 = (uint32_t)states[1].state.buttons;
// You can read back up to 17 successive values at once pkg.lJoyX2 = (int32_t)states[1].state.analog_stick_l.x;
hidSixAxisSensorValuesRead(&sixaxis, player1Id, 1); pkg.lJoyY2 = (int32_t)states[1].state.analog_stick_l.y;
pkg.accelX = (float_t)sixaxis.accelerometer.x; pkg.rJoyX2 = (int32_t)states[1].state.analog_stick_r.x;
pkg.accelY = (float_t)sixaxis.accelerometer.y; pkg.rJoyY2 = (int32_t)states[1].state.analog_stick_r.y;
pkg.accelZ = (float_t)sixaxis.accelerometer.z;
pkg.gyroX = (float_t)sixaxis.gyroscope.x; pkg.heldKeys3 = (uint32_t)states[2].state.buttons;
pkg.gyroY = (float_t)sixaxis.gyroscope.y; pkg.lJoyX3 = (int32_t)states[2].state.analog_stick_l.x;
pkg.gyroZ = (float_t)sixaxis.gyroscope.z; pkg.lJoyY3 = (int32_t)states[2].state.analog_stick_l.y;
pkg.rJoyX3 = (int32_t)states[2].state.analog_stick_r.x;
pkg.rJoyY3 = (int32_t)states[2].state.analog_stick_r.y;
pkg.heldKeys4 = (uint32_t)states[3].state.buttons;
pkg.lJoyX4 = (int32_t)states[3].state.analog_stick_l.x;
pkg.lJoyY4 = (int32_t)states[3].state.analog_stick_l.y;
pkg.rJoyX4 = (int32_t)states[3].state.analog_stick_r.x;
pkg.rJoyY4 = (int32_t)states[3].state.analog_stick_r.y;
HidTouchScreenState touchState={0};
if (hidGetTouchScreenStates(&touchState, 1)) {
pkg.touchX1 = (uint32_t)touchState.touches[0].x;
pkg.touchY1 = (uint32_t)touchState.touches[0].y;
pkg.touchX2 = (uint32_t)touchState.touches[1].x;
pkg.touchY2 = (uint32_t)touchState.touches[1].y;
}
HidSixAxisSensorState sixaxis = {0};
u64 style_set = padGetStyleSet(&pad);
if (style_set & HidNpadStyleTag_NpadHandheld)
hidGetSixAxisSensorStates(handles[0], &sixaxis, 1);
else if (style_set & HidNpadStyleTag_NpadFullKey)
hidGetSixAxisSensorStates(handles[1], &sixaxis, 1);
else if (style_set & HidNpadStyleTag_NpadJoyDual) {
// For JoyDual, read from either the Left or Right Joy-Con depending on which is/are connected
u64 attrib = padGetAttributes(&pad);
if (attrib & HidNpadAttribute_IsLeftConnected)
hidGetSixAxisSensorStates(handles[2], &sixaxis, 1);
else if (attrib & HidNpadAttribute_IsRightConnected)
hidGetSixAxisSensorStates(handles[3], &sixaxis, 1);
}
pkg.accelX = (float_t)sixaxis.acceleration.x;
pkg.accelY = (float_t)sixaxis.acceleration.y;
pkg.accelZ = (float_t)sixaxis.acceleration.z;
pkg.gyroX = (float_t)sixaxis.angle.x;
pkg.gyroY = (float_t)sixaxis.angle.y;
pkg.gyroZ = (float_t)sixaxis.angle.z;
sendJoyConInput(connection, &pkg); sendJoyConInput(connection, &pkg);
} }
@ -131,14 +102,32 @@ void handleInput(JoyConSocket *connection)
if (connectJoyConSocket(connection, 2223)) if (connectJoyConSocket(connection, 2223))
gamePadSend(connection); gamePadSend(connection);
} }
void inputHandlerLoop(void *dummy) void inputHandlerLoop(void *dummy)
{ {
JoyConSocket *connection = createJoyConSocket(); JoyConSocket *connection = createJoyConSocket();
padConfigureInput(4, HidNpadStyleSet_NpadStandard);
padInitializeAny(&pad);
rc = hiddbgInitialize();
hidInitializeTouchScreen();
// It's necessary to initialize these separately as they all have different handle values
HidSixAxisSensorHandle handles[4];
hidGetSixAxisSensorHandles(&handles[0], 1, HidNpadIdType_Handheld, HidNpadStyleTag_NpadHandheld);
hidGetSixAxisSensorHandles(&handles[1], 1, HidNpadIdType_No1, HidNpadStyleTag_NpadFullKey);
hidGetSixAxisSensorHandles(&handles[2], 2, HidNpadIdType_No1, HidNpadStyleTag_NpadJoyDual);
hidStartSixAxisSensor(handles[0]);
hidStartSixAxisSensor(handles[1]);
hidStartSixAxisSensor(handles[2]);
hidStartSixAxisSensor(handles[3]);
while (appletMainLoop()) while (appletMainLoop())
{ {
handleInput(connection); handleInput(connection);
svcSleepThread(23333333ULL); svcSleepThread(23333333ULL);
} }
freeJoyConSocket(connection); freeJoyConSocket(connection);
hiddbgUnsetAllAutoPilotVirtualPadState();
hiddbgExit();
hidStopSixAxisSensor(handles[0]);
hidStopSixAxisSensor(handles[1]);
hidStopSixAxisSensor(handles[2]);
hidStopSixAxisSensor(handles[3]);
} }

View file

@ -56,41 +56,7 @@ static const SocketInitConfig socketInitConf = {
.sb_efficiency = 2, .sb_efficiency = 2,
}; };
u32 gyroHandles[4];
void initGyro()
{
hidGetSixAxisSensorHandles(&gyroHandles[0], 2, CONTROLLER_PLAYER_1, TYPE_JOYCON_PAIR);
hidGetSixAxisSensorHandles(&gyroHandles[2], 1, CONTROLLER_PLAYER_1, TYPE_PROCONTROLLER);
hidGetSixAxisSensorHandles(&gyroHandles[3], 1, CONTROLLER_HANDHELD, TYPE_HANDHELD);
hidStartSixAxisSensor(gyroHandles[0]);
hidStartSixAxisSensor(gyroHandles[1]);
hidStartSixAxisSensor(gyroHandles[2]);
hidStartSixAxisSensor(gyroHandles[3]);
}
void unInitGyro()
{
hidStopSixAxisSensor(gyroHandles[0]);
hidStopSixAxisSensor(gyroHandles[1]);
hidStopSixAxisSensor(gyroHandles[2]);
hidStopSixAxisSensor(gyroHandles[3]);
}
void switchInit()
{
plInitialize();
romfsInit();
networkInit(&socketInitConf);
audoutInitialize();
audoutStartAudioOut();
}
void switchDestroy()
{
audoutStopAudioOut();
audoutExit();
networkDestroy();
plExit();
}
static Thread renderThread; static Thread renderThread;
static Thread inputHandlerThread; static Thread inputHandlerThread;
@ -120,7 +86,11 @@ ClkrstSession cpuSession;
void init() void init()
{ {
/* Init all switch required systems */ /* Init all switch required systems */
switchInit(); romfsInit();
networkInit(&socketInitConf);
audoutInitialize();
audoutStartAudioOut();
padConfigureInput(8, HidNpadStyleSet_NpadStandard);
clkrstInitialize(); clkrstInitialize();
clkrstOpenSession(&cpuSession, PcvModuleId_CpuBus, 3); clkrstOpenSession(&cpuSession, PcvModuleId_CpuBus, 3);
clkrstSetClockRate(&cpuSession, 1785000000); clkrstSetClockRate(&cpuSession, 1785000000);
@ -130,16 +100,18 @@ void init()
startAudio(); startAudio();
startInput(); startInput();
startRender(videoContext); startRender(videoContext);
initGyro();
appletSetIdleTimeDetectionExtension(AppletIdleTimeDetectionExtension_ExtendedUnsafe); appletSetIdleTimeDetectionExtension(AppletIdleTimeDetectionExtension_ExtendedUnsafe);
} }
void unInit() void unInit()
{ {
freeRenderer(renderContext); freeRenderer(renderContext);
freeVideoContext(videoContext); freeVideoContext(videoContext);
unInitGyro();
clkrstCloseSession(&cpuSession); //end OC clkrstCloseSession(&cpuSession); //end OC
clkrstExit(); clkrstExit();
audoutStopAudioOut();
audoutExit();
networkDestroy();
plExit();
} }
bool threadsSleeping = false; bool threadsSleeping = false;
int main(int argc, char **argv) int main(int argc, char **argv)
@ -150,7 +122,7 @@ int main(int argc, char **argv)
static Thread audioHandlerThread; static Thread audioHandlerThread;
while (appletMainLoop()) while (appletMainLoop())
{ {
if (appletGetFocusState() == AppletFocusState_Focused) if (appletGetFocusState() == AppletFocusState_InFocus)
{ {
if (threadsSleeping) if (threadsSleeping)
{ {

View file

@ -31,26 +31,6 @@ typedef struct
int32_t lJoyY4; int32_t lJoyY4;
int32_t rJoyX4; int32_t rJoyX4;
int32_t rJoyY4; int32_t rJoyY4;
uint32_t heldKeys5;
int32_t lJoyX5;
int32_t lJoyY5;
int32_t rJoyX5;
int32_t rJoyY5;
uint32_t heldKeys6;
int32_t lJoyX6;
int32_t lJoyY6;
int32_t rJoyX6;
int32_t rJoyY6;
uint32_t heldKeys7;
int32_t lJoyX7;
int32_t lJoyY7;
int32_t rJoyX7;
int32_t rJoyY7;
uint32_t heldKeys8;
int32_t lJoyX8;
int32_t lJoyY8;
int32_t rJoyX8;
int32_t rJoyY8;
uint32_t touchX1; uint32_t touchX1;
uint32_t touchY1; uint32_t touchY1;
uint32_t touchX2; uint32_t touchX2;
@ -62,7 +42,6 @@ typedef struct
float_t gyroY; float_t gyroY;
float_t gyroZ; float_t gyroZ;
uint32_t controllerCount; uint32_t controllerCount;
uint32_t frameRate;
uint64_t streamEnd; uint64_t streamEnd;
} JoyPkg; } JoyPkg;

View file

@ -9,7 +9,6 @@
float timeThen = 0; float timeThen = 0;
float timeNow = 1; float timeNow = 1;
float delta = 1; float delta = 1;
uint32_t frameRate = 0;
void initDelta() void initDelta()
{ {
timeThen = svcGetSystemTick(); timeThen = svcGetSystemTick();
@ -22,7 +21,7 @@ void loopStart()
delta = (timeNow - timeThen) / 10000000; delta = (timeNow - timeThen) / 10000000;
if (delta > 1) if (delta > 1)
{ {
//to much lag. set to 1 // to much lag. set to 1
delta = 1.0f; delta = 1.0f;
} }
} }
@ -69,7 +68,7 @@ long getDistance(long ax, long ay, long bx, long by)
return sqrt(a * a + b * b); return sqrt(a * a + b * b);
} }
bubble resolveBubble(bubble b1, bubble b2) bubble resolveBubble(bubble b1, bubble b2)
{ //Fix colliding circles { // Fix colliding circles
long distance_x = b1.x - b2.x; long distance_x = b1.x - b2.x;
long distance_y = b1.y - b2.y; long distance_y = b1.y - b2.y;
long radii_sum = b1.r + b2.r; long radii_sum = b1.r + b2.r;
@ -77,9 +76,9 @@ bubble resolveBubble(bubble b1, bubble b2)
long unit_x = distance_x / distance; long unit_x = distance_x / distance;
long unit_y = distance_y / distance; long unit_y = distance_y / distance;
b1.x = b2.x + (radii_sum)*unit_x; //Uncollide b1.x = b2.x + (radii_sum)*unit_x; // Uncollide
b1.y = b2.y + (radii_sum)*unit_y; //Uncollide b1.y = b2.y + (radii_sum)*unit_y; // Uncollide
//Conservation of momentum // Conservation of momentum
long newVelX1 = (b1.vx * (b1.r - b2.r) + (2 * b2.r * b2.vx)) / radii_sum; long newVelX1 = (b1.vx * (b1.r - b2.r) + (2 * b2.r * b2.vx)) / radii_sum;
long newVelY1 = (b1.vy * (b1.r - b2.r) + (2 * b2.r * b2.vy)) / radii_sum; long newVelY1 = (b1.vy * (b1.r - b2.r) + (2 * b2.r * b2.vy)) / radii_sum;
// long newVelX2 = (b2.vx * (b2.r - b1.r) + (2 * b1.r * b1.vx)) / radii_sum; // long newVelX2 = (b2.vx * (b2.r - b1.r) + (2 * b1.r * b1.vx)) / radii_sum;
@ -92,9 +91,9 @@ bubble resolveBubble(bubble b1, bubble b2)
return newBubble; return newBubble;
} }
bool detectCircleToCircleCollision(bubble b1, bubble b2) bool detectCircleToCircleCollision(bubble b1, bubble b2)
{ //check for collision between circles { // check for collision between circles
long radii_sum = b1.r + b2.r; long radii_sum = b1.r + b2.r;
long distance = getDistance(b1.x, b1.y, b2.x, b2.y); //If distance is less than radius added together a collision is occuring long distance = getDistance(b1.x, b1.y, b2.x, b2.y); // If distance is less than radius added together a collision is occuring
if (distance < radii_sum) if (distance < radii_sum)
{ {
return true; return true;
@ -131,7 +130,7 @@ void resolveCollisions()
} }
} }
if (!aCollided) if (!aCollided)
{ //If nothing collided keep the same data { // If nothing collided keep the same data
newBubbles[a] = bubbles[a]; newBubbles[a] = bubbles[a];
} }
aCollided = false; aCollided = false;
@ -218,11 +217,11 @@ RenderContext *createRenderer()
while (1) while (1)
; ;
} }
SDL_SetRenderDrawBlendMode(context->renderer, SDL_BLENDMODE_BLEND); //enable transparency SDL_SetRenderDrawBlendMode(context->renderer, SDL_BLENDMODE_BLEND); // enable transparency
logoTexture = IMG_LoadTexture(context->renderer, "iconTransparent.png"); logoTexture = IMG_LoadTexture(context->renderer, "iconTransparent.png");
//Create font cache // Create font cache
context->yuv_text = SDL_CreateTexture(context->renderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STREAMING, RESX, RESY); context->yuv_text = SDL_CreateTexture(context->renderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STREAMING, RESX, RESY);
context->rect.x = 0; context->rect.x = 0;
@ -354,21 +353,21 @@ void drawGradient(RenderContext *context, int x, int y, int w, int h, SDL_Color
int drawLines = 1; int drawLines = 1;
switch (direction) switch (direction)
{ {
case 1: //Top to bottom gradient case 1: // Top to bottom gradient
drawLines = h; drawLines = h;
break; break;
case 2: //Bottom to top gradient case 2: // Bottom to top gradient
drawLines = h; drawLines = h;
break; break;
case 3: //Left to right gradient case 3: // Left to right gradient
drawLines = w; drawLines = w;
break; break;
case 4: //Right to left gradient case 4: // Right to left gradient
drawLines = w; drawLines = w;
break; break;
} }
for (int i = 0; i < drawLines; i++) for (int i = 0; i < drawLines; i++)
{ //Top to bottom gradient { // Top to bottom gradient
float t = ((float)(i)) / ((float)(drawLines)); float t = ((float)(i)) / ((float)(drawLines));
int r = ((float)colourStart.r) * (1.0f - t) + ((float)colourEnd.r) * t; int r = ((float)colourStart.r) * (1.0f - t) + ((float)colourEnd.r) * t;
int g = ((float)colourStart.g) * (1.0f - t) + ((float)colourEnd.g) * t; int g = ((float)colourStart.g) * (1.0f - t) + ((float)colourEnd.g) * t;
@ -395,8 +394,8 @@ void drawGradient(RenderContext *context, int x, int y, int w, int h, SDL_Color
void renderBubbles(RenderContext *context) void renderBubbles(RenderContext *context)
{ {
//Buggy right now. I need to understand C a bit better first. // Buggy right now. I need to understand C a bit better first.
//resolveCollisions(); // resolveCollisions();
for (int i = 0; i < bubblesLength; i++) for (int i = 0; i < bubblesLength; i++)
{ {
bubbles[i].vx += globalForce.vx * delta; bubbles[i].vx += globalForce.vx * delta;
@ -404,7 +403,7 @@ void renderBubbles(RenderContext *context)
bubbles[i].x += bubbles[i].vx * delta; bubbles[i].x += bubbles[i].vx * delta;
bubbles[i].y += bubbles[i].vy * delta; bubbles[i].y += bubbles[i].vy * delta;
float negRadius = bubbles[i].r * -1; float negRadius = bubbles[i].r * -1;
if (bubbles[i].y < negRadius || bubbles[i].y > 720 + bubbles[i].r + 1) //bubble off top or overflowed to bottom because large delta if (bubbles[i].y < negRadius || bubbles[i].y > 720 + bubbles[i].r + 1) // bubble off top or overflowed to bottom because large delta
{ {
float randYv = getRandomInt(20, 50) * -1; float randYv = getRandomInt(20, 50) * -1;
@ -485,13 +484,6 @@ void handleFrame(RenderContext *renderContext, VideoContext *videoContext)
memcpy(renderContext->VPlane, frame->data[2], sizeof(renderContext->VPlane)); memcpy(renderContext->VPlane, frame->data[2], sizeof(renderContext->VPlane));
mutexUnlock(&renderContext->texture_mut); mutexUnlock(&renderContext->texture_mut);
setFrameAvail(renderContext); setFrameAvail(renderContext);
if (++videoContext->video_frame_count % 60 == 0)
{
new_time = svcGetSystemTick();
frameRate = (uint32_t)(60.0 / ((new_time - old_time) / 19200000.0));
old_time = new_time;
}
} }
void displayFrame(RenderContext *renderContext) void displayFrame(RenderContext *renderContext)

View file

@ -5,7 +5,6 @@
#include <libswscale/swscale.h> #include <libswscale/swscale.h>
#include "context.h" #include "context.h"
uint32_t frameRate;
/* Allocates a render context */ /* Allocates a render context */
RenderContext *createRenderer(void); RenderContext *createRenderer(void);