From 7f97346fc9e4459d05a97a300cd1835ce00a11a2 Mon Sep 17 00:00:00 2001 From: Bart Trzynadlowski Date: Sat, 24 Sep 2011 01:49:48 +0000 Subject: [PATCH] - Tweaked some error messages and comments. Hopefully, this is the last update for v0.2a's code. - Documentation updates. --- Docs/README.txt | 8 ++++---- Src/Graphics/Shader.cpp | 11 +++++------ Src/OSD/SDL/Main.cpp | 40 ++++++++++++++++++++++++---------------- Src/Sound/SCSP.cpp | 2 -- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/Docs/README.txt b/Docs/README.txt index 443a9a9..d932254 100644 --- a/Docs/README.txt +++ b/Docs/README.txt @@ -27,10 +27,10 @@ TODO: don't forget to add date to revision history! ================ Supermodel emulates the Sega Model 3 arcade platform. It uses OpenGL 2.1 and -runs on Windows, Linux, and Mac OS X. In order to use it, you must legally -possess ROM images of Model 3 games. Learning to operate Supermodel will come -with a steep learning curve for most people. Before seeking out help, please -read this user manual carefully. +SDL, and can run on Windows, Linux, and Mac OS X. In order to use it, you must +legally possess ROM images of Model 3 games. Learning to operate Supermodel +will come with a steep learning curve for most people. Before seeking out +help, please read this user manual carefully. Supermodel is distributed as free software under the terms of the GNU General Public License, included in LICENSE.txt. Additional copyright information for diff --git a/Src/Graphics/Shader.cpp b/Src/Graphics/Shader.cpp index b26c2ae..1daf0d6 100644 --- a/Src/Graphics/Shader.cpp +++ b/Src/Graphics/Shader.cpp @@ -84,7 +84,7 @@ static char *LoadShaderSource(const char *file) bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint *fragmentShaderPtr, const char *vsFile, const char *fsFile, const char *vsString, const char *fsString) { - char msg[2048+128], infoLog[2048]; + char infoLog[2048]; const char *vsSource, *fsSource; // source code GLuint shaderProgram, vertexShader, fragmentShader; GLint result, len; @@ -109,7 +109,7 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint if ((glCreateProgram==NULL) || (glCreateShader==NULL) || (glShaderSource==NULL) || (glCompileShader==NULL)) { ret = FAIL; - ErrorLog("OpenGL 2.0 does not appear to be present. Unable to proceed."); + ErrorLog("OpenGL 2.x does not appear to be present. Unable to proceed."); goto Quit; } @@ -128,7 +128,7 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint if (!result) // failed to compile { glGetShaderInfoLog(vertexShader, 2048, &len, infoLog); - ErrorLog("Vertex shader failed to compile. Compiler says:\n%s", infoLog); + ErrorLog("Vertex shader failed to compile. Your OpenGL driver said:\n%s", infoLog); ret = FAIL; // error } @@ -139,8 +139,7 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint if (!result) // failed to compile { glGetShaderInfoLog(fragmentShader, 2048, &len, infoLog); - ErrorLog("Fragment shader failed to compile. Compiler says:\n%s", infoLog); - fprintf(stderr, msg); + ErrorLog("Fragment shader failed to compile. Your OpenGL driver said:\n%s", infoLog); ret = FAIL; // error } @@ -152,7 +151,7 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint if (result == GL_FALSE) { glGetProgramInfoLog(shaderProgram, 2048, &len, infoLog); - ErrorLog("Failed to link shader objects. Linker says:\n%s\n", infoLog); + ErrorLog("Failed to link shader objects. Your OpenGL driver said:\n%s\n", infoLog); ret = FAIL; // error } diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index 30727d2..e3286b9 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -1313,7 +1313,7 @@ int main(int argc, char **argv) int f; ret = sscanf(&argv[i][14],"=%d",&f); if (ret != 1) - ErrorLog("-ppc-frequency requires a frequency."); + ErrorLog("'-ppc-frequency' requires a frequency."); else CmdLine.Set("Global", "PowerPCFrequency", f); } @@ -1332,7 +1332,7 @@ int main(int argc, char **argv) { ret = sscanf(&argv[i][13],"=%d",&n); if (ret != 1) - ErrorLog("-sound-volume requires a volume setting."); + ErrorLog("'-sound-volume' requires a volume setting."); else CmdLine.Set("Global", "SoundVolume", n); } @@ -1340,7 +1340,7 @@ int main(int argc, char **argv) { ret = sscanf(&argv[i][13],"=%d",&n); if (ret != 1) - ErrorLog("-music-volume requires a volume setting."); + ErrorLog("'-music-volume' requires a volume setting."); else CmdLine.Set("Global", "MusicVolume", n); } @@ -1372,7 +1372,7 @@ int main(int argc, char **argv) ret = sscanf(&argv[i][4],"=%d,%d",&x,&y); if (ret != 2) - ErrorLog("-res requires both a width and a height."); + ErrorLog("'-res' requires both a width and a height."); else { CmdLine.Set("Global", "XResolution", x); @@ -1394,17 +1394,25 @@ int main(int argc, char **argv) n = 1; CmdLine.Set("Global", "ShowFrameRate", n); } - else if (!strncmp(argv[i],"-vert-shader=",13)) + else if (!strncmp(argv[i],"-vert-shader",12)) { - if (argv[i][13] == '\0') - ErrorLog("-vert-shader requires a file path."); + if (argv[i][12] == '\0') + ErrorLog("'-vert-shader' requires a file path."); + else if (argv[i][12] != '=') + ErrorLog("Ignoring unrecognized option: %s", argv[i]); + else if (argv[i][13] == '\0') + ErrorLog("'-vert-shader' requires a file path."); else CmdLine.Set("Global", "VertexShader", &argv[i][13]); } - else if (!strncmp(argv[i],"-frag-shader=",13)) + else if (!strncmp(argv[i],"-frag-shader",12)) { - if (argv[i][13] == '\0') - ErrorLog("-frag-shader requires a file path."); + if (argv[i][12] == '\0') + ErrorLog("'-frag-shader' requires a file path."); + else if (argv[i][12] != '=') + ErrorLog("Ignoring unrecognized option: %s", argv[i]); + else if (argv[i][13] == '\0') + ErrorLog("'-frag-shader' requires a file path."); else CmdLine.Set("Global", "FragmentShader", &argv[i][13]); } @@ -1412,11 +1420,11 @@ int main(int argc, char **argv) else if (!strncmp(argv[i],"-input-system", 13)) // this setting is not written to the config file! { if (argv[i][13] == '\0') - ErrorLog("-input-system requires an input system name."); + ErrorLog("'-input-system' requires an input system name."); else if (argv[i][13] != '=') - ErrorLog("Ignoring unrecognized option: %s.", argv[i]); + ErrorLog("Ignoring unrecognized option: %s", argv[i]); else if (argv[i][14] == '\0') - ErrorLog("-input-system requires an input system name."); + ErrorLog("'-input-system' requires an input system name."); else inputSystem = &argv[i][14]; } @@ -1436,7 +1444,7 @@ int main(int argc, char **argv) else if (ret == 2) cmdDis = true; else - ErrorLog("-dis requires address and, optionally, number of instructions."); + ErrorLog("'-dis' requires address and, optionally, number of instructions."); } else if (!strcmp(argv[i],"-print-gl-info")) { @@ -1444,7 +1452,7 @@ int main(int argc, char **argv) return 0; } else if (argv[i][0] == '-') - ErrorLog("Ignoring unrecognized option: %s.", argv[i]); + ErrorLog("Ignoring unrecognized option: %s", argv[i]); else { if (fileIdx) // already specified a file @@ -1484,7 +1492,7 @@ int main(int argc, char **argv) #endif // SUPERMODEL_WIN32 else { - ErrorLog("Unknown input system: %s.\n", g_Config.GetInputSystem()); + ErrorLog("Unknown input system: %s\n", g_Config.GetInputSystem()); exitCode = 1; goto Exit; } diff --git a/Src/Sound/SCSP.cpp b/Src/Sound/SCSP.cpp index 61ea54b..c3f2979 100644 --- a/Src/Sound/SCSP.cpp +++ b/Src/Sound/SCSP.cpp @@ -39,8 +39,6 @@ * * To-Do List * ---------- - * - Remove asserts() in DSP code and make sure memory allocation errors are - * being handled properly. * - Wrap up into an object. Remove any unused #ifdef pathways. */