public bool GetThreadByName(string name, ref PS3TMAPI.PPUThreadInfo LocalthreadInfo) { PS3TMAPI.ProcessInfo processInfo; PS3TMAPI.GetProcessInfo(Target, Parameters.ProcessID, out processInfo); if (processInfo.ThreadIDs.Length <= 0) { return(false); } for (int i = 0; i < processInfo.ThreadIDs.Length; i++) { PS3TMAPI.GetPPUThreadInfo(Target, Parameters.ProcessID, processInfo.ThreadIDs[i], out LocalthreadInfo); if (LocalthreadInfo.ThreadName == null) { continue; } if (LocalthreadInfo.ThreadName.Contains(name)) { return(true); } } return(false); }
/// <summary> /// /// </summary> /// <returns></returns> public static bool Install() { try { if (PS3.Extension.ReadUInt64(INSTALL_ADDR) == 0x3C60000160630068) { return(true); } ulong PC = 0; ulong[] Registers = new ulong[0x49]; PS3.Extension.WriteString(RPC_THREAD_NAME_ADDR, RPC_THREAD_NAME); PS3.SetMemory(INSTALL_ADDR, RPC_INSTRUCTIONS); PS3.MainThreadStop(); for (uint i = 0; i < 0x49; i++) { Registers[i] = PS3.GetSingleRegister(i); } PC = PS3.GetSingleRegister((uint)TMAPI.SPRegisters.SNPS3_pc); PS3.SetSingleRegister((uint)TMAPI.SPRegisters.SNPS3_pc, INSTALL_ADDR); PS3.MainThreadContinue(); while (PS3.Extension.ReadUInt64(RPC_CREATION) == 0) { Thread.Sleep(1); } PS3.MainThreadStop(); for (uint i = 0; i < 0x49; i++) { PS3.SetSingleRegister(i, Registers[i]); } PS3.SetSingleRegister((uint)TMAPI.SPRegisters.SNPS3_pc, PC); PS3.MainThreadContinue(); PS3TMAPI.PPUThreadInfo ThreadInfo = new PS3TMAPI.PPUThreadInfo(); if (PS3.GetThreadByName(RPC_THREAD_NAME, ref ThreadInfo)) { PS3.StopThreadyID(ThreadInfo.ThreadID); PS3.SetSingleRegisterByThreadID(ThreadInfo.ThreadID, (uint)TMAPI.GPRegisters.SNPS3_gpr_13, Registers[13]); PS3.ContinueThreadByID(ThreadInfo.ThreadID); } return(true); } catch { return(false); } }