示例#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);
        }
示例#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());
        }
示例#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());
        }
示例#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());
        }
示例#5
0
        /// <summary>
        /// Shutdown game or platform
        /// </summary>
        public void Shutdown()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            _tmapi.PowerOff(true);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#9
0
        /// <summary>
        /// Disconnects from target.
        /// </summary>
        public void Disconnect()
        {
            if (_tmapi == null)
            {
                _tmapi = new TMAPI();
            }

            _tmapi.DisconnectTarget();

            _tmapi = new TMAPI();
        }
示例#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);
        }