I'm working on a project that involves redirecting IOP modules loaded from ROM to ones located on a memory card (from a dump from specific, different console revision). This includes PADMAN, MCMAN, etc. I've created a module to redirect ROM0:/ files to MC1:/, and it does work so far. Problem is, the game I'm trying to load with this module intact does an IOP reset pretty early, effectively disabling my redirection module. How can I trap IOP resets to reinject my redirector module? I've looked at the sources for PS2RD and OPL, and the basic process seems to be to hook 2 EE functions and then inject your own modules that need to be stored in kernel RAM before loading the game. Then when the game tries to do an IOP reset, the hooked functions are free to replace certain modules before doing the reset. Am I understanding that correctly? Any advice would be appreciated.
It hooks onto SifSetDma and SifSetReg, and identifies IOP reset packets. The newer version of OPL simply use a custom UDNL module that will replace CDVDMAN and CDVDFSV with its own versions. No patching of the IOPRP image on the EE side is required. As of right now, OPL keeps a separate IOPRP image that contains the new CDVDMAN and CDVDFSV because OPL has different sets of CDVDMAN and CDVDFSV modules. If you do not need multiple versions of any modules, then you could just integrate your IOPRP image into the UDNL module by replacing its 0-byte IOPRP.IMG file in its sources. If you do it that way, then it becomes simpler because you do not need to allocate memory and upload your IOPRP image.