コード例 #1
0
ファイル: emu.cpp プロジェクト: V10lator/emumaster
bool Emu::loadState(const QString &statePath)
{
	emsl.save = false;
	emsl.abortIfLoadFails = false;

	QFile file(statePath);
	if (!file.open(QIODevice::ReadOnly)) {
		emsl.error = tr("Could not open file.");
		return false;
	}

	QDataStream sOmit(&file);
	sOmit.setByteOrder(QDataStream::LittleEndian);
	sOmit.setFloatingPointPrecision(QDataStream::SinglePrecision);
	QImage omitFrame;
	sOmit >> omitFrame;

	QByteArray compressed = file.read(file.size() - file.pos());
	QByteArray data = qUncompress(compressed);
	file.close();
	compressed.clear();

	QDataStream s(&data, QIODevice::ReadOnly);
	s.setByteOrder(QDataStream::LittleEndian);
	s.setFloatingPointPrecision(QDataStream::SinglePrecision);

	return loadInternal(&s);
}
コード例 #2
0
void WebMediaPlayerClientImpl::startDelayedLoad()
{
    ASSERT(m_delayingLoad);
    ASSERT(!m_webMediaPlayer);

    m_delayingLoad = false;

    loadInternal();
}
コード例 #3
0
void FontFace::loadWithCallback(PassRefPtrWillBeRawPtr<LoadFontCallback> callback, ExecutionContext* context)
{
    loadInternal(context);
    if (m_status == Loaded)
        callback->notifyLoaded(this);
    else if (m_status == Error)
        callback->notifyError(this);
    else
        m_callbacks.append(callback);
}
コード例 #4
0
void WebMediaPlayerClientImpl::loadRequested()
{
    if (m_preload == MediaPlayer::None) {
#if ENABLE(WEB_AUDIO)
        m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider.
#endif
        m_webMediaPlayer.clear();
        m_delayingLoad = true;
    } else
        loadInternal();
}
コード例 #5
0
//==============================================================================
void TextureResource::load(const CString& filename, ResourceInitializer& init)
{
	try
	{
		loadInternal(filename, init);
	}
	catch(std::exception& e)
	{
		throw ANKI_EXCEPTION("Failed to load texture") << e;
	}
}
コード例 #6
0
void ModelManager::loadList()
{
	fs::path ModelPath(L"./Data/Models/"), CacheFilePath(L"./Data/ModelCache.dat");
	if (!fs::exists(ModelPath)) throw std::ios_base::failure("Model directory not found");

	if (loadFromCache(CacheFilePath, ModelPath))
		return;

	// Rebuild the cache file, since it is invalid
	loadInternal(ModelPath);
	saveToCache(CacheFilePath, ModelPath);
}
コード例 #7
0
ファイル: kiconloader.cpp プロジェクト: kthxbyte/KDE1-Linaro
QPixmap KIconLoader::loadMiniIcon ( const QString &name, int w, int h ){

  QPixmap result;

  if (name.left(1)!='/'){
    result = loadInternal( "mini/" + name, w, h);
  }

  if (result.isNull())
    result = loadInternal(name, w, h);


/* 
   Stephan: See above
   if (result.isNull())
    warning(klocale->translate("ERROR: couldn't find mini icon: %s"), 
    (const char *) name);

*/

  return result;
}
コード例 #8
0
	HResource Resources::loadFromUUID(const String& uuid, bool async, bool loadDependencies, bool keepInternalReference)
	{
		Path filePath;

		// Default manifest is at 0th index but all other take priority since Default manifest could
		// contain obsolete data. 
		for (auto iter = mResourceManifests.rbegin(); iter != mResourceManifests.rend(); ++iter)
		{
			if ((*iter)->uuidToFilePath(uuid, filePath))
				break;
		}

		return loadInternal(uuid, filePath, !async, loadDependencies, keepInternalReference);
	}
