Пример #1
0
        public object GetValueFromPtr(MemorySharp m, IntPtr adr)
        {
            string result = "ERROR";

            try
            {
                if (retHEX.Checked)
                {
                    result = "0x" + m.Read <int>(adr, false).ToString("X4");
                }
                if (retINT.Checked)
                {
                    result = m.Read <int>(adr, false).ToString();
                }
                if (retUINT.Checked)
                {
                    result = m.Read <uint>(adr, false).ToString();
                }
                if (retFLOAT.Checked)
                {
                    result = m.Read <float>(adr, false).ToString();
                }
                if (retSTRING.Checked)
                {
                    result = m.ReadString(adr, false);
                }
            }
            catch { }
            return(result);
        }
Пример #2
0
        public void GetLR2ValueResult()
        {
            try {
                LR2value.music_name       = sharp.ReadString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21F20, false), Encoding.GetEncoding(932), false);
                LR2value.music_diff       = sharp.ReadString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21F24, false), Encoding.GetEncoding(932), false);
                LR2value.music_diff_level = sharp.ReadString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21f3c, false), Encoding.GetEncoding(932), false);
                LR2value.music_diff_hakko = sharp.ReadString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21f44, false), Encoding.GetEncoding(932), false);
                LR2value.music_genre      = sharp.ReadString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21f2c, false), Encoding.GetEncoding(932), false);
                LR2value.music_artist     = sharp.ReadString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21f30, false), Encoding.GetEncoding(932), false);
                LR2value.music_artist2    = sharp.ReadString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21f34, false), Encoding.GetEncoding(932), false);
                LR2value.play_clear_type  = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x97b88, false);
                LR2value.play_gauge_type  = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x8, false);
                //LR2value.play_djlevel = sharp.Read<int>((IntPtr)LR2value.baseaddr + 0x97a48, false) * 9 / 32;

                LR2value.play_pgreat        = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x97988, false);
                LR2value.play_great         = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x97984, false);
                LR2value.play_good          = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x97980, false);
                LR2value.play_bad           = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x9797c, false);
                LR2value.play_poor          = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x97978, false);
                LR2value.play_combo         = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x97998, false);
                LR2value.play_maximum_combo = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x979BC, false);
                LR2value.play_score         = LR2value.play_pgreat * 2 + LR2value.play_great;

                //if (LR2value.play_djlevel > 8) {
                LR2value.play_djlevel = (LR2value.play_score * 100 / (LR2value.play_maximum_combo * 2)) / 11;
                //}
            } catch (Exception) { return; }
        }
Пример #3
0
        private string GetPlayerName(int entityId) // Works but should create a new Object every time instead of using an update function. TODO:
        {
            var radarBase        = _process["client.dll"].Read <int>(Base.MainOffsets.RadarBase);
            var radarBasePointer = _process.Read <int>(new IntPtr(radarBase + (int)Base.EntityOffsets.RadarBasePointer), false);

            RadarNameAddress = radarBasePointer + (0x1E0 * (entityId + 1)) + (int)Base.StructSizes.RadarStruct;

            return(_process.ReadString(radarBasePointer + (0x1E0 * (entityId + 1)) + Base.StructSizes.RadarStruct,
                                       Encoding.Unicode, false, 64));
        }
