Exemplo n.º 1
0
void KeywordIndexMerger::beginMerge(const IndexMergeInfos& mergeFieldInfos)
{
    std::string sSuffix = mergeFieldInfos.getSuffix();
    m_pDictOutStream = getFileSystem()->createFile(
            BarrelDirectory::getFilePath(getFieldSchema()->getName(),
                    DICT_FILEEXT, sSuffix));
    m_pDocOutStream = getFileSystem()->createFile(
            BarrelDirectory::getFilePath(getFieldSchema()->getName(),
                    DOC_POSTING_FILEEXT, sSuffix));
    m_pDictWriter.assign(new DictWriter(m_pDictOutStream));

    m_pDictWriter->reserve(10000); //TODO:
}
Exemplo n.º 2
0
void AbstractHMDSequence::initScene()
{
	auto device = Lib::device;
	auto driver = device->getVideoDriver();
	auto smgr = device->getSceneManager();

	// Create world
	// fps camera node를 쓰면 StereoRenderer+HeadTracking 박살난다
	smgr->addCameraSceneNode();

	// load the quake map
	printf("%i\n", (int)device->getFileSystem()->addFileArchive("ext/irrlicht/media/map-20kdm2.pk3"));
	irr::scene::IAnimatedMesh *q3mesh = smgr->getMesh("20kdm2.bsp");
	irr::scene::ISceneNode *q3levelNode = smgr->addOctreeSceneNode(q3mesh->getMesh(0), 0, -1, 128);
	q3levelNode->setPosition(irr::core::vector3df(-1350,-90,-1400));

	// load a faerie
	irr::scene::IAnimatedMesh *faerie = smgr->getMesh("ext/irrlicht/media/faerie.md2");
	irr::scene::IAnimatedMeshSceneNode *faerieNode = smgr->addAnimatedMeshSceneNode(faerie);
	faerieNode->setMaterialTexture(0, driver->getTexture("ext/irrlicht/media/faerie2.bmp"));
	faerieNode->setMaterialFlag(irr::video::EMF_LIGHTING, false);
	faerieNode->setPosition(irr::core::vector3df(40,190,-1030));
	faerieNode->setRotation(irr::core::vector3df(0,-90,0));
	faerieNode->setMD2Animation(irr::scene::EMAT_SALUTE);

	// load a dwarf
	irr::scene::IAnimatedMesh *dwarf = smgr->getMesh("ext/irrlicht/media/dwarf.x");
	irr::scene::IAnimatedMeshSceneNode *dwarfNode = smgr->addAnimatedMeshSceneNode(dwarf);
	dwarfNode->setPosition(irr::core::vector3df(40,-25,20));
}
Exemplo n.º 3
0
void LocalFileSystem::resolveURLInternal(
    ExecutionContext* context,
    const KURL& fileSystemURL,
    CallbackWrapper* callbacks)
{
    WebFileSystem* fileSystem = getFileSystem();
    if (!fileSystem) {
        fileSystemNotAvailable(context, callbacks);
        return;
    }
    fileSystem->resolveURL(fileSystemURL, callbacks->release());
}
Exemplo n.º 4
0
void LocalFileSystem::deleteFileSystemInternal(
    ExecutionContext* context,
    FileSystemType type,
    CallbackWrapper* callbacks)
{
    WebFileSystem* fileSystem = getFileSystem();
    if (!fileSystem) {
        fileSystemNotAvailable(context, callbacks);
        return;
    }
    KURL storagePartition = KURL(KURL(), context->getSecurityOrigin()->toString());
    fileSystem->deleteFileSystem(storagePartition, static_cast<WebFileSystemType>(type), callbacks->release());
}
Exemplo n.º 5
0
      bool VirtualMountSystem::createPath(const Path& path)
      {
         bool ret = Parent::createPath(path);

         if (ret)
         {
            // make sure the filesystem that owns the path has the path elements
            // in its search table (so that we can open the file, if it is new)
            String root = String::ToLower(path.getRoot());
            FileSystemRef fsRef = getFileSystem(path);

            PathFSMap* rootDict = mMountMap[root];
            if (rootDict)
            {
               // add all directories in the path
               // add the filename

               // Start from the top and work our way down
               Path sub,dir;
               dir.setPath("");
               for (U32 i = 0; i < path.getDirectoryCount(); i++)
               {
                  sub.setPath(path.getDirectory(i));
                  dir.appendPath(sub);

                  Vector<FileSystemRef>& fsList = (*rootDict)[String::ToLower(dir.getPath())];
                  Vector<FileSystemRef>::iterator iter = Find(fsList.begin(), fsList.end(), fsRef);

                  if (iter == fsList.end())
                     fsList.push_back(fsRef);
               }

               // add full file path
               Vector<FileSystemRef>& fsList = (*rootDict)[String::ToLower(path.getFullPath(false))];
               Vector<FileSystemRef>::iterator iter = Find(fsList.begin(), fsList.end(), fsRef);

               if (iter == fsList.end())
                  fsList.push_back(fsRef);
            }
         }

         return ret;
      }
Exemplo n.º 6
0
	virtual void update(UniverseContext& context) override
	{
		PROFILE_FUNCTION();
		float dt;
		++m_fps_frame;
		if (m_fps_frame == 30)
		{
			m_fps = 30.0f / m_fps_timer->tick();
			m_fps_frame = 0;
		}
		dt = m_timer->tick();
		m_last_time_delta = dt;
		for (int i = 0; i < context.m_scenes.size(); ++i)
		{
			context.m_scenes[i]->update(dt);
		}
		m_plugin_manager->update(dt);
		m_input_system.update(dt);
		getFileSystem().updateAsyncTransactions();
	}
Exemplo n.º 7
0
void TxGuiResourceProvider::loadRawDataContainer(const xsgui::String& filename, xsgui::RawDataContainer& output, const xsgui::String& resourceGroup)
{
	char *pChar = xsgui::StringConv::Utf8ToChar((char*)filename.c_str());	
	CStreamHelper pStream = getFileSystem()->open(pChar);
	output.setSize(0);
	output.setData(0);
	if(!pStream.isNull())
	{
		uint size = pStream->getLength();
		uchar *pData = new uchar[size+1];
		pData[size] = 0;
		if(pData)
		{
			pStream->read(pData,size);
			//xsgui::makeMap(pData,size,'LAND');
			output.setData(pData);
			output.setSize(size);
		}
	}
	xsgui::StringConv::DeletePtr(pChar);
}
Exemplo n.º 8
0
	void update(UniverseContext& context) override
	{
		PROFILE_FUNCTION();
		float dt;
		++m_fps_frame;
		if (m_fps_timer->getTimeSinceTick() > 0.5f)
		{
			m_fps = m_fps_frame / m_fps_timer->tick();
			m_fps_frame = 0;
		}
		dt = m_timer->tick();
		m_last_time_delta = dt;
		{
			PROFILE_BLOCK("update scenes");
			for (int i = 0; i < context.m_scenes.size(); ++i)
			{
				context.m_scenes[i]->update(dt);
			}
		}
		m_plugin_manager->update(dt);
		m_input_system->update(dt);
		getFileSystem().updateAsyncTransactions();
	}
Exemplo n.º 9
0
void OBEngine::load(const char *filename)
{
	FGData *inData = getFileSystem()->getFile(filename);
	if ( inData == NULL ) return;

	FGDataReader in;
	in.init(inData);

	m_earthPath.load(in);
	m_marsPath.load(in);
	m_ship.load(in);
	delete inData;

	m_msg.set("Loaded ");
	m_msg.add(filename);

	m_uiMode = UI_INERT;

	// note the angle diff between Mars and Earth
	double angleE = m_earthPath.m_startPos.getAngle();
	double angleM = m_marsPath.m_startPos.getAngle();
	double diff = FGDoubleGeometry::angleDiff(angleE, angleM);
	int a=5;
}
Exemplo n.º 10
0
bool
launchGame()
{
   if (!loadGameInfo(sGameInfo)) {
      gLog->warn("Could not load game info.");
   } else {
      gLog->info("Loaded game info: '{}' - {} v{}", sGameInfo.meta.shortnames[decaf::Language::English], sGameInfo.meta.product_code, sGameInfo.meta.title_version);
   }

   auto rpx = sGameInfo.cos.argstr;

   if (rpx.empty()) {
      rpx = sExecutableName;
   }

   if (rpx.empty()) {
      gLog->error("Could not find game executable to load.");
      return false;
   }

   // Set up the code heap to load stuff to
   initialiseCodeHeap(sGameInfo.cos.max_codesize);

   // Load the application-level kernel binding
   auto coreinitModule = loader::loadRPL("coreinit");

   if (!coreinitModule) {
      gLog->error("Could not load system coreinit library");
      return false;
   }

   // Load the application
   auto appModule = loader::loadRPL(rpx);

   if (!appModule) {
      gLog->error("Could not load {}", rpx);
      return false;
   }

   gLog->debug("Succesfully loaded {}", rpx);
   sUserModule = appModule;

   // Setup title path
   auto fileSystem = getFileSystem();

   // Temporarily set mlc to write so we can create folders
   fileSystem->setPermissions("/vol/storage_mlc01", fs::Permissions::ReadWrite, fs::PermissionFlags::Recursive);

   // Create title folder
   auto titleID = sGameInfo.app.title_id;
   auto titleLo = static_cast<uint32_t>(titleID & 0xffffffff);
   auto titleHi = static_cast<uint32_t>(titleID >> 32);
   auto titlePath = fmt::format("/vol/storage_mlc01/sys/title/{:08x}/{:08x}", titleHi, titleLo);
   auto titleFolder = fileSystem->makeFolder(titlePath);

   // Create Mii database folder
   fileSystem->makeFolder("/vol/storage_mlc01/usr/save/00050010/1004a100/user/common/db");

   // Restore mlc to Read only
   fileSystem->setPermissions("/vol/storage_mlc01", fs::Permissions::Read, fs::PermissionFlags::Recursive);

   // Set title folder to ReadWrite
   fileSystem->setPermissions(titlePath, fs::Permissions::ReadWrite, fs::PermissionFlags::Recursive);

   // Set mlc/usr to ReadWrite
   fileSystem->setPermissions("/vol/storage_mlc01/usr", fs::Permissions::ReadWrite, fs::PermissionFlags::Recursive);

   // We need to set some default stuff up...
   auto core = cpu::this_core::state();
   core->gqr[2].value = 0x40004;
   core->gqr[3].value = 0x50005;
   core->gqr[4].value = 0x60006;
   core->gqr[5].value = 0x70007;

   // Setup coreinit threads
   coreinit::internal::startAlarmCallbackThreads();
   coreinit::internal::startAppIoThreads();
   coreinit::internal::startDefaultCoreThreads();
   coreinit::internal::startDeallocatorThreads();

   // Notify frontend that game has loaded
   decaf::event::onGameLoaded(sGameInfo);

   // Start the entry thread!
   auto gameThreadEntry = coreinitModule->findFuncExport<uint32_t, uint32_t, void*>("GameThreadEntry");
   coreinit::OSRunThread(coreinit::OSGetDefaultThread(1), gameThreadEntry, 0, nullptr);

   return true;
}
Exemplo n.º 11
0
/** 找开文件
@param   pszFileName:文件名
@param   
@return  
*/
bool CCsvReader::Open(const char* pszFileName, bool bEncrypt)
{
	if(pszFileName == NULL)
	{
		return false;
	}

	m_curStrName = pszFileName;

	// 取得文件系统
	FileSystem * pFileSystem = getFileSystem();
	if(pFileSystem == NULL)
	{
		return false;
	}

	// 读取文件
	Stream * pStream = pFileSystem->open(pszFileName);
	if(pStream == NULL)
	{
		return false;
	}

	// 解密文件
	char * pFileBuffer = NULL;
	MemoryStream memorystream;
	if(bEncrypt)
	{
		int nFileLength = pStream->getLength();
		pFileBuffer = new char [nFileLength + 1];
		if(!pStream->read(pFileBuffer, nFileLength))
		{
			return false;
		}
		pStream->close();
		pStream->release();

		if(!makeMap((uchar *)pFileBuffer, nFileLength, 'LAND'))
		{
			return false;
		}

		memorystream.attach((uchar *)pFileBuffer, nFileLength);
		pStream = &memorystream;
	}
	
	// 解析
	if(!_Open(pStream))
	{
		if(pFileBuffer != NULL)
		{
			delete [] pFileBuffer;
			pFileBuffer = NULL;
		}
		
		// 关闭文件
		pStream->close();
		pStream->release();
		return false;
	}
	// 关闭文件
	pStream->close();
	
	pStream->release();
	if(pFileBuffer != NULL)
	{
		delete [] pFileBuffer;
		pFileBuffer = NULL;
	}
	return true;
}
Exemplo n.º 12
0
void OBEngine::onKeyReleased(int key)
{
	m_msg.set("");

	if ( key == 'V' )
	{
		m_bShowVenus = !m_bShowVenus;
	}

	if ( key == 16 ) 
	{
		m_hoverPathPointIdx = -1;
		m_hoverAccelPoint = NULL;
		m_uiMode = UI_INERT;
	}

	if ( (key==8) || (key==46) )
	{
		// delete/backspace
		if ( m_hoverAccelPoint != NULL )
		{
			m_ship.removeAccelerationPoint(m_hoverAccelPoint);
			m_ship.calcPoints();
			m_hoverAccelPoint = NULL;
		}
	}

	if ( key=='0' )
	{
		// kill the thrust for this point
		if ( m_hoverAccelPoint != NULL )
		{
			m_hoverAccelPoint->m_mag = 0.0;
			m_ship.calcPoints();
			m_hoverAccelPoint = NULL;
		}
	}

	if ( key=='1' )
	{
		// max out the thrust for this point
		if ( m_hoverAccelPoint != NULL )
		{
			m_hoverAccelPoint->m_mag = PATH_ACCELERATION;
			m_ship.calcPoints();
			m_hoverAccelPoint = NULL;
		}
	}
	if ( key == 'X' )
	{
		if ( m_hoverAccelPoint != NULL )
		{
			if ( m_hoverAccelPoint->m_type == ACCTYPE_NORMAL )
			{
				m_hoverAccelPoint->m_type = ACCTYPE_STOPTRACE;
			}
			else if ( m_hoverAccelPoint->m_type == ACCTYPE_STOPTRACE )
			{
				m_hoverAccelPoint->m_type = ACCTYPE_NORMAL;
			}
			m_ship.calcPoints();
			m_hoverAccelPoint = NULL;
		}
	}
	if ( key == 'R' )
	{
		if ( m_hoverAccelPoint != NULL )
		{
			if ( m_hoverAccelPoint->m_type == ACCTYPE_NORMAL )
			{
				m_hoverAccelPoint->m_type = ACCTYPE_REDIRECT;
			}
			else if ( m_hoverAccelPoint->m_type == ACCTYPE_REDIRECT )
			{
				m_hoverAccelPoint->m_type = ACCTYPE_NORMAL;
			}
			m_ship.calcPoints();
			m_hoverAccelPoint = NULL;
		}
	}

	if ( key == ' ' )
	{
		// toggle playback
		if ( m_uiMode == UI_INERT )
		{
			m_playbackStepIdx = 0;
			m_playbackTimer.start(PLAYBACK_STEP_TIME);
			m_uiMode = UI_PLAYBACK;
		}
		else
		{
			// halt playback
			m_uiMode = UI_INERT;
		}
	}

	if ( key == 116 )
	{
		// save
		FGDataWriter out;
		out.init();

		m_earthPath.save(out);
		m_marsPath.save(out);
		m_ship.save(out);

		FGData *toSave = out.getData();
		getFileSystem()->putFile("path.sav", toSave);
		delete toSave;

		m_msg.set("Saved");
	}
	if ( key == 117 )
	{
		// load
		load("path.sav");
	}
}