Files
Ranieri 75d729ce40 Feature/iop emulator (#244)
* refactor: from guest  threads to EE scheduler

* feat: bad wip mpeg fix for code veronica

* feat: cheap copy from host
feat: small perf o vsync tick

* feat: added EE clock Hz
fix: fix MPEG out of sync with new EE refactor

* fix: fix lotr tests

* fix: fix cri dtx loading
fix: fix wrong mmi instruction translation
fix: fix thread info params
feat: added EE  timers decoder and consumer
feat: split SFI and IOP memory to prevent collision and overrides

* feat: revert wrong changes

* refactor: change GS architecture

* feat: IOP emulator
refactor: codegen to catch callbacks on mips code
feat: added a lot of entries or IOP emulator

* feat: analyzer resolve the complete constant-producing sequence with five-instruction backward scan stopped at LUI and therefore

* feat: remove recompiled version of GetRomName
refactor: split IOP emulator logic
feat: added more HLE IOP modules
feat: added ps2_path

* eat: enhance ELF parser with improved callable entry detection and control flow analysis

* feat: update memory hint handling and enhance entry point discovery logic

* feat: add SET_GPR_ZE32 macro for zero-extending loads with unsigned semantics

* refactor: Refactor PS2 IOP Host Adapter and Memory Management
feat: Added PS2Vfs for virtual file system operations, including file opening, reading, writing, and path resolution.
feat: Improve VIF1 data processing to handle GIF image packets more efficiently.

* feat: added a lot of tests

* fix: fix texture caching
feat: wip multi version on dbcman

* feat: remove LLE IOPs
2026-09-19 21:31:44 -03:00
..
2026-09-19 21:31:44 -03:00
2026-09-19 21:31:44 -03:00
2026-09-19 21:31:44 -03:00
2026-09-19 21:31:44 -03:00

ps2xIOP

ps2xIOP runs original IRX modules on an R3000A interpreter, with a virtual IOP kernel providing imports without a PS2 BIOS. The C++20 static library ps2_iop / ps2x::iop is linked into ps2xRuntime.

Execution policy

Game-specific IOP code executes from IRX modules. There is no game-profile selection or native profile-plugin loader. A physical IRX RPC server is authoritative for its SID.

Generic HLE services remain available when no loaded IRX provides an endpoint:

Service SID Activation
MCSERV 0x80000400, 0x80000480 Recognized module load
LIBSD 0x80000701 Recognized module load
DBCMAN 0x80001300 Recognized module load

These services are dormant before module load and after reset or the final module stop. Unknown modules fail to load; unknown RPC SIDs remain unhandled. Games previously using TSNDDRV, CRI DTX, CLFILE, SOUND or SDRDRV profiles now require their IRX modules and support for the imports and hardware they use.

Lifecycle and transport

  • reset() clears loaded modules, HLE service state and emulator state.
  • loadModule(...) / loadModuleBuffer(...) load and start an IRX.
  • stopModule(...) releases a module and its owned state.
  • runEeCycles(...) advances the IOP from EE cycle accounting.
  • selectRpcAbi(...), handleRpc(...) and onSifTransfer(...) connect SIF transport.

IOP RAM is separate from EE RAM. The transport copies data through the IOP memory accessors; SIF notifications do not mirror bytes into equal-numbered EE addresses. RpcResult describes completion and dispatch actions for the runtime.

Link with target_link_libraries(my_runtime PRIVATE ps2x::iop). The public API is iop_subsystem.h; PS2Runtime owns its subsystem and host adapter.

Diagnostics and tests

debugSnapshot() exposes emulator cycle/instruction counts, loaded module, thread and RPC-server counts, generic service metrics and load diagnostics. The runtime debugger renders these in the IOP/SIF tab.

Build standalone tests with:

cmake -S ps2xIOP -B out/build/iop-tests -DPS2X_IOP_BUILD_TESTS=ON
cmake --build out/build/iop-tests
ctest --test-dir out/build/iop-tests --output-on-failure

The suites cover IRX execution, RPC, imports, version resolution and generic HLE compatibility. ps2x_tests also covers runtime SIF RPC/DMA integration.