Пример #4
0
    public static string ReadAnimationString(ref Player player)
    {
        try
        {
            var    ptr = _memorySharp[player._playerPtr].Read <IntPtr>();
            string str = _memorySharp.ReadString(ptr + _AnimStringOffset, false, 32);
            return(str);
        }
        catch (ArgumentException)
        {
            Dispose();
        }

        return(string.Empty);
    }
        private void tmr_GameData_Tick(object sender, EventArgs e)
        {
            try
            {
                Process pcsx2       = Process.GetProcesses().First(p => p.ProcessName.StartsWith(PCSX2PROCESSNAME));
                long    pcsx2Offset = GameHelper.GetPcsx2Offset(pcsx2);
                IntPtr  pcsx2Intptr = new IntPtr(pcsx2Offset);

                mem = new MemorySharp(pcsx2);
                string areaWord1 = "";
                string areaWord2 = "";
                string areaWord3 = "";

                if (mem.IsRunning)
                {
                    if (mem.Read <byte>(IntPtr.Add(pcsx2Intptr, GameHelper.CONNECTED_TO_AS_ADDRESS), 4, false).First() == 0x01)
                    {
                        //Get party count
                        //Not really useful right now since I can't seem to get this to display
                        int partyCount = mem.Read <byte>(IntPtr.Add(pcsx2Intptr, GameHelper.PARTY_COUNT_ADDRESS), false);

                        //Get the server name
                        string serverName = ByteConverstionHelper.converyBytesToSJIS(mem.Read <byte>(IntPtr.Add(pcsx2Intptr, GameHelper.SERVER_NAME_ADDRESS), 20, false));

                        //Get the town you are in.
                        //This address actually shows the current zone ccs file. So when you zone into an area this will update to that zone's CCS file
                        //Could be useful to display the area you are in but using the default assets wouldn't be telling of where the player actually is.
                        string townFileName = mem.ReadString(IntPtr.Add(pcsx2Intptr, GameHelper.ZONE_CCS_FILE_LOADED), Encoding.Default, false, 12).Split('.')[0].ToLower();

                        //Don't want the timer to continue if the player is just sitting in town.
                        if (townFileName.ToLower().Contains("town"))
                        {
                            presence.Timestamps = new Timestamps()
                            {
                                Start = null
                            };
                            sessionStarted = false;
                        }

                        //Check to see if we are in a zone. (Could technically use townFileName, but I haven't done extensive testing with that to see if it is
                        // always a zone file name that is loaded there.)

                        if (mem.Read <byte>(IntPtr.Add(pcsx2Intptr, GameHelper.IN_AREA_ADDRESS), 4, false).First() == 0x01)
                        {
                            //Get the pointer addresses and add their offsets to them
                            IntPtr areawordPointerAddress =
                                new IntPtr(mem.Read <int>(IntPtr.Add(pcsx2Intptr, GameHelper.AREA_WORD_POINTER), false) +
                                           pcsx2Offset);
                            IntPtr areaword1Pointer =
                                new IntPtr(mem.Read <int>(
                                               areawordPointerAddress + GameHelper.AREA_WORD_ONE_POINTER_OFFSET, false) + pcsx2Offset);
                            IntPtr areaWord2Pointer =
                                new IntPtr(mem.Read <int>(
                                               areawordPointerAddress + GameHelper.AREA_WORD_TWO_POINTER_OFFSET, false) + pcsx2Offset);
                            IntPtr areaWord3Pointer =
                                new IntPtr(mem.Read <int>(
                                               areawordPointerAddress + GameHelper.AREA_WORD_THREE_POINTER_OFFSET, false) + pcsx2Offset);

                            //Get the keywords.
                            areaWord1    = ByteConverstionHelper.converyBytesToSJIS(mem.Read <byte>(areaword1Pointer, 12, false)).Substring(4);
                            areaWord2    = ByteConverstionHelper.converyBytesToSJIS(mem.Read <byte>(areaWord2Pointer, 12, false)).Substring(4);
                            areaWord3    = ByteConverstionHelper.converyBytesToSJIS(mem.Read <byte>(areaWord3Pointer, 12, false)).Substring(4);
                            townFileName = "default";
                            //Check to see if the game is started (if the player is in a zone) so the timer won't constantly reset
                            if (!sessionStarted)
                            {
                                presence.Timestamps = new Timestamps()
                                {
                                    Start = DateTime.UtcNow
                                };

                                sessionStarted = true;
                            }
                        }
                        setPresence(serverName, areaWord1, areaWord2, areaWord3, partyCount, townFileName);
                    }
                }
                else
                {
                    client.SetPresence(defaultPresence);
                    sessionStarted = false;
                }
            }
            catch (Exception)
            {
                client.SetPresence(defaultPresence);
                sessionStarted = false;
            }
        }
Пример #6
0
 public static string ReadString(uint offset)
 {
     return(process.ReadString(new IntPtr(offset), Encoding.UTF8, false));
 }
Пример #7
0
 public string ReadString(IntPtr address, Encoding encoding, bool isRelative = true, int maxLength = 512)
 {
     return(m.ReadString(address, encoding, isRelative, maxLength));
 }