void plSoundBuffer::Read( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Read( s, mgr ); s->ReadLE( &fFlags ); s->ReadLE( &fDataLength ); fFileName = s->ReadSafeString(); s->ReadLE( &fHeader.fFormatTag ); s->ReadLE( &fHeader.fNumChannels ); s->ReadLE( &fHeader.fNumSamplesPerSec ); s->ReadLE( &fHeader.fAvgBytesPerSec ); s->ReadLE( &fHeader.fBlockAlign ); s->ReadLE( &fHeader.fBitsPerSample ); fValid = false; if( !( fFlags & kIsExternal ) ) { fData = new uint8_t[ fDataLength ]; if( fData == nil ) fFlags |= kIsExternal; else { s->Read( fDataLength, fData ); fValid = true; SetLoaded(true); } } else { fData = nil; // fValid = EnsureInternal(); fValid = true; } }
/** otgUnloadLdd */ void COtgRoot::otgUnloadLdd() { // code to unload the OTG ldd driver TInt err (User::FreeLogicalDevice(KOTGDeviceInterfaceDriverName)); if (err != KErrNone) { OstTrace1(TRACE_WARNING, COTGROOT_OTGUNLOADLDD, "[WARNING failed %d]", err); } SetLoaded(EFalse); }
void ModelStatic::Purge() { for ( unsigned int i=0; i<m_surfaces.size(); i++) { delete m_surfaces[i].geom->m_indices; delete m_surfaces[i].geom->m_verts; delete m_surfaces[i].geom; } m_surfaces.clear(); SetLoaded( false ); SetDefaulted( false ); }
/** otgLoadLdd */ TInt COtgRoot::otgLoadLdd() { if(gVerboseOutput) { OstTraceFunctionEntry0(COTGROOT_OTGLOADLDD); } LOG_VERBOSE2(_L("Load driver: %S\n"), &KOTGDeviceInterfaceDriverName); if(gVerboseOutput) { OstTraceExt1(TRACE_VERBOSE, COTGROOT_OTGLOADLDD_DUP01, "Load driver: %S\n", KOTGDeviceInterfaceDriverName); } if (!LddLoaded()) { // load ldd device drivers (load otg only, it will load the needed stuff for us) TInt err(User::LoadLogicalDevice(KOTGDeviceInterfaceDriverName)); if ( (err != KErrNone) && (err != KErrAlreadyExists) ) { test.Printf(_L("<Error %d> Unable to load driver: %S\n"), err, &KOTGDeviceInterfaceDriverName); OstTraceExt2(TRACE_NORMAL, COTGROOT_OTGLOADLDD_DUP02, "<Error %d> Unable to load driver: %S\n", err, KOTGDeviceInterfaceDriverName); SetLoaded(EFalse); return(err); } else { LOG_VERBOSE2(_L("Loaded driver: '%S' OK\n"), &KOTGDeviceInterfaceDriverName); if(gVerboseOutput) { OstTraceExt1(TRACE_VERBOSE, COTGROOT_OTGLOADLDD_DUP03, "Loaded driver: '%S' OK\n", KOTGDeviceInterfaceDriverName); } SetLoaded(ETrue); } } return(KErrNone); }
void Module::UnLoad() { if(!IsLoaded()) return; if(m_unload_func) m_unload_func(); for(u32 i=0; i<m_funcs_list.size(); ++i) { Emu.GetModuleManager().UnloadFunc(m_funcs_list[i]->id); } SetLoaded(false); }
void Module::Load() { if(IsLoaded()) return; if(m_load_func) m_load_func(); for(u32 i=0; i<m_funcs_list.size(); ++i) { Emu.GetModuleManager().AddFunc(m_funcs_list[i]); } SetLoaded(true); }
void CFileListManager::OnMousePressed( vgui::MouseCode code ) { // determine where we were pressed int x, y, row, column; vgui::input()->GetCursorPos( x, y ); GetCellAtPos( x, y, row, column ); if ( code == MOUSE_LEFT ) { bool bIsFakeToggleButton = column == CI_LOADED; if ( bIsFakeToggleButton && row >= 0 && row < GetItemCount() ) { int itemID = GetItemIDFromRow( row ); KeyValues *kv = GetItem( itemID ); const char *pStr = kv->GetString( GetKey( ( ColumnIndex_t )column ), "" ); Assert( *pStr == 'Y' || *pStr == 'N' ); bool bSet = *pStr == 'N'; // bSet is the NEW state, not the old one kv->SetString( GetKey( ( ColumnIndex_t )column ), bSet ? "Y" : "N" ); SetLoaded( ( DmFileId_t )GetItemUserData( itemID ), bSet ); // get the key focus RequestFocus(); return; } } else if ( code == MOUSE_RIGHT ) { int itemID = -1; if ( row >= 0 && row < GetItemCount() ) { itemID = GetItemIDFromRow( row ); if ( !IsItemSelected( itemID ) ) { SetSingleSelectedItem( itemID ); } } KeyValues *kv = new KeyValues( "OpenContextMenu", "itemID", itemID ); OnOpenContextMenu( kv ); kv->deleteThis(); return; } BaseClass::OnMousePressed( code ); }
void tSoundLoader<T>::Start() { if ( NULL != mSndMngr ) { cObjectLoader::Start(); if ( SND_LT_PATH == mLoadType ) LoadFromPath(); else if ( SND_LT_MEM == mLoadType ) LoadFromMemory(); else if ( SND_LT_PACK == mLoadType ) LoadFromPack(); else if ( SND_LT_SAMPLES == mLoadType ) LoadFromSamples(); SetLoaded(); } }
void CFileListManager::OnUnloadFiles( KeyValues *pParams ) { CNotifyScopeGuard notify( "CFileListManager::OnUnloadFiles", NOTIFY_SOURCE_FILE_LIST_MANAGER, NOTIFY_SETDIRTYFLAG ); int nSelected = GetSelectedItemsCount(); for ( int i = 0; i < nSelected; ++i ) { int itemId = GetSelectedItem( i ); DmFileId_t fileid = ( DmFileId_t )GetItemUserData( itemId ); if ( g_pDataModel->IsFileLoaded( fileid ) ) { SetLoaded( fileid, false ); } } Refresh(); }
void DObject::InitMembers( void ) { m_pd3dDevice = NULL; // m_pe3dConsole = NULL; m_lcLocation.Init(); SetPoolMode( D3DPOOL_MANAGED ); m_iPitchMax = DR_PITCHMAX; m_iPitchMin = DR_PITCHMIN; m_iYawMax = Rad2Angle(PI_TWICE); m_iYawMin = Rad2Angle(-PI_TWICE); SetLoaded( false ); }
void cTextureFontLoader::Update() { if ( !mLoaded ) { if ( !mTexLoaded ) { mTexLoader->Load(); mTexLoader->Update(); mTexLoaded = mTexLoader->IsLoaded(); } if ( mTexLoaded && !mFontLoaded ) { LoadFont(); } if ( mFontLoaded ) { SetLoaded(); } } }
//// ForceNonInternal //////////////////////////////////////////////////////// // destroys loaded, and frees data void plSoundBuffer::UnLoad( void ) { if(fLoaded) int i = 0; if(fLoading) return; if(fReader) fReader->Close(); delete fReader; fReader = nil; delete [] fData; fData = nil; SetLoaded(false); fFlags |= kIsExternal; }
void CPropTask::Init() { if(!m_bAutomationMode) { m_sAlias = GetDialog()->GetAlias(); m_sUsrText[0] = GetDialog()->GetText1(); m_sUsrText[1] = GetDialog()->GetText2(); m_sUsrText[2] = GetDialog()->GetText3(); m_sHelpUrl = GetDialog()->GetHelpUrl(); m_sUrl = GetDialog()->GetUrl(); m_sInterval = GetDialog()->GetInterval(); m_sPriority = GetDialog()->GetPriority(); m_sIOSync = GetDialog()->GetIoSync(); m_sEvent = GetDialog()->GetEventString(); m_sWatchdog = GetDialog()->GetWatchdog(); SetAutoStart(GetDialog()->GetAutoStart()); SetLoaded(GetDialog()->GetLoaded()); // NFTASKHANDLING 19.05.05 SIS } }
// // Unload the current DSMPlugin from memory // bool CDSMPlugin::UnloadPlugin(void) { // TODO: Log events // Force the DSMplugin to free the buffers it allocated if (m_pTransBuffer != NULL) (*m_PFreeBuffer)(m_pTransBuffer); if (m_pRestBuffer != NULL) (*m_PFreeBuffer)(m_pRestBuffer); m_pTransBuffer = NULL; m_pRestBuffer = NULL; SetLoaded(false); if ((*m_PShutdown)()) { bool fFreed = false; fFreed = (FALSE != FreeLibrary(m_hPDll)); if (*m_szDllName) DeleteFile(m_szDllName); return fFreed; } else return false; }
/* this class wraps all OTGDI calls as well to simplify calling and normalising object access. - it has no base-class hence we can use multiple-inheritance */ COtgRoot::COtgRoot() { iOptActive = EFalse; SetLoaded(EFalse); }
void ComponentData::Load() { SetLoaded(true); }
// // Load the given DSMplugin and map its functions // bool CDSMPlugin::LoadPlugin(char* szPlugin, bool fAllowMulti) { // sf@2003 - Multi dll trick // I really don't like doing this kind of dirty workaround but I have no time to do // better for now. Used only by a listening viewer. // Create a numbered temporary copy of the original plugin dll and load it (viewer only, for now) if (fAllowMulti) { bool fDllCopyCreated = false; int i = 1; char szDllCopyName[MAX_PATH]; char szCurrentDir[MAX_PATH]; char szCurrentDir_szPlugin[MAX_PATH]; char szCurrentDir_szDllCopyName[MAX_PATH]; while (!fDllCopyCreated) { strcpy(szDllCopyName, szPlugin); szDllCopyName[strlen(szPlugin) - 4] = '\0'; //remove the ".dsm" extension sprintf(szDllCopyName, "%s-tmp.d%d", szDllCopyName, i++); fDllCopyCreated = (FALSE != CopyFile(szPlugin, szDllCopyName, false)); // Note: Let's be really dirty; Overwrite if it's possible only (dll not loaded). // This way if for some reason (abnormal process termination) the dll wasn't previously // normally deleted we overwrite/clean it with the new one at the same time. strcpy (szCurrentDir_szDllCopyName,szDllCopyName); DWORD error=GetLastError(); if (error==2) { if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH)) { char* p = strrchr(szCurrentDir, '\\'); *p = '\0'; } strcpy (szCurrentDir_szPlugin,szCurrentDir); strcat (szCurrentDir_szPlugin,"\\"); strcat (szCurrentDir_szPlugin,szPlugin); strcpy (szCurrentDir_szDllCopyName,szCurrentDir); strcat (szCurrentDir_szDllCopyName,"\\"); strcat (szCurrentDir_szDllCopyName,szDllCopyName); fDllCopyCreated = (FALSE != CopyFile(szCurrentDir_szPlugin, szCurrentDir_szDllCopyName, false)); } if (i > 99) break; // Just in case... } strcpy(m_szDllName, szDllCopyName); m_hPDll = LoadLibrary(m_szDllName); } else // Use the original plugin dll { ZeroMemory(m_szDllName, strlen(m_szDllName)); m_hPDll = LoadLibrary(szPlugin); //Try current PATH if (m_hPDll==NULL) { char szCurrentDir[MAX_PATH]; char szCurrentDir_szPlugin[MAX_PATH]; if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH)) { char* p = strrchr(szCurrentDir, '\\'); *p = '\0'; } strcpy (szCurrentDir_szPlugin,szCurrentDir); strcat (szCurrentDir_szPlugin,"\\"); strcat (szCurrentDir_szPlugin,szPlugin); m_hPDll = LoadLibrary(szCurrentDir_szPlugin); } } if (m_hPDll == NULL) return false; m_PDescription = (DESCRIPTION) GetProcAddress(m_hPDll, "Description"); m_PStartup = (STARTUP) GetProcAddress(m_hPDll, "Startup"); m_PShutdown = (SHUTDOWN) GetProcAddress(m_hPDll, "Shutdown"); m_PSetParams = (SETPARAMS) GetProcAddress(m_hPDll, "SetParams"); m_PGetParams = (GETPARAMS) GetProcAddress(m_hPDll, "GetParams"); m_PTransformBuffer = (TRANSFORMBUFFER) GetProcAddress(m_hPDll, "TransformBuffer"); m_PRestoreBuffer = (RESTOREBUFFER) GetProcAddress(m_hPDll, "RestoreBuffer"); m_PFreeBuffer = (FREEBUFFER) GetProcAddress(m_hPDll, "FreeBuffer"); m_PReset = (RESET) GetProcAddress(m_hPDll, "Reset"); if (m_PStartup == NULL || m_PShutdown == NULL || m_PSetParams == NULL || m_PGetParams == NULL || m_PTransformBuffer == NULL || m_PRestoreBuffer == NULL || m_PFreeBuffer == NULL) { FreeLibrary(m_hPDll); if (*m_szDllName) DeleteFile(m_szDllName); return false; } // return ((*m_PStartup)()); SetLoaded(true); return true; }