private void btnGameChecker_Click(object sender, EventArgs e) { var version = Util.GameInfoArray()[1]; //Grabs process's version var cusa = Util.GameInfoArray()[0]; //Grabs process's CUSA try { Calling.Notify("CUSA : " + $"{cusa}" + "\nVersion : " + $"{version}"); //Notifies PS4 with CUSA and Vesrion running pbGameImage.Load("https://store.playstation.com/store/api/chihiro/00_09_000/titlecontainer/US/en/999/" + Util.GameInfoArray()[0] + "_00/image"); //Uses the CUSA that was grabbed to load the image from the website. lblCUSA.Text = "CUSA : " + $"{cusa}"; lblVersion.Text = "Version : " + $"{version}"; } catch { lblCUSA.Text = "Make sure you are on the game!"; lblVersion.Text = "This checks the game you have loaded on your PS4!"; } }
public static void attachToGame(string processName, string gameName, ref bool att, ref int pid, ref ulong procEntry, ref List <ulong> _entryList, ref ulong stub, ref ulong stringbuf, bool initRpc = false) { var cusa = GameInfoArray()[0]; var version = GameInfoArray()[1]; PS4 = main.PS4; try { PS4.Connect(); ProcessList pl = PS4.GetProcessList(); ProcessInfo pi; foreach (Process p in pl.processes) { if (p.name == processName) { pid = p.pid; pi = PS4.GetProcessInfo(p.pid); _entryList.Clear(); for (int i = 0; i < pi.entries.Length; i++) { MemoryEntry me = pi.entries[i]; _entryList.Add(me.start); } for (int i = 0; i < pi.entries.Length; i++) { MemoryEntry me = pi.entries[i]; if (me.prot == 5) { procEntry = me.start; if (initRpc) { if (stub == 0) { stub = PS4.InstallRPC(pid); vme = pi.FindEntry("libSceLibcInternal.sprx"); if (Calling.version == 405) { stringbuf = PS4.Call(pid, stub, vme.start + 0x382F0, 0x1000); } else if (Calling.version == 455) { stringbuf = PS4.Call(pid, stub, vme.start + 0x2C2A0, 0x1000); } else if (Calling.version == 505) { stringbuf = PS4.Call(pid, stub, vme.start + 0x23D90, 0x1000); } else { stringbuf = PS4.Call(pid, stub, vme.start + 0x23D90, 0x1000); } } } Calling.Notify("PS4 Trainer by TylerMods\n\nAttached to " + gameName + "!\n\n\n\n\n\n", 210); Launching.main.lblAttached.Text = "Attached : True"; var result = Regex.Replace( "Attached : True", // input @"Attached", // word to match @"<b>$0</b>", // "wrap match in bold tags" RegexOptions.IgnoreCase); // ignore case when matching Launching.main.lblCUSA.Text = $"CUSA : {cusa}"; Launching.main.lblGameVersion.Text = $"Version : {version}"; Launching.main.lblGame.Text = $"Game : {gameName}"; break; } } //MessageBox.Show("Successfully detected game process.\n\nAttached to process (" + p.name + ", " + pid + ")!", "Game Detected", MessageBoxButtons.OK, MessageBoxIcon.Information); att = true; return; } } MessageBox.Show("Failed to detect game process.\nMake sure " + gameName + " is running!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); att = false; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error); Launching.main.lblAttached.Text = "Attached : False"; Launching.main.lblCUSA.Text = "CUSA : Not Attached"; Launching.main.lblGameVersion.Text = "Version : Not Attached"; Launching.main.lblGame.Text = "Game : Not Attached"; } }