XmlMeta bug fix for IntFlags2

This commit is contained in:
dexy 2018-12-14 22:33:19 +11:00
parent f24691a586
commit 0ec052ddbc
2 changed files with 16 additions and 8 deletions

View File

@ -178,10 +178,12 @@ namespace CodeWalker.GameFiles
case MetaStructureEntryDataType.IntEnum: case MetaStructureEntryDataType.IntEnum:
case MetaStructureEntryDataType.IntFlags1: case MetaStructureEntryDataType.IntFlags1:
case MetaStructureEntryDataType.IntFlags2: case MetaStructureEntryDataType.IntFlags2:
{
if (entry.ReferenceKey != 0)
{ {
var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey); var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey);
mb.AddEnumInfo(_infos.EnumNameHash); mb.AddEnumInfo(_infos.EnumNameHash);
}
int val = GetEnumInt(entry.ReferenceKey, cnode.InnerText, entry.DataType); int val = GetEnumInt(entry.ReferenceKey, cnode.InnerText, entry.DataType);
Write(val, data, entry.DataOffset); Write(val, data, entry.DataOffset);
@ -189,10 +191,12 @@ namespace CodeWalker.GameFiles
} }
case MetaStructureEntryDataType.ShortFlags: case MetaStructureEntryDataType.ShortFlags:
{
if (entry.ReferenceKey != 0)
{ {
var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey); var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey);
mb.AddEnumInfo(_infos.EnumNameHash); mb.AddEnumInfo(_infos.EnumNameHash);
}
int val = GetEnumInt(entry.ReferenceKey, cnode.InnerText, entry.DataType); int val = GetEnumInt(entry.ReferenceKey, cnode.InnerText, entry.DataType);
Write((short)val, data, entry.DataOffset); Write((short)val, data, entry.DataOffset);

View File

@ -332,7 +332,9 @@ namespace CodeWalker.Forms
byte[] data = null; byte[] data = null;
#if !DEBUG
try try
#endif
{ {
switch (metaFormat) switch (metaFormat)
{ {
@ -358,11 +360,13 @@ namespace CodeWalker.Forms
return false; return false;
} }
} }
#if !DEBUG
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("Exception encountered!\r\n" + ex.Message, "Cannot convert XML"); MessageBox.Show("Exception encountered!\r\n" + ex.ToString(), "Cannot convert XML");
return false; return false;
} }
#endif
if (data == null) if (data == null)
{ {
MessageBox.Show("Schema not supported. (Unspecified error - data was null!)", "Cannot convert XML"); MessageBox.Show("Schema not supported. (Unspecified error - data was null!)", "Cannot convert XML");
@ -393,7 +397,7 @@ namespace CodeWalker.Forms
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("Error saving file to RPF! The RPF archive may be corrupted...\r\n" + ex.Message, "Really Bad Error"); MessageBox.Show("Error saving file to RPF! The RPF archive may be corrupted...\r\n" + ex.ToString(), "Really Bad Error");
} }
return false; return false;