Merge pull request #1065 from unknownbrackets/report-server

Server reporting: couple more logs, fix mime type
This commit is contained in:
Henrik Rydgård committed 2013-03-24 10:06:46 -07:00
commit 3aaa437d71
6 files changed
+49 -24

No files matched your search

+36 -24
View File
@@ -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());
}
@@ -121,7 +125,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 +142,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)
@@ -159,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;
+1
View File
@@ -19,5 +19,6 @@
namespace Reporting
{
bool IsEnabled();
void ReportMessage(const char *message, ...);
}
+2
View File
@@ -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);
}
+3
View File
@@ -19,6 +19,7 @@
#include <algorithm>
#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;
+5
View File
@@ -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++) {
+2
View File
@@ -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());