filesystem: allow acquiring C interface through CreateInterface export

This commit is contained in:
Alibek Omarov
2022-08-25 20:33:16 +03:00
parent 9d49985100
commit fce8afabfb
4 changed files with 15 additions and 1 deletions

View File

@@ -492,6 +492,18 @@ extern "C" void EXPORT *CreateInterface( const char *interface, int *retval )
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( &copy, &g_api, sizeof( copy ));
if( retval ) *retval = 0;
return ©
}
if( retval ) *retval = 1;
return NULL;
}