mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-24 00:31:52 +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.gameKey.titleId = CafeSystem::GetForegroundTitleId();
|
||||
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
|
||||
uint32 hostIp;
|
||||
inet_pton(AF_INET, nexTokenResult.nexToken.host, &hostIp);
|
||||
const uint32_t hostIp = ((struct sockaddr_in*)addrs->ai_addr)->sin_addr.s_addr;
|
||||
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->setNotificationHandler(notificationHandler);
|
||||
cemuLog_log(LogType::Force, "IOSU_FPD: Created friend server session");
|
||||
|
Loading…
Reference in New Issue
Block a user