Pulsar  3d3a057
Data Structures | Functions
archive.h File Reference

Archive container interface. More...

#include <pulsar/types.h>
#include <pulsar/archive/archive_internal.h>
#include <pulsar/archive/archive_file.h>

Go to the source code of this file.

Data Structures

union  PLSR_ArchiveVersion
 Archive version found in header. More...
 
struct  PLSR_ArchiveHeaderInfo
 Common archive header information. More...
 
struct  PLSR_ArchiveSectionInfo
 Archive section header information. More...
 
struct  PLSR_ArchiveSection
 Archive section. More...
 
struct  PLSR_ArchiveTableInfo
 Archive section header information. More...
 
struct  PLSR_ArchiveTable
 Archive table (entry list) More...
 
struct  PLSR_ArchiveTableEntry
 Archive table entry (fixed size entry) More...
 
struct  PLSR_ArchiveTableBlock
 Archive table block (sized entry) More...
 
struct  PLSR_ArchiveListInfo
 Archive list information. More...
 
struct  PLSR_ArchiveList
 Archive list (fixed size data array) More...
 
struct  PLSR_Archive
 Archive file. More...
 

Functions

PLSR_RC plsrArchiveOpenEx (const char *path, PLSR_Archive *out, bool storePath)
 Open from a file at specified path (advanced)
 
NX_INLINE PLSR_RC plsrArchiveOpen (const char *path, PLSR_Archive *out)
 Open from a file at specified path. More...
 
PLSR_RC plsrArchiveOpenInside (const PLSR_Archive *ar, u32 offset, PLSR_Archive *out)
 Open from inside another archive at specified offset.
 
void plsrArchiveClose (PLSR_Archive *ar)
 Close archive, releasing resources if applicable.
 
NX_INLINE PLSR_RC plsrArchiveRelativePath (const PLSR_Archive *ar, const char *path, char *out, size_t size)
 Construct path relative to the physical archive file. More...
 
NX_INLINE PLSR_RC plsrArchiveRead (const PLSR_Archive *ar, void *out, size_t size)
 Read archive contents at the current position.
 
PLSR_RC plsrArchiveReadAtEx (const PLSR_Archive *ar, u32 offset, void *out, size_t size, bool acceptZero)
 Read archive contents at the specified offset (advanced)
 
NX_INLINE PLSR_RC plsrArchiveReadAt (const PLSR_Archive *ar, u32 offset, void *out, size_t size)
 Read archive contents at the specified offset. More...
 
PLSR_RC plsrArchiveReadString (const PLSR_Archive *ar, u32 offset, char *out, size_t size)
 Read a null-terminated string at the specified offset.
 
PLSR_RC plsrArchiveReadHeaderInfo (const PLSR_Archive *ar, const char *magic, PLSR_ArchiveHeaderInfo *out)
 Read archive header. More...
 
PLSR_RC plsrArchiveReadSectionHeaderInfo (const PLSR_Archive *ar, u32 offset, const char *magic, PLSR_ArchiveSectionInfo *out)
 Read archive section header. More...
 
PLSR_RC plsrArchiveReadTableHeaderInfo (const PLSR_Archive *ar, u32 offset, PLSR_ArchiveTableInfo *out)
 Read archive table header information.
 
PLSR_RC plsrArchiveReadTableEntry (const PLSR_Archive *ar, const PLSR_ArchiveTable *table, u16 id, u32 index, PLSR_ArchiveTableEntry *out)
 Read one archive table entry at specified index. More...
 
PLSR_RC plsrArchiveReadTableBlock (const PLSR_Archive *ar, const PLSR_ArchiveTable *table, u16 id, u32 index, PLSR_ArchiveTableBlock *out)
 Read one table block at specified index. More...
 
PLSR_RC plsrArchiveListReadEntries (const PLSR_Archive *ar, const PLSR_ArchiveList *list, u32 startIndex, u32 count, void *outEntries, u32 *outReadCount)
 Read a number of list entries starting from the specified index. More...
 
PLSR_RC plsrArchiveListGetEntry (const PLSR_Archive *ar, const PLSR_ArchiveList *list, u32 index, void *out)
 Read one list entry.
 

Detailed Description

Archive container interface.

Function Documentation

◆ plsrArchiveListReadEntries()

PLSR_RC plsrArchiveListReadEntries ( const PLSR_Archive ar,
const PLSR_ArchiveList list,
u32  startIndex,
u32  count,
void *  outEntries,
u32 *  outReadCount 
)

Read a number of list entries starting from the specified index.

Note
Additionally to checking RC, outReadCount might not match the requested count

◆ plsrArchiveOpen()

NX_INLINE PLSR_RC plsrArchiveOpen ( const char *  path,
PLSR_Archive out 
)

Open from a file at specified path.

Note
Path is not stored by default unless specified using plsrArchiveOpenEx()

◆ plsrArchiveReadAt()

NX_INLINE PLSR_RC plsrArchiveReadAt ( const PLSR_Archive ar,
u32  offset,
void *  out,
size_t  size 
)

Read archive contents at the specified offset.

Note
Offset zero is invalid unless you specify otherwise using plsrArchiveReadAtEx() (start of an archive should always be the header)

◆ plsrArchiveReadHeaderInfo()

PLSR_RC plsrArchiveReadHeaderInfo ( const PLSR_Archive ar,
const char *  magic,
PLSR_ArchiveHeaderInfo out 
)

Read archive header.

Parameters
magicExpected header magic

◆ plsrArchiveReadSectionHeaderInfo()

PLSR_RC plsrArchiveReadSectionHeaderInfo ( const PLSR_Archive ar,
u32  offset,
const char *  magic,
PLSR_ArchiveSectionInfo out 
)

Read archive section header.

Parameters
magicExpected section magic

◆ plsrArchiveReadTableBlock()

PLSR_RC plsrArchiveReadTableBlock ( const PLSR_Archive ar,
const PLSR_ArchiveTable table,
u16  id,
u32  index,
PLSR_ArchiveTableBlock out 
)

Read one table block at specified index.

Parameters
idExpected reference identifier

◆ plsrArchiveReadTableEntry()

PLSR_RC plsrArchiveReadTableEntry ( const PLSR_Archive ar,
const PLSR_ArchiveTable table,
u16  id,
u32  index,
PLSR_ArchiveTableEntry out 
)

Read one archive table entry at specified index.

Parameters
idExpected reference identifier

◆ plsrArchiveRelativePath()

NX_INLINE PLSR_RC plsrArchiveRelativePath ( const PLSR_Archive ar,
const char *  path,
char *  out,
size_t  size 
)

Construct path relative to the physical archive file.

  • Does not guarantee it exists (but might fail in some cases if it does not)
  • Works only if the archive path was stored when opened