Merge branch 'multiple_frontend_support' of https://github.com/rock88/moonlight-nx into test

This commit is contained in:
Andrey Konoplyankin 2021-04-25 17:41:40 +03:00
commit 9f0a2c0740
10 changed files with 176 additions and 216 deletions

View file

@ -76,7 +76,8 @@ M_INCLUDES := \
-I$(TOPDIR)/third_party/nanogui/ext/nanovg/src
DEFINES := -DNANOGUI_USE_OPENGL -DNVG_STB_IMAGE_IMPLEMENTATION -DNANOGUI_NO_GLFW \
-DHAS_SOCKLEN_T -DHAS_POLL -DHAS_FCNTL -DUSE_MBEDTLS_CRYPTO -DMOONLIGHT_VERSION=\"$(MOONLIGHT_VERSION)\"
-DUSE_MBEDTLS -DHAS_SOCKLEN_T -DHAS_POLL -DHAS_FCNTL -DUSE_MBEDTLS_CRYPTO \
-DMOONLIGHT_VERSION=\"$(MOONLIGHT_VERSION)\"
CFLAGS := -g -Wall -fcompare-debug-second -O2 -ffunction-sections $(ARCH) $(DEFINES) $(INCLUDE) $(M_INCLUDES) -D__SWITCH__
CXXFLAGS := $(CFLAGS) -std=gnu++17
@ -118,7 +119,6 @@ MOONLIGHT_LIBRETRO_CXX_SOURCES = \
GLVideoRenderer.cpp \
Data.cpp \
MbedTLSCryptoManager.cpp \
mbedtls_to_openssl_wrapper.cpp \
AudrenAudioRenderer.cpp \
BoxArtManager.cpp \
Logger.cpp \
@ -157,6 +157,7 @@ MOONLIGHT_COMMON_C_SOURCES = \
Misc.c \
Platform.c \
PlatformSockets.c \
PlatformCrypto.c \
RtpFecQueue.c \
RtpReorderQueue.c \
RtspConnection.c \

View file

