Skip to content
Projets

À propos

Small, Fast and Modular PS2 Device Emulator

Jeux et émulation

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
+1
in 7 days
+6
in 15 days
+6
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

neutrino

Small, Fast and Modular PS2 Device Emulator

Design

A neutrino is a particle with almost zero mass, and that's what this device emulator's primary goal is. To have almost 0 mass when emulating devices to maximize compatibility.

Neutrino also does not have a user interface, instead it's meant to be integrated as a backend to a frontend (user interface). This makes neutrino much more easy to maintain, and allows many more applications to be made using neutrino as the backend.

With neutrino all modules are... modular. They are in a separate folder called modules. This allows the user add new and improved modules. What modules are loaded is fully configurable using TOML config files in the config folder.

Environments

An environment in neutrino describes what IOP modules are loaded and defines what features the environment has. In neutrino there are 3 environments:

  • Boot Environment (BE): environment neutrino is loaded from (by uLE / ps2link / ...), containing neutrino, configuration files and drivers
  • Load Environment (LE): neutrino's loader.elf reboots into the LE, containing virtual disk images
  • Emulation Environment (EE): neutrino's ee_core.elf reboots into the EE, emulating devices

Backing Store Driver (BSD)

A backing store driver provides a storage location for storing virtual disk images. For instance of DVD's, HDD's or MC's. The following backing storage devices are supported:

Device PS2 model Speed Device comp. Type BSD
USB FAT + 70k x x Block Device usb
USB slim x x Block Device usb
MX4SIO slim x x Block Device mx4sio
MMCE slim x x File System mmce
MX4SIO FAT + 70k x x Block Device mx4sio
MMCE FAT + 70k x x File System mmce
iLink / IEEE1394 FAT x x Block Device ilink
UDPBD ALL x x Block Device udpbd
UDPFS ALL x x File System udpfs
SMB (read-only) FAT x x File System smb
NFS (read-only) FAT x x File System nfs
ATA (internal HDD) FAT x x Block Device ata

Clarifying information:

  • PS2 model: The older FAT PS2 models and the first slim PS2 model (70k) have the original PS1 MIPS R3000 CPU. Later slim PS2 models have a new CPU with 'DECKARD' emulating the MIPS R3000. This is why there is a speed difference between those two groups of PS2 models.

  • Speed: USB, MX4SIO and MMCE have been tested with neutrino v1.5.0. The other speeds are based on older tests and should serve as an indication. For proper emulation of the ps2 DVD drive a speed of at least 2.2MB/s is needed. The slower the speed, the more likely video's will stutter. Due to game-bugs, some games will not even run if the device is too slow. For SMB and NFS the speed is that of a 16 kbyte read as neutrino issues them, on a FAT PS2 over 100 Mbit: enough for the DVD drive at full speed, the most it can read was not measured.

  • Device comp.: how many devices will work with neutrino. For instance most USB sticks work, but some (mostly USB3.0 sticks) don't work. With mx4sio, many SD cards are not compatible, etc... Don't hold these values for fact, they are based on my personal observations and should give you an indication on what devices would fit your need.

  • Type: How the device exposes itself to the PS2: as a file system with files that can be opened/closed read and written. Or as a block device with 512byte sectors.

  • BSD: Name of the BSD for use with the neutrino command line, such as: -bsd=ilink

Block devices

For block devices the PS2 will use it's own filesystem and partition drivers.

The following partitioning schemes are supported:

  • MBR (Master Boot Record)
  • GPT (GUID Partition Table)

The following file systems are supported:

  • FAT32, accessable as mass:<file>.iso
  • exFat, accessable as mass:<file>.iso
  • HDLoader, accessable as hdl:<file>, hdl:<file>.iso, hdl:<part> or hdl:<part>.iso

Note that the HDLoader backing store is currently read-ony, and limited to only emulating the DVD.

Block device fragmentation

During load neutrino will request all 'fragments' where virtual disk images are located. After rebooting into the Emulation Environment there is no more file system available, instead neutrino will access the sectors of the block device directly using a fragment table. A maximum of 64 fragments is supported for the combined total of the virtual disk images you need. If for instance you have 1 virtual DVD and 1 virtual MC (that's already 2 fragments), then they cannot have more than 64 fragments combined. If your (FAT32/exFat) drive is more fragmented you'll need to de-fragment your drive (details not covered here).

Note that this limitation only applies to the "block device" type, and not the "file system" type, even though it can be the uSD card. MX4SIO for instance is used as a block device with the 64 fragment limitation. But when inserting the same exFat formatted uSD card into an MMCE device, this limitation does not exist, becouse the CPU on MMCE device will completely handle the exFat filesystem.

CD/DVD emulation

The following CD/DVD emulation drivers are supported:

  • No: using original CD's / DVD's in the optical drive
  • ESR: using ESR patched DVD's in the optical drive
  • File: using an iso file from the backing store

ATA HDD emulation

The following HDD emulation drivers are supported:

  • No: using ATA HDD in the PS2
  • File: using a virtual HDD image file from the backing store

Usage instructions

Neutrino is a command line application. To get the most out of neutrino you will need to run it from the command line, for instance using ps2link and ps2client.

Alternatively you can use a more user friendly GUI from one of the third-party projects (see below), but with a limited feature set.

Command line usage instructions:

Usage: neutrino.elf options

Options:
  -bsd=<driver>     Backing store drivers (optional, auto-detected from path prefix), supported are:
                    - no     (uses cdvd)
                    - ata    (block device)
                    - usb    (block device)
                    - mx4sio (block device)
                    - udpbd  (block device)
                    - udpfs  (file system)
                    - ilink  (block device)
                    - mmce   (file system)
                    - smb    (file system, read-only)
                    - nfs    (file system, read-only)

  -bsdfs=<driver>   Backing store fileystem drivers used for block device, supported are:
                    - exfat (default)
                    - hdl   (HD Loader)
                    - bd    (Block Device)
                    NOTE: Used only for block devices (see -bsd)

  -dvd=<mode>       DVD emulation mode, supported are:
                    - no (default)
                    - esr
                    - <file>

  -ata0=<mode>      ATA HDD 0 emulation mode, supported are:
                    - no (default)
                    - <file>
                    NOTE: only both emulated, or both real.
                          mixing not possible
  -ata0id=<mode>    ATA 0 HDD ID emulation mode, supported are:
                    - no (default)
                    - <file>
                    NOTE: only supported if ata0 is present
  -ata1=<mode>      See -ata0=<mode>

  -mc0=<mode>       MC0 emulation mode, supported are:
                    - no (default)
                    - <file>
  -mc1=<mode>       See -mc0=<mode>

  -elf=<file>       ELF file to boot, supported are:
                    - auto (elf file from cd/dvd) (default)
                    - <file>

  -gc=<compat>      Game compatibility modes, supported are:
                    - 0: IOP: Fast reads (sceCdRead)
                    - 1: dummy
                    - 2: IOP: Sync reads (sceCdRead)
                    - 3: EE : Unhook syscalls
                    - 5: IOP: Emulate DVD-DL
                    - 7: IOP: Fix game buffer overrun
                    Multiple options possible, for example -gc=23

  -gsm=v:c          GS video mode

                    Parameter v = Force video mode to:
                    -         : don't force (default)  (480i/576i)
                    - fp1     : force 240p/288p - auto PAL/NTSC
                    - fp2     : force 480p/576p - auto PAL/NTSC
                    - 1080ix1 : force 1080i width x1, height x1 (very small!)
                    - 1080ix2 : force 1080i width x2, height x2
                    - 1080ix3 : force 1080i width x3, height x3

                    Parameter c = Compatibility mode:
                    -      : no compatibility mode (default)
                    - 1    : field flipping type 1 (GSM/OPL)
                    - 2    : field flipping type 2
                    - 3    : field flipping type 3

                    Examples:
                    -gsm=fp2      - recommended mode
                    -gsm=fp2:1    - recommended mode, with compatibility 1
                    -gsm=1080ix2

  -cwd=<path>       Change working directory

  -cfg=<file>       Load extra user/game specific config file (without .toml extension)

  -dbc              Enable debug colors
  -logo             Enable logo (adds rom0:PS2LOGO to arguments)
  -qb               Quick-Boot directly into load environment

  --b               Break, all following parameters are passed to the ELF

Usage examples:
  neutrino.elf -dvd=usb:path/to/filename.iso
  neutrino.elf -dvd=mx4sio:path/to/filename.iso
  neutrino.elf -dvd=mmce:path/to/filename.iso
  neutrino.elf -dvd=ilink:path/to/filename.iso
  neutrino.elf -dvd=udpbd:path/to/filename.iso
  neutrino.elf -dvd=udpfs:path/to/filename.iso
  neutrino.elf -dvd=smb:path/to/filename.iso
  neutrino.elf -dvd=nfs:path/to/filename.iso
  neutrino.elf -dvd=ata:path/to/filename.iso
  neutrino.elf -bsd=ata -bsdfs=hdl -dvd=hdl:filename.iso
  neutrino.elf -bsd=udpbd -bsdfs=bd -dvd=bdfs:udp0p0

SMB

-dvd=smb:path/to/filename.iso plays a game from a share on an SMB2 file server, over the network adapter. It uses usmb2, a minimal SMB2 client with its own tiny TCP/IP stack. Only DVD images are supported: the driver is read-only, so it cannot hold HDD or memory card images.

On a fat PS2 over 100 Mbit, a 16 kbyte read takes 3.1 ms (5.3 MB/s while reading), most of it DMA'd straight into the game's buffer, with any server. That is more than the DVD drive needs at full speed; the most the backend can read was not measured.

The network, server and login are module arguments in config/bsd-smb.toml, the same for smb_ioman.irx and smb_fhi.irx, and the PS2's address also goes in ministack.irx's arguments:

args = ["ip=192.168.1.10", "mask=255.255.255.0", "gw=192.168.1.1", "srv=192.168.1.2", "user=guest", "pass=", "share=PS2SMB"]
  • ip, mask, gw: the PS2's address, netmask and gateway
  • srv: the address of the SMB server
  • user, pass: NTLM login
  • share: the name of the share; the path is relative to it

NFS

-dvd=nfs:path/to/filename.iso plays a game from an NFS export, over the network adapter. It uses unfs4, a minimal NFSv4.0 client, on the same tiny TCP/IP stack as SMB. Only DVD images are supported: the driver is read-only, so it cannot hold HDD or memory card images.

On a fat PS2 over 100 Mbit, a 16 kbyte read from the Linux kernel's NFS server takes 2.9 ms (5.6 MB/s while reading), most of it DMA'd straight into the game's buffer, as with SMB: more than the DVD drive needs at full speed, and not the most the backend can read.

The network, server and export are module arguments in config/bsd-nfs.toml, the same for nfs_ioman.irx and nfs_fhi.irx, and the PS2's address also goes in ministack.irx's arguments:

args = ["ip=192.168.1.10", "mask=255.255.255.0", "gw=192.168.1.1", "srv=192.168.1.2", "export=/srv/ps2"]
  • ip, mask, gw: the PS2's address, netmask and gateway
  • srv: the address of the NFS server
  • export: the exported directory; the path is relative to it
  • uid, gid: the AUTH_SYS credentials, 0 if not given. With the usual root squash that is the anonymous user, so the images must be readable by everyone.

The server must have NFSv4.0 enabled. The PS2 connects from a port below 1024, so the export does not need the insecure option. On Linux:

/srv/ps2  192.168.1.0/24(ro)

UDPFS / UDPBD PC Server

The pc/udpfs_server.py script serves files and/or block devices to the PS2 over UDP (Ethernet).

Requirements

  • Python 3 (no additional packages required for basic use)
  • lz4 — optional, required only for .zso (LZ4-compressed ISO) support:
    pip install lz4
    
  • libchdr0 — required for .chd (CHD compressed ISO) support:
    apt install libchdr0
    
    Build from source: https://github.com/rtissera/libchdr

The pc/compressed_iso/ directory is a local module bundled with the server; no installation is needed.

Usage

# Share a USB drive (or any block device) with many games — typical UDPBD use case
python pc/udpfs_server.py -b /dev/sdX          # Linux
python pc/udpfs_server.py -b \\.\PhysicalDriveX  # Windows

# Share a single disk image (UDPBD mode)
python pc/udpfs_server.py -b game.iso

# Share a directory as a filesystem (UDPFS mode)
python pc/udpfs_server.py -d /path/to/ps2games

# Share both a block device and a directory
python pc/udpfs_server.py -b /dev/sdX -d /path/to/ps2games

# With transparent decompression (.iso is appended to .zso/.cso/.chd names)
python pc/udpfs_server.py -d /games --enable-compression

# Read-only mode
python pc/udpfs_server.py -b /dev/sdX --read-only

Compression support

When --enable-compression is passed, the server transparently decompresses compressed ISO images:

Format Extension Compression Extra dependency
ZSO .zso LZ4 pip install lz4
CSO .cso zlib none
CHD .chd zlib/lzma/huff/flac apt install libchdr0

Building

Neutrino is built with ps2max: its LLVM (clang and ld.lld for the EE and the IOP) and maxsdk (picolibc, the compiler-rt builtins and the IOP build rules). From ps2dev it only takes ps2sdk's IOP headers and a few of ps2sdk's prebuilt IOP modules (udnl, eesync, iomanX, fileXio, the BDM drivers). The EE programs do not use an SDK: ee/mini has the little of ps2sdk they need, on the PS2's BIOS.

In a ps2max tree, with LLVM and maxsdk built (build-llvm.sh and build-libs.sh), neutrino in apps/neutrino:

git submodule update --init   # usmb2, unfs4, mmceman
make                          # IOP modules, ee_core.elf and neutrino.elf, in build/apps/neutrino
make release                  # releases/neutrino_<version>.7z: neutrino.elf, config/, modules/, the PC server

PS2MAX=<dir> names another ps2max tree, PS2MAX_IRX=<dir> another directory of ps2sdk's IOP modules, OUT=<dir> another build directory. make copy puts neutrino.elf, version.txt and modules/ in ee/loader, next to config/, and make run PS2_IP=<address> starts it there on a PS2 with ps2link.

neutrino.elf is packed: ee/packer compresses the loader with LZMA, and a small stub unpacks it when it starts (neutrino_unpacked.elf is the loader itself).

The CI (.github/workflows/ps2.yml) builds with the LLVM and maxsdk commits that ps2max.deps names, and keeps the release package of every push as an artifact.

Third-Party Loaders

The following third-party projects use neutrino:

Loader Author
XEB+ neutrino Launcher Plugin sync-on-luma
NHDDL pcm720
RETROLauncher Boon Tobias
OSD-XMB Hiro Tex
PSBBN + BBNL CosmicScale + pcm720
RiptOPL NathanNeurotic
wOPL KrahJohlito
Modulo AdityaKumar7209

Add your project here? Send me a PR.

Explorer des projets similaires

Chargement…