Playstation2

From NixOS Wiki
Revision as of 11:17, 28 November 2020 by GovanifY (talk | contribs) (Added a dev section for crazy people doing ps2 dev in 2020 like me)
Jump to: navigation, search

Emulation

This section explains how to run Playstation 2 games on NixOS. A dedicated Games page lists games and reports on their successful execution on NixOS.

PCSX2

You need a legal copy of your ps2 bios. There are many ways to do it, i just describe an easy but slowly one using uLaunchELF :

1/ get latest ps2ident from https://www.ps2-home.com/forum/viewtopic.php?p=11926#p11926 
2/ extract somewhere on an USB mass storage
3/ launch it from uLaunchELF (mass:) , then select USB as save device
4/ waiiiiiiiiiiiit. ( slow USB 1, notice progress bars )
5/ copy files in the right pcsx2 directory ( by default /home/<username>/.config/PCSX2/bios )

You can also explore the bios file using romdirfs.

Development

If you want to develop for the PlayStation 2 on NixOS you'll probably want to use the Open Source PS2SDK . The section below explains how to bootstrap the toolchain in order to have a working development environment.

Building the open source PS2SDK on NixOS

You can use the following nix-shell script to build the open source PS2SDK through ps2toolchain.

{ pkgs ? import <nixpkgs> {} }:
let fhs = pkgs.buildFHSUserEnv {
  name = "ps2dev";
  targetPkgs = pkgs: (with pkgs; [
    gnumake
    clang
    clang-tools
    gcc
    wget
    git
    patch
    texinfo
    bash
  ]);
  runScript = "bash";
};
in pkgs.stdenv.mkDerivation {
  name = "ps2dev-shell";
  nativeBuildInputs = [ fhs ];
  shellHook = ''
    # or whatever you want
    export PS2DEV=$HOME/ps2
    mkdir -p $PS2DEV
    chown -R $USER: $PS2DEV

    # setup login env
    export PS2SDK=$PS2DEV/ps2sdk
    export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
    exec ps2dev
    '';
}

You will have to run this shell each time you want to enter in an environment with the SDK tools available or, alternatively, re-export those environment variables in the shell of your liking:

# or whatever you want
export PS2DEV=$HOME/ps2
export PS2SDK=$PS2DEV/ps2sdk
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin

Retail

HDD Partitioning

Playstation 2 use PFS filesystem. You could use pfsshell on PC. pfsshell's author advises you to not use it as root.

# chown myuser /dev/sdb

$ pfsshell 
pfsshell for POSIX systems
https://github.com/uyjulian/pfsshell

This program uses pfs, apa, iomanX, 
code from ps2sdk (https://github.com/ps2dev/ps2sdk)

Type "help" for a list of commands.

> device /dev/sdb
hdd: PS2 APA Driver v2.5 (c) 2003 Vector
hdd: max open = 1, 3 buffers
hdd: 07:13:40 02/03/2020
hdd: disk0: 0x06fccf2f sectors, max 0x00200000
hdd: checking log...
hdd: drive status 0, format version 00000002
hdd: version 0000 driver start.
pfs Playstation Filesystem Driver v2.2
ps2fs: (c) 2003 Sjeep, Vector and Florin Sasu
pfs Max mount: 1, Max open: 1, Number of buffers: 10
pfs version 0000 driver start.
# initialise yes
# ls
0x0001   128MB __mbr
0x0100   128MB __net
0x0100   256MB __system
0x0100   512MB __sysconf
0x0100  1024MB __common

install FHDB (Free HDBoot)

Alternatively you could simply use an image disc with dd ( as windows people use HDDGURU: HDD Raw Copy Tool) , for example FHDB image disc ( like https://www.ps2-home.com/forum/download/file.php?id=12450 ) , that way you can use homebrews too :

dd if=FHDB.img of=/dev/sdb status=progress

FHDB is slower than FMCB but you can use it to install FMCB.

Install games

Use hdl_dump (see hdl_dump help) :

 $ hdl_dump install /dev/sdb Final\ Fantasy\ X\ \(France\).iso

Network

Samba

works fine - example soon.

FTP transfer

A very slow solution ( ~ 500KB/s ).

  • PC side (client) :

PS2 doesn't support TLS, use plain FTP. (tested with filezilla)

  • PS2 side (server) :

Launch ps2net. You need to activate hdd (exploring it in uLaunchELF for example) before ps2net to share it.