コード例 #9
0
ファイル: kiconloader.cpp プロジェクト: kthxbyte/KDE1-Linaro
QPixmap KIconLoader::loadIcon ( const QString &name, int w, int h ){
  QPixmap result = loadInternal(name, w, h);

/* Stephan: It's OK to know, how many icons are still missing, but
       we don't need to tell everybody ;) Perhaps this can be con-
       verted to a KDEBUG solution, that is more silent? Don't know.

  if (result.isNull())
    warning(klocale->translate("ERROR: couldn't find icon: %s"), (const char *) name);

*/

  return result;
}
コード例 #10
0
ファイル: BaseResourceLoader.cpp プロジェクト: jsmtux/Op3nD
Resource* BaseResourceLoader::loadResource(State* state, string dir)
{
  Resource* ret;
  map<string,Resource*>::iterator tmp;

  if((tmp=resourceList.find(dir))==resourceList.end()){
    ret = loadInternal(state, dir);
    resourceList.insert(pair<string, Resource* >(dir, ret));
  }
  else{
    ret = tmp->second;
  }
  return ret;
}
コード例 #11
0
ファイル: player.cpp プロジェクト: peres/scummvm
bool VideoPlayer::load(Common::SeekableReadStream *file, uint16 flags) {
	_file = file;
	_flags = flags;
	_audioStream = NULL;

	uint16 fps = loadInternal();

	if (fps != 0) {
		_millisBetweenFrames = 1000 / fps;
		_begunPlaying = false;
		return true;
	} else {
		_file = NULL;
		return false;
	}
}
コード例 #12
0
	HResource Resources::loadAsync(const Path& filePath, bool loadDependencies, bool keepInternalReference)
	{
		if (!FileSystem::isFile(filePath))
		{
			LOGWRN_VERBOSE("Cannot load resource. Specified file: " + filePath.toString() + " doesn't exist.");

			return HResource();
		}

		String uuid;
		bool foundUUID = getUUIDFromFilePath(filePath, uuid);

		if (!foundUUID)
			uuid = UUIDGenerator::generateRandom();

		return loadInternal(uuid, filePath, false, loadDependencies, keepInternalReference);
	}
コード例 #13
0
bool IResource::load(bool async)
{
	if(m_loadState==LoadState_Loaded)
		return true;
	if(m_loadRequest && m_loadRequest->IsLoaded())
	{
		delete m_loadRequest;
		m_loadRequest=0;
		_onLoaded();
	}else
	{
		if(m_loadState!=LoadState_Loading)
		{

			try{
				preLoadInternal(async);
				if(!async)
				{
					loadInternal();
					m_loadState=LoadState_Loaded;
					_onLoaded();
				}
			}catch(...){
				m_loadState=LoadState_Unloaded;
				throw;
			}
		}else if(!async && m_loadRequest)
		{
			//worst case,we are asked to use it,but it is already in the loading queue
			while(!m_loadRequest->IsLoaded())
			{
				OS::IThreadManager::getInstance().sleep(50);
			}
			delete m_loadRequest;
			m_loadRequest=0;
			_onLoaded();
		}
	}
	if(m_loadState==LoadState_Unloaded)
		m_loadState=LoadState_Loading;
	return true;
}
コード例 #14
0
/**
 * Loads from a byte array.
 * @param data Byte array to load from.
 * @return The number of bytes read.
 */
