diff --git a/src/main/java/cpw/mods/fml/client/SplashProgress.java b/src/main/java/cpw/mods/fml/client/SplashProgress.java index 2742384..79cfd55 100644 --- a/src/main/java/cpw/mods/fml/client/SplashProgress.java +++ b/src/main/java/cpw/mods/fml/client/SplashProgress.java @@ -9,6 +9,8 @@ import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; +import java.io.PrintStream; +import java.io.PrintWriter; import java.lang.Thread.UncaughtExceptionHandler; import java.nio.IntBuffer; import java.util.Iterator; @@ -41,6 +43,7 @@ import org.lwjgl.opengl.SharedDrawable; import org.lwjgl.util.glu.GLU; +import cpw.mods.fml.common.EnhancedRuntimeException; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.ICrashCallable; @@ -176,7 +179,12 @@ return "GL info"; } }); - CrashReport report = CrashReport.makeCrashReport(new Throwable(), "Loading screen debug info"); + CrashReport report = CrashReport.makeCrashReport(new Throwable() + { + @Override public String getMessage(){ return "This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR"; } + @Override public void printStackTrace(final PrintWriter s){ s.println(getMessage()); } + @Override public void printStackTrace(final PrintStream s) { s.println(getMessage()); } + }, "Loading screen debug info"); System.out.println(report.getCompleteReport()); try @@ -272,8 +280,8 @@ // forge logo setColor(backgroundColor); - float fw = (float)forgeTexture.getWidth() / 2; - float fh = (float)forgeTexture.getHeight() / 2; + float fw = (float)forgeTexture.getWidth() / 2 / 2; + float fh = (float)forgeTexture.getHeight() / 2 / 2; if(rotate) { float sh = Math.max(fw, fh); @@ -494,10 +502,62 @@ catch (Exception e) { e.printStackTrace(); - throw new RuntimeException(e); + if (disableSplash()) + { + throw new EnhancedRuntimeException(e) + { + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("SplashProgress has detected a error loading Minecraft."); + stream.println("This can sometimes be caused by bad video drivers."); + stream.println("We have automatically disabeled the new Splash Screen in config/splash.properties."); + stream.println("Try reloading minecraft before reporting any errors."); + } + }; + } + else + { + throw new EnhancedRuntimeException(e) + { + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("SplashProgress has detected a error loading Minecraft."); + stream.println("This can sometimes be caused by bad video drivers."); + stream.println("Please try disabeling the new Splash Screen in config/splash.properties."); + stream.println("After doing so, try reloading minecraft before reporting any errors."); + } + }; + } } } + private static boolean disableSplash() + { + File configFile = new File(Minecraft.getMinecraft().mcDataDir, "config/splash.properties"); + FileReader r = null; + enabled = false; + config.setProperty("enabled", "false"); + + FileWriter w = null; + try + { + w = new FileWriter(configFile); + config.store(w, "Splash screen properties"); + } + catch(IOException e) + { + FMLLog.log(Level.ERROR, e, "Could not save the splash.properties file"); + return false; + } + finally + { + IOUtils.closeQuietly(w); + } + return true; + } + private static IResourcePack createResourcePack(File file) { if(file.isDirectory()) diff --git a/src/main/java/cpw/mods/fml/common/EnhancedRuntimeException.java b/src/main/java/cpw/mods/fml/common/EnhancedRuntimeException.java index 13b3157..e5d90ff 100644 --- a/src/main/java/cpw/mods/fml/common/EnhancedRuntimeException.java +++ b/src/main/java/cpw/mods/fml/common/EnhancedRuntimeException.java @@ -44,7 +44,7 @@ this.printStackTrace(new WrappedPrintStream() { @Override - void println(String line) + public void println(String line) { buf.append(line).append('\n'); } @@ -60,7 +60,7 @@ printStackTrace(new WrappedPrintStream() { @Override - void println(String line) + public void println(String line) { s.println(line); } @@ -72,7 +72,7 @@ printStackTrace(new WrappedPrintStream() { @Override - void println(String line) + public void println(String line) { s.println(line); } @@ -84,6 +84,6 @@ public static abstract class WrappedPrintStream { - abstract void println(String line); + public abstract void println(String line); } } \ No newline at end of file diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java index 64cec6e..c271f63 100644 --- a/src/main/java/net/minecraft/client/Minecraft.java +++ b/src/main/java/net/minecraft/client/Minecraft.java @@ -566,12 +566,12 @@ this.field_152354_ay = null; this.loadingScreen = new LoadingScreenRenderer(this); + FMLClientHandler.instance().onInitializationComplete(); if (this.gameSettings.fullScreen && !this.fullscreen) { this.toggleFullscreen(); } - FMLClientHandler.instance().onInitializationComplete(); try { Display.setVSyncEnabled(this.gameSettings.enableVsync);