From 9e385215ce254b4047eb4e7092b1479f6694ccdc Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 21 Jul 2014 22:49:57 -0700 Subject: [PATCH] Add support for selecting sops on or off --- .../src/com/limelight/nvstream/NvConnection.java | 2 +- .../src/com/limelight/nvstream/StreamConfiguration.java | 9 ++++++++- .../src/com/limelight/nvstream/http/NvHTTP.java | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/moonlight-common/src/com/limelight/nvstream/NvConnection.java b/moonlight-common/src/com/limelight/nvstream/NvConnection.java index b7f72240..0f8ef5fb 100644 --- a/moonlight-common/src/com/limelight/nvstream/NvConnection.java +++ b/moonlight-common/src/com/limelight/nvstream/NvConnection.java @@ -169,7 +169,7 @@ public class NvConnection { throws IOException, XmlPullParserException { // Launch the app since it's not running int gameSessionId = h.launchApp(app.getAppId(), config.getWidth(), - config.getHeight(), config.getRefreshRate(), riKey); + config.getHeight(), config.getRefreshRate(), riKey, config.getSops()); if (gameSessionId == 0) { listener.displayMessage("Failed to launch application"); return false; diff --git a/moonlight-common/src/com/limelight/nvstream/StreamConfiguration.java b/moonlight-common/src/com/limelight/nvstream/StreamConfiguration.java index 807e4eca..cc610ff5 100644 --- a/moonlight-common/src/com/limelight/nvstream/StreamConfiguration.java +++ b/moonlight-common/src/com/limelight/nvstream/StreamConfiguration.java @@ -6,6 +6,7 @@ public class StreamConfiguration { private int refreshRate; private int bitrate; private int maxPacketSize; + private boolean sops; public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate) { this.app = app; @@ -14,15 +15,17 @@ public class StreamConfiguration { this.refreshRate = refreshRate; this.bitrate = bitrate; this.maxPacketSize = 1024; + this.sops = true; } - public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate, int maxPacketSize) { + public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate, int maxPacketSize, boolean sops) { this.app = app; this.width = width; this.height = height; this.refreshRate = refreshRate; this.bitrate = bitrate; this.maxPacketSize = maxPacketSize; + this.sops = sops; } public int getWidth() { @@ -48,4 +51,8 @@ public class StreamConfiguration { public String getApp() { return app; } + + public boolean getSops() { + return sops; + } } diff --git a/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java b/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java index 9c543ffd..9fdb2176 100644 --- a/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java +++ b/moonlight-common/src/com/limelight/nvstream/http/NvHTTP.java @@ -252,12 +252,13 @@ public class NvHTTP { openHttpConnection(baseUrl + "/unpair?uniqueid=" + uniqueId); } - public int launchApp(int appId, int width, int height, int refreshRate, SecretKey inputKey) throws IOException, XmlPullParserException { + public int launchApp(int appId, int width, int height, int refreshRate, SecretKey inputKey, boolean sops) throws IOException, XmlPullParserException { InputStream in = openHttpConnection(baseUrl + "/launch?uniqueid=" + uniqueId + "&appid=" + appId + "&mode=" + width + "x" + height + "x" + refreshRate + - "&additionalStates=1&sops=0&rikey="+cryptoProvider.encodeBase64String(inputKey.getEncoded())); + "&additionalStates=1&sops=" + (sops ? 1 : 0) + + "&rikey="+cryptoProvider.encodeBase64String(inputKey.getEncoded())); String gameSession = getXmlString(in, "gamesession"); return Integer.parseInt(gameSession); }