Crate psyk

Crate psyk 

Source
Expand description

PSY-Q Library and Object File Parser

This crate provides parsing and manipulation capabilities for PSY-Q LIB and OBJ files, which were used by the official PlayStation 1 development toolchain and third-party toolchains for the Sega Saturn, Sega Genesis/MegaDrive/Sega CD/Mega CD, Super Nintendo, and others.

§Overview

PSY-Q was the official development kit for PlayStation 1 games. It produced two main types of binary files:

  • LIB files: Archive files containing multiple object modules
  • OBJ files: Individual object files with machine code and linking information

§Quick Start

Reading a library file:

use std::path::Path;
use psyk::io;
use anyhow::Result;

fn main() -> Result<()> {
    let lib = io::read_lib(Path::new("LIBAPI.LIB"))?;

    for module in lib.modules() {
        println!("Module: {}", module.name());
        println!("Created: {}", module.created());
        println!("Exports: {:?}", module.exports());
    }

    Ok(())
}

Reading either a LIB or OBJ file:

use std::path::Path;
use psyk::io;
use anyhow::Result;

fn main() -> Result<()> {
    let lib_or_obj = io::read(Path::new("SOME.OBJ"))?;
    println!("{}", lib_or_obj);
    Ok(())
}

Modules§

cli
cputype
CPU architecture type identifiers.
display
io
link
PSY-Q Linker Script File Parser

Structs§

Code
Machine code section.
Def
Variable or type definition debug information.
Def2
Extended variable or type definition with additional metadata.
Export
An exported symbol from a module.
Filename
A file name reference used in debug information.
FunctionStart
Function start debug information.
GroupSymbol
A group symbol definition.
LIB
A LIB is an archive of several OBJ files. It consists of a magic number followed by one or more Modules.
LNKHeader
Section header information.
LocalSymbol
A local symbol definition.
Module
A module entry in a LIB archive.
ModuleMetadata
Metadata for a module within a LIB archive.
OBJ
A PSY-Q object file (LNK format).
OpaqueModule
An opaque module representation used during parsing.
Patch
A relocation patch to be applied by the linker.
ProcedureCall
n.b.! this is completely untested and based on assumptions from the output from dumpobj.
ProcedureDefinition
n.b.! this is completely untested and based on assumptions from the output from dumpobj.
SectionOffsetLine
Section, Offset, and Line number information for source-line debugging.
SetMXInfo
Set MX info directive.
SetSLDLineNum
Set source line debugger (SLD) line number.
SetSLDLineNumFile
Set source line debugger (SLD) line number with file reference.
XBSS
External BSS (uninitialized data) symbol.
XDEF
An external symbol definition (XDEF).
XREF
An external symbol reference (XREF).

Enums§

Dim
Dimension specification for arrays.
Expression
An expression used in relocations.
Section
A section within an OBJ file.

Traits§

FromPSYQTimestamp
Trait for converting PSY-Q timestamps to standard Rust date/time types.