diff --git a/HipHopFile/Functions.cs b/HipHopFile/Functions.cs index d52d200..6ec156f 100644 --- a/HipHopFile/Functions.cs +++ b/HipHopFile/Functions.cs @@ -557,9 +557,9 @@ public static HipSection[] SetupStream(ref Section_HIPA HIPA, ref Section_PACK P // Sort the LDBG asset IDs. The AHDR data will then be written in this order. LHDR.assetIDlist = LHDR.assetIDlist.OrderBy(i => i).ToList(); - foreach (uint assetID in LHDR.assetIDlist) + for (int i = 0; i < LHDR.assetIDlist.Count; i++) { - Section_AHDR AHDR = assetDictionary[assetID]; + Section_AHDR AHDR = assetDictionary[LHDR.assetIDlist[i]]; // Does the AHDR section already have the asset data, or should we get it from the dictionary? // AHDRs from IP will already have data, but the ones from the INI builder won't! @@ -567,7 +567,10 @@ public static HipSection[] SetupStream(ref Section_HIPA HIPA, ref Section_PACK P { if (!assetDataDictionary.Keys.Contains(AHDR.assetID)) { - SendMessage($"Error: asset with ID [{AHDR.assetID.ToString("X8")}] was not found. The archive will not be saved correctly and will be unusable."); + SendMessage($"Error: asset with ID [{AHDR.assetID.ToString("X8")}] was not found. The asset will be removed from the archive."); + DICT.ATOC.AHDRList.Remove(AHDR); + LHDR.assetIDlist.Remove(AHDR.assetID); + i--; continue; } AHDR.data = assetDataDictionary[AHDR.assetID]; diff --git a/HipHopFile/Sections/Section_LTOC.cs b/HipHopFile/Sections/Section_LTOC.cs index ea9721e..57be5f1 100644 --- a/HipHopFile/Sections/Section_LTOC.cs +++ b/HipHopFile/Sections/Section_LTOC.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using static HipHopFile.Functions; namespace HipHopFile { diff --git a/HipHopTool/Program.cs b/HipHopTool/Program.cs index 4cb0306..a6d4607 100644 --- a/HipHopTool/Program.cs +++ b/HipHopTool/Program.cs @@ -12,7 +12,7 @@ static void Main(string[] args) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); - SendMessage("HipHopTool v0.4.8 by igorseabra4"); + SendMessage("HipHopTool v0.4.9 by igorseabra4"); if (args.Length == 0) ShowNoArgsMenu();