How to Pass Launch Arguments to a PS2 Game
(such as the developer build of Oni 2)
by Iritscen

Requirements:
- all the files in the top level of ps2launchargs/
- PCSX2
- a PS2 game on disc or an ISO
- (recommended) a USB gamepad

As of Jan. 2018, there is no existing way to pass launch arguments to a game on your PlayStation 2, nor in the PCSX2 emulator, nor in the homebrew boot loader uLaunchELF ("uLE" for short).  So I have customized an older version of uLE (v4.40h, the last known version compatible with PCSX2) to accept launch arguments from a text file and pass them to the game when launching it.  The BOOT.ELF file in this package is the custom build of uLE.

The following process must be performed in Windows, as uLE 4.40h does not run in the Mac build of PCSX2 (as of v0.97), nor in virtualized Windows on a Mac (at least, not in Fusion vmWare as of v10.1.1).  Follow these steps to start sending launch arguments to a game:

1. On the command line, move to the directory that contains ps2client.exe (in this package's folder) and call "ps2client.exe -h 192.168.0.10 listen".  ps2client will open a port for sharing with PCSX2 the directories listed in elflist.txt.  This file must be kept next to ps2client.exe, and it is currently set to "C:", meaning "share all of the C: drive".  Note that all hard drive access is read-only by default and that uLE is only interested in the LaunchArgs.txt file.

2. Ensure that LaunchArgs.txt contains what you want to be passed to the game.  Each new line is a separate argument.  This file must be kept next to BOOT.ELF.  Known launch arguments for Oni 2 are documented on the wiki (the redirect page "Oni2AS" will eventually lead you to the right place).

3. Open PCSX2.  (These instructions were written for v1.4.0.)
	A. Enable filesystem access by choosing System>Enable Host Filesystem.
	B. Under the CDVD menu, you need to pick "ISO" if you have an image file (like Oni 2) or else "Plugin" if the game is on disc.  Your choice will be mounted within uLE.
	C. Choose System>Run Elf… and choose BOOT.ELF (in this package's folder).
	D. Navigate in the file browser to cdfs:, then choose the game binary (for Oni 2, this is SCPS123.45) with the circle button.  The game will be launched with the arguments you chose in step 2.  If you cannot see the game in cdfs: (this may happen for any DVD-ROM game), you can always go to the main menu's MISC directory and choose "PS2Disc".

4. There are two ways to ensure that launch arguments are being passed properly:
	A. Look for an effect in-game.  The simplest working argument that you can test with Oni 2 is "-noui", which will cause the game to immediately load the first mission instead of the main menu.
	B. Open the PCSX2 console (Misc menu) and search for "uLaunchELF" to see messages from uLE as it reads LaunchArgs.txt and passes the arguments to uLE's loader, a separate binary stored inside BOOT.ELF which actually launches the game.

Have fun!