From a350422004f6ffec16225bd393d0da5fcdd016f0 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 24 Mar 2013 09:37:25 -0700 Subject: [PATCH 1/3] Fix reporting parameters, oops. --- Core/Reporting.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index a64528c61e..bb9de2ac35 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -121,7 +121,7 @@ namespace Reporting if (http.Resolve(ServerHostname(), ServerPort())) { http.Connect(); - http.POST("/report/message", data, "application/x-www-urlencoded", output); + http.POST("/report/message", data, "application/x-www-form-urlencoded", output); http.Disconnect(); result = true; } @@ -138,10 +138,11 @@ namespace Reporting char temp[PARAM_BUFFER_SIZE]; // TODO: Need to escape these values, add more. - snprintf(temp, PARAM_BUFFER_SIZE - 1, "version=%s&game=%s_%s", + snprintf(temp, PARAM_BUFFER_SIZE - 1, "version=%s&game=%s_%s&game_title=%s", PPSSPP_GIT_VERSION, g_paramSFO.GetValueString("DISC_ID").c_str(), - g_paramSFO.GetValueString("DISC_VERSION").c_str()); + g_paramSFO.GetValueString("DISC_VERSION").c_str(), + g_paramSFO.GetValueString("TITLE").c_str()); std::string data; switch (payload.type) From afbde31b42e3aedac8f3a6d67a848be064176584 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 24 Mar 2013 09:42:49 -0700 Subject: [PATCH 2/3] Add some OpenGL related reporting errors. --- GPU/GLES/ShaderManager.cpp | 2 ++ GPU/GLES/TextureCache.cpp | 3 +++ GPU/GLES/TransformPipeline.cpp | 5 +++++ Windows/EmuThread.cpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/GPU/GLES/ShaderManager.cpp b/GPU/GLES/ShaderManager.cpp index 26ea5e2ded..ab982107d7 100644 --- a/GPU/GLES/ShaderManager.cpp +++ b/GPU/GLES/ShaderManager.cpp @@ -28,6 +28,7 @@ #include "math/lin/matrix4x4.h" +#include "Core/Reporting.h" #include "../GPUState.h" #include "../ge_constants.h" #include "ShaderManager.h" @@ -52,6 +53,7 @@ Shader::Shader(const char *code, uint32_t shaderType) { ERROR_LOG(G3D, "Error in shader compilation!\n"); ERROR_LOG(G3D, "Info log: %s\n", infoLog); ERROR_LOG(G3D, "Shader source:\n%s\n", (const char *)code); + Reporting::ReportMessage("Error in shader compilation: info: %s / code: %s", infoLog, (const char *)code); } else { DEBUG_LOG(G3D, "Compiled shader:\n%s\n", (const char *)code); } diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 3a090a175b..5921aef3a9 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -19,6 +19,7 @@ #include #include "Core/MemMap.h" +#include "Core/Reporting.h" #include "GPU/ge_constants.h" #include "GPU/GPUState.h" #include "GPU/GLES/TextureCache.h" @@ -671,6 +672,7 @@ void TextureCache::SetTexture() { u32 format = gstate.texformat & 0xF; if (format >= 11) { + Reporting::ReportMessage("Unknown texture format %i", format); ERROR_LOG(G3D, "Unknown texture format %i", format); format = 0; } @@ -1087,6 +1089,7 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level) break; default: + Reporting::ReportMessage("Unknown texture format %i", entry.format); ERROR_LOG(G3D, "Unknown Texture Format %d!!!", entry.format); finalBuf = tmpTexBuf32; return; diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 43ba60d04f..c08391dc86 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -21,6 +21,7 @@ #include "../../Core/MemMap.h" #include "../../Core/Host.h" #include "../../Core/System.h" +#include "../../Core/Reporting.h" #include "../../native/gfx_es2/gl_state.h" #include "../../native/ext/cityhash/city.h" @@ -117,6 +118,8 @@ void TransformDrawEngine::GLLost() { void TransformDrawEngine::DrawBezier(int ucount, int vcount) { u16 indices[3 * 3 * 6]; + Reporting::ReportMessage("Unsupported bezier curve"); + // Generate indices for a rectangular mesh. int c = 0; for (int y = 0; y < 3; y++) { @@ -160,6 +163,8 @@ void TransformDrawEngine::DrawBezier(int ucount, int vcount) { void TransformDrawEngine::DrawSpline(int ucount, int vcount, int utype, int vtype) { u16 indices[3 * 3 * 6]; + Reporting::ReportMessage("Unsupported spline curve"); + // Generate indices for a rectangular mesh. int c = 0; for (int y = 0; y < 3; y++) { diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 88c0eb20a4..b930ddca0f 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -5,6 +5,7 @@ #include "StringUtil.h" #include "../Globals.h" #include "EmuThread.h" +#include "../Core/Reporting.h" #include "../Core/MemMap.h" #include "../Core/Core.h" #include "../Core/Host.h" @@ -65,6 +66,7 @@ DWORD TheThread(LPVOID x) { std::string error_string; if (!host->InitGL(&error_string)) { + Reporting::ReportMessage("OpenGL init error: %s", error_string.c_str()); std::string full_error = StringFromFormat( "Failed initializing OpenGL. Try upgrading your graphics drivers.\n\nError message:\n\n%s", error_string.c_str()); MessageBoxA(0, full_error.c_str(), "OpenGL Error", MB_OK | MB_ICONERROR); ERROR_LOG(BOOT, full_error.c_str()); From 0b9d4cca3b25613f3116e5d444f67222e40a4d35 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 24 Mar 2013 09:53:41 -0700 Subject: [PATCH 3/3] Clean up to server reporting, expose IsEnabled(). --- Core/Reporting.cpp | 53 ++++++++++++++++++++++++++++------------------ Core/Reporting.h | 1 + 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index bb9de2ac35..529c724c58 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -52,53 +52,57 @@ namespace Reporting static Payload payloadBuffer[PAYLOAD_BUFFER_SIZE]; static int payloadBufferPos = 0; + inline std::string ServerHost() + { + if (g_Config.sReportHost.compare("default") == 0) + return ""; + return g_Config.sReportHost; + } + static size_t ServerHostnameLength() { - if (g_Config.sReportHost.empty()) + if (!IsEnabled()) return g_Config.sReportHost.npos; // IPv6 literal? - if (g_Config.sReportHost[0] == '[') + std::string host = ServerHost(); + if (host[0] == '[') { - size_t length = g_Config.sReportHost.find("]:"); - if (length != g_Config.sReportHost.npos) + size_t length = host.find("]:"); + if (length != host.npos) ++length; return length; } else - return g_Config.sReportHost.find(':'); + return host.find(':'); } static const char *ServerHostname() { - if (g_Config.sReportHost.empty()) - return NULL; - // Disabled by default for now. - if (g_Config.sReportHost.compare("default") == 0) + if (!IsEnabled()) return NULL; + std::string host = ServerHost(); size_t length = ServerHostnameLength(); - if (length == g_Config.sReportHost.npos) - return g_Config.sReportHost.c_str(); + if (length == host.npos) + return host.c_str(); - lastHostname = g_Config.sReportHost.substr(0, length); + lastHostname = host.substr(0, length); return lastHostname.c_str(); } static int ServerPort() { - if (g_Config.sReportHost.empty()) - return 0; - // Disabled by default for now. - if (g_Config.sReportHost.compare("default") == 0) + if (!IsEnabled()) return 0; + std::string host = ServerHost(); size_t offset = ServerHostnameLength(); - if (offset == g_Config.sReportHost.npos) + if (offset == host.npos) return DEFAULT_PORT; // Skip the colon. - std::string port = g_Config.sReportHost.substr(offset + 1); + std::string port = host.substr(offset + 1); return atoi(port.c_str()); } @@ -160,12 +164,19 @@ namespace Reporting return 0; } - void ReportMessage(const char *message, ...) + bool IsEnabled() { - if (g_Config.sReportHost.empty() || CheckSpamLimited()) - return; + if (g_Config.sReportHost.empty()) + return false; // Disabled by default for now. if (g_Config.sReportHost.compare("default") == 0) + return false; + return true; + } + + void ReportMessage(const char *message, ...) + { + if (!IsEnabled() || CheckSpamLimited()) return; const int MESSAGE_BUFFER_SIZE = 32768; diff --git a/Core/Reporting.h b/Core/Reporting.h index 52de51a385..a5ebc5baa9 100644 --- a/Core/Reporting.h +++ b/Core/Reporting.h @@ -19,5 +19,6 @@ namespace Reporting { + bool IsEnabled(); void ReportMessage(const char *message, ...); } \ No newline at end of file