mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 00:59:18 +01:00
Resolve domains to IPs in Friends NEX (#807)
This commit is contained in:
parent
d56bc807cf
commit
b74ae21953
@ -165,9 +165,28 @@ namespace iosu
|
|||||||
g_fpd.myPresence.isOnline = 1;
|
g_fpd.myPresence.isOnline = 1;
|
||||||
g_fpd.myPresence.gameKey.titleId = CafeSystem::GetForegroundTitleId();
|
g_fpd.myPresence.gameKey.titleId = CafeSystem::GetForegroundTitleId();
|
||||||
g_fpd.myPresence.gameKey.ukn = CafeSystem::GetForegroundTitleVersion();
|
g_fpd.myPresence.gameKey.ukn = CafeSystem::GetForegroundTitleVersion();
|
||||||
|
|
||||||
|
// Resolve potential domain to IP address
|
||||||
|
struct addrinfo hints = {0}, *addrs;
|
||||||
|
hints.ai_family = AF_INET;
|
||||||
|
|
||||||
|
const int status = getaddrinfo(nexTokenResult.nexToken.host, NULL, &hints, &addrs);
|
||||||
|
if (status != 0) {
|
||||||
|
#if BOOST_OS_WINDOWS
|
||||||
|
cemuLog_log(LogType::Force, "IOSU_FPD: Failed to resolve hostname {}, {}", nexTokenResult.nexToken.host, gai_strerrorA(status));
|
||||||
|
#else
|
||||||
|
cemuLog_log(LogType::Force, "IOSU_FPD: Failed to resolve hostname {}, {}", nexTokenResult.nexToken.host, gai_strerror(status));
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char addrstr[NI_MAXHOST];
|
||||||
|
getnameinfo(addrs->ai_addr, addrs->ai_addrlen, addrstr, sizeof addrstr, NULL, 0, NI_NUMERICHOST);
|
||||||
|
cemuLog_log(LogType::Force, "IOSU_FPD: Resolved IP for hostname {}, {}", nexTokenResult.nexToken.host, addrstr);
|
||||||
|
|
||||||
// start session
|
// start session
|
||||||
uint32 hostIp;
|
const uint32_t hostIp = ((struct sockaddr_in*)addrs->ai_addr)->sin_addr.s_addr;
|
||||||
inet_pton(AF_INET, nexTokenResult.nexToken.host, &hostIp);
|
freeaddrinfo(addrs);
|
||||||
g_fpd.nexFriendSession = new NexFriends(hostIp, nexTokenResult.nexToken.port, "ridfebb9", myPid, nexTokenResult.nexToken.nexPassword, nexTokenResult.nexToken.token, accountId, (uint8*)&miiData, (wchar_t*)screenName, (uint8)countryCode, g_fpd.myPresence);
|
g_fpd.nexFriendSession = new NexFriends(hostIp, nexTokenResult.nexToken.port, "ridfebb9", myPid, nexTokenResult.nexToken.nexPassword, nexTokenResult.nexToken.token, accountId, (uint8*)&miiData, (wchar_t*)screenName, (uint8)countryCode, g_fpd.myPresence);
|
||||||
g_fpd.nexFriendSession->setNotificationHandler(notificationHandler);
|
g_fpd.nexFriendSession->setNotificationHandler(notificationHandler);
|
||||||
cemuLog_log(LogType::Force, "IOSU_FPD: Created friend server session");
|
cemuLog_log(LogType::Force, "IOSU_FPD: Created friend server session");
|
||||||
|
Loading…
Reference in New Issue
Block a user