diff --git a/source2/IL2PCU/Cosmos.IL2CPU/Cosmos.IL2CPU.csproj b/source2/IL2PCU/Cosmos.IL2CPU/Cosmos.IL2CPU.csproj index 21a7484b2..487209a9f 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/Cosmos.IL2CPU.csproj +++ b/source2/IL2PCU/Cosmos.IL2CPU/Cosmos.IL2CPU.csproj @@ -51,6 +51,7 @@ + diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILOpCode.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILOpCode.cs index 5606f8d9c..d0cd15f58 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILOpCode.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILOpCode.cs @@ -12,10 +12,10 @@ namespace Cosmos.IL2CPU { //TODO: Change this to an abstract class and make constructor protected public class ILOpCode { - public readonly Code Value; + public readonly Code OpCode; - public ILOpCode(Code aValue) { - Value = aValue; + public ILOpCode(Code aOpCode) { + OpCode = aOpCode; } //TODO: Use System.Reflection.Emit.OpCodes where possible, but we still need these diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILOpCodes/InlineI.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILOpCodes/InlineI.cs new file mode 100644 index 000000000..b1d53d043 --- /dev/null +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILOpCodes/InlineI.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cosmos.IL2CPU.ILOpCodes { + public class InlineI : ILOpCode { + public readonly UInt32 Value; + + public InlineI(Code aOpCode, UInt32 aValue) + : base(aOpCode) { + Value = aValue; + } + } +} diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILOpCodes/InlineNone.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILOpCodes/InlineNone.cs index 595155e9d..d84e3b005 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILOpCodes/InlineNone.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILOpCodes/InlineNone.cs @@ -6,7 +6,8 @@ using System.Text; namespace Cosmos.IL2CPU.ILOpCodes { public class InlineNone : ILOpCode { - public InlineNone(Code aValue) : base(aValue) { + public InlineNone(Code aOpCode) + : base(aOpCode) { } } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/ILReader.cs b/source2/IL2PCU/Cosmos.IL2CPU/ILReader.cs index 5029c9da3..523a0bd13 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/ILReader.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/ILReader.cs @@ -96,7 +96,7 @@ namespace Cosmos.IL2CPU { // The operand is a 32-bit integer. case OperandType.InlineI: xOperandSize = 4; - xILOpCode = new ILOpCode(xOpCodeVal); + xILOpCode = new ILOpCodes.InlineI(xOpCodeVal, ReadInt32(xIL, 1)); break; // The operand is a 64-bit integer. case OperandType.InlineI8: @@ -131,7 +131,7 @@ namespace Cosmos.IL2CPU { break; case OperandType.InlineSwitch: { - int xCount = ReadInt32(xIL, 1); + int xCount = (int)ReadInt32(xIL, 1); int[] xBranchLocations = new int[xCount]; uint[] xBranchValues = new uint[xCount]; for (int i = 0; i < xCount; i++) { @@ -204,8 +204,8 @@ namespace Cosmos.IL2CPU { return xResult; } - private Int32 ReadInt32(byte[] aBytes, int aPos) { - return (aBytes[aPos + 3] << 24 | aBytes[aPos + 2] << 16 | aBytes[aPos + 1] << 8 | aBytes[aPos]); + private UInt32 ReadInt32(byte[] aBytes, int aPos) { + return (UInt32)(aBytes[aPos + 3] << 24 | aBytes[aPos + 2] << 16 | aBytes[aPos + 1] << 8 | aBytes[aPos]); } //mOperandValueStr = mModule.ResolveString(OperandValueInt32);