@@ -165,9 +165,28 @@ namespace iosu
165
165
g_fpd.myPresence .isOnline = 1 ;
166
166
g_fpd.myPresence .gameKey .titleId = CafeSystem::GetForegroundTitleId ();
167
167
g_fpd.myPresence .gameKey .ukn = CafeSystem::GetForegroundTitleVersion ();
168
+
169
+ // Resolve potential domain to IP address
170
+ struct addrinfo hints = {0 }, *addrs;
171
+ hints.ai_family = AF_INET;
172
+
173
+ const int status = getaddrinfo (nexTokenResult.nexToken .host , NULL , &hints, &addrs);
174
+ if (status != 0 ) {
175
+ #if BOOST_OS_WINDOWS
176
+ cemuLog_log (LogType::Force, " IOSU_FPD: Failed to resolve hostname {}, {}" , nexTokenResult.nexToken .host , gai_strerrorA (status));
177
+ #else
178
+ cemuLog_log (LogType::Force, " IOSU_FPD: Failed to resolve hostname {}, {}" , nexTokenResult.nexToken .host , gai_strerror (status));
179
+ #endif
180
+ return ;
181
+ }
182
+
183
+ char addrstr[NI_MAXHOST];
184
+ getnameinfo (addrs->ai_addr , addrs->ai_addrlen , addrstr, sizeof addrstr, NULL , 0 , NI_NUMERICHOST);
185
+ cemuLog_log (LogType::Force, " IOSU_FPD: Resolved IP for hostname {}, {}" , nexTokenResult.nexToken .host , addrstr);
186
+
168
187
// start session
169
- uint32 hostIp;
170
- inet_pton (AF_INET, nexTokenResult. nexToken . host , &hostIp );
188
+ const uint32_t hostIp = (( struct sockaddr_in *)addrs-> ai_addr )-> sin_addr . s_addr ;
189
+ freeaddrinfo (addrs );
171
190
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 );
172
191
g_fpd.nexFriendSession ->setNotificationHandler (notificationHandler);
173
192
cemuLog_log (LogType::Force, " IOSU_FPD: Created friend server session" );
0 commit comments