bool readSaveGame(char *&buffer, int &size, const char *filename) { if(lastvm >= 0 && tryLoad(buffer, size, filename, lastvm)) return true; for(int i=0; i<24; i++) if(tryLoad(buffer, size, filename, i)) { lastvm = i; return true; } return false; }
VstPlugin::VstPlugin( const QString & _plugin ) : m_plugin( _plugin ), m_pluginWindowID( 0 ), m_embedMethod( gui ? ConfigManager::inst()->vstEmbedMethod() : "headless" ), m_version( 0 ), m_currentProgram() { if( QDir::isRelativePath( m_plugin ) ) { m_plugin = ConfigManager::inst()->vstDir() + m_plugin; } setSplittedChannels( true ); PE::MachineType machineType; try { PE::FileInfo peInfo(m_plugin); machineType = peInfo.machineType(); } catch (std::runtime_error& e) { qCritical() << "Error while determining PE file's machine type: " << e.what(); machineType = PE::MachineType::unknown; } switch(machineType) { case PE::MachineType::amd64: tryLoad( REMOTE_VST_PLUGIN_FILEPATH_64 ); // Default: RemoteVstPlugin64 break; case PE::MachineType::i386: tryLoad( REMOTE_VST_PLUGIN_FILEPATH_32 ); // Default: 32/RemoteVstPlugin32 break; default: m_failed = true; return; } setTempo( Engine::getSong()->getTempo() ); connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( setTempo( bpm_t ) ) ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) ); // update once per second m_idleTimer.start( 1000 ); connect( &m_idleTimer, SIGNAL( timeout() ), this, SLOT( idleUpdate() ) ); }
void ReadabilityArticle::setUrl(QUrl url) { if (m_url == url) return; m_url = url; tryLoad(); }
iIMDShape *modelGet(const QString &filename) { QString name(filename.toLower()); if (models.contains(name)) { return models[name]; // cached } else if (tryLoad("structs/", name) || tryLoad("misc/", name) || tryLoad("effects/", name) || tryLoad("components/prop/", name) || tryLoad("components/weapons/", name) || tryLoad("components/bodies/", name) || tryLoad("features/", name) || tryLoad("misc/micnum/", name) || tryLoad("misc/minum/", name) || tryLoad("misc/mivnum/", name) || tryLoad("misc/researchimds/", name)) { return models[name]; } debug(LOG_ERROR, "Could not find: %s", name.toUtf8().constData()); return nullptr; }
void ReadabilityArticle::setApi(QtReadabilityParserApi* api) { if (m_api) { qWarning("Cannot change article API after initialization"); return; } m_api = api; tryLoad(); }
static void tryAutoLoad(MainWindow &mw) { const auto &config = getConfig(); const auto &settings = config.autoLoad; if (settings.autoLoadMap && !settings.fileName.isEmpty()) { tryLoad(mw, QDir{settings.lastMapDirectory}, settings.fileName, false); } else if (config.general.firstRun) { firstRun(mw); } }
VstPlugin::VstPlugin( const QString & _plugin ) : RemotePlugin(), JournallingObject(), m_plugin( _plugin ), m_pluginWidget( NULL ), m_pluginWindowID( 0 ), m_badDllFormat( false ), m_name(), m_version( 0 ), m_vendorString(), m_productString(), m_currentProgramName(), m_allProgramNames(), p_name(), m_currentProgram(), m_idleTimer() { setSplittedChannels( true ); tryLoad( REMOTE_VST_PLUGIN_FILEPATH ); #ifdef LMMS_BUILD_WIN64 if( m_badDllFormat ) { m_badDllFormat = false; tryLoad( "32/RemoteVstPlugin32" ); } #endif setTempo( Engine::getSong()->getTempo() ); connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( setTempo( bpm_t ) ) ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) ); // update once per second m_idleTimer.start( 1000 ); connect( &m_idleTimer, SIGNAL( timeout() ), this, SLOT( idleUpdate() ) ); }
bool NetscapePluginModule::load() { if (!tryLoad()) { unload(); return false; } m_isInitialized = true; ASSERT(initializedNetscapePluginModules().find(this) == notFound); initializedNetscapePluginModules().append(this); return true; }
static void firstRun(MainWindow &mw) { const auto cd = [](QDir dir, QString subdir) -> QDir { return QDir{dir.absoluteFilePath(subdir)}; }; /* REVISIT: may want both .exe directory and the cwd, since they might be different! */ std::set<QString> seen; for (const auto &dir : {QDir{getConfig().autoLoad.lastMapDirectory}, QDir::current(), cd(QDir::current(), "map")}) { const auto name = dir.absolutePath(); if (seen.find(name) != seen.end()) continue; seen.emplace(name); if (tryLoad(mw, dir, "arda.mm2", true)) break; } }