Пример #1
0
 public XDRPCReference(IXboxConsole console, uint pointer, int size)
 {
     this.XboxConsole = console;
     this.BufferSize  = size;
     this.Pointer     = pointer;
     this._xboxName   = console[];
 }
Пример #2
0
        public static void XNotify(this IXboxConsole console, string text, XNotifyLogo icon)
        {
            string command = "consolefeatures ver=2" + " type=12 params=\"A\\0\\A\\2\\" + 2 + "/" + text.Length + "\\" + text.ConvertStringToHex(Encoding.ASCII) + "\\" + 1 + "\\";

            command += icon + "\\\"";
            console.SendTextCommand(0, command, out _);
        }
Пример #3
0
 public static short ReadInt16(this IXboxConsole xbCon, uint offset)
 {
     xbCon.DebugTarget.GetMemory(offset, 2, memoryBuffer, out _);
     xbCon.DebugTarget.InvalidateMemoryCache(true, offset, 2);
     Array.Reverse(memoryBuffer, 0, 2);
     return(BitConverter.ToInt16(memoryBuffer, 0));
 }
Пример #4
0
 public static byte[] ReadBytes(this IXboxConsole xbCon, uint offset, uint size)
 {
     byte[] temp = new byte[size];
     xbCon.DebugTarget.GetMemory(offset, size, temp, out _);
     xbCon.DebugTarget.InvalidateMemoryCache(true, offset, size);
     return(temp);
 }
Пример #5
0
 /// <summary>
 /// Connects to target.
 /// If platform doesn't require connection, just return true.
 /// IMPORTANT:
 /// Since NetCheat connects and attaches a few times after the user does (Constant write thread, searching, ect)
 /// You must have it automatically use the settings that the user input, instead of asking again
 /// This can be reset on Disconnect()
 /// </summary>
 public bool Connect()
 {
     this.xbManager = new XboxManager();
     this.xbCon     = this.xbManager.OpenConsole(this.xbManager.DefaultConsole);
     this.Xbox      = this.xbCon.OpenConnection(null);
     return(this.xbCon.Name != "");
 }
Пример #6
0
        public static TDelegate CreateDelegate <TDelegate>(
            this IXboxConsole console,
            XDRPCMode mode,
            string module,
            int ordinal)
        {
            if (!typeof(Delegate).IsAssignableFrom(typeof(TDelegate)))
            {
                throw new XDRPCInvalidArgumentTypeException(typeof(TDelegate), -1);
            }
            MethodInfo method = typeof(TDelegate).GetMethod("Invoke");

            Expression[] array = (Expression[])((IEnumerable <ParameterExpression>)((IEnumerable <ParameterInfo>)method.GetParameters()).Select <ParameterInfo, ParameterExpression>((Func <ParameterInfo, ParameterExpression>)(paramInfo => Expression.Parameter(paramInfo.ParameterType, paramInfo.Name))).ToArray <ParameterExpression>()).Select <ParameterExpression, UnaryExpression>((Func <ParameterExpression, UnaryExpression>)(paramInfo => Expression.Convert((Expression)paramInfo, typeof(object)))).ToArray <UnaryExpression>();
            Type         type  = method.ReturnType;

            if (method.ReturnType == typeof(void))
            {
                type = typeof(uint);
            }
            return(((Expression <TDelegate>)(() => Expression.Call(typeof(XDRPCMarshaler).GetMethod("ExecuteRPC", new Type[5]
            {
                typeof(IXboxConsole),
                typeof(XDRPCMode),
                typeof(string),
                typeof(int),
                typeof(object[])
            }).MakeGenericMethod(type), (Expression)Expression.Constant((object)console), (Expression)Expression.Constant((object)mode), (Expression)Expression.Constant((object)module), (Expression)Expression.Constant((object)ordinal), (Expression)Expression.NewArrayInit(typeof(object), array)))).Compile());
        }
