예제 #1
0
 public void Initialize()
 {
     _xbox = new Xbox(AssemblyGlobals.Logger);
     _xbox.Connect(AssemblyGlobals.TestXbox.Ip);
 }
예제 #2
0
        private void tsmi_load_console_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists("Recieved"))
            {
                Directory.CreateDirectory("Recieved");
            }

            if (Vars.isConnected)
            {
                if (File.Exists(Folders.Recieved + "\\" + FileNames.launchINI))
                {
                    File.Delete(Folders.Recieved + "\\" + FileNames.launchINI);
                }
                List <string> FoundDrives = new List <string>();
                if (Xbox.GetDrives().Length > 1)
                {
                    foreach (string drive in Xbox.GetDrives())
                    {
                        try {
                            Vars.xbCon.ReceiveFile(Folders.Recieved + "\\" + FileNames.launchINI, drive + ":\\" + FileNames.launchINI);
                            FoundDrives.Add(drive);
                        } catch { continue; }
                    }
                }

                if (FoundDrives.Count > 1)
                {
                    File.Delete(Folders.Recieved + "\\" + FileNames.launchINI);
                    frm_sub_edit_ini sub_ini = new frm_sub_edit_ini(FoundDrives.ToArray());
                    if (sub_ini.ShowDialog() == DialogResult.OK)
                    {
                        try {
                            if (Vars.isConnected)
                            {
                                Vars.xbCon.ReceiveFile(Folders.Recieved + "\\" + FileNames.launchINI, this.chosen_drive + ":\\" + FileNames.launchINI);
                                using (StreamReader sr = new StreamReader(Folders.Recieved + "\\" + FileNames.launchINI)) {
                                    rtb_ini_editor.Text = sr.ReadToEnd();
                                }
                            }
                            else
                            {
                                MessageBox.Show("Not connected to console.");
                            }
                        } catch { MessageBox.Show("There was an error recieving file! Please try again!"); }
                    }
                }
                else
                {
                    File.Delete(Folders.Recieved + "\\" + FileNames.launchINI);
                    this.chosen_drive = FoundDrives[0];
                    try {
                        if (Vars.isConnected)
                        {
                            Vars.xbCon.ReceiveFile(Folders.Recieved + "\\" + FileNames.launchINI, this.chosen_drive + ":\\" + FileNames.launchINI);
                            using (StreamReader sr = new StreamReader(Folders.Recieved + "\\" + FileNames.launchINI)) {
                                rtb_ini_editor.Text = sr.ReadToEnd();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Not connected to console.");
                        }
                    } catch { MessageBox.Show("There was an error recieving file! Please try again!"); }
                }
            }
            else
            {
                MessageBox.Show("Connect to your console!");
            }
        }
예제 #3
0
 /// <summary>
 /// Establishes a stream to the specified file name on an Xbox using the default <see cref="XboxFileMode.Create"/> option.
 /// </summary>
 /// <param name="xbox"></param>
 /// <param name="fileName"></param>
 public XboxFileStream(Xbox xbox, string fileName) : this(xbox, fileName, XboxFileMode.Create)
 {
 }
예제 #4
0
 private void tsmi_reboot_active_Click(object sender, EventArgs e)
 {
     Xbox.Reboot(XDevkit.XboxRebootFlags.Warm);
 }
예제 #5
0
        private void frm_game_info_multiple_Load(object sender, EventArgs e)
        {
            new Thread(new ThreadStart(delegate {
                for (int i = 0; i < Files.Count(); i++)
                {
                    Image Content  = null, Package = null;
                    bool Error     = false, HasImage = true;
                    string Display = "", Title = "", DeviceID = "", TitleID = "", ConsoleID = "", ProfileID = "", SubFolder = "", TitleFolder = "", ContentRoot = "", FullDirectory = "", Hash = "", Revision = "";

                    STFSP = new STFSPackage(this.Files[i], Logs);
                    if (STFSP.ParseSuccess)
                    {
                        try {
                            try {
                                Content = this.STFSP.Header.ContentImage;
                                Package = this.STFSP.Header.PackageImage;
                            } catch { HasImage = false; }

                            Display  = this.STFSP.Header.Title_Display;
                            Title    = this.STFSP.Header.Title_Package;
                            DeviceID = Conversion.BytesToHexString(this.STFSP.Header.DeviceID);
                            TitleID  = this.STFSP.Header.TitleID.ToString("X2").ToUpper();
                            this.STFSP.CloseIO();

                            List <byte> fileBytes = FileEx.ReadBytes(this.Files[i], 0, 0x9725 /*0x450*/).ToList();
                            string[] accepted     = { "LIVE", "PIRS", "CON " };
                            string fileType       = Encoding.UTF8.GetString(fileBytes.GetRange(0, 0x4).ToArray());
                            if (accepted.Contains(fileType))
                            {
                                ConsoleID     = Conversion.BytesToHexString(fileBytes.GetRange(0x36C, 0x4).ToArray());
                                ProfileID     = Conversion.BytesToHexString(fileBytes.GetRange(0x371, 0x4).ToArray());
                                SubFolder     = Conversion.BytesToHexString(fileBytes.GetRange(0x344, 0x4).ToArray());
                                TitleFolder   = Conversion.BytesToHexString(fileBytes.GetRange(0x360, 0x4).ToArray());
                                Revision      = Convert.ToInt32(fileBytes.GetRange(0x9724, 0x1).ToArray()[0]).ToString();
                                ContentRoot   = this.STFSP.Header.ThisType != PackageType.Profile ? Conversion.BytesToHexString(fileBytes.GetRange(0x364, 0x8).ToArray()) : this.STFSP.Header.Title_Display;
                                FullDirectory = String.Format("HDD:\\Content\\{0}\\{1}\\{2}", ContentRoot, TitleFolder, SubFolder);
                                Hash          = Hashing.MD5(fileBytes.ToArray()).Substring(0, 12).ToUpper();
                            }
                        } catch { Invoke(new MethodInvoker(() => { Error = true; this.Text = String.Format("Game Info - {0}/{1} | Errors: {2}", this.Successes, this.Files.Count(), this.Errors++); })); }
                        Info.Add(new STFSInfo {
                            Display = Display, Title = TitleFolder, DeviceID = DeviceID, TitleID = TitleID, ConsoleID = ConsoleID, ProfileID = ProfileID, Sub = SubFolder, TitleName = Title,
                            Content = Content, FullDirectory = FullDirectory, Package = Package, Root = ContentRoot, Local = this.Files[i], Error = Error, Hash = Hash, HasImage = HasImage, Revision = Revision
                        });
                        Invoke(new MethodInvoker(() => {
                            this.Text = String.Format("Game Info - {0}/{1}{2}{3}", this.Successes++, this.Files.Count(), (Error ? " | Errors: " : ""), (Error ? this.Errors.ToString() : ""));
                            if (!Error)
                            {
                                FormE.ListViews.addToListView(lv_main, TitleID, (Title == "" ? Xbox.HexTitleToName(Convert.ToUInt32(TitleID, 16)) : Title), "Loaded", Hash, Revision);
                            }
                        }));
                    }
                    else
                    {
                        this.Errors++;
                    }
                }
                Invoke(new MethodInvoker(() => { this.Text = "Game Info - Finished Loading Files"; this.Finished = true; Info.ForEach(s => Console.WriteLine(s.ToString())); }));
            })).Start();
        }
예제 #6
0
 private void tsmi_reboot_cold_Click(object sender, EventArgs e)
 {
     Xbox.Reboot(XDevkit.XboxRebootFlags.Cold);
 }
예제 #7
0
 private void tsmi_reboot_title_Click(object sender, EventArgs e)
 {
     Xbox.Reboot(XDevkit.XboxRebootFlags.Title);
 }
예제 #8
0
        //Gets all info from a table where it equals the condition
        public static Xbox Select(string table, string where, string equals)
        {
            string queryString = "SELECT * FROM  " + table + " WHERE " + where + " = @equals";
            Xbox   result      = null;

            using (MySqlConnection connection = new MySqlConnection(csb.ToString()))
            {
                connection.Open();
                MySqlCommand command = new MySqlCommand(queryString, connection);
                command.Prepare();
                command.Parameters.AddWithValue("@equals", equals);
                //command.ExecuteNonQuery();
                MySqlDataReader reader = command.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        DateTime time         = DateTime.Parse(reader["time"].ToString());
                        DateTime now          = DateTime.Now;
                        TimeSpan timeLeft     = time.Subtract(now);
                        double   totalSeconds = timeLeft.TotalSeconds;
                        double   totalMins    = totalSeconds / 60;
                        double   totalHours   = totalMins / 60;
                        double   totalDays    = totalHours / 24;
                        string   totalTime    = (int)totalDays + "d " + (int)(totalHours % 24) + "h " + (int)(totalMins % 60) + "m";
                        if (totalDays >= 300)
                        {
                            totalTime = "Lifetime";
                        }
                        if (totalSeconds < 0)
                        {
                            totalTime = "Expired";
                        }
                        Xbox xbox = new Xbox();
                        xbox.CPUKey  = reader["cpukey"].ToString();
                        xbox.ID      = (int)reader["id"];
                        xbox.Salt    = reader["salt"].ToString();
                        xbox.Enabled = bool.Parse(reader["enabled"].ToString());
                        //1096157269 WaW; 1480659546 CSGO; 1096157460 AW
                        xbox.Game         = 4294838225; //Dashboard
                        xbox.Time         = totalTime;
                        xbox.Gamertag     = "Abyscuit"; //Replace with reader ToString()
                        xbox.totalDays    = totalDays;
                        xbox.totalHours   = totalHours;
                        xbox.totalMinutes = totalMins;
                        xbox.totalSeconds = totalSeconds;
                        result            = xbox;
                    }
                }
                catch (Exception e)
                {
                    result        = new Xbox();
                    result.CPUKey = "Failed";
                    result.Time   = e.Message;
                    return(result);
                }
                finally
                {
                    // Always call Close when done reading.
                    reader.Close();
                }
            }
            Console.WriteLine(string.Format("{0}", result));

            return(result);
        }
