Exemple #1
0
BOOL	UploadGAR (void)
{
	FILE *GAR;
	char filename[MAX_PATH];
	int i;
	
	if (!PromptFile(topHWnd,"Game Action Replay RAM file (gar.bin)\0gar.bin\0\0",filename,NULL,Path_PLUG,"Please select a valid Game Action Replay data file...","gar.bin",FALSE))
		return FALSE;
	
	if ((GAR = fopen(filename,"rb")) == NULL)
	{
		MessageBox(topHWnd,"Unable to open GAR data file!",MSGBOX_TITLE,MB_OK | MB_ICONERROR);
		return FALSE;
	}
	OpenStatus(topHWnd);
	InitPort();
	StatusText("Resetting CopyNES...");
	ResetNES(RESET_COPYMODE);
	StatusText("Loading initialization plugin...");
	if (!LoadPlugin("garset.bin"))
	{
		fclose(GAR);
		CloseStatus();
		return FALSE;
	}
	StatusText("Running initialization plugin...");
	RunCode();
	Sleep(SLEEP_LONG);
	StatusText("Loading upload plugin...");
	if (!LoadPlugin("garup.bin"))
	{
		fclose(GAR);
		CloseStatus();
		return FALSE;
	}
	StatusText("Running upload plugin...");
	RunCode();
	StatusText("Uploading from data file...");
	BYTE a[256];
	for (i = 0; i < 8; i++)
	{
		fread(&a,256,1,GAR);
		if (!WriteBlock(a, 256))
		{
			fclose(GAR);
			CloseStatus();
			return FALSE;
		}
		StatusPercent((i*100)/8);
	}
	StatusPercent(100);
	StatusText("...done!");
	fclose(GAR);
	StatusText("Upload complete!");
	StatusOK();
	ResetNES(RESET_COPYMODE);
	return TRUE;
}
Exemple #2
0
BOOL	DownloadGAR (void)
{
	FILE *GAR;
	char filename[MAX_PATH];
	int i;

	if (!PromptFile(topHWnd,"Game Action Replay RAM file (gar_d.bin)\0gar_d.bin\0\0",filename,NULL,Path_PLUG,"Please specify where to save Game Action Replay RAM data...","gar_d.bin",TRUE))
		return FALSE;

	if ((GAR = fopen(filename,"wb")) == NULL)
	{
		MessageBox(topHWnd,"Unable to open file for output!",MSGBOX_TITLE,MB_OK | MB_ICONERROR);
		return FALSE;
	}
	OpenStatus(topHWnd);
	InitPort();
	StatusText("Resetting CopyNES...");
	ResetNES(RESET_COPYMODE);
	StatusText("Loading initialization plugin...");
	if (!LoadPlugin("garset.bin"))
	{
		fclose(GAR);
		CloseStatus();
		return FALSE;
	}
	StatusText("Running initialization plugin...");
	RunCode();
	Sleep(SLEEP_LONG);
	StatusText("Loading download plugin...");
	if (!LoadPlugin("gardn.bin"))
	{
		fclose(GAR);
		CloseStatus();
		return FALSE;
	}
	StatusText("Running download plugin...");
	RunCode();
	StatusText("Saving to file...");
	for (i = 0; i < 0x800; i++)
	{
		BYTE n;
		if (!ReadByte(n))
		{
			fclose(GAR);
			CloseStatus();
			return FALSE;
		}
		fwrite(&n,1,1,GAR);
		if (!(i & 0x7))
			StatusPercent((i*100)/2048);
	}
	fclose(GAR);
	StatusText("Download complete!");
	StatusOK();
	ResetNES(RESET_COPYMODE);
	return TRUE;
}
Exemple #3
0
void CPlugins::CreatePlugins(void)
{
    LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX");
    LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio");
    LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP");
    LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control");

    //Enable debugger
    if (m_RSP != NULL && m_RSP->EnableDebugging)
    {
        WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
        m_RSP->EnableDebugging(bHaveDebugger());
        WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging done");
    }
}
void cPluginManager::ReloadPluginsNow(cSettingsRepositoryInterface & a_Settings)
{
	LOG("-- Loading Plugins --");

	// Unload any existing plugins:
	m_bReloadPlugins = false;
	UnloadPluginsNow();

	// Refresh the list of plugins to load new ones from disk / remove the deleted ones:
	RefreshPluginList();

	// Load the plugins:
	AStringVector ToLoad = GetFoldersToLoad(a_Settings);
	for (auto & pluginFolder: ToLoad)
	{
		LoadPlugin(pluginFolder);
	}  // for pluginFolder - ToLoad[]

	// Log a report of the loading process
	size_t NumLoadedPlugins = GetNumLoadedPlugins();
	if (NumLoadedPlugins == 0)
	{
		LOG("-- No Plugins Loaded --");
	}
	else if (NumLoadedPlugins == 1)
	{
		LOG("-- Loaded 1 Plugin --");
	}
	else
	{
		LOG("-- Loaded %u Plugins --", static_cast<unsigned>(NumLoadedPlugins));
	}
	CallHookPluginsLoaded();
}
Exemple #5
0
int main(int argc,char* argv[])
{
DWORD dwEntryPoint,dwSize;
void *Data;
hPLUGININSTANCE hInsts;
StartUpProc StartUp;

	printf("\nPrague module loader ver 0.1\n");
	if(argc<2)
	{
		printf(Usage);
		return 1;
	}

	hInsts = LoadPlugin(argv[1], &dwEntryPoint);
	if(hInsts)
	{
		printf("Load Plugin OK\n");
		StartUp=(StartUpProc)dwEntryPoint;
//		StartUp();
	}
	else
		printf("Load Plugin Failed\n");

	if(errOK==GetMetaData(argv[1], &Data,&dwSize))
		printf("GetMetaData OK\n");
	else
		printf("GetMetaData Failed\n");
	UnloadPlugin(hInsts);
	return 0;
}
Exemple #6
0
void vmsPluginSupport::Initialize()
{
	CString str = ((CFdmApp*)AfxGetApp ())->m_strAppPath;
	if (str.Right (1) != "\\")
		str += '\\';
	str += "Plugins\\";

	CString strMask = str + "*.dll"; 

	WIN32_FIND_DATA wfd;
	HANDLE hFind = FindFirstFile (strMask, &wfd);
	if (hFind == INVALID_HANDLE_VALUE)
		return;

	do 
	{
		vmsLoadedPlugin plug;
		plug.bRunning = false;
		plug.enType = FDMPT_WINDOWLESS;
		plug.strDllFileName = str + wfd.cFileName;
		
		if (FALSE == LoadPlugin (plug))
			continue;

		m_vPlugins.push_back (plug);
	} 
	while (FindNextFile (hFind, &wfd));
}
bool mcuPluginManager::SetMicro(const wxString &mcu, const wxString &family)
{
    bool ret;

    ret = false;

    // Is family name different?
    if (m_family != family) {

        ret = LoadPlugin(family);
        if (ret == false) {
            return false;
        }
    }

    // Store names
    m_mcuName = mcu;
    m_family = family;

    // Now we can safely set the part
    m_pPlugin->OnSetDevice(m_mcuName);

    // Load the plugin based on the family name
    return ret;
}
BOOL CFilePreviewDlg::RunPlugin(HANDLE hFile)
{
	CString strType;
	
	int nExtPos = m_sTargetName.ReverseFind( '.' );
	if ( nExtPos > 0 ) strType = m_sTargetName.Mid( nExtPos );
	CharLower( strType.GetBuffer() );
	strType.ReleaseBuffer();
	
	if ( ! LoadPlugin( strType ) ) return FALSE;
	
	HRESULT hr = S_FALSE;
	
	if ( SUCCEEDED( m_pPlugin->SetSite( &m_xDownloadPreviewSite ) ) )
	{
		BSTR bsFile = m_sTargetName.AllocSysString();
		hr = m_pPlugin->Preview( hFile, bsFile );
		SysFreeString( bsFile );
	}
	
	m_pSection.Lock();
	m_pPlugin->Release();
	m_pPlugin = NULL;
	m_pSection.Unlock();
	
	CoUninitialize();
	
	if ( hr != S_OK ) Sleep( 1000 );
	
	return ( hr != S_FALSE );	// Fall through if it's S_FALSE
}
Exemple #9
0
void RheiaFramePluginManager::LoadAllPlugins()
{
	RheiaPluginRegistrationTable& RegisteredPlugins = RheiaPluginManager::Get()->RegisteredPlugins;

    RheiaPluginRegistrationTable::iterator it = RegisteredPlugins.begin();
    for( ; it != RegisteredPlugins.end() ; ++it )
        LoadPlugin((*it).name);
}
BOOL CLibraryBuilderPlugins::ExtractMetadata(CString& strPath, HANDLE hFile)
{
	CString strType;
	
	int nExtPos = strPath.ReverseFind( '.' );
	if ( nExtPos > 0 ) strType = strPath.Mid( nExtPos );
	
	CharLower( strType.GetBuffer() );
	strType.ReleaseBuffer();
	
	ILibraryBuilderPlugin* pPlugin = NULL;
	
	if ( m_pMap.Lookup( strType, (void*&)pPlugin ) )
	{
		if ( pPlugin == NULL ) return FALSE;
	}
	else
	{
		pPlugin = LoadPlugin( strType );
		if ( pPlugin == NULL ) return FALSE;
	}
	
	CXMLElement* pXML	= new CXMLElement();
	ISXMLElement* ppXML	= (ISXMLElement*)CXMLCOM::Wrap( pXML, IID_ISXMLElement );
	
	BSTR bsFile = strPath.AllocSysString();
	
	HRESULT hResult = pPlugin->Process( hFile, bsFile, ppXML );
	
	SysFreeString( bsFile );
	
	ppXML->Release();
	
	BOOL bSuccess = FALSE;
	
	if ( hResult == S_OK )
	{
		if ( CXMLElement* pOuter = pXML->GetFirstElement() )
		{
			CXMLElement* pInner		= pOuter->GetFirstElement();
			CString strSchemaURI	= pOuter->GetAttributeValue( CXMLAttribute::schemaName );
			
			if ( pInner && strSchemaURI.GetLength() )
			{
				pInner = pInner->Detach();
				bSuccess = m_pBuilder->SubmitMetadata( strSchemaURI, pInner );
			}
		}
	}
	else if ( hResult == E_UNEXPECTED )
	{
		bSuccess = m_pBuilder->SubmitCorrupted();
	}
	
	delete pXML;
	
	return bSuccess;
}
Exemple #11
0
KVDetector *KVGeoImport::BuildDetector(TString det_name, TGeoVolume* det_vol)
{
    // Create a KVDetector with given name for the given volume
    //
    // Detector definition in geometry
    // ===============================
    // 1.) All detector volumes & nodes must have names which begin with "DET_"
    //
    // 2.) They must be made of materials which are known by the range table fRangeTable.
    //
    // 3.) For multi-layer detectors, the "active" layer volume/node must have a name beginning with "ACTIVE_"
    //
    // 4.) The "thickness" of the detector or any layer inside a multilayer detector
    //     will be taken as the size of the volume's shape along its Z-axis
    //     (so make sure that you define your detector volumes in this way).
    //
    // 5.) It is assumed that the natural length units of the geometry are centimetres.
    //
    // 6.) The name of the KVDetector object created and added to the array will be taken
    //     from the unique full path of the node corresponding to the geometrical positioning
    //     of the detector, see KVGeoNavigator::ExtractDetectorNameFromPath
    //
    // 7.) The 'type' of the detector will be set to the name of the material
    //     in the detector's active layer i.e. if active layer material name is "Si",
    //     detector type will be 'Si'
    // 
    // 8.) Default class for all detectors is KVDetector
    //     if you want to use an other class
    //     you need to defined it using SetDetectorPlugin method and put the
    //	  associated line in your .kvrootrc configuration file. This plugin
    //	  has to be loaded by your KVMultiDetArray object


   KVDetector* d = 0;
   TPluginHandler *ph=NULL;
   if ( fDetectorPlugin=="" || !(ph = LoadPlugin("KVDetector",fDetectorPlugin)) ){
   	d = new KVDetector;
   }
   else{
   	d = (KVDetector* )ph->ExecPlugin(0);
   }
   
	d->SetName(det_name);

    Int_t nlayer = det_vol->GetNdaughters();
    if(nlayer){
        for(int i=0;i<nlayer;i++){
            AddLayer(d, det_vol->GetNode(i)->GetVolume());
        }
    }
    else
        AddLayer(d, det_vol);
    TString type = d->GetActiveLayer()->GetName();
    //type.ToUpper();
    d->SetType( type );
    return d;
}
Exemple #12
0
CGHost :: CGHost( CConfig *CFG, QString configFile )
	: d_ptr(new CGHostPrivate()),
		m_ConfigFile(configFile)
{
	currentGHost.setLocalData( this );
	foreach( QObject *plugin, QPluginLoader::staticInstances() )
	{
		LoadPlugin( plugin, CFG );
	}
Exemple #13
0
//===========================================================================
/*virtual*/ bool igApp::OnCmdLineParsed( wxCmdLineParser& parser )
{
	wxString pluginPath;
	if( parser.Found( "plugin", &pluginPath ) )
		LoadPlugin( pluginPath );

	if( wxCMD_SWITCH_ON != parser.FoundSwitch( "noConfig" ) )
		RestoreConfiguration();

	return true;
}
Exemple #14
0
void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
{
	LOG("-- Loading Plugins --");
	m_bReloadPlugins = false;
	UnloadPluginsNow();

	FindPlugins();

	cServer::BindBuiltInConsoleCommands();

	// Check if the Plugins section exists.
	int KeyNum = a_SettingsIni.FindKey("Plugins");

	// If it does, how many plugins are there?
	int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);

	if (KeyNum == -1)
	{
		InsertDefaultPlugins(a_SettingsIni);
	}
	else if (NumPlugins > 0)
	{
		for (int i = 0; i < NumPlugins; i++)
		{
			AString ValueName = a_SettingsIni.GetValueName(KeyNum, i);
			if (ValueName.compare("Plugin") == 0)
			{
				AString PluginFile = a_SettingsIni.GetValue(KeyNum, i);
				if (!PluginFile.empty())
				{
					if (m_Plugins.find(PluginFile) != m_Plugins.end())
					{
						LoadPlugin(PluginFile);
					}
				}
			}
		}
	}

	size_t NumLoadedPlugins = GetNumPlugins();
	if (NumLoadedPlugins == 0)
	{
		LOG("-- No Plugins Loaded --");
	}
	else if (NumLoadedPlugins > 1)
	{
		LOG("-- Loaded %i Plugins --", (int)NumLoadedPlugins);
	}
	else
	{
		LOG("-- Loaded 1 Plugin --");
	}
	CallHookPluginsLoaded();
}
Exemple #15
0
void CPlugins::CreatePlugins( void ) 
{
	LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGfxPlugin, "GFX");
	LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceDebug, "Audio");
	LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSP, "RSP");
	LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceDebug, "Control");

	//Enable debugger
	if (m_RSP != NULL && m_RSP->EnableDebugging)
	{
		WriteTrace(TraceRSP,__FUNCTION__ ": EnableDebugging starting");
		m_RSP->EnableDebugging(bHaveDebugger());
		WriteTrace(TraceRSP,__FUNCTION__ ": EnableDebugging done");
	}

	if (bHaveDebugger())
	{
		Notify().RefreshMenu();
	}
}
Exemple #16
0
NPError NP_GetValue(void *future, NPPVariable variable, void *value)
{
	NPError err;
	LoadPlugin();	
	if ( !gLib ) return NPERR_GENERIC_ERROR;
	DEB(ef, "-> NP_GetValue( %x, %d, %x )\n", future, variable, value );

	err = gNP_GetValue( future, variable, value );
	DEB(ef, "<- NP_GetValue = %d\n", err );
	return err;
}
Exemple #17
0
NPError NP_Shutdown(void)
{
	NPError err;
	LoadPlugin();	
	if ( !gLib ) return NPERR_GENERIC_ERROR;	
	DEB(ef, "-> NP_Shutdown()\n" );
	
	err = gNP_Shutdown( );
	DEB(ef, "<- NP_Shutdown = %d\n", err );
	return err;
}
Exemple #18
0
char *NP_GetMIMEDescription(void)
{
	char * ret;
	
	LoadPlugin();
	if ( !gLib ) return NULL;	
	DEB(ef, "-> NP_GetMIMEDescription()\n" );
	
	ret = gNP_GetMIMEDescription();
	DEB(ef, "<- NP_GetMIMEDescription = %s\n", ret );
	return ret;
}
Exemple #19
0
BOOL	LoadPlugin (const char *filename)
{
	Plugin *plugin = makePlugin("", filename, -1, "");
	if (!plugin)
	{
		MessageBox(topHWnd,"Failed to open plugin file!","Dump",MB_OK | MB_ICONERROR);
		return FALSE;
	}
	BOOL result = LoadPlugin(plugin);
	delete plugin;
	return result;
}
Exemple #20
0
KVIonRangeTable* KVIonRangeTable::GetRangeTable(const Char_t* name)
{
   // Generates an instance of the KVIonRangeTable plugin class corresponding to given name.

   TPluginHandler *ph;
   //check and load plugin library
   if (!(ph = LoadPlugin("KVIonRangeTable", name))) {
      ::Error("KVIonRangeTable::GetRangeTable", "No plugin for KVIonRangeTable with name=%s found in .kvrootrc", name);
      return 0;
   }
   KVIonRangeTable *irt = (KVIonRangeTable *) ph->ExecPlugin(0);
   return irt;
}
Exemple #21
0
Framework::Framework()
{
    /* General: Print debugging information. */
    std::cout << zeug::platform::verbose() << std::endl;

    /* zeug::window: Initialization. */
    this->base_window = std::make_shared<zeug::window>();
    
    /* ZMQ: Initialization with 0 worker threads (we are using shared memory). */
    this->zmq_context = std::make_shared<zmq::context_t>(0);
    
    /* ZMQ: Create framework publication socket on this thread. */
    this->zmq_framework_publisher = std::make_shared<zmq::socket_t>(*this->zmq_context.get(), ZMQ_PUB);
    
    /* ZMQ: Bind. */
    this->zmq_framework_publisher->bind("inproc://Framework");
    
    /* Plugins: Initialization.*/
    LoadPlugin("Game");
    LoadPlugin("Graphics");  
    LoadPlugin("Input");
    LoadPlugin("Physics");
}
BOOL CMultiPlugin::Add(const ATPLUGIN_ARGUMENT &pluginArg)
{
	PLUGININFO *pPlugin;

	tstring strPluginDirectory = GetATDirectory();
	strPluginDirectory += _T("\\Filter");
	pPlugin = LoadPlugin(strPluginDirectory.c_str(), pluginArg);

	if (!pPlugin)
		return FALSE;

	m_apFilters.push_back(pPlugin);
	return TRUE;
}
// エントリポイント
BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call) {
	case DLL_PROCESS_ATTACH:
		LoadPlugin(hModule);
		break;
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
Exemple #24
0
void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
{
	LOG("-- Loading Plugins --");
	m_bReloadPlugins = false;
	UnloadPluginsNow();

	FindPlugins();

	cServer::BindBuiltInConsoleCommands();
	
	unsigned int KeyNum = a_SettingsIni.FindKey("Plugins");
	unsigned int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
	if (KeyNum == -1)
	{
		InsertDefaultPlugins(a_SettingsIni);
	}
	else if (NumPlugins > 0)
	{
		for(unsigned int i = 0; i < NumPlugins; i++)
		{
			AString ValueName = a_SettingsIni.GetValueName(KeyNum, i);
			if (ValueName.compare("Plugin") == 0)
			{
				AString PluginFile = a_SettingsIni.GetValue(KeyNum, i);
				if (!PluginFile.empty())
				{
					if (m_Plugins.find(PluginFile) != m_Plugins.end())
					{
						LoadPlugin( PluginFile );
					}
				}
			}
		}
	}

	if (GetNumPlugins() == 0)
	{
		LOG("-- No Plugins Loaded --");
	}
	else if (GetNumPlugins() > 1)
	{
		LOG("-- Loaded %i Plugins --", GetNumPlugins());
	}
	else
	{
		LOG("-- Loaded 1 Plugin --");
	}
}
Exemple #25
0
GTGanilData* KVGANILDataReader::NewGanTapeInterface()
{
   // Creates and returns new instance of class derived from GTGanilData used to read GANIL acquisition data
   // Actual class is determined by Plugin.GTGanilData in environment files and name of dataset.
   // If no dataset is defined, we use the default GTGanilData object.

   //check and load plugin library
   TString dsname = "any";
   if(gDataSet) dsname = gDataSet->GetName();
   TPluginHandler *ph=LoadPlugin("GTGanilData", dsname);
   if (!ph){
   	// default: GTGanilData
      return (new GTGanilData);
   }

   //execute constructor/macro for plugin
   return ((GTGanilData *) ph->ExecPlugin(0));
}
Exemple #26
0
void CmdLoadPlugin(const CCommandContext &context, const CCommand &command){
	if(command.ArgC() != 2){
		META_CONPRINT("Usage: js_load [plugin_dir]\n");
		return;
	}

	auto pl = SMJS_Plugin::GetPluginByDir(command.Arg(1));
	if(pl != NULL){
		META_CONPRINTF("Plugin \"%s\" is already loaded!\n", command.Arg(1));
		return;
	}

	pl = LoadPlugin(command.Arg(1));
	if(pl == NULL){
		META_CONPRINTF("Plugin \"%s\" failed to load!\n", command.Arg(1));
	}else{
		META_CONPRINTF("Plugin \"%s\" loaded successfully!\n", command.Arg(1));
	}
}
/**	Loads a configuration file
 *
 *	@param configfile The filename of the configuration file
 *
 *	This method will search through the config file, if it parses [VFS]
 *	it'll happily start extracting data from that section, until the next 
 *	section is detected (which, incidentally starts with "[").  Upon reading 
 *	a valid command, the data section will be removed (part of the string 
 *	after the '=' in each valid command line) and compared against what 
 *	VirtualFS is programmed to cope with, upon getting a correct comparison 
 *	from the command, the data section will be tagged into the appropiate 
 *	place in the internal configuration data, to be used later
 */
void VirtualFS::LoadConfig(char *configfile)
{
	bool							begin				=	false;
	const int					buffersize	=	2048;
	char							buffer[buffersize];
	std::ifstream			config(configfile);

	//	Read the config file and look for vfs plugins
	while(config.eof()==0){
		config.getline(buffer,buffersize);

		//	Start reading the config file only when you reach the VFS section
		if(strncmp(buffer,"[VFS]",5) == 0){
			begin = true;
			continue;
		}

		//	End reading when you read the next section (each section starts like [SECTION], [ANOTHERSECTION]
		if( (begin == true) && (strncmp(buffer,"[",1) == 0) ){
			break;
		}

		//	Ignore any blank lines
		if(strcmp(buffer,"\0") == 0){
			continue;
		}
		
		//	If begun, process config data
		if(begin==true){
			char *type		= strtok(buffer,"=");
			char *module	= strtok(&buffer[strlen(type)+1],"\n");

			//	Get the function ptr to create the filters
			VFSTransport::transport_t	t = (VFSTransport::transport_t)	m_moduledb->GetFunction(module,"CreateTransport");
			VFSPlugin::plugin_t				p = (VFSPlugin::plugin_t)				m_moduledb->GetFunction(module,"CreatePlugin");
			VFSFilter::filter_t				f = (VFSFilter::filter_t)				m_moduledb->GetFunction(module,"CreateFilter");

			LoadPlugin(t,p,f);
		}
	}          
}
Exemple #28
0
	void CRoot::LoadPlugins(CString szPluginFile)
	{
		//CConfigFile file;
		//file.Load((char*)szPluginFile.c_str());

		//CConfigFile::SettingSectionMap &mapSec = file.GetMap();
		//CConfigFile::SettingSectionMap::iterator iter = mapSec.begin();
		//for (; iter != mapSec.end(); iter++)
		//{
		//	CConfigFile::SettingSection *pSec = iter->second;
		//	if (pSec != NULL)
		//	{
		//		CConfigFile::SettingSection::iterator iterSec = pSec->begin();
		//		for (; iterSec != pSec->end(); iterSec++)
		//		{
		//			LoadPlugin(iterSec->second);
		//		}
		//	}
		//}

		LoadPlugin("RenderSystem_Direct3D9");
	}
Exemple #29
0
bool FindAndRunAutoloadPlugins(){
	char autoloadPath[512];
	smutils->BuildPath(Path_SM, autoloadPath, sizeof(autoloadPath), "plugins.js/autoload.txt");

	FILE *autoloadFile = fopen(autoloadPath, "r");
	if(autoloadFile == NULL) return false;

	char line[256];
	bool allSuccess = true;
	while(fgets(line, sizeof(line), autoloadFile) != NULL){
		int len = strlen(line);
		while(len > 0 && (line[len - 1] == '\n' || line[len - 1] == '\r')){
			line[len - 1] = '\0'; // Remove newline
			--len;
		}

		if(LoadPlugin(line) == NULL) allSuccess = false;
	}

	fclose(autoloadFile);

	return allSuccess;
}
Exemple #30
0
bool FindAndRunPlugins(){
	char pluginsPath[512];
	smutils->BuildPath(Path_SM, pluginsPath, sizeof(pluginsPath), "plugins.js");

	DIR *dir;
	struct dirent *ent;
	if ((dir = opendir(pluginsPath)) != NULL) {
		while ((ent = readdir (dir)) != NULL) {
			if(strcmp(ent->d_name, "") == 0) continue;
			if(strcmp(ent->d_name, ".") == 0) continue;
			if(strcmp(ent->d_name, "..") == 0) continue;
			if(strcmp(ent->d_name, "disabled") == 0) continue;

			LoadPlugin(ent->d_name);
		}
		closedir(dir);
	} else {
		smutils->LogError(myself, "Couldn't open \"plugins.js\" folder");
		return false;
	}

	return true;
}