mirror of
https://github.com/DevL0rd/SkyNX
synced 2024-11-26 04:50:18 +00:00
Added a few more toggles.
This commit is contained in:
parent
fb7056c56b
commit
91d7c02d46
5 changed files with 179 additions and 100 deletions
|
@ -14,6 +14,8 @@ var sheight = screenSize.height;
|
||||||
var swidth = screenSize.width;
|
var swidth = screenSize.width;
|
||||||
var hidStreamClient = new net.Socket();
|
var hidStreamClient = new net.Socket();
|
||||||
var usingVideo = true;
|
var usingVideo = true;
|
||||||
|
var usingAudio = true;
|
||||||
|
var abxySwap = false;
|
||||||
function connect() {
|
function connect() {
|
||||||
hidStreamClient.connect({
|
hidStreamClient.connect({
|
||||||
host: ip,
|
host: ip,
|
||||||
|
@ -84,7 +86,9 @@ hidStreamClient.on('connect', function () {
|
||||||
if (usingVideo) {
|
if (usingVideo) {
|
||||||
startVideoProcess();
|
startVideoProcess();
|
||||||
}
|
}
|
||||||
startAudioProcess();
|
if (usingAudio) {
|
||||||
|
startAudioProcess();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var switchHidBuffer = new Buffer.alloc(0);
|
var switchHidBuffer = new Buffer.alloc(0);
|
||||||
function parseInputStruct(buff) {
|
function parseInputStruct(buff) {
|
||||||
|
@ -186,10 +190,18 @@ function handleControllerInput(hid, controllerId, playerNumber) {
|
||||||
|
|
||||||
var inputStates = heldKeysBitmask(heldKeys);
|
var inputStates = heldKeysBitmask(heldKeys);
|
||||||
//Button mapping
|
//Button mapping
|
||||||
vgen.setButton(controllerId, vgen.Buttons.B, inputStates.A);
|
if (!abxySwap) {
|
||||||
vgen.setButton(controllerId, vgen.Buttons.A, inputStates.B);
|
vgen.setButton(controllerId, vgen.Buttons.B, inputStates.A);
|
||||||
vgen.setButton(controllerId, vgen.Buttons.X, inputStates.Y);
|
vgen.setButton(controllerId, vgen.Buttons.A, inputStates.B);
|
||||||
vgen.setButton(controllerId, vgen.Buttons.Y, inputStates.X);
|
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.BACK, inputStates.Minus);
|
||||||
vgen.setButton(controllerId, vgen.Buttons.START, inputStates.Plus);
|
vgen.setButton(controllerId, vgen.Buttons.START, inputStates.Plus);
|
||||||
vgen.setButton(controllerId, vgen.Buttons.LEFT_SHOULDER, inputStates.L);
|
vgen.setButton(controllerId, vgen.Buttons.LEFT_SHOULDER, inputStates.L);
|
||||||
|
@ -326,7 +338,9 @@ hidStreamClient.on('end', function () {
|
||||||
if (usingVideo) {
|
if (usingVideo) {
|
||||||
ffmpegProcess.kill();
|
ffmpegProcess.kill();
|
||||||
}
|
}
|
||||||
ffmpegAudioProcess.kill();
|
if (usingAudio) {
|
||||||
|
ffmpegAudioProcess.kill();
|
||||||
|
}
|
||||||
setTimeout(connect, 1000);
|
setTimeout(connect, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -346,9 +360,19 @@ if (args.length > 1) {
|
||||||
} else {
|
} else {
|
||||||
usingVideo = true;
|
usingVideo = true;
|
||||||
}
|
}
|
||||||
|
if (args.includes("/noAudio")) {
|
||||||
|
usingAudio = false;
|
||||||
|
} else {
|
||||||
|
usingAudio = true;
|
||||||
|
}
|
||||||
|
if (args.includes("/abxySwap")) {
|
||||||
|
abxySwap = true;
|
||||||
|
} else {
|
||||||
|
abxySwap = false;
|
||||||
|
}
|
||||||
connect();
|
connect();
|
||||||
} else {
|
} else {
|
||||||
console.log('Error: Usage NXStreamer.exe ip 0.0.0.0 q 5');
|
console.log('Error: Usage NXStreamer.exe ip 0.0.0.0 q 5 /noVideo /noAudio /abxySwap');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('Error: Usage NXStreamer.exe ip 0.0.0.0 q 5');
|
console.log('Error: Usage NXStreamer.exe ip 0.0.0.0 q 5');
|
||||||
|
|
|
@ -59,102 +59,116 @@
|
||||||
Disable Video
|
Disable Video
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<div class="form-group">
|
||||||
<div class="comment">Useful for using your JoyCons on PC and streaming the audio to headphones or the switch
|
<label class="switch">
|
||||||
speakers.</div>
|
<input id="disableAudio" type="checkbox">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label class="form-check-label" for="rainbowEnabled">
|
||||||
|
Disable Audio
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="switch">
|
||||||
|
<input id="abxySwap" type="checkbox">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label class="form-check-label" for="rainbowEnabled">
|
||||||
|
Swap A-B X-Y
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div id="stats" class="contentArea contentAreaScrollable customScroll" style="display: none;">
|
||||||
<div id="stats" class="contentArea contentAreaScrollable customScroll" style="display: none;">
|
<div class="chartpanel">
|
||||||
<div class="chartpanel">
|
<h5 class="chartTitle">FPS</h5>
|
||||||
<h5 class="chartTitle">FPS</h5>
|
<div style="width: 100%; height: 150px;">
|
||||||
<div style="width: 100%; height: 150px;">
|
<canvas id="fpsChart"></canvas>
|
||||||
<canvas id="fpsChart"></canvas>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div id="settings" class="contentArea contentAreaScrollable customScroll" style="display: none;">
|
||||||
<div id="settings" class="contentArea contentAreaScrollable customScroll" style="display: none;">
|
<hr />
|
||||||
<hr />
|
<h2>General</h2>
|
||||||
<h2>General</h2>
|
<hr />
|
||||||
<hr />
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label class="switch">
|
||||||
<label class="switch">
|
<input id="autoStart" type="checkbox">
|
||||||
<input id="autoStart" type="checkbox">
|
<span class="slider round"></span>
|
||||||
<span class="slider round"></span>
|
</label>
|
||||||
</label>
|
<label class="form-check-label" for="autoStart">
|
||||||
<label class="form-check-label" for="autoStart">
|
Start streamer automatically
|
||||||
Start streamer automatically
|
</label>
|
||||||
</label>
|
</div>
|
||||||
</div>
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label class="switch">
|
||||||
<label class="switch">
|
<input id="rainbowEnabled" type="checkbox">
|
||||||
<input id="rainbowEnabled" type="checkbox">
|
<span class="slider round"></span>
|
||||||
<span class="slider round"></span>
|
</label>
|
||||||
</label>
|
<label class="form-check-label" for="rainbowEnabled">
|
||||||
<label class="form-check-label" for="rainbowEnabled">
|
Enable Rainbow Accents
|
||||||
Enable Rainbow Accents
|
</label>
|
||||||
</label>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<h2>Drivers</h2>
|
<h2>Drivers</h2>
|
||||||
<hr />
|
<hr />
|
||||||
<form class="form-group">
|
<form class="form-group">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button id="installScpVBusBtn" type="button" class="btn btn-dark btn-block">Install Controller</button>
|
<button id="installScpVBusBtn" type="button" class="btn btn-dark btn-block">Install Controller</button>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<button id="unInstallScpVBusBtn" type="button" class="btn btn-danger btn-block">Un-Install
|
||||||
|
Controller</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
</form>
|
||||||
<button id="unInstallScpVBusBtn" type="button" class="btn btn-danger btn-block">Un-Install
|
<form class="form-group">
|
||||||
Controller</button>
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<button id="installAudioDriverBtn" type="button" class="btn btn-dark btn-block">Install Audio
|
||||||
|
Driver</button>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<button id="unInstallAudioDriverBtn" type="button" class="btn btn-danger btn-block">Un-Install Audio
|
||||||
|
Driver</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</form>
|
</div>
|
||||||
<form class="form-group">
|
<div id="console" class="contentArea" style="display: none;">
|
||||||
<div class="row">
|
<div id="consoleContainer" class="customScroll"></div>
|
||||||
<div class="col">
|
<input id="consoleInput" type="text" placeholder="Console command"><br>
|
||||||
<button id="installAudioDriverBtn" type="button" class="btn btn-dark btn-block">Install Audio
|
</div>
|
||||||
Driver</button>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<button id="unInstallAudioDriverBtn" type="button" class="btn btn-danger btn-block">Un-Install Audio
|
|
||||||
Driver</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="console" class="contentArea" style="display: none;">
|
<div id="statusbar" class="rainbowBackgroundColor2">
|
||||||
<div id="consoleContainer" class="customScroll"></div>
|
<span id="statusbartext">Streamer stopped.</span>
|
||||||
<input id="consoleInput" type="text" placeholder="Console command"><br>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div id="loadingCover">
|
||||||
<div id="statusbar" class="rainbowBackgroundColor2">
|
<div class="centerVert">
|
||||||
<span id="statusbartext">Streamer stopped.</span>
|
<img src="img/loading.gif" class="loadingGif">
|
||||||
</div>
|
<h1 style="color:rgb(206, 206, 206); font-size: 16px;">
|
||||||
<div id="loadingCover">
|
Application loading...
|
||||||
<div class="centerVert">
|
</h1>
|
||||||
<img src="img/loading.gif" class="loadingGif">
|
</div>
|
||||||
<h1 style="color:rgb(206, 206, 206); font-size: 16px;">
|
|
||||||
Application loading...
|
|
||||||
</h1>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<script src="js/fontawesome-all.min.js"></script>
|
||||||
<script src="js/fontawesome-all.min.js"></script>
|
<script src="js/Chart.min.js"></script>
|
||||||
<script src="js/Chart.min.js"></script>
|
<script>
|
||||||
<script>
|
let $ = require('jquery');
|
||||||
let $ = require('jquery');
|
require('popper.js');
|
||||||
require('popper.js');
|
require('bootstrap');
|
||||||
require('bootstrap');
|
$(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/animations.js"></script>
|
<script src="./js/window.js"></script>
|
||||||
<script src="./js/window.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>
|
<script src="./js/console.js"></script>
|
||||||
<script src="./js/console.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -11,13 +11,13 @@ ipcRenderer.on('started', function (event, data) {
|
||||||
})
|
})
|
||||||
var running = false;
|
var running = false;
|
||||||
function connect() {
|
function connect() {
|
||||||
ipcRenderer.send('connect', { ip: clientSettings.ip, q: clientSettings.quality, disableVideo: clientSettings.disableVideo });
|
ipcRenderer.send('connect', { ip: clientSettings.ip, q: clientSettings.quality, disableVideo: clientSettings.disableVideo, disableAudio: clientSettings.disableAudio, abxySwap: clientSettings.abxySwap });
|
||||||
}
|
}
|
||||||
function disconnect() {
|
function disconnect() {
|
||||||
ipcRenderer.send('kill');
|
ipcRenderer.send('kill');
|
||||||
}
|
}
|
||||||
function restart() {
|
function restart() {
|
||||||
ipcRenderer.send('restart', { ip: clientSettings.ip, q: clientSettings.quality, disableVideo: clientSettings.disableVideo });
|
ipcRenderer.send('restart', { ip: clientSettings.ip, q: clientSettings.quality, disableVideo: clientSettings.disableVideo, disableAudio: clientSettings.disableAudio, abxySwap: clientSettings.abxySwap });
|
||||||
}
|
}
|
||||||
$('#startBtn').click(function () {
|
$('#startBtn').click(function () {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
|
|
@ -38,6 +38,12 @@ function initSettings() {
|
||||||
if (!clientSettings.hasOwnProperty("disableVideo")) {
|
if (!clientSettings.hasOwnProperty("disableVideo")) {
|
||||||
clientSettings.disableVideo = false;
|
clientSettings.disableVideo = false;
|
||||||
}
|
}
|
||||||
|
if (!clientSettings.hasOwnProperty("disableAudio")) {
|
||||||
|
clientSettings.disableAudio = false;
|
||||||
|
}
|
||||||
|
if (!clientSettings.hasOwnProperty("abxySwap")) {
|
||||||
|
clientSettings.abxySwap = false;
|
||||||
|
}
|
||||||
if (!clientSettings.hasOwnProperty("firstInstall")) {
|
if (!clientSettings.hasOwnProperty("firstInstall")) {
|
||||||
clientSettings.firstInstall = false;
|
clientSettings.firstInstall = false;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +63,8 @@ function applyClientSettings() {
|
||||||
$("#qualitySlider").val(clientSettings.quality);
|
$("#qualitySlider").val(clientSettings.quality);
|
||||||
$('#qualityLabel').html("Quality: " + clientSettings.quality + "Mbps");
|
$('#qualityLabel').html("Quality: " + clientSettings.quality + "Mbps");
|
||||||
$('#disableVideo').prop("checked", clientSettings.disableVideo);
|
$('#disableVideo').prop("checked", clientSettings.disableVideo);
|
||||||
|
$('#disableAudio').prop("checked", clientSettings.disableAudio);
|
||||||
|
$('#abxySwap').prop("checked", clientSettings.abxySwap);
|
||||||
$("#ipInput").val(clientSettings.ip);
|
$("#ipInput").val(clientSettings.ip);
|
||||||
if (clientSettings.debug) {
|
if (clientSettings.debug) {
|
||||||
$("#dev-btn").fadeIn(400);
|
$("#dev-btn").fadeIn(400);
|
||||||
|
@ -122,11 +129,11 @@ var qualityChangeTimeout;
|
||||||
$(document).on('input', '#qualitySlider', function () {
|
$(document).on('input', '#qualitySlider', function () {
|
||||||
$('#qualityLabel').html("Quality: " + $(this).val() + "Mbps");
|
$('#qualityLabel').html("Quality: " + $(this).val() + "Mbps");
|
||||||
clientSettings.quality = $(this).val();
|
clientSettings.quality = $(this).val();
|
||||||
saveClientSettings();
|
|
||||||
if (running) {
|
if (running) {
|
||||||
clearTimeout(qualityChangeTimeout);
|
clearTimeout(qualityChangeTimeout);
|
||||||
qualityChangeTimeout = setTimeout(restart, 1000)
|
qualityChangeTimeout = setTimeout(restart, 1000)
|
||||||
}
|
}
|
||||||
|
saveClientSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('input', '#ipInput', function () {
|
$(document).on('input', '#ipInput', function () {
|
||||||
|
@ -135,7 +142,25 @@ $(document).on('input', '#ipInput', function () {
|
||||||
});
|
});
|
||||||
$("#disableVideo").on('change', function () {
|
$("#disableVideo").on('change', function () {
|
||||||
clientSettings.disableVideo = $("#disableVideo").prop("checked");
|
clientSettings.disableVideo = $("#disableVideo").prop("checked");
|
||||||
restart();
|
if (running) {
|
||||||
|
restart();
|
||||||
|
}
|
||||||
|
saveClientSettings();
|
||||||
|
applyClientSettings();
|
||||||
|
});
|
||||||
|
$("#disableAudio").on('change', function () {
|
||||||
|
clientSettings.disableAudio = $("#disableAudio").prop("checked");
|
||||||
|
if (running) {
|
||||||
|
restart();
|
||||||
|
}
|
||||||
|
saveClientSettings();
|
||||||
|
applyClientSettings();
|
||||||
|
});
|
||||||
|
$("#abxySwap").on('change', function () {
|
||||||
|
clientSettings.abxySwap = $("#abxySwap").prop("checked");
|
||||||
|
if (running) {
|
||||||
|
restart();
|
||||||
|
}
|
||||||
saveClientSettings();
|
saveClientSettings();
|
||||||
applyClientSettings();
|
applyClientSettings();
|
||||||
});
|
});
|
||||||
|
|
|
@ -82,7 +82,7 @@ app.on('browser-window-created', function (e, window) {
|
||||||
});
|
});
|
||||||
var streamerProcess;
|
var streamerProcess;
|
||||||
var clientSender;
|
var clientSender;
|
||||||
|
var streamerProcessIsRunning = false;
|
||||||
function startStreamer(arg) {
|
function startStreamer(arg) {
|
||||||
var cwd = './NxStreamingService/';
|
var cwd = './NxStreamingService/';
|
||||||
if (!isDev) {
|
if (!isDev) {
|
||||||
|
@ -92,22 +92,38 @@ function startStreamer(arg) {
|
||||||
if (arg.disableVideo) {
|
if (arg.disableVideo) {
|
||||||
args.push("/noVideo");
|
args.push("/noVideo");
|
||||||
}
|
}
|
||||||
|
if (arg.disableAudio) {
|
||||||
|
args.push("/noAudio");
|
||||||
|
}
|
||||||
|
if (arg.abxySwap) {
|
||||||
|
args.push("/abxySwap");
|
||||||
|
}
|
||||||
|
|
||||||
streamerProcess = spawn(
|
streamerProcess = spawn(
|
||||||
"./NxStreamingService.exe",
|
"./NxStreamingService.exe",
|
||||||
args,
|
args,
|
||||||
{ cwd: cwd, stdio: "pipe" }
|
{ cwd: cwd, stdio: "pipe" }
|
||||||
);
|
);
|
||||||
|
|
||||||
streamerProcess.stdout.on("data", data => {
|
streamerProcess.stdout.on("data", data => {
|
||||||
log(`${data}`);
|
log(`${data}`);
|
||||||
|
if (!streamerProcessIsRunning) {
|
||||||
|
streamerProcessIsRunning = true;
|
||||||
|
clientSender.send("started");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
streamerProcess.stderr.on('data', (data) => {
|
streamerProcess.stderr.on('data', (data) => {
|
||||||
log(`${data}`);
|
log(`${data}`);
|
||||||
|
if (!streamerProcessIsRunning) {
|
||||||
|
streamerProcessIsRunning = true;
|
||||||
|
clientSender.send("started");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
streamerProcess.on('close', (code) => {
|
streamerProcess.on('close', (code) => {
|
||||||
clientSender.send("close");
|
clientSender.send("close");
|
||||||
log(`streamerProcess process exited with code ${code}`);
|
log(`streamerProcess process exited with code ${code}`);
|
||||||
|
streamerProcessIsRunning = false;
|
||||||
});
|
});
|
||||||
clientSender.send("started");
|
|
||||||
}
|
}
|
||||||
ipcMain.on('connect', (event, arg) => {
|
ipcMain.on('connect', (event, arg) => {
|
||||||
clientSender = event.sender;
|
clientSender = event.sender;
|
||||||
|
|
Loading…
Reference in a new issue