diff --git a/index.html b/index.html
index ba03ad6..abe5631 100644
--- a/index.html
+++ b/index.html
@@ -163,7 +163,7 @@
diff --git a/static/js/index.js b/static/js/index.js
index 488a5da..6d6c649 100644
--- a/static/js/index.js
+++ b/static/js/index.js
@@ -253,7 +253,7 @@ function pairTo(nvhttpHost, onSuccess, onFailure) {
nvhttpHost.pollServer(function(ret) {
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
onFailure();
return;
@@ -354,8 +354,6 @@ function addHost() {
beginBackgroundPollingOfHost(_nvhttpHost);
}
saveHosts();
- }, function() {
- snackbarLog('pairing to ' + inputHost + ' failed!');
});
modal.close();
});
@@ -566,7 +564,7 @@ function showApps(host) {
var img = new Image();
img.src = 'static/res/applist_error.svg'
$("#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());
});
@@ -590,7 +588,7 @@ function showHostsAndSettingsMode() {
}
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();
$("#main-navigation").show();
$("#main-content").children().not("#listener, #loadingSpinner, #naclSpinner").show();
@@ -601,6 +599,15 @@ function showAppsMode() {
$("#settings").hide();
$("#main-content").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
// 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.
return host.resumeApp(
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,
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion
]);
@@ -688,7 +704,16 @@ function startGame(host, appID) {
remote_audio_enabled, // Play audio locally too?
0x030002, // Surround channel mask << 16 | Surround channel count
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,
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion
]);
@@ -776,8 +801,7 @@ function stopGame(host, callbackFunction) {
snackbarLog('Stopping ' + appName);
host.quitApp().then(function(ret2) {
host.refreshServerInfo().then(function(ret3) { // refresh to show no app is currently running.
- showAppsMode();
- stylizeBoxArt(host, runningApp.id);
+ showApps(host);
if (typeof(callbackFunction) === "function") callbackFunction();
}, 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());
diff --git a/static/js/messages.js b/static/js/messages.js
index 9493a90..8e4a9c1 100644
--- a/static/js/messages.js
+++ b/static/js/messages.js
@@ -37,26 +37,16 @@ function handleMessage(msg) {
} else { // else, it's just info, or an event
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
- $('#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
chrome.power.releaseKeepAwake();
- api.refreshServerInfo().then(function(ret) { // refresh the serverinfo to acknowledge the currently running app
- api.getAppList().then(function(appList) {
- appList.forEach(function(app) {
- stylizeBoxArt(api, app.id); // and reapply stylization to indicate what's currently running
- });
- });
+ api.refreshServerInfo().then(function(ret) {
+ // Return to app list with new currentgame
+ showApps(api);
+ }, function() {
+ // Return to app list anyway
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') {
$('#loadingSpinner').css('display', 'none');
$('body').css('backgroundColor', 'black');
diff --git a/static/js/utils.js b/static/js/utils.js
index e0d3f83..9a0ef2a 100644
--- a/static/js/utils.js
+++ b/static/js/utils.js
@@ -417,9 +417,7 @@ NvHTTP.prototype = {
'&remoteControllersBitmap=' + gamepadMask +
'&gcmap=' + gamepadMask,
false
- ]).then(function(ret) {
- return true;
- });
+ ]);
},
resumeApp: function(rikey, rikeyid, surroundAudioInfo) {
@@ -430,9 +428,7 @@ NvHTTP.prototype = {
'&rikeyid=' + rikeyid +
'&surroundAudioInfo=' + surroundAudioInfo,
false
- ]).then(function(ret) {
- return true;
- });
+ ]);
},
quitApp: function() {