/// <summary> /// Attaches to target process. /// This should automatically continue the process if it is stopped. /// </summary> public bool Attach() { if (_ccapi == null) { _ccapi = new CCAPI(); } return(_ccapi.AttachProcess(CCAPI.ProcessType.CURRENTGAME) >= 0); }
/// <summary> /// Called by user. /// Should display options for the API. /// Can be used for other things. /// </summary> public void Configure() { if (_ccapi == null) { _ccapi = new CCAPI(); } _ccapi.OpenManager(); }
/// <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 (!enabled) { return(false); } if (_ccapi == null) { _ccapi = new CCAPI(); } return(_ccapi.GetMemory((uint)address, bytes) >= 0); }
/// <summary> /// Shutdown game or platform /// </summary> public void Shutdown() { if (!enabled) { return; } if (_ccapi == null) { _ccapi = new CCAPI(); } _ccapi.ShutDown(CCAPI.RebootFlags.ShutDown); }
/// <summary> /// Write bytes to the memory of target process. /// </summary> public void SetBytes(ulong address, byte[] bytes) { if (!enabled) { return; } if (_ccapi == null) { _ccapi = new CCAPI(); } _ccapi.SetMemory((uint)address, bytes); }
/// <summary> /// Disconnects from target. /// </summary> public void Disconnect() { if (!enabled) { return; } if (_ccapi == null) { _ccapi = new CCAPI(); } _ccapi.DisconnectTarget(); _ccapi = new CCAPI(); }
/// <summary> /// Connects to target. /// If platform doesn't require connection, just return true. /// </summary> public bool Connect() { if (!enabled) { return(false); } if (_ccapi == null) { _ccapi = new CCAPI(); } if (ip == "") { bool ret = _ccapi.ConnectTarget(); ip = _ccapi.ps3api.GetConsoleIP(); return(ret); } else { return(_ccapi.ConnectTarget(ip) >= 0); } }
public CCAPI() { RegistryKey Key = Registry .CurrentUser .OpenSubKey(@"Software\FrenchModdingTeam\CCAPI\InstallFolder"); if (Key != null) { //string Path = Key.GetValue("path") as String; string Path = ".\\APIs\\CCAPI 2.80"; programPath = Path; if (!string.IsNullOrEmpty(Path)) { string DllUrl = Path + @"\CCAPI.dll"; if (File.Exists(DllUrl)) { if (BitConverter.ToString(MD5.Create() .ComputeHash(File.ReadAllBytes(DllUrl))) .Replace("-", "").Equals(CCAPIHASH)) { if (libModule == IntPtr.Zero) { libModule = LoadLibrary(DllUrl); } if (libModule != IntPtr.Zero) { this.connectConsole = (CCAPI.CCAPIConnectConsole_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIConnectConsole"), typeof(CCAPI.CCAPIConnectConsole_t)); this.disconnectConsole = (CCAPI.CCAPIDisconnectConsole_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIDisconnectConsole"), typeof(CCAPI.CCAPIDisconnectConsole_t)); this.getConnectionStatus = (CCAPI.CCAPIGetConnectionStatus_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetConnectionStatus"), typeof(CCAPI.CCAPIGetConnectionStatus_t)); this.getConsoleInfo = (CCAPI.CCAPIGetConsoleInfo_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetConsoleInfo"), typeof(CCAPI.CCAPIGetConsoleInfo_t)); this.getDllVersion = (CCAPI.CCAPIGetDllVersion_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetDllVersion"), typeof(CCAPI.CCAPIGetDllVersion_t)); this.getFirmwareInfo = (CCAPI.CCAPIGetFirmwareInfo_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetFirmwareInfo"), typeof(CCAPI.CCAPIGetFirmwareInfo_t)); this.getNumberOfConsoles = (CCAPI.CCAPIGetNumberOfConsoles_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetNumberOfConsoles"), typeof(CCAPI.CCAPIGetNumberOfConsoles_t)); this.getProcessList = (CCAPI.CCAPIGetProcessList_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetProcessList"), typeof(CCAPI.CCAPIGetProcessList_t)); this.getProcessMemory = (CCAPI.CCAPIGetMemory_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetMemory"), typeof(CCAPI.CCAPIGetMemory_t)); this.getProcessName = (CCAPI.CCAPIGetProcessName_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetProcessName"), typeof(CCAPI.CCAPIGetProcessName_t)); this.getTemperature = (CCAPI.CCAPIGetTemperature_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIGetTemperature"), typeof(CCAPI.CCAPIGetTemperature_t)); this.notify = (CCAPI.CCAPIVshNotify_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIVshNotify"), typeof(CCAPI.CCAPIVshNotify_t)); this.ringBuzzer = (CCAPI.CCAPIRingBuzzer_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIRingBuzzer"), typeof(CCAPI.CCAPIRingBuzzer_t)); this.setBootConsoleIds = (CCAPI.CCAPISetBootConsoleIds_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPISetBootConsoleIds"), typeof(CCAPI.CCAPISetBootConsoleIds_t)); this.setConsoleIds = (CCAPI.CCAPISetConsoleIds_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPISetConsoleIds"), typeof(CCAPI.CCAPISetConsoleIds_t)); this.setConsoleLed = (CCAPI.CCAPISetConsoleLed_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPISetConsoleLed"), typeof(CCAPI.CCAPISetConsoleLed_t)); this.setProcessMemory = (CCAPI.CCAPISetMemory_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPISetMemory"), typeof(CCAPI.CCAPISetMemory_t)); this.shutdown = (CCAPI.CCAPIShutdown_t)Marshal.GetDelegateForFunctionPointer(CCAPI.GetProcAddress(this.libModule, "CCAPIShutdown"), typeof(CCAPI.CCAPIShutdown_t)); } else { MessageBox.Show("Impossible to load CCAPI.dll version 2.80.", "CCAPI.dll cannot be load", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("You're not using the right CCAPI.dll please install the version 2.80.", "CCAPI.dll version incorrect", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("You need to install CCAPI to use this library.", "CCAPI.dll not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Invalid CCAPI folder, please re-install it.", "CCAPI not installed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("You need to install CCAPI to use this library.", "CCAPI not installed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }