diff --git a/About/About.xml b/About/About.xml
new file mode 100644
index 0000000..c41268e
--- /dev/null
+++ b/About/About.xml
@@ -0,0 +1,9 @@
+
+
+ BetterLoading
+ Samboy063
+
+ 1.0
+ An enhanced loading screen.
+
+
\ No newline at end of file
diff --git a/Assemblies/0Harmony.dll b/Assemblies/0Harmony.dll
new file mode 100644
index 0000000..1b6fa8e
Binary files /dev/null and b/Assemblies/0Harmony.dll differ
diff --git a/Assemblies/BetterLoading.dll b/Assemblies/BetterLoading.dll
new file mode 100644
index 0000000..d923d46
Binary files /dev/null and b/Assemblies/BetterLoading.dll differ
diff --git a/Source.DotSettings.user b/Source.DotSettings.user
new file mode 100644
index 0000000..dc568f4
--- /dev/null
+++ b/Source.DotSettings.user
@@ -0,0 +1,8 @@
+
+ True
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="num" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" />
+ True
+ True
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/.idea/.name b/Source/.idea/.idea.BetterLoading/.idea/.name
new file mode 100644
index 0000000..7b61a72
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/.idea/.name
@@ -0,0 +1 @@
+BetterLoading
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/.idea/contentModel.xml b/Source/.idea/.idea.BetterLoading/.idea/contentModel.xml
new file mode 100644
index 0000000..3695212
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/.idea/contentModel.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/.idea/encodings.xml b/Source/.idea/.idea.BetterLoading/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/.idea/indexLayout.xml b/Source/.idea/.idea.BetterLoading/.idea/indexLayout.xml
new file mode 100644
index 0000000..27ba142
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/.idea/misc.xml b/Source/.idea/.idea.BetterLoading/.idea/misc.xml
new file mode 100644
index 0000000..1d8c84d
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/.idea/modules.xml b/Source/.idea/.idea.BetterLoading/.idea/modules.xml
new file mode 100644
index 0000000..31b2d3e
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/.idea/workspace.xml b/Source/.idea/.idea.BetterLoading/.idea/workspace.xml
new file mode 100644
index 0000000..90ea194
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/.idea/workspace.xml
@@ -0,0 +1,306 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1548671471843
+
+
+ 1548671471843
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/.idea/.idea.BetterLoading/riderModule.iml b/Source/.idea/.idea.BetterLoading/riderModule.iml
new file mode 100644
index 0000000..468d82c
--- /dev/null
+++ b/Source/.idea/.idea.BetterLoading/riderModule.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/BetterLoading.csproj b/Source/BetterLoading.csproj
new file mode 100644
index 0000000..79ad5ab
--- /dev/null
+++ b/Source/BetterLoading.csproj
@@ -0,0 +1,66 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {E08CFC22-1BA8-41FE-A60B-491C308B8B65}
+ Library
+ Properties
+ DebugUtil
+ BetterLoading
+ v3.5
+ 512
+
+
+ AnyCPU
+ true
+ full
+ false
+ ..\Assemblies\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ ..\Assemblies
+ TRACE
+ prompt
+ 4
+
+
+
+ Deps\0Harmony.dll
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll
+ False
+
+
+
+
+
+
+ C:\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll
+ False
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/BetterLoadingMain.cs b/Source/BetterLoadingMain.cs
new file mode 100644
index 0000000..7ccd532
--- /dev/null
+++ b/Source/BetterLoadingMain.cs
@@ -0,0 +1,222 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Xml;
+using Harmony;
+using JetBrains.Annotations;
+using RimWorld;
+using UnityEngine;
+using Verse;
+
+namespace BetterLoading
+{
+ public class BetterLoadingMain : Mod
+ {
+ public static LoadingScreenManager Manager;
+
+ public BetterLoadingMain(ModContentPack content) : base(content)
+ {
+ Manager = Camera.main.gameObject.AddComponent();
+ var inst = HarmonyInstance.Create("me.samboycoding.blm");
+ inst.PatchAll(Assembly.GetExecutingAssembly());
+ }
+
+ [HarmonyPatch(typeof(LoadedModManager))]
+ [HarmonyPatch(nameof(LoadedModManager.LoadModXML))]
+ [UsedImplicitly]
+ public class LoadModXmlPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix()
+ {
+ Log.Message("Loading Screen Manager :: Read XML Files :: Start");
+ Manager.currentStage = LoadingStage.ReadXMLFiles;
+ Manager.totalLoadedContentPacks = LoadedModManager.RunningMods.Count();
+ Manager.numContentPacksLoaded = 0;
+ }
+ }
+
+ [HarmonyPatch(typeof(ModContentPack))]
+ [HarmonyPatch(nameof(ModContentPack.LoadDefs))]
+ [UsedImplicitly]
+ public class LoadDefsPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix(ModContentPack __instance)
+ {
+ Manager.numContentPacksLoaded += 1;
+ Manager.currentlyLoadingDefsFrom = __instance;
+ }
+ }
+
+ [HarmonyPatch(typeof(LoadedModManager))]
+ [HarmonyPatch(nameof(LoadedModManager.CombineIntoUnifiedXML))]
+ [UsedImplicitly]
+ public class CombineXmlPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix()
+ {
+ Log.Message("Loading Screen Manager :: Unify XML Tree :: Start");
+ Manager.currentStage = LoadingStage.UnifyXML;
+ }
+ }
+
+ [HarmonyPatch(typeof(LoadedModManager))]
+ [HarmonyPatch(nameof(LoadedModManager.ApplyPatches))]
+ [UsedImplicitly]
+ public class ApplyPatchesPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix()
+ {
+ Log.Message("Loading Screen Manager :: Apply XML Patches :: Start");
+ Manager.numPatchesToLoad = LoadedModManager.RunningMods.Count();
+ Manager.currentStage = LoadingStage.ApplyPatches;
+ }
+ }
+
+ [HarmonyPatch(typeof(ModContentPack))]
+ [HarmonyPatch("LoadPatches")]
+ [UsedImplicitly]
+ public class GetPatchesPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix(ModContentPack __instance)
+ {
+ Manager.currentlyPatching = __instance;
+ Manager.numPatchesLoaded++;
+ }
+ }
+
+ [HarmonyPatch(typeof(LoadedModManager))]
+ [HarmonyPatch(nameof(LoadedModManager.ParseAndProcessXML))]
+ [UsedImplicitly]
+ public class PAndPXmlPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix(XmlDocument xmlDoc)
+ {
+ Log.Message("Loading Screen Manager :: Pre-Parse XML Tree :: Start");
+ Manager.numDefsToProcess = xmlDoc.DocumentElement.ChildNodes.Count;
+
+ Manager.numDefsToPreProcess = 0;
+ var enumerator = xmlDoc.DocumentElement.ChildNodes.GetEnumerator();
+ while (enumerator.MoveNext())
+ {
+ if (((XmlNode) enumerator.Current).NodeType == XmlNodeType.Element) Manager.numDefsToPreProcess++;
+ }
+
+ Manager.currentStage = LoadingStage.ParseProcessXMLStage1;
+ }
+ }
+
+ [HarmonyPatch(typeof(XmlInheritance))]
+ [HarmonyPatch(nameof(XmlInheritance.TryRegister))]
+ [UsedImplicitly]
+ public class TryRegisterInheritancePatch
+ {
+ [UsedImplicitly]
+ public static void Prefix()
+ {
+ if (Manager.currentStage == LoadingStage.ParseProcessXMLStage1)
+ Manager.numDefsPreProcessed++;
+ }
+ }
+
+ [HarmonyPatch(typeof(XmlInheritance))]
+ [HarmonyPatch(nameof(XmlInheritance.Resolve))]
+ [UsedImplicitly]
+ public class ResolveInheritancePatch
+ {
+ [UsedImplicitly]
+ public static void Prefix()
+ {
+ if (Manager.currentStage == LoadingStage.ParseProcessXMLStage1)
+ {
+ Log.Message("Loading Screen Manager :: Process XML Tree :: Start");
+ Manager.currentStage = LoadingStage.ParseProcessXMLStage2;
+ }
+ }
+ }
+
+ [HarmonyPatch(typeof(DirectXmlLoader))]
+ [HarmonyPatch(nameof(DirectXmlLoader.DefFromNode))]
+ [UsedImplicitly]
+ public class DefFromNodePatch
+ {
+ [UsedImplicitly]
+ public static void Prefix()
+ {
+ Manager.numDefsProcessed++;
+ }
+ }
+
+ [HarmonyPatch(typeof(GenGeneric))]
+ [HarmonyPatch("MethodOnGenericType")]
+ [HarmonyPatch(new[] {typeof(Type), typeof(Type), typeof(string)})]
+ [UsedImplicitly]
+ public class DefDatabaseReferencesPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix(Type genericParam, string methodName)
+ {
+ if ((Manager.currentStage == LoadingStage.ParseProcessXMLStage2 ||
+ Manager.currentStage == LoadingStage.ResolveReferences)
+ && genericParam.IsSubclassOf(typeof(Def))
+ && methodName == "ResolveAllReferences")
+ {
+ Manager.currentDatabaseResolving = genericParam;
+ Manager.numDatabasesReloaded++;
+
+ if (Manager.currentStage != LoadingStage.ResolveReferences)
+ {
+ Log.Message("Loading Screen Manager :: Resolve References :: Start");
+ Manager.numDefDatabases = typeof(Def).AllSubclasses().Count() - 1; //-1 because Def subclasses Def. Or something.
+ Manager.currentStage = LoadingStage.ResolveReferences;
+ }
+ }
+ }
+ }
+
+ [HarmonyPatch(typeof(StaticConstructorOnStartupUtility))]
+ [HarmonyPatch(nameof(StaticConstructorOnStartupUtility.CallAll))]
+ [UsedImplicitly]
+ public class FinishUpPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix()
+ {
+ Log.Message("Loading Screen Manager :: Call Static CCtors :: Start");
+ Manager.currentStage = LoadingStage.FinishUp;
+ Manager.numStaticConstructorsToCall =
+ GenTypes.AllTypesWithAttribute().Count();
+ }
+ }
+
+ [HarmonyPatch(typeof(RuntimeHelpers))]
+ [HarmonyPatch(nameof(RuntimeHelpers.RunClassConstructor))]
+ [HarmonyPatch(new [] {typeof(RuntimeTypeHandle)})]
+ [UsedImplicitly]
+ public class RunClassConstructorPatch
+ {
+ [UsedImplicitly]
+ public static void Prefix(RuntimeTypeHandle type)
+ {
+ //This patch is really sketchy as it's more than possible that this could be called in a million and one places.
+ //Need to safeguard as much as is humanly possible.
+ if (Manager.currentStage != LoadingStage.FinishUp) return;
+ var typeImpl = Type.GetTypeFromHandle(type);
+ if(typeImpl.TryGetAttribute(out StaticConstructorOnStartup attrib))
+ {
+ //We are calling the constructor of a StaticConstructorOnStartup-Annotated class. In theory.
+ Manager.currentStaticConstructor = typeImpl;
+ Manager.numStaticConstructorsCalled++;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/Deps/0Harmony.dll b/Source/Deps/0Harmony.dll
new file mode 100644
index 0000000..1b6fa8e
Binary files /dev/null and b/Source/Deps/0Harmony.dll differ
diff --git a/Source/Deps/0Harmony.pdb b/Source/Deps/0Harmony.pdb
new file mode 100644
index 0000000..86ccee0
Binary files /dev/null and b/Source/Deps/0Harmony.pdb differ
diff --git a/Source/LoadingScreenManager.cs b/Source/LoadingScreenManager.cs
new file mode 100644
index 0000000..4a85010
--- /dev/null
+++ b/Source/LoadingScreenManager.cs
@@ -0,0 +1,179 @@
+using System;
+using UnityEngine;
+using Verse;
+using Harmony;
+
+namespace BetterLoading
+{
+ public class LoadingScreenManager : MonoBehaviour
+ {
+ public bool shouldShow = true;
+
+ public LoadingStage currentStage = LoadingStage.CreateClasses;
+
+ public ModContentPack currentlyLoadingDefsFrom;
+ public int totalLoadedContentPacks;
+ public int numContentPacksLoaded;
+
+ public int numPatchesToLoad;
+ public int numPatchesLoaded;
+ public ModContentPack currentlyPatching;
+
+ public int numDefsToPreProcess;
+ public int numDefsPreProcessed;
+
+ public int numDefsToProcess;
+ public int numDefsProcessed;
+
+ public int numDefDatabases;
+ public int numDatabasesReloaded;
+ public Type currentDatabaseResolving;
+
+ public int numStaticConstructorsToCall;
+ public int numStaticConstructorsCalled;
+ public Type currentStaticConstructor;
+
+ public LoadingScreenManager()
+ {
+ Log.Message("LoadingScreenManager :: Init");
+ }
+
+ public void OnGUI()
+ {
+ //In terms of stages, we have:
+ //
+ //Initialize mods - this just verifies files exist etc and is pre-instantiation so cannot be shown
+ //
+ //Load mod content - this loads assemblies and schedules the load of audio clips, textures, and strings. Again, pre-instantiation.
+ //
+ //Create mod classes (that's where this gets setup, so it's unlikely that we'll be able to display this fully/at all)
+ //
+ //Loading of xml files in defs folder (LoadedModManager#LoadModXML) - can be displayed as a progress bar
+ //
+ //XML Unification (LoadedModManager#CombineIntoUnifiedXML) - may be doable as a progress bar, may just be easier to show it's being done
+ //
+ //Patch application. Loaded per mod in ModContentPack#LoadPatches and then applied in blocks (a mod at a time) by PatchOperation#Apply (but this is overridden, so... does harmony work?)
+ // This runs as Load Mod Patches -> Apply one at a time -> load next mod -> apply -> etc
+ //
+ //Parse + Process XML. Two time consuming stages:
+ // - Register all inheritence nodes (XMLInheritence#TryRegister for each xmlDoc.DocumentElement.ChildNodes in param for LoadedModManager#ParseAndProcessXML)
+ // - Addition of Defs - DirectXmlLoader#DefFromNode for each def followed OPTIONALLY by DefPackage#AddDef if it loads (which not all of even the vanilla ones do).
+ //
+ //Freeing of memory (probably don't need to show) via LoadedModManager#ClearCachedPatches and XmlInheritance#Clear
+
+ if (!LongEventHandler.AnyEventNowOrWaiting)
+ {
+ shouldShow = false;
+ }
+
+ if(!shouldShow) return;
+
+ //Draw window
+ var rect = new Rect(100, 100, UI.screenWidth - 200, UI.screenHeight - 200);
+ rect = rect.Rounded();
+ UIMenuBackgroundManager.background.BackgroundOnGUI();
+ Widgets.DrawShadowAround(rect);
+ Widgets.DrawWindowBackground(rect);
+
+ Text.Font = GameFont.Medium;
+ Text.Anchor = TextAnchor.UpperCenter;
+
+ rect.y += 20; //Nudge down for title
+
+ Widgets.Label(rect, "BetterLoading :: Game Loading, Please Wait...");
+
+ Text.Font = GameFont.Small;
+ Text.Anchor = TextAnchor.UpperLeft;
+
+ rect.x += 20; //Indent
+ rect.width -= 20;
+
+ //------------------------Mod Construction------------------------
+ rect.y += 50; //Move down a bit
+ Widgets.Label(rect, currentStage == LoadingStage.CreateClasses ? "Constructing Mods" : "Mods Constructed");
+
+ //Draw a bar
+ var barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect, currentStage == LoadingStage.CreateClasses ? 0 : 1);
+
+ //------------------------Def XML Reading------------------------
+ rect.y += 50;
+ Widgets.Label(rect,
+ $"Reading Def XML ({numContentPacksLoaded}/{(totalLoadedContentPacks == 0 ? "" : "" + totalLoadedContentPacks)}): {(currentlyLoadingDefsFrom != null && currentlyLoadingDefsFrom.Name.Length > 0 ? currentlyLoadingDefsFrom.Name : "Waiting...")}");
+
+ //Draw a bar
+ barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect,
+ totalLoadedContentPacks == 0 ? 0 : (float) numContentPacksLoaded / totalLoadedContentPacks);
+
+ //------------------------XML Unification------------------------
+ rect.y += 50;
+ Widgets.Label(rect,
+ currentStage < LoadingStage.UnifyXML ? "Waiting for XML Load To Complete..." :
+ currentStage == LoadingStage.UnifyXML ? "Building Def Tree" : "Finished Building Def Tree");
+
+ //Draw a bar
+ barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect, currentStage <= LoadingStage.UnifyXML ? 0 : 1);
+
+ //------------------------Patch Application------------------------
+ rect.y += 50;
+ Widgets.Label(rect,
+ currentStage < LoadingStage.ApplyPatches ? "Waiting for XML Tree..." :
+ currentStage == LoadingStage.ApplyPatches ? $"Applying mod patches ({numPatchesLoaded}/{numPatchesToLoad}): {(currentlyPatching == null ? "" : currentlyPatching.Name)}"
+ : "Patches Applied");
+
+ //Draw a bar
+ barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect, currentStage < LoadingStage.ApplyPatches ? 0 : numPatchesLoaded / (float) numPatchesToLoad);
+
+ //------------------------XML Parse/Process Stage 1------------------------
+ rect.y += 50;
+ Widgets.Label(rect, currentStage < LoadingStage.ParseProcessXMLStage1
+ ? "Waiting for patches to be applied..."
+ : currentStage == LoadingStage.ParseProcessXMLStage1
+ ? $"Registering Defs from Patched XML: {numDefsPreProcessed}/{numDefsToPreProcess} ({((float) numDefsPreProcessed / numDefsToPreProcess).ToStringPercent()})"
+ : "Defs Registered");
+
+ barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect,
+ numDefsToPreProcess == 0 ? 0 : (float) numDefsPreProcessed / numDefsToPreProcess);
+
+ //------------------------XML Parse/Process Stage 2------------------------
+ rect.y += 50;
+ Widgets.Label(rect, currentStage < LoadingStage.ParseProcessXMLStage2
+ ? "Waiting for defs to be registered..."
+ : currentStage == LoadingStage.ParseProcessXMLStage2
+ ? $"Creating Defs from Patched XML: {numDefsProcessed}/{numDefsToProcess} ({((float) numDefsProcessed / numDefsToProcess).ToStringPercent()})"
+ : "Defs Created");
+
+ barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect,
+ numDefsToProcess == 0 ? 0 : (float) numDefsProcessed / numDefsToProcess);
+
+ //------------------------Reference Resolving------------------------
+ rect.y += 50;
+ Widgets.Label(rect, currentStage < LoadingStage.ResolveReferences
+ ? "Waiting for defs to be created..."
+ : currentStage == LoadingStage.ResolveReferences
+ ? $"Reloading DefDatabase: {currentDatabaseResolving.Name} ({numDatabasesReloaded}/{numDefDatabases})"
+ : "Databases Reloaded");
+
+ barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect,
+ numDefDatabases == 0 ? 0 : (float) numDatabasesReloaded / numDefDatabases);
+
+ //------------------------Finishing Up------------------------
+ rect.y += 50;
+ Widgets.Label(rect,
+ currentStage < LoadingStage.FinishUp ? "Waiting for databases to finish reload..." :
+ currentStage == LoadingStage.FinishUp ? $"Running Startup Static CCtors: {currentStaticConstructor?.FullName} ({numStaticConstructorsCalled}/{numStaticConstructorsToCall})" : "Finished");
+
+ barRect = new Rect(rect.x, rect.y + 25, rect.width - 24, 20);
+ Widgets.FillableBar(barRect,
+ numStaticConstructorsToCall == 0 ? 0 : (float) numStaticConstructorsCalled/ numStaticConstructorsToCall);
+
+ Text.Anchor = TextAnchor.UpperLeft; //Reset this
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/LoadingStage.cs b/Source/LoadingStage.cs
new file mode 100644
index 0000000..70dfd81
--- /dev/null
+++ b/Source/LoadingStage.cs
@@ -0,0 +1,14 @@
+namespace BetterLoading
+{
+ public enum LoadingStage
+ {
+ CreateClasses = 0,
+ ReadXMLFiles,
+ UnifyXML,
+ ApplyPatches,
+ ParseProcessXMLStage1,
+ ParseProcessXMLStage2,
+ ResolveReferences,
+ FinishUp,
+ }
+}
\ No newline at end of file
diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..94f6c6b
--- /dev/null
+++ b/Source/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("BetterLoading")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BetterLoading")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("E08CFC22-1BA8-41FE-A60B-491C308B8B65")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/Source/obj/Debug/BetterLoading.csproj.CopyComplete b/Source/obj/Debug/BetterLoading.csproj.CopyComplete
new file mode 100644
index 0000000..e69de29
diff --git a/Source/obj/Debug/BetterLoading.csproj.CoreCompileInputs.cache b/Source/obj/Debug/BetterLoading.csproj.CoreCompileInputs.cache
new file mode 100644
index 0000000..1058812
--- /dev/null
+++ b/Source/obj/Debug/BetterLoading.csproj.CoreCompileInputs.cache
@@ -0,0 +1 @@
+9d86387ebd00280539aae51cead6504262052aa2
diff --git a/Source/obj/Debug/BetterLoading.csproj.FileListAbsolute.txt b/Source/obj/Debug/BetterLoading.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..f5d4984
--- /dev/null
+++ b/Source/obj/Debug/BetterLoading.csproj.FileListAbsolute.txt
@@ -0,0 +1,30 @@
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\BetterLoading.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\BetterLoading.pdb
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\Assembly-CSharp.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\UnityEngine.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\TextMeshPro-1.0.55.56.0b11.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\Assembly-CSharp-firstpass.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\NAudio.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\NVorbis.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\bin\Debug\UnityEngine.UI.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\obj\Debug\BetterLoading.csprojAssemblyReference.cache
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\obj\Debug\BetterLoading.csproj.CoreCompileInputs.cache
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\obj\Debug\BetterLoading.csproj.CopyComplete
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\obj\Debug\BetterLoading.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\obj\Debug\BetterLoading.pdb
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Source\bin\Debug\BetterLoading.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Source\bin\Debug\BetterLoading.pdb
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Source\obj\Debug\BetterLoading.csprojAssemblyReference.cache
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Source\obj\Debug\BetterLoading.csproj.CoreCompileInputs.cache
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Source\obj\Debug\BetterLoading.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Source\obj\Debug\BetterLoading.pdb
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Assemblies\BetterLoading.dll
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Assemblies\BetterLoading.pdb
+C:\Users\Sam\RiderProjects\Rimworld Mods\BetterLoading\Source\obj\Debug\BetterLoading.csproj.CopyComplete
+C:\Users\Sam\Downloads\BetterLoading\BetterLoading\Source\obj\Debug\BetterLoading.csprojAssemblyReference.cache
+C:\Users\Sam\Downloads\BetterLoading\BetterLoading\Source\obj\Debug\BetterLoading.csproj.CoreCompileInputs.cache
+C:\Users\Sam\Downloads\BetterLoading\BetterLoading\Source\obj\Debug\BetterLoading.dll
+C:\Users\Sam\Downloads\BetterLoading\BetterLoading\Source\obj\Debug\BetterLoading.pdb
+C:\Users\Sam\Downloads\BetterLoading\BetterLoading\Assemblies\BetterLoading.dll
+C:\Users\Sam\Downloads\BetterLoading\BetterLoading\Assemblies\BetterLoading.pdb
+C:\Users\Sam\Downloads\BetterLoading\BetterLoading\Source\obj\Debug\BetterLoading.csproj.CopyComplete
diff --git a/Source/obj/Debug/BetterLoading.csprojAssemblyReference.cache b/Source/obj/Debug/BetterLoading.csprojAssemblyReference.cache
new file mode 100644
index 0000000..be15d7f
Binary files /dev/null and b/Source/obj/Debug/BetterLoading.csprojAssemblyReference.cache differ
diff --git a/Source/obj/Debug/BetterLoading.dll b/Source/obj/Debug/BetterLoading.dll
new file mode 100644
index 0000000..d923d46
Binary files /dev/null and b/Source/obj/Debug/BetterLoading.dll differ
diff --git a/Source/obj/Debug/BetterLoading.pdb b/Source/obj/Debug/BetterLoading.pdb
new file mode 100644
index 0000000..f3cfd35
Binary files /dev/null and b/Source/obj/Debug/BetterLoading.pdb differ