Пример #7
0
 public static float ReadFloat(this IXboxConsole xbCon, uint offset)
 {
     xbCon.DebugTarget.GetMemory(offset, 4, memoryBuffer, out _);
     xbCon.DebugTarget.InvalidateMemoryCache(true, offset, 4);
     Array.Reverse(memoryBuffer, 0, 4);
     return(BitConverter.ToSingle(memoryBuffer, 0));
 }
Пример #8
0
 public static ulong ReadUInt64(this IXboxConsole xbCon, uint offset)
 {
     xbCon.DebugTarget.GetMemory(offset, 8, memoryBuffer, out _);
     xbCon.DebugTarget.InvalidateMemoryCache(true, offset, 8);
     Array.Reverse(memoryBuffer, 0, 8);
     return(BitConverter.ToUInt64(memoryBuffer, 0));
 }
Пример #9
0
 public static uint ReadUInt32(this IXboxConsole xbCon, uint offset)
 {
     xbCon.DebugTarget.GetMemory(offset, 4, memoryBuffer, out OutInt);
     xbCon.DebugTarget.InvalidateMemoryCache(true, offset, 4);
     Array.Reverse(memoryBuffer, 0, 4);
     return(BitConverter.ToUInt32(memoryBuffer, 0));
 }
Пример #10
0
        internal XDRPCExecutionState(
            IXboxConsole console,
            XDRPCExecutionOptions options,
            XDRPCArgumentInfo[] arguments,
            XDRPCExecutionState.XDRPCCallFlags flags)
        {
            this.Console     = console;
            this.Options     = options;
            this.ReturnValue = 0UL;
            this.PostMethodCallReturnValue = 0UL;
            this.callFlags = flags;
            List <XDRPCArgumentInfo> xdrpcArgumentInfoList = new List <XDRPCArgumentInfo>();

            for (int index = 0; index < arguments.Length; ++index)
            {
                if (arguments[index].IsFloatingPointValue())
                {
                    xdrpcArgumentInfoList.Add(arguments[index]);
                    arguments[index] = (XDRPCArgumentInfo) new XDRPCNullArgumentInfo();
                }
            }
            this.IntegerArguments       = arguments;
            this.FloatingPointArguments = xdrpcArgumentInfoList.ToArray();
            this.totalArgumentCount     = 0;
            for (int index = 0; index < this.IntegerArguments.Length; ++index)
            {
                this.totalArgumentCount += this.IntegerArguments[index].GetArgumentCount();
            }
            this.bufferData        = (XDRPCExecutionState.ArgumentBufferData[])null;
            this.totalBufferSize   = 0;
            this.connectionId      = 0U;
            this.bufferBaseAddress = 0U;
            this.callData          = (byte[])null;
        }
Пример #11
0
    public static void Connect()
    {
        m_XboxManager = new XboxManager();
        m_XboxConsole = m_XboxManager.OpenConsole(m_XboxManager.DefaultConsole);

        try
        {
            m_XboxConnection = m_XboxConsole.OpenConnection(null);
        }
        catch (Exception)
        {
            throw new Exception("Couldn't connect to console: " + m_XboxManager.DefaultConsole);
        }

        if (!m_XboxConsole.DebugTarget.IsDebuggerConnected(out string debuggerName, out string userName))
        {
            m_XboxConsole.DebugTarget.ConnectAsDebugger("XboxTool", XboxDebugConnectFlags.Force);

            if (!m_XboxConsole.DebugTarget.IsDebuggerConnected(out debuggerName, out userName))
            {
                throw new Exception("Couldn't connect a debugger to console: " + m_XboxConsole.Name);
            }
        }

        m_ActiveConnection = true;
    }
Пример #12
0
        public static uint GetTemperature(this IXboxConsole console, TemperatureFlag temperatureType)
        {
            object[] objArray = new object[] { "consolefeatures ver=", "2", " type=15 params=\"A\\0\\A\\1\\", typeof(int), @"\", (int)temperatureType, "\\\"" };
            string   command  = string.Concat(objArray);

            console.SendTextCommand(0, command, out string response);
            return(uint.Parse(response.Substring(response.Find(" ") + 1), NumberStyles.HexNumber));
        }
Пример #13
0
 public static T ExecuteRPC <T>(
     this IXboxConsole console,
     XDRPCExecutionOptions options,
     params object[] args)
     where T : struct
 {
     XDRPCArgumentInfo[] argumentInfoArray = XDRPCMarshaler.GenerateArgumentInfoArray(args);
     return(XDRPCMarshaler.ExecuteRPC <T>(console, options, argumentInfoArray));
 }
Пример #14
0
        public static string ReadString(this IXboxConsole xbCon, uint offset, byte[] readBuffer)
        {
            xbCon.DebugTarget.GetMemory(offset, (uint)readBuffer.Length, readBuffer, out _);
            xbCon.DebugTarget.InvalidateMemoryCache(true, offset, (uint)readBuffer.Length);
            string stringValue = new(Encoding.ASCII.GetChars(readBuffer));

            char[] separator = new char[1];
            return(stringValue.Split(separator)[0]);
        }
Пример #15
0
        public static void LoadModule(this IXboxConsole xbCon, string module)
        {
            if (module.Contains("\\") == false)
            {
                module = "Hdd:\\" + module;
            }

            xbCon.ExecuteRPC <uint>(XDRPCMode.System, "xboxkrnl.exe", 409, new object[] { module, 8, 0, 0 });
        }
Пример #16
0
 public static T ExecuteRPC <T>(
     this IXboxConsole console,
     XDRPCExecutionOptions options,
     out ulong postMethodCallReturn)
     where T : struct
 {
     XDRPCArgumentInfo[] xdrpcArgumentInfoArray = new XDRPCArgumentInfo[0];
     return(XDRPCMarshaler.ExecuteRPC <T>(console, options, out postMethodCallReturn, xdrpcArgumentInfoArray));
 }
Пример #17
0
 internal ConsoleProfile(string gamertag, Xuid onlineXuid, Xuid offlineXuid, SubscriptionTier tier, XboxLiveCountry country, IXboxConsole console, IProfileSupport profileSupport)
     : base(gamertag, onlineXuid)
 {
     this.OfflineXuid = offlineXuid;
     this.Tier = tier;
     this.Country = country;
     this.Console = console;
     this.profileSupport = profileSupport;
     //this.Friends = FriendsManagerFactory.CreateFriendsManager(this);
 }
Пример #18
0
        public static void UnloadModule(this IXboxConsole xbCon, string module)
        {
            uint handle = xbCon.ExecuteRPC <uint>(XDRPCMode.System, "xam.xex", 1102, new object[] { module });

            if (handle != 0u)
            {
                xbCon.WriteInt16(handle + 0x40, 1);
                xbCon.ExecuteRPC <uint>(XDRPCMode.System, "xboxkrnl.exe", 417, new object[] { handle });
            }
        }
Пример #19
0
 public static void LaunchXEX(this IXboxConsole console, string xexPath, string xexDirectory)
 {
     try
     {
         console.SendTextCommand(0, NewMethod(xexPath, xexDirectory), out _);
     }
     catch
     {
     }
 }
Пример #20
0
 public static void Shutdown(this IXboxConsole console)
 {
     try
     {
         console.SendTextCommand(0, "consolefeatures ver=" + "2" + " type=11 params=\"A\\0\\A\\0\\\"", out string response);
     }
     catch
     {
     }
 }
Пример #21
0
        public static T ExecuteRPC <T>(
            this IXboxConsole console,
            XDRPCExecutionOptions options,
            params XDRPCArgumentInfo[] args)
            where T : struct
        {
            ulong postMethodCallReturn;

            return(XDRPCMarshaler.ExecuteRPC <T>(console, options, out postMethodCallReturn, args));
        }
Пример #22
0
        public static void LaunchTitle(this IXboxConsole console, string path, string directory)
        {
            string[] lines = path.Split("\\".ToCharArray());

            for (int i = 0; i < lines.Length - 1; i++)
            {
                directory += lines[i] + "\\";
            }

            console.SendTextCommand(0, "magicboot title=\"" + path + "\" directory=\"" + directory + "\"", out _);
        }
Пример #23
0
 public static void WriteString(this IXboxConsole xbCon, uint Address, string String)
 {
     byte[] array = new byte[0];
     for (int i = 0; i < String.Length; i++)
     {
         byte value = (byte)String[i];
         array.Push(out array, value);
     }
     array.Push(out array, 0);
     xbCon.DebugTarget.SetMemory(Address, (uint)array.Length, array, out _);
 }
Пример #24
0
        public static T ExecuteRPC <T>(
            this IXboxConsole console,
            string threadName,
            uint functionAddress,
            params object[] args)
            where T : struct
        {
            XDRPCExecutionOptions options = new XDRPCExecutionOptions(threadName, functionAddress);

            XDRPCArgumentInfo[] argumentInfoArray = XDRPCMarshaler.GenerateArgumentInfoArray(args);
            return(XDRPCMarshaler.ExecuteRPC <T>(console, options, argumentInfoArray));
        }
Пример #25
0
        public static T ExecuteRPC <T>(
            this IXboxConsole console,
            XDRPCMode mode,
            string module,
            int ordinal,
            params object[] args)
            where T : struct
        {
            XDRPCExecutionOptions options = new XDRPCExecutionOptions(mode, module, ordinal);

            XDRPCArgumentInfo[] argumentInfoArray = XDRPCMarshaler.GenerateArgumentInfoArray(args);
            return(XDRPCMarshaler.ExecuteRPC <T>(console, options, argumentInfoArray));
        }
Пример #26
0
        public static T ExecuteRPC <T>(
            this IXboxConsole console,
            string threadName,
            string module,
            int ordinal,
            out ulong postMethodCallReturn,
            params object[] args)
            where T : struct
        {
            XDRPCExecutionOptions options = new XDRPCExecutionOptions(threadName, module, ordinal);

            XDRPCArgumentInfo[] argumentInfoArray = XDRPCMarshaler.GenerateArgumentInfoArray(args);
            return(XDRPCMarshaler.ExecuteRPC <T>(console, options, out postMethodCallReturn, argumentInfoArray));
        }
Пример #27
0
        public static string GetCPUKey(this IXboxConsole xbCon)
        {
            byte[] RPC = new byte[] { 0x38, 0x00, 0x00, 0x71, 0x44, 0x00, 0x00, 0x02, 0x4E, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00 };

            xbCon.DebugTarget.SetMemory(0x81B44688, 16, RPC, out outInt);
            UInt64 CPU1 = xbCon.ExecuteRPC <UInt64>(new XDRPCExecutionOptions(XDRPCMode.Title, 0x81B44688), new object[] { 0x48565050, 3, 0x8000020000020600 });
            UInt64 CPU2 = xbCon.ExecuteRPC <UInt64>(new XDRPCExecutionOptions(XDRPCMode.Title, 0x81B44688), new object[] { 0x48565050, 3, 0x8000020000020800 });
            UInt64 CPU3 = xbCon.ExecuteRPC <UInt64>(new XDRPCExecutionOptions(XDRPCMode.Title, 0x81B44688), new object[] { 0x48565050, 3, 0x8000020000020A00 });
            UInt64 CPU4 = xbCon.ExecuteRPC <UInt64>(new XDRPCExecutionOptions(XDRPCMode.Title, 0x81B44688), new object[] { 0x48565050, 3, 0x8000020000020C00 });

            xbCon.DebugTarget.SetMemory(0x81B44688, 16, new byte[16], out outInt);

            return(String.Format("{0}{1}", (CPU1 | CPU2).ToString("X8"), (CPU3 | CPU4).ToString("X8")));
        }
Пример #28
0
        public static bool SupportsRPC(this IXboxConsole console)
        {
            bool flag = true;

            try
            {
                console.ExecuteRPC <int>(XDRPCMode.System, "xbdm.xex", 117, (object)0);
            }
            catch (XDRPCException ex)
            {
                flag = false;
            }
            return(flag);
        }
Пример #29
0
        public static XDRPCReference AllocateRPC <T>(
            this IXboxConsole console,
            XDRPCMode mode)
            where T : struct
        {
            Type t = typeof(T);

            if (!XDRPCMarshaler.IsValidArgumentType(t))
            {
                throw new XDRPCInvalidTypeException(t, string.Format("Invalid type {0}: Cannot allocate type not supported by XDRPC.", (object)t.Name));
            }
            XDRPCArgumentInfo argumentInfo = XDRPCMarshaler.GenerateArgumentInfo(t, (object)default(T), ArgumentType.ByRef);

            return(console.AllocateRPC(argumentInfo, mode));
        }
Пример #30
0
 public static XDRPCReference AllocateRPC(
     this IXboxConsole console,
     XDRPCArgumentInfo lpvBufArg,
     XDRPCMode mode)
 {
     if (lpvBufArg.PassBy == ArgumentType.ByValue)
     {
         throw new XDRPCInvalidOperationException("Allocating XDRPCArgumentInfo with ByValue argument type is not allowed.");
     }
     if (lpvBufArg.GetRequiredReferenceSize() > 0)
     {
         throw new XDRPCInvalidOperationException("Struct type containing references is not supported by the XDRPC allocation system. You will need to use the XDRPC allocation system to create the data for the references on the Xbox and change the struct to have uints filled with the XDRPCReference.Pointer values for that data instead of the references. See the How to Use XDRPC documentation for more info.");
     }
     return(console.AllocateRPC(lpvBufArg.GetRequiredBufferSize(), mode));
 }
Пример #31
0
        public bool ConnectToConsole()
        {
            if (!this.activeConnection)
            {
                this.xbManager = new XboxManager();
                this.xbCon     = this.xbManager.OpenConsole(this.xbManager.DefaultConsole);

                try {
                    this.xboxConnection = this.xbCon.OpenConnection(null);
                }
                catch (Exception) {
                    ConnectionStatusLabel.Text = "Could not connect to console: " + this.xbManager.DefaultConsole;
                    return(false);
                }
                if (this.xbCon.DebugTarget.IsDebuggerConnected(out this.debuggerName, out this.userName))
                {
                    this.activeConnection      = true;
                    ConnectionStatusLabel.Text = "Connection to " + xbCon.Name + " established!";
                    return(true);
                }
                else
                {
                    this.xbCon.DebugTarget.ConnectAsDebugger("Xbox Toolbox", XboxDebugConnectFlags.Force);
                    if (!this.xbCon.DebugTarget.IsDebuggerConnected(out this.debuggerName, out this.userName))
                    {
                        ConnectionStatusLabel.Text = "Attempted to connect to console: " + xbCon.Name + " but failed";
                        return(false);
                    }
                    else
                    {
                        this.activeConnection      = true;
                        ConnectionStatusLabel.Text = "Connection to " + xbCon.Name + " established!";
                        return(true);
                    }
                }
            }
            else if (this.xbCon.DebugTarget.IsDebuggerConnected(out this.debuggerName, out this.userName))
            {
                ConnectionStatusLabel.Text = "Connection to " + xbCon.Name + " already established!";
                return(true);
            }
            else
            {
                this.activeConnection = false;
                return(ConnectToConsole());
            }
        }