It didn’t even come to my mind that you could be ‘attacking’ me…
The source I’m sending has one good feature (bug?) which I find very useful
it’s recursive - you can have several PAK files in one, hehe. It looks for
normal files as well and prefers these, just as Quake does. It’s a very easy
way to do ‘data’ patches, even during development - no need to rePAK it
everything.
There is no stuff for creating PAK’s, as writing it’d be just waste of time.
Planetquake should do it. There are even Linux utils to comfortably manage the
datafiles.
I hope it’s a working version…
------------------------ Tomas Andrle ~ Virsoft — @Tomas_Andrle -------------
-------------- next part --------------
A non-text attachment was scrubbed…
Name: Files.c
Type: application/x-unknown-content-type-c_auto_file
Size: 4298 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/19980731/3be0d9ac/attachment.bin
-------------- next part --------------
#ifndef _FILES_H
#define _FILES_H
#ifdef __cplusplus
extern “C”
{
#endif
/* this is not a good way to report anything… */
#define F_ERROR 0
#define F_OK 1
#define F_ALREADY 2
typedef struct PAK_DirEntry /* does __attr.. work outside djgpp? */
{
char name[56]; //__attribute__((packed));
unsigned long int offset; //__attribute__((packed));
unsigned long int length; //__attribute__((packed));
}
PAK_DirEntry;
typedef struct PAK_Library
{
char *name;
long int entry_count;
struct PAK_DirEntry *entries;
struct PAK_Library *next;
}
PAK_Library;
typedef struct PAK_Header
{
long int id; //__attribute__((packed));
long int table_offset; //__attribute__((packed));
long int table_length; //__attribute__((packed));
}
PAK_Header;
int f_add_pak (char *filename);
int f_length (char *filename, long int *length);
FILE *f_open_file (char *filename, char *mode, long int offset);
int f_read (char *filename, char *destination, long int offset, long int length);
int f_read_file (char *filename, char **destination, long int *length);
void f_init (char *pattern);
void f_exit();
#ifdef __cplusplus
};
#endif
#endif