Skip to content

Commit

Permalink
SplitMDL: Temporary fix for an issue that causes SA2 project creation…
Browse files Browse the repository at this point in the history
… to fail. Cannot test if it works via manual building so it's a shot in the dark.
  • Loading branch information
End-User-Person committed Nov 30, 2024
1 parent 2ea5604 commit ee14ffa
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions Libraries/SplitTools/SplitMDL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void Split(string filePath, string outputFolder, string[] animatio
{
mdlsplitfilenames = IniSerializer.Deserialize<Dictionary<int, string>>(mdllabelfile);
}
string[] mdlmetadata = new string[0];
string[] mdlmetadata = [];

// mtn labels
Dictionary<int, string> mtnsectionlist = new Dictionary<int, string>();
Expand All @@ -85,7 +85,7 @@ public static void Split(string filePath, string outputFolder, string[] animatio
{
mtnsplitpaths = IniSerializer.Deserialize<Dictionary<int, string>>(exmtnfile);
}
string[] exmtndata = new string[0];
string[] exmtndata = [];

// getting model pointers
int address = 0;
Expand Down Expand Up @@ -129,18 +129,19 @@ public static void Split(string filePath, string outputFolder, string[] animatio
i = ByteConverter.ToInt16(anifile, address);
while (i != -1)
{
if (mtnlabelfile != null)
{
mtnmetadata = mtnsplitfilenames[i].Split('|'); // Filename|Description
string outFilename = mtnmetadata[0];
if (!mtnmetadata[0].StartsWith("NO FILE"))
{
animmeta = mtnmetadata[1];
mtnsectionlist[i] = outFilename + "|" + animmeta;
}
else
mtnsectionlist[i] = "NULL";
}
// This doesn't work as of November 2024. Reimplement when fixed.
//if (mtnlabelfile != null)
//{
// mtnmetadata = mtnsplitfilenames[i].Split('|'); // Filename|Description
// string outFilename = mtnmetadata[0];
// if (!mtnmetadata[0].StartsWith("NO FILE"))
// {
// animmeta = mtnmetadata[1];
// mtnsectionlist[i] = outFilename + "|" + animmeta;
// }
// else
// mtnsectionlist[i] = "NULL";
//}
int aniaddr = ByteConverter.ToInt32(anifile, address + 4);
if (!processedanims.ContainsKey(aniaddr))
{
Expand Down Expand Up @@ -203,11 +204,11 @@ public static void Split(string filePath, string outputFolder, string[] animatio
IniSerializer.Serialize(mdlsectionlist, Path.Combine(outputFolder, mdlsectionListFilename));
}

if (mtnlabelfile != null)
{
string mtnsectionListFilename = Path.GetFileNameWithoutExtension(mtnlabelfile) + "_data.ini";
IniSerializer.Serialize(mtnsectionlist, Path.Combine(outputFolder, mtnsectionListFilename));
}
//if (mtnlabelfile != null)
//{
// string mtnsectionListFilename = Path.GetFileNameWithoutExtension(mtnlabelfile) + "_data.ini";
// IniSerializer.Serialize(mtnsectionlist, Path.Combine(outputFolder, mtnsectionListFilename));
//}

// save ini file
IniSerializer.Serialize(new MDLInfo() { BigEndian = ByteConverter.BigEndian, Indexes = modelnames },
Expand Down

0 comments on commit ee14ffa

Please sign in to comment.