void LoadGFFsFromRIMs(string moduleDir, Dictionary <string, ClassDefinition> defs, Compatibility compat, ExistsIn existsIn) { // We load every module in the game files // Find the list of module names // TODO: Implement this for KOTOR 2, which uses a different file structure foreach (string filename in Directory.GetFiles(moduleDir)) { //Debug.Log("Loading " + filename); RIMObject obj = new RIMObject(filename); List <RIMObject.Resource> resources = new List <RIMObject.Resource>(obj.resources.Values); //Debug.Log(resources.Count()); for (int i = 0; i < resources.Count(); i++) { RIMObject.Resource resource = resources[i]; LoadRIM(obj, resource, defs, compat, existsIn); } } }
void LoadRIM(RIMObject obj, RIMObject.Resource resource, Dictionary <string, ClassDefinition> defs, Compatibility compat, ExistsIn existsIn) { if (!gffTypes.Contains(resource.ResType)) { return; } try { //Debug.Log("Loading resource " + resource.ResRef); string className = "Aurora" + resource.ResType.ToString().ToUpper().Replace(" ", ""); // Load the resource from the RIM Stream stream = obj.GetResource(resource.ResRef, resource.ResType); GFFObject gffObject = new GFFLoader(stream).GetObject(); LoadGFF(gffObject, defs, className, compat, existsIn); } catch { // Just keep going Debug.LogWarning("Failed to load " + resource.ResRef); } }