Added GL version/vendor to error report. (#207)
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
4b1dc39e4a
commit
af667a48d5
|
@ -68,6 +68,7 @@ public class Container extends AppGameContainer {
|
||||||
public void start() throws SlickException {
|
public void start() throws SlickException {
|
||||||
try {
|
try {
|
||||||
setup();
|
setup();
|
||||||
|
ErrorHandler.setGlString();
|
||||||
getDelta();
|
getDelta();
|
||||||
while (running())
|
while (running())
|
||||||
gameLoop();
|
gameLoop();
|
||||||
|
|
|
@ -33,6 +33,7 @@ import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.newdawn.slick.util.Log;
|
import org.newdawn.slick.util.Log;
|
||||||
import org.newdawn.slick.util.ResourceLoader;
|
import org.newdawn.slick.util.ResourceLoader;
|
||||||
|
|
||||||
|
@ -73,9 +74,23 @@ public class ErrorHandler {
|
||||||
message = { desc, scroll },
|
message = { desc, scroll },
|
||||||
messageReport = { descReport, scroll };
|
messageReport = { descReport, scroll };
|
||||||
|
|
||||||
|
/** OpenGL string (if any). */
|
||||||
|
private static String glString = null;
|
||||||
|
|
||||||
// This class should not be instantiated.
|
// This class should not be instantiated.
|
||||||
private ErrorHandler() {}
|
private ErrorHandler() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the OpenGL version string.
|
||||||
|
*/
|
||||||
|
public static void setGlString() {
|
||||||
|
try {
|
||||||
|
String glVersion = GL11.glGetString(GL11.GL_VERSION);
|
||||||
|
String glVendor = GL11.glGetString(GL11.GL_VENDOR);
|
||||||
|
glString = String.format("%s (%s)", glVersion, glVendor);
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays an error popup and logs the given error.
|
* Displays an error popup and logs the given error.
|
||||||
* @param error a description of the error
|
* @param error a description of the error
|
||||||
|
@ -197,6 +212,11 @@ public class ErrorHandler {
|
||||||
sb.append("**JRE:** ");
|
sb.append("**JRE:** ");
|
||||||
sb.append(System.getProperty("java.version"));
|
sb.append(System.getProperty("java.version"));
|
||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
|
if (glString != null) {
|
||||||
|
sb.append("**OpenGL Version:** ");
|
||||||
|
sb.append(glString);
|
||||||
|
sb.append('\n');
|
||||||
|
}
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
sb.append("**Error:** `");
|
sb.append("**Error:** `");
|
||||||
sb.append(error);
|
sb.append(error);
|
||||||
|
|
|
@ -107,10 +107,13 @@ public class Opsu extends StateBasedGame {
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.error(e);
|
Log.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set default exception handler
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void uncaughtException(Thread t, Throwable e) {
|
public void uncaughtException(Thread t, Throwable e) {
|
||||||
ErrorHandler.error("** Uncaught Exception! **", e, true);
|
ErrorHandler.error("** Uncaught Exception! **", e, true);
|
||||||
|
System.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -123,15 +126,19 @@ public class Opsu extends StateBasedGame {
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
// shouldn't happen
|
// shouldn't happen
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
ErrorHandler.error(String.format(
|
errorAndExit(
|
||||||
|
null,
|
||||||
|
String.format(
|
||||||
"opsu! could not be launched for one of these reasons:\n" +
|
"opsu! could not be launched for one of these reasons:\n" +
|
||||||
"- An instance of opsu! is already running.\n" +
|
"- An instance of opsu! is already running.\n" +
|
||||||
"- Another program is bound to port %d. " +
|
"- Another program is bound to port %d. " +
|
||||||
"You can change the port opsu! uses by editing the \"Port\" field in the configuration file.",
|
"You can change the port opsu! uses by editing the \"Port\" field in the configuration file.",
|
||||||
Options.getPort()), null, false);
|
Options.getPort()
|
||||||
System.exit(1);
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load natives
|
||||||
File nativeDir;
|
File nativeDir;
|
||||||
if (!Utils.isJarRunning() && (
|
if (!Utils.isJarRunning() && (
|
||||||
(nativeDir = new File("./target/natives/")).isDirectory() ||
|
(nativeDir = new File("./target/natives/")).isDirectory() ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user