mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 16:59:35 -04:00
93e221feaa
* feat: remove memory and pad from stub section * feat: add support for resume entry targets in CodeGenerator (this allow jumps in address outside function) feat: refactor entry point discovery one more try to reduce big generated file * feat: optmizations for release build * feat: remove unused file * feat: added some test cases for code gen * feat: added log macro and remove win specific code * feat: refactor runtime folder structure feat: added reset sound driver RPC state and compatibility layout feat: rename and added new test feat: update RPC calls to use defined constants feat: added more PSMC(16, 32) feat: change cd read to try find the asset ignoring case sensitive fix: fix some render problems feat: add logs on pad feat: added more RPC handles * feat: added game override for code veronica * feat: apply vita patch * feat: flags to disable build * feat: fix merges feat: break a lot of tests * feat: better throw error on empty cd path feat: remove recompiler unusde function feat: apply missing patch * feat: gamedp is now part of lib feat: missing file * feat: small cleanup * feat: missing vita changes * feat: fix more merge * feat: fix tests * feat: last missing feature * feat: added missing import * feat: rename test local functions * feat: init syscall on ps2 list * feat: added DMA helpers * feat: faster builds feat: more implement for darkcloud * feat: back missing file * feat: added missing includes * feat: remove test * feat: missing include * feat: read register funtion * feat: build fix * feat: force exit on detach thread
58 lines
2.1 KiB
Markdown
58 lines
2.1 KiB
Markdown
# Runtime Library
|
|
The runtime library provides the execution environment for recompiled code, including:
|
|
|
|
* Memory management (32MB main RAM, scratchpad, etc.)
|
|
* Register context (128-bit GPRs, VU0 registers, etc.)
|
|
* Function table for dynamic linking
|
|
* Basic PS2 system call stubs
|
|
|
|
# How to use:
|
|
|
|
Take your decompiled code and place the cpp files on ps2xRuntime/src/runner and header files on ps2xRuntime/include and compile/be happy.
|
|
|
|
## Vita Build Notes
|
|
|
|
The Vita runtime uses `Quenom/raylib-5.5-vita` for vita build. I recommend build runtime only.
|
|
|
|
Expected environment:
|
|
|
|
* `VITASDK` points to your VitaSDK root.
|
|
* `Quenom/raylib-5.5-vita` has already been built and installed into `$VITASDK/arm-vita-eabi`.
|
|
* SDL2 with the PVR backend required by that raylib fork is also installed into the same VitaSDK prefix.
|
|
* `PS2X_DEFAULT_BOOT_ELF` is mandatory, you need to define where your game is like "ux0:data/RANJ00001/game/SLUS_201.84".
|
|
|
|
The CMake for `ps2xRuntime` consumes those preinstalled headers and libraries from VitaSDK. It does not fetch or install the Vita raylib fork for you.
|
|
|
|
## Adding Custom Function Implementations
|
|
You can add custom implementations for PS2 system calls or game functions by:
|
|
|
|
1. Creating function implementations that match the signature:
|
|
```cpp
|
|
void function_name(uint8_t* rdram, R5900Context* ctx, PS2Runtime *runtime);
|
|
```
|
|
|
|
2. Registering them with the runtime:
|
|
```cpp
|
|
runtime.registerFunction(address, function_name);
|
|
```
|
|
|
|
## Advanced Features
|
|
Memory Translation
|
|
The runtime handles PS2's memory addressing, including:
|
|
|
|
* KSEG0/KSEG1 direct mapping
|
|
* TLB lookups for user memory
|
|
* Special memory areas (scratchpad, I/O registers)
|
|
|
|
## Vector Unit Support
|
|
PS2-specific 128-bit MMI instructions and VU0 macro mode instructions are supported via SSE/AVX intrinsics.
|
|
|
|
## Instruction Patching
|
|
You can patch specific instructions in the recompiled code to fix game issues or implement custom behavior.
|
|
|
|
## Limitations
|
|
|
|
* Graphics and sound output require external implementations
|
|
* Some PS2-specific hardware features may not be fully supported
|
|
* Performance may vary based on the complexity of the game
|