mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 23:12:59 +08:00
Fixed sbyte types in handler of ArrayOfBytes
This commit is contained in:
parent
8baef77ecd
commit
e2b59d2ca5
@ -432,7 +432,6 @@ namespace CodeWalker.GameFiles
|
||||
switch (arrEntry.DataType)
|
||||
{
|
||||
default:
|
||||
case MetaStructureEntryDataType.SignedByte:
|
||||
for (int n = 0; n < byteArrLen; n++)
|
||||
{
|
||||
var bidx = eoffset + n;
|
||||
@ -440,6 +439,15 @@ namespace CodeWalker.GameFiles
|
||||
sb.Append(b.ToString("X").PadLeft(2, '0'));
|
||||
}
|
||||
break;
|
||||
case MetaStructureEntryDataType.SignedByte:
|
||||
for (int n = 0; n < byteArrLen; n++)
|
||||
{
|
||||
var bidx = eoffset + n;
|
||||
sbyte b = ((bidx >= 0) && (bidx < data.Length)) ? (sbyte)data[bidx] : (sbyte)0;
|
||||
sb.Append(b.ToString()); //sb.Append(b.ToString("X").PadLeft(2, '0')); to show HEX values
|
||||
if (n < byteArrLen - 1) sb.Append(" ");
|
||||
}
|
||||
break;
|
||||
|
||||
case MetaStructureEntryDataType.UnsignedByte:
|
||||
for (int n = 0; n < byteArrLen; n++)
|
||||
|
@ -301,12 +301,20 @@ namespace CodeWalker.GameFiles
|
||||
switch (arrEntry.DataType)
|
||||
{
|
||||
default:
|
||||
case MetaStructureEntryDataType.SignedByte:
|
||||
split = Split(node.InnerText, 2);
|
||||
for (int j = 0; j < split.Length; j++)
|
||||
{
|
||||
byte val = Convert.ToByte(split[j], 16);
|
||||
data[offset] = val;
|
||||
offset += sizeof(byte);
|
||||
}
|
||||
break;
|
||||
case MetaStructureEntryDataType.SignedByte:
|
||||
split = node.InnerText.Split(); //split = Split(node.InnerText, 2); to read as unsplitted HEX
|
||||
for (int j = 0; j < split.Length; j++)
|
||||
{
|
||||
sbyte val = Convert.ToSByte(split[j], 10);
|
||||
data[offset] = (byte)val;
|
||||
offset += sizeof(sbyte);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user