libspk - A library for reading virtual files from an archive

All other SDK help, questions and information
Post Reply
rsoft
Rookie Programmer
Rookie Programmer
Posts: 19
Joined: Jun 22, 2013
Location: /home/rsoft

libspk - A library for reading virtual files from an archive

Post by rsoft » July 28th, 2013, 1:29 am

The disks games like Need for Speed 4 and others use mostly contain files that turn out to be archives.
This has, depending on the archive format, several advantages over storing the files directly on the ISO-9660 file system:
  • - Possibility to use longer and more complex file names
    - Ability to "multiplex", effectively increasing the maximum file count
    - Professional looking disk contents, even if you are using plain TIMs for graphics
My particular package/archive format (SPK) currently has the following limitations:
  • - Maximum virtual file size of 0xFFFF bytes (shouldn't be hard to increase)
    - Default file name size of up to 64-3 characters (can be changed at compile-time)
    - A maximum of 255 virtual files
    - No hierarchy/directories
The library (libspk) is designed to allow for the following features:
  • - Fairly low memory footprint
    - Can be "instanciated" to allow for multiple open archives at once
    - Up to 16 concurrently open virtual files (can be changed at compile-time)
    - Portable (requires only fairly standard C functions)
    - Completely static memory usage (doesn't allocate or free memory at run-time)
As of now, it doesn't work with PSY-Q due to the absence of fopen, fread, fseek and ftell, but it shouldn't be too hard to write some compatibility functions for PSY-Q as they don't even have to support the full function set.
It works with Tails92's PSXSDK and natively on Linux with a standard GNU toolchain though.
It's not fully tested but should at least work partially.
You can get the latest version over on GitHub: https://github.com/rsoft-/libspk
It's currently released under GPLv3 but that might change in the future. (Maybe zlib, but I'm not sure as of yet.)

User avatar
Shendo
Verified
C Programming Expert
C Programming Expert
Posts: 250
Joined: Mar 21, 2012
I am a: Programmer
Motto: Never settle
PlayStation Model: SCPH-7502
Discord: ShendoXT
Location: Croatia, EU

Post by Shendo » July 28th, 2013, 10:15 am

Nice job. Not only does it get rid of the limitations imposed by the filesystem but you can do a basic protection of your data.
Dev console: SCPH-7502, FreePSXBoot, CH340 serial cable.

rsoft
Rookie Programmer
Rookie Programmer
Posts: 19
Joined: Jun 22, 2013
Location: /home/rsoft

Post by rsoft » July 28th, 2013, 6:59 pm

Thanks!
But using it as a protection scheme (be it basic or not) is neither encouraged, nor is it effective being used as one as it is an open format.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests