/// <summary> /// Converts pointers to references to other parsed BNSA objects. This allows us to export references rather than hard coded values for easy recompilation and editing of the outputted XML. /// </summary> /// <param name="parsedBNSA">BNSA File that has been parsed</param> public void ResolveReferences(BNSAFile parsedBNSA) { //foreach (Palette palette in parsedBNSA.Palettes) //{ // if (palette.Pointer == PalettePointer) // { // ResolvedPalette = palette; // break; // } //} foreach (Tileset tileset in parsedBNSA.Tilesets) { if (tileset.Pointer == TilesetPointer) { ResolvedTileset = tileset; break; } } foreach (OAMDataListGroup oamDataList in parsedBNSA.OAMDataListGroups) { if (oamDataList.Pointer == OAMDataListPointer) { ResolvedOAMDataListGroup = oamDataList; break; } } foreach (MiniAnimGroup minianimgroup in parsedBNSA.MiniAnimGroups) { if (minianimgroup.Pointer == MiniAnimationPointer) { ResolvedMiniAnimGroup = minianimgroup; ResolvedMiniAnimGroup.ResolveReferences(parsedBNSA, this); break; } } //if (ResolvedPalette != null) //{ // Console.WriteLine("----Resolved Palette Reference"); //} //else //{ // Console.WriteLine("----/!\\ Failed to Resolve Palette: 0x"+PalettePointer.ToString("X2")); //} if (ResolvedTileset != null) { Console.WriteLine("----Resolved Tileset Reference"); } else { Console.WriteLine("----/!\\ Failed to Resolve Tileset Pointer 0x" + TilesetPointer.ToString("X2")); throw new Exception("Failed to resolve mini-animation object."); } if (ResolvedMiniAnimGroup != null) { Console.WriteLine("----Resolved MiniAnim Reference"); } else { Console.WriteLine("----/!\\ Failed to Resolve MiniAnim 0x" + MiniAnimationPointer.ToString("X2")); throw new Exception("Failed to resolve mini-animation object."); } if (ResolvedOAMDataListGroup != null) { Console.WriteLine("----Resolved OAM Data List Reference"); } else { Console.WriteLine("----/!\\ Failed to Resolve OAM Data List 0x" + OAMDataListPointer.ToString("X2")); throw new Exception("Failed to resolve mini-animation object."); } //foreach (MiniAnim tileset in parsedBNSA.MiniAnimGroups) //{ // if (minianim.Pointer == TilesetPointer) // { // ResolvedMiniAnim = tileset; // break; // } //} }