예제 #9
0
        /// <summary>
        /// Injects the specified GSC mods to the their correct game locations
        /// </summary>
        /// <param name="modItem"></param>
        private void InjectModItem(ModsData.ModItem modItem)
        {
            try
            {
                if (IsInGame())
                {
                    SetStatus($"You must be in pre-game lobby before injecting mods.");
                    XtraMessageBox.Show(this, "You must be in pre-game lobby before injecting mods.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                ClearGscMods();
                LastUsedGscFiles.Clear();

                modItem.DownloadInstallFiles();

                // Free Memory Offsets
                uint freeMemoryOffset;

                if (ConsoleType.Equals("PS3"))
                {
                    freeMemoryOffset = 0x51000000;
                }
                else
                {
                    freeMemoryOffset = 0x40300000;
                }

                foreach (string installFilePath in modItem.InstallPaths)
                {
                    foreach (string localFilePath in Directory.GetFiles(modItem.GetDownloadDataPath(), "*.*", SearchOption.AllDirectories))
                    {
                        string installFileName = Path.GetFileName(installFilePath);

                        if (string.Equals(installFileName, Path.GetFileName(localFilePath), StringComparison.CurrentCultureIgnoreCase))
                        {
                            GscData.FileItem gscFileData = GetGscFileData(ConsoleType, modItem.GameType, installFilePath);

                            LastUsedGscFiles.Add(installFilePath);

                            byte[] gscFile = File.ReadAllBytes(localFilePath);

                            SetStatus($"{modItem.Name} v{modItem.Version} ({modItem.GetGameType()}) - Injecting GSC file: {installFileName} ...");

                            if (ConsoleType.Equals("PS3"))
                            {
                                PS3.Extension.WriteUInt32(gscFileData.Pointer, 0x51000000); // Overwrite script pointer
                                PS3.Extension.WriteBytes(0x51000000, gscFile);              // Write compiled script buffer to free memory location
                            }
                            else if (ConsoleType.Equals("XBOX"))
                            {
                                Xbox.WriteUInt32(gscFileData.Pointer, 0x40300000);
                                Xbox.WriteByte(0x40300000, gscFile);
                            }

                            /* TESTS FOR INJECTING MUTIPLE GSC FILES aZaZ..
                             * if (ConsoleType.Equals("PS3"))
                             * {
                             *  freeMemoryOffset = GET_ALIGNED_DWORD(freeMemoryOffset + 1);
                             *
                             *  PS3.Extension.WriteUInt32(gscFileData.Pointer, freeMemoryOffset); // Overwrite script pointer
                             *  PS3.Extension.WriteBytes(freeMemoryOffset, new byte[gscFile.Length + 1]);
                             *  PS3.Extension.WriteBytes(freeMemoryOffset, gscFile); // Write compiled script buffer to free memory location
                             *
                             *  freeMemoryOffset += (uint)(gscFile.Length + 1);
                             * }
                             * else if (ConsoleType.Equals("XBOX"))
                             * {
                             *  freeMemoryOffset = GET_ALIGNED_DWORD(freeMemoryOffset + 1);
                             *
                             *  XBOX.SetMemory(gscFileData.Pointer, BitConverter.GetBytes(freeMemoryOffset).Reverse().ToArray());
                             *  XBOX.SetMemory(freeMemoryOffset, new byte[gscFile.Length + 1]);
                             *  XBOX.SetMemory(freeMemoryOffset, gscFile);
                             *
                             *
                             *  freeMemoryOffset += (uint)(gscFile.Length + 1);
                             * }
                             *
                             *
                             * Xbox.WriteUInt32(gscFileData.Pointer, freeMemoryOffset);
                             */

                            SetStatus($"{modItem.Name} v{modItem.Version} ({modItem.GetGameType()}) - Injected GSC file: {installFileName}");
                            MenuItemClearGscMods.Enabled = true;
                        }
                    }
                }

                LastInjectedGameType = modItem.GameType;

                SettingsData.UpdateInstalledMod(modItem.GameType, modItem.Id);
                SaveSettingsData();

                if (ConsoleType.Equals("PS3"))
                {
                    NotifyMessagePS3("^2Injected GSC Mods", $"{modItem.Name} v{modItem.Version} by {modItem.CreatedBy}", "party_ready");
                }

                SetStatus($"{modItem.Name} v{modItem.Version} ({modItem.GetGameType()}) - Injected all GSC files.");

                XtraMessageBox.Show(this, $"Injected Mods: {modItem.Name}\nTime: {DateTime.Now:H:mm:ss}", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                SetStatus($"Unable to inject GSC files. Error: {ex.Message}", ex);
                XtraMessageBox.Show(this, $"There was a problem injecting gsc files. Error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #10
0
 public void Initialize()
 {
     _xbox = new Xbox(AssemblyGlobals.Logger);
 }
	/// <summary>	Check if an axis is past a threshold and was not the check before. </summary>
	/// <remarks>	James, 2014-05-02. </remarks>
	/// <param name="Axis">		 	The axis to check. </param>
	/// <param name="Threshold">	The threashold between 0 and 1. </param>
	/// <returns>
	/// 	true if the axis is past the threshold and previously was not, otherwise false.
	/// </returns>
	public bool AxisJustPastThreshold( Xbox.Axis Axis, float Threshold )
	{
		float threshold = Mathf.Clamp( Threshold, -1f, 1f );

		if ( threshold > 0 )
		{
			if ( Axes[ Axis ] >= threshold && PrevAxes[ Axis ] < threshold )
				return true;
		}
		else
		{
			if ( Axes[ Axis ] < threshold && PrevAxes[ Axis ] > threshold )
				return true;
		}
		
		return false;
	}
	public bool IsButtonUp( Xbox.Button b )
	{
		if ( Buttons[ b ] == false && prevButtons[ b ] == true )
		{
			return true;
		}

		return false;
	}
예제 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NameAnsweringProtocolEventArgs"/> class using the specified Xbox instance.
 /// </summary>
 /// <param name="xbox">The Xbox to pass to the event arguments. This value can be <see langword="null"/>.</param>
 public NameAnsweringProtocolEventArgs(Xbox xbox)
 {
     //Set
     Result = xbox;
 }
예제 #14
0
 void MediaTransport_ThumbnailRequest(object sender, Xbox.Controls.ThumbnailRequestEventArgs e)
 {
     thumbManager.ThumbnailRequest(e.Position, (int)e.PlayRate);
 }