mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-07-12 18:04:04 +00:00
Fix compilation for 3DS (#140)
* Changes to enhance support for 3DS * Align helpers to correct type at compile * explicity declare/initialize operational val where used
This commit is contained in:
committed by
GitHub
parent
2ea47752c3
commit
82e2514854
+6
-1
@@ -73,6 +73,9 @@ DWORD WINAPI ThreadProc(LPVOID lpParameter) {
|
||||
#elif defined(__WIIU__)
|
||||
int ThreadProc(int argc, const char** argv) {
|
||||
struct thread_context* ctx = (struct thread_context*)argv;
|
||||
#elif defined (__3DS__)
|
||||
void ThreadProc(void* context) {
|
||||
struct thread_context* ctx = (struct thread_context*)context;
|
||||
#else
|
||||
void* ThreadProc(void* context) {
|
||||
struct thread_context* ctx = (struct thread_context*)context;
|
||||
@@ -90,8 +93,10 @@ void* ThreadProc(void* context) {
|
||||
|
||||
free(ctx);
|
||||
|
||||
#if defined(LC_WINDOWS) || defined(__vita__) || defined(__WIIU__) || defined(__3DS__)
|
||||
#if defined(LC_WINDOWS) || defined(__vita__) || defined(__WIIU__)
|
||||
return 0;
|
||||
#elif defined(__3DS__)
|
||||
return;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
@@ -151,7 +151,8 @@ int pollSockets(struct pollfd* pollFds, int pollFdsCount, int timeoutMs) {
|
||||
#elif defined(__3DS__)
|
||||
int err;
|
||||
u64 poll_start = osGetTime();
|
||||
for (u64 i = poll_start; (i - poll_start) < timeoutMs; i = osGetTime()) {
|
||||
// seems like timeoutMs is never negative
|
||||
for (u64 i = poll_start; (i - poll_start) < (u64)timeoutMs; i = osGetTime()) {
|
||||
err = poll(pollFds, pollFdsCount, 0); // This is running for 14ms
|
||||
if (err) {
|
||||
break;
|
||||
@@ -471,18 +472,17 @@ SOCKET connectTcpSocket(struct sockaddr_storage* dstaddr, SOCKADDR_LEN addrlen,
|
||||
// We still must split our own sends into smaller chunks with TCP_NODELAY enabled to
|
||||
// avoid MTU issues on the way out to to the target.
|
||||
#if defined(LC_WINDOWS) && !defined(NXDK)
|
||||
int val;
|
||||
|
||||
// Windows doesn't support setting TCP_MAXSEG but IP_PMTUDISC_DONT forces the MSS to the protocol
|
||||
// minimum which is what we want here. Linux doesn't do this (disabling PMTUD just avoids setting DF).
|
||||
if (dstaddr->ss_family == AF_INET) {
|
||||
val = IP_PMTUDISC_DONT;
|
||||
int val = IP_PMTUDISC_DONT;
|
||||
if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, (char*)&val, sizeof(val)) < 0) {
|
||||
Limelog("setsockopt(IP_MTU_DISCOVER, IP_PMTUDISC_DONT) failed: %d\n", val, (int)LastSocketError());
|
||||
}
|
||||
}
|
||||
else {
|
||||
val = IP_PMTUDISC_DONT;
|
||||
int val = IP_PMTUDISC_DONT;
|
||||
if (setsockopt(s, IPPROTO_IPV6, IPV6_MTU_DISCOVER, (char*)&val, sizeof(val)) < 0) {
|
||||
Limelog("setsockopt(IPV6_MTU_DISCOVER, IP_PMTUDISC_DONT) failed: %d\n", val, (int)LastSocketError());
|
||||
}
|
||||
|
||||
@@ -902,7 +902,7 @@ static bool parseUrlAddrFromRtspUrlString(const char* rtspUrlString, char* desti
|
||||
|
||||
// SDP attributes are in the form:
|
||||
// a=x-nv-bwe.bwuSafeZoneLowLimit:70\r\n
|
||||
bool parseSdpAttributeToUInt(const char* payload, const char* name, unsigned int* val) {
|
||||
bool parseSdpAttributeToUInt(const char* payload, const char* name, uint32_t* val) {
|
||||
// Find the entry for the specified attribute name
|
||||
char* attribute = strstr(payload, name);
|
||||
if (!attribute) {
|
||||
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
#include "Limelight-internal.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
#define MAX_OPTION_NAME_LEN 128
|
||||
|
||||
@@ -269,7 +270,7 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
|
||||
if (IS_SUNSHINE()) {
|
||||
// Send client feature flags to Sunshine hosts
|
||||
uint32_t moonlightFeatureFlags = ML_FF_FEC_STATUS | ML_FF_SESSION_ID_V1;
|
||||
snprintf(payloadStr, sizeof(payloadStr), "%u", moonlightFeatureFlags);
|
||||
snprintf(payloadStr, sizeof(payloadStr), "%" PRIu32, moonlightFeatureFlags);
|
||||
err |= addAttributeString(&optionHead, "x-ml-general.featureFlags", payloadStr);
|
||||
|
||||
// New-style control stream encryption is low overhead, so we enable it any time it is supported
|
||||
@@ -299,7 +300,7 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
|
||||
EncryptionFeaturesEnabled |= SS_ENC_AUDIO;
|
||||
}
|
||||
|
||||
snprintf(payloadStr, sizeof(payloadStr), "%u", EncryptionFeaturesEnabled);
|
||||
snprintf(payloadStr, sizeof(payloadStr), "%" PRIu32, EncryptionFeaturesEnabled);
|
||||
err |= addAttributeString(&optionHead, "x-ss-general.encryptionEnabled", payloadStr);
|
||||
|
||||
// Enable YUV444 if requested
|
||||
|
||||
Reference in New Issue
Block a user