00001 #ifndef _SFS_BASE_H_
00002 #define _SFS_BASE_H_
00003
00004 #include <string.h>
00005
00006 #define SFS_ATTR_INVALID 0x01
00007 #define SFS_ATTR_NOCD 0x08
00008 #define SFS_ATTR_CD 0x00
00009 #define SFS_ATTR_STICKY_CD 0x02
00010 #define SFS_ATTR_POPSTICKY 0x04 // path relative to last "sticky_cd"
00011
00012 struct SFS_VolumeSpec {
00013 char fs[12];
00014 };
00015
00016 struct SFS_Header {
00017 char type[4];
00018 UINT32 byte_order;
00019 UINT32 time;
00020 };
00021
00022 struct SFS_File {
00023 char type[4];
00024 UINT32 byte_order;
00025 UINT32 sz;
00026 UINT8 head_sz;
00027 UINT8 attr;
00028 UINT16 reserved;
00029 char name[4];
00030 };
00031
00032 inline int sfs_putfileheader(char *ptr, char *fn, int filesz, int flags)
00033 {
00034 SFS_File *file = (SFS_File *)ptr;
00035
00036 int n = sizeof(SFS_File) - 4;
00037 n += strlen(fn) + 1;
00038 n = (n+3)&0xfffffffc;
00039
00040 memcpy(file->type, "FILE", 4);
00041 file->byte_order = 0x04030201;
00042 file->sz = filesz;
00043 file->head_sz = n;
00044 file->attr = flags;
00045 file->reserved = 0;
00046
00047
00048
00049
00050
00051
00052 memcpy(((char *)file) + n - 4, "\0\0\0\0", 4);
00053 strcpy(file->name, fn);
00054 return n;
00055 }
00056
00057 #endif