diff --git a/rpcs3/Emu/Cell/lv2/sys_net.cpp b/rpcs3/Emu/Cell/lv2/sys_net.cpp index fd2e42cdbc..0baa5fb861 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net.cpp @@ -2347,8 +2347,27 @@ error_code sys_net_infoctl(ppu_thread& ppu, s32 cmd, vm::ptr arg) { case 9: { - // TODO: Find out if this string can change - constexpr auto name = "nameserver 192.168.1.1\0"sv; + constexpr auto nameserver = "nameserver \0"sv; + constexpr auto default_ip = "192.168.1.1\0"sv; + + char buffer[nameserver.size() + 80]; + std::memcpy(buffer, nameserver.data(), nameserver.size()); + + const auto nph = g_fxo->get>(); + if (nph->get_dns()) + { + struct sockaddr_in serv; + std::memset(&serv, 0, sizeof(serv)); + serv.sin_addr.s_addr = nph->get_dns(); + inet_ntop(AF_INET, &serv.sin_addr, buffer + nameserver.size() - 1, sizeof(buffer) - nameserver.size()); + } + else + { + std::memcpy(buffer + nameserver.size() - 1, default_ip.data(), default_ip.size()); + } + + std::string_view name{buffer}; + vm::static_ptr_cast(arg)->zero = 0; std::memcpy(vm::static_ptr_cast(arg)->server_name.get_ptr(), name.data(), name.size()); break; }