📄 resmgr.h
字号:
typedef struct PATH_ENTRY
{
char * name; /* complete path name */
char device; /* index pointing to specific device */
char state; /* open, mounted, error, etc. */
char open_count; /* number of open files within directory */
} PATH_ENTRY;
/* ------------------------------------------------------------------------
P R O T O T Y P E S
------------------------------------------------------------------------ */
RES_EXPORT int ResInit( HWND hwnd );
RES_EXPORT void ResExit( void );
RES_EXPORT int ResMountCD( int cd_number, int device );
RES_EXPORT int ResDismountCD( void );
RES_EXPORT int ResCheckMedia( int device );
RES_EXPORT int ResDevice( int device, DEVICE_ENTRY * dev );
RES_EXPORT void ResPurge( const char * archive, const char * volume, const int * directory, const char * filename );
RES_EXPORT int ResAttach( const char * attach_point, const char * filename, int replace_flag );
RES_EXPORT void ResDetach( int handle );
RES_EXPORT int ResOpenFile( const char * name, int mode );
RES_EXPORT int ResSizeFile( int file );
RES_EXPORT int ResReadFile( int handle, void * buffer, size_t count );
RES_EXPORT char * ResLoadFile( const char * filename, char * buffer, size_t * size );
RES_EXPORT void ResUnloadFile( char * buffer );
RES_EXPORT int ResCloseFile( int file );
RES_EXPORT size_t ResWriteFile( int handle, const void * buffer, size_t count );
RES_EXPORT int ResDeleteFile( const char * name );
RES_EXPORT int ResModifyFile( const char * name, int flags );
RES_EXPORT long ResTellFile( int handle );
RES_EXPORT int ResSeekFile( int handle, size_t offset, int origin );
RES_EXPORT int ResStatusFile( const char * filename, RES_STAT * stat_buffer );
RES_EXPORT int ResExtractFile( const char * dst, const char * src );
#if( RES_STREAMING_IO )
# undef RES_FOPEN
# undef RES_FCLOSE
# undef RES_FTELL
# undef RES_FREAD
# undef RES_FSEEK
# define RES_FOPEN ResFOpen
# define RES_FCLOSE ResFClose
# define RES_FTELL ResFTell
# define RES_FREAD ResFRead
# define RES_FSEEK ResFSeek
#if( RES_REPLACE_STREAMING )
/* msvc has a bug in the linker that makes it impossible to just
replace the stdio.h functions at link time. */
# define fopen ResFOpen
# define fclose ResFClose
# define ftell ResFTell
# define fread ResFRead
# define fseek ResFSeek
#endif
FILE * __cdecl RES_FOPEN( const char * name, const char * mode );
int __cdecl RES_FCLOSE( FILE * file );
long __cdecl RES_FTELL( FILE * stream ); /* default is to use ftell !!! */
size_t __cdecl RES_FREAD( void *buffer, size_t size, size_t num, FILE *stream );
int __cdecl RES_FSEEK( FILE * stream, long offset, int whence );
# define fsetpos(f,o) fseek(f,o,SEEK_SET)
# define rewind(f) fseek(f,0L,SEEK_SET)
#else
# define RES_FOPEN fopen
# define RES_FCLOSE fclose
# define RES_FTELL ftell
# define RES_FREAD fread
# define RES_FSEEK fseek
#endif /* RES_STREAMING_IO */
RES_EXPORT int ResMakeDirectory( char * pathname );
RES_EXPORT int ResDeleteDirectory( char * pathname, int forced );
RES_EXPORT RES_DIR * ResOpenDirectory( char * pathname );
RES_EXPORT char * ResReadDirectory( RES_DIR * dir );
RES_EXPORT void ResCloseDirectory( RES_DIR * dir );
RES_EXPORT int ResExistFile( char * name );
RES_EXPORT int ResExistDirectory( char * pathname );
RES_EXPORT int ResSetDirectory( const char * pathname );
RES_EXPORT int ResGetDirectory( char * buffer );
RES_EXPORT int ResCountDirectory( char * path,struct _finddata_t **file_data );
RES_EXPORT int ResWhereIs( char * filename, char * path );
RES_EXPORT int ResWhichCD( void );
RES_EXPORT int ResWriteTOC( char * filename );
RES_EXPORT PFI ResSetCallback( int which, PFI func );
RES_EXPORT PFI ResGetCallback( int which );
RES_EXPORT void ResAssignPath( int index, char * path );
RES_EXPORT int ResBuildPathname( int index, char * path_in, char * path_out );
RES_EXPORT int ResGetPath( int idx, char * buffer );
RES_EXPORT int ResCreatePath( char * path, int recurse );
RES_EXPORT int ResAddPath( char * path, int recurse );
RES_EXPORT int ResGetArchive( int idx, char * buffer );
RES_EXPORT int ResAsynchRead( int file, void * buffer, PFV callback );
RES_EXPORT int ResAsynchWrite( int file, void * buffer, PFV callback );
#if( RES_DEBUG_VERSION )
RES_EXPORT void ResDbg( int on );
RES_EXPORT int ResDbgLogOpen( char * filename );
RES_EXPORT void ResDbgLogClose( void );
RES_EXPORT void ResDbgPrintf( char * msg, ... );
RES_EXPORT void ResDbgLogPause( int on );
RES_EXPORT void ResDbgDump( void );
#endif /* RES_DEBUG_VERSION */
#if 0
int ResOpenStream( char *, int );
int ResDefineStream( int, int, PFV );
size_t ResPlayStream( int, int );
size_t ResWriteStream( int, int, size_t );
#endif
/* -------------------------------------------------------------------------------
C O N V E N I E N C E D E F I N I T I O N S
------------------------------------------------------------------------------- */
#ifndef SEEK_CUR
# define SEEK_SET 0
# define SEEK_CUR 1
# define SEEK_END 2
#endif /* SEEK_CUR */
enum
{
RES_NOT_FORCED = 0,
RES_FORCED
};
#define RES_HD 0x00010000
#define RES_CD 0x00020000
#define RES_NET 0x00040000
#define RES_ARCHIVE 0x00080000
#define RES_FLOPPY 0x00100000
#ifndef _O_APPEND /* so you don't need <fcntl.h> */
# define _O_RDONLY 0x0000 /* open for reading only */
# define _O_WRONLY 0x0001 /* open for writing only */
# define _O_RDWR 0x0002 /* open for reading and writing */
# define _O_APPEND 0x0008 /* writes done at eof */
# define _O_CREAT 0x0100 /* create and open file */
# define _O_TRUNC 0x0200 /* open and truncate */
# define _O_EXCL 0x0400 /* open only if file doesn't already exist */
# define _O_TEXT 0x4000 /* file mode is text (translated) */
# define _O_BINARY 0x8000 /* file mode is binary (untranslated) */
# define _O_RAW _O_BINARY /* msvc 2.0 compatability */
#endif /* _O_APPEND */
#ifndef O_RDONLY /* Yes, there was fcntl.h before Microsoft (even if not ansi) */
# define O_RDONLY _O_RDONLY /* and... #define O_RDONLY 0x0000 will complain because MS.SUX */
# define O_WRONLY _O_WRONLY
# define O_RDWR _O_RDWR
# define O_APPEND _O_APPEND
# define O_CREAT _O_CREAT
# define O_TRUNC _O_TRUNC
# define O_EXCL _O_EXCL
# define O_TEXT _O_TEXT
# define O_BINARY _O_BINARY
# define O_RAW _O_BINARY
#endif
#define READ_ONLY_MODE _O_RDONLY
#define WRITE_ONLY_MODE _O_WRONLY
#define READ_WRITE_MODE _O_RDWR
#define APPEND_MODE _O_APPEND
#define CREATE_MODE _O_CREAT
#define TRUNCATE_MODE _O_TRUNC
#define TEXT_MODE _O_TEXT
#define BINARY_MODE _O_BINARY
#define ASCII_BACKSLASH 0x5c
#define ASCII_FORESLASH 0x2f
#define ASCII_SPACE 0x20
#define ASCII_DOT 0x2e
#define ASCII_STAR 0x2a
#define ASCII_OPEN_BRACKET 0x5b
#define ASCII_CLOSE_BRACKET 0x5d
#define ASCII_COLON 0x3a
#define ASCII_QUOTE 0x22
#define ASCII_ASTERISK ASCII_STAR
#define ASCII_PERIOD ASCII_DOT
/* VC++ mutex code is NOT very lightweight. These macros are for our
simple semaphores for blocking hash table resizing while ptrs are
exposed */
/* #if( RES_USE_MULTITHREAD ) */
#if( RES_MULTITHREAD )
# define RES_LOCK(a) {(a)->lock = TRUE;}
# define RES_UNLOCK(a) {(a)->lock = FALSE;}
# define RES_IS_LOCKED(a) ((a)->lock == TRUE)
# define RES_WHILE_LOCKED(a) {while((a)->lock);}
#else
# define RES_LOCK(a)
# define RES_UNLOCK(a)
# define RES_IS_LOCKED(a) (TRUE == TRUE)
# define RES_WHILE_LOCKED(a)
#endif /* RES_USE_MULTITHREAD */
#define UNZIP_SLIDE_SIZE 32768
#define UNZIP_BUFFER_SIZE 2048
#define INPUTBUFSIZE 20480
#endif /* RESOURCE_MANAGER */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -