mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
filesystem: allow acquiring C interface through CreateInterface export
This commit is contained in:
parent
9d49985100
commit
fce8afabfb
@ -492,6 +492,18 @@ extern "C" void EXPORT *CreateInterface( const char *interface, int *retval )
|
|||||||
return &g_VFileSystem009;
|
return &g_VFileSystem009;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !Q_strcmp( interface, FS_API_CREATEINTERFACE_TAG ))
|
||||||
|
{
|
||||||
|
// return a copy, to disallow overriding
|
||||||
|
static fs_api_t copy = { 0 };
|
||||||
|
|
||||||
|
if( !copy.InitStdio )
|
||||||
|
memcpy( ©, &g_api, sizeof( copy ));
|
||||||
|
|
||||||
|
if( retval ) *retval = 0;
|
||||||
|
return ©
|
||||||
|
}
|
||||||
|
|
||||||
if( retval ) *retval = 1;
|
if( retval ) *retval = 1;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2868,7 +2868,7 @@ static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fs_api_t g_api =
|
fs_api_t g_api =
|
||||||
{
|
{
|
||||||
FS_InitStdio,
|
FS_InitStdio,
|
||||||
FS_ShutdownStdio,
|
FS_ShutdownStdio,
|
||||||
|
@ -29,6 +29,7 @@ extern "C"
|
|||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#define FS_API_VERSION 1 // not stable yet!
|
#define FS_API_VERSION 1 // not stable yet!
|
||||||
|
#define FS_API_CREATEINTERFACE_TAG "XashFileSystem001" // follow FS_API_VERSION!!!
|
||||||
|
|
||||||
// search path flags
|
// search path flags
|
||||||
enum
|
enum
|
||||||
|
@ -86,6 +86,7 @@ extern qboolean fs_ext_path;
|
|||||||
extern char fs_rodir[MAX_SYSPATH];
|
extern char fs_rodir[MAX_SYSPATH];
|
||||||
extern char fs_rootdir[MAX_SYSPATH];
|
extern char fs_rootdir[MAX_SYSPATH];
|
||||||
extern char fs_writedir[MAX_SYSPATH];
|
extern char fs_writedir[MAX_SYSPATH];
|
||||||
|
extern fs_api_t g_api;
|
||||||
|
|
||||||
#define GI FI.GameInfo
|
#define GI FI.GameInfo
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user