diff --git a/avi/common/common.c b/avi/common/common.c new file mode 100644 index 00000000..c9c8f169 --- /dev/null +++ b/avi/common/common.c @@ -0,0 +1,17 @@ +#include +#include "common.h" + +extern movie_interface_t g_api; +movie_api_t g_engfuncs; + +int EXPORT GetMovieAPI( int version, movie_api_t *api, movie_interface_t *interface ); +int EXPORT GetMovieAPI( int version, movie_api_t *api, movie_interface_t *interface ) +{ + if( version != MOVIE_API_VERSION ) + return 0; + + memcpy( &g_engfuncs, api, sizeof( g_engfuncs )); + memcpy( interface, &g_api, sizeof( *interface )); + + return MOVIE_API_VERSION; +} diff --git a/avi/common/common.h b/avi/common/common.h new file mode 100644 index 00000000..bdef3576 --- /dev/null +++ b/avi/common/common.h @@ -0,0 +1,20 @@ +#ifndef AVI_COMMON_H +#define AVI_COMMON_H + +#include "movie_api.h" + +extern movie_api_t g_engfuncs; + +#define Mem_Malloc( pool, size ) g_engfuncs._Mem_Alloc( pool, size, false, __FILE__, __LINE__ ) +#define Mem_Calloc( pool, size ) g_engfuncs._Mem_Alloc( pool, size, true, __FILE__, __LINE__ ) +#define Mem_Realloc( pool, ptr, size ) g_engfuncs._Mem_Realloc( pool, ptr, size, true, __FILE__, __LINE__ ) +#define Mem_Free( mem ) g_engfuncs._Mem_Free( mem, __FILE__, __LINE__ ) +#define Mem_AllocPool( name ) g_engfuncs._Mem_AllocPool( name, __FILE__, __LINE__ ) +#define Mem_FreePool( pool ) g_engfuncs._Mem_FreePool( pool, __FILE__, __LINE__ ) + +#define Con_Printf (*g_engfuncs._Con_Printf) +#define Con_DPrintf (*g_engfuncs._Con_DPrintf) +#define Con_Reportf (*g_engfuncs._Con_Reportf) +#define Sys_Error (*g_engfuncs._Sys_Error) + +#endif // AVI_COMMON_H diff --git a/avi/common/wscript b/avi/common/wscript new file mode 100644 index 00000000..30dcdaff --- /dev/null +++ b/avi/common/wscript @@ -0,0 +1,23 @@ +#! /usr/bin/env python +# encoding: utf-8 + +from waflib import Logs +import os + +def options(opt): + return + +def configure(conf): + return + +def build(bld): + bld(name = 'avi_common_includes', export_includes = '.', use = 'engine_includes filesystem_includes') + + bld.stlib(source = bld.path.ant_glob(['*.c']), + target = 'avi_common', + features = 'c', + includes = '.', + use = 'avi_common_includes public werror', + install_path = bld.env.LIBDIR, + subsystem = bld.env.MSVC_SUBSYSTEM + ) diff --git a/engine/client/avi/avi_win.c b/avi/win32/avi_win.c similarity index 100% rename from engine/client/avi/avi_win.c rename to avi/win32/avi_win.c diff --git a/avi/win32/wscript b/avi/win32/wscript new file mode 100644 index 00000000..6cf27361 --- /dev/null +++ b/avi/win32/wscript @@ -0,0 +1,26 @@ +#! /usr/bin/env python +# encoding: utf-8 + +from waflib import Logs +import os + +def options(opt): + return + +def configure(conf): + return + +def build(bld): + libs = [ 'engine_includes', 'werror', 'public' ] + + if bld.env.DEDICATED: + return + + bld.shlib(source = bld.path.ant_glob(['*.c']), + target = 'avi_win32', + features = 'c', + includes = '. ../', + use = 'avi_common avi_common_includes public werror', + install_path = bld.env.LIBDIR, + subsystem = bld.env.MSVC_SUBSYSTEM + ) diff --git a/wscript b/wscript index 4237c466..4546fde1 100644 --- a/wscript +++ b/wscript @@ -69,6 +69,8 @@ SUBDIRS = [ Subproject('dllemu'), # disable only by engine feature, makes no sense to even parse subprojects in dedicated mode + Subproject('avi/common', lambda x: not x.env.DEDICATED), + Subproject('avi/win32', lambda x: not x.env.DEDICATED and x.env.DEST_OS == 'win32'), Subproject('3rdparty/extras', lambda x: not x.env.DEDICATED and x.env.DEST_OS != 'android'), Subproject('3rdparty/nanogl', lambda x: not x.env.DEDICATED and x.env.NANOGL), Subproject('3rdparty/gl-wes-v2', lambda x: not x.env.DEDICATED and x.env.GLWES),