@ -29,8 +29,8 @@
28896597262C88C700139ABE /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28896596262C88C700139ABE /* CoreMedia.framework */; };
28896599262C88D000139ABE /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28896598262C88D000139ABE /* CoreVideo.framework */; };
2889659D262C88DD00139ABE /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2889659C262C88DC00139ABE /* VideoToolbox.framework */; };
288965AF262C89D800139ABE /* mbedtls_to_openssl_wrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36F16474247473A300D70AD9 /* mbedtls_to_openssl_wrapper.cpp */; };
28AD4A752606120A009314C6 /* glad.c in Sources */ = {isa = PBXBuildFile; fileRef = 28AD4A722606120A009314C6 /* glad.c */; };
28EE5DAC2635B49E00C9C623 /* PlatformCrypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 28EE5DAA2635B49E00C9C623 /* PlatformCrypto.c */; };
3602C3B7245D903000368900 /* HostButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3602C3B5245D903000368900 /* HostButton.cpp */; };
3602C3BA245DB3C800368900 /* AppListWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3602C3B8245DB3C800368900 /* AppListWindow.cpp */; };
3602C3BD245DBA9100368900 /* AppButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3602C3BB245DBA9100368900 /* AppButton.cpp */; };
@ -170,6 +170,8 @@
28AD4A712606120A009314C6 /* glad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glad.h; sourceTree = "<group>"; };
28AD4A722606120A009314C6 /* glad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = glad.c; sourceTree = "<group>"; };
28AD4A742606120A009314C6 /* khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = khrplatform.h; sourceTree = "<group>"; };
28EE5DAA2635B49E00C9C623 /* PlatformCrypto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = PlatformCrypto.c; sourceTree = "<group>"; };
28EE5DAB2635B49E00C9C623 /* PlatformCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCrypto.h; sourceTree = "<group>"; };
3602C3B5245D903000368900 /* HostButton.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HostButton.cpp; sourceTree = "<group>"; };
3602C3B6245D903000368900 /* HostButton.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = HostButton.hpp; sourceTree = "<group>"; };
3602C3B8245DB3C800368900 /* AppListWindow.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AppListWindow.cpp; sourceTree = "<group>"; };
@ -392,7 +394,6 @@
36F1646F2474736E00D70AD9 /* switch_wrapper.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = switch_wrapper.c; sourceTree = "<group>"; };
36F164712474736E00D70AD9 /* evp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = evp.h; sourceTree = "<group>"; };
36F164722474736E00D70AD9 /* rand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rand.h; sourceTree = "<group>"; };
36F16474247473A300D70AD9 /* mbedtls_to_openssl_wrapper.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = mbedtls_to_openssl_wrapper.cpp; sourceTree = "<group>"; };
36F16476247481F200D70AD9 /* AudrenAudioRenderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AudrenAudioRenderer.cpp; sourceTree = "<group>"; };
36F16477247481F200D70AD9 /* AudrenAudioRenderer.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = AudrenAudioRenderer.hpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -732,6 +733,8 @@
isa = PBXGroup;
children = (
3652F04E245C292B001FABF3 /* Limelight.h */,
28EE5DAA2635B49E00C9C623 /* PlatformCrypto.c */,
28EE5DAB2635B49E00C9C623 /* PlatformCrypto.h */,
3652F047245C292B001FABF3 /* PlatformThreads.h */,
3652F048245C292B001FABF3 /* Input.h */,
3652F049245C292B001FABF3 /* ControlStream.c */,
@ -952,7 +955,6 @@
children = (
36F164702474736E00D70AD9 /* openssl */,
36F1646F2474736E00D70AD9 /* switch_wrapper.c */,
36F16474247473A300D70AD9 /* mbedtls_to_openssl_wrapper.cpp */,
);
path = switch;
sourceTree = "<group>";
@ -1148,11 +1150,11 @@
3652EFD0245B3B00001FABF3 /* vscrollpanel.cpp in Sources */,
3652F06D245C292B001FABF3 /* win32.c in Sources */,
3652F002245B6961001FABF3 /* AddHostWindow.cpp in Sources */,
288965AF262C89D800139ABE /* mbedtls_to_openssl_wrapper.cpp in Sources */,
3652EFF8245B4EE2001FABF3 /* Application.cpp in Sources */,
3652F07E245C292B001FABF3 /* AudioStream.c in Sources */,
3652F076245C292B001FABF3 /* Connection.c in Sources */,
3652EFE4245B3B00001FABF3 /* combobox.cpp in Sources */,
28EE5DAC2635B49E00C9C623 /* PlatformCrypto.c in Sources */,
3652EFF2245B3B00001FABF3 /* textbox.cpp in Sources */,
3652F074245C292B001FABF3 /* Platform.c in Sources */,
3661D2FF2469E0C00060EE24 /* GLVideoRenderer.cpp in Sources */,
@ -1271,6 +1273,7 @@
"-DHAVE_PULSE",
"-DUSE_MBEDTLS_CRYPTO",
"-DMOONLIGHT_VERSION=\\\"1.1.0\\\"",
"-DUSE_MBEDTLS",
);
OTHER_LDFLAGS = (
"-lglfw",
@ -1364,6 +1367,7 @@
"-DHAVE_PULSE",
"-DUSE_MBEDTLS_CRYPTO",
"-DMOONLIGHT_VERSION=\\\"1.1.0\\\"",
"-DUSE_MBEDTLS",
);
OTHER_LDFLAGS = (
"-lglfw",

View file

@ -74,7 +74,7 @@ int main(int argc, const char * argv[]) {
GamepadController::instance().init(new SwitchGamepadFrontend());
nanogui::init();
nanogui::ref<Application> app = new Application(Size(m_width, m_height), Size(m_fb_width, m_fb_height));
nanogui::ref<Application> app = new Application({ (float)m_width, (float)m_height }, { (float)m_fb_width, (float)m_fb_height });
nanogui::setup(1.0 / 15.0);

View file

@ -10,12 +10,14 @@
#include <fstream>
#include <future>
#include <unistd.h>
#if defined(__linux) || defined(__APPLE__)
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#ifdef __SWITCH__
#elif defined(__SWITCH__)
#include <switch.h>
#endif
@ -83,14 +85,9 @@ void GameStreamClient::stop() {
#endif
}
std::vector<std::string> GameStreamClient::host_addresses_for_find() {
std::vector<std::string> addresses;
static uint32_t get_my_ip_address() {
uint32_t address = 0;
#ifdef __SWITCH__
Result result = nifmGetCurrentIpAddress(&address);
bool isSucceed = R_SUCCEEDED(result);
#else
#if defined(__linux) || defined(__APPLE__)
struct ifreq ifr;
ifr.ifr_addr.sa_family = AF_INET;
strncpy(ifr.ifr_name, "en0", IFNAMSIZ - 1);
@ -100,9 +97,17 @@ std::vector<std::string> GameStreamClient::host_addresses_for_find() {
close(fd);
address = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
#elif defined(__SWITCH__)
nifmGetCurrentIpAddress(&address);
#endif
return address;
}
std::vector<std::string> GameStreamClient::host_addresses_for_find() {
std::vector<std::string> addresses;
bool isSucceed = true;
#endif
uint32_t address = get_my_ip_address();
bool isSucceed = address != 0;
if (isSucceed) {
int a = address & 0xFF;
@ -120,6 +125,10 @@ std::vector<std::string> GameStreamClient::host_addresses_for_find() {
return addresses;
}
bool GameStreamClient::can_find_host() {
return get_my_ip_address() != 0;
}
void GameStreamClient::find_host(ServerCallback<Host> callback) {
perform_async([this, callback] {
auto addresses = host_addresses_for_find();
@ -152,13 +161,19 @@ void GameStreamClient::find_host(ServerCallback<Host> callback) {
});
}
bool GameStreamClient::can_wake_up_host(const Host &host) {
return WakeOnLanManager::instance().can_wake_up_host(host);
}
void GameStreamClient::wake_up_host(const Host &host, ServerCallback<bool> callback) {
perform_async([this, host, callback] {
if (WakeOnLanManager::instance().wake_up_host(host)) {
auto result = WakeOnLanManager::instance().wake_up_host(host);
if (result.isSuccess()) {
usleep(5'000'000);
nanogui::async([callback] { callback(GSResult<bool>::success(true)); });
nanogui::async([callback, result] { callback(result); });
} else {
nanogui::async([callback] { callback(GSResult<bool>::failure("Wake up failed...")); });
nanogui::async([callback, result] { callback(result); });
}
});
}

View file

@ -67,8 +67,13 @@ public:
void stop();
std::vector<std::string> host_addresses_for_find();
bool can_find_host();
void find_host(ServerCallback<Host> callback);
bool can_wake_up_host(const Host &host);
void wake_up_host(const Host &host, ServerCallback<bool> callback);
void connect(const std::string &address, ServerCallback<SERVER_DATA> callback);
void pair(const std::string &address, const std::string &pin, ServerCallback<bool> callback);
void applist(const std::string &address, ServerCallback<AppInfoList> callback);

View file

@ -2,26 +2,28 @@
#include "Data.hpp"
#include "Logger.hpp"
#include "Settings.hpp"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
static const int numPorts = 5;
static const int ports[numPorts] = {7, 9, 47998, 47999, 48000};
#if defined(__linux) || defined(__APPLE__) || defined(__SWITCH__)
#define UNIX_SOCKS
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
static void populate_address(struct sockaddr_storage* addr, unsigned short port) {
if (addr->ss_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in*)addr;
sin->sin_port = htons(port);
}
else if (addr->ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)addr;
sin6->sin6_port = htons(port);
}
}
#elif defined(_WIN32)
#define WIN32_SOCKS
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#endif
#if defined(UNIX_SOCKS) || defined(WIN32_SOCKS)
static Data mac_string_to_bytes(std::string mac) {
std::string str = mac;
@ -51,49 +53,99 @@ static Data create_payload(const Host &host) {
}
return payload;
}
#endif
bool WakeOnLanManager::wake_up_host(const Host &host) {
bool result = false;
#if defined(UNIX_SOCKS)
GSResult<bool> send_packet_unix(const Host &host, const Data &payload) {
struct sockaddr_in udpClient, udpServer;
int broadcast = 1;
int udpSocket = socket(AF_INET, SOCK_DGRAM, 0);
if (udpSocket == -1) {
Logger::error("WakeOnLanManager", "An error was encountered creating the UDP socket: '%s'", strerror(errno));
return GSResult<bool>::failure("An error was encountered creating the UDP socket: " + std::string(strerror(errno)));
}
int setsock_result = setsockopt(udpSocket, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof broadcast);
if (setsock_result == -1) {
Logger::error("WakeOnLanManager", "Failed to set socket options: '%s'", strerror(errno));
return GSResult<bool>::failure("Failed to set socket options: " + std::string(strerror(errno)));
}
// Set parameters
udpClient.sin_family = AF_INET;
udpClient.sin_addr.s_addr = INADDR_ANY;
udpClient.sin_port = 0;
// Bind socket
int bind_result = bind(udpSocket, (struct sockaddr*) &udpClient, sizeof(udpClient));
if (bind_result == -1) {
Logger::error("WakeOnLanManager", "Failed to bind socket: '%s'", strerror(errno));
return GSResult<bool>::failure("Failed to bind socket: " + std::string(strerror(errno)));
}
// Set server end point (the broadcast addres)
udpServer.sin_family = AF_INET;
udpServer.sin_addr.s_addr = inet_addr(host.address.c_str());
udpServer.sin_port = htons(9);
// Send the packet
ssize_t result = sendto(udpSocket, payload.bytes(), sizeof(unsigned char) * 102, 0, (struct sockaddr*) &udpServer, sizeof(udpServer));
if (result == -1) {
Logger::error("WakeOnLanManager", "Failed to send magic packet to socket: '%s'", strerror(errno));
return GSResult<bool>::failure("Failed to send magic packet to socket: " + std::string(strerror(errno)));
}
return GSResult<bool>::success(true);
}
#elif defined(_WIN32)
GSResult<bool> send_packet_win32(const Host &host, const Data &payload) {
struct sockaddr_in udpClient, udpServer;
int broadcast = 1;
WSADATA data;
SOCKET udpSocket;
// Setup broadcast socket
WSAStartup(MAKEWORD(2, 2), &data);
udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (setsockopt(udpSocket, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast, sizeof(broadcast)) == -1){
return GSResult<bool>::failure("Failed to setup a broadcast socket");
}
// Set parameters
udpClient.sin_family = AF_INET;
udpClient.sin_addr.s_addr = INADDR_ANY;
udpClient.sin_port = htons(0);
// Bind socket
bind(udpSocket, (struct sockaddr*) &udpClient, sizeof(udpClient));
// Set server end point (the broadcast addres)
udpServer.sin_family = AF_INET;
udpServer.sin_addr.s_addr = inet_addr(host.address.c_str());
udpServer.sin_port = htons(9);
// Send the packet
sendto(udpSocket, payload.bytes(), sizeof(unsigned char) * 102, 0, (struct sockaddr*) &udpServer, sizeof(udpServer));
return GSResult<bool>::success(true);
}
#endif
bool WakeOnLanManager::can_wake_up_host(const Host &host) {
#if defined(UNIX_SOCKS) || defined(WIN32_SOCKS)
return true;
#else
return false;
#endif
}
GSResult<bool> WakeOnLanManager::wake_up_host(const Host &host) {
Data payload = create_payload(host);
struct addrinfo hints, *res, *curr;
#if defined(UNIX_SOCKS)
return send_packet_unix(host, payload);
#elif defined(_WIN32)
return send_packet_win32(host, payload);
#endif
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
if (getaddrinfo(host.address.c_str(), NULL, &hints, &res) != 0 || res == NULL) {
// Failed to resolve address
Logger::error("WakeOnLanManager", "Failed to resolve WOL address");
return result;
}
// Try all addresses that this DNS name resolves to. We have
// to create a new socket each time because the addresses
// may be different address families.
for (curr = res; curr != NULL; curr = curr->ai_next) {
int wol_socket = socket(curr->ai_family, SOCK_DGRAM, IPPROTO_UDP);
if (wol_socket < 0) {
Logger::error("WakeOnLanManager", "Failed to create WOL socket");
continue;
}
int val = 1;
setsockopt(wol_socket, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val));
struct sockaddr_storage addr;
memset(&addr, 0, sizeof(addr));
memcpy(&addr, curr->ai_addr, curr->ai_addrlen);
for (int j = 0; j < numPorts; j++) {
populate_address(&addr, ports[j]);
long err = sendto(wol_socket, payload.bytes(), payload.size(), 0, (struct sockaddr*)&addr, curr->ai_addrlen);
result = result || err > 0;
Logger::info("WakeOnLanManager", "Sending WOL packet returned: %ld", err);
}
close(wol_socket);
}
freeaddrinfo(res);
return result;
return GSResult<bool>::failure("Wake up host not supported...");
}

View file

@ -1,11 +1,13 @@
#include "Singleton.hpp"
#include "GameStreamClient.hpp"
#include <stdio.h>
struct Host;
class WakeOnLanManager: public Singleton<WakeOnLanManager> {
private:
bool wake_up_host(const Host &host);
bool can_wake_up_host(const Host &host);
GSResult<bool> wake_up_host(const Host &host);
friend class GameStreamClient;
};

View file

@ -1,121 +0,0 @@
#include <openssl/rand.h>
#include <openssl/evp.h>
#include <mbedtls/gcm.h>
#include <cstdlib>
#include "Data.hpp"
struct MBED_CIPHER_CTX {
mbedtls_gcm_context ctx;
int iv_len;
const unsigned char *iv;
unsigned char* tag;
};
const EVP_CIPHER *EVP_aes_128_gcm(void) {
return NULL;
}
const EVP_CIPHER *EVP_aes_128_cbc(void) {
return NULL;
}
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) {
if (ctx) {
mbedtls_gcm_init(&ctx->ctx);
ctx->iv_len = 0;
ctx->iv = NULL;
ctx->tag = NULL;
}
}
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx) {
if (ctx) {
mbedtls_gcm_free(&ctx->ctx);
if (ctx->tag) {
free(ctx->tag);
ctx->tag = NULL;
}
}
return 1;
}
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) {
EVP_CIPHER_CTX* ctx = (EVP_CIPHER_CTX *)malloc(sizeof(EVP_CIPHER_CTX));
EVP_CIPHER_CTX_init(ctx);
return ctx;
}
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) {
if (ctx && ctx->tag) {
free(ctx->tag);
}
}
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) {
if (ctx && type == EVP_CTRL_GCM_SET_IVLEN) {
ctx->iv_len = arg;
} else if (ctx && type == EVP_CTRL_GCM_GET_TAG) {
unsigned char *tag = (unsigned char*)ptr;
for (int i = 0; i < arg; i++) {
tag[i] = ctx->tag[i];
}
}
return 1;
}
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv) {
if (ctx && key != NULL && iv != NULL) {
mbedtls_gcm_setkey(&ctx->ctx, MBEDTLS_CIPHER_ID_AES, key, ctx->iv_len * 8);
mbedtls_gcm_starts(&ctx->ctx, MBEDTLS_GCM_ENCRYPT, iv, ctx->iv_len, NULL, 0);
ctx->iv = iv;
}
return 1;
}
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) {
if (ctx) {
ctx->tag = (unsigned char*)malloc(ctx->iv_len);
mbedtls_gcm_crypt_and_tag(&ctx->ctx, MBEDTLS_GCM_ENCRYPT, inl, ctx->iv, ctx->iv_len, NULL, 0, in, out, ctx->iv_len, ctx->tag);
*outl = inl;
}
return 1;
}
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) {
return 1;
}
// TODO: This is correct?
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv) {
if (ctx && key != NULL && iv != NULL) {
mbedtls_gcm_setkey(&ctx->ctx, MBEDTLS_CIPHER_ID_AES, key, ctx->iv_len * 8);
mbedtls_gcm_starts(&ctx->ctx, MBEDTLS_GCM_DECRYPT, iv, ctx->iv_len, NULL, 0);
ctx->iv = iv;
}
return 1;
}
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) {
if (ctx) {
ctx->tag = (unsigned char*)malloc(ctx->iv_len);
mbedtls_gcm_crypt_and_tag(&ctx->ctx, MBEDTLS_GCM_DECRYPT, inl, ctx->iv, ctx->iv_len, NULL, 0, in, out, ctx->iv_len, ctx->tag);
*outl = inl;
}
return 1;
}
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl) {
return 1;
}
int RAND_bytes(unsigned char *buf, int num) {
Data rand = Data::random_bytes(num);
for (int i = 0; i < num; i++) {
buf[i] = rand.bytes()[i];
}
return 1;
}

