mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Address broken error checking for launch requests and other minor issues
This commit is contained in:
parent
1194556b9c
commit
754173543a
@ -163,7 +163,7 @@
|
|||||||
<div class="mdl-dialog__content">
|
<div class="mdl-dialog__content">
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||||
<input class="mdl-textfield__input" type="text" id="dialogInputHost" />
|
<input class="mdl-textfield__input" type="text" id="dialogInputHost" />
|
||||||
<label class="mdl-textfield__label" for="dialogInputHost">IP Address or Hostname of Geforce PC</label>
|
<label class="mdl-textfield__label" for="dialogInputHost">IP Address or Hostname of GeForce PC</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-dialog__actions">
|
<div class="mdl-dialog__actions">
|
||||||
|
@ -253,7 +253,7 @@ function pairTo(nvhttpHost, onSuccess, onFailure) {
|
|||||||
|
|
||||||
nvhttpHost.pollServer(function(ret) {
|
nvhttpHost.pollServer(function(ret) {
|
||||||
if (!nvhttpHost.online) {
|
if (!nvhttpHost.online) {
|
||||||
snackbarLog('Failed to connect to ' + nvhttpHost.hostname + '! Are you sure the host is on?');
|
snackbarLog('Failed to connect to ' + nvhttpHost.hostname + '! Ensure that GameStream is enabled in GeForce Experience.');
|
||||||
console.error('%c[index.js]', 'color: green;', 'Host declared as offline:', nvhttpHost, nvhttpHost.toString()); //Logging both the object and the toString version for text logs
|
console.error('%c[index.js]', 'color: green;', 'Host declared as offline:', nvhttpHost, nvhttpHost.toString()); //Logging both the object and the toString version for text logs
|
||||||
onFailure();
|
onFailure();
|
||||||
return;
|
return;
|
||||||
@ -354,8 +354,6 @@ function addHost() {
|
|||||||
beginBackgroundPollingOfHost(_nvhttpHost);
|
beginBackgroundPollingOfHost(_nvhttpHost);
|
||||||
}
|
}
|
||||||
saveHosts();
|
saveHosts();
|
||||||
}, function() {
|
|
||||||
snackbarLog('pairing to ' + inputHost + ' failed!');
|
|
||||||
});
|
});
|
||||||
modal.close();
|
modal.close();
|
||||||
});
|
});
|
||||||
@ -566,7 +564,7 @@ function showApps(host) {
|
|||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.src = 'static/res/applist_error.svg'
|
img.src = 'static/res/applist_error.svg'
|
||||||
$("#game-grid").html(img)
|
$("#game-grid").html(img)
|
||||||
snackbarLog('Unable to get your games')
|
snackbarLog('Unable to retrieve your games')
|
||||||
console.error('%c[index.js, showApps]', 'Failed to get applist from host: ' + host.hostname, '\n Host object:', host, host.toString());
|
console.error('%c[index.js, showApps]', 'Failed to get applist from host: ' + host.hostname, '\n Host object:', host, host.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -590,7 +588,7 @@ function showHostsAndSettingsMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showAppsMode() {
|
function showAppsMode() {
|
||||||
console.log('%c[index.js]', 'color: green;', 'Entrering "Show apps" mode');
|
console.log('%c[index.js]', 'color: green;', 'Entering "Show apps" mode');
|
||||||
$('#backIcon').show();
|
$('#backIcon').show();
|
||||||
$("#main-navigation").show();
|
$("#main-navigation").show();
|
||||||
$("#main-content").children().not("#listener, #loadingSpinner, #naclSpinner").show();
|
$("#main-content").children().not("#listener, #loadingSpinner, #naclSpinner").show();
|
||||||
@ -601,6 +599,15 @@ function showAppsMode() {
|
|||||||
$("#settings").hide();
|
$("#settings").hide();
|
||||||
$("#main-content").removeClass("fullscreen");
|
$("#main-content").removeClass("fullscreen");
|
||||||
$("#listener").removeClass("fullscreen");
|
$("#listener").removeClass("fullscreen");
|
||||||
|
$('#loadingSpinner').css('display', 'none');
|
||||||
|
$('body').css('backgroundColor', '#282C38');
|
||||||
|
|
||||||
|
// Restore back to a window
|
||||||
|
if (windowState == 'normal') {
|
||||||
|
chrome.app.window.current().restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
isInGame = false;
|
||||||
|
|
||||||
// FIXME: We want to eventually poll on the app screen but we can't now
|
// FIXME: We want to eventually poll on the app screen but we can't now
|
||||||
// because it slows down box art loading and we don't update the UI live
|
// because it slows down box art loading and we don't update the UI live
|
||||||
@ -669,7 +676,16 @@ function startGame(host, appID) {
|
|||||||
if (host.currentGame == appID) { // if user wants to launch the already-running app, then we resume it.
|
if (host.currentGame == appID) { // if user wants to launch the already-running app, then we resume it.
|
||||||
return host.resumeApp(
|
return host.resumeApp(
|
||||||
rikey, rikeyid, 0x030002 // Surround channel mask << 16 | Surround channel count
|
rikey, rikeyid, 0x030002 // Surround channel mask << 16 | Surround channel count
|
||||||
).then(function(ret) {
|
).then(function(launchResult) {
|
||||||
|
$xml = $($.parseXML(launchResult.toString()));
|
||||||
|
$root = $xml.find('root');
|
||||||
|
|
||||||
|
if ($root.attr('status_code') != 200) {
|
||||||
|
snackbarLog('Error ' + $root.attr('status_code') + ': ' + $root.attr('status_message'));
|
||||||
|
showApps(host);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate,
|
sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate,
|
||||||
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion
|
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion
|
||||||
]);
|
]);
|
||||||
@ -688,7 +704,16 @@ function startGame(host, appID) {
|
|||||||
remote_audio_enabled, // Play audio locally too?
|
remote_audio_enabled, // Play audio locally too?
|
||||||
0x030002, // Surround channel mask << 16 | Surround channel count
|
0x030002, // Surround channel mask << 16 | Surround channel count
|
||||||
gamepadMask
|
gamepadMask
|
||||||
).then(function(ret) {
|
).then(function(launchResult) {
|
||||||
|
$xml = $($.parseXML(launchResult.toString()));
|
||||||
|
$root = $xml.find('root');
|
||||||
|
|
||||||
|
if ($root.attr('status_code') != 200) {
|
||||||
|
snackbarLog('Error ' + $root.attr('status_code') + ': ' + $root.attr('status_message'));
|
||||||
|
showApps(host);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate,
|
sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate,
|
||||||
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion
|
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion
|
||||||
]);
|
]);
|
||||||
@ -776,8 +801,7 @@ function stopGame(host, callbackFunction) {
|
|||||||
snackbarLog('Stopping ' + appName);
|
snackbarLog('Stopping ' + appName);
|
||||||
host.quitApp().then(function(ret2) {
|
host.quitApp().then(function(ret2) {
|
||||||
host.refreshServerInfo().then(function(ret3) { // refresh to show no app is currently running.
|
host.refreshServerInfo().then(function(ret3) { // refresh to show no app is currently running.
|
||||||
showAppsMode();
|
showApps(host);
|
||||||
stylizeBoxArt(host, runningApp.id);
|
|
||||||
if (typeof(callbackFunction) === "function") callbackFunction();
|
if (typeof(callbackFunction) === "function") callbackFunction();
|
||||||
}, function(failedRefreshInfo2) {
|
}, function(failedRefreshInfo2) {
|
||||||
console.error('%c[index.js, stopGame]', 'color:green;', 'Failed to refresh server info! Returned error was:' + failedRefreshInfo + ' and failed server was:', host, host.toString());
|
console.error('%c[index.js, stopGame]', 'color:green;', 'Failed to refresh server info! Returned error was:' + failedRefreshInfo + ' and failed server was:', host, host.toString());
|
||||||
|
@ -37,26 +37,16 @@ function handleMessage(msg) {
|
|||||||
} else { // else, it's just info, or an event
|
} else { // else, it's just info, or an event
|
||||||
console.log('%c[messages.js, handleMessage]', 'color:gray;', 'Message data: ', msg.data)
|
console.log('%c[messages.js, handleMessage]', 'color:gray;', 'Message data: ', msg.data)
|
||||||
if (msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function
|
if (msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function
|
||||||
$('#loadingSpinner').css('display', 'none'); // This is a fallback for RTSP handshake failing, which immediately terminates the stream.
|
|
||||||
$('body').css('backgroundColor', '#282C38');
|
|
||||||
|
|
||||||
// Release our keep awake request
|
// Release our keep awake request
|
||||||
chrome.power.releaseKeepAwake();
|
chrome.power.releaseKeepAwake();
|
||||||
|
|
||||||
api.refreshServerInfo().then(function(ret) { // refresh the serverinfo to acknowledge the currently running app
|
api.refreshServerInfo().then(function(ret) {
|
||||||
api.getAppList().then(function(appList) {
|
// Return to app list with new currentgame
|
||||||
appList.forEach(function(app) {
|
showApps(api);
|
||||||
stylizeBoxArt(api, app.id); // and reapply stylization to indicate what's currently running
|
}, function() {
|
||||||
});
|
// Return to app list anyway
|
||||||
});
|
|
||||||
showApps(api);
|
showApps(api);
|
||||||
|
|
||||||
isInGame = false;
|
|
||||||
|
|
||||||
// restore main window from 'fullscreen' to 'normal' mode (if required)
|
|
||||||
(windowState == 'normal') && chrome.app.window.current().restore();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (msg.data === 'Connection Established') {
|
} else if (msg.data === 'Connection Established') {
|
||||||
$('#loadingSpinner').css('display', 'none');
|
$('#loadingSpinner').css('display', 'none');
|
||||||
$('body').css('backgroundColor', 'black');
|
$('body').css('backgroundColor', 'black');
|
||||||
|
@ -417,9 +417,7 @@ NvHTTP.prototype = {
|
|||||||
'&remoteControllersBitmap=' + gamepadMask +
|
'&remoteControllersBitmap=' + gamepadMask +
|
||||||
'&gcmap=' + gamepadMask,
|
'&gcmap=' + gamepadMask,
|
||||||
false
|
false
|
||||||
]).then(function(ret) {
|
]);
|
||||||
return true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resumeApp: function(rikey, rikeyid, surroundAudioInfo) {
|
resumeApp: function(rikey, rikeyid, surroundAudioInfo) {
|
||||||
@ -430,9 +428,7 @@ NvHTTP.prototype = {
|
|||||||
'&rikeyid=' + rikeyid +
|
'&rikeyid=' + rikeyid +
|
||||||
'&surroundAudioInfo=' + surroundAudioInfo,
|
'&surroundAudioInfo=' + surroundAudioInfo,
|
||||||
false
|
false
|
||||||
]).then(function(ret) {
|
]);
|
||||||
return true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
quitApp: function() {
|
quitApp: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user