mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 19:13:03 +00:00
Add support for sending attached gamepads at launch-time to support games that only detect at start
This commit is contained in:
parent
f644436aeb
commit
de05a5b446
@ -27,7 +27,8 @@ public class StreamConfiguration {
|
|||||||
private boolean supportsHevc;
|
private boolean supportsHevc;
|
||||||
private int hevcBitratePercentageMultiplier;
|
private int hevcBitratePercentageMultiplier;
|
||||||
private boolean enableHdr;
|
private boolean enableHdr;
|
||||||
|
private int attachedGamepadMask;
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private StreamConfiguration config = new StreamConfiguration();
|
private StreamConfiguration config = new StreamConfiguration();
|
||||||
|
|
||||||
@ -86,6 +87,21 @@ public class StreamConfiguration {
|
|||||||
config.enableHdr = enableHdr;
|
config.enableHdr = enableHdr;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StreamConfiguration.Builder setAttachedGamepadMask(int attachedGamepadMask) {
|
||||||
|
config.attachedGamepadMask = attachedGamepadMask;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamConfiguration.Builder setAttachedGamepadMaskByCount(int gamepadCount) {
|
||||||
|
config.attachedGamepadMask = 0;
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if (gamepadCount > i) {
|
||||||
|
config.attachedGamepadMask |= 1 << i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public StreamConfiguration.Builder setAudioConfiguration(int audioConfig) {
|
public StreamConfiguration.Builder setAudioConfiguration(int audioConfig) {
|
||||||
if (audioConfig == MoonBridge.AUDIO_CONFIGURATION_STEREO) {
|
if (audioConfig == MoonBridge.AUDIO_CONFIGURATION_STEREO) {
|
||||||
@ -129,6 +145,7 @@ public class StreamConfiguration {
|
|||||||
this.audioChannelMask = CHANNEL_MASK_STEREO;
|
this.audioChannelMask = CHANNEL_MASK_STEREO;
|
||||||
this.supportsHevc = false;
|
this.supportsHevc = false;
|
||||||
this.enableHdr = false;
|
this.enableHdr = false;
|
||||||
|
this.attachedGamepadMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
@ -194,4 +211,8 @@ public class StreamConfiguration {
|
|||||||
public boolean getEnableHdr() {
|
public boolean getEnableHdr() {
|
||||||
return enableHdr;
|
return enableHdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAttachedGamepadMask() {
|
||||||
|
return attachedGamepadMask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,9 @@ public class NvHTTP {
|
|||||||
"&rikeyid="+context.riKeyId +
|
"&rikeyid="+context.riKeyId +
|
||||||
(!enableHdr ? "" : "&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0") +
|
(!enableHdr ? "" : "&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0") +
|
||||||
"&localAudioPlayMode=" + (context.streamConfig.getPlayLocalAudio() ? 1 : 0) +
|
"&localAudioPlayMode=" + (context.streamConfig.getPlayLocalAudio() ? 1 : 0) +
|
||||||
"&surroundAudioInfo=" + ((context.streamConfig.getAudioChannelMask() << 16) + context.streamConfig.getAudioChannelCount()),
|
"&surroundAudioInfo=" + ((context.streamConfig.getAudioChannelMask() << 16) + context.streamConfig.getAudioChannelCount()) +
|
||||||
|
(context.streamConfig.getAttachedGamepadMask() != 0 ? "&remoteControllersBitmap=" + context.streamConfig.getAttachedGamepadMask() : "") +
|
||||||
|
(context.streamConfig.getAttachedGamepadMask() != 0 ? "&gcmap=" + context.streamConfig.getAttachedGamepadMask() : ""),
|
||||||
false);
|
false);
|
||||||
String gameSession = getXmlString(xmlStr, "gamesession");
|
String gameSession = getXmlString(xmlStr, "gamesession");
|
||||||
return gameSession != null && !gameSession.equals("0");
|
return gameSession != null && !gameSession.equals("0");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user