From a381874bb9c3bdeeb508bb81719b4d210eb29696 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Sun, 6 Oct 2013 11:13:07 -0700 Subject: [PATCH] Delay sound system backend initalization to speed up startup and prevent race condition on some computers. --- .../cpw/mods/fml/client/FMLClientHandler.java | 2 ++ .../net/minecraft/client/Minecraft.java.patch | 26 +++++++++++-------- .../client/audio/SoundManager.java.patch | 18 +++++++++++++ 3 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch diff --git a/client/cpw/mods/fml/client/FMLClientHandler.java b/client/cpw/mods/fml/client/FMLClientHandler.java index 6337aaa546..5332e3143e 100644 --- a/client/cpw/mods/fml/client/FMLClientHandler.java +++ b/client/cpw/mods/fml/client/FMLClientHandler.java @@ -259,6 +259,8 @@ public class FMLClientHandler implements IFMLSidedHandler haltGame("There was a severe problem during mod loading that has caused the game to fail", le); return; } + + client.field_71416_A.LOAD_SOUND_SYSTEM = true; // Reload resources client.func_110436_a(); RenderingRegistry.instance().loadEntityRenderers((Map, Render>)RenderManager.field_78727_a.field_78729_o); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index f8afdd307a..113940e050 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -21,16 +21,20 @@ @SideOnly(Side.CLIENT) public class Minecraft implements IPlayerUsage { -@@ -366,6 +373,8 @@ +@@ -362,9 +369,12 @@ + this.field_71446_o = new TextureManager(this.field_110451_am); + this.field_110451_am.func_110542_a(this.field_71446_o); + this.field_71416_A = new SoundManager(this.field_110451_am, this.field_71474_y, this.field_110446_Y); ++ this.field_71416_A.LOAD_SOUND_SYSTEM = false; + this.field_110451_am.func_110542_a(this.field_71416_A); this.func_71357_I(); this.field_71466_p = new FontRenderer(this.field_71474_y, new ResourceLocation("textures/font/ascii.png"), this.field_71446_o, false); - -+ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am); + ++ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am); + if (this.field_71474_y.field_74363_ab != null) { - this.field_71466_p.func_78264_a(this.field_135017_as.func_135042_a()); -@@ -400,6 +409,7 @@ +@@ -400,6 +410,7 @@ this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items")); GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d); this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o); @@ -38,7 +42,7 @@ this.func_71361_d("Post startup"); this.field_71456_v = new GuiIngame(this); -@@ -418,6 +428,7 @@ +@@ -418,6 +429,7 @@ { this.func_71352_k(); } @@ -46,7 +50,7 @@ } public void func_110436_a() -@@ -733,6 +744,7 @@ +@@ -733,6 +745,7 @@ { this.func_71405_e(); } @@ -54,7 +58,7 @@ } private void func_71411_J() -@@ -801,9 +813,11 @@ +@@ -801,9 +814,11 @@ if (!this.field_71454_w) { @@ -66,7 +70,7 @@ } GL11.glFlush(); -@@ -1325,10 +1339,14 @@ +@@ -1325,10 +1340,14 @@ public void func_71407_l() { @@ -81,7 +85,7 @@ this.field_71424_I.func_76320_a("stats"); this.field_71413_E.func_77449_e(); -@@ -1785,6 +1803,8 @@ +@@ -1785,6 +1804,8 @@ this.field_71453_ak.func_74428_b(); } @@ -90,7 +94,7 @@ this.field_71424_I.func_76319_b(); this.field_71423_H = func_71386_F(); } -@@ -1808,8 +1828,27 @@ +@@ -1808,8 +1829,27 @@ } this.field_71413_E.func_77450_a(StatList.field_75936_f, 1); diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch new file mode 100644 index 0000000000..66f94d8126 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java ++++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java +@@ -27,6 +27,7 @@ + @SideOnly(Side.CLIENT) + public class SoundManager implements ResourceManagerReloadListener + { ++ public boolean LOAD_SOUND_SYSTEM = true; + private static final String[] field_130084_a = new String[] {"ogg"}; + private SoundSystem field_77381_a; + private boolean field_77376_g; +@@ -67,6 +68,7 @@ + + public void func_110549_a(ResourceManager p_110549_1_) + { ++ if (!this.LOAD_SOUND_SYSTEM) return; //Stop the sound system from initializing three times at startup. Causing race conditions on some machines. + this.func_82464_d(); + this.func_77370_b(); + this.func_77363_d();