Exemplo n.º 1
0
OPStatus InputPlugin::loadPlugin(const char * libPath, InputPlugin*& outplug)
{
    if (nullptr != outplug)
    {
        LOG_DEBUG(InputPlugin) << "Existing Plugin object";
        return OP_ERROR;
    }

    InputPlugin* plugin = new InputPlugin;

    if (OP_ERROR == loadLibrary(libPath, plugin->_libHandle, plugin->_pluginInfo))
    {
        delete plugin;
        LOG_ERROR(InputPlugin) << "Error loading library " << libPath;
        return OP_ERROR;
    }

    //Find entries for functions in DLL
    void(*InitFunc)(void);
    
    plugin->loadDefaults();
    plugin->loadPJ64Settings();

    getPluginFunction(plugin->_libHandle, "ControllerCommand", plugin->ControllerCommand);
    getPluginFunction(plugin->_libHandle, "InitiateControllers", InitFunc);
    getPluginFunction(plugin->_libHandle, "ReadController", plugin->ReadController);
    getPluginFunction(plugin->_libHandle, "GetKeys", plugin->GetKeys);
    getPluginFunction(plugin->_libHandle, "RumbleCommand", plugin->RumbleCommand);

    //version 102 functions
    getPluginFunction(plugin->_libHandle, "PluginLoaded", plugin->PluginOpened);

    //Make sure dll had all needed functions
    if (InitFunc == nullptr ||
        plugin->CloseLib == nullptr)
    {
        freeLibrary(plugin->_libHandle);
        delete plugin;
        LOG_ERROR(InputPlugin) << "Invalid plugin: not all required functions are found";
        return OP_ERROR;
    }

    if (plugin->_pluginInfo.Version >= 0x0102)
    {
        if (plugin->PluginOpened == nullptr)
        {
            freeLibrary(plugin->_libHandle);
            delete plugin;
            LOG_ERROR(InputPlugin) << "Invalid plugin: not all required functions are found";
            return OP_ERROR;
        }

        plugin->PluginOpened();
    }

    // Return it
    outplug = plugin; plugin = nullptr;

    return OP_OK;
}
Exemplo n.º 2
0
void DynaLoader::loadLibrary ( const QString& fileName ) 
    /*throw (DynaLoader::LibraryLoadException)*/
{
    freeLibrary();    
    QFileInfo dlInfo( fileName );
    QString dlFileName = dlInfo.fileName();

    QString convertedFileName = fileName;
//TODO: should load MAC frameworks with out .dyld postfix specified
#ifndef _MAC_
    QRegExp regExp( "^" + libPrefix() + ".+\\." + libExtension() + "$" );
    if ( -1 == regExp.indexIn( dlFileName ) ) {
        dlFileName = libPrefix() + dlFileName + "." + libExtension();
        convertedFileName = dlInfo.absolutePath() + QDir::separator() +
                            dlFileName;
    }
#endif
    convertedFileName = QDir::convertSeparators( convertedFileName );
#if defined UNICODE && (defined _WIN32 || defined WIN32)
    handle = dl_open(convertedFileName.toStdWString().data());
#else
    handle = dl_open(QFile::encodeName(convertedFileName));
#endif
    if ( handle == 0 )
        throw LibraryLoadException( dl_error() );
}
Exemplo n.º 3
0
void PluginInfo::releaseFactory(std::string key_string)
{
	if(!loaded) return;

	--num_references;
	if(num_references<=0)
	{
		freeLibrary();
	}
}
Exemplo n.º 4
0
void freeCustomLibraries()
{
	log_msg("***** Free custom libraries *****\n");

	TCustomDll* dll=customDlls;
	TCustomDll* nextDll;
	while (dll)
	{
		dll->release();
		freeLibrary(dll->offset);
		nextDll = dll->nextDll;
		D2FogMemDeAlloc(dll,__FILE__,__LINE__,0);
		dll = nextDll;
	}
}
Exemplo n.º 5
0
int main(int argc, char** argv)
{
	// Parse command line BEFORE InitGoogleTest.
	bool useTersePrinter = true;	// ALWAYS true (for testing only)
	bool useTerseOutput = false;	// option for terse (true) or all (false)
	bool useColor = true;
	bool noClose = false;
	for (int i = 1; i < argc; i++)
	{
		if (strcmp(argv[i], "--terse_output") == 0 )
			useTerseOutput = true;
		else if (strcmp(argv[i], "--no_close") == 0 )
			noClose = true;
		else if (strcmp(argv[i], "--gtest_color=no") == 0)
			useColor = false;
	}
	// Do this after parsing the command line but before changing printer.
	testing::InitGoogleTest(&argc, argv);
	// ALWAYS uses TersePrinter.
	if (useTersePrinter)
	{
		UnitTest& unit_test = *UnitTest::GetInstance();
		TestEventListeners& listeners = unit_test.listeners();
		delete listeners.Release(listeners.default_result_printer());
		listeners.Append(new TersePrinter(useTerseOutput, useColor));
	}
	// run the tests
	loadLibrary();
	int retval = RUN_ALL_TESTS();
	freeLibrary();
	// Verify that all tests were run. This can occur if a source file
	// is missing from the project. The UnitTest reflection API in
	// example 9 will not work here because of user modifications.
	// Change the following value to the number of tests (within 20).
	TersePrinter::PrintTestTotals(2340, __FILE__, __LINE__);

#ifdef __WIN32
	printf("%c", '\n');
#endif
	if (noClose)			// command line option
		systemPause();

	return retval;
}
Exemplo n.º 6
0
OPStatus InputPlugin::unloadPlugin()
{
    if (OP_ERROR == freeLibrary(_libHandle))
    {
        LOG_FATAL(RSPPlugin) << "Error unloading plugin";
        return OP_ERROR;
    }

    memset(&_pluginInfo, 0, sizeof(_pluginInfo));
    Config = nullptr;
    ControllerCommand = nullptr;
    GetKeys = nullptr;
    ReadController = nullptr;
    CloseLib = nullptr;
    RomOpen = nullptr;
    RomClosed = nullptr;

    return OP_OK;
}
Exemplo n.º 7
0
void freeD2Libraries()
{
	log_msg("***** Free Libraries *****\n");

	freeLibrary( offset_SmackW32 );
	freeLibrary( offset_D2Common );
	freeLibrary( offset_ijl11 );
	freeLibrary( offset_D2Gdi );
	freeLibrary( offset_D2Win );
	freeLibrary( offset_D2sound );
//	freeLibrary( offset_D2Multi );
//	freeLibrary( offset_D2MCPCLI );
	freeLibrary( offset_D2Launch );
	freeLibrary( offset_D2gfx );
	freeLibrary( offset_D2Game );
	freeLibrary( offset_D2Client );
	freeLibrary( offset_D2Net );
	freeLibrary( offset_D2Lang );
	freeLibrary( offset_D2CMP );
	freeLibrary( offset_Bnclient );
	freeLibrary( offset_Fog	);
	freeLibrary( offset_Storm );

	log_msg("\n\n");
}
Exemplo n.º 8
0
	~LibEGL()
	{
		freeLibrary(libEGL);
	}
 ~Library()
 {
     freeLibrary( *pHandle_m );
 }
Exemplo n.º 10
0
HikNetHelper::~HikNetHelper() {
    freeLibrary();
}
Exemplo n.º 11
0
DynaLoader::~DynaLoader ()
{
    freeLibrary();
}