Skip to content

Add IOP, audio, pad, fio changes, VAG handling, and call-stack logger#76

Merged
ran-j merged 1 commit intoran-j:mainfrom
aslanhudajev:feat/iop-audio-pad-and-logger
Feb 24, 2026
Merged

Add IOP, audio, pad, fio changes, VAG handling, and call-stack logger#76
ran-j merged 1 commit intoran-j:mainfrom
aslanhudajev:feat/iop-audio-pad-and-logger

Conversation

@aslanhudajev
Copy link
Contributor

@aslanhudajev aslanhudajev commented Feb 23, 2026

  • Add IOP with RPC handling (handleRPC, LibSd SID) and init/reset using RDRAM
  • Add IOP audio layer for LibSd RPC (handleLibSdRpc)
  • Add PS2AudioBackend with VAG decode, onVagTransfer/onSoundCommand, raylib playback
  • Add PSPadBackend with readState and raylib input
  • Add IOP RAM mapping in Memory (getIOPRAM) for EE↔IOP access
  • Add fio syscalls: fioOpen, fioRead, fioWrite, fioClose, fioLseek, fioMkdir
  • Add VAG accumulation for fio reads (multi-chunk VagAccumEntry)
  • Add ps2_log.h call-stack logger (tab-indented, Debug only, ps2_log.txt next to exe)
  • Code generator: emit ps2_log include and PS_LOG_ENTRY for full functions
  • Recompiler: emit ps2_log include and PS_LOG_ENTRY for stubs
  • Runtime: print "[PS2 LOG] Logs saved at " on exit (Debug only)

Architecture

flowchart TB
    subgraph EE["Emotion Engine (EE)"]
        Recomp["Recompiled Code"]
        Syscalls["Syscalls / Stubs"]
    end

    subgraph Memory["Memory"]
        RDRAM["RDRAM (EE main RAM)"]
        IOPRAM["iop_ram (future)"]
    end

    subgraph IOP["IOP Layer"]
        RPC["handleRPC()"]
        LibSd["LibSd RPC"]
    end

    subgraph Backends["Host Backends"]
        Audio["PS2AudioBackend\n(VAG decode, raylib)"]
        Pad["PSPadBackend\n(raylib input)"]
    end

    subgraph FIO["File I/O"]
        SyscallFio["fioOpen/Read/Write/Close/Lseek/Mkdir"]
        VagAccum["VAG accumulation\n(multi-chunk)"]
        HostFS["Host filesystem"]
    end

    Recomp --> Syscalls
    Syscalls -->|"SIF RPC"| RPC
    Syscalls -->|"pad reads"| Pad
    Syscalls --> SyscallFio

    RPC -->|"rdram ptr"| RDRAM
    RPC --> LibSd
    LibSd --> Audio

    SyscallFio --> VagAccum
    VagAccum --> HostFS
    VagAccum -->|"VAG data"| Audio

    RDRAM -.->|"not yet used"| IOPRAM
    ```
Loading

@aslanhudajev
Copy link
Contributor Author

Note how the audio implementation does not yet use iop_ram from ps2_memory.h.
Just wanted to make that clear.

- Add IOP with RPC handling (handleRPC, LibSd SID) and init/reset using RDRAM
- Add IOP audio layer for LibSd RPC (handleLibSdRpc)
- Add PS2AudioBackend with VAG decode, onVagTransfer/onSoundCommand, raylib playback
- Add PSPadBackend with readState and raylib input
- Add IOP RAM mapping in Memory (getIOPRAM) for EE↔IOP access
- Add fio syscalls: fioOpen, fioRead, fioWrite, fioClose, fioLseek, fioMkdir
- Add VAG accumulation for fio reads (multi-chunk VagAccumEntry)
- Add ps2_log.h call-stack logger (tab-indented, Debug only, ps2_log.txt next to exe)
- Code generator: emit ps2_log include and PS_LOG_ENTRY for full functions
- Recompiler: emit ps2_log include and PS_LOG_ENTRY for stubs
- Runtime: print "[PS2 LOG] Logs saved at <path>" on exit (Debug only)
@aslanhudajev aslanhudajev force-pushed the feat/iop-audio-pad-and-logger branch from 2bec677 to d930f57 Compare February 23, 2026 23:53
@aslanhudajev
Copy link
Contributor Author

Problems:
When any input is read, audio slows down considerably.
Will need to be fixed in future release.

@ran-j ran-j merged commit c1e98c9 into ran-j:main Feb 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants