mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-10-01 18:31:21 -04:00
Feature/stub by address (#61)
* feat: split runtime code in small files to be easy to develop * feat: split stubs in inl files * feat: function auto link function treat functions with underscore as same as without underscore * feat: remove underscore prefix from stubs * feat: thread and flags refactor * feat: propagate request stop feat: some elf validation on runtime * feat: remove Z7 compiler options feat: added a literal float case error on vu * fix: fix critical recompiler error on marking pc calls * feat: better system interrupt refactor: small refactor on thread system * feat: stubs implements for resident evil code veronica * feat: merge fileio * feat: stub by address * feat: codegen now auto-routes J/JAL callssites with known relocation symbols to syscalls/stubs
This commit is contained in:
@@ -34,6 +34,8 @@ The translated code is very literal, with each MIPS instruction mapping to a C++
|
||||
### Current Behavior
|
||||
|
||||
* `stubs` entries generate wrappers that call known runtime syscall/stub handlers by name.
|
||||
* `stubs` also supports address bindings with `handler@0xADDRESS` for stripped games (for example `sceCdRead@0x00123456`).
|
||||
* Recompiler now tries relocation-symbol auto-binding at callsites (`J/JAL`) before raw address dispatch; when relocation symbol is known (for example `sceCdRead`), it can call runtime handlers without manual address mapping.
|
||||
* `skip` entries are not recompiled and generate explicit `ps2_stubs::TODO_NAMED(...)` wrappers.
|
||||
* Recompiled `SYSCALL` now calls `runtime->handleSyscall(...)` with the encoded syscall immediate.
|
||||
* Runtime syscall dispatch tries encoded syscall ID first, then falls back to `$v1`.
|
||||
@@ -82,10 +84,19 @@ Main fields in `config.toml`:
|
||||
* `general.patch_syscalls`: apply configured patches to `SYSCALL` instructions (`false` recommended).
|
||||
* `general.patch_cop0`: apply configured patches to COP0 instructions.
|
||||
* `general.patch_cache`: apply configured patches to CACHE instructions.
|
||||
* `general.stubs`: names to force as stubs.
|
||||
* `general.stubs`: names to force as stubs. Also accepts `handler@0xADDRESS` to bind a stripped function address directly to a runtime syscall/stub handler.
|
||||
* `general.skip`: names to force as skipped wrappers.
|
||||
* `patches.instructions`: raw instruction replacements by address.
|
||||
|
||||
Address binding for stripped ELFs:
|
||||
|
||||
* Use `handler@0xADDRESS` inside `general.stubs` to map a stripped function start directly to a runtime handler.
|
||||
* Example: `sceCdRead@0x00123456` binds function start `0x00123456` to `ps2_stubs::sceCdRead(...)`.
|
||||
* Before manual binding, try plain recompilation first: if ELF relocation symbols are present for calls, runtime handler routing can be inferred automatically.
|
||||
* The address must be the function start in that exact ELF build.
|
||||
* Addresses are not portable across different games/regions/builds.
|
||||
* The handler name must exist in runtime call lists (`PS2_SYSCALL_LIST` or `PS2_STUB_LIST`).
|
||||
|
||||
Example:
|
||||
|
||||
```toml
|
||||
@@ -101,6 +112,11 @@ patch_cache = true
|
||||
|
||||
stubs = ["printf", "malloc", "free"]
|
||||
|
||||
# stripped function binding by address:
|
||||
# stubs = ["sceCdRead@0x00123456", "SifLoadModule@0x00127890"]
|
||||
# mixed example:
|
||||
# stubs = ["printf", "sceCdRead@0x00123456", "SifLoadModule@0x00127890"]
|
||||
|
||||
skip = ["abort", "exit"]
|
||||
|
||||
[patches]
|
||||
@@ -131,4 +147,4 @@ To execute the recompiled code.
|
||||
* Inspired by N64Recomp
|
||||
* Uses ELFIO for ELF parsing
|
||||
* Uses toml11 for TOML parsing
|
||||
* Uses fmt for string formatting
|
||||
* Uses fmt for string formatting
|
||||
|
||||
Reference in New Issue
Block a user