Seregon/ShadPKG

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

C++/47.3 KB/No license
ps4MEL/readme.md
ShadPKG / ps4MEL / readme.md
1# PS4 Memory Emulation Layer (PS4MEL)
2 
3Complete runtime emulation layer for decompiled PS4 games.
4 
5## Components
6 
7| File | Description |
8|------|-------------|
9| `ps4_memory.h/cpp` | 16MB global memory + address translation |
10| `ps4_tls.h/cpp` | Thread Local Storage (Windows/POSIX) |
11| `ps4_kernel.h/cpp` | 30+ sceKernel* syscalls |
12| `ps4_pthread.h/cpp` | Threading primitives |
13| `ps4_graphics.h/cpp` | VideoOut/GnmDriver stubs |
14| `runtime.h/cpp` | Initialization + additional stubs |
15 
16## Architecture
17 
18```
19┌────────────────────────────────────────────────────┐
20│ Decompiled Game Code │
21├────────────────────────────────────────────────────┤
22│ PS4_GLOBAL_* │ sceKernel* │ scePthread* │
23├────────────────┼────────────┼─────────────────────┤
24│ ps4_memory │ ps4_kernel │ ps4_pthread │
25│ (16MB region) │ (syscalls) │ (threading) │
26└────────────────────────────────────────────────────┘
27```
28 
29## Usage
30 
311. Include headers in your decompiled code
322. Call `runtime_init()` at program start
333. Call `runtime_shutdown()` before exit
34 
35## API Reference
36 
37### Memory (`ps4_memory.h`)
38- `PS4_GLOBAL_I64(addr)` - Read 64-bit from PS4 address
39- `PS4_GLOBAL_PTR(addr)` - Get pointer to PS4 address
40- `TranslateAddress(addr)` - Convert PS4 → host address
41 
42### Kernel (`ps4_kernel.h`)
43- `sceKernelOpen/Close/Read/Write` - File I/O
44- `sceKernelMmap/Munmap/Mprotect` - Memory management
45- `sceKernelGetProcessTime` - Timing
46- `sceKernelUsleep/Nanosleep` - Sleep
47 
48### Threading (`ps4_pthread.h`)
49- `scePthreadCreate/Join/Exit` - Thread lifecycle
50- `scePthreadMutex*` - Mutex operations
51- `scePthreadCond*` - Condition variables
52 
53### Graphics (`ps4_graphics.h`)
54- `sceVideoOutOpen/Close` - Display initialization
55- `sceGnmSubmitCommandBuffers` - GPU commands (stub)
56 
57## License
58 
59Part of ShadPKG project.