ps2sdk Documentation

repository·master·Indexed 22 days ago

https://github.com/ps2dev/ps2sdk

An open-source development kit for the Sony PlayStation 2 providing low-level access to the Emotion Engine (EE) and IO Processor (IOP) hardware, networking, and storage. It includes libraries such as libkernel for BIOS management, libcglue for unifying file descriptors, and support for gprof profiling. The SDK also provides specialized drivers for Bandai Namco System 246/256 arcade hardware, including ATA/ATAPI, CD/DVD, and Flash Memory drivers.

Tokens
30.2K
Snippets
82
Records
247
Agent score
78%

What's inside ps2sdk

  1. Overview of the Security Manager IOP module

    master

    The Security Manager is an IOP (Input/Output Processor) module providing security-related functions for the PlayStation 2. Its primary responsibilities include:

    • Memory Card Authentication: Handling security checks for memory card usage.
    • KELF Binding: Managing Kernel ELF (KELF) binding processes.

    Important Implementation Note: This module does not perform encryption or decryption itself. Instead, it interfaces with the MechaCon processor, which handles the actual cryptographic operations. Consequently, this module does not contain or require any encryption keys.

  2. Overview of PS2SDK capabilities

    master

    PS2SDK is an open-source collection of libraries for developing applications on the Sony PlayStation 2. It provides access to the hardware's dual-processor architecture (Emotion Engine and IO Processor) and includes support for:

    • System Functions: Access to PS2 internal OS functions and BIOS calls via lkernel.
    • Peripherals: Control pad, multitap, USB mouse, and keyboard.
    • Storage: Memory cards, CD/DVD, and full HDD file system support.
    • Networking: TCP/IP stack, DNS resolution (compatible with Ethernet Adapter), HTTP client, and Network File System (NFS) for loading files from a host PC.
    • Audio: Sound library access via freesd.
    • Standard C Library: newlib implementation for libc functionality.
  3. Use libkernel to manage BIOS functionality and patching

    master

    The libkernel.a library provides access to the PS2 BIOS functionality embedded in the hardware. Because the PS2 BIOS contains various bugs, libkernel implements wrappers around problematic BIOS functions to ensure more reliable execution.

    These wrappers are automatically initialized during the application's _InitSys phase. While this provides stability, it increases the binary size. If you require extremely small binaries or wish to avoid patching specific BIOS functions, you can use provided macros to disable these initializations.

  4. Use srxfixup to generate IRX and ERX files

    master

    The srxfixup tool is used to process relocatable ELF files to ensure they can be loaded as relocatable executables or libraries (IRX/ERX) by loadcore.

    It performs the following transformations:

    • Sets the ELF header e_type to 0xFF80, 0xFF81, or 0xFF91 (depending on architecture/features).
    • Creates the .iopmod or .eemod section and the first program header containing metadata (name, version, section sizes/offsets).
    • Rebuilds relocations.
  5. Use the HardDisk ChecKer (HDCK) module

    master

    The HardDisk ChecKer (HDCK) is an IOP module used to ensure the integrity of the APA (Allocation Partition Array) scheme used by Sony to organize space on PlayStation 2 HDD units.

    Once initialized, HDCK creates a hdck device. You can interact with this device using the devctl I/O function to trigger the checking process.

    Syntax:
    	hdck
    
    I/O functions:
    	devctl (Used for starting off the checking process)
  6. Access Arcade Extended RAM (ACRAM) on System 246/256

    master

    The ACRAM module provides access to the extended volatile memory used in Bandai Namco System 246 and 256 arcade hardware.

    Hardware Compatibility Notes:

    • System 246A (e.g., DRIVING version): Features two slots for external ACRAM boards (RAM32 PCB or RAM64 PCB). Note that certain titles, like Wangan Midnight, require two RAM64 PCBs.
    • System 246B and 246C: 64MB of ACRAM is integrated directly onto the motherboard.
    • System 256: ACRAM is not part of the system.

    Dependency: This module relies on an Altera FPGA programmed by acfpgald.irx, similar to how the ATA interface operates.