bool DebuggerEngineLibrary::init(const QString &path, QString *dbgEngDLL, QString *errorMessage) { // Load the dependent help lib first const QString helpLibPath = libPath(QLatin1String(dbgHelpDllC), path); QLibrary helpLib(helpLibPath, 0); if (!helpLib.isLoaded() && !helpLib.load()) { *errorMessage = msgLibLoadFailed(helpLibPath, helpLib.errorString()); return false; } // Load dbgeng lib const QString engineLibPath = libPath(QLatin1String(dbgEngineDllC), path); QLibrary lib(engineLibPath, 0); if (!lib.isLoaded() && !lib.load()) { *errorMessage = msgLibLoadFailed(engineLibPath, lib.errorString()); return false; } *dbgEngDLL = engineLibPath; // Locate symbols void *createFunc = lib.resolve(debugCreateFuncC); if (!createFunc) { *errorMessage = QCoreApplication::translate("Debugger::Cdb", "Unable to resolve '%1' in the debugger engine library '%2'"). arg(QLatin1String(debugCreateFuncC), QLatin1String(dbgEngineDllC)); return false; } m_debugCreate = static_cast<DebugCreateFunction>(createFunc); return true; }
static nsresult LoadGtkModule(GnomeAccessibilityModule& aModule) { NS_ENSURE_ARG(aModule.libName); if (!(aModule.lib = PR_LoadLibrary(aModule.libName))) { MAI_LOG_DEBUG(("Fail to load lib: %s in default path\n", aModule.libName)); //try to load the module with "gtk-2.0/modules" appended char *curLibPath = PR_GetLibraryPath(); nsCAutoString libPath(curLibPath); #if defined(LINUX) && defined(__x86_64__) libPath.Append(":/usr/lib64:/usr/lib"); #else libPath.Append(":/usr/lib"); #endif MAI_LOG_DEBUG(("Current Lib path=%s\n", libPath.get())); PR_FreeLibraryName(curLibPath); PRInt16 loc1 = 0, loc2 = 0; PRInt16 subLen = 0; while (loc2 >= 0) { loc2 = libPath.FindChar(':', loc1); if (loc2 < 0) subLen = libPath.Length() - loc1; else subLen = loc2 - loc1; nsCAutoString sub(Substring(libPath, loc1, subLen)); sub.Append("/gtk-2.0/modules/"); sub.Append(aModule.libName); aModule.lib = PR_LoadLibrary(sub.get()); if (aModule.lib) { MAI_LOG_DEBUG(("Ok, load %s from %s\n", aModule.libName, sub.get())); break; } loc1 = loc2+1; } if (!aModule.lib) { MAI_LOG_DEBUG(("Fail to load %s\n", aModule.libName)); return NS_ERROR_FAILURE; } } //we have loaded the library, try to get the function ptrs if (!(aModule.init = PR_FindFunctionSymbol(aModule.lib, aModule.initName)) || !(aModule.shutdown = PR_FindFunctionSymbol(aModule.lib, aModule.shutdownName))) { //fail, :( MAI_LOG_DEBUG(("Fail to find symbol %s in %s", aModule.init ? aModule.shutdownName : aModule.initName, aModule.libName)); PR_UnloadLibrary(aModule.lib); aModule.lib = NULL; return NS_ERROR_FAILURE; } return NS_OK; }
void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event ) { wxString searchPath = wxFileName( m_modelLibrary->GetValue() ).GetPath(); if( searchPath.IsEmpty() ) searchPath = Prj().GetProjectPath(); wxString wildcards = SpiceLibraryFileWildcard() + "|" + AllFilesWildcard(); wxFileDialog openDlg( this, _( "Select library" ), searchPath, "", wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( openDlg.ShowModal() == wxID_CANCEL ) return; wxFileName libPath( openDlg.GetPath() ); // Try to convert the path to relative to project if( libPath.MakeRelativeTo( Prj().GetProjectPath() ) && !libPath.GetFullPath().StartsWith( ".." ) ) m_modelLibrary->SetValue( libPath.GetFullPath() ); else m_modelLibrary->SetValue( openDlg.GetPath() ); loadLibrary( openDlg.GetPath() ); m_modelName->Popup(); }
void Gcc::refreshSettings() { QStringList include_dirs; QStringList lib_dirs; QSettings settings(m_targetFile, QSettings::IniFormat); m_cflags.clear(); m_lflags.clear(); include_dirs = settings.value("Target/include_dirs").toString().split(' ', QString::SkipEmptyParts); lib_dirs = settings.value("Target/lib_dirs").toString().split(' ', QString::SkipEmptyParts); QStringListIterator i(include_dirs); while(i.hasNext()) { QDir includePath(i.next()); if(includePath.isAbsolute()) m_cflags << "-I" + includePath.path(); else m_cflags << "-I" + QDir::currentPath() + "/" + includePath.path(); } i = lib_dirs; while(i.hasNext()) { QDir libPath(i.next()); if(libPath.isAbsolute()) m_lflags << "-L" + libPath.path(); else m_lflags << "-L" + QDir::currentPath() + "/" + libPath.path(); } m_cflags << settings.value("Target/cflags").toString().split(' ', QString::SkipEmptyParts); m_lflags << settings.value("Target/lflags").toString().split(' ', QString::SkipEmptyParts); }
void CodeManager::createDirectories() { // check directory structure createDirectory(QDir(cpuPath())); createDirectory(QDir(sourcePath())); createDirectory(QDir(libPath())); createDirectory(QDir(incPath())); }
void load_plugin(std::string path) { QString libPath(path.c_str()); QLibrary library(libPath); bool loaded = library.load(); if(!loaded) printf("%s library failed to load!\n", path.c_str()); }
wxString WIZARD_FPLIB_TABLE::LIBRARY::GetRelativePath( const wxString& aBase, const wxString& aSubstitution ) const { wxFileName libPath( m_path ); // Check if the library path belongs to the project folder if( libPath.MakeRelativeTo( aBase ) && !libPath.GetFullPath().StartsWith( ".." ) ) { return wxString( aSubstitution + "/" + libPath.GetFullPath() ); } // Probably on another drive, so the relative path will not work return wxEmptyString; }
void Python::refreshSettings() { QStringList lib_dirs; QSettings settings(m_targetFile, QSettings::IniFormat); lib_dirs = settings.value("Target/lib_dirs").toString().split(' ', QString::SkipEmptyParts); QStringListIterator i = lib_dirs; while(i.hasNext()) { QDir libPath(i.next()); if(libPath.isAbsolute()) m_lflags << "-L" + libPath.path(); else m_lflags << "-L" + QDir::currentPath() + "/" + libPath.path(); } }
// static void SoundSourceProxy::loadPlugins() { /** Scan for and initialize all plugins */ QList<QDir> pluginDirs; QStringList nameFilters; const QString& pluginPath = CmdlineArgs::Instance().getPluginPath(); if (!pluginPath.isEmpty()) { qDebug() << "Adding plugin path from commandline arg:" << pluginPath; pluginDirs.append(QDir(pluginPath)); } #ifdef __LINUX__ QDir libPath(UNIX_LIB_PATH); if (libPath.cd("plugins") && libPath.cd("soundsource")) { pluginDirs.append(libPath.absolutePath()); } pluginDirs.append(QDir(QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/.mixxx/plugins/soundsource/")); #elif __WINDOWS__ pluginDirs.append(QDir(QCoreApplication::applicationDirPath() + "/plugins/soundsource/")); #elif __APPLE__ QString bundlePluginDir = QCoreApplication::applicationDirPath(); //blah/Mixxx.app/Contents/MacOS bundlePluginDir.remove("MacOS"); //blah/Mixxx.app/Contents/PlugIns/soundsource //bundlePluginDir.append("PlugIns/soundsource"); //Our SCons bundle target doesn't handle plugin subdirectories :( bundlePluginDir.append("PlugIns/"); pluginDirs.append(QDir(bundlePluginDir)); // Do we ever put stuff here? I think this was meant to be // ~/Library/Application Support/Mixxx/Plugins rryan 04/2012 pluginDirs.append(QDir("/Library/Application Support/Mixxx/Plugins/soundsource/")); pluginDirs.append(QDir(QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/Library/Application Support/Mixxx/Plugins/soundsource/")); nameFilters << "libsoundsource*"; #endif QDir dir; foreach(dir, pluginDirs) { QStringList files = dir.entryList(nameFilters, QDir::Files | QDir::NoDotAndDotDot); QString file; foreach (file, files) { getPlugin(dir.filePath(file)); }
bool PluginLauncher::launch( Poco::Util::Application& app ) { bool launched(false); if(_libName.length() > 0) { try { _sharedLib.unload(); Poco::Util::LayeredConfiguration& appConfig(app.config()); SLAString appDir(appConfig.getString("application.dir")); SLAString libPath(appDir); libPath += _libName; libPath += sl::getSharedLibSuffix(); _sharedLib.load(libPath); nlFunc_launchLayer* launchLayerFunc = queryLaunchLayerFunction(); nlFunc_launch* launchFunc = queryLaunchFunction(); if(launchFunc /*&& !launchLayerFunc*/) { launchFunc(); launched = true; } else { if(launchLayerFunc) { int returnCode(sl::CocosAppDelegate::launch(launchLayerFunc)); launched = (returnCode == 0); } else { SL_PROCESS_APP()->log( ELogType_Error, "failed to queryLaunchFunction lib: %s", _libName.c_str()); SL_PROCESS_APP()->log( ELogType_Error, "failed to queryLaunchLayerFunction lib: %s", _libName.c_str()); } } _sharedLib.unload(); } catch ( ... ) { app.logger().error("failed to launch lib: %s", _libName.c_str()); } } return launched; }
void Gcc::refreshSettings() { QStringList include_dirs; QStringList lib_dirs; QSettings settings(m_targetFile, QSettings::IniFormat); m_cflags.clear(); m_lflags.clear(); include_dirs = settings.value("Target/include_dirs").toString().split(' ', QString::SkipEmptyParts); lib_dirs = settings.value("Target/lib_dirs").toString().split(' ', QString::SkipEmptyParts); QStringListIterator i(include_dirs); while(i.hasNext()) { QDir includePath(i.next()); if(includePath.isAbsolute()) m_cflags << "-I" + includePath.path(); else m_cflags << "-I" + QDir::currentPath() + "/" + includePath.path(); } i = lib_dirs; while(i.hasNext()) { QDir libPath(i.next()); if(libPath.isAbsolute()) m_lflags << "-L" + libPath.path(); else m_lflags << "-L" + QDir::currentPath() + "/" + libPath.path(); } m_cflags << settings.value("Target/cflags").toString().split(' ', QString::SkipEmptyParts); m_lflags << settings.value("Target/lflags").toString().split(' ', QString::SkipEmptyParts); #ifdef Q_OS_MAC if(QSysInfo::MacintoshVersion == QSysInfo::MV_TIGER) { m_cflags << "-isysroot" << "/Developer/SDKs/MacOSX10.4u.sdk"; m_lflags << "-isysroot" << "/Developer/SDKs/MacOSX10.4u.sdk"; } #endif }
int main(int argc, char **argv) { // This program should receive one parameter - the folder of compressed bits if(argc != 2) { std::cout << "Pass correct parameters. Usage: " << argv[0] << " <folder of compressed bit files" << std::endl; return -1; } // Check if the folder exist boost::filesystem::path libPath(argv[1]); if(!boost::filesystem::exists(libPath)) { std::cout << "The folder " << libPath.string().c_str() << " does not exist" << std::endl; return -1; } // Maps to store the information on tile type, elements and configs std::vector<ConfigBitMap> configMapVector; std::vector<ElementConfigMap> elementMapVector; TiletypeElementMap tileMap; // Write the database file to disk std::string dbFileName = kFamily + ".ldb"; boost::filesystem::path dbFilePath = libPath / dbFileName; std::ofstream dbFile(dbFilePath.string().c_str(), std::ofstream::binary); if(!dbFile.good()) { std::cout << "Could not open file " << dbFilePath.string() << " to write" << std::endl; return -1; } // Populate the maps PopulateMaps(libPath, tileMap, elementMapVector, configMapVector); std::cout << "Opened file " << dbFilePath.string() << " to store library database" << std::endl; dbFile.write("<<<<BITLIBDB>>>>", 16); // std::cout << "Tile map size " << sizeof(tileMap.size()) << std::endl; uint32_t dataSize; dataSize = tileMap.size(); dbFile.write((char *) (&dataSize), sizeof(dataSize)); // Now go over the map data structure and write it to a file // File format is given at the top of this file TiletypeElementMap::const_iterator pTiletypes = tileMap.begin(); TiletypeElementMap::const_iterator eTiletypes = tileMap.end(); while(pTiletypes != eTiletypes) { // Write the tile name char count, name string and element count dataSize = pTiletypes->first.size(); dbFile.write((const char *) &dataSize, sizeof(dataSize)); dbFile.write((const char *) pTiletypes->first.c_str(), pTiletypes->first.size()); dataSize = pTiletypes->second.size(); dbFile.write((const char*) &dataSize, sizeof(dataSize)); std::cout << "Tile type " << pTiletypes->first << " has " << pTiletypes->second.size() << " elements." << std::endl; // Iterate over elements ElementConfigMap::const_iterator pElements = pTiletypes->second.begin(); ElementConfigMap::const_iterator eElements = pTiletypes->second.end(); while(pElements != eElements) { // Write element name char count, name string and config count dataSize = pElements->first.size(); dbFile.write((const char *) &dataSize, sizeof(dataSize)); dbFile.write((const char *) pElements->first.c_str(), pElements->first.size()); dataSize = pElements->second.size(); dbFile.write((const char *) &dataSize, sizeof(dataSize)); // std::cout << " Element type " << pElements->first << " has " // << pElements->second.size() << " configs." << std::endl; // Itereate over configs ConfigBitMap::const_iterator pConfigs = pElements->second.begin(); ConfigBitMap::const_iterator eConfigs = pElements->second.end(); while(pConfigs != eConfigs) { // Write config namem char count, name string and count of bit addresses dataSize = pConfigs->first.size(); dbFile.write((const char *) &dataSize, sizeof(dataSize)); dbFile.write(pConfigs->first.c_str(), pConfigs->first.size()); dataSize = pConfigs->second.size(); dbFile.write((const char *) &dataSize, sizeof(dataSize)); // Write the bit addresses for(std::vector<uint32_t>::const_iterator iter = pConfigs->second.begin(); iter != pConfigs->second.end(); iter++) { dbFile.write((char *) &*iter, sizeof(uint32_t)); } // std::cout << "\t" << pConfigs->first << " " << pConfigs->second.size(); pConfigs++; } // std::cout << std::endl; pElements++; } pTiletypes++; } return 0; }
bool OpenAL::Initialize(bool openDevice) { if (IsInitialized()) return true; #if defined(NAZARA_PLATFORM_WINDOWS) ///FIXME: Is OpenAL Soft a better implementation than Creative ? /// If we could use OpenAL Soft everytime, this would allow us to use sonorous extensions /// and give us more technical possibilities with audio const char* libs[] = { "soft_oal.dll", "wrap_oal.dll", "openal32.dll" }; #elif defined(NAZARA_PLATFORM_LINUX) const char* libs[] = { "libopenal.so.1", "libopenal.so.0", "libopenal.so" }; //#elif defined(NAZARA_PLATFORM_MACOSX) #else NazaraError("Unknown OS"); return false; #endif bool succeeded = false; for (const char* path : libs) { String libPath(path); if (!s_library.Load(libPath)) continue; try { // al alBuffer3f = reinterpret_cast<OpenALDetail::LPALBUFFER3F>(LoadEntry("alBuffer3f")); alBuffer3i = reinterpret_cast<OpenALDetail::LPALBUFFER3I>(LoadEntry("alBuffer3i")); alBufferData = reinterpret_cast<OpenALDetail::LPALBUFFERDATA>(LoadEntry("alBufferData")); alBufferf = reinterpret_cast<OpenALDetail::LPALBUFFERF>(LoadEntry("alBufferf")); alBufferfv = reinterpret_cast<OpenALDetail::LPALBUFFERFV>(LoadEntry("alBufferfv")); alBufferi = reinterpret_cast<OpenALDetail::LPALBUFFERI>(LoadEntry("alBufferi")); alBufferiv = reinterpret_cast<OpenALDetail::LPALBUFFERIV>(LoadEntry("alBufferiv")); alDeleteBuffers = reinterpret_cast<OpenALDetail::LPALDELETEBUFFERS>(LoadEntry("alDeleteBuffers")); alDeleteSources = reinterpret_cast<OpenALDetail::LPALDELETESOURCES>(LoadEntry("alDeleteSources")); alDisable = reinterpret_cast<OpenALDetail::LPALDISABLE>(LoadEntry("alDisable")); alDistanceModel = reinterpret_cast<OpenALDetail::LPALDISTANCEMODEL>(LoadEntry("alDistanceModel")); alDopplerFactor = reinterpret_cast<OpenALDetail::LPALDOPPLERFACTOR>(LoadEntry("alDopplerFactor")); alDopplerVelocity = reinterpret_cast<OpenALDetail::LPALDOPPLERVELOCITY>(LoadEntry("alDopplerVelocity")); alEnable = reinterpret_cast<OpenALDetail::LPALENABLE>(LoadEntry("alEnable")); alGenBuffers = reinterpret_cast<OpenALDetail::LPALGENBUFFERS>(LoadEntry("alGenBuffers")); alGenSources = reinterpret_cast<OpenALDetail::LPALGENSOURCES>(LoadEntry("alGenSources")); alGetBoolean = reinterpret_cast<OpenALDetail::LPALGETBOOLEAN>(LoadEntry("alGetBoolean")); alGetBooleanv = reinterpret_cast<OpenALDetail::LPALGETBOOLEANV>(LoadEntry("alGetBooleanv")); alGetBuffer3f = reinterpret_cast<OpenALDetail::LPALGETBUFFER3F>(LoadEntry("alGetBuffer3f")); alGetBuffer3i = reinterpret_cast<OpenALDetail::LPALGETBUFFER3I>(LoadEntry("alGetBuffer3i")); alGetBufferf = reinterpret_cast<OpenALDetail::LPALGETBUFFERF>(LoadEntry("alGetBufferf")); alGetBufferfv = reinterpret_cast<OpenALDetail::LPALGETBUFFERFV>(LoadEntry("alGetBufferfv")); alGetBufferi = reinterpret_cast<OpenALDetail::LPALGETBUFFERI>(LoadEntry("alGetBufferi")); alGetBufferiv = reinterpret_cast<OpenALDetail::LPALGETBUFFERIV>(LoadEntry("alGetBufferiv")); alGetDouble = reinterpret_cast<OpenALDetail::LPALGETDOUBLE>(LoadEntry("alGetDouble")); alGetDoublev = reinterpret_cast<OpenALDetail::LPALGETDOUBLEV>(LoadEntry("alGetDoublev")); alGetEnumValue = reinterpret_cast<OpenALDetail::LPALGETENUMVALUE>(LoadEntry("alGetEnumValue")); alGetError = reinterpret_cast<OpenALDetail::LPALGETERROR>(LoadEntry("alGetError")); alGetFloat = reinterpret_cast<OpenALDetail::LPALGETFLOAT>(LoadEntry("alGetFloat")); alGetFloatv = reinterpret_cast<OpenALDetail::LPALGETFLOATV>(LoadEntry("alGetFloatv")); alGetInteger = reinterpret_cast<OpenALDetail::LPALGETINTEGER>(LoadEntry("alGetInteger")); alGetIntegerv = reinterpret_cast<OpenALDetail::LPALGETINTEGERV>(LoadEntry("alGetIntegerv")); alGetListener3f = reinterpret_cast<OpenALDetail::LPALGETLISTENER3F>(LoadEntry("alGetListener3f")); alGetListener3i = reinterpret_cast<OpenALDetail::LPALGETLISTENER3I>(LoadEntry("alGetListener3i")); alGetListenerf = reinterpret_cast<OpenALDetail::LPALGETLISTENERF>(LoadEntry("alGetListenerf")); alGetListenerfv = reinterpret_cast<OpenALDetail::LPALGETLISTENERFV>(LoadEntry("alGetListenerfv")); alGetListeneri = reinterpret_cast<OpenALDetail::LPALGETLISTENERI>(LoadEntry("alGetListeneri")); alGetListeneriv = reinterpret_cast<OpenALDetail::LPALGETLISTENERIV>(LoadEntry("alGetListeneriv")); alGetProcAddress = reinterpret_cast<OpenALDetail::LPALGETPROCADDRESS>(LoadEntry("alGetProcAddress")); alGetSource3f = reinterpret_cast<OpenALDetail::LPALGETSOURCE3F>(LoadEntry("alGetSource3f")); alGetSource3i = reinterpret_cast<OpenALDetail::LPALGETSOURCE3I>(LoadEntry("alGetSource3i")); alGetSourcef = reinterpret_cast<OpenALDetail::LPALGETSOURCEF>(LoadEntry("alGetSourcef")); alGetSourcefv = reinterpret_cast<OpenALDetail::LPALGETSOURCEFV>(LoadEntry("alGetSourcefv")); alGetSourcei = reinterpret_cast<OpenALDetail::LPALGETSOURCEI>(LoadEntry("alGetSourcei")); alGetSourceiv = reinterpret_cast<OpenALDetail::LPALGETSOURCEIV>(LoadEntry("alGetSourceiv")); alGetString = reinterpret_cast<OpenALDetail::LPALGETSTRING>(LoadEntry("alGetString")); alIsBuffer = reinterpret_cast<OpenALDetail::LPALISBUFFER>(LoadEntry("alIsBuffer")); alIsEnabled = reinterpret_cast<OpenALDetail::LPALISENABLED>(LoadEntry("alIsEnabled")); alIsExtensionPresent = reinterpret_cast<OpenALDetail::LPALISEXTENSIONPRESENT>(LoadEntry("alIsExtensionPresent")); alIsSource = reinterpret_cast<OpenALDetail::LPALISSOURCE>(LoadEntry("alIsSource")); alListener3f = reinterpret_cast<OpenALDetail::LPALLISTENER3F>(LoadEntry("alListener3f")); alListener3i = reinterpret_cast<OpenALDetail::LPALLISTENER3I>(LoadEntry("alListener3i")); alListenerf = reinterpret_cast<OpenALDetail::LPALLISTENERF>(LoadEntry("alListenerf")); alListenerfv = reinterpret_cast<OpenALDetail::LPALLISTENERFV>(LoadEntry("alListenerfv")); alListeneri = reinterpret_cast<OpenALDetail::LPALLISTENERI>(LoadEntry("alListeneri")); alListeneriv = reinterpret_cast<OpenALDetail::LPALLISTENERIV>(LoadEntry("alListeneriv")); alSource3f = reinterpret_cast<OpenALDetail::LPALSOURCE3F>(LoadEntry("alSource3f")); alSource3i = reinterpret_cast<OpenALDetail::LPALSOURCE3I>(LoadEntry("alSource3i")); alSourcef = reinterpret_cast<OpenALDetail::LPALSOURCEF>(LoadEntry("alSourcef")); alSourcefv = reinterpret_cast<OpenALDetail::LPALSOURCEFV>(LoadEntry("alSourcefv")); alSourcei = reinterpret_cast<OpenALDetail::LPALSOURCEI>(LoadEntry("alSourcei")); alSourceiv = reinterpret_cast<OpenALDetail::LPALSOURCEIV>(LoadEntry("alSourceiv")); alSourcePause = reinterpret_cast<OpenALDetail::LPALSOURCEPAUSE>(LoadEntry("alSourcePause")); alSourcePausev = reinterpret_cast<OpenALDetail::LPALSOURCEPAUSEV>(LoadEntry("alSourcePausev")); alSourcePlay = reinterpret_cast<OpenALDetail::LPALSOURCEPLAY>(LoadEntry("alSourcePlay")); alSourcePlayv = reinterpret_cast<OpenALDetail::LPALSOURCEPLAYV>(LoadEntry("alSourcePlayv")); alSourceQueueBuffers = reinterpret_cast<OpenALDetail::LPALSOURCEQUEUEBUFFERS>(LoadEntry("alSourceQueueBuffers")); alSourceRewind = reinterpret_cast<OpenALDetail::LPALSOURCEREWIND>(LoadEntry("alSourceRewind")); alSourceRewindv = reinterpret_cast<OpenALDetail::LPALSOURCEREWINDV>(LoadEntry("alSourceRewindv")); alSourceStop = reinterpret_cast<OpenALDetail::LPALSOURCESTOP>(LoadEntry("alSourceStop")); alSourceStopv = reinterpret_cast<OpenALDetail::LPALSOURCESTOPV>(LoadEntry("alSourceStopv")); alSourceUnqueueBuffers = reinterpret_cast<OpenALDetail::LPALSOURCEUNQUEUEBUFFERS>(LoadEntry("alSourceUnqueueBuffers")); alSpeedOfSound = reinterpret_cast<OpenALDetail::LPALSPEEDOFSOUND>(LoadEntry("alSpeedOfSound")); // alc alcCaptureCloseDevice = reinterpret_cast<OpenALDetail::LPALCCAPTURECLOSEDEVICE>(LoadEntry("alcCaptureCloseDevice")); alcCaptureOpenDevice = reinterpret_cast<OpenALDetail::LPALCCAPTUREOPENDEVICE>(LoadEntry("alcCaptureOpenDevice")); alcCaptureSamples = reinterpret_cast<OpenALDetail::LPALCCAPTURESAMPLES>(LoadEntry("alcCaptureSamples")); alcCaptureStart = reinterpret_cast<OpenALDetail::LPALCCAPTURESTART>(LoadEntry("alcCaptureStart")); alcCaptureStop = reinterpret_cast<OpenALDetail::LPALCCAPTURESTOP>(LoadEntry("alcCaptureStop")); alcCloseDevice = reinterpret_cast<OpenALDetail::LPALCCLOSEDEVICE>(LoadEntry("alcCloseDevice")); alcCreateContext = reinterpret_cast<OpenALDetail::LPALCCREATECONTEXT>(LoadEntry("alcCreateContext")); alcDestroyContext = reinterpret_cast<OpenALDetail::LPALCDESTROYCONTEXT>(LoadEntry("alcDestroyContext")); alcGetContextsDevice = reinterpret_cast<OpenALDetail::LPALCGETCONTEXTSDEVICE>(LoadEntry("alcGetContextsDevice")); alcGetCurrentContext = reinterpret_cast<OpenALDetail::LPALCGETCURRENTCONTEXT>(LoadEntry("alcGetCurrentContext")); alcGetEnumValue = reinterpret_cast<OpenALDetail::LPALCGETENUMVALUE>(LoadEntry("alcGetEnumValue")); alcGetError = reinterpret_cast<OpenALDetail::LPALCGETERROR>(LoadEntry("alcGetError")); alcGetIntegerv = reinterpret_cast<OpenALDetail::LPALCGETINTEGERV>(LoadEntry("alcGetIntegerv")); alcGetProcAddress = reinterpret_cast<OpenALDetail::LPALCGETPROCADDRESS>(LoadEntry("alcGetProcAddress")); alcGetString = reinterpret_cast<OpenALDetail::LPALCGETSTRING>(LoadEntry("alcGetString")); alcIsExtensionPresent = reinterpret_cast<OpenALDetail::LPALCISEXTENSIONPRESENT>(LoadEntry("alcIsExtensionPresent")); alcMakeContextCurrent = reinterpret_cast<OpenALDetail::LPALCMAKECONTEXTCURRENT>(LoadEntry("alcMakeContextCurrent")); alcOpenDevice = reinterpret_cast<OpenALDetail::LPALCOPENDEVICE>(LoadEntry("alcOpenDevice")); alcProcessContext = reinterpret_cast<OpenALDetail::LPALCPROCESSCONTEXT>(LoadEntry("alcProcessContext")); alcSuspendContext = reinterpret_cast<OpenALDetail::LPALCSUSPENDCONTEXT>(LoadEntry("alcSuspendContext")); succeeded = true; break; } catch (const std::exception& e) { NazaraWarning(libPath + " loading failed: " + String(e.what())); continue; } } if (!succeeded) { NazaraError("Failed to load OpenAL"); Uninitialize(); return false; } if (openDevice) OpenDevice(); return true; }
void ItemHandle::installLaunchScripts() { UserCore::Item::ItemInfoI* item = getItemInfo(); if (!item) return; UserCore::Item::BranchInfoI* branch = item->getCurrentBranch(); if (!branch) return; std::vector<UserCore::Item::Misc::ExeInfoI*> exeList; item->getExeList(exeList); char* scriptBin = NULL; char* scriptXdg = NULL; try { UTIL::FS::readWholeFile(UTIL::STRING::toStr( UTIL::OS::getDataPath(L"scripts/launch_bin_template.sh")), &scriptBin); UTIL::FS::readWholeFile(UTIL::STRING::toStr( UTIL::OS::getDataPath(L"scripts/launch_xdg_template.sh")), &scriptXdg); } catch (gcException &e) { safe_delete(scriptBin); safe_delete(scriptXdg); Warning(gcString("Failed to read launch script template: {0}\n", e)); return; } gcString globalArgs = getUserCore()->getCVarValue("gc_linux_launch_globalargs"); gcString globalExe = getUserCore()->getCVarValue("gc_linux_launch_globalbin"); if (!UTIL::FS::isValidFile(globalExe.c_str())) globalExe = ""; for (size_t x=0; x<exeList.size(); x++) { UserCore::Item::Misc::ExeInfoI* exe = exeList[x]; if (!exe || !UTIL::FS::isValidFile(exe->getExe())) continue; gcString path("{0}/desura_launch_{1}.sh", item->getPath(), UTIL::LIN::sanitiseFileName(exe->getName())); char magicBytes[5] = {0}; try { UTIL::FS::FileHandle fh(exe->getExe(), UTIL::FS::FILE_READ); fh.read(magicBytes, 5); } catch (gcException& e) { continue; } UTIL::LIN::BinType type = UTIL::LIN::getFileType(magicBytes, 5); try { UTIL::FS::FileHandle fh(path.c_str(), UTIL::FS::FILE_WRITE); if (type == UTIL::LIN::BT_UNKNOWN) { gcString lcmd(scriptXdg, exe->getExe()); fh.write(lcmd.c_str(), lcmd.size()); } else { gcString libPath("\"{0}/{1}/{2}/lib\"", UTIL::OS::getAppDataPath(), branch->getItemId().getFolderPathExtension(), (uint32)branch->getBranchId()); gcString libPathB("{0}/lib{1}", item->getPath(), branch->is32Bit()?"32":"64"); if (UTIL::FS::isValidFolder(libPathB.c_str())) { libPath += ":"; libPath += "\"" + libPathB + "\""; } const char* exePath = exe->getExe(); gcString args; gcString ea(exe->getExeArgs()); if (globalExe.size() > 0) { args += gcString(exePath); exePath = globalExe.c_str(); } if (ea.size() > 0) { if (args.size() > 0) args += " "; args += ea; } if (globalArgs.size() > 0) { if (args.size() > 0) args += " "; args += globalArgs; } gcString lcmd(scriptBin, exePath, args, libPath); fh.write(lcmd.c_str(), lcmd.size()); } } catch (gcException &e) { } chmod(path.c_str(), S_IRWXU|S_IRGRP|S_IROTH); } safe_delete(scriptBin); safe_delete(scriptXdg); }