/// <summary> /// This function should discover all superbundles that are paired with the current game /// </summary> protected override void DiscoverSuperbundles() { var s_BaseLayout = Layout[0].Value as DbObject; // Check to ensure that we actually have a base layout if (s_BaseLayout == null) #if DEBUG { throw new Exception("No Superbundles found in Layout. This probably means data is corrupted or the engine you're trying to load is unsupported."); } #else { return; } #endif // Get the superbundle list var s_Superbundles = s_BaseLayout["superBundles"].Value as DbObject; // Ensure that we actually have the superbundles object before iterating if (s_Superbundles == null) #if DEBUG { throw new Exception("No Superbundles found in Layout. This probably means data is corrupted or the engine you're trying to load is unsupported."); } #else { return; } #endif // Iterate through each of the superbundles in the list for (var i = 0; i < s_Superbundles.Count; ++i) { var s_SuperBundleEntry = s_Superbundles[i].Value as DbObject; var s_Name = s_SuperBundleEntry?["name"]; if (s_Name == null) { continue; } // Get the path of the superbundle var s_SbPath = (string)s_Name.Value; // Create a new superbundle entry to keep track of the superbundle var s_Entry = new SuperbundleEntry(s_SbPath); // Figure out in which package this entry is in (if any). if (!FileSystem.FileExists("/game/Data/" + s_Entry.Name + ".sb") || !FileSystem.FileExists("/game/Data/" + s_Entry.Name + ".toc")) { foreach (var s_Package in Packages) { if (!FileSystem.FileExists("/game" + s_Package.Path + "/Data/" + s_Entry.Name + ".sb") || !FileSystem.FileExists("/game" + s_Package.Path + "/Data/" + s_Entry.Name + ".toc")) { continue; } s_Entry.ContainedPackage = s_Package; break; } // Base superbundle doesn't exist at all. if (s_Entry.ContainedPackage == null) { continue; } } // Check whether this entry also exists in the authoritative package. if (AuthoritativePackage != null && FileSystem.FileExists("/game" + AuthoritativePackage.Path + "/Data/" + s_Entry.Name + ".sb") && FileSystem.FileExists("/game" + AuthoritativePackage.Path + "/Data/" + s_Entry.Name + ".toc")) { s_Entry.AuthoritativePackage = AuthoritativePackage; } Superbundles.Add(s_Entry); } }
/// <summary> /// Constructor for handling Frostbite 2013.2 specific superbundles /// </summary> /// <param name="p_Reader"></param> /// <param name="p_Entry"></param> /// <param name="p_Authoritative"></param> public SuperbundleLayout(RimeReader p_Reader, SuperbundleEntry p_Entry, bool p_Authoritative) : base(p_Reader, p_Entry, p_Authoritative) { }