Update to support GFE 3.0.7

This commit is contained in:
Cameron Gutman 2016-10-05 19:25:51 -07:00
parent bd881aaee4
commit ee5ee588bc
5 changed files with 23 additions and 16 deletions

View File

@ -108,18 +108,22 @@ void* MoonlightInstance::GamepadThreadFunc(void* context) {
void* MoonlightInstance::ConnectionThreadFunc(void* context) {
MoonlightInstance* me = (MoonlightInstance*)context;
int err;
SERVER_INFORMATION serverInfo;
// Post a status update before we begin
pp::Var response("Starting connection to " + me->m_Host);
me->PostMessage(response);
err = LiStartConnection(me->m_Host.c_str(),
LiInitializeServerInformation(&serverInfo);
serverInfo.address = me->m_Host.c_str();
serverInfo.serverInfoAppVersion = me->m_AppVersion.c_str();
err = LiStartConnection(&serverInfo,
&me->m_StreamConfig,
&MoonlightInstance::s_ClCallbacks,
&MoonlightInstance::s_DrCallbacks,
&MoonlightInstance::s_ArCallbacks,
NULL, 0,
me->m_ServerMajorVersion);
NULL, 0);
if (err != 0) {
// Notify the JS code that the stream has ended
pp::Var response(MSG_STREAM_TERMINATED);
@ -176,9 +180,9 @@ void MoonlightInstance::HandleStartStream(int32_t callbackId, pp::VarArray args)
std::string height = args.Get(2).AsString();
std::string fps = args.Get(3).AsString();
std::string bitrate = args.Get(4).AsString();
std::string serverMajorVersion = args.Get(5).AsString();
std::string rikey = args.Get(6).AsString();
std::string rikeyid = args.Get(7).AsString();
std::string rikey = args.Get(5).AsString();
std::string rikeyid = args.Get(6).AsString();
std::string appversion = args.Get(7).AsString();
pp::Var response("Setting stream width to: " + width);
PostMessage(response);
@ -190,12 +194,12 @@ void MoonlightInstance::HandleStartStream(int32_t callbackId, pp::VarArray args)
PostMessage(response);
response = ("Setting stream bitrate to: " + bitrate);
PostMessage(response);
response = ("Setting server major version to: " + serverMajorVersion);
PostMessage(response);
response = ("Setting rikey to: " + rikey);
PostMessage(response);
response = ("Setting rikeyid to: " + rikeyid);
PostMessage(response);
response = ("Setting appversion to: " + appversion);
PostMessage(response);
// Populate the stream configuration
LiInitializeStreamConfiguration(&m_StreamConfig);
@ -205,7 +209,6 @@ void MoonlightInstance::HandleStartStream(int32_t callbackId, pp::VarArray args)
m_StreamConfig.bitrate = stoi(bitrate); // kilobits per second
m_StreamConfig.streamingRemotely = 0;
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
m_ServerMajorVersion = stoi(serverMajorVersion);
// The overhead of receiving a packet is much higher in NaCl because we must
// pass through various layers of abstraction on each recv() call. We're using a
@ -218,8 +221,9 @@ void MoonlightInstance::HandleStartStream(int32_t callbackId, pp::VarArray args)
int rikeyiv = htonl(stoi(rikeyid));
memcpy(m_StreamConfig.remoteInputAesIv, &rikeyiv, sizeof(rikeyiv));
// Store the host from the start message
// Store the parameters from the start message
m_Host = host;
m_AppVersion = appversion;
// Initialize the rendering surface before starting the connection
if (InitializeRenderingSurface(m_StreamConfig.width, m_StreamConfig.height)) {

@ -1 +1 @@
Subproject commit 293c6a7274f877322afd7dae4eac96533ff2ab5d
Subproject commit bd825776b3d40ea834bac2352e4359bb3145b367

View File

@ -145,8 +145,8 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
static AUDIO_RENDERER_CALLBACKS s_ArCallbacks;
std::string m_Host;
std::string m_AppVersion;
STREAM_CONFIGURATION m_StreamConfig;
int m_ServerMajorVersion;
bool m_Running;
pthread_t m_ConnectionThread;

View File

@ -504,7 +504,7 @@ 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).then(function (ret) {
sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate,
bitrate.toString(), host.serverMajorVersion.toString(), rikey, rikeyid.toString()]);
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion]);
}, function (failedResumeApp) {
console.log('ERROR: failed to resume the app!');
console.log('Returned error was: ' + failedResumeApp);
@ -522,7 +522,7 @@ function startGame(host, appID) {
0x030002 // Surround channel mask << 16 | Surround channel count
).then(function (ret) {
sendMessage('startRequest', [host.address, streamWidth, streamHeight, frameRate,
bitrate.toString(), host.serverMajorVersion.toString(), rikey, rikeyid.toString()]);
bitrate.toString(), rikey, rikeyid.toString(), host.appVersion]);
}, function (failedLaunchApp) {
console.log('ERROR: failed to launch app with appID: ' + appID);
console.log('Returned error was: ' + failedLaunchApp);

View File

@ -37,6 +37,7 @@ function NvHTTP(address, clientUid, userEnteredAddress = '') {
this.paired = false;
this.currentGame = 0;
this.serverMajorVersion = 0;
this.appVersion = '';
this.clientUid = clientUid;
this._memCachedBoxArtArray = {};
this._pollCount = 0;
@ -159,6 +160,7 @@ NvHTTP.prototype = {
string += 'is paired: ' + this.paired + '\r\n';
string += 'current game: ' + this.currentGame + '\r\n';
string += 'server major version: ' + this.serverMajorVersion + '\r\n';
string += 'appversion: ' + this.appVersion + '\r\n';
string += 'GFE version: ' + this.GfeVersion + '\r\n';
string += 'gpu type: ' + this.gputype + '\r\n';
string += 'number of apps: ' + this.numofapps + '\r\n';
@ -191,7 +193,8 @@ NvHTTP.prototype = {
this.paired = $root.find("PairStatus").text().trim() == 1;
this.currentGame = parseInt($root.find("currentgame").text().trim(), 10);
this.serverMajorVersion = parseInt($root.find("appversion").text().trim().substring(0, 1), 10);
this.appVersion = $root.find("appversion").text().trim();
this.serverMajorVersion = parseInt(this.appVersion.substring(0, 1), 10);
this.serverUid = $root.find('uniqueid').text().trim();
this.hostname = $root.find('hostname').text().trim();
this.externalIP = $root.find('ExternalIP').text().trim();