int EditableMetatileHeightMaps::load(const Tbyte* data) {
  // Count of loaded bytes
  int byteCount = 0;
  LoadHelper loader(data,
                    byteCount);
                    
  if (loader.version() > 0) {
    throw UnrecognizedVersionException(TALES_SRCANDLINE,
                                       "EditableMetatileHeightMaps::load("
                                       "const Tbyte*)",
                                       DataChunkIDs::metatileHeightMaps,
                                       "EditableMetatileHeightMaps",
                                       loader.version(),
                                       0);
  }
  
  loadInternal(data,
               byteCount);
  
  return byteCount;
}
コード例 #15
0
void ModelManager::loadInternal(const boost::filesystem::path &Path) {
	fs::directory_iterator EndIterator;

	for (fs::directory_iterator PathIterator(Path); PathIterator != EndIterator; ++PathIterator) {
		// If the current visited path is a directory, recusively look for a model
		if (fs::is_directory(PathIterator->status())) {
			loadInternal(PathIterator->path());
		}
		// Validates the PMX model extension
		else if (fs::is_regular_file(PathIterator->status()) && PathIterator->path().has_extension()) {
			if (boost::iequals(PathIterator->path().extension().generic_wstring(), L".pmx")) {
				try {
					auto desc = ModelLoader->getDescription(PathIterator->path().wstring());
					KnownModels[desc.name.japanese] = PathIterator->path();
				}
				catch (PMX::Loader::Exception &e) {
				}
			}
		}
	}
}
コード例 #16
0
ファイル: ProxyVizNode.cpp プロジェクト: spinos/aphid
MStatus ProxyViz::compute( const MPlug& plug, MDataBlock& block )
{
	if(!m_enableCompute) return MS::kSuccess;
	if( plug == outValue ) {
		
		updateWorldSpace(thisMObject() );
		
		MStatus status;

		ExampVox * defBox = plantExample(0);
		
		defBox->setGeomSizeMult(block.inputValue(aradiusMult).asFloat() );
		
		defBox->setGeomBox(block.inputValue(abboxminx).asFloat(),
			block.inputValue(abboxminy).asFloat(), 
			block.inputValue(abboxminz).asFloat(), 
			block.inputValue(abboxmaxx).asFloat(), 
			block.inputValue(abboxmaxy).asFloat(), 
			block.inputValue(abboxmaxz).asFloat());
		
		float grdsz = defBox->geomExtent() * 32.f ;
		if(grdsz < 32.f) {
			AHelper::Info<float>(" ProxyViz input box is too small", grdsz);
			grdsz = 32.f;
			AHelper::Info<float>(" trancated to", grdsz);
		}
		
		if(m_toSetGrid) {
			m_toSetGrid = false;
			resetGrid(grdsz);
		}
		
		if(_firstLoad) {
/// internal cache only, initializing from external cache is obsolete 
			if(!loadInternal(block) )
				std::cout<<"\n ERROR proxviz cannot load internal cache";

			_firstLoad = 0;
		}
        
		if(!m_toCheckVisibility) {
			MArrayDataHandle groundMeshArray = block.inputArrayValue(agroundMesh );
			MArrayDataHandle groundSpaceArray = block.inputArrayValue(agroundSpace );
/// in case no ground is connected
            if(updateGround(groundMeshArray, groundSpaceArray )) {
                moveWithGround();
                AHelper::Info<std::string>(" ProxyViz ground ", groundBuildLog() );
            }
		}
		
		if(!m_hasParticle) {
			block.setClean(plug);
            return MS::kSuccess;
		}
		
		const int ngroups = block.inputValue(agroupcount).asInt();
		
		MDataHandle hdata = block.inputValue(outPositionPP, &status);
        MFnVectorArrayData farray(hdata.data(), &status);
        if(!status) {
            MGlobal::displayInfo("proxy viz is not properly connected to a particle system");
			block.setClean(plug);
            return MS::kSuccess;
        }
    
        MDataHandle scaledata = block.inputValue(outScalePP, &status);
        MFnVectorArrayData scalearray(scaledata.data(), &status);
        if(!status) {
            MGlobal::displayInfo("proxy viz is not properly connected to a particle system");
			block.setClean(plug);
            return MS::kSuccess;
        }
		
		MDataHandle rotatedata = block.inputValue(outRotationPP, &status);
        MFnVectorArrayData rotatearray(rotatedata.data(), &status);
        if(!status) {
            MGlobal::displayInfo("proxy viz is not properly connected to a particle system");
			block.setClean(plug);
            return MS::kSuccess;
        }
		
		MDataHandle replaceData = block.inputValue(outReplacePP, &status);
        MFnDoubleArrayData replaceArrayFn(replaceData.data(), &status);
        if(!status) {
            MGlobal::displayInfo("proxy viz is not properly connected to a particle system, needs userScalarPP");
			block.setClean(plug);
            return MS::kSuccess;
        }
		
		MVectorArray outPosArray = farray.array();	
        MVectorArray outScaleArray = scalearray.array();
		MVectorArray outRotateArray = rotatearray.array();
		MDoubleArray outReplaceArray = replaceArrayFn.array();
		
		if( outPosArray.length() < 1) {
			block.setClean(plug);
			return MS::kSuccess;
		}
		
		computePPAttribs(outPosArray, outRotateArray, outScaleArray, outReplaceArray,
						ngroups);

        float result = outPosArray.length();

		MDataHandle outputHandle = block.outputValue( outValue );
		outputHandle.set( result );
		block.setClean(plug);
    }
	if(plug == outValue1) {
		
		MArrayDataHandle hArray = block.inputArrayValue(ainexamp);
		updateExamples(hArray);

		float result = 91.f;

		MDataHandle outputHandle = block.outputValue( outValue1 );
		outputHandle.set( result );
		block.setClean(plug);
	}

	return MS::kSuccess;
}
コード例 #17
0
ファイル: font.cpp プロジェクト: fr33mind/Belle
Font::Font(const QVariantMap& data, QObject *parent) :
    GameObject(data, parent)
{
    init();
    loadInternal(data);
}
コード例 #18
0
ファイル: kiconloader.cpp プロジェクト: kthxbyte/KDE1-Linaro
QPixmap KIconLoader::reloadIcon ( const QString &name, int w, int h ){
  flush( name );

  return loadInternal( name, w, h );
}
コード例 #19
0
ScriptPromise FontFace::load(ScriptState* scriptState)
{
    loadInternal(scriptState->executionContext());
    return fontStatusPromise(scriptState);
}
コード例 #20
0
ファイル: get_user_input.cpp プロジェクト: fr33mind/Belle
GetUserInput::GetUserInput(const QVariantMap& data, QObject *parent):
    Action(data, parent)
{
    init();
    loadInternal(data);
}
コード例 #21
0
bool Module::load()
{
	XMP_AutoLock lock ( &mLoadingLock, kXMP_WriteLock );
	return loadInternal();
}
コード例 #22
0
void KviDefaultScriptManager::load(const QString & szConfigFile)
{
	KviConfigurationFile cfg(szConfigFile, KviConfigurationFile::Read);
	loadInternal(&cfg);
}
コード例 #23
0
ファイル: wait.cpp プロジェクト: fr33mind/Belle
Wait::Wait(const QVariantMap& data, QObject *parent) :
    Action(data, parent)
{
    init();
    loadInternal(data);
}