// Token: 0x06000BF9 RID: 3065 RVA: 0x0003DA7C File Offset: 0x0003BC7C
        public static PS3TMAPI.SNRESULT GetProcessList(int target, out uint[] processIDs)
        {
            processIDs = null;
            uint num = 0u;

            PS3TMAPI.SNRESULT sNRESULT = PS3TMAPI.Is32Bit() ? PS3TMAPI.GetProcessListX86(target, ref num, IntPtr.Zero) : PS3TMAPI.GetProcessListX64(target, ref num, IntPtr.Zero);
            PS3TMAPI.SNRESULT sNRESULT2;
            PS3TMAPI.SNRESULT result;
            if (!PS3TMAPI.FAILED(sNRESULT))
            {
                PS3TMAPI.ScopedGlobalHeapPtr scopedGlobalHeapPtr = new PS3TMAPI.ScopedGlobalHeapPtr(Marshal.AllocHGlobal((int)(4u * num)));
                sNRESULT = (PS3TMAPI.Is32Bit() ? PS3TMAPI.GetProcessListX86(target, ref num, scopedGlobalHeapPtr.Get()) : PS3TMAPI.GetProcessListX64(target, ref num, scopedGlobalHeapPtr.Get()));
                if (PS3TMAPI.FAILED(sNRESULT))
                {
                    sNRESULT2 = sNRESULT;
                    result    = sNRESULT2;
                    return(result);
                }
                IntPtr unmanagedBuf = scopedGlobalHeapPtr.Get();
                processIDs = new uint[num];
                for (uint num2 = 0u; num2 < num; num2 += 1u)
                {
                    unmanagedBuf = PS3TMAPI.ReadDataFromUnmanagedIncPtr <uint>(unmanagedBuf, ref processIDs[(int)((uint)((UIntPtr)num2))]);
                }
            }
            sNRESULT2 = sNRESULT;
            result    = sNRESULT2;
            return(result);
        }
        // Token: 0x06000BFF RID: 3071 RVA: 0x0003DD70 File Offset: 0x0003BF70
        public static PS3TMAPI.SNRESULT GetConnectStatus(int target, out PS3TMAPI.ConnectStatus status, out string usage)
        {
            uint   num;
            IntPtr utf;

            PS3TMAPI.SNRESULT result = PS3TMAPI.Is32Bit() ? PS3TMAPI.GetConnectStatusX86(target, out num, out utf) : PS3TMAPI.GetConnectStatusX64(target, out num, out utf);
            status = (PS3TMAPI.ConnectStatus)num;
            usage  = PS3TMAPI.Utf8ToString(utf, 4294967295u);
            return(result);
        }
Ejemplo n.º 3
0
        public async Task <ConnectionStatus> ConnectAsync()
        {
            PS3TMAPI.SNRESULT result = PS3TMAPI.InitTargetComms();
            if (PS3TMAPI.SUCCEEDED(result))
            {
                return(await Task.Run(() => this.Connect()).ConfigureAwait(false));
            }

            return(this.ConnectionStatus = ConnectionStatus.Unavailable);
        }
Ejemplo n.º 4
0
        public void SetSingleRegisterByThreadID(ulong ID, uint Register, ulong Value)
        {
            ulong[] Return    = new ulong[1];
            uint[]  Registers = new uint[1];

            Registers[0] = Register;
            Return[0]    = ULongReverse(Value);

            PS3TMAPI.SNRESULT a = PS3TMAPI.ThreadSetRegisters(Target, PS3TMAPI.UnitType.PPU, Parameters.ProcessID, ID, (uint[])Registers, Return);
        }
 // Token: 0x06000BFE RID: 3070 RVA: 0x0003DCF8 File Offset: 0x0003BEF8
 public static PS3TMAPI.SNRESULT GetConnectionInfo(int target, out PS3TMAPI.TCPIPConnectProperties connectProperties)
 {
     connectProperties = null;
     PS3TMAPI.ScopedGlobalHeapPtr scopedGlobalHeapPtr = new PS3TMAPI.ScopedGlobalHeapPtr(Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PS3TMAPI.TCPIPConnectProperties))));
     PS3TMAPI.SNRESULT            sNRESULT            = PS3TMAPI.Is32Bit() ? PS3TMAPI.GetConnectionInfoX86(target, scopedGlobalHeapPtr.Get()) : PS3TMAPI.GetConnectionInfoX64(target, scopedGlobalHeapPtr.Get());
     if (PS3TMAPI.SUCCEEDED(sNRESULT))
     {
         connectProperties = new PS3TMAPI.TCPIPConnectProperties();
         Marshal.PtrToStructure(scopedGlobalHeapPtr.Get(), connectProperties);
     }
     return(sNRESULT);
 }
Ejemplo n.º 6
0
        public ConnectionStatus GetConnectionStatus()
        {
            if (this.ConnectionStatus != ConnectionStatus.Connected)
            {
                return(ConnectionStatus.Unavailable);
            }

            PS3TMAPI.ConnectStatus status = PS3TMAPI.ConnectStatus.Unavailable;
            PS3TMAPI.SNRESULT      result = PS3TMAPI.GetConnectStatus(this.TargetIndex, out status, out Params.usage);

            return((PS3TMAPI.SUCCEEDED(result)) ? (ConnectionStatus)status : ConnectionStatus.Unavailable);
        }
