Esempio n. 1
0
        public static SNRESULT GetPPUThreadInfo(int target, uint processID, ulong threadID, out PPUThreadInfo threadInfo)
        {
            byte[]   buffer = new byte[1024];
            uint[]   bSize  = new uint[] { 1024 };
            SNRESULT ret;

            if (!Is32Bit())
            {
                ret = PPUThreadInfoX64(target, processID, threadID, bSize, buffer);
            }
            else
            {
                ret = PPUThreadInfoX86(target, processID, threadID, bSize, buffer);
            }

            threadInfo              = new PPUThreadInfo();
            threadInfo.ThreadID     = BitConverter.ToUInt64(buffer, 0);
            threadInfo.Priority     = BitConverter.ToUInt32(buffer, 8);
            threadInfo.State        = (PPUThreadState)BitConverter.ToUInt32(buffer, 0x10);
            threadInfo.StackAddress = BitConverter.ToUInt64(buffer, 0x14);
            threadInfo.StackSize    = BitConverter.ToUInt64(buffer, 0x1C);
            threadInfo.ThreadName   = TMAPI.ByteArrayToString(buffer, 0x28, 0);

            return(ret);
        }
Esempio n. 2
0
        /// <summary>
        /// Attaches to target process.
        /// This should automatically continue the process if it is stopped.
        /// </summary>
        public bool Attach()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            return(_tmapi.AttachProcess());
        }
Esempio n. 3
0
        /// <summary>
        /// Pauses the attached process (return false if not available feature)
        /// </summary>
        public bool PauseProcess()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            return(_tmapi.AttachProcOnly());
        }
Esempio n. 4
0
        /// <summary>
        /// Connects to target.
        /// If platform doesn't require connection, just return true.
        /// </summary>
        public bool Connect()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            return(_tmapi.ConnectTarget());
        }
Esempio n. 5
0
        /// <summary>
        /// Shutdown game or platform
        /// </summary>
        public void Shutdown()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            _tmapi.PowerOff(true);
        }
Esempio n. 6
0
        /// <summary>
        /// Write bytes to the memory of target process.
        /// </summary>
        public void SetBytes(ulong address, byte[] bytes)
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            _tmapi.SetMemory((uint)address, bytes);
        }
Esempio n. 7
0
        /// <summary>
        /// Read bytes from memory of target process.
        /// Returns read bytes into bytes array.
        /// Returns false if failed.
        /// </summary>
        public bool GetBytes(ulong address, ref byte[] bytes)
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            return(_tmapi.GetMemory((uint)address, bytes) == PS3TMAPI.SNRESULT.SN_S_OK);
        }
Esempio n. 8
0
        /// <summary>
        /// Continues the attached process (return false if not available feature)
        /// </summary>
        public bool ContinueProcess()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            _tmapi.ContinueProcess();
            return(true);
        }
Esempio n. 9
0
        /// <summary>
        /// Disconnects from target.
        /// </summary>
        public void Disconnect()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            _tmapi.DisconnectTarget();

            _tmapi = new TMAPI();
        }
Esempio n. 10
0
        /// <summary>
        /// Tells NetCheat if the process is currently stopped (return false if not available feature)
        /// </summary>
        public bool isProcessStopped()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            ulong[] ppu, spu;
            _tmapi.GetThreadList(0, _tmapi.SCE.ProcessID(), out ppu, out spu);

            PS3TMAPI.PPUThreadInfo ppuTI;
            foreach (ulong tID in ppu)
            {
                _tmapi.GetPPUThreadInfo(0, _tmapi.SCE.ProcessID(), tID, out ppuTI);
                if (ppuTI.State != PS3TMAPI.PPUThreadState.OnProc &&
                    ppuTI.State != PS3TMAPI.PPUThreadState.Sleep &&
                    ppuTI.State != PS3TMAPI.PPUThreadState.Runnable)
                {
                    return(true);
                }
            }

            return(false);
        }