A tool for deriving PKG packet encryption keys for ps4 written in c++
| 1 | /* |
| 2 | * ╔═══════════════════════════════════════════════════════════════════════════╗ |
| 3 | * ║ PS4 MOCK RUNTIME HEADER ║ |
| 4 | * ╠═══════════════════════════════════════════════════════════════════════════╣ |
| 5 | * ║ Declarations for PS4 syscall stubs and runtime functions. ║ |
| 6 | * ╚═══════════════════════════════════════════════════════════════════════════╝ |
| 7 | */ |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include <chrono> |
| 12 | #include <cstddef> |
| 13 | #include <cstdint> |
| 14 | #include <string> |
| 15 | #include <thread> |
| 16 | |
| 17 | /* |
| 18 | * ┌─────────────────────────────────────────────────────────────────┐ |
| 19 | * │ RUNTIME LIFECYCLE │ |
| 20 | * └─────────────────────────────────────────────────────────────────┘ |
| 21 | */ |
| 22 | |
| 23 | void runtime_init(); |
| 24 | void runtime_shutdown(); |
| 25 | std::string resolve_path(const std::string &ps4_path); |
| 26 | |
| 27 | /* |
| 28 | * ┌─────────────────────────────────────────────────────────────────┐ |
| 29 | * │ PS4 KERNEL SYSCALLS │ |
| 30 | * └─────────────────────────────────────────────────────────────────┘ |
| 31 | */ |
| 32 | |
| 33 | extern "C" { |
| 34 | |
| 35 | // ─────────────────────── FILE I/O ─────────────────────── |
| 36 | int sceKernelOpen(const char *path, int flags, int mode); |
| 37 | ssize_t sceKernelRead(int fd, void *buf, size_t nbyte); |
| 38 | int sceKernelClose(int fd); |
| 39 | off_t sceKernelLseek(int fd, off_t offset, int whence); |
| 40 | |
| 41 | // ─────────────────────── MEMORY ─────────────────────── |
| 42 | void *sceKernelMmap(void *addr, size_t len, int prot, int flags, int fd, |
| 43 | off_t offset); |
| 44 | int sceKernelMunmap(void *addr, size_t len); |
| 45 | |
| 46 | // ─────────────────────── THREADING ─────────────────────── |
| 47 | int scePthreadCreate(void *thread, void *attr, void *(*start_routine)(void *), |
| 48 | void *arg); |
| 49 | int scePthreadMutexLock(void *mutex); |
| 50 | int scePthreadMutexUnlock(void *mutex); |
| 51 | |
| 52 | // ─────────────────────── MODULES ─────────────────────── |
| 53 | int sceKernelLoadStartModule(const char *path, size_t args, const void *argp, |
| 54 | unsigned int flags, void *option, int *result); |
| 55 | int sceSysmoduleLoadModule(int id); |
| 56 | |
| 57 | // ─────────────────────── MISC ─────────────────────── |
| 58 | uint64_t sceKernelGetProcessTime(); |
| 59 | int sceKernelUsleep(unsigned int usec); |
| 60 | |
| 61 | } // extern "C" |
| 62 |