From a6844d6b9e7b4c376d2c8b280bc3ede0968f0f1e Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 7 Mar 2013 20:37:28 +0100 Subject: [PATCH] move shader error files in dolphin user directory --- .../Src/ProgramShaderCache.cpp | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp index c42e540042..a441ba2d64 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp @@ -290,15 +290,12 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons glGetProgramInfoLog(pid, length, &charsWritten, infoLog); ERROR_LOG(VIDEO, "Program info log:\n%s", infoLog); char szTemp[MAX_PATH]; - sprintf(szTemp, "p_%d.txt", pid); - FILE *fp = fopen(szTemp, "wb"); - fwrite(infoLog, length, 1, fp); - delete[] infoLog; - fwrite(s_glsl_header, strlen(s_glsl_header), 1, fp); - fwrite(vcode, strlen(vcode), 1, fp); - fwrite(s_glsl_header, strlen(s_glsl_header), 1, fp); - fwrite(pcode, strlen(pcode), 1, fp); - fclose(fp); + sprintf(szTemp, "%sp_%d.txt", File::GetUserPath(D_DUMP_IDX).c_str(), pid); + std::ofstream file; + OpenFStream(file, szTemp, std::ios_base::out); + file << infoLog << s_glsl_header << vcode << s_glsl_header << pcode; + file.close(); + delete [] infoLog; } if (linkStatus != GL_TRUE) { @@ -334,12 +331,11 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code ) glGetShaderInfoLog(result, length, &charsWritten, infoLog); ERROR_LOG(VIDEO, "PS Shader info log:\n%s", infoLog); char szTemp[MAX_PATH]; - sprintf(szTemp, "ps_%d.txt", result); - FILE *fp = fopen(szTemp, "wb"); - fwrite(infoLog, strlen(infoLog), 1, fp); - fwrite(s_glsl_header, strlen(s_glsl_header), 1, fp); - fwrite(code, strlen(code), 1, fp); - fclose(fp); + sprintf(szTemp, "%sps_%d.txt", File::GetUserPath(D_DUMP_IDX).c_str(), result); + std::ofstream file; + OpenFStream(file, szTemp, std::ios_base::out); + file << infoLog << s_glsl_header << code; + file.close(); delete[] infoLog; } if (compileStatus != GL_TRUE)