コード例 #1
0
        private List <PlayerDataModel> processPlayers()
        {
            List <PlayerDataModel> playerData = new List <PlayerDataModel>();

            //Make sure we are in a game.
            if (m.ReadBytes(GameHelper.PLAYER_POINTER_ADDRESS, 4) != new byte[] { 0x00, 0x00, 0x00, 0x00 })
            {
                string objectPtr = ByteConverstionHelper.byteArrayHexToAddressString(m.ReadBytes(GameHelper.PLAYER_INDEX_POINTER_ADDRESS, 4));
                do
                {
                    string playerPointerAddress     = ByteConverstionHelper.byteArrayHexToAddressString(m.ReadBytes((int.Parse(objectPtr, System.Globalization.NumberStyles.HexNumber) + GameHelper.PLAYER_INDEX_PLAYER_POINTER_OFFSET).ToString("X4"), 4));
                    string playerNamePointerAddress = ByteConverstionHelper.byteArrayHexToAddressString(m.ReadBytes((int.Parse(playerPointerAddress, System.Globalization.NumberStyles.HexNumber) + GameHelper.PLAYER_NAME_OFFSET).ToString("X4"), 4));
                    string teamID   = ByteConverstionHelper.byteArrayHexToHexString(m.ReadBytes((int.Parse(playerPointerAddress, System.Globalization.NumberStyles.HexNumber) + GameHelper.PLAYER_TEAMID_OFFSET).ToString("X4"), 4));
                    string teamName = GameHelper.GetTeamName(teamID);


                    if (teamName == "SEALS" || teamName == "TERRORISTS")
                    {
                        PlayerDataModel PD = new PlayerDataModel();
                        PD._pointerAddress = playerPointerAddress;
                        PD._Team           = teamName;
                        PD._PlayerHealth   = ByteConverstionHelper.byteHexFloatToDecimal(m.ReadBytes((int.Parse(playerPointerAddress, System.Globalization.NumberStyles.HexNumber) + GameHelper.PLAYER_HEALTH_OFFSET).ToString("X4"), 4));

                        PD._PlayerName = ByteConverstionHelper.convertBytesToString(m.ReadBytes(playerNamePointerAddress, 20));
                        //PD._hasMPBomb = m.readByte((int.Parse(playerPointerAddress, System.Globalization.NumberStyles.HexNumber) + GameHelper.ENTITY_HAS_MPBOMB).ToString("X4"));
                        int livingStatus = m.ReadByte((int.Parse(playerPointerAddress, System.Globalization.NumberStyles.HexNumber) + GameHelper.PLAYER_DEATH_CAUSE_ID_OFFSET).ToString("X4"));

                        if (livingStatus == 255)
                        {
                            PD._LivingStatus = "ALIVE";
                        }
                        else
                        {
                            PD._LivingStatus = "DEAD";
                        }

                        playerData.Add(PD);
                    }

                    objectPtr = ByteConverstionHelper.byteArrayHexToAddressString(m.ReadBytes(objectPtr, 4)); // Get the next pointer in the list
                } while (objectPtr.ToUpper() != "206FE508");
            }

            return(playerData);
        }
コード例 #2
0
        private void tmr_GetGameData_Tick(object sender, EventArgs e)
        {
            List <PlayerDataModel> playerData = new List <PlayerDataModel>();

            if (pcsx2Running)
            {
                m.OpenProcess(PCSX2PROCESSNAME + ".exe");

                if ((m.ReadBytes(GameHelper.PLAYER_POINTER_ADDRESS, 4) != null) && (!m.ReadBytes(GameHelper.PLAYER_POINTER_ADDRESS, 4).SequenceEqual(new byte[] { 0, 0, 0, 0 })))
                {
                    if (m.ReadByte(GameHelper.GAME_ENDED_ADDRESS) == 0)
                    {
                        string playerDataLocationAddress = ByteConverstionHelper.byteArrayHexToAddressString(m.ReadBytes(GameHelper.PLAYER_POINTER_ADDRESS, 4));
                        string playerTeam = GameHelper.GetTeamName(ByteConverstionHelper.byteArrayHexToHexString(m.ReadBytes((int.Parse(playerDataLocationAddress, System.Globalization.NumberStyles.HexNumber) + GameHelper.PLAYER_TEAMID_OFFSET).ToString("X4"), 4)));

                        //Get Room specific data
                        int sealsRoundsWon = m.ReadByte(GameHelper.SEAL_WIN_COUNTER_ADDRESS);
                        int mercsRoundsWon = m.ReadByte(GameHelper.MERCS_WIN_COUNTER_ADDRESS);
                        int sealsAlive     = m.ReadByte(GameHelper.SEALS_ALIVE_COUNTER_ADDRESS);
                        int mercsAlive     = m.ReadByte(GameHelper.MERCS_ALIVE_COUNTER_ADDRESS);

                        string roundTimePointerAdddress = ByteConverstionHelper.byteArrayHexToAddressString(m.ReadBytes(GameHelper.ROUND_TIMER_POINTER, 4));
                        string roundTime = ByteConverstionHelper.convertBytesToString(m.ReadBytes((int.Parse(roundTimePointerAdddress, System.Globalization.NumberStyles.HexNumber) + 12).ToString("X4"), 5));

                        //string roundTime = ByteConverstionHelper.convertBytesToString(m.ReadBytes(GameHelper.ROUND_TIMER_RESPAWN_ADDRESS, 5));
                        playerData = processPlayers();

                        resetPlayers();

                        foreach (var item in playerData)
                        {
                            if (item._Team == "SEALS")
                            {
                                var playerDataLabel = pnl_Background.Controls
                                                      .OfType <PlayerDataLabel>()
                                                      .Where(pdl => pdl.Name.Contains("lbl_Seal_") && pdl.Text == "")
                                                      .OrderBy(label => label.Name);;

                                if (item._PlayerName == "DroPPinCliPz")
                                {
                                }
                                setLabel(GetLabels("lbl_Seal_").First(), item);
                            }
                            else if (item._Team == "TERRORISTS")
                            {
                                var playerDataLabel = pnl_Background.Controls
                                                      .OfType <PlayerDataLabel>()
                                                      .Where(pdl => pdl.Name.Contains("lbl_Terr_") && pdl.Text == "")
                                                      .OrderBy(label => label.Name);
                                setLabel(GetLabels("lbl_Terr_").First(), item);
                            }
                        }



                        lbl_S_Alive.Text  = sealsAlive.ToString();
                        lbl_T_Alive.Text  = mercsAlive.ToString();
                        lbl_S_Rounds.Text = sealsRoundsWon.ToString();
                        lbl_T_Rounds.Text = mercsRoundsWon.ToString();
                        lbl_GameTime.Text = roundTime.ToString();
                    }
                }
                else
                {
                    resetPlayers();
                    lbl_S_Rounds.Text = "0";
                    lbl_T_Rounds.Text = "0";
                    lbl_S_Alive.Text  = "0";
                    lbl_T_Alive.Text  = "0";
                    lbl_GameTime.Text = "00:00";
                }
            }
        }