View file

@ -63,7 +63,7 @@ void MainWindow::reload() {
} else {
auto alert = screen()->add<Alert>("Error", "Innactive host...", false);
if (!button->host().mac.empty()) {
if (!button->host().mac.empty() && GameStreamClient::instance().can_wake_up_host(button->host())) {
alert->add_button("Wake Up", [this, button] {
wake_up_host(button->host());
});
@ -78,21 +78,23 @@ void MainWindow::reload() {
});
}
auto find_button = button_container->add<AddHostButton>(AddHostButtonTypeFind);
find_button->set_fixed_size({ 200, 200 });
find_button->set_callback([this] {
auto addresses = GameStreamClient::instance().host_addresses_for_find();
if (addresses.empty()) {
screen()->add<Alert>("Error", "Can't obtain IP address...");
} else {
auto alert = screen()->add<Alert>("Find Host", "Search Host PC in the same network as yours Switch by evalute IP addresses from " + addresses.front() + " to " + addresses.back() + ".\nPlease check your PC and Switch network before tap on a Find.", false);
alert->add_button("Find", [this] {
find_host();
});
alert->add_button("Cancel");
}
});
if (GameStreamClient::instance().can_find_host()) {
auto find_button = button_container->add<AddHostButton>(AddHostButtonTypeFind);
find_button->set_fixed_size({ 200, 200 });
find_button->set_callback([this] {
auto addresses = GameStreamClient::instance().host_addresses_for_find();
if (addresses.empty()) {
screen()->add<Alert>("Error", "Can't obtain IP address...");
} else {
auto alert = screen()->add<Alert>("Find Host", "Search Host PC in the same network as yours Switch by evalute IP addresses from " + addresses.front() + " to " + addresses.back() + ".\nPlease check your PC and Switch network before tap on a Find.", false);
alert->add_button("Find", [this] {
find_host();
});
alert->add_button("Cancel");
}
});
}
auto add_button = button_container->add<AddHostButton>(AddHostButtonTypeAdd);
add_button->set_fixed_size({ 200, 200 });

@ -1 +1 @@
Subproject commit 5782246b30bfc11e659cf53b498886a924aa97d1
Subproject commit 13041e0323685ff1b2ccade347cb1de850286d23