LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic, float *fSamplingRate) { // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku AnsiString file; if (Dynamic) { // próba wczytania z katalogu pojazdu file = Global::asCurrentDynamicPath + AnsiString(Name); if (FileExists(file)) Name = file.c_str(); // nowa nazwa else Dynamic = false; // wczytanie z "sounds/" } TSoundContainer *Next = First; DWORD dwStatus; for (int i = 0; i < Count; i++) { if (strcmp(Name, Next->Name) == 0) { if (fSamplingRate) *fSamplingRate = Next->fSamplingRate; // czêstotliwoœæ return (Next->GetUnique(pDS)); // DSBuffers. /* Next->pDSBuffer[Next->Oldest]->Stop(); Next->pDSBuffer[Next->Oldest]->SetCurrentPosition(0); if (Next->Oldest<Next->Concurrent-1) { Next->Oldest++; return (Next->pDSBuffer[Next->Oldest-1]); } else { Next->Oldest= 0; return (Next->pDSBuffer[Next->Concurrent-1]); }; /* for (int j=0; j<Next->Concurrent; j++) { Next->pDSBuffer[j]->GetStatus(&dwStatus); if ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING) return (Next->pDSBuffer[j]); } */ } else Next = Next->Next; }; if (Dynamic) // wczytanie z katalogu pojazdu Next = LoadFromFile("", Name, 1); else Next = LoadFromFile(Directory, Name, 1); if (Next) { // if (fSamplingRate) *fSamplingRate = Next->fSamplingRate; // czêstotliwoœæ return Next->GetUnique(pDS); } ErrorLog("Missed sound: " + AnsiString(Name)); return (NULL); };
Shader::Shader(std::string vertexFile, std::string fragmentFile) : Shader() { mVertex =glCreateShader(GL_VERTEX_SHADER); mFragment =glCreateShader(GL_FRAGMENT_SHADER); mProgram =glCreateProgram(); LoadFromFile(FragmentShader, fragmentFile); LoadFromFile(VertexShader, vertexFile); }
CMapzoneData::CMapzoneData(const char *szMapName) { if (!LoadFromFile(szMapName)) { Log("Unable to find map zones! Trying to create them...\n"); saveZonFile(szMapName);//try making the zon file if the map has the entities LoadFromFile(szMapName); } }
/*! Loads a shader program from a file and creates the related program @param vertex_file - the file which stores the vertex shader code @param fragment_file - the file which stores the fragment shader code @return - Gluint of the shader program */ GLuint LoadAndCreateShaderProgram(string vertex_file, string fragment_file) { string vertex_source = LoadFromFile(vertex_file); string fragment_source= LoadFromFile(fragment_file); // create and return the pgoram. return CreateShaderProgram(vertex_source, fragment_source); }
CFavouritesService::CFavouritesService(std::string userDataFolder) : m_userDataFolder(std::move(userDataFolder)) { CFileItemList items; std::string favourites = "special://xbmc/system/favourites.xml"; if(XFILE::CFile::Exists(favourites)) LoadFromFile(favourites, m_favourites); else CLog::Log(LOGDEBUG, "CFavourites::Load - no system favourites found, skipping"); favourites = URIUtils::AddFileToFolder(m_userDataFolder, "favourites.xml"); if(XFILE::CFile::Exists(favourites)) LoadFromFile(favourites, m_favourites); else CLog::Log(LOGDEBUG, "CFavourites::Load - no userdata favourites found, skipping"); }
bool cPlayer::LoadFromDisk(cWorldPtr & a_World) { LoadRank(); // Load from the UUID file: if (LoadFromFile(GetUUIDFileName(m_UUID), a_World)) { return true; } // Load from the offline UUID file, if allowed: AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName()); const char * OfflineUsage = " (unused)"; if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData()) { OfflineUsage = ""; if (LoadFromFile(GetUUIDFileName(OfflineUUID), a_World)) { return true; } } // Load from the old-style name-based file, if allowed: if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData()) { AString OldStyleFileName = Printf("players/%s.json", GetName().c_str()); if (LoadFromFile(OldStyleFileName, a_World)) { // Save in new format and remove the old file if (SaveToDisk()) { cFile::Delete(OldStyleFileName); } return true; } } // None of the files loaded successfully LOG("Player data file not found for %s (%s, offline %s%s), will be reset to defaults.", GetName().c_str(), m_UUID.c_str(), OfflineUUID.c_str(), OfflineUsage ); if (a_World == NULL) { a_World = cRoot::Get()->GetDefaultWorld(); } return false; }
NameGenerator::NameGenerator() { //ctor LoadFromFile("data/letter_chances.txt"); std::string key, value; for(auto it = m_values.begin(); it != m_values.end(); it++) { key = it->first; value = it->second; try { if(key.size() == 1) { m_first[key.at(0)] = std::stof(value); } if(key.size() == 2) { m_second[key.at(0)][key.at(1)] = std::stof(value); } if(key.size() == 3) { m_third[key.at(0)][key.at(1)][key.at(2)] = std::stof(value); } } catch(...) { std::cout << "Could not convert " << value << std::endl; } } }
void Ide::LoadLastMain() { bool editor = IsEditorMode(); LoadFromFile(THISBACK(SerializeLastMain), ConfigFile("lastmain.cfg")); if(editor) main <<= Null; }
int main() { MyTree<int>* root = CreateEmptyTree<int>(); LoadFromFile(root, "C:\\input.txt"); Square(root); SaveToFile(root, "C:\\out.txt"); DeleteTree(root); }
bool pawsConfigPopup::Initialize() { if (!LoadFromFile("configpopup.xml")) return false; return true; }
/* constructor ----------- if "szPath" is NULL then we create an untitled document and default object the type is "doctypeNew" if "lhDoc" is NULL and "doctypeEmbedded" if "lhDoc" is non NULL if "szPath" is non NULL we create a document of type "doctypeFromFile" and initialize it from file "szPath" if "lhDoc" is NULL then we call OleRegisterServerDoc() otherwise we just use "lhDoc" as our registration handle */ TOLEDocument::TOLEDocument (TOLEServer &server, LHSERVERDOC lhDoc, LPSTR szPath, BOOL dirty) { szName = 0; lpvtbl = &_vtbl; fRelease = FALSE; fDirty = dirty; server.pDocument = this; // // since we only have one object we can create it now... // pObject = new TOLEObject; if (szPath) LoadFromFile (szPath); else { SetDocumentName (UNNAMED_DOC); type = lhDoc ? doctypeEmbedded : doctypeNew; } if (lhDoc != 0) this->lhDoc = lhDoc; // use registration handle we were given else OleRegisterServerDoc (server.lhServer, szName, this, (LHSERVERDOC FAR *) &this->lhDoc); }
Bitmap::Bitmap(const WCHAR *path) { data = NULL; xOffsets = NULL; yOffsets = NULL; LoadFromFile(path); }
bool pawsConfigChatFilter::Initialize() { if (!LoadFromFile("configchatfilter.xml")) return false; return true; }
//----------------------------------------------------------------------------------------------- ResourceStream::ResourceStream( const std::string& fileToOpenForReading, bool failSilently ) : m_jazzPath( fileToOpenForReading ) , m_startOfData( NULL ) , m_currentReadOffset( 0 ) , m_dataBytesAvailable( 0 ) , m_capacity( 0 ) , m_internalFormat( RESOURCE_STREAM_FORMAT_INVALID ) , m_currentIndentationDepth( 0 ) , m_consecutiveNewLineCount( 1 ) , m_justWroteBlockBegin( false ) , m_justWroteBlockEnd( false ) , m_integrity( RESOURCE_STREAM_INTEGRITY_VALID ) { // DEBUGGING - { int q = 5; } //ConsolePrintf( "ResourceStream is being constructed from JazzPath...\n" ); // { int q = 5; } //ConsolePrintf( "ResourceSteam being contructed from JazzPath, relative \"%s\" to marker #%d, resolved \"%s\".\n", fileToOpenForReading.GetRelativePathAsString().c_str(), fileToOpenForReading.GetFileFolderID(), fileToOpenForReading..c_str() ); LoadFromFile( fileToOpenForReading ); // { int q = 5; } //ConsolePrintf( "Finished loading ResourceStream from file \"%s\"; resource stream contains %d bytes (capacity=%d).\n", m_jazzPath..c_str(), m_dataBytesAvailable, m_capacity ); if( IsValid() ) { { int q = 5; } //ConsolePrintf( Rgba::GREY, "Loaded ResourceStream from file \"%s\"; resource stream contains %d bytes (capacity=%d).\n", m_jazzPath.c_str(), m_dataBytesAvailable, m_capacity ); } else if( !failSilently ) { { int q = 5; } //ConsolePrintf( Rgba::RED, "FAILED TO LOAD ResourceStream from file \"%s\".\n", m_jazzPath..c_str() ); } }
bool pawsConfigSound::Initialize() { if ( ! LoadFromFile("configsound.xml")) return false; return true; }
INT CLcMdl2D::Create(void* p1, void* p2, void* p3, void* p4) { char* sFile = (char*)p1; if(FAILED(LoadFromFile(sFile))) return -1; char fname[128]={0}; char fext [ 32]={0}; LcStr_SplitPath(sFile, NULL, NULL, fname, fext); sprintf(m_sName, "%s%s", fname, fext); D3DXVECTOR3 vcMin; D3DXVECTOR3 vcMax; // Set Max and Min vertex Position D3DXComputeBoundingBox( (D3DXVECTOR3*)m_pVtx , 4 , D3DXGetFVFVertexSize(VtxDUV1::FVF) , &vcMin , &vcMax); m_BndInf.Set(vcMin, vcMax); return 0; }
bool SysConf::Reload() { std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename; LoadFromFile(filename); return m_IsValid; }
int SImgX_STB::LoadFromFile( LPCSTR pszFileName ) { wchar_t wszFileName[MAX_PATH+1]; MultiByteToWideChar(CP_ACP,0,pszFileName,-1,wszFileName,MAX_PATH); if(GetLastError()==ERROR_INSUFFICIENT_BUFFER) return 0; return LoadFromFile(wszFileName); }
bool CEpgDataLoader::Load(LPCTSTR pszFolder,HANDLE hAbortEvent) { if (pszFolder==NULL) return false; FILETIME ftCurrent; TCHAR szFileMask[MAX_PATH]; HANDLE hFind; WIN32_FIND_DATA fd; ::GetSystemTimeAsFileTime(&ftCurrent); ::PathCombine(szFileMask,pszFolder,TEXT("*_epg.dat")); hFind=::FindFirstFile(szFileMask,&fd); if (hFind==INVALID_HANDLE_VALUE) return false; do { if ((fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)==0 && ftCurrent-fd.ftLastWriteTime<FILETIME_HOUR*24*14 && ::lstrlen(pszFolder)+1+::lstrlen(fd.cFileName)<MAX_PATH) { TCHAR szFilePath[MAX_PATH]; ::PathCombine(szFilePath,pszFolder,fd.cFileName); LoadFromFile(szFilePath); if (hAbortEvent!=NULL && ::WaitForSingleObject(hAbortEvent,0)==WAIT_OBJECT_0) break; } } while (::FindNextFile(hFind,&fd)); ::FindClose(hFind); return true; }
int main(int argc, char* argv[]) { LoadFromFile(); printf("\n\n"); LoadFromMemory(); return 0; }
bool pawsConfigKeys::CreateTree() { pawsTreeNode * root; /**************** CS_ASSERT(tree == NULL); tree = new pawsTree(); tree->SetRelativeFrame(0, 0,parent->GetDefaultFrame().Width(),parent->GetDefaultFrame().Height()); tree->SetScrollBars(false, true); tree->SetTreeLayout(new pawsStdTreeLayout(tree, 5, 20)); tree->SetTreeDecorator(new pawsStdTreeDecorator(tree, graphics2D, 0x0000ff, 0x00ffff, 13)); AddChild(tree); if ( !tree->LoadFromFile("configkeys.xml") ) return false; *********************/ if (!LoadFromFile("configkeys.xml") ) return false; tree = dynamic_cast<pawsTree *>(children[0]); tree->SetRelativeFrameSize(parent->GetScreenFrame().Width()-20, parent->GetScreenFrame().Height()-20); root = tree->GetRoot(); if (root != NULL) CreateTreeWidgets(root); tree->SetScrollBars(false,true); return true; }
void CommunicationVoiceLibrary::ScanFolder(const char* folderName, bool recursing) { string folder(PathUtil::MakeGamePath(string(folderName))); folder += "/"; string searchString(folder + "*.xml"); _finddata_t fd; intptr_t handle = 0; ICryPak *pPak = gEnv->pCryPak; handle = pPak->FindFirst(searchString.c_str(), &fd); if (handle > -1) { do { if (!strcmp(fd.name, ".") || !strcmp(fd.name, "..")) continue; if (fd.attrib & _A_SUBDIR) ScanFolder(folder + fd.name, true); else LoadFromFile(folder + fd.name); } while (pPak->FindNext(handle, &fd) >= 0); pPak->FindClose(handle); } if (!recursing) stl::push_back_unique(m_folderNames, folderName); }
bool pawsConfigCamera::CreateTree() { pawsTreeNode * root; /*tree = new pawsTree(); tree->MoveTo(screenFrame.xmin, screenFrame.ymin); tree->SetSize(screenFrame.Width(), screenFrame.Height()); tree->SetScrollBars(false, true); tree->SetTreeLayout(new pawsStdTreeLayout(tree, 5, 20)); tree->SetTreeDecorator(new pawsStdTreeDecorator(tree, graphics2D, 0x0000ff, 0x00ffff, 13)); AddChild(tree); */ if (!LoadFromFile("configcamera.xml")) return false; tree = dynamic_cast<pawsTree *>(children[0]); tree->SetRelativeFrameSize(parent->ScreenFrame().Width()-20, parent->ScreenFrame().Height()-20); root = tree->GetRoot(); if (root != NULL) CreateTreeWidgets(root); tree->SetScrollBars(false,true); return true; }
bool LuaState::ExecuteFromFile(const String& filePath, int errorHandler) { if (!LoadFromFile(filePath)) return false; return CallWithHandler(errorHandler, 0); }
void CClipVolumeProxy::SerializeXML(XmlNodeRef &entityNodeXML, bool loading) { if(loading) { LOADING_TIME_PROFILE_SECTION; if(XmlNodeRef pVolumeNode = entityNodeXML->findChild( "ClipVolume" )) { const char* szFileName = NULL; if(pVolumeNode->getAttr("GeometryFileName",&szFileName)) { // replace %level% by level path char szFilePath[_MAX_PATH]; const int nAliasNameLen = sizeof("%level%")-1; cry_strcpy(szFilePath, gEnv->p3DEngine->GetLevelFilePath(szFileName+nAliasNameLen)); if(m_pEntity && LoadFromFile(szFilePath)) gEnv->p3DEngine->UpdateClipVolume(m_pClipVolume, m_pRenderMesh, m_pBspTree, m_pEntity->GetWorldTM(), !m_pEntity->IsHidden(), m_pEntity->GetName()); } } } else { XmlNodeRef volumeNode = entityNodeXML->newChild( "ClipVolume" ); volumeNode->setAttr( "GeometryFileName", m_GeometryFileName ); } }
Texture::Texture( const std::string& texturePath ) : m_width(0), m_height(0), m_texels(nullptr), m_channels(0) { REQUIRES( !texturePath.empty() ); m_filePath = texturePath; LoadFromFile( m_filePath ); }
int LoadHZData(const TCHAR *hz_data_name) { int file_length; assert(hz_data_name); if (share_segment->hz_data_loaded) return 1; file_length = GetFileLength(hz_data_name); if (file_length <= 0) return 0; hz_data = AllocateSharedMemory(hz_data_share_name, file_length); if (!hz_data) return 0; if ((file_length = LoadFromFile(hz_data_name, hz_data, file_length)) == -1) { FreeSharedMemory(hz_data_share_name, hz_data); Log(LOG_ID, L"汉字信息表文件打开失败。name=%s", hz_data_name); return 0; } if (!file_length) return 0; share_segment->hz_data_loaded = 1; return 1; }
void Ide::SetMain(const String& package) { FlushFile(); SaveWorkspace(); transferfilecache.Clear(); main = package; export_dir = GetHomeDirFile(main); mainconfigname.Clear(); mainconfigparam.Clear(); ScanWorkspace(); LoadFromFile(THISBACK(SerializeWorkspace), WorkspaceFile()); editorsplit.Zoom(0); UpdateFormat(); String e = editfile; editfile.Clear(); MakeTitle(); MakeIcon(); SyncMainConfigList(); AdjustMainConfig(); SyncBuildMode(); SetHdependDirs(); SetBar(); HideBottom(); SyncUsc(); NewCodeBase(); if(IsNull(e)) e = GetFirstFile(); EditFile(e); }
bool pawsConfigChatBubbles::Initialize() { if ( ! LoadFromFile("configchatbubbles.xml")) return false; return true; }
void Settings::LoadFromFile() { // setlocale( LC_ALL, ".ACP" ); //vs9 bag std::ifstream ifs("settings.txt"); if (!ifs.is_open()) return; LoadFromFile(ifs, loadFromTextFile); }