Skip to content

intricate/ps2-memory-card

Repository files navigation

ps2-memory-card

PlayStation 2 memory card filesystem library written in Haskell.

Note that this library isn't exactly "finished" or fully-featured. I was mostly just curious about the PS2 memory card filesystem and, also, I thought it'd be cool to explore PCSX2 *.ps2 images in Haskell.

Getting Started

Usage

Reading the memory card filesystem:

import PlayStation2.MemoryCard
  ( Filesystem (..)
  , ReadFilesystemError
  , readFilesystem
  )
import Prelude
import System.IO.MMap (mmapFileByteString)

f :: IO (Either ReadFilesystemError Filesystem)
f = do
  bs <- mmapFileByteString "./memcard.ps2" Nothing
  pure (readFilesystem bs)

From there, you could list the contents of a directory (e.g. the root directory which is available via the fRootDirectoryEntry field of Filesystem):

listDirectoryContents fs (fRootDirectoryEntry fs)

... or build a Tree of directory contents:

buildDirectoryTree fs (fRootDirectoryEntry fs)

... or read a specific file, given a reference to it:

readFile fs someFileReference

Building

Building with cabal:

cabal build ps2-memory-card

Acknowledgments

License

Apache 2.0

About

PlayStation 2 memory card library written in Haskell.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published