Seregon/ShadPKG

A tool for deriving PKG packet encryption keys for ps4 written in c++

C++/47.3 KB/No license
ps4MEL/runtime.h
ShadPKG / ps4MEL / runtime.h
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 
23void runtime_init();
24void runtime_shutdown();
25std::string resolve_path(const std::string &ps4_path);
26 
27/*
28 * ┌─────────────────────────────────────────────────────────────────┐
29 * │ PS4 KERNEL SYSCALLS │
30 * └─────────────────────────────────────────────────────────────────┘
31 */
32 
33extern "C" {
34 
35// ─────────────────────── FILE I/O ───────────────────────
36int sceKernelOpen(const char *path, int flags, int mode);
37ssize_t sceKernelRead(int fd, void *buf, size_t nbyte);
38int sceKernelClose(int fd);
39off_t sceKernelLseek(int fd, off_t offset, int whence);
40 
41// ─────────────────────── MEMORY ───────────────────────
42void *sceKernelMmap(void *addr, size_t len, int prot, int flags, int fd,
43 off_t offset);
44int sceKernelMunmap(void *addr, size_t len);
45 
46// ─────────────────────── THREADING ───────────────────────
47int scePthreadCreate(void *thread, void *attr, void *(*start_routine)(void *),
48 void *arg);
49int scePthreadMutexLock(void *mutex);
50int scePthreadMutexUnlock(void *mutex);
51 
52// ─────────────────────── MODULES ───────────────────────
53int sceKernelLoadStartModule(const char *path, size_t args, const void *argp,
54 unsigned int flags, void *option, int *result);
55int sceSysmoduleLoadModule(int id);
56 
57// ─────────────────────── MISC ───────────────────────
58uint64_t sceKernelGetProcessTime();
59int sceKernelUsleep(unsigned int usec);
60 
61} // extern "C"
62