예제 #1
0
        private void pokeToolStripButton_Click(object sender, EventArgs e)
        {
            //Loop
            foreach (DataObject dataObject in wrapper.GetAllObjects())
            {
                //Prepare
                byte[] buffer = null;

                //Check
                switch (dataObject.Node.Type)
                {
                case IfpNodeType.SignedByte: buffer = BitConverter.GetBytes((sbyte)dataObject.Value); break;

                case IfpNodeType.Int: buffer = BitConverter.GetBytes((int)dataObject.Value); break;

                case IfpNodeType.Short: buffer = BitConverter.GetBytes((short)dataObject.Value); break;

                case IfpNodeType.Long: buffer = BitConverter.GetBytes((long)dataObject.Value); break;

                case IfpNodeType.Single: buffer = BitConverter.GetBytes((float)dataObject.Value); break;

                case IfpNodeType.Double: buffer = BitConverter.GetBytes((double)dataObject.Value); break;

                case IfpNodeType.Byte:
                case IfpNodeType.Enumerator8:
                case IfpNodeType.Bitfield8: buffer = BitConverter.GetBytes((byte)dataObject.Value); break;

                case IfpNodeType.UnsignedShort:
                case IfpNodeType.Enumerator16:
                case IfpNodeType.Bitfield16: buffer = BitConverter.GetBytes((ushort)dataObject.Value); break;

                case IfpNodeType.UnsignedInt:
                case IfpNodeType.Enumerator32:
                case IfpNodeType.Bitfield32: buffer = BitConverter.GetBytes((uint)dataObject.Value); break;

                case IfpNodeType.UnsignedLong:
                case IfpNodeType.Enumerator64:
                case IfpNodeType.Bitfield64: buffer = BitConverter.GetBytes((ulong)dataObject.Value); break;

                case IfpNodeType.TagId: buffer = BitConverter.GetBytes((uint)(TagId)dataObject.Value); break;

                case IfpNodeType.StringId: buffer = BitConverter.GetBytes((uint)(StringId)dataObject.Value); break;

                case IfpNodeType.String32: buffer = Encoding.UTF8.GetBytes(((string)dataObject.Value).PadRight(32, '\0').Substring(0, 32)); break;

                case IfpNodeType.String64: buffer = Encoding.UTF8.GetBytes(((string)dataObject.Value).PadRight(64, '\0').Substring(0, 64)); break;

                case IfpNodeType.Unicode128: buffer = Encoding.UTF8.GetBytes(((string)dataObject.Value).PadRight(128, '\0').Substring(0, 128)); break;

                case IfpNodeType.Unicode256: buffer = Encoding.UTF8.GetBytes(((string)dataObject.Value).PadRight(256, '\0').Substring(0, 256)); break;
                }

                //Set Xbox memory
                if (buffer != null)
                {
                    Xbox.SetMemory(dataObject.Address, buffer, buffer.Length);
                }
            }
        }
예제 #2
0
 private void MapReset_Click(object sender, EventArgs e)
 {
     //Reset
     if (Xbox != null && Xbox.Connected)
     {
         Xbox.SetMemory(0x547F6E, new byte[] { 1, 1 }, 2);
     }
 }
예제 #3
0
        /// <summary>
        /// The poke.
        /// </summary>
        /// <param name="Addr">The addr.</param>
        /// <param name="Data">The data.</param>
        /// <param name="size">The size in bits.</param>
        /// <remarks></remarks>
        //[DllImport("RthDLL.dll", CharSet = CharSet.Ansi)]
        public static void Poke(uint Addr, uint Data, int size)
        {
            if (!_IsConnected)
            {
                return;
            }
            // Calculate the offset

            switch (connectedDebugType)
            {
            case debugType.RthDLL:
                uint Ptr = BaseAddress + (Addr - VirtMatgOffset);

                // Init connection
                uint con = console.OpenConnection(null);

                // Poke
                uint   Out   = 0;
                byte[] Bytes = BitConverter.GetBytes(Data);
                console.DebugTarget.SetMemory(Ptr, (uint)(size / 8), Bytes, out Out);

                // Close connection
                console.CloseConnection(con);
                break;

            case debugType.YeloDebug:
                switch (size)
                {
                case 1:
                    xboxDebug.SetMemory(Addr, (Byte)Data);
                    break;

                case 2:
                    xboxDebug.SetMemory(Addr, (UInt16)Data);
                    break;

                case 4:
                    xboxDebug.SetMemory(Addr, (UInt32)Data);
                    break;
                }
                break;
            }
        }