From 820d83b2c07a34b7feb3ca9d2c817bd23546d78d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 5 Aug 2025 23:38:07 +0200 Subject: [PATCH 1/3] sceUriParse: Size queries are not errors --- Core/HLE/sceParseUri.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceParseUri.cpp b/Core/HLE/sceParseUri.cpp index c7b1ca956b..607f2ffc0d 100644 --- a/Core/HLE/sceParseUri.cpp +++ b/Core/HLE/sceParseUri.cpp @@ -246,7 +246,7 @@ static int sceUriBuild(u32 workAreaAddr, u32 workAreaSizeAddr, int workAreaSize, } if (workAreaAddr == 0) { - return hleLogDebug(Log::sceNet, -1, "size query, required size: %d", requiredSize); + return hleLogDebug(Log::sceNet, 0, "size query, required size: %d", requiredSize); } if (requiredSize > workAreaSize) { @@ -305,7 +305,7 @@ static int sceUriEscape(u32 escapedAddr, u32 escapedLengthAddr, int escapedBuffe } if (escapedAddr == 0) { - return hleLogError(Log::sceNet, -1, "size query, required size: %d", requiredSize); + return hleLogDebug(Log::sceNet, 0, "size query, required size: %d", requiredSize); } if (requiredSize > escapedBufferLength) { From 05b82d6ce46a05441eb83ed505def89c5cf5080a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 5 Aug 2025 23:57:28 +0200 Subject: [PATCH 2/3] Allow passing in a custom resolver to HTTPRequest and Connection. This inverts the bad dependency. --- Common/File/PathBrowser.cpp | 2 +- Common/GhidraClient.cpp | 2 +- Common/Net/HTTPClient.cpp | 14 +++++--- Common/Net/HTTPClient.h | 13 ++++++-- Common/Net/HTTPRequest.cpp | 10 +++--- Common/Net/Resolve.cpp | 51 ----------------------------- Common/Net/Resolve.h | 1 - Core/FileLoaders/HTTPFileLoader.cpp | 2 +- Core/HLE/sceHttp.cpp | 7 ++-- Core/HLE/sceHttp.h | 2 +- Core/HLE/sceNet.cpp | 49 +++++++++++++++++++++++++++ Core/HLE/sceNet.h | 1 + Core/HLE/sceNetResolver.cpp | 2 +- Core/HLE/sceNp2.cpp | 3 +- Core/WebServer.cpp | 2 +- UI/RemoteISOScreen.cpp | 2 +- 16 files changed, 87 insertions(+), 76 deletions(-) diff --git a/Common/File/PathBrowser.cpp b/Common/File/PathBrowser.cpp index a7798db570..818e5063e3 100644 --- a/Common/File/PathBrowser.cpp +++ b/Common/File/PathBrowser.cpp @@ -21,7 +21,7 @@ bool LoadRemoteFileList(const Path &url, const std::string &userAgent, bool *cancel, std::vector &files) { _dbg_assert_(url.Type() == PathType::HTTP); - http::Client http; + http::Client http(nullptr); Buffer result; int code = 500; std::vector responseHeaders; diff --git a/Common/GhidraClient.cpp b/Common/GhidraClient.cpp index 2ae0b53be2..815eaf63b7 100644 --- a/Common/GhidraClient.cpp +++ b/Common/GhidraClient.cpp @@ -193,7 +193,7 @@ bool GhidraClient::FetchTypes() { } bool GhidraClient::FetchResource(const std::string &path, std::string &outResult) { - http::Client http; + http::Client http(nullptr); if (!http.Resolve(host_.c_str(), port_)) { pendingResult_.error = "can't resolve host"; return false; diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index de46c3338e..b7b1a09916 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -63,7 +63,11 @@ bool Connection::Resolve(const char *host, int port, DNSType type) { char port_str[16]; snprintf(port_str, sizeof(port_str), "%d", port); - std::string processedHostname = ProcessHostnameWithInfraDNS(std::string(host)); + std::string processedHostname(host); + + if (customResolve_) { + processedHostname = customResolve_(host); + } std::string err; if (!net::DNSResolve(processedHostname.c_str(), port_str, &resolved_, err, type)) { @@ -211,7 +215,7 @@ namespace http { constexpr const char *DEFAULT_USERAGENT = "PPSSPP"; constexpr const char *HTTP_VERSION = "1.1"; -Client::Client() { +Client::Client(net::ResolveFunc func) : Connection(func) { userAgent_ = DEFAULT_USERAGENT; httpVersion_ = HTTP_VERSION; } @@ -488,8 +492,8 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector #include #include +#include #include "Common/File/Path.h" #include "Common/Net/NetBuffer.h" @@ -12,10 +13,14 @@ namespace net { +typedef std::function ResolveFunc; + class Connection { public: virtual ~Connection(); + explicit Connection(ResolveFunc func) : customResolve_(func) {} + // Inits the sockaddr_in. bool Resolve(const char *host, int port, DNSType type = DNSType::ANY); @@ -35,9 +40,10 @@ protected: private: uintptr_t sock_ = -1; + ResolveFunc customResolve_; }; -} // namespace net +} // namespace net namespace http { @@ -55,7 +61,7 @@ public: class Client : public net::Connection { public: - Client(); + Client(net::ResolveFunc func); ~Client(); // Return value is the HTTP return code. 200 means OK. < 0 means some local error. @@ -95,7 +101,7 @@ protected: // Really an asynchronous request. class HTTPRequest : public Request { public: - HTTPRequest(RequestMethod method, std::string_view url, std::string_view postData, std::string_view postMime, const Path &outfile, RequestFlags flags = RequestFlags::ProgressBar | RequestFlags::ProgressBarDelayed, std::string_view name = ""); + HTTPRequest(RequestMethod method, std::string_view url, std::string_view postData, std::string_view postMime, const Path &outfile, RequestFlags flags, net::ResolveFunc customResolve, std::string_view name = ""); ~HTTPRequest(); void Start() override; @@ -115,6 +121,7 @@ private: std::string postMime_; bool completed_ = false; bool failed_ = false; + net::ResolveFunc customResolve_; }; // Fake request for cache hits. diff --git a/Common/Net/HTTPRequest.cpp b/Common/Net/HTTPRequest.cpp index b5b8a5c425..21ddf14516 100644 --- a/Common/Net/HTTPRequest.cpp +++ b/Common/Net/HTTPRequest.cpp @@ -59,7 +59,7 @@ Path RequestManager::UrlToCachePath(const std::string_view url) { return http::UrlToCachePath(cacheDir_, url); } -std::shared_ptr CreateRequest(RequestMethod method, std::string_view url, std::string_view postdata, std::string_view postMime, const Path &outfile, RequestFlags flags, std::string_view name) { +static std::shared_ptr CreateRequest(RequestMethod method, std::string_view url, std::string_view postdata, std::string_view postMime, const Path &outfile, RequestFlags flags, net::ResolveFunc customResolve, std::string_view name) { if (IsHttpsUrl(url) && System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) { #ifndef HTTPS_NOT_AVAILABLE return std::make_shared(method, url, postdata, postMime, outfile, flags, name); @@ -67,7 +67,7 @@ std::shared_ptr CreateRequest(RequestMethod method, std::string_view ur return std::shared_ptr(); #endif } else { - return std::make_shared(method, url, postdata, postMime, outfile, flags, name); + return std::make_shared(method, url, postdata, postMime, outfile, flags, customResolve, name); } } @@ -105,7 +105,7 @@ std::shared_ptr RequestManager::StartDownload(std::string_view url, con } } - std::shared_ptr dl = CreateRequest(RequestMethod::GET, url, "", "", outfile, flags, ""); + std::shared_ptr dl = CreateRequest(RequestMethod::GET, url, "", "", outfile, flags, nullptr, ""); // OK, didn't get it from cache, so let's continue with the download, putting it in the cache. if (enableCache) { @@ -131,7 +131,7 @@ std::shared_ptr RequestManager::StartDownloadWithCallback( std::function callback, std::string_view name, const char *acceptMime) { - std::shared_ptr dl = CreateRequest(RequestMethod::GET, url, "", "", outfile, flags, name); + std::shared_ptr dl = CreateRequest(RequestMethod::GET, url, "", "", outfile, flags, nullptr, name); if (!userAgent_.empty()) dl->SetUserAgent(userAgent_); @@ -150,7 +150,7 @@ std::shared_ptr RequestManager::AsyncPostWithCallback( RequestFlags flags, std::function callback, std::string_view name) { - std::shared_ptr dl = CreateRequest(RequestMethod::POST, url, postData, postMime, Path(), flags, name); + std::shared_ptr dl = CreateRequest(RequestMethod::POST, url, postData, postMime, Path(), flags, nullptr, name); if (!userAgent_.empty()) dl->SetUserAgent(userAgent_); dl->SetCallback(callback); diff --git a/Common/Net/Resolve.cpp b/Common/Net/Resolve.cpp index 75f7b9afc0..241c607c57 100644 --- a/Common/Net/Resolve.cpp +++ b/Common/Net/Resolve.cpp @@ -1,5 +1,3 @@ -#include "Core/Config.h" -#include "Core/HLE/sceNet.h" #include "ppsspp_config.h" #include "Common/Net/Resolve.h" @@ -504,53 +502,4 @@ bool DirectDNSLookupIPV4(const char *dns_server_ip, const char *domain, uint32_t return true; } -std::string ProcessHostnameWithInfraDNS(const std::string& hostname) { - std::string resolvedHostname = hostname; - - // Resolve any aliases. First check the ini file, then check the hardcoded DNS config. - auto aliasIter = g_Config.mHostToAlias.find(hostname); - if (aliasIter != g_Config.mHostToAlias.end()) { - const std::string& alias = aliasIter->second; - INFO_LOG(Log::sceNet, "%s - Resolved alias %s from hostname %s", __FUNCTION__, alias.c_str(), hostname.c_str()); - resolvedHostname = alias; - } - - if (g_Config.bInfrastructureAutoDNS) { - // Also look up into the preconfigured fixed DNS JSON. - auto fixedDNSIter = GetInfraDNSConfig().fixedDNS.find(resolvedHostname); - if (fixedDNSIter != GetInfraDNSConfig().fixedDNS.end()) { - const std::string& domainIP = fixedDNSIter->second; - INFO_LOG(Log::sceNet, "%s - Resolved IP %s from fixed DNS lookup with '%s'", __FUNCTION__, domainIP.c_str(), resolvedHostname.c_str()); - resolvedHostname = domainIP; - } - } - - // Check if hostname is already an IPv4 address, if so we do not need further lookup. This usually happens - // after the mHostToAlias or fixedDNSIter lookups, which effectively both are hardcoded DNS. - uint32_t resolvedAddr; - if (inet_pton(AF_INET, resolvedHostname.c_str(), &resolvedAddr)) { - INFO_LOG(Log::sceNet, "Not looking up '%s', already an IP address.", resolvedHostname.c_str()); - return resolvedHostname; - } - - // Now use the configured primary DNS server to do a lookup. - // If auto DNS, use the server from that config. - std::string dnsServer; - if (g_Config.bInfrastructureAutoDNS && !GetInfraDNSConfig().dns.empty()) { - dnsServer = GetInfraDNSConfig().dns; - } else { - dnsServer = g_Config.sInfrastructureDNSServer; - } - - if (net::DirectDNSLookupIPV4(dnsServer.c_str(), resolvedHostname.c_str(), &resolvedAddr)) { - char temp[32]; - inet_ntop(AF_INET, &resolvedAddr, temp, sizeof(temp)); - INFO_LOG(Log::sceNet, "Direct lookup of '%s' from '%s' succeeded: %s", resolvedHostname.c_str(), dnsServer.c_str(), temp); - return std::string(temp); - } - - WARN_LOG(Log::sceNet, "Direct DNS lookup of '%s' at DNS server '%s' failed. Will try OS DNS...", resolvedHostname.c_str(), dnsServer.c_str()); - return resolvedHostname; -} - } // namespace net diff --git a/Common/Net/Resolve.h b/Common/Net/Resolve.h index bc978bcb9e..5c7958d654 100644 --- a/Common/Net/Resolve.h +++ b/Common/Net/Resolve.h @@ -26,6 +26,5 @@ int inet_pton(int af, const char* src, void* dst); // Does a DNS lookup without involving the OS, so you can hit any DNS server. bool DirectDNSLookupIPV4(const char *dnsServer, const char *host, uint32_t *ipv4_addr); -std::string ProcessHostnameWithInfraDNS(const std::string& hostname); } // namespace net diff --git a/Core/FileLoaders/HTTPFileLoader.cpp b/Core/FileLoaders/HTTPFileLoader.cpp index 2d9d966cdc..6e4489bb8c 100644 --- a/Core/FileLoaders/HTTPFileLoader.cpp +++ b/Core/FileLoaders/HTTPFileLoader.cpp @@ -23,7 +23,7 @@ #include "Core/FileLoaders/HTTPFileLoader.h" HTTPFileLoader::HTTPFileLoader(const ::Path &filename) - : url_(filename.ToString()), progress_(&cancel_), filename_(filename) { + : url_(filename.ToString()), progress_(&cancel_), filename_(filename), client_(nullptr) { // no custom resolver support } void HTTPFileLoader::Prepare() { diff --git a/Core/HLE/sceHttp.cpp b/Core/HLE/sceHttp.cpp index 74d548b5db..5c4897d5ff 100644 --- a/Core/HLE/sceHttp.cpp +++ b/Core/HLE/sceHttp.cpp @@ -27,6 +27,7 @@ #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernelMemory.h" #include "Core/HLE/sceHttp.h" +#include "Core/HLE/sceNet.h" #include "Core/Debugger/MemBlockInfo.h" #include "Common/StringUtils.h" #include "Common/LogReporting.h" @@ -80,7 +81,7 @@ HTTPConnection::HTTPConnection(int templateID, const char* hostString, const cha this->enableKeepalive = enableKeepalive; } -HTTPRequest::HTTPRequest(int connectionID, int method, const char* url, u64 contentLength) { +HTTPRequest::HTTPRequest(int connectionID, int method, const char *url, u64 contentLength, net::ResolveFunc customResolver) : client(customResolver) { // Copy base data as initial base value for this // Since dynamic_cast/dynamic_pointer_cast/typeid requires RTTI to be enabled (ie. /GR instead of /GR- on msvc, enabled by default on most compilers), so we can only use static_cast here HTTPConnection::operator=(static_cast(*httpObjects[connectionID - 1LL])); @@ -558,7 +559,7 @@ static int sceHttpCreateRequest(int connectionID, int method, const char *path, if (method < PSPHttpMethod::PSP_HTTP_METHOD_GET || method > PSPHttpMethod::PSP_HTTP_METHOD_HEAD) return hleLogError(Log::sceNet, SCE_HTTP_ERROR_UNKNOWN_METHOD, "unknown method"); - httpObjects.emplace_back(std::make_shared(connectionID, method, path? path:"", contentLength)); + httpObjects.emplace_back(std::make_shared(connectionID, method, path ? path : "", contentLength, &ProcessHostnameWithInfraDNS)); int retid = (int)httpObjects.size(); return hleLogDebug(Log::sceNet, retid); } @@ -729,7 +730,7 @@ static int sceHttpCreateRequestWithURL(int connectionID, int method, const char if (!baseURL.Valid()) return hleLogError(Log::sceNet, SCE_HTTP_ERROR_INVALID_URL, "invalid url"); - httpObjects.emplace_back(std::make_shared(connectionID, method, url ? url : "", contentLength)); + httpObjects.emplace_back(std::make_shared(connectionID, method, url ? url : "", contentLength, &ProcessHostnameWithInfraDNS)); int retid = (int)httpObjects.size(); return hleLogDebug(Log::sceNet, retid); } diff --git a/Core/HLE/sceHttp.h b/Core/HLE/sceHttp.h index 47101159c8..8c532bc2cc 100644 --- a/Core/HLE/sceHttp.h +++ b/Core/HLE/sceHttp.h @@ -268,7 +268,7 @@ private: std::string responseContent_; public: - HTTPRequest(int connectionID, int method, const char* url, u64 contentLength); + HTTPRequest(int connectionID, int method, const char* url, u64 contentLength, net::ResolveFunc customResolver); ~HTTPRequest(); virtual const char* className() override { return name_HTTPRequest; } diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 4f0e5b73f7..892bb576f1 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -464,6 +464,55 @@ bool PollInfraJsonDownload(std::string *jsonOutput) { return true; } +std::string ProcessHostnameWithInfraDNS(const std::string &hostname) { + std::string resolvedHostname = hostname; + + // Resolve any aliases. First check the ini file, then check the hardcoded DNS config. + auto aliasIter = g_Config.mHostToAlias.find(hostname); + if (aliasIter != g_Config.mHostToAlias.end()) { + const std::string& alias = aliasIter->second; + INFO_LOG(Log::sceNet, "%s - Resolved alias %s from hostname %s", __FUNCTION__, alias.c_str(), hostname.c_str()); + resolvedHostname = alias; + } + + if (g_Config.bInfrastructureAutoDNS) { + // Also look up into the preconfigured fixed DNS JSON. + auto fixedDNSIter = GetInfraDNSConfig().fixedDNS.find(resolvedHostname); + if (fixedDNSIter != GetInfraDNSConfig().fixedDNS.end()) { + const std::string& domainIP = fixedDNSIter->second; + INFO_LOG(Log::sceNet, "%s - Resolved IP %s from fixed DNS lookup with '%s'", __FUNCTION__, domainIP.c_str(), resolvedHostname.c_str()); + resolvedHostname = domainIP; + } + } + + // Check if hostname is already an IPv4 address, if so we do not need further lookup. This usually happens + // after the mHostToAlias or fixedDNSIter lookups, which effectively both are hardcoded DNS. + uint32_t resolvedAddr; + if (inet_pton(AF_INET, resolvedHostname.c_str(), &resolvedAddr)) { + INFO_LOG(Log::sceNet, "Not looking up '%s', already an IP address.", resolvedHostname.c_str()); + return resolvedHostname; + } + + // Now use the configured primary DNS server to do a lookup. + // If auto DNS, use the server from that config. + std::string dnsServer; + if (g_Config.bInfrastructureAutoDNS && !GetInfraDNSConfig().dns.empty()) { + dnsServer = GetInfraDNSConfig().dns; + } else { + dnsServer = g_Config.sInfrastructureDNSServer; + } + + if (net::DirectDNSLookupIPV4(dnsServer.c_str(), resolvedHostname.c_str(), &resolvedAddr)) { + char temp[32]; + inet_ntop(AF_INET, &resolvedAddr, temp, sizeof(temp)); + INFO_LOG(Log::sceNet, "Direct lookup of '%s' from '%s' succeeded: %s", resolvedHostname.c_str(), dnsServer.c_str(), temp); + return std::string(temp); + } + + WARN_LOG(Log::sceNet, "Direct DNS lookup of '%s' at DNS server '%s' failed. Will try OS DNS...", resolvedHostname.c_str(), dnsServer.c_str()); + return resolvedHostname; +} + void InitLocalhostIP() { // The entire 127.*.*.* is reserved for loopback. uint32_t localIP = 0x7F000001 + PPSSPP_ID - 1; diff --git a/Core/HLE/sceNet.h b/Core/HLE/sceNet.h index e53782f609..818a6915db 100644 --- a/Core/HLE/sceNet.h +++ b/Core/HLE/sceNet.h @@ -127,6 +127,7 @@ void StartInfraJsonDownload(); bool PollInfraJsonDownload(std::string *jsonOutput); bool LoadAutoDNS(std::string_view json); void DeleteAutoDNSCacheFile(); +std::string ProcessHostnameWithInfraDNS(const std::string &hostname); // These return false if allowed to be consistent with the similar function for achievements. bool NetworkWarnUserIfOnlineAndCantSavestate(); diff --git a/Core/HLE/sceNetResolver.cpp b/Core/HLE/sceNetResolver.cpp index e0f4a27b43..b4547b9289 100644 --- a/Core/HLE/sceNetResolver.cpp +++ b/Core/HLE/sceNetResolver.cpp @@ -89,7 +89,7 @@ static int NetResolver_StartNtoA(NetResolver *resolver, u32 hostnamePtr, u32 inA std::string hostname = std::string(safe_string(Memory::GetCharPointer(hostnamePtr))); // Process hostname with infra-DNS - std::string processedHostname = net::ProcessHostnameWithInfraDNS(hostname); + std::string processedHostname = ProcessHostnameWithInfraDNS(hostname); // Flag resolver as in-progress - not relevant for sync functions but potentially relevant for async resolver->isRunning = true; diff --git a/Core/HLE/sceNp2.cpp b/Core/HLE/sceNp2.cpp index 977e006621..eca61133e7 100644 --- a/Core/HLE/sceNp2.cpp +++ b/Core/HLE/sceNp2.cpp @@ -22,6 +22,7 @@ #include "Core/CoreTiming.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" +#include "Core/HLE/sceNet.h" #include "Core/HLE/sceNp.h" #include "Core/HLE/sceNp2.h" @@ -157,7 +158,7 @@ static int sceNpMatching2ContextStart(int ctxId) // TODO: use sceNpGetUserProfile and check server availability using sceNpService_76867C01 //npMatching2Ctx.started = true; Url url("http://static-resource.np.community.playstation.net/np/resource/psp-title/" + std::string(npTitleId.data) + "_00/matching/" + std::string(npTitleId.data) + "_00-matching.xml"); - http::Client client; + http::Client client(&ProcessHostnameWithInfraDNS); bool cancelled = false; net::RequestProgress progress(&cancelled); if (!client.Resolve(url.Host().c_str(), url.Port())) { diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index 1a36a45b91..1b6fe10c65 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -76,7 +76,7 @@ static ServerStatus RetrieveStatus() { // relay that address to a mobile device searching for the server. static bool RegisterServer(int port) { bool success = false; - http::Client http; + http::Client http(nullptr); bool cancelled = false; net::RequestProgress progress(&cancelled); Buffer theVoid = Buffer::Void(); diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index d8af81c40d..79d202e60a 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -106,7 +106,7 @@ std::string RemoteSubdir() { } bool RemoteISOConnectScreen::FindServer(std::string &resultHost, int &resultPort) { - http::Client http; + http::Client http(nullptr); Buffer result; int code = 500; bool hadTimeouts = false; From 5e05a6d0ac12a9e0a8e95b8bf9de18414fecbb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 6 Aug 2025 00:04:39 +0200 Subject: [PATCH 3/3] Get rid of some more backward Common/Core dependencies --- Common/GPU/Vulkan/VulkanContext.cpp | 3 +-- Common/GPU/Vulkan/VulkanContext.h | 1 + Common/Net/Resolve.cpp | 2 +- Common/UI/Screen.cpp | 3 +-- Common/VR/PPSSPPVR.cpp | 3 +-- SDL/SDLVulkanGraphicsContext.cpp | 1 + android/jni/AndroidVulkanContext.cpp | 1 + 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Common/GPU/Vulkan/VulkanContext.cpp b/Common/GPU/Vulkan/VulkanContext.cpp index c121d58cfe..adeda01667 100644 --- a/Common/GPU/Vulkan/VulkanContext.cpp +++ b/Common/GPU/Vulkan/VulkanContext.cpp @@ -5,7 +5,6 @@ #include #include -#include "Core/Config.h" #include "Common/System/System.h" #include "Common/System/Display.h" #include "Common/Log.h" @@ -171,7 +170,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { #endif #endif - if ((flags_ & VulkanInitFlags::VALIDATE) && g_Config.sCustomDriver.empty()) { + if ((flags_ & VulkanInitFlags::VALIDATE) && info.customDriver.empty()) { if (IsInstanceExtensionAvailable(VK_EXT_DEBUG_UTILS_EXTENSION_NAME)) { // Enable the validation layers for (size_t i = 0; i < ARRAY_SIZE(validationLayers); i++) { diff --git a/Common/GPU/Vulkan/VulkanContext.h b/Common/GPU/Vulkan/VulkanContext.h index dfe130c922..2e4e160ec7 100644 --- a/Common/GPU/Vulkan/VulkanContext.h +++ b/Common/GPU/Vulkan/VulkanContext.h @@ -184,6 +184,7 @@ public: const char *app_name; int app_ver; VulkanInitFlags flags; + std::string customDriver; }; VkResult CreateInstance(const CreateInfo &info); diff --git a/Common/Net/Resolve.cpp b/Common/Net/Resolve.cpp index 241c607c57..eb3727136d 100644 --- a/Common/Net/Resolve.cpp +++ b/Common/Net/Resolve.cpp @@ -1,5 +1,4 @@ #include "ppsspp_config.h" -#include "Common/Net/Resolve.h" #include #include @@ -13,6 +12,7 @@ #include "Common/StringUtils.h" #include "Common/Data/Encoding/Utf8.h" #include "Common/Net/SocketCompat.h" +#include "Common/Net/Resolve.h" #ifndef HTTPS_NOT_AVAILABLE #include "ext/naett/naett.h" diff --git a/Common/UI/Screen.cpp b/Common/UI/Screen.cpp index 6cb652c2a2..c06332a5db 100644 --- a/Common/UI/Screen.cpp +++ b/Common/UI/Screen.cpp @@ -7,12 +7,11 @@ #include "Common/UI/UI.h" #include "Common/UI/View.h" #include "Common/UI/ViewGroup.h" +#include "Common/Data/Collections/TinySet.h" #include "Common/Log.h" #include "Common/TimeUtil.h" -#include "Core/KeyMap.h" - void Screen::focusChanged(ScreenFocusChange focusChange) { const char *eventName = ""; switch (focusChange) { diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index c09ae8c6eb..2fe3259979 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -14,8 +14,7 @@ #include "Common/Math/lin/matrix4x4.h" -#include "Common/Input/InputState.h" -#include "Common/Input/KeyCodes.h" +// The deps below need to be inverted, or we need to move this file (probably better) #include "Core/HLE/sceDisplay.h" #include "Core/HLE/sceCtrl.h" diff --git a/SDL/SDLVulkanGraphicsContext.cpp b/SDL/SDLVulkanGraphicsContext.cpp index f3c70d5361..07feadd2b9 100644 --- a/SDL/SDLVulkanGraphicsContext.cpp +++ b/SDL/SDLVulkanGraphicsContext.cpp @@ -72,6 +72,7 @@ bool SDLVulkanGraphicsContext::Init(SDL_Window *&window, int x, int y, int w, in info.app_name = "PPSSPP"; info.app_ver = gitVer.ToInteger(); info.flags = FlagsFromConfig(); + info.customDriver = g_Config.sCustomDriver; if (VK_SUCCESS != vulkan_->CreateInstance(info)) { *error_message = vulkan_->InitError(); delete vulkan_; diff --git a/android/jni/AndroidVulkanContext.cpp b/android/jni/AndroidVulkanContext.cpp index c9a5f95cd9..56c5b79d3e 100644 --- a/android/jni/AndroidVulkanContext.cpp +++ b/android/jni/AndroidVulkanContext.cpp @@ -71,6 +71,7 @@ bool AndroidVulkanContext::InitAPI() { info.app_name = "PPSSPP"; info.app_ver = gitVer.ToInteger(); info.flags = FlagsFromConfig(); + info.customDriver = g_Config.sCustomDriver; if (!g_Vulkan->CreateInstanceAndDevice(info)) { delete g_Vulkan; g_Vulkan = nullptr;