Running game and ps2dev9.irx + ps2ip.irx simultaneously

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
User avatar
HoRRoR_X
Posts: 1
Joined: Mon Nov 09, 2009 12:57 am
Contact:

Running game and ps2dev9.irx + ps2ip.irx simultaneously

Post by HoRRoR_X »

Hello. I'm to run TCP/IP server and PS2 game on my PS2 simultaneously. There appears to be a problem: when I reset IOP using an image on cdrom by SifIopReset("rom0:UDNL cdrom0:\\<myiopimg>;1", 0), it can't load ps2dev9.irx. When I do the same by SifIopReset("rom0:UDNL rom0:EELOADCNF", 0), game's running but everything else isn't working. Does any method exist to load IOP modules in such a way as to get everything working?

Another question: can I load modules from memory rather than image on cd-rom when resetting IOP?

P.S. I have small knowledge of PS2 architecture and no experience of programming for this console; I'm learning by studying sources and examples...
dlanor
Posts: 258
Joined: Thu Oct 28, 2004 6:28 pm
Location: Stockholm, Sweden

Re: Running game and ps2dev9.irx + ps2ip.irx simultaneously

Post by dlanor »

HoRRoR_X wrote:Hello. I'm to run TCP/IP server and PS2 game on my PS2 simultaneously. There appears to be a problem: when I reset IOP using an image on cdrom by SifIopReset("rom0:UDNL cdrom0:\\<myiopimg>;1", 0), it can't load ps2dev9.irx.
Here you need to realize that ps2dev9.irx is one of the drivers you already have running at the time (probably a different version than the game's), since it is one of the basic drivers required for networking.

The fact that the driver is in use for current file transfers is problably why you can't reset it as you intended. But even if that had worked it would also have killed the active networking, so you'd have to 'catch' this case and somehow reinitialize the newly loaded module to do the same thing the old module was doing. And in this it is not enough to handle just the Dev9 driver, as that is just one of several drivers involved in networking. You'd have to wait for them all to be reloaded, and possibly enforce reload of something the game might not use, before the networking can be re-initialized properly. And by that time the reloading is likely to have failed anyway, if it relied in any way on that networking for its functionality.
When I do the same by SifIopReset("rom0:UDNL rom0:EELOADCNF", 0), game's running but everything else isn't working.
"everything else" is a bit vague, but it is obvious that any modules you set up before that call will have been killed by it, including your networking setup. Again, you would have to repeat the initialization of that stuff (possibly from RAM-embedded module files of your own), before you can have it running normally again.
Does any method exist to load IOP modules in such a way as to get everything working?
There are methods to do it, but not any generic method that applies to all cases (since the variations of those are endless).
Another question: can I load modules from memory rather than image on cd-rom when resetting IOP?
Not by the method you described above, using an IOP image file, as this would require that you first add a new device driver, to open files in RAM storage. That method is possible too, but needlessly complex, and it still relies on another method for loading that device driver anyway.

The other, and more generic method is to simply load modules individually from embedded storage in your program, like most homebrew programs do it.

Since you said that you aren't very familiar with PS2 homebrew methods it may be a good idea to study how other homebrew programs do the things you wish to do in yours. One such program that I am involved with, called uLaunchELF (aka: uLE) uses many different embedded modules, including both device drivers and other stuff. And this project is open-source, available at PSX-scene.com for your studies. (That project has a separate subforum there, inside the one for "PS2 Homebrew/Dev..." stuff.)

But the big difference from your needs is that you want to control things while a game is running, which raises additional problems for your resident routines, which must be able to survive IOP reset and module reloading as commanded by the game code. This is something uLE never has to do, so you won't find any tips on that there.

Another open-source project more related to your needs would be the new USBLoader variant (recently renamed "Open PS2 Loader") which in addition to its old capability of using USB drives now also uses SMB networking to run games stored in a fileshare folder of a networked PC (normally stored on an HDD of that PC, though other media also work). That game loader must make its SMB networking drivers survive all the IOP initialization work done by the games, so this should be close to identical to your own needs.

You can find more information on that project, including full source code, at this page.

Best regards: dlanor
Post Reply