Niotso  git revision 558726a9f13d7c3423a683dd2f4323589b66c310
The New Implementation of The Sims Online
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions | Variables
far.c File Reference
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "far.h"

Macros

#define FAR_MINSIZE_ANY   MINSIZE_PERSIST
 
#define read_int32(x)   (int)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)) | ((x)[3]<<(8*3)))
 
#define read_int24(x)   (int)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)))
 
#define read_int16(x)   (int)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)))
 
#define read_int8(x)   (int)(((x)[0]<<(8*0)))
 
#define read_uint32(x)   (unsigned)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)) | ((x)[3]<<(8*3)))
 
#define read_uint24(x)   (unsigned)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)))
 
#define read_uint16(x)   (unsigned)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)))
 
#define read_uint8(x)   (unsigned)(((x)[0]<<(8*0)))
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 

Functions

void libfar_set_option (int Option, int Value)
 
int libfar_get_option (int Option)
 
int far_identify (const uint8_t *Buffer, unsigned FileSize)
 
FARFilefar_create_archive (int Type)
 
PersistFilefar_create_persist ()
 
FAREntryNodefar_add_entry (FARFile *FARFileInfo, int Position)
 
int far_read_header (FARFile *FARFileInfo, const uint8_t *Buffer, unsigned FileSize)
 
int far_read_entry (const FARFile *FARFileInfo, FAREntry *FAREntryInfo, const uint8_t *Buffer, unsigned MaxEntrySize, unsigned ArchiveSize)
 
int far_read_persist_header (PersistFile *PersistData, const uint8_t *Buffer, unsigned FileSize)
 
int far_read_entry_data (const FARFile *FARFileInfo, FAREntry *FAREntryInfo, uint8_t *Buffer)
 
int far_read_persist_data (PersistFile *PersistData, uint8_t *CompressedData)
 
int far_enumerate_entries (FARFile *FARFileInfo, const uint8_t *Index, unsigned IndexSize, unsigned ArchiveSize)
 
int far_enumerate_entry_data (const FARFile *FARFileInfo, uint8_t *Buffer)
 
void libfar_free (void *ptr)
 

Variables

static int libfarOptions []
 

Macro Definition Documentation

#define FAR_MINSIZE_ANY   MINSIZE_PERSIST
#define max (   a,
 
)    (((a) > (b)) ? (a) : (b))
#define min (   a,
 
)    (((a) < (b)) ? (a) : (b))
#define read_int16 (   x)    (int)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)))
#define read_int24 (   x)    (int)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)))
#define read_int32 (   x)    (int)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)) | ((x)[3]<<(8*3)))
#define read_int8 (   x)    (int)(((x)[0]<<(8*0)))
#define read_uint16 (   x)    (unsigned)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)))
#define read_uint24 (   x)    (unsigned)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)))
#define read_uint32 (   x)    (unsigned)(((x)[0]<<(8*0)) | ((x)[1]<<(8*1)) | ((x)[2]<<(8*2)) | ((x)[3]<<(8*3)))
#define read_uint8 (   x)    (unsigned)(((x)[0]<<(8*0)))

Function Documentation

FAREntryNode* far_add_entry ( FARFile FARFileInfo,
int  Position 
)
FARFile* far_create_archive ( int  Type)
PersistFile* far_create_persist ( )
int far_enumerate_entries ( FARFile FARFileInfo,
const uint8_t *  Index,
unsigned  IndexSize,
unsigned  ArchiveSize 
)
int far_enumerate_entry_data ( const FARFile FARFileInfo,
uint8_t *  Buffer 
)
int far_identify ( const uint8_t *  Buffer,
unsigned  FileSize 
)
int far_read_entry ( const FARFile FARFileInfo,
FAREntry FAREntryInfo,
const uint8_t *  Buffer,
unsigned  MaxEntrySize,
unsigned  ArchiveSize 
)
int far_read_entry_data ( const FARFile FARFileInfo,
FAREntry FAREntryInfo,
uint8_t *  Buffer 
)
int far_read_header ( FARFile FARFileInfo,
const uint8_t *  Buffer,
unsigned  FileSize 
)
int far_read_persist_data ( PersistFile PersistData,
uint8_t *  CompressedData 
)
int far_read_persist_header ( PersistFile PersistData,
const uint8_t *  Buffer,
unsigned  FileSize 
)
void libfar_free ( void *  ptr)
int libfar_get_option ( int  Option)
void libfar_set_option ( int  Option,
int  Value 
)

Variable Documentation

int libfarOptions[]
static