Ejemplo n.º 1
1
 public static ExecutionID XamGetExecutionId(XboxConsole Console)
 {
     var ppExecutionId = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 640, ppExecutionId);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
     if (ppExecutionId.Value == 0) throw new Exception("XDKUtilities.XamGetExecutionId: Invalid pointer returned.");
     //The above only gets the pointer in console memory to the Execution ID. We still have to grab it below.
     //Props to MS devs for making a really nice function to do this.
     using (var refr = new XDRPCReference(Console, ppExecutionId.Value, 24)) return refr.Get<ExecutionID>();
 }
Ejemplo n.º 2
1
 /// <summary>
 /// The init rth.
 /// </summary>
 /// <param name="IP">The ip.</param>
 /// <returns>The init rth.</returns>
 /// <remarks></remarks>
 //[DllImport("RthDLL.dll", CharSet = CharSet.Ansi)]
 public static debugType InitRTH(string IP)
 {
     // Try to connect
     try
     {
         InitYeloDebug(IP);
         connectedDebugType = debugType.YeloDebug;
         _IsConnected = true;
         return debugType.YeloDebug;
     }
     catch (Exception ex1)
     {
         if (IP == "<Auto>")
         {
             Globals.Global.ShowErrorMsg("Could not connect to a Yelo debug Xbox and RthDLL does not support <Auto> Mode.", ex1);
             return debugType.None;
         }
         else
         try
         {
             console = new XboxManagerClass().OpenConsole(IP);
             _debugIP = IP;
             connectedDebugType = debugType.RthDLL;
             _IsConnected = true;
             return debugType.RthDLL;
         }
         catch (Exception ex2)
         {
             Globals.Global.ShowErrorMsg("Could not connect to a debug Xbox", ex2);
             return debugType.None;
         }
     }
 }
Ejemplo n.º 3
1
 public static XAMACCOUNTINFO XamProfileFindAccount(XboxConsole Console, ulong OfflineXUID)
 {
     if (!XUID.IsOfflineXUID(OfflineXUID)) throw new Exception("XDKUtilities.XamProfileFindAccount: Invalid offline XUID specified.");
     var xuidOffline = new XDRPCArgumentInfo<ulong>(OfflineXUID);
     var pAccountInfo = new XDRPCStructArgumentInfo<XAMACCOUNTINFO>(new XAMACCOUNTINFO(), ArgumentType.Out);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 565, xuidOffline, pAccountInfo);
     //if (returnVal != 0x00000000) throw ProfilesExceptionFactory.CreateExceptionFromErrorCode(returnVal);
     return pAccountInfo.Value;
 }
Ejemplo n.º 4
0
        public static XboxFileInfo CopyTo(this FileInfo fileInfo, XboxPath xboxPath, XboxConsole console, IProgress <XboxFileTransferMetric> metrics)
        {
            if (fileInfo == null)
            {
                throw new ArgumentNullException("fileInfo");
            }

            if (xboxPath == null)
            {
                throw new ArgumentNullException("xboxPath");
            }

            if (console == null)
            {
                throw new ArgumentNullException("console");
            }

            if (!fileInfo.Exists)
            {
                throw new FileNotFoundException("Cannot copy a file that does not exist", fileInfo.FullName);
            }

            console.Adapter.SendFile(console.SystemIpAddressAndSessionKeyCombined, fileInfo.FullName, xboxPath, metrics);

            return(new XboxFileInfo(xboxPath, console));
        }
Ejemplo n.º 5
0
        public static void XamShowMessageComposeUI(XboxConsole Console, uint XUserIndex, ulong[] Recipients = null, string MessageText = "")
        {
            if (XUserIndex > 3)
            {
                throw new Exception("XDKUtilities.XamShowMessageComposeUI: Invalid user index specified.");
            }
            if (Recipients != null)
            {
                if (Recipients.Length > 64)
                {
                    throw new Exception("XDKUtilities.XamShowMessageComposeUI: Too many recipients specified. The maximum is 64.");
                }
                if (Recipients.Any(recipient => !XUID.IsOnlineXUID(recipient) && !XUID.IsTeamXUID(recipient)))
                {
                    throw new Exception("XDKUtilities.XamShowMessageComposeUI: Invalid recipient online/team XUID specified.");
                }
            }
            if (MessageText.Length > 255)
            {
                throw new Exception("XDKUtilities.XamShowMessageComposeUI: Specified message text is invalid. It must be less than or equal to 255 characters in length.");
            }
            var dwUserIndex     = new XDRPCArgumentInfo <uint>(XUserIndex);
            var pXuidRecipients = Recipients == null || Recipients.Length == 0 ? new XDRPCNullArgumentInfo() : (XDRPCArgumentInfo) new XDRPCArrayArgumentInfo <ulong[]>(Recipients);
            var cRecipients     = Recipients == null ? 0 : Recipients.Length;
            var pszText         = string.IsNullOrWhiteSpace(MessageText) ? new XDRPCNullArgumentInfo() : (XDRPCArgumentInfo) new XDRPCStringArgumentInfo(MessageText, Encoding.BigEndianUnicode);
            var returnVal       = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 716, dwUserIndex, pXuidRecipients, cRecipients, pszText);

            if (returnVal != 0x00000000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
        }