Ejemplo n.º 7
0
        public PowerState GetPowerState()
        {
            if (this.ConnectionStatus != ConnectionStatus.Connected)
            {
                return(PowerState.Unknown);
            }

            PS3TMAPI.PowerStatus status = PS3TMAPI.PowerStatus.Unknown;
            PS3TMAPI.SNRESULT    result = PS3TMAPI.GetPowerStatus(this.TargetIndex, out status);
            return((PS3TMAPI.SUCCEEDED(result)) ?
                   (PowerState)status :
                   PowerState.Unknown);
        }
Ejemplo n.º 8
0
        public byte[] GetMemory(uint address, uint length)
        {
            if (this.ConnectionStatus != ConnectionStatus.Connected)
            {
                return(new byte[1] {
                    0x00
                });
            }

            byte[]            bytes  = new byte[length];
            PS3TMAPI.SNRESULT result = PS3TMAPI.ProcessGetMemory(this.TargetIndex, UNIT, Params.processID, 0, address, ref bytes);
            return((PS3TMAPI.SUCCEEDED(result)) ? bytes : new byte[1] {
                0x00
            });
        }
Ejemplo n.º 9
0
        public ConnectionStatus Connect()
        {
            PS3TMAPI.SNRESULT result = PS3TMAPI.InitTargetComms();
            if (PS3TMAPI.FAILED(result))
            {
                throw new DevkitNotFoundException();
            }

            result = PS3TMAPI.Connect(this.TargetIndex, null);
            if (PS3TMAPI.FAILED(result))
            {
                throw new DevkitConnectFailedException();
            }

            return(this.ConnectionStatus = ConnectionStatus.Connected);
        }
 // Token: 0x06000BFC RID: 3068 RVA: 0x0003DBC8 File Offset: 0x0003BDC8
 public static PS3TMAPI.SNRESULT GetTargetInfo(ref PS3TMAPI.TargetInfo targetInfo)
 {
     PS3TMAPI.TargetInfoPriv targetInfoPriv = new PS3TMAPI.TargetInfoPriv
     {
         Flags  = targetInfo.Flags,
         Target = targetInfo.Target
     };
     PS3TMAPI.SNRESULT sNRESULT = PS3TMAPI.Is32Bit() ? PS3TMAPI.GetTargetInfoX86(ref targetInfoPriv) : PS3TMAPI.GetTargetInfoX64(ref targetInfoPriv);
     if (!PS3TMAPI.FAILED(sNRESULT))
     {
         targetInfo.Flags   = targetInfoPriv.Flags;
         targetInfo.Target  = targetInfoPriv.Target;
         targetInfo.Name    = PS3TMAPI.Utf8ToString(targetInfoPriv.Name, 4294967295u);
         targetInfo.Type    = PS3TMAPI.Utf8ToString(targetInfoPriv.Type, 4294967295u);
         targetInfo.Info    = PS3TMAPI.Utf8ToString(targetInfoPriv.Info, 4294967295u);
         targetInfo.HomeDir = PS3TMAPI.Utf8ToString(targetInfoPriv.HomeDir, 4294967295u);
         targetInfo.FSDir   = PS3TMAPI.Utf8ToString(targetInfoPriv.FSDir, 4294967295u);
         targetInfo.Boot    = targetInfoPriv.Boot;
     }
     return(sNRESULT);
 }
Ejemplo n.º 11
0
        public bool SetPowerState(PowerState state, bool isForce = false)
        {
            if (this.ConnectionStatus != ConnectionStatus.Connected)
            {
                return(false);
            }

            PS3TMAPI.SNRESULT result = PS3TMAPI.SNRESULT.SN_E_COMMS_ERR;
            switch (state)
            {
            case PowerState.Off:
                result = PS3TMAPI.PowerOff(this.TargetIndex, isForce);
                break;

            case PowerState.On:
                result = PS3TMAPI.PowerOn(this.TargetIndex);
                break;
            }

            return(PS3TMAPI.SUCCEEDED(result));
        }
Ejemplo n.º 12
0
        public bool AttachProcess()
        {
            if (this.ConnectionStatus != ConnectionStatus.Connected)
            {
                return(false);
            }

            PS3TMAPI.SNRESULT result = PS3TMAPI.GetProcessList(this.TargetIndex, out Params.processIDs);
            if (PS3TMAPI.FAILED(result))
            {
                throw new DevKitAttachProcessFailedException($"{Enum.GetName(typeof(PS3TMAPI.SNRESULT), result)}");
            }

            if (Params.processIDs.Length > 0)
            {
                Params.processID = Convert.ToUInt32(Params.processIDs[0]);
                PS3TMAPI.ProcessAttach(this.TargetIndex, UNIT, Params.processID);
                Console.WriteLine(Params.processID);

                return(PS3TMAPI.SUCCEEDED(PS3TMAPI.ProcessContinue(this.TargetIndex, Params.processID)));
            }

            return(false);
        }
 // Token: 0x06000BF1 RID: 3057 RVA: 0x0003D884 File Offset: 0x0003BA84
 public static bool SUCCEEDED(PS3TMAPI.SNRESULT res)
 {
     return(res >= PS3TMAPI.SNRESULT.SN_S_OK);
 }
 // Token: 0x06000BF0 RID: 3056 RVA: 0x0003D868 File Offset: 0x0003BA68
 public static bool FAILED(PS3TMAPI.SNRESULT res)
 {
     return(!PS3TMAPI.SUCCEEDED(res));
 }
Ejemplo n.º 15
0
 /// <summary>Disconnect the target.</summary>
 public int DisconnectTarget()
 {
     PS3TMAPI.SNRESULT sNRESULT = PS3TMAPI.Disconnect(Target);
     IsConnected = false;
     return((int)sNRESULT);
 }