mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Merge branch 'master' of github.com:s0ckz/limelight-common
Conflicts: src/com/limelight/nvstream/StreamConfiguration.java
This commit is contained in:
commit
ef1f44f873
1
moonlight-common/.gitignore
vendored
1
moonlight-common/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
*.class
|
*.class
|
||||||
|
/bin
|
||||||
|
@ -160,7 +160,7 @@ public class NvConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean startSteamBigPicture() throws XmlPullParserException, IOException
|
private boolean startApp() throws XmlPullParserException, IOException
|
||||||
{
|
{
|
||||||
NvHTTP h = new NvHTTP(hostAddr, getMacAddressString(), localDeviceName, cryptoProvider);
|
NvHTTP h = new NvHTTP(hostAddr, getMacAddressString(), localDeviceName, cryptoProvider);
|
||||||
|
|
||||||
@ -174,18 +174,21 @@ public class NvConnection {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvApp app = h.getSteamApp();
|
NvApp app = h.getApp(config.getApp());
|
||||||
if (app == null) {
|
if (app == null) {
|
||||||
listener.displayMessage("Steam not found in GFE app list");
|
listener.displayMessage("The app " + config.getApp() + " is not in GFE app list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there's a game running, resume it
|
// If there's a game running, resume it
|
||||||
if (h.getCurrentGame() != 0) {
|
if (h.getCurrentGame() != 0) {
|
||||||
try {
|
try {
|
||||||
if (!h.resumeApp(riKey)) {
|
if (h.getCurrentGame() == app.getAppId() && !h.resumeApp(riKey)) {
|
||||||
listener.displayMessage("Failed to resume existing session");
|
listener.displayMessage("Failed to resume existing session");
|
||||||
return false;
|
return false;
|
||||||
|
} else if (h.getCurrentGame() != app.getAppId()) {
|
||||||
|
listener.displayMessage("Another app was running. Quitting it");
|
||||||
|
return quitAndLaunch(h, app);
|
||||||
}
|
}
|
||||||
} catch (GfeHttpResponseException e) {
|
} catch (GfeHttpResponseException e) {
|
||||||
if (e.getErrorCode() == 470) {
|
if (e.getErrorCode() == 470) {
|
||||||
@ -196,13 +199,34 @@ public class NvConnection {
|
|||||||
"device or the PC itself and try again. (Error code: "+e.getErrorCode()+")");
|
"device or the PC itself and try again. (Error code: "+e.getErrorCode()+")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else if (e.getErrorCode() == 525) {
|
||||||
|
listener.displayMessage("The application is minimized. Trying to quit it");
|
||||||
|
return quitAndLaunch(h, app);
|
||||||
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeLog.info("Resumed existing game session");
|
LimeLog.info("Resumed existing game session");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
return launchNotRunningApp(h, app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean quitAndLaunch(NvHTTP h, NvApp app) throws IOException,
|
||||||
|
XmlPullParserException {
|
||||||
|
if (!h.quitApp()) {
|
||||||
|
listener.displayMessage("Failed to quit previous session! You must quit it manually");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return launchNotRunningApp(h, app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean launchNotRunningApp(NvHTTP h, NvApp app)
|
||||||
|
throws IOException, XmlPullParserException {
|
||||||
// Launch the app since it's not running
|
// Launch the app since it's not running
|
||||||
int gameSessionId = h.launchApp(app.getAppId(), config.getWidth(),
|
int gameSessionId = h.launchApp(app.getAppId(), config.getWidth(),
|
||||||
config.getHeight(), config.getRefreshRate(), riKey);
|
config.getHeight(), config.getRefreshRate(), riKey);
|
||||||
@ -210,8 +234,8 @@ public class NvConnection {
|
|||||||
listener.displayMessage("Failed to launch application");
|
listener.displayMessage("Failed to launch application");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeLog.info("Launched new game session");
|
LimeLog.info("Launched new game session");
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -265,7 +289,7 @@ public class NvConnection {
|
|||||||
switch (currentStage)
|
switch (currentStage)
|
||||||
{
|
{
|
||||||
case LAUNCH_APP:
|
case LAUNCH_APP:
|
||||||
success = startSteamBigPicture();
|
success = startApp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RTSP_HANDSHAKE:
|
case RTSP_HANDSHAKE:
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package com.limelight.nvstream;
|
package com.limelight.nvstream;
|
||||||
|
|
||||||
public class StreamConfiguration {
|
public class StreamConfiguration {
|
||||||
|
private String app;
|
||||||
private int width, height;
|
private int width, height;
|
||||||
private int refreshRate;
|
private int refreshRate;
|
||||||
private int bitrate;
|
private int bitrate;
|
||||||
private int maxPacketSize;
|
private int maxPacketSize;
|
||||||
|
|
||||||
public StreamConfiguration(int width, int height, int refreshRate, int bitrate) {
|
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate) {
|
||||||
|
this.app = app;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.refreshRate = refreshRate;
|
this.refreshRate = refreshRate;
|
||||||
@ -14,7 +16,8 @@ public class StreamConfiguration {
|
|||||||
this.maxPacketSize = 1024;
|
this.maxPacketSize = 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StreamConfiguration(int width, int height, int refreshRate, int bitrate, int maxPacketSize) {
|
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate, int maxPacketSize) {
|
||||||
|
this.app = app;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.refreshRate = refreshRate;
|
this.refreshRate = refreshRate;
|
||||||
@ -41,4 +44,8 @@ public class StreamConfiguration {
|
|||||||
public int getMaxPacketSize() {
|
public int getMaxPacketSize() {
|
||||||
return maxPacketSize;
|
return maxPacketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApp() {
|
||||||
|
return app;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,12 +140,12 @@ public class NvHTTP {
|
|||||||
return Integer.parseInt(game);
|
return Integer.parseInt(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NvApp getSteamApp() throws IOException,
|
public NvApp getApp(String app) throws IOException,
|
||||||
XmlPullParserException {
|
XmlPullParserException {
|
||||||
LinkedList<NvApp> appList = getAppList();
|
LinkedList<NvApp> appList = getAppList();
|
||||||
for (NvApp app : appList) {
|
for (NvApp appFromList : appList) {
|
||||||
if (app.getAppName().equals("Steam")) {
|
if (appFromList.getAppName().equals(app)) {
|
||||||
return app;
|
return appFromList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user