2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 // =============================================================================
28 _QERFuncTable_1 g_FuncTable; // Radiant function table
29 _QERFileSystemTable g_FileSystemTable;
31 // =============================================================================
34 CSynapseServer* g_pSynapseServer = NULL;
35 CSynapseClientImage g_SynapseClient;
37 static const XMLConfigEntry_t entries[] =
39 { VFS_MAJOR, SYN_REQUIRE, sizeof( _QERFileSystemTable ), &g_FileSystemTable },
40 { NULL, SYN_UNKNOWN, 0, NULL }
44 #pragma GCC visibility push(default)
46 extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
48 #pragma GCC visibility pop
50 if ( strcmp( version, SYNAPSE_VERSION ) ) {
51 Syn_Printf( "ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version );
54 g_pSynapseServer = pServer;
55 g_pSynapseServer->IncRef();
56 Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() );
58 g_SynapseClient.AddAPI( IMAGE_MAJOR, "wal", sizeof( _QERPlugImageTable ) );
59 g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable );
61 if ( !g_SynapseClient.ConfigXML( pServer, NULL, entries ) ) {
65 return &g_SynapseClient;
68 bool CSynapseClientImage::RequestAPI( APIDescriptor_t *pAPI ){
69 if ( !strcmp( pAPI->major_name, IMAGE_MAJOR ) ) {
70 _QERPlugImageTable* pTable = static_cast<_QERPlugImageTable*>( pAPI->mpTable );
71 if ( !strcmp( pAPI->minor_name, "wal" ) ) {
72 pTable->m_pfnLoadImage = &LoadWAL;
77 Syn_Printf( "ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo() );
81 bool CSynapseClientImage::OnActivate() {
82 if ( !g_FileSystemTable.m_nSize ) {
83 Syn_Printf( "ERROR: VFS_MAJOR table was not initialized before OnActivate in '%s' - incomplete synapse.config?\n", GetInfo() );
91 const char* CSynapseClientImage::GetInfo(){
92 return "WAL formats module built " __DATE__ " " RADIANT_VERSION;