Ejemplo n.º 6
0
        private void LoadLaunchFileData()
        {
            try
            {
                Directory.CreateDirectory(LocalLaunchBackupFileDirectory);
                Directory.CreateDirectory(LocalLaunchFileDirectory);

                XboxConsole.ReceiveFile(LocalLaunchBackupFilePath, ConsoleLaunchFilePath);
                XboxConsole.ReceiveFile(LocalLaunchFilePath, ConsoleLaunchFilePath);

                LaunchFileData = new FileIniDataParser().ReadFile(LocalLaunchFilePath);

                ComboBoxSections.Properties.Items.Clear();

                foreach (SectionData section in LaunchFileData.Sections)
                {
                    ComboBoxSections.Properties.Items.Add(section.SectionName);
                }

                ComboBoxSections.SelectedItem = "Plugins";
            }
            catch (Exception ex)
            {
                Program.Log.Error(ex, $"There was a problem loading the launch.ini file. Error: {ex.Message}");
                XtraMessageBox.Show($"There was a problem loading the launch.ini file.\n\nError: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Open a connection to the XBox Console
        /// </summary>
        /// <returns>true if the connection was successful.</returns>
        public bool Connect()
        {
            if (!IsConnected)
            {
                try
                {
                    _xboxManager        = new XboxManager();
                    _xboxConsole        = _xboxManager.OpenConsole(DeviceIdent);
                    _xboxDebugTarget    = _xboxConsole.DebugTarget;
                    _xboxConnectionCode = _xboxConsole.OpenConnection(null);
                }
                catch
                {
                    _xboxManager     = null;
                    _xboxConsole     = null;
                    _xboxDebugTarget = null;
                    return(false);
                }

                try
                {
                    XboxType = _xboxConsole.ConsoleType.ToString();
                }
                catch
                {
                    XboxType = "Unable to get.";
                }

                IsConnected = true;
            }
            return(true);
        }
Ejemplo n.º 8
0
        public static void XamShowGameInviteUI(XboxConsole Console, uint XUserIndex, ulong[] Recipients = null)
        {
            if (XUserIndex > 3)
            {
                throw new Exception("XDKUtilities.XamShowGameInviteUI: Invalid user index specified.It must be less than or equal to 3.");
            }
            if (Recipients != null)
            {
                if (Recipients.Length > 64)
                {
                    throw new Exception("XDKUtilities.XamShowGameInviteUI: Too many recipients specified. The maximum is 64.");
                }
                if (Recipients.Any(recipient => !XUID.IsOnlineXUID(recipient) && !XUID.IsTeamXUID(recipient)))
                {
                    throw new Exception("XDKUtilities.XamShowGameInviteUI: Invalid recipient online/team XUID specified.");
                }
            }
            var dwUserIndex     = new XDRPCArgumentInfo <uint>(XUserIndex);
            var pXuidRecipients = Recipients == null || Recipients.Length == 0 ? new XDRPCNullArgumentInfo() : (XDRPCArgumentInfo) new XDRPCArrayArgumentInfo <ulong[]>(Recipients);
            var cRecipients     = Recipients == null ? 0 : Recipients.Length;
            var returnVal       = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 717, dwUserIndex, pXuidRecipients, cRecipients);

            if (returnVal != 0x00000000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// The init rth.
 /// </summary>
 /// <param name="IP">The ip.</param>
 /// <returns>The init rth.</returns>
 /// <remarks></remarks>
 //[DllImport("RthDLL.dll", CharSet = CharSet.Ansi)]
 public static debugType InitRTH(string IP)
 {
     // Try to connect
     try
     {
         InitYeloDebug(IP);
         connectedDebugType = debugType.YeloDebug;
         _IsConnected       = true;
         return(debugType.YeloDebug);
     }
     catch (Exception ex1)
     {
         if (IP == "<Auto>")
         {
             Globals.Global.ShowErrorMsg("Could not connect to a Yelo debug Xbox and RthDLL does not support <Auto> Mode.", ex1);
             return(debugType.None);
         }
         else
         {
             try
             {
                 console            = new XboxManagerClass().OpenConsole(IP);
                 _debugIP           = IP;
                 connectedDebugType = debugType.RthDLL;
                 _IsConnected       = true;
                 return(debugType.RthDLL);
             }
             catch (Exception ex2)
             {
                 Globals.Global.ShowErrorMsg("Could not connect to a debug Xbox", ex2);
                 return(debugType.None);
             }
         }
     }
 }
Ejemplo n.º 10
0
 public XUIDGTConversionForm(XboxConsole Console, ulong P1XUID, uint XUserFindUserAddress)
 {
     InitializeComponent();
     console = Console;
     p1XUID  = P1XUID;
     address = XUserFindUserAddress;
 }
Ejemplo n.º 11
0
        public void TestProcessRunPassesCorrectValues()
        {
            ShimXboxProcess.RunXboxConsoleStringStringXboxOperatingSystemActionOfString =
                (console, fileName, arguments, operatingSystem, outputReceivedCallback) =>
            {
                Type processType = typeof(XboxProcess);
                CheckRunExecutableValueEquality(processType, console.SystemIpAddress.ToString(), fileName, arguments, operatingSystem, outputReceivedCallback);
            };

            ShimXboxConsoleAdapterBase.AllInstances.RunExecutableStringStringStringXboxOperatingSystemActionOfString =
                (adapter, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback) =>
            {
                Type adapterType = typeof(XboxConsoleAdapterBase);
                CheckRunExecutableValueEquality(adapterType, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback);
            };

            ShimXboxXdkBase.AllInstances.RunExecutableStringStringStringXboxOperatingSystemActionOfString =
                (x, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback) =>
            {
                Type xdkType = typeof(XboxXdkBase);
                CheckRunExecutableValueEquality(xdkType, toolsIP, fileName, arguments, operatingSystem, outputReceivedCallback);
            };

            using (this.xboxConsole = new XboxConsole(this.processRunTestIPAddress))
            {
                XboxProcess.Run(this.xboxConsole, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem, this.processRunTestAction);
                this.processRunTestAction = null;
                XboxProcess.Run(this.xboxConsole, ProcessRunTestFileName, ProcessRunTestArguments, ProcessRunTestOperatingSystem);
            }
        }
Ejemplo n.º 12
0
        public static void LaunchModule(XboxConsole Console, uint ConsoleConnection, string ModulePath)
        {
            var    tmpString = ModulePath.Replace('\\', '~').Split('~');
            var    directory = ModulePath.Substring(0, (ModulePath.Length - tmpString[tmpString.Length - 1].Length) - 1);
            string outsts;
            string command;

            if (directory.Contains("\\"))
            {
                command = string.Format("magicboot title=\"{0}\"" + " directory=\"{1}\"", ModulePath, directory);
            }
            else
            {
                //We can only launch from the FLASH root.
                if (string.CompareOrdinal(directory, "FLASH:") == 0)
                {
                    command = string.Format("magicboot title=\"{0}\"", ModulePath);
                }
                else
                {
                    throw new Exception("XDKUtilities.LaunchModule: You can only launch modules from the FLASH root, not any others.");
                }
            }
            Console.SendTextCommand(ConsoleConnection, command, out outsts);
        }
Ejemplo n.º 13
0
        public static bool XamFeatureEnabled(XboxConsole Console, XamAppIDs AppID)
        {
            var appID     = new XDRPCArgumentInfo <uint>((uint)AppID);
            var returnVal = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 512, appID);

            return(Convert.ToBoolean(returnVal));
        }
Ejemplo n.º 14
0
        public static void XNotifyQueueUI(XboxConsole Console, uint XUserIndex, XNotifyUITypes XNotifyUIType, XNotifyUIPriorities XNotifyUIPriority, string XNotifyMessage)
        {
            if (XUserIndex > 3)
            {
                throw new Exception("XDKUtilities.XNotifyQueueUI: Invalid user index specified. It must be less than or equal to 3.");
            }
            if (!Enum.IsDefined(typeof(XNotifyUITypes), XNotifyUIType))
            {
                throw new Exception("XDKUtilities.XNotifyQueueUI: Invalid notification type specified.");
            }
            if (!Enum.IsDefined(typeof(XNotifyUIPriorities), XNotifyUIPriority))
            {
                throw new Exception("XDKUtilities.XNotifyQueueUI: Invalid notification priority specified.");
            }
            var dwType          = new XDRPCArgumentInfo <uint>((uint)XNotifyUIType);
            var dwUserIndex     = new XDRPCArgumentInfo <uint>(XUserIndex);
            var dwPriority      = new XDRPCArgumentInfo <uint>((uint)XNotifyUIPriority);
            var pwszStringParam = new XDRPCStringArgumentInfo(XNotifyMessage, Encoding.BigEndianUnicode);
            var returnVal       = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 656, dwType, dwUserIndex, dwPriority, pwszStringParam);

            if (returnVal != 0x00000000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
        }
Ejemplo n.º 15
0
 public Boolean ConnectTarget()
 {
     if (!IsConnected)
     {
         try
         {
             xboxMgr        = new XboxManager();
             xbCon          = xboxMgr.OpenConsole(DeviceIdent);
             dbgXbox        = xbCon.DebugTarget;
             connectioncode = xbCon.OpenConnection(null);
             IsConnected    = true;
         }
         catch
         {
             xbCon   = null;
             xboxMgr = null;
             dbgXbox = null;
             return(false);
         }
         try
         {
             XboxType = xbCon.ConsoleType.ToString();
         }
         catch
         {
             XboxType = "Can't get";
         }
     }
     return(IsConnected);
 }
Ejemplo n.º 16
0
        static private eErrorType changeCurrentConsole(String consoleName)
        {
            if (mThread != null)
            {
                mExitThread.Set();
                mThread.Join();
                mThread = null;
            }

            try
            {
                mCurrentConsole = mXboxManager.OpenConsole(consoleName);
            }
            catch (Exception e)
            {
                mCurrentConsole = null;
                return(errorCatch(e));
            }

            mCurrentConsoleName = consoleName;

            mExitThread.Reset();
            mThread = new Thread(new ThreadStart(threadFunc));
            mThread.IsBackground = true;
            mThread.Start();

            return(eErrorType.c*K);
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XboxFileInfo"/> class.
 /// </summary>
 /// <param name="definition">The definition object describing this file.</param>
 /// <param name="console">The console on which the file resides.</param>
 internal XboxFileInfo(XboxFileSystemInfoDefinition definition, XboxConsole console)
     : base(definition, console)
 {
     if (definition.FileAttributes.HasFlag(FileAttributes.Directory))
     {
         throw new ArgumentException("Cannot pass a directory to the XboxFileInfo constructor", "definition");
     }
 }
Ejemplo n.º 18
0
        static public eErrorType sendFile(XboxConsole console, string localName, string remoteName, bool createDir, bool onlyIfNewer)
        {
            if (console == null)
            {
                return(eErrorType.cNotConnected);
            }

            eErrorType res = eErrorType.c*K;

            try
            {
                if (createDir)
                {
                    string path = remoteName;
                    int    i    = path.LastIndexOf('\\');
                    if (i >= 0)
                    {
                        path = path.Substring(0, i);
                    }
                    createDirectory(console, path);
                }

                bool     gotLocalDateTime = false;
                DateTime localDateTime    = DateTime.Now;
                try
                {
                    localDateTime    = File.GetLastWriteTime(localName);
                    gotLocalDateTime = true;
                }
                catch { }

                if (onlyIfNewer && gotLocalDateTime)
                {
                    IXboxFile fileObject = null;
                    try
                    {
                        fileObject = console.GetFileObject(remoteName);
                    }
                    catch { }
                    if (fileObject != null)
                    {
                        DateTime remoteDateTime = (DateTime)fileObject.ChangeTime;
                        if (localDateTime <= remoteDateTime)
                        {
                            return(res);
                        }
                    }
                }

                console.SendFile(localName, remoteName);
            }
            catch (Exception e)
            {
                res = errorCatch(e);
            }
            return(res);
        }
Ejemplo n.º 19
0
        //[DllImport("XSimWrapperDll.dll", CharSet = CharSet.Ansi)]
        //public static extern uint XSimInitialize(UInt32 dwComponentFrameRate);

        public Program()
        {
            manager    = new XboxManager();
            console    = manager.OpenConsole(manager.DefaultConsole);
            automation = console.XboxAutomation;
            gamepad    = new XBOX_AUTOMATION_GAMEPAD();
            result     = false;
            enableMU   = false;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Investigates whether a directory exists on an Xbox.
        /// </summary>
        /// <param name="directory">The directory to look for.</param>
        /// <param name="console">The Xbox Console to look on.</param>
        /// <returns>A value indicating whether the directory exists on the console or not.</returns>
        public static bool Exists(XboxPath directory, XboxConsole console)
        {
            if (console == null)
            {
                throw new ArgumentNullException("console");
            }

            return(XboxDirectoryInfo.ExistsImpl(console.SystemIpAddressAndSessionKeyCombined, directory, console.Adapter));
        }
Ejemplo n.º 21
0
        public ModuleLauncherControl(XboxConsole Console, uint Connection, string JoinedLine)
        {
            InitializeComponent();
            this.Console    = Console;
            this.Connection = Connection;
            var np = JoinedLine.Split(',');

            ModuleControlGroup.Text = np[0];
            ModulePathEdit.Text     = np[1];
        }
Ejemplo n.º 22
0
        public static void XamFeatureEnableDisable(XboxConsole Console, bool EnableDisable, XamAppIDs AppID)
        {
            var enableDisable = new XDRPCArgumentInfo <bool>(EnableDisable);
            var appID         = new XDRPCArgumentInfo <uint>((uint)AppID);
            var returnVal     = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 515, enableDisable, appID);

            if (returnVal != 0)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
        }
Ejemplo n.º 23
0
        public static ConsoleFeatures DmGetConsoleFeatures(XboxConsole Console)
        {
            var pdwConsoleFeatures = new XDRPCArgumentInfo <uint>(0, ArgumentType.Out);
            var returnVal          = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xbdm.xex", 220, pdwConsoleFeatures);

            if (returnVal != 0x02DA0000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
            return((ConsoleFeatures)pdwConsoleFeatures.Value);
        }
Ejemplo n.º 24
0
 static public void reboot(XboxConsole console, string file, string mediaDir, string cmdLine, XboxRebootFlags flags)
 {
     if (console != null)
     {
         try
         {
             console.Reboot(file, mediaDir, cmdLine, flags);
         }
         catch { }
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XboxFileSystemInfo"/> class.
        /// </summary>
        /// <param name="definition">The definition of this file sytsem object.</param>
        /// <param name="console">The console on which this file system object resides.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="definition"/> or <paramref name="console"/> parameter is null.</exception>
        internal XboxFileSystemInfo(XboxFileSystemInfoDefinition definition, XboxConsole console)
            : base(console)
        {
            if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }

            this.XboxPath   = definition.Path;
            this.definition = definition;
        }
Ejemplo n.º 26
0
        public static uint XexGetModuleHandle(XboxConsole Console, string ModuleName)
        {
            var name      = new XDRPCStringArgumentInfo(ModuleName, Encoding.ASCII);
            var handle    = new XDRPCArgumentInfo <uint>(0, ArgumentType.Out);
            var returnVal = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xboxkrnl.exe", 405, name, handle);

            if (returnVal != 0x00000000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
            return(handle.Value);
        }
Ejemplo n.º 27
0
        static public void destroy()
        {
            if (mThread != null)
            {
                mExitThread.Set();
                mThread.Join();
                mThread = null;
            }

            mCurrentConsole = null;
            mXboxManager    = null;
        }
Ejemplo n.º 28
0
        public static uint XamAlloc(XboxConsole Console, uint Flags, uint Size)
        {
            var dwFlags   = new XDRPCArgumentInfo <uint>(Flags);
            var cb        = new XDRPCArgumentInfo <uint>(Size);
            var ppv       = new XDRPCArgumentInfo <uint>(0, ArgumentType.Out);
            var returnVal = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 490, dwFlags, cb, ppv);

            if (returnVal != 0x00000000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
            return(ppv.Value);
        }
Ejemplo n.º 29
0
        public static XAMACCOUNTINFO XamProfileFindAccount(XboxConsole Console, ulong OfflineXUID)
        {
            if (!XUID.IsOfflineXUID(OfflineXUID))
            {
                throw new Exception("XDKUtilities.XamProfileFindAccount: Invalid offline XUID specified.");
            }
            var xuidOffline  = new XDRPCArgumentInfo <ulong>(OfflineXUID);
            var pAccountInfo = new XDRPCStructArgumentInfo <XAMACCOUNTINFO>(new XAMACCOUNTINFO(), ArgumentType.Out);
            var returnVal    = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 565, xuidOffline, pAccountInfo);

            //if (returnVal != 0x00000000) throw ProfilesExceptionFactory.CreateExceptionFromErrorCode(returnVal);
            return(pAccountInfo.Value);
        }
Ejemplo n.º 30
0
        public static DM_SYSTEM_INFO DmGetSystemInfo(XboxConsole Console)
        {
            var pdmGetSystemInfo = new XDRPCStructArgumentInfo <DM_SYSTEM_INFO>(new DM_SYSTEM_INFO {
                SizeOfStruct = 0x20
            }, ArgumentType.ByRef);
            var returnVal = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xbdm.xex", 161, pdmGetSystemInfo);

            if (returnVal != 0x02DA0000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
            return(pdmGetSystemInfo.Value);
        }
Ejemplo n.º 31
0
        public static void XamShowPlayersUI(XboxConsole Console, uint XUserIndex)
        {
            if (XUserIndex > 3)
            {
                throw new Exception("XDKUtilities.XamShowPlayersUI: Invalid user index specified. It must be less than or equal to 3.");
            }
            var dwUserIndex = new XDRPCArgumentInfo <uint>(XUserIndex);
            var returnVal   = Console.ExecuteRPC <uint>(XDRPCMode.Title, "xam.xex", 712, dwUserIndex);

            if (returnVal != 0x00000000)
            {
                throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
            }
        }
Ejemplo n.º 32
0
        public void UploadLocalFile()
        {
            try
            {
                string type = GridViewLocalFiles.GetRowCellValue(GridViewLocalFiles.FocusedRowHandle, "Type").ToString();
                string name = GridViewLocalFiles.GetRowCellValue(GridViewLocalFiles.FocusedRowHandle, "Name").ToString();

                if (type.Equals("file"))
                {
                    string localPath   = TextBoxLocalPath.Text + name;
                    string consolePath = TextBoxConsolePath.Text + name;

                    if (File.Exists(localPath))
                    {
                        SetLocalStatus($"Uploading file to {consolePath}...");

                        if (ConsoleType == ConsoleTypePrefix.PS3)
                        {
                            FtpExtensions.UploadFile(localPath, consolePath);
                        }
                        else
                        {
                            XboxConsole.SendFile(localPath, consolePath);
                        }

                        SetLocalStatus($"Successfully uploaded file: {Path.GetFileName(localPath)}");
                        LoadConsoleDirectory(DirectoryPathConsole);
                    }
                    else
                    {
                        SetLocalStatus("Unable to upload file as it doesn't exist on your computer.");
                    }
                }
                else if (type.Equals("folder"))
                {
                    string localPath   = TextBoxLocalPath.Text + name + @"\";
                    string consolePath = TextBoxConsolePath.Text + name;

                    SetLocalStatus($"Uploading folder to {consolePath}...");
                    //FtpClient.UploadDirectory(localPath, consolePath, FtpFolderSyncMode.Update, FtpRemoteExists.Overwrite);
                    SetLocalStatus($"Successfully uploaded folder: {localPath}");
                    LoadConsoleDirectory(DirectoryPathConsole);
                }
            }
            catch (Exception ex)
            {
                SetLocalStatus($"Unable to upload to console. Error: {ex.Message}", ex);
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XboxFileSystemInfo"/> class.
        /// </summary>
        /// <param name="xboxPath">The Xbox path to the file system object.</param>
        /// <param name="console">The console on which the file system object resides.</param>
        /// <exception cref="System.ArgumentException">Thrown if given an invalid path.</exception>
        protected XboxFileSystemInfo(XboxPath xboxPath, XboxConsole console)
            : base(console)
        {
            if (xboxPath == null)
            {
                throw new ArgumentNullException("xboxPath");
            }

            if (!xboxPath.IsValid)
            {
                throw new ArgumentException("Invalid Xbox path.", "xboxPath");
            }

            this.XboxPath = xboxPath;
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Open a connection to the XBox Console
        /// </summary>
        /// <returns>true if the connection was successful.</returns>
        public bool Connect()
        {
            if (!IsConnected)
            {
                try
                {
                    _xboxManager = new XboxManager();
                    _xboxConsole = _xboxManager.OpenConsole(DeviceIdent);
                    _xboxDebugTarget = _xboxConsole.DebugTarget;
                    _xboxConnectionCode = _xboxConsole.OpenConnection(null);
                }
                catch
                {
                    _xboxManager = null;
                    _xboxConsole = null;
                    _xboxDebugTarget = null;
                    return false;
                }

                try { XboxType = _xboxConsole.ConsoleType.ToString(); }
                catch { XboxType = "Unable to get."; }

                IsConnected = true;
            }
            return true;
        }
        public XboxDevConsole(string name)
        {
            console = xboxManager.OpenConsole(name);

            // create a connection to the console so we can communicate with it
            Connect();

            // the features are flags, so we need to check for all of them
            Features = "";
            foreach (XboxConsoleFeatures feature in Enum.GetValues(typeof(XboxConsoleFeatures)))
                if (((uint)console.ConsoleFeatures & (uint)feature) != 0)
                    Features += feature.ToString() + "|";
            Features = (Features.Length != 0) ? Features.Substring(0, Features.Length - 1) : "None";

            Type = console.ConsoleType.ToString();
            Name = console.Name;
            CurrentTitle = console.RunningProcessInfo.ProgramName;

            // format the IP address, it's in the wrong endian so the .Net classes parse it backwards
            uint ipAddress = console.IPAddress;
            IPAddress = "";
            for (int i = 24; i >= 0; i -= 8)
                IPAddress += ((ipAddress >> i) & 0xFF).ToString() + ".";
            IPAddress = IPAddress.Substring(0, IPAddress.Length - 1);

            // organize a list of all of the heap memory allocated
            string response = SendTextCommand("walkmem");
            foreach (string resp in RecieveStrings())
                committedMemory.Add(new CommittedMemoryBlock(resp));

            response = SendTextCommand("systeminfo");

            console.ReceiveSocketLine(consoleConnection, out response);
            HDDEnabled = (response.Replace("HDD=", "") == "Enabled");

            // this contains the type, that's already been parsed
            console.ReceiveSocketLine(consoleConnection, out response);

            console.ReceiveSocketLine(consoleConnection, out response);
            string[] settings = response.Split(new char[] { ' ' });
            Platform = settings[0].Replace("Platform=", "");
            Motherboard = settings[1].Replace("System=", "");

            console.ReceiveSocketLine(consoleConnection, out response);
            settings = response.Split(new char[] { ' ' });
            BaseKernelVersion = new Version(settings[0].Replace("BaseKrnl=", ""));
            KernelVersion = new Version(settings[1].Replace("Krnl=", ""));
            XDKVersion = new Version(settings[2].Replace("XDK=", ""));

            // retrieve the . at the end
            console.ReceiveSocketLine(consoleConnection, out response);

            // organize a list of all of the modules loaded in memory
            response = SendTextCommand("modules");
            foreach (string resp in RecieveStrings())
                modules.Add(new Module(resp));
        }
Ejemplo n.º 36
0
 public static ConsoleTypes DmGetConsoleType(XboxConsole Console)
 {
     var pdwConsoleType = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xbdm.xex", 140, pdwConsoleType);
     if (returnVal != 0x02DA0000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
     return (ConsoleTypes)pdwConsoleType.Value;
 }
Ejemplo n.º 37
0
 public static DM_SYSTEM_INFO DmGetSystemInfo(XboxConsole Console)
 {
     var pdmGetSystemInfo = new XDRPCStructArgumentInfo<DM_SYSTEM_INFO>(new DM_SYSTEM_INFO { SizeOfStruct = 0x20 }, ArgumentType.ByRef);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xbdm.xex", 161, pdmGetSystemInfo);
     if (returnVal != 0x02DA0000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
     return pdmGetSystemInfo.Value;
 }
Ejemplo n.º 38
0
 public static void HalSendSMCMessage(XboxConsole Console, byte[] Request, ref byte[] Response)
 {
     if (Request.Length != 16) throw new Exception("XDKUtilities.HalSendSMCMessage: Invalid request specified. It must be 16 bytes in length.");
     if (!Enum.IsDefined(typeof(SMCRequestTypes), Request[0])) throw new Exception("XDKUtilities.HalSendSMCMessage: Invalid request specified. The first byte needs to be a valid request value.");
     var request = new XDRPCArrayArgumentInfo<byte[]>(Request);
     var response = Response == null ? (XDRPCArgumentInfo)new XDRPCNullArgumentInfo() : new XDRPCArrayArgumentInfo<byte[]>(Response, ArgumentType.ByRef);
     Console.ExecuteRPC<uint>(XDRPCMode.Title, "xboxkrnl.exe", 41, request, response);
     if (!(response is XDRPCNullArgumentInfo)) Response = ((XDRPCArrayArgumentInfo<byte[]>)response).Value;
 }
Ejemplo n.º 39
0
 public static void LaunchModule(XboxConsole Console, uint ConsoleConnection, string ModulePath)
 {
     var tmpString = ModulePath.Replace('\\', '~').Split('~');
     var directory = ModulePath.Substring(0, (ModulePath.Length - tmpString[tmpString.Length - 1].Length) - 1);
     string outsts;
     string command;
     if (directory.Contains("\\")) command = string.Format("magicboot title=\"{0}\"" + " directory=\"{1}\"", ModulePath, directory);
     else
     {
         //We can only launch from the FLASH root.
         if (string.CompareOrdinal(directory, "FLASH:") == 0) command = string.Format("magicboot title=\"{0}\"", ModulePath);
         else throw new Exception("XDKUtilities.LaunchModule: You can only launch modules from the FLASH root, not any others.");
     }
     Console.SendTextCommand(ConsoleConnection, command, out outsts);
 }
Ejemplo n.º 40
0
 public static void XamShowGamerCardUIForXUID(XboxConsole Console, uint XUserIndex, ulong GamerXUID)
 {
     if (XUserIndex > 3) throw new Exception("XDKUtilities.XamShowGamerCardUIForXUID: Invalid user index specified. It must be less than or equal to 3.");
     if (!XUID.IsOnlineXUID(GamerXUID) && !XUID.IsTeamXUID(GamerXUID)) throw new Exception("XDKUtilities.XamShowGamerCardUIForXUID: Invalid gamer online/team XUID specified.");
     var dwUserIndex = new XDRPCArgumentInfo<uint>(XUserIndex);
     var xuidPlayer = new XDRPCArgumentInfo<ulong>(GamerXUID);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 771, dwUserIndex, xuidPlayer);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
 }
Ejemplo n.º 41
0
 public static void XamShowFofUI(XboxConsole Console, uint XUserIndex, ulong FriendXUID, string Gamertag)
 {
     if (XUserIndex > 3) throw new Exception("XDKUtilities.XamShowFofUI: Invalid user index specified. It must be less than or equal to 3.");
     if (!XUID.IsOnlineXUID(FriendXUID) && !XUID.IsTeamXUID(FriendXUID)) throw new Exception("XDKUtilities.XamShowFofUI: Invalid friend online/team XUID specified.");
     if (Gamertag.Length > 15) throw new Exception("XDKUtilities.XamShowFofUI: Invalid Gamertag specified. It must be less than or equal to 16 characters in length.");
     var dwUserIndex = new XDRPCArgumentInfo<uint>(XUserIndex);
     var xuidFriend = new XDRPCArgumentInfo<ulong>(FriendXUID);
     var pszGamertag = new XDRPCStringArgumentInfo(Gamertag, Encoding.ASCII);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 1572, dwUserIndex, xuidFriend, pszGamertag);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
 }
Ejemplo n.º 42
0
 public static uint XexGetProcedureAddress(XboxConsole Console, uint ModuleHandle, uint FunctionOrdinal)
 {
     if (ModuleHandle == 0) throw new Exception("XDKUtilities.XexGetProcedureAddress: Invalid module handle specified.");
     if (FunctionOrdinal == 0) throw new Exception("XDKUtilities.XexGetProcedureAddress: Invalid function ordinal specified.");
     var handle = new XDRPCArgumentInfo<uint>(ModuleHandle);
     var ordinal = new XDRPCArgumentInfo<uint>(FunctionOrdinal);
     var address = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xboxkrnl.exe", 407, handle, ordinal, address);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
     return address.Value;
 }
Ejemplo n.º 43
0
 public static uint XexGetModuleHandle(XboxConsole Console, string ModuleName)
 {
     var name = new XDRPCStringArgumentInfo(ModuleName, Encoding.ASCII);
     var handle = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xboxkrnl.exe", 405, name, handle);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
     return handle.Value;
 }
Ejemplo n.º 44
0
 public static void XamShowPlayersUI(XboxConsole Console, uint XUserIndex)
 {
     if (XUserIndex > 3) throw new Exception("XDKUtilities.XamShowPlayersUI: Invalid user index specified. It must be less than or equal to 3.");
     var dwUserIndex = new XDRPCArgumentInfo<uint>(XUserIndex);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 712, dwUserIndex);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
 }
Ejemplo n.º 45
0
 public static void XamShowMessageComposeUI(XboxConsole Console, uint XUserIndex, ulong[] Recipients = null, string MessageText = "")
 {
     if (XUserIndex > 3) throw new Exception("XDKUtilities.XamShowMessageComposeUI: Invalid user index specified.");
     if (Recipients != null)
     {
         if (Recipients.Length > 64) throw new Exception("XDKUtilities.XamShowMessageComposeUI: Too many recipients specified. The maximum is 64.");
         if (Recipients.Any(recipient => !XUID.IsOnlineXUID(recipient) && !XUID.IsTeamXUID(recipient))) throw new Exception("XDKUtilities.XamShowMessageComposeUI: Invalid recipient online/team XUID specified.");
     }
     if (MessageText.Length > 255) throw new Exception("XDKUtilities.XamShowMessageComposeUI: Specified message text is invalid. It must be less than or equal to 255 characters in length.");
     var dwUserIndex = new XDRPCArgumentInfo<uint>(XUserIndex);
     var pXuidRecipients = Recipients == null || Recipients.Length == 0 ? new XDRPCNullArgumentInfo() : (XDRPCArgumentInfo)new XDRPCArrayArgumentInfo<ulong[]>(Recipients);
     var cRecipients = Recipients == null ? 0 : Recipients.Length;
     var pszText = string.IsNullOrWhiteSpace(MessageText) ? new XDRPCNullArgumentInfo() : (XDRPCArgumentInfo)new XDRPCStringArgumentInfo(MessageText, Encoding.BigEndianUnicode);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 716, dwUserIndex, pXuidRecipients, cRecipients, pszText);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
 }
Ejemplo n.º 46
0
        /// <summary>
        /// Close the connection to the XBox Console
        /// </summary>
        public void Disconnect()
        {
            if (!IsConnected) return;

            if (_xboxConsole != null)
                _xboxConsole.CloseConnection(_xboxConnectionCode);

            _xboxManager = null;
            _xboxDebugTarget = null;
            _xboxConsole = null;
            IsConnected = false;
        }
Ejemplo n.º 47
0
 public static void XamFree(XboxConsole Console, uint Address)
 {
     var pv = new XDRPCArgumentInfo<uint>(Address);
     Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 492, pv);
 }
Ejemplo n.º 48
0
 public static void XNotifyQueueUI(XboxConsole Console, uint XUserIndex, XNotifyUITypes XNotifyUIType, XNotifyUIPriorities XNotifyUIPriority, string XNotifyMessage)
 {
     if (XUserIndex > 3) throw new Exception("XDKUtilities.XNotifyQueueUI: Invalid user index specified. It must be less than or equal to 3.");
     if (!Enum.IsDefined(typeof(XNotifyUITypes), XNotifyUIType)) throw new Exception("XDKUtilities.XNotifyQueueUI: Invalid notification type specified.");
     if (!Enum.IsDefined(typeof(XNotifyUIPriorities), XNotifyUIPriority)) throw new Exception("XDKUtilities.XNotifyQueueUI: Invalid notification priority specified.");
     var dwType = new XDRPCArgumentInfo<uint>((uint)XNotifyUIType);
     var dwUserIndex = new XDRPCArgumentInfo<uint>(XUserIndex);
     var dwPriority = new XDRPCArgumentInfo<uint>((uint)XNotifyUIPriority);
     var pwszStringParam = new XDRPCStringArgumentInfo(XNotifyMessage, Encoding.BigEndianUnicode);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 656, dwType, dwUserIndex, dwPriority, pwszStringParam);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
 }
Ejemplo n.º 49
0
 public static void XamShowGameInviteUI(XboxConsole Console, uint XUserIndex, ulong[] Recipients = null)
 {
     if (XUserIndex > 3) throw new Exception("XDKUtilities.XamShowGameInviteUI: Invalid user index specified.It must be less than or equal to 3.");
     if (Recipients != null)
     {
         if (Recipients.Length > 64) throw new Exception("XDKUtilities.XamShowGameInviteUI: Too many recipients specified. The maximum is 64.");
         if (Recipients.Any(recipient => !XUID.IsOnlineXUID(recipient) && !XUID.IsTeamXUID(recipient))) throw new Exception("XDKUtilities.XamShowGameInviteUI: Invalid recipient online/team XUID specified.");
     }
     var dwUserIndex = new XDRPCArgumentInfo<uint>(XUserIndex);
     var pXuidRecipients = Recipients == null || Recipients.Length == 0 ? new XDRPCNullArgumentInfo() : (XDRPCArgumentInfo)new XDRPCArrayArgumentInfo<ulong[]>(Recipients);
     var cRecipients = Recipients == null ? 0 : Recipients.Length;
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 717, dwUserIndex, pXuidRecipients, cRecipients);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
 }
Ejemplo n.º 50
0
 public static bool XamFeatureEnabled(XboxConsole Console, XamAppIDs AppID)
 {
     var appID = new XDRPCArgumentInfo<uint>((uint)AppID);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 512, appID);
     return Convert.ToBoolean(returnVal);
 }
Ejemplo n.º 51
0
 public static uint XamAlloc(XboxConsole Console, uint Flags, uint Size)
 {
     var dwFlags = new XDRPCArgumentInfo<uint>(Flags);
     var cb = new XDRPCArgumentInfo<uint>(Size);
     var ppv = new XDRPCArgumentInfo<uint>(0, ArgumentType.Out);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 490, dwFlags, cb, ppv);
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
     return ppv.Value;
 }
Ejemplo n.º 52
0
 public static void XamFeatureEnableDisable(XboxConsole Console, bool EnableDisable, XamAppIDs AppID)
 {
     var enableDisable = new XDRPCArgumentInfo<bool>(EnableDisable);
     var appID = new XDRPCArgumentInfo<uint>((uint)AppID);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 515, enableDisable, appID);
     if (returnVal != 0) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
 }
Ejemplo n.º 53
0
 public static string XamGetCachedTitleName(XboxConsole Console, uint TitleID)
 {
     if (TitleID == 0) return string.Empty;
     var dwTitleId = new XDRPCArgumentInfo<uint>(TitleID);
     var pwsz = new XDRPCArrayArgumentInfo<byte[]>(new byte[56], ArgumentType.Out, 56);
     var pcch = new XDRPCArgumentInfo<int>(56, ArgumentType.ByRef);
     var returnVal = Console.ExecuteRPC<uint>(XDRPCMode.Title, "xam.xex", 694, dwTitleId, pwsz, pcch);
     if (returnVal == 0x3E5) return string.Empty;
     if (returnVal != 0x00000000) throw new COMException("Exception from HRESULT: " + string.Format("0x{0:X}", returnVal), (int)returnVal);
     return Encoding.BigEndianUnicode.GetString(pwsz.Value).Replace("\0", string.Empty);
 }