02061d74c2
(as received from Jonas Echterhoff)
78 lines
2.0 KiB
C
Executable File
78 lines
2.0 KiB
C
Executable File
#ifndef __FILEIO
|
|
#define __FILEIO
|
|
|
|
|
|
#define kFileErr -1
|
|
#define kMaxFiles 32768
|
|
#define kMaxFileNameLength 32
|
|
|
|
typedef char tOpaqueFileSystemLocator[272]; //size of this is platform specific
|
|
typedef int tFileRef;
|
|
|
|
typedef struct{
|
|
int loaded;
|
|
int parsed;
|
|
int tagged;
|
|
int size;
|
|
void *data;
|
|
void *parsedData;
|
|
tOpaqueFileSystemLocator fsLoc;
|
|
char name[kMaxFileNameLength];
|
|
} tFileTableEntry;
|
|
|
|
#define kFileTypeRAW ".raw"
|
|
#define kFileTypeRAW3d ".raw3d"
|
|
#define kFileTypeGrayscaleRAW ".graw"
|
|
#define kFileTypeSGI ".sgi"
|
|
#define kFileTypeWaveFront ".obj"
|
|
#define kFileTypeWAV ".wav"
|
|
#define kFileTypeModel ".mdl"
|
|
#define kFileTypeSolidEntity ".ent"
|
|
#define kFileTypeCarDefinition ".car"
|
|
#define kFileTypeMapDefinition ".mapinfo"
|
|
#define kFileTypeEnvironmentDefinition ".env"
|
|
#define kFileTypePackageFile ".redplug"
|
|
#define kFileTypeImageURL ".url"
|
|
#define kFileTypeCompressedTexture ".txr"
|
|
#define kFileTypeLog ".redlog"
|
|
|
|
extern int gFileTableSize;
|
|
extern int gFileTampered;
|
|
extern tFileTableEntry *gFileTable;
|
|
|
|
static inline int _stricmp(const char *s1, const char *s2)
|
|
{
|
|
char c1, c2;
|
|
while (1)
|
|
{
|
|
c1 = *s1++;
|
|
c2 = *s2++;
|
|
if(c1>='A'&&c1<='Z')c1+=0x20;
|
|
if(c2>='A'&&c2<='Z')c2+=0x20;
|
|
if (c1 < c2) return -1;
|
|
if (c1 > c2) return 1;
|
|
if (c1 == 0) return 0;
|
|
}
|
|
}
|
|
|
|
#include "parser.h"
|
|
|
|
extern int gFileErrorReporting;
|
|
|
|
tFileRef FileGetReference(char *name);
|
|
tFileRef FileGetIndexedReference(tFileRef base,int i);
|
|
tFileRef FileGetBaseReference(tFileRef ref);
|
|
void FileAppendData(tFileRef fileRef,void *data,int size);
|
|
void *FileGetPartialDataPtr(tFileRef fileRef,int offset,int size);
|
|
void *FileGetDataPtr(tFileRef reference);
|
|
void FileSetData(tFileRef reference,void *data);
|
|
void FileReleaseData(int reference);
|
|
void FileInitIO();
|
|
void FileRescanDirectory();
|
|
char *FileGetExtension(tFileRef reference);
|
|
char *FileGetName(tFileRef reference);
|
|
int FileGetSize(tFileRef reference);
|
|
void* FileGetParsedDataPtr(tFileRef reference, int parserType, int dataSize);
|
|
unsigned int FileGetChecksum(tFileRef reference);
|
|
|
|
#endif |