mirror of
https://github.com/Pharaoh2k/ps5debug-NG.git
synced 2026-10-22 03:42:51 -05:00
vm_map nentries/name adjustments were gated to explicit 6/7.0x/8.x cases, so 7.5x (7.20-7.61) and 9.x+ got no adjustment. That broke locating the inject target on install and left PROC_INFO/PROC_LIST/PROC_MAPS names empty/truncated. Switch all three sites (installer proc_elf, debugger proc_elf, scan) to a >= 6.x threshold. - find_pid: locate SceShellCore via sysctl KERN_PROC_PID/ki_comm (firmware-agnostic) instead of a per-FW struct proc name offset. - install_kernel_patch: skip the write when the jailbreak already set the bits, preventing a kernel panic on 7.61. - proc_field_offsets: switch to threshold offsets (corrects 7.5x and adds 10/11/12.x).
36 lines
782 B
C
36 lines
782 B
C
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
#include "sdk_shim.h"
|
|
|
|
int find_proc_pid_by_name(const char *name)
|
|
{
|
|
if (!name) return -1;
|
|
|
|
for (int pid = 1; pid < 0x2710; pid++) {
|
|
int mib[4];
|
|
uint8_t kinfo[0x448];
|
|
size_t outlen = 0x448;
|
|
|
|
mib[0] = 1;
|
|
mib[1] = 0xE;
|
|
mib[2] = 1;
|
|
mib[3] = pid;
|
|
|
|
if (__crt_syscall(202, (long)(intptr_t)mib, 4,
|
|
(long)(intptr_t)kinfo,
|
|
(long)(intptr_t)&outlen, 0, 0) != 0)
|
|
continue;
|
|
|
|
char comm[0x14];
|
|
memcpy(comm, &kinfo[0x1BF], 0x13);
|
|
comm[0x13] = 0;
|
|
|
|
if (strcmp(comm, name) == 0)
|
|
return pid;
|
|
}
|
|
return -1;
|
|
}
|