diff --git a/Common/Net/Resolve.cpp b/Common/Net/Resolve.cpp index 644de89310..eb06516ed3 100644 --- a/Common/Net/Resolve.cpp +++ b/Common/Net/Resolve.cpp @@ -26,13 +26,17 @@ extern JavaVM *gJvm; namespace net { static bool g_naettInitialized; +static bool g_wsaInitialized; -void Init() -{ +void Init() { #ifdef _WIN32 // WSA does its own internal reference counting, no need to keep track of if we inited or not. - WSADATA wsaData = {0}; - WSAStartup(MAKEWORD(2, 2), &wsaData); + WSADATA wsaData{}; + if (FAILED(WSAStartup(MAKEWORD(2, 2), &wsaData))) { + ERROR_LOG(Log::sceNet, "WSAStartup failed"); + } else { + g_wsaInitialized = true; + } #endif if (!g_naettInitialized) { #ifndef HTTPS_NOT_AVAILABLE @@ -47,14 +51,19 @@ void Init() } } -void Shutdown() -{ +void Shutdown() { #ifdef _WIN32 - WSACleanup(); + if (g_wsaInitialized) { + WSACleanup(); + } #endif } -bool HostPortExists(const std::string& host, int port, int timeout_ms) { +// This checks whether a TCP connection to host : port can be established within a given timeout. +// It does this by attempting a new, non - blocking TCP connect() and waiting for it to succeed or time out. +// The socket is closed immediately after the check. +// It does not inspect or detect existing connections from other applications; it only tests reachability by making its own connection attempt. +bool HostPortExists(const std::string &host, int port, int timeout_ms) { if (host.empty() || (port <= 0 || port > 65535) || timeout_ms < 0) return false; addrinfo hints; diff --git a/Common/Net/Resolve.h b/Common/Net/Resolve.h index 15e89cc9f1..84644584a3 100644 --- a/Common/Net/Resolve.h +++ b/Common/Net/Resolve.h @@ -18,7 +18,7 @@ enum class DNSType { IPV6 = 2, }; -bool HostPortExists(const std::string& host, int port, int timeout_ms); +bool HostPortExists(const std::string &host, int port, int timeout_ms); bool DNSResolve(const std::string &host, const std::string &service, addrinfo **res, std::string &error, DNSType type = DNSType::ANY); void DNSResolveFree(addrinfo *res); diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index fd68959ddb..bd2f16b50f 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -250,7 +250,7 @@ bool SymbolMap::SaveSymbolMap(const Path &filename) const { return false; } strm.next_in = (Bytef *)data.data(); - strm.avail_in = data.size(); + strm.avail_in = (u32)data.size(); strm.next_out = out_data; strm.avail_out = out_size; int flush = Z_NO_FLUSH; diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 34cd4cb561..248ed5052d 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -24,17 +24,14 @@ #include "Common/GraphicsContext.h" #include "Common/System/OSD.h" #include "Common/VR/PPSSPPVR.h" +#include "Common/StringUtils.h" #include "Core/Config.h" -#include "Core/Debugger/Breakpoints.h" -#include "Core/MemMapHelpers.h" #include "Core/Reporting.h" #include "Core/Core.h" #include "Core/ELF/ParamSFO.h" #include "GPU/GPUState.h" -#include "GPU/ge_constants.h" -#include "GPU/GeDisasm.h" #include "GPU/Common/FramebufferManagerCommon.h" #include "GPU/GLES/ShaderManagerGLES.h" #include "GPU/GLES/GPU_GLES.h" @@ -114,7 +111,7 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw) } if (g_Config.bHardwareTessellation) { - // Disable hardware tessellation if device is unsupported. + // Log information that we disable hardware tessellation if device is unsupported. if (!drawEngine_.SupportsHWTessellation()) { ERROR_LOG(Log::G3D, "Hardware Tessellation is unsupported, falling back to software tessellation"); } @@ -211,10 +208,8 @@ void GPU_GLES::BuildReportingInfo() { glExtensions = render->GetGLString(GL_EXTENSIONS); } - char temp[16384]; - snprintf(temp, sizeof(temp), "%s (%s %s), %s (extensions: %s)", glVersion.c_str(), glVendor.c_str(), glRenderer.c_str(), glSlVersion.c_str(), glExtensions.c_str()); reportingPrimaryInfo_ = glVendor; - reportingFullInfo_ = temp; + reportingFullInfo_ = StringFromFormat("%s (%s %s), %s (extensions: %s)", glVersion.c_str(), glVendor.c_str(), glRenderer.c_str(), glSlVersion.c_str(), glExtensions.c_str()); Reporting::UpdateConfig(); } diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index c8b76ccc28..cc3db79d27 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -24,6 +24,7 @@ #include "Common/TimeUtil.h" #include "Common/File/FileUtil.h" #include "Common/GraphicsContext.h" +#include "Common/StringUtils.h" #include "Core/Config.h" #include "Core/Reporting.h" @@ -384,10 +385,8 @@ void GPU_Vulkan::BuildReportingInfo() { featureNames = featureNames.substr(2); } - char temp[16384]; - snprintf(temp, sizeof(temp), "v%08x driver v%08x (%s), vendorID=%d, deviceID=%d (features: %s)", props.apiVersion, props.driverVersion, props.deviceName, props.vendorID, props.deviceID, featureNames.c_str()); reportingPrimaryInfo_ = props.deviceName; - reportingFullInfo_ = temp; + reportingFullInfo_ = StringFromFormat("v%08x driver v%08x (%s), vendorID=%d, deviceID=%d (features: %s)", props.apiVersion, props.driverVersion, props.deviceName, props.vendorID, props.deviceID, featureNames.c_str()); Reporting::UpdateConfig(); } diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 3cd5b6859e..0ac55669d9 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -1000,8 +1000,10 @@ namespace MainWindow { if (rc_client_raintegration_activate_menu_item(Achievements::GetClient(), LOWORD(wParam))) { break; } + MessageBox(hWnd, L"Unhandled menu item. Did you unload RAIntegration?", L"Sorry", 0); +#else + MessageBox(hWnd, L"Unhandled menu item. Please report a bug.", L"Sorry", 0); #endif - MessageBox(hWnd, L"Unhandled menu item", L"Sorry", 0); break; } }