Fixed issue where config folder would not be created before SplashProgress tried to read from it.

Default macs to disable the new loading screen due to to many macs having issues.
Users can enable it again by editing their config.
Catch and gracefully handle more errors when starting up the Splash Screen.
This commit is contained in:
Lex Manos 2015-08-22 18:55:32 -07:00
parent 4b299529b7
commit 90a88efd8a
3 changed files with 108 additions and 68 deletions

3
.gitignore vendored
View File

@ -3,6 +3,9 @@
/.settings
/.classpath
#In case people make their workspace in the repo
/eclipse/
#idea
/.idea
*.iml

View File

@ -8,7 +8,7 @@
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
this.field_71443_c = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1;
this.field_71440_d = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1;
@@ -410,10 +409,10 @@
@@ -411,10 +410,10 @@
this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an);
this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
this.field_110451_am.func_110542_a(this.field_135017_as);
@ -21,7 +21,7 @@
this.func_175595_al();
this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az);
this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves"));
@@ -449,6 +448,8 @@
@@ -450,6 +449,8 @@
}
});
this.field_71417_B = new MouseHelper();
@ -30,7 +30,7 @@
this.func_71361_d("Pre startup");
GlStateManager.func_179098_w();
GlStateManager.func_179103_j(7425);
@@ -462,17 +463,21 @@
@@ -463,17 +464,21 @@
GlStateManager.func_179096_D();
GlStateManager.func_179128_n(5888);
this.func_71361_d("Startup");
@ -53,7 +53,7 @@
this.field_71460_t = new EntityRenderer(this, this.field_110451_am);
this.field_110451_am.func_110542_a(this.field_71460_t);
this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_71474_y);
@@ -482,22 +487,25 @@
@@ -483,22 +488,25 @@
this.field_71458_u = new GuiAchievement(this);
GlStateManager.func_179083_b(0, 0, this.field_71443_c, this.field_71440_d);
this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
@ -82,7 +82,7 @@
if (this.field_71474_y.field_74353_u && !this.field_71431_Q)
{
this.func_71352_k();
@@ -681,21 +689,23 @@
@@ -682,21 +690,23 @@
File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
Bootstrap.func_179870_a(p_71377_1_.func_71502_e());
@ -109,7 +109,7 @@
}
public boolean func_152349_b()
@@ -887,11 +897,6 @@
@@ -888,11 +898,6 @@
public void func_147108_a(GuiScreen p_147108_1_)
{
@ -121,7 +121,7 @@
if (p_147108_1_ == null && this.field_71441_e == null)
{
p_147108_1_ = new GuiMainMenu();
@@ -901,6 +906,17 @@
@@ -902,6 +907,17 @@
p_147108_1_ = new GuiGameOver();
}
@ -139,7 +139,7 @@
if (p_147108_1_ instanceof GuiMainMenu)
{
this.field_71474_y.field_74330_P = false;
@@ -999,7 +1015,7 @@
@@ -1000,7 +1016,7 @@
{
while (!this.field_152351_aB.isEmpty())
{
@ -148,7 +148,7 @@
}
}
@@ -1034,9 +1050,11 @@
@@ -1035,9 +1051,11 @@
if (!this.field_71454_w)
{
@ -160,7 +160,7 @@
}
this.field_71424_I.func_76319_b();
@@ -1382,7 +1400,7 @@
@@ -1383,7 +1401,7 @@
if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b))
{
@ -169,7 +169,7 @@
this.field_71439_g.func_71038_i();
}
}
@@ -1462,15 +1480,19 @@
@@ -1463,15 +1481,19 @@
case 2:
BlockPos blockpos = this.field_71476_x.func_178782_a();
@ -190,7 +190,7 @@
if (itemstack == null)
{
@@ -1493,7 +1515,8 @@
@@ -1494,7 +1516,8 @@
{
ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g();
@ -200,7 +200,7 @@
{
this.field_71460_t.field_78516_c.func_78445_c();
}
@@ -1591,6 +1614,8 @@
@@ -1592,6 +1615,8 @@
--this.field_71467_ac;
}
@ -209,7 +209,7 @@
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n)
@@ -1689,6 +1714,8 @@
@@ -1690,6 +1715,8 @@
while (Mouse.next())
{
@ -218,7 +218,7 @@
i = Mouse.getEventButton();
KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState());
@@ -1744,6 +1771,7 @@
@@ -1745,6 +1772,7 @@
this.field_71462_r.func_146274_d();
}
}
@ -226,7 +226,7 @@
}
if (this.field_71429_W > 0)
@@ -1920,6 +1948,7 @@
@@ -1921,6 +1949,7 @@
}
}
}
@ -234,7 +234,7 @@
}
for (i = 0; i < 9; ++i)
@@ -2120,12 +2149,15 @@
@@ -2121,12 +2150,15 @@
this.field_71453_ak.func_74428_b();
}
@ -250,7 +250,7 @@
this.func_71403_a((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
@@ -2161,6 +2193,12 @@
@@ -2162,6 +2194,12 @@
while (!this.field_71437_Z.func_71200_ad())
{
@ -263,7 +263,7 @@
String s2 = this.field_71437_Z.func_71195_b_();
if (s2 != null)
@@ -2186,8 +2224,14 @@
@@ -2187,8 +2225,14 @@
SocketAddress socketaddress = this.field_71437_Z.func_147137_ag().func_151270_a();
NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress);
networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null));
@ -280,7 +280,7 @@
this.field_71453_ak = networkmanager;
}
@@ -2198,6 +2242,8 @@
@@ -2199,6 +2243,8 @@
public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_)
{
@ -289,7 +289,7 @@
if (p_71353_1_ == null)
{
NetHandlerPlayClient nethandlerplayclient = this.func_147114_u();
@@ -2211,6 +2257,18 @@
@@ -2212,6 +2258,18 @@
{
this.field_71437_Z.func_71263_m();
this.field_71437_Z.func_175592_a();
@ -308,7 +308,7 @@
}
this.field_71437_Z = null;
@@ -2237,6 +2295,7 @@
@@ -2238,6 +2296,7 @@
this.func_71351_a((ServerData)null);
this.field_71455_al = false;
@ -316,7 +316,7 @@
}
this.field_147127_av.func_147690_c();
@@ -2341,134 +2400,11 @@
@@ -2342,134 +2401,11 @@
if (this.field_71476_x != null)
{
boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
@ -453,23 +453,24 @@
if (flag)
{
int j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + inventoryplayer.field_70461_c;
@@ -2724,8 +2660,11 @@
p_70001_1_.func_152767_b("gl_max_texture_size", Integer.valueOf(func_71369_N()));
}
@@ -2727,18 +2663,8 @@
+ //Forge: Adds a optimization to the getGLMaximumTextureSize, only calculate it once.
+ private static int max_texture_size = -1;
public static int func_71369_N()
{
+ if (max_texture_size != -1) return max_texture_size;
for (int i = 16384; i > 0; i >>= 1)
{
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
@@ -2733,6 +2672,7 @@
- for (int i = 16384; i > 0; i >>= 1)
- {
- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
-
- if (j != 0)
- {
- return i;
- }
- }
-
- return -1;
+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done.
+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize();
}
if (j != 0)
{
+ max_texture_size = i;
return i;
}
}
public boolean func_70002_Q()

View File

@ -60,6 +60,7 @@ import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.Iterator;
import java.util.Properties;
@ -81,7 +82,6 @@ import net.minecraft.crash.CrashReport;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.EnhancedRuntimeException;
import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ICrashCallable;
@ -103,6 +103,7 @@ import org.lwjgl.util.glu.GLU;
* @deprecated not a stable API, will break, don't use this yet
*/
@Deprecated
@SuppressWarnings("serial")
public class SplashProgress
{
private static Drawable d;
@ -159,6 +160,11 @@ public class SplashProgress
public static void start()
{
File configFile = new File(Minecraft.getMinecraft().mcDataDir, "config/splash.properties");
File parent = configFile.getParentFile();
if (!parent.exists())
parent.mkdirs();
FileReader r = null;
config = new Properties();
try
@ -175,9 +181,14 @@ public class SplashProgress
IOUtils.closeQuietly(r);
}
//Some system do not support this and have weird effects so we need to detect and disable by default.
//The user can always force enable it if they want to take the responsibility for bugs.
//For now macs derp so disable them.
boolean defaultEnabled = !System.getProperty("os.name").toLowerCase().contains("mac");
// Enable if we have the flag, and there's either no optifine, or optifine has added a key to the blackboard ("optifine.ForgeSplashCompatible")
// Optifine authors - add this key to the blackboard if you feel your modifications are now compatible with this code.
enabled = getBool("enabled", true) && ( (!FMLClientHandler.instance().hasOptifine()) || Launch.blackboard.containsKey("optifine.ForgeSplashCompatible"));
enabled = getBool("enabled", defaultEnabled) && ( (!FMLClientHandler.instance().hasOptifine()) || Launch.blackboard.containsKey("optifine.ForgeSplashCompatible"));
rotate = getBool("rotate", false);
logoOffset = getInt("logoOffset", 0);
backgroundColor = getHex("background", 0xFFFFFF);
@ -243,9 +254,13 @@ public class SplashProgress
catch (LWJGLException e)
{
e.printStackTrace();
throw new RuntimeException(e);
disableSplash(e);
}
Thread mainThread = Thread.currentThread();
//Call this ASAP if splash is enabled so that threading doesn't cause issues later
getMaxTextureSize();
//Thread mainThread = Thread.currentThread();
thread = new Thread(new Runnable()
{
private final int barWidth = 400;
@ -478,6 +493,22 @@ public class SplashProgress
checkThreadState();
}
private static int max_texture_size = -1;
public static int getMaxTextureSize()
{
if (max_texture_size != -1) return max_texture_size;
for (int i = 0x4000; i > 0; i >>= 1)
{
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
if (GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0)
{
max_texture_size = i;
return i;
}
}
return -1;
}
private static void checkThreadState()
{
if(thread.getState() == Thread.State.TERMINATED || threadError != null)
@ -549,34 +580,39 @@ public class SplashProgress
catch (Exception e)
{
e.printStackTrace();
if (disableSplash())
disableSplash(e);
}
}
private static boolean disableSplash(Exception e)
{
if (disableSplash())
{
throw new EnhancedRuntimeException(e)
{
throw new EnhancedRuntimeException(e)
@Override
protected void printStackTrace(WrappedPrintStream stream)
{
@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
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)
{
throw new EnhancedRuntimeException(e)
@Override
protected void printStackTrace(WrappedPrintStream stream)
{
@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.");
}
};
}
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.");
}
};
}
}
@ -587,7 +623,6 @@ public class SplashProgress
if (!parent.exists())
parent.mkdirs();
FileReader r = null;
enabled = false;
config.setProperty("enabled", "false");
@ -623,6 +658,7 @@ public class SplashProgress
private static final IntBuffer buf = BufferUtils.createIntBuffer(4 * 1024 * 1024);
@SuppressWarnings("unused")
private static class Texture
{
private final ResourceLocation location;