From 7c1f052b87f3afcc9531ae7d6c359121c60b0ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 13 Jun 2026 17:08:24 +0200 Subject: [PATCH 1/5] ImGe debugger fix --- GPU/Common/TextureCacheCommon.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 5be04b85aa..eca87f0efd 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -2234,7 +2234,9 @@ void TextureCacheCommon::ApplyTexture(bool doBind, bool flatZ) { if (entry->status & TexStatus::CLUT_GPU) { _dbg_assert_(entry->status & TexStatus::CLUT8_INDEXED); // Special process. - ApplyTextureDepalFramebufferCLUT(entry); + if (doBind) { + ApplyTextureDepalFramebufferCLUT(entry); + } gstate_c.SetTextureSolidAlpha(false); gstate_c.SetTextureIs3D(false); gstate_c.SetTextureIsArray(false); From 00126e4c6fe4d814a994c941cc1189b77981d413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 13 Jun 2026 17:12:16 +0200 Subject: [PATCH 2/5] Correct some logging categories --- Common/Net/HTTPClient.cpp | 14 +++++++------- Common/Net/HTTPHeaders.cpp | 10 +++++----- Common/Net/HTTPNaettRequest.cpp | 18 +++++++++--------- Common/Net/Sinks.cpp | 2 +- Common/Net/URL.cpp | 2 +- Core/HLE/sceNet.cpp | 2 +- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index b57dabd775..fa9bc4b116 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -54,11 +54,11 @@ std::string Connection::GetLocalIpAsString() const { bool Connection::Resolve(const char *host, int port, DNSType type) { if ((intptr_t)sock_ != -1) { - ERROR_LOG(Log::IO, "Resolve: Already have a socket"); + ERROR_LOG(Log::Net, "Resolve: Already have a socket"); return false; } if (!host || port < 1 || port > 65535) { - ERROR_LOG(Log::IO, "Resolve: Invalid host or port (%d)", port); + ERROR_LOG(Log::Net, "Resolve: Invalid host or port (%d)", port); return false; } @@ -76,7 +76,7 @@ bool Connection::Resolve(const char *host, int port, DNSType type) { std::string err; if (!net::DNSResolve(processedHostname.c_str(), port_str, &resolved_, err, type)) { - WARN_LOG(Log::IO, "Failed to resolve host '%s': '%s' (%s)", host, err.c_str(), DNSTypeAsString(type)); + WARN_LOG(Log::Net, "Failed to resolve host '%s': '%s' (%s)", host, err.c_str(), DNSTypeAsString(type)); // Zero port so that future calls fail. port_ = 0; return false; @@ -99,7 +99,7 @@ static void FormatAddr(char *addrbuf, size_t bufsize, const addrinfo *info) { bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { if (port_ <= 0) { - ERROR_LOG(Log::IO, "Bad port"); + ERROR_LOG(Log::Net, "Bad port"); return false; } sock_ = -1; @@ -115,13 +115,13 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { int sock = socket(possible->ai_family, SOCK_STREAM, IPPROTO_TCP); if ((intptr_t)sock == -1) { - ERROR_LOG(Log::IO, "Bad socket"); + ERROR_LOG(Log::Net, "Bad socket"); continue; } // Windows sockets aren't limited by socket number, just by count, so checking FD_SETSIZE there is wrong. #if !PPSSPP_PLATFORM(WINDOWS) if (sock >= FD_SETSIZE) { - ERROR_LOG(Log::IO, "Socket doesn't fit in FD_SET: %d We probably have a leak.", sock); + ERROR_LOG(Log::Net, "Socket doesn't fit in FD_SET: %d We probably have a leak.", sock); closesocket(sock); continue; } @@ -194,7 +194,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { } if (cancelConnect && *cancelConnect) { - WARN_LOG(Log::HTTP, "connect: cancelled (2): %s:%d", host_.c_str(), port_); + WARN_LOG(Log::Net, "connect: cancelled (2): %s:%d", host_.c_str(), port_); break; } diff --git a/Common/Net/HTTPHeaders.cpp b/Common/Net/HTTPHeaders.cpp index 98792f1136..b2955b266b 100644 --- a/Common/Net/HTTPHeaders.cpp +++ b/Common/Net/HTTPHeaders.cpp @@ -31,7 +31,7 @@ bool RequestHeader::GetParamValue(const char *param_name, std::string *value) co for (size_t i = 0; i < v.size(); i++) { std::vector parts; SplitString(v[i], '=', parts); - DEBUG_LOG(Log::IO, "Param: %.*s Value: %.*s", (int)parts[0].size(), parts[0].data(), (int)parts[1].size(), parts[1].data()); + DEBUG_LOG(Log::HTTP, "Param: %.*s Value: %.*s", (int)parts[0].size(), parts[0].data(), (int)parts[1].size(), parts[1].data()); if (parts[0] == param_name) { *value = parts[1]; return true; @@ -119,13 +119,13 @@ int RequestHeader::ParseHttpHeader(const char *buffer) { if (!strncasecmp(key, "User-Agent", key_len)) { user_agent = new char[value_len + 1]; memcpy(user_agent, buffer, value_len + 1); - VERBOSE_LOG(Log::IO, "user-agent: %s", user_agent); + VERBOSE_LOG(Log::HTTP, "user-agent: %s", user_agent); } else if (!strncasecmp(key, "Referer", key_len)) { referer = new char[value_len + 1]; memcpy(referer, buffer, value_len + 1); } else if (!strncasecmp(key, "Content-Length", key_len)) { content_length = atoi(buffer); - VERBOSE_LOG(Log::IO, "Content-Length: %i", (int)content_length); + VERBOSE_LOG(Log::HTTP, "Content-Length: %i", (int)content_length); } else { std::string key_str(key, key_len); std::transform(key_str.begin(), key_str.end(), key_str.begin(), tolower); @@ -148,12 +148,12 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) { line_count++; if (type == SIMPLE) { // Done! - VERBOSE_LOG(Log::IO, "Simple: Done parsing http request."); + VERBOSE_LOG(Log::HTTP, "Simple: Done parsing http request."); break; } } - VERBOSE_LOG(Log::IO, "finished parsing request."); + VERBOSE_LOG(Log::HTTP, "finished parsing request."); ok = line_count > 1 && resource != nullptr; } diff --git a/Common/Net/HTTPNaettRequest.cpp b/Common/Net/HTTPNaettRequest.cpp index 174ce582b7..da7189e195 100644 --- a/Common/Net/HTTPNaettRequest.cpp +++ b/Common/Net/HTTPNaettRequest.cpp @@ -61,7 +61,7 @@ void HTTPSRequest::Join() { res_ = nullptr; req_ = nullptr; } else { - ERROR_LOG(Log::IO, "HTTPSDownload::Join not implemented"); + ERROR_LOG(Log::HTTP, "HTTPSDownload::Join not implemented"); } } @@ -88,22 +88,22 @@ bool HTTPSRequest::Done() { // It's a naett error. Translate and handle. switch (resultCode_) { case naettConnectionError: // -1 - ERROR_LOG(Log::IO, "Connection error"); + ERROR_LOG(Log::HTTP, "Connection error"); break; case naettProtocolError: // -2 - ERROR_LOG(Log::IO, "Protocol error"); + ERROR_LOG(Log::HTTP, "Protocol error"); break; case naettReadError: // -3 - ERROR_LOG(Log::IO, "Read error"); + ERROR_LOG(Log::HTTP, "Read error"); break; case naettWriteError: // -4 - ERROR_LOG(Log::IO, "Write error"); + ERROR_LOG(Log::HTTP, "Write error"); break; case naettGenericError: // -5 - ERROR_LOG(Log::IO, "Generic error"); + ERROR_LOG(Log::HTTP, "Generic error"); break; default: - ERROR_LOG(Log::IO, "Unhandled naett error %d", resultCode_); + ERROR_LOG(Log::HTTP, "Unhandled naett error %d", resultCode_); break; } failed_ = true; @@ -111,11 +111,11 @@ bool HTTPSRequest::Done() { } else if (resultCode_ == 200) { bool clear = !(flags_ & RequestFlags::KeepInMemory); if (!outfile_.empty() && !buffer_.FlushToFile(outfile_, clear)) { - ERROR_LOG(Log::IO, "Failed writing download to '%s'", outfile_.c_str()); + ERROR_LOG(Log::HTTP, "Failed writing download to '%s'", outfile_.c_str()); } progress_.Update(bodyLength, bodyLength, true); } else { - WARN_LOG(Log::IO, "Naett request failed: %d", resultCode_); + WARN_LOG(Log::HTTP, "Naett request failed: %d", resultCode_); failed_ = true; progress_.Update(0, 0, true); } diff --git a/Common/Net/Sinks.cpp b/Common/Net/Sinks.cpp index f5919c89a2..79129a2e99 100644 --- a/Common/Net/Sinks.cpp +++ b/Common/Net/Sinks.cpp @@ -209,7 +209,7 @@ void InputSink::AccountFill(int bytes) { int err = socket_errno; if (err == EWOULDBLOCK || err == EAGAIN) return; - ERROR_LOG(Log::IO, "Error reading from socket: %d", err); + ERROR_LOG(Log::Net, "Error reading from socket: %d", err); return; } diff --git a/Common/Net/URL.cpp b/Common/Net/URL.cpp index bef6efc2be..139f1f5f44 100644 --- a/Common/Net/URL.cpp +++ b/Common/Net/URL.cpp @@ -34,7 +34,7 @@ void UrlEncoder::AppendEscaped(const std::string &value) void Url::Split() { size_t colonSlashSlash = url_.find("://"); if (colonSlashSlash == std::string::npos) { - ERROR_LOG(Log::IO, "Invalid URL: %s", url_.c_str()); + ERROR_LOG(Log::Net, "Invalid URL: %s", url_.c_str()); return; } diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index ed17563880..cfeb4ddad5 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -212,7 +212,7 @@ bool LoadDNSForGameID(std::string_view gameID, std::string_view jsonStr, InfraDN json::JsonReader reader(jsonStr.data(), jsonStr.length()); if (!reader.ok() || !reader.root()) { - ERROR_LOG(Log::IO, "Error parsing DNS JSON"); + ERROR_LOG(Log::sceNet, "Error parsing DNS JSON"); return false; } From 2604e169e1c747aecf44b0707e4500fed146fd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 13 Jun 2026 17:18:35 +0200 Subject: [PATCH 3/5] Make progress optional in some function to avoid flouting convention --- Common/Net/HTTPClient.cpp | 29 +++++++++++++++++++---------- Common/Net/HTTPClient.h | 6 +++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index fa9bc4b116..2596b7dd3c 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -348,7 +348,9 @@ int Client::SendRequest(const char *method, const RequestParams &req, const char } int Client::SendRequestWithData(const char *method, const RequestParams &req, std::string_view data, const char *otherHeaders, net::RequestProgress *progress) { - progress->Update(0, 0, false); + if (progress) { + progress->Update(0, 0, false); + } net::Buffer buffer; const char *tpl = @@ -367,7 +369,7 @@ int Client::SendRequestWithData(const char *method, const RequestParams &req, st req.acceptMime, otherHeaders ? otherHeaders : ""); buffer.Append(data); - bool flushed = buffer.FlushSocket(sock(), dataTimeout_, progress->cancelled); + bool flushed = buffer.FlushSocket(sock(), headerTimeout_, progress ? progress->cancelled : nullptr); if (!flushed) { return -1; // TODO error code. } @@ -378,9 +380,9 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector & // Snarf all the data we can into RAM. A little unsafe but hey. static constexpr float CANCEL_INTERVAL = 0.25f; bool ready = false; - double endTimeout = time_now_d() + dataTimeout_; + double endTimeout = time_now_d() + headerTimeout_; while (!ready) { - if (progress->cancelled && *progress->cancelled) + if (progress && progress->cancelled && *progress->cancelled) return -1; ready = fd_util::WaitUntilReady(sock(), CANCEL_INTERVAL, false); if (!ready && time_now_d() > endTimeout) { @@ -417,15 +419,16 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector & return -1; } - if (statusLine) - *statusLine = line; + if (statusLine) { + *statusLine = std::move(line); + } while (true) { int sz = readbuf->TakeLineCRLF(&line); if (!sz || sz < 0) break; VERBOSE_LOG(Log::HTTP, "Header line: %s", line.c_str()); - responseHeaders.push_back(line); + responseHeaders.emplace_back(line); } if (responseHeaders.size() == 0) { @@ -479,7 +482,9 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vectorUpdate(0, 0, true); + if (progress) { + progress->Update(0, 0, true); + } return -1; } } else { @@ -493,14 +498,18 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vectorUpdate(0, 0, true); + if (progress) { + progress->Update(0, 0, true); + } return -1; } output->Append(decompressed); } } - progress->Update(contentLength, contentLength, true); + if (progress) { + progress->Update(contentLength, contentLength, true); + } return 0; } diff --git a/Common/Net/HTTPClient.h b/Common/Net/HTTPClient.h index 607715086e..fed7ab307c 100644 --- a/Common/Net/HTTPClient.h +++ b/Common/Net/HTTPClient.h @@ -27,7 +27,7 @@ public: bool Connect(int maxTries = 2, double timeout = 20.0f, bool *cancelConnect = nullptr); void Disconnect(); - // Only to be used for bring-up and debugging. + // TODO: Try to expose this less. uintptr_t sock() const { return sock_; } std::string GetLocalIpAsString() const; @@ -83,7 +83,7 @@ public: int ReadResponseEntity(net::Buffer *readbuf, const std::vector &responseHeaders, Buffer *output, net::RequestProgress *progress); void SetDataTimeout(double t) { - dataTimeout_ = t; + headerTimeout_ = t; } void SetUserAgent(std::string_view value) { @@ -97,7 +97,7 @@ public: protected: std::string userAgent_; const char* httpVersion_; - double dataTimeout_ = 900.0; + double headerTimeout_ = 900.0; }; // Really an asynchronous request. From 96ae36b7ddfe2a059eef0c28b98ff0cf896846cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 13 Jun 2026 17:44:26 +0200 Subject: [PATCH 4/5] Fix some comments, remove redundant fields etc --- Common/Net/HTTPClient.cpp | 9 ++++----- Common/Net/HTTPClient.h | 4 +++- Common/Net/HTTPNaettRequest.cpp | 5 ++--- Common/Net/HTTPNaettRequest.h | 1 - Common/Net/HTTPRequest.cpp | 4 ++-- Common/Net/HTTPRequest.h | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index 2596b7dd3c..bbc8e09c75 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -229,8 +229,6 @@ Client::~Client() { Disconnect(); } -// Ignores line folding (deprecated), but respects field combining. -// Don't use for Set-Cookie, which is a special header per RFC 7230. bool GetHeaderValue(const std::vector &responseHeaders, std::string_view header, std::string *value) { std::string search(header); search.push_back(':'); @@ -317,7 +315,7 @@ int Client::POST(const RequestParams &req, std::string_view data, std::string_vi if (mime.empty()) { snprintf(otherHeaders, sizeof(otherHeaders), "Content-Length: %lld\r\n", (long long)data.size()); } else { - snprintf(otherHeaders, sizeof(otherHeaders), "Content-Length: %lld\r\nContent-Type: %.*s\r\n", (long long)data.size(), (int)mime.size(), mime.data()); + snprintf(otherHeaders, sizeof(otherHeaders), "Content-Length: %lld\r\nContent-Type: %.*s\r\n", (long long)data.size(), STR_VIEW(mime)); } int err = SendRequestWithData("POST", req, data, otherHeaders, progress); @@ -514,8 +512,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector &responseHeaders, std::string_view header, std::string *value); class RequestParams { @@ -132,7 +134,7 @@ private: class CachedRequest : public Request { public: CachedRequest(RequestMethod method, std::string_view url, std::string_view name, bool *cancelled, RequestFlags flags, std::string_view responseData) - : Request(method, url, name, cancelled, flags) + : Request(method, url, name, Path(), cancelled, flags) { buffer_.Append(responseData); } diff --git a/Common/Net/HTTPNaettRequest.cpp b/Common/Net/HTTPNaettRequest.cpp index da7189e195..516a944045 100644 --- a/Common/Net/HTTPNaettRequest.cpp +++ b/Common/Net/HTTPNaettRequest.cpp @@ -13,8 +13,7 @@ namespace http { HTTPSRequest::HTTPSRequest(RequestMethod method, std::string_view url, std::string_view postData, std::string_view postMime, const Path &outfile, RequestFlags flags, std::string_view name) - : Request(method, url, name, &cancelled_, flags), method_(method), postData_(postData), postMime_(postMime) { - outfile_ = outfile; + : Request(method, url, name, outfile, &cancelled_, flags), postData_(postData), postMime_(postMime) { } HTTPSRequest::~HTTPSRequest() { @@ -61,7 +60,7 @@ void HTTPSRequest::Join() { res_ = nullptr; req_ = nullptr; } else { - ERROR_LOG(Log::HTTP, "HTTPSDownload::Join not implemented"); + ERROR_LOG(Log::HTTP, "HTTPSRequest::Join called before completion"); } } diff --git a/Common/Net/HTTPNaettRequest.h b/Common/Net/HTTPNaettRequest.h index 3ff7e5e1b0..71054d8a21 100644 --- a/Common/Net/HTTPNaettRequest.h +++ b/Common/Net/HTTPNaettRequest.h @@ -25,7 +25,6 @@ public: bool Failed() const override { return failed_; } private: - RequestMethod method_; std::string postData_; std::string postMime_; bool completed_ = false; diff --git a/Common/Net/HTTPRequest.cpp b/Common/Net/HTTPRequest.cpp index 1dd8d06027..b41d18c093 100644 --- a/Common/Net/HTTPRequest.cpp +++ b/Common/Net/HTTPRequest.cpp @@ -10,8 +10,8 @@ namespace http { -Request::Request(RequestMethod method, std::string_view url, std::string_view name, bool *cancelled, RequestFlags flags) - : method_(method), url_(url), name_(name), progress_(cancelled), flags_(flags) { +Request::Request(RequestMethod method, std::string_view url, std::string_view name, const Path &outFile, bool *cancelled, RequestFlags flags) + : method_(method), url_(url), name_(name), outfile_(outFile), progress_(cancelled), flags_(flags) { INFO_LOG(Log::HTTP, "HTTP %s request: %.*s (%.*s)", RequestMethodToString(method), (int)url.size(), url.data(), (int)name.size(), name.data()); progress_.callback = [this](int64_t bytes, int64_t contentLength, bool done) { diff --git a/Common/Net/HTTPRequest.h b/Common/Net/HTTPRequest.h index 0c2e80568f..29991b49ac 100644 --- a/Common/Net/HTTPRequest.h +++ b/Common/Net/HTTPRequest.h @@ -31,7 +31,7 @@ using RequestCompletionCallback = std::function; // Abstract request. class Request { public: - Request(RequestMethod method, std::string_view url, std::string_view name, bool *cancelled, RequestFlags mode); + Request(RequestMethod method, std::string_view url, std::string_view name, const Path &outFile, bool *cancelled, RequestFlags mode); virtual ~Request() {} void SetAccept(const char *mime) { From 1a38b91d31a27382479e33cfcc09a4465cc27f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 13 Jun 2026 17:44:39 +0200 Subject: [PATCH 5/5] Fix compilation error on x86-32 --- GPU/Common/VertexDecoderHandwritten.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GPU/Common/VertexDecoderHandwritten.cpp b/GPU/Common/VertexDecoderHandwritten.cpp index 7caaf36754..576aeb6a67 100644 --- a/GPU/Common/VertexDecoderHandwritten.cpp +++ b/GPU/Common/VertexDecoderHandwritten.cpp @@ -184,7 +184,11 @@ void VtxDec_Tu8_C5551_Ps16(const u8 *srcp, u8 *dstp, int numVerts, const UVScale alpha &= col0; // Combined 5551 -> 8888 RGBA. Nasty. +#if PPSSPP_ARCH(AMD64) __m128i col = _mm_cvtsi64_si128(col0); +#else + __m128i col = _mm_set1_epi64x(col0); +#endif __m128i r = _mm_slli_epi32(_mm_and_si128(col, rmask), 8 - 5); __m128i g = _mm_slli_epi32(_mm_and_si128(col, gmask), 16 - 10); __m128i b = _mm_slli_epi32(_mm_and_si128(col, bmask), 24 - 15);