bool CAnimateProduct::Load() { if (IsLoaded()) return true; if (m_eLoadType == ESharedData) return false; if (m_pTmpl == NULL) { m_pReader = new CSubThreadDataReader(); m_pReader->LoadAnimPlist(m_strPlistFileName); m_pReader->LoadTexImage(m_strSFAtlasFile); m_pReader->LoadPlist(m_strSFPlistFile); //cocos2d::AnimationCache::getInstance()->addAnimationsWithFile(m_strPlistFileName); //m_pAnimation = cocos2d::AnimationCache::getInstance()->getAnimation(m_strName); } else if (m_pTmpl->GetAnimation()) m_pAnimation = m_pTmpl->GetAnimation()->clone(); else if (!m_pTmpl->HaveSubThreadReader()) return false; CBaseProduct::Load(); return true; }
bool PMISRecord::VisitFormIDs(FormIDOp &op) { if(!IsLoaded()) return false; op.Accept(NAME.value); if(XEZN.IsLoaded()) op.Accept(XEZN.value); if(Patrol.IsLoaded()) { op.Accept(Patrol->INAM.value); for(uint32_t x = 0; x < Patrol->SCR_.value.size(); x++) if(Patrol->SCR_.value[x]->isSCRO) op.Accept(Patrol->SCR_.value[x]->reference); op.Accept(Patrol->TNAM.value); } if(Ownership.IsLoaded()) op.Accept(Ownership->XOWN.value); for(uint32_t x = 0; x < XDCR.value.size(); x++) op.Accept(XDCR.value[x]->reference); if(XLKR.IsLoaded()) op.Accept(XLKR.value); if(ActivateParents.IsLoaded()) for(uint32_t x = 0; x < ActivateParents->XAPR.value.size(); x++) op.Accept(ActivateParents->XAPR.value[x]->reference); if(XESP.IsLoaded()) op.Accept(XESP->parent); if(XEMI.IsLoaded()) op.Accept(XEMI.value); if(XMBR.IsLoaded()) op.Accept(XMBR.value); for(uint32_t x = 0; x < XPWR.value.size(); x++) op.Accept(XPWR.value[x]->reference); return op.Stop(); }
/* ================ idAF::RemoveBindConstraints ================ */ void idAF::RemoveBindConstraints() { const idKeyValue *kv; if ( !IsLoaded() ) { return; } const idDict &args = self->spawnArgs; idStr name; kv = args.MatchPrefix( "bindConstraint ", NULL ); while ( kv ) { name = kv->GetKey(); name.Strip( "bindConstraint " ); if ( physicsObj.GetConstraint( name ) ) { physicsObj.DeleteConstraint( name ); } kv = args.MatchPrefix( "bindConstraint ", kv ); } hasBindConstraints = false; }
bool NOTERecord::VisitFormIDs(FormIDOp &op) { if(!IsLoaded()) return false; if(MODL.IsLoaded()) { for(UINT32 x = 0; x < MODL->Textures.MODS.size(); x++) op.Accept(MODL->Textures.MODS[x]->texture); } if(YNAM.IsLoaded()) op.Accept(YNAM.value); if(ZNAM.IsLoaded()) op.Accept(ZNAM.value); for(UINT32 x = 0; x < ONAM.value.size(); x++) op.Accept(ONAM.value[x]); if(IsVoice() && TNAMAlt.IsLoaded()) op.Accept(TNAMAlt.value); if(SNAM.IsLoaded()) op.Accept(SNAM.value); return op.Stop(); }
int CFileLoader::Write() { if ( !IsLoaded() ) return ERROR_FILE_NOT_FOUND; if ( !m_data.vStarts.size() || !m_data.vEnemy.size() || !m_data.vLevel.size() ) return ERROR_NOINTERFACE; int err = 0; std::vector<BYTE> file = m_File.vFile; DWORD systemData = 0, levelData = 0, enemyData = 0, occupiedSpace = 0, totalSpace = 0; // first, apply modifications to levels for(int i = 0; i < MAX_LEVELS; ++i) if ( m_vEditors[i]->Changed() ) m_vEditors[i]->Apply(); if ( !GetMemoryStatus(systemData, levelData, enemyData, occupiedSpace, totalSpace) || occupiedSpace >= totalSpace || file.size() < NES_PTR_EOF ) return ERROR_NOT_ENOUGH_MEMORY; const DWORD DELTA_PTR = 0x8010; std::vector<DWORD> vLevels, vEnemies; m_ptr.ptrLevelStarts = NES_PTR_START - DELTA_PTR; CopyMemory(&file[NES_PTR_START], &m_data.vStarts[0], m_data.vStarts.size()); m_ptr.ptrLevels[0] = m_ptr.ptrLevelStarts + m_data.vStarts.size(); m_ptr.ptrLevels[1] = m_ptr.ptrLevels[0] + MAX_LEVELS; // write levels banks DWORD ptr = m_ptr.ptrLevels[1] + MAX_LEVELS; int c = m_data.vLevel.size(); for(int i = 0; i < c; ++i) { vLevels.push_back(ptr); PBYTE pArray = NULL; DWORD dwSize = 0; if ( m_data.vLevel[i]->MakeByteArray(&pArray, &dwSize) && ptr + dwSize + DELTA_PTR < NES_PTR_EOF ) { CopyMemory(&file[ptr + DELTA_PTR], pArray, dwSize); ptr += dwSize; delete[] pArray; } else return ERROR_NOT_ENOUGH_MEMORY; } // write level pointers for(int i = 0; i < MAX_LEVELS; ++i) { file[m_ptr.ptrLevels[1] + DELTA_PTR + i] = HIBYTE(LOWORD(vLevels[m_game.nLevel[i] - 1])); file[m_ptr.ptrLevels[0] + DELTA_PTR + i] = LOBYTE(LOWORD(vLevels[m_game.nLevel[i] - 1])); } // now update place of enemies data // note, that we already checked, that we have enough space to store all data // enemies pointers arrays DWORD dwEnmPtrsSize = MAX_LEVELS * 2 + ( MAX_LEVELS / 10 ) * 4; DWORD eptr = max(ptr, m_ptr.ptrEnemies[0]); if ( eptr + dwEnmPtrsSize + enemyData + DELTA_PTR > NES_PTR_EOF ) // move data backward eptr = NES_PTR_EOF - DELTA_PTR - enemyData - dwEnmPtrsSize; if ( eptr < ptr ) // cant rewrite level data, but it shall be always false return ERROR_NOT_ENOUGH_MEMORY; if ( ptr < eptr ) // fill free space with 'ff' for(DWORD p = ptr + DELTA_PTR; p < eptr + DELTA_PTR; ++p) file[p] = 0xFF; m_ptr.ptrEnemies[0] = eptr; m_ptr.ptrEnemies[1] = m_ptr.ptrEnemies[0] + MAX_LEVELS / 10; m_ptr.ptrEnemies[2] = m_ptr.ptrEnemies[1] + MAX_LEVELS / 10; m_ptr.ptrEnemies[3] = m_ptr.ptrEnemies[2] + MAX_LEVELS / 10; eptr = m_ptr.ptrEnemies[3] + MAX_LEVELS / 10; ptr = eptr + MAX_LEVELS * 2; // now 'eptr' points to start of array ptrs, // and 'ptr' points to data c = m_data.vEnemy.size(); for(int i = 0; i < c; ++i) { vEnemies.push_back(ptr); PBYTE pArray = NULL; DWORD dwSize = 0; if ( m_data.vEnemy[i]->MakeByteArray(&pArray, &dwSize) && ptr + dwSize < NES_PTR_EOF ) { CopyMemory(&file[ptr + DELTA_PTR], pArray, dwSize); delete[] pArray; ptr += dwSize; } else return ERROR_NOT_ENOUGH_MEMORY; } for(; ptr < NES_PTR_EOF - DELTA_PTR; ++ptr) file[ptr + DELTA_PTR] = 0xFF; // write enemies pointers for(int lv = 0; lv < MAX_LEVELS / 10; ++lv) { DWORD levelPtrHi = eptr + 20 * lv, levelPtrLo = eptr + 20 * lv + 10; file[m_ptr.ptrEnemies[0] + lv + DELTA_PTR] = HIBYTE(LOWORD(levelPtrHi)); file[m_ptr.ptrEnemies[1] + lv + DELTA_PTR] = LOBYTE(LOWORD(levelPtrHi)); file[m_ptr.ptrEnemies[2] + lv + DELTA_PTR] = HIBYTE(LOWORD(levelPtrLo)); file[m_ptr.ptrEnemies[3] + lv + DELTA_PTR] = LOBYTE(LOWORD(levelPtrLo)); for(int i = 0; i < 10; ++i) { file[levelPtrHi + DELTA_PTR + i] = HIBYTE(LOWORD(vEnemies[m_game.nEnemy[10 * lv + i] - 1])); file[levelPtrLo + DELTA_PTR + i] = LOBYTE(LOWORD(vEnemies[m_game.nEnemy[10 * lv + i] - 1])); } } // write from copy to a file array m_File.vFile = file; // write main pointers Short(NES_PTR_LEVEL_STARTS, LOWORD(m_ptr.ptrLevelStarts)); Short(NES_PTR_LEVELS1, LOWORD(m_ptr.ptrLevels[0])); Short(NES_PTR_LEVELS2, LOWORD(m_ptr.ptrLevels[1])); Short(NES_PTR_ENEMY1, LOWORD(m_ptr.ptrEnemies[0])); Short(NES_PTR_ENEMY2, LOWORD(m_ptr.ptrEnemies[1])); Short(NES_PTR_ENEMY3, LOWORD(m_ptr.ptrEnemies[2])); Short(NES_PTR_ENEMY4, LOWORD(m_ptr.ptrEnemies[3])); return err; }
/** Destructor. */ GLTexture2D::~GLTexture2D() { if (IsLoaded()) UnloadLocal(); }
DllLibPlist::~DllLibPlist() { if (IsLoaded()) Unload(); }
void DllLibPlist::plist_get_real_val(plist_t node, double *val) { if (IsLoaded()) _plist_get_real_val(node, val); return; }
void DllLibPlist::plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist) { if (IsLoaded()) _plist_from_bin(plist_bin, length, plist); return; }
plist_t DllLibPlist::plist_dict_get_item(plist_t node, const char* key) { if (IsLoaded()) return _plist_dict_get_item(node, key); return NULL; }
bool GenPlugin::Load() { if( IsLoaded() ) return true; // (1) Load DLL hDLL = LoadLibrary( GetFullpath() ); if( !hDLL ) return false; // (2) Find export WINAMP_GEN_GETTER winampGetGeneralPurposePlugin = ( WINAMP_GEN_GETTER )GetProcAddress( hDLL, "winampGetGeneralPurposePlugin" ); if( winampGetGeneralPurposePlugin == NULL ) { FreeLibrary( hDLL ); hDLL = NULL; return false; } // (3) Get module plugin = winampGetGeneralPurposePlugin(); if( !plugin ) { FreeLibrary( hDLL ); hDLL = NULL; return false; } // (4) Process module plugin->hDllInstance = hDLL; plugin->hwndParent = WindowMain; // Note: Some plugins (mainly old ones) set description in init. // Therefore we init first and copy the name after. // (5) Init if( plugin->init ) { const WNDPROC WndprocBefore = ( WNDPROC )GetWindowLong( WindowMain, GWL_WNDPROC ); plugin->init(); const WNDPROC WndprocAfter = ( WNDPROC )GetWindowLong( WindowMain, GWL_WNDPROC ); if( WndprocBefore != WndprocAfter ) { WndprocBackup = WndprocBefore; iHookerIndex = iWndprocHookCounter++; } } if( !szName ) { // Note: The prefix is not removed to hide their // origin at Nullsoft! It just reads easier. if( !strnicmp( plugin->description, "nullsoft ", 9 ) ) { plugin->description += 9; } // Get rid of " (xxx.dll)" postfix char * walk = plugin->description + strlen( plugin->description ) - 5; while( true ) { if( ( walk <= plugin->description ) || strnicmp( walk, ".dll)", 5 ) ) break; while( ( walk > plugin->description ) && ( *walk != '(' ) ) walk--; if( walk <= plugin->description ) break; walk--; if( ( walk <= plugin->description ) || ( *walk != ' ' ) ) break; *walk = '\0'; } iNameLen = ( int )strlen( plugin->description ); szName = new TCHAR[ iNameLen + 1 ]; ToTchar( szName, plugin->description, iNameLen ); szName[ iNameLen ] = TEXT( '\0' ); } TCHAR szBuffer[ 5000 ]; _stprintf( szBuffer, TEXT( "Loading <%s>, %s" ), GetFilename(), szName ); Console::Append( szBuffer ); Console::Append( TEXT( " " ) ); // Note: Plugins that use a wndproc hook need // to be unloaded in the inverse loading order. // This is due to the nature of wndproc hooking. if( iHookerIndex != -1 ) { Console::Append( TEXT( "Wndproc hook added (by plugin)" ) ); } return true; }
Stage::~Stage() { if (IsLoaded()) { Unload(); } }
void CDllExtension::Load(const char * path){ CString dll_path; if (IsLoaded()) { Unload(); } // try to load specific path if passed in as a parameter if (strlen(path) > 0) { dll_path = path; write_log(preferences.debug_dll_extension(), "[CDLLExtension] setting path (1) to %s\n", dll_path); } else { // Nothing passed in, so we try the DLL of the formula // and the DLL from preferences. dll_path = p_function_collection->DLLPath(); write_log(preferences.debug_dll_extension(), "[CDLLExtension] setting path (2) to %s\n", dll_path); if (dll_path == "") { dll_path = preferences.dll_name().GetString(); write_log(preferences.debug_dll_extension(), "[CDLLExtension] setting path (3) to %s\n", dll_path); } } if (dll_path == "") { // Nothing to do return; } p_filenames->SwitchToOpenHoldemDirectory(); _hmod_dll = LoadLibrary(dll_path); DWORD dll_error = GetLastError(); // If the DLL didn't get loaded if (_hmod_dll == NULL) { CString error_message; error_message.Format("Unable to load DLL from:\n" "%s\n" "error-code: %d\n", dll_path.GetString(), dll_error); OH_MessageBox_Error_Warning(error_message, "DLL Load Error"); return; } // Get address of process_message from dll // user.dll, as defined in WinHoldem, does not ship with a .def file by default - we must use the ordinal method to get the address //global.process_message = (process_message_t) GetProcAddress(global._hmod_dll, "process_message"); _process_message = (process_message_t) ::GetProcAddress(_hmod_dll, (LPCSTR) 1); if (_process_message==NULL) { CString error_message; error_message.Format("Unable to find process_message in dll"); OH_MessageBox_Error_Warning(error_message, "DLL Load Error"); FreeLibrary(_hmod_dll); _hmod_dll = NULL; return; } // pass "load" message (_process_message) ("event", "load"); // No longer passing any pointers to the DLL. // We do no export functions an link them implicitly: // http://www.maxinmontreal.com/forums/viewtopic.php?f=112&t=15470 }
bool CDStoreCodecPlugin::Link( void* modulePtr , TPluginMetaDataPtr pluginMetaData ) {GUCEF_TRACE; if ( IsLoaded() ) return false; _sohandle = modulePtr; if ( NULL != _sohandle ) { GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, "DStoreCodecPlugin: Linking API using module pointer: " + PointerToString( modulePtr ) ); _fptable[ DSTOREPLUG_INIT ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Init" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SHUTDOWN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Shutdown" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_NAME ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Name" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_COPYRIGHT ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Copyright" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_VERSION ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Version" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_TYPE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Type" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_DEST_FILE_OPEN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Dest_File_Open" , 3*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_DEST_FILE_CLOSE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Dest_File_Close" , 2*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_BEGIN_NODE_STORE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Begin_Node_Store" , 3*sizeof(void*)+8 ).funcPtr; _fptable[ DSTOREPLUG_END_NODE_STORE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_End_Node_Store" , 3*sizeof(void*)+8 ).funcPtr; _fptable[ DSTOREPLUG_STORE_NODE_ATT ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Store_Node_Att" , 5*sizeof(void*)+12 ).funcPtr; _fptable[ DSTOREPLUG_BEGIN_NODE_CHILDREN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Begin_Node_Children" , 3*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_END_NODE_CHILDREN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_End_Node_Children" , 3*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SRC_FILE_OPEN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Src_File_Open" , 2*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SRC_FILE_CLOSE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Src_File_Close" , 2*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SET_READ_HANDLERS ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Set_Read_Handlers" , 4*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_START_READING ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Start_Reading" , 2*sizeof(void*) ).funcPtr; if ( ( _fptable[ DSTOREPLUG_INIT ] == NULL ) || ( _fptable[ DSTOREPLUG_SHUTDOWN ] == NULL ) || ( _fptable[ DSTOREPLUG_NAME ] == NULL ) || ( _fptable[ DSTOREPLUG_COPYRIGHT ] == NULL ) || ( _fptable[ DSTOREPLUG_VERSION ] == NULL ) || ( _fptable[ DSTOREPLUG_TYPE ] == NULL ) || ( _fptable[ DSTOREPLUG_DEST_FILE_OPEN ] == NULL ) || ( _fptable[ DSTOREPLUG_DEST_FILE_CLOSE ] == NULL ) || ( _fptable[ DSTOREPLUG_BEGIN_NODE_STORE ] == NULL ) || ( _fptable[ DSTOREPLUG_END_NODE_STORE ] == NULL ) || ( _fptable[ DSTOREPLUG_STORE_NODE_ATT ] == NULL ) || ( _fptable[ DSTOREPLUG_BEGIN_NODE_CHILDREN ] == NULL ) || ( _fptable[ DSTOREPLUG_END_NODE_CHILDREN ] == NULL ) || ( _fptable[ DSTOREPLUG_SRC_FILE_OPEN ] == NULL ) || ( _fptable[ DSTOREPLUG_SRC_FILE_CLOSE ] == NULL ) || ( _fptable[ DSTOREPLUG_SET_READ_HANDLERS ] == NULL ) || ( _fptable[ DSTOREPLUG_START_READING ] == NULL ) ) { memset( _fptable, NULL, sizeof(anyPointer) * DSTOREPLUG_LASTFPTR ); _sohandle = NULL; GUCEF_ERROR_LOG( LOGLEVEL_NORMAL, "Invalid codec module: One or more functions could not be located in the module " + PointerToString( modulePtr ) ); return false; } /* * Intialize the plugin module */ UInt32 statusCode = ( (TDSTOREPLUGFPTR_Init) _fptable[ DSTOREPLUG_INIT ] )( &_plugdata ); if ( statusCode > 0 ) { // We have loaded & linked our plugin module GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, "DStoreCodecPlugin: Successfully loaded module and invoked Init() which returned status " + Int32ToString( statusCode ) + " using module: " + PointerToString( modulePtr ) ); GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, " - Name: " + GetName() ); GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, " - Copyright/EULA: " + GetCopyright() ); // Copy the given metadata and update it with info from the actual module m_metaData = new CPluginMetaData( *pluginMetaData ); m_metaData->SetDescription( GetDescription() ); m_metaData->SetCopyright( GetCopyright() ); m_metaData->SetVersion( GetVersion() ); return true; } else { memset( _fptable, NULL, sizeof(anyPointer) * DSTOREPLUG_LASTFPTR ); _sohandle = NULL; _plugdata = NULL; GUCEF_ERROR_LOG( LOGLEVEL_NORMAL, "Initialization routine reported an error for module " + PointerToString( modulePtr ) ); return false; } } return false; }
int32_t IMADRecord::Unload() { IsChanged(false); IsLoaded(false); EDID.Unload(); DNAM.Unload(); BNAM.Unload(); VNAM.Unload(); TNAM.Unload(); NAM3.Unload(); RNAM.Unload(); SNAM.Unload(); UNAM.Unload(); NAM1.Unload(); NAM2.Unload(); WNAM.Unload(); XNAM.Unload(); YNAM.Unload(); NAM4.Unload(); _00_.Unload(); _40_.Unload(); _01_.Unload(); _41_.Unload(); _02_.Unload(); _42_.Unload(); _03_.Unload(); _43_.Unload(); _04_.Unload(); _44_.Unload(); _05_.Unload(); _45_.Unload(); _06_.Unload(); _46_.Unload(); _07_.Unload(); _47_.Unload(); _08_.Unload(); _48_.Unload(); _09_.Unload(); _49_.Unload(); _0A_.Unload(); _4A_.Unload(); _0B_.Unload(); _4B_.Unload(); _0C_.Unload(); _4C_.Unload(); _0D_.Unload(); _4D_.Unload(); _0E_.Unload(); _4E_.Unload(); _0F_.Unload(); _4F_.Unload(); _10_.Unload(); _50_.Unload(); _11_.Unload(); _51_.Unload(); _12_.Unload(); _52_.Unload(); _13_.Unload(); _53_.Unload(); _14_.Unload(); _54_.Unload(); RDSD.Unload(); RDSI.Unload(); return 1; }
/* ================ idAF::AddBindConstraints ================ */ void idAF::AddBindConstraints( void ) { const idKeyValue *kv; idStr name; idAFBody *body; idLexer lexer; idToken type, bodyName, jointName; idVec3 origin, renderOrigin; idMat3 axis, renderAxis; if( !IsLoaded() ) { return; } const idDict &args = self->spawnArgs; // get the render position origin = physicsObj.GetOrigin( 0 ); axis = physicsObj.GetAxis( 0 ); renderAxis = baseAxis.Transpose() * axis; renderOrigin = origin - baseOrigin * renderAxis; // parse all the bind constraints for( kv = args.MatchPrefix( "bindConstraint ", NULL ); kv; kv = args.MatchPrefix( "bindConstraint ", kv ) ) { name = kv->GetKey(); name.Strip( "bindConstraint " ); lexer.LoadMemory( kv->GetValue(), kv->GetValue().Length(), kv->GetKey() ); lexer.ReadToken( &type ); lexer.ReadToken( &bodyName ); body = physicsObj.GetBody( bodyName ); if( !body ) { gameLocal.DWarning( "idAF::AddBindConstraints: body '%s' not found on entity '%s'", bodyName.c_str(), self->name.c_str() ); lexer.FreeSource(); continue; } if( type.Icmp( "fixed" ) == 0 ) { idAFConstraint_Fixed *c; c = new idAFConstraint_Fixed( name, body, NULL ); physicsObj.AddConstraint( c ); } else if( type.Icmp( "ballAndSocket" ) == 0 ) { idAFConstraint_BallAndSocketJoint *c; c = new idAFConstraint_BallAndSocketJoint( name, body, NULL ); physicsObj.AddConstraint( c ); lexer.ReadToken( &jointName ); jointHandle_t joint = animator->GetJointHandle( jointName ); if( joint == INVALID_JOINT ) { gameLocal.DWarning( "idAF::AddBindConstraints: joint '%s' not found", jointName.c_str() ); } animator->GetJointTransform( joint, gameLocal.time, origin, axis ); c->SetAnchor( renderOrigin + origin * renderAxis ); } else if( type.Icmp( "universal" ) == 0 ) { idAFConstraint_UniversalJoint *c; c = new idAFConstraint_UniversalJoint( name, body, NULL ); physicsObj.AddConstraint( c ); lexer.ReadToken( &jointName ); jointHandle_t joint = animator->GetJointHandle( jointName ); if( joint == INVALID_JOINT ) { gameLocal.DWarning( "idAF::AddBindConstraints: joint '%s' not found", jointName.c_str() ); } animator->GetJointTransform( joint, gameLocal.time, origin, axis ); c->SetAnchor( renderOrigin + origin * renderAxis ); c->SetShafts( idVec3( 0, 0, 1 ), idVec3( 0, 0, -1 ) ); } else { gameLocal.DWarning( "idAF::AddBindConstraints: unknown constraint type '%s' on entity '%s'", type.c_str(), self->name.c_str() ); } lexer.FreeSource(); } hasBindConstraints = true; }
plist_t DllLibPlist::plist_new_dict(void) { if (IsLoaded()) return _plist_new_dict(); return NULL; }
bool CISEMultiSession::SendQuotes(vector<CQuoteParams>& vecQuotes) { CAutoLock Lock(&m_MultiSessionLock); map<uint8, CBookRequests> mapBook2Requests; { // check for connection state CAutoLock DataLock(this); if(IsLoaded() == false || m_bMultiSessionLoggedOn == false) { for(vector<CQuoteParams>::iterator itQuotes = vecQuotes.begin(); itQuotes != vecQuotes.end(); itQuotes++) { itQuotes->m_SendResult.m_Error = enNotConnected; itQuotes->m_SendResult.m_sOrderID = ""; } return false; } static quote_trans_mo106_t Mo106; static const int nMaxItems = /*1;*/sizeof(Mo106.item) / sizeof(quote_trans_mo106_item_t); { CAutoLock ClassesLock(&m_ISE.m_InstrumentClasses); CAutoLock UndLock(&m_ISE.m_Underlyings); CAutoLock SeriesLock(&m_ISE.m_Series); for(vector<CQuoteParams>::iterator itQuotes = vecQuotes.begin(); itQuotes != vecQuotes.end(); itQuotes++) { // find series CSeries* pSeries = GetSeriesByRequest(itQuotes->m_sSeries); if(pSeries && pSeries->m_pUnderlying && pSeries->m_pInstrumentClass) { // check for premium if(itQuotes->m_dPremium == 0) { CDeleteQuoteRequest DeleteRequest; DeleteRequest.m_Data.series = pSeries->m_Series; DeleteRequest.m_Data.orderbook_c = pSeries->m_pUnderlying->m_uiOrderbook; DeleteRequest.m_Data.bid_or_ask_c = itQuotes->m_BidOrAsk; //ThEN/B/ DeleteRequest.m_Data.order_category_n = ORDER_CAT_QUOTE; DeleteRequest.m_Data.order_category_filter_n = ORDER_CAT_QUOTE; //ThEN/E/ { CAutoLock UserLock(&(CISESession0::m_User)); StringToClickString(CISESession0::m_User.m_sCountryID, sizeof(DeleteRequest.m_Data.whose.trading_code.country_id_s), DeleteRequest.m_Data.whose.trading_code.country_id_s); StringToClickString(CISESession0::m_User.m_sCustomerID, sizeof(DeleteRequest.m_Data.whose.trading_code.ex_customer_s), DeleteRequest.m_Data.whose.trading_code.ex_customer_s); } DeleteRequest.m_Ref = &(*itQuotes); mapBook2Requests[pSeries->m_pUnderlying->m_uiOrderbook].m_DeleteRequests.push_back(DeleteRequest); } else { vector<CSubmitQuoteRequest>& vecSubmitRequests = mapBook2Requests[pSeries->m_pUnderlying->m_uiOrderbook].m_SubmitRequests; if(vecSubmitRequests.size() == 0 || vecSubmitRequests.back().m_Data.items_n == nMaxItems) vecSubmitRequests.push_back(CSubmitQuoteRequest()); CSubmitQuoteRequest& SubmitRequest = vecSubmitRequests.back(); uint16_t& nItems = SubmitRequest.m_Data.items_n; SubmitRequest.m_Data.item[nItems].series = pSeries->m_Series; SubmitRequest.m_Data.item[nItems].open_quantity_u = itQuotes->m_lOpenQuantity; SubmitRequest.m_Data.item[nItems].premium_i = DBL2DEC(itQuotes->m_dPremium, pSeries->m_pInstrumentClass->m_uiDecInPremium); SubmitRequest.m_Data.item[nItems].quantity_u = itQuotes->m_lQuantity; SubmitRequest.m_Data.item[nItems].step_up_buffer_n = itQuotes->m_lQuantity; SubmitRequest.m_Data.item[nItems].bid_or_ask_c = itQuotes->m_BidOrAsk; nItems++; SubmitRequest.m_Refs.push_back(&(*itQuotes)); } } else { itQuotes->m_SendResult.m_Error = enSymbolNotSupported; itQuotes->m_SendResult.m_sOrderID = ""; } } } } map<uint8, CBookRequests >::iterator itBook; ErrorNumberEnum Error = enNoError; InitAsync(); for(itBook = mapBook2Requests.begin(); itBook != mapBook2Requests.end(); itBook++) { CBookRequests& BookRequests = itBook->second; vector<CSubmitQuoteRequest>::iterator itSubmReq; for(itSubmReq = BookRequests.m_SubmitRequests.begin(); itSubmReq != BookRequests.m_SubmitRequests.end();itSubmReq++) { CSubmitQuoteRequest& Req = *itSubmReq; Req.m_Data.orderbook_c = itBook->first; CallAsync(enArtSumbit, &Req); } vector<CDeleteQuoteRequest>::iterator itDelReq; for(itDelReq = BookRequests.m_DeleteRequests.begin(); itDelReq != BookRequests.m_DeleteRequests.end();itDelReq++) { CallAsync(enArtDelete, &(*itDelReq)); } } WaitAsyncComplete(); // update cache CAutoLock SeriesLock(&m_ISE.m_Series); for(vector<CQuoteParams>::iterator itQuotes = vecQuotes.begin(); itQuotes != vecQuotes.end(); itQuotes++) { const CQuoteParams& Quote = *itQuotes; if(Quote.m_SendResult.m_Error == enNoError) { // find series CSeries* pSeries = GetSeriesByRequest(itQuotes->m_sSeries); if(pSeries) { pSeries->UpdateQuoteCache(Quote, 0); } } } return true; }
uint32_t DllLibPlist::plist_dict_get_size(plist_t node) { if (IsLoaded()) return _plist_dict_get_size(node); return 0; }
bool CSkin::Load() { bool bRet = false; BEATS_ASSERT(!IsLoaded(), _T("Can't Load a skin which is already loaded!")); // Load From File CSerializer serializer(_T("..\\Resource\\skin\\org.skin")); CSerializer tmpVerticesBufferPos, tmpVerticesBufferUV; CSerializer indexBuffer; size_t uVertexCount = 0; serializer >> uVertexCount; m_uVertexCount = uVertexCount; m_vertices = new CVertexPTB[uVertexCount]; float x, y, z; float u,v; for (size_t i = 0; i < uVertexCount; ++i) { ESkeletonBoneType bone, bone1, bone2, bone3; float weight, weight1, weight2,weight3; serializer >> x >> y >> z >> u >> v; serializer >> bone; serializer >> weight; serializer >> bone1; serializer >> weight1; serializer >> bone2; serializer >> weight2; serializer >> bone3; serializer >> weight3; CVertexPTB &vertex = m_vertices[i]; kmVec3Fill(&vertex.position,x,y,z); vertex.tex = CTex(u,v); vertex.bones = CIVector4(bone, bone1, bone2, bone3); kmVec4Fill(&vertex.weights,weight,weight1,weight2,weight3); #ifdef _DEBUG float sum = weight + weight1 + weight2+weight3; BEATS_ASSERT(sum < 1.01F, _T("Weight can't be greater than 1.01F, cur Value : %f!"), sum); BEATS_WARNING(sum > 0.99F, _T("Weight can't be smaller than 0.99F, cur Value : %f!"), sum); #endif } for (size_t i = 0; i < uVertexCount; ++i) { indexBuffer << (short)i; } CRenderer* pRenderer = CRenderer::GetInstance(); pRenderer->GenVertexArrays(1, &m_uVAO); pRenderer->GenBuffers(2, m_uVBO); #ifndef SW_SKEL_ANIM buildVBOVertex(m_vertices, m_uVertexCount*sizeof(CVertexPTB)); BEATS_SAFE_DELETE_ARRAY(m_vertices); #endif buildVBOIndex(indexBuffer.GetBuffer(), indexBuffer.GetWritePos()); buildVAO(); SetLoadedFlag(true); return bRet; }
void DllLibPlist::plist_get_string_val(plist_t node, char **val) { if (IsLoaded()) _plist_get_string_val(node, val); return; }
int ModuleCmd_Switch( Tcl_Interp *interp, int argc, char *argv[]) { char *oldmodule, *newmodule, *realname, *oldfile, *newfile, *oldname, *newname, *oldmodule_buffer = (char *) NULL; int ret_val = TCL_OK; /** ** allocate buffer memory **/ if (!(oldfile = stringer(NULL, MOD_BUFSIZE, NULL))) if( OK != ErrorLogger( ERR_STRING, LOC, NULL)) goto unwind0; if (!(newfile = stringer(NULL, MOD_BUFSIZE, NULL))) if( OK != ErrorLogger( ERR_STRING, LOC, NULL)) goto unwind1; if (!(oldname = stringer(NULL, MOD_BUFSIZE, NULL))) if( OK != ErrorLogger( ERR_STRING, LOC, NULL)) goto unwind2; if (!(newname = stringer(NULL, MOD_BUFSIZE, NULL))) if( OK != ErrorLogger( ERR_STRING, LOC, NULL)) goto unwind3; /** ** Parameter check. the required syntax is: ** module switch [ <old> ] <new> ** If <old> is not specified, then the pathname of <new> is assumed. **/ if( argc == 1) { newmodule = argv[0]; if(!(oldmodule_buffer = stringer(NULL,0,newmodule,NULL))) if( OK != ErrorLogger( ERR_STRING, LOC, NULL)) goto unwind4; /* starting from the end of the module name, find the first * forward slash and replace with null */ if ((oldmodule = strrchr(oldmodule_buffer, *psep))) { *oldmodule = 0; } oldmodule = oldmodule_buffer; } else if( argc == 2) { oldmodule = argv[0]; newmodule = argv[1]; } else { if( OK != ErrorLogger( ERR_USAGE, LOC, "switch oldmodule newmodule", NULL)) return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/ } /** ** Set the name of the module specified on the command line **/ g_specified_module = oldmodule; /** ** First try to find a match for the modulefile out of the LOADEDMODULES. **/ if( !IsLoaded( interp, oldmodule, &realname, oldfile)) if( OK != ErrorLogger( ERR_NOTLOADED, LOC, oldmodule, NULL)) goto unwind4; /** ** If we have another name to try, try finding it on disk. **/ if( realname) ret_val = Locate_ModuleFile( interp, realname, oldname, oldfile); /** ** If we've made it this far without finding a file, then look using the ** exact name the user gave me -- i.e. the old method. **/ if( ret_val == TCL_ERROR) { if( TCL_ERROR == (ret_val = Locate_ModuleFile( interp, oldmodule, oldname, oldfile))) if( OK != ErrorLogger( ERR_LOCATE, LOC, oldmodule, NULL)) goto unwind4; /** ** OK, this one is known. Is it loaded, too? **/ if( !IsLoaded( interp, oldname, NULL, oldfile)) if( OK != ErrorLogger( ERR_NOTLOADED, LOC, oldmodule, NULL)) goto unwind4; } /** ** Set the name of the module specified on the command line **/ g_specified_module = newmodule; /** ** Now try to find the new file to swap with. **/ if( TCL_ERROR == (ret_val = Locate_ModuleFile( interp, newmodule, newname, newfile))) if( OK != ErrorLogger( ERR_LOCATE, LOC, newmodule, NULL)) goto unwind4; ErrorLogger( NO_ERR_VERBOSE, LOC, "Switching '$1' to '$2'", oldmodule, newmodule, NULL); /** ** We'll remove the current modulefile with the SWITCH1 state set. ** This means that instead of really removing the paths, markers will ** be put in its place for later use. **/ g_flags |= (M_REMOVE | M_SWSTATE1); g_specified_module = oldmodule; g_current_module = oldname; if( Read_Modulefile( interp, oldfile) == 0) Update_LoadedList( interp, oldname, oldfile); else { ErrorLogger( NO_ERR_VERBOSE, LOC, "failed", NULL); goto unwind4; } g_flags &= ~(M_REMOVE | M_SWSTATE1); /** ** Move on to state SWITCH2. This loads the modulefile at the append ** and prepend markers. **/ g_flags |= M_SWSTATE2; g_specified_module = newmodule; g_current_module = newname; if( Read_Modulefile( interp, newfile) == 0) Update_LoadedList( interp, newname, newfile); else { ErrorLogger( NO_ERR_VERBOSE, LOC, "failed", NULL); goto unwind4; } g_flags &= ~M_SWSTATE2; /** ** This actually unsets environment variables and gets rid of the ** markers. **/ g_flags |= (M_REMOVE | M_SWSTATE3); g_specified_module = oldmodule; g_current_module = oldname; if( Read_Modulefile( interp, oldfile) == 0) Update_LoadedList( interp, newname, newfile); else { ErrorLogger( NO_ERR_VERBOSE, LOC, "failed", NULL); goto unwind4; } /** ** Return on success **/ ErrorLogger( NO_ERR_VERBOSE, LOC, "done", NULL); /** ** free space ** assume don't need what's pointed to by g_current_module ** and g_specified_module **/ null_free((void *) &newname); null_free((void *) &oldname); null_free((void *) &newfile); null_free((void *) &oldfile); return( TCL_OK); /** ------- EXIT (SUCCESS) --------> **/ unwind4: if (oldmodule == oldmodule_buffer) null_free((void *) &oldmodule); null_free((void *) &newname); unwind3: null_free((void *) &oldname); unwind2: null_free((void *) &newfile); unwind1: null_free((void *) &oldfile); unwind0: return( TCL_ERROR); /** ------- EXIT (FAILURE) --------> **/ } /** End of 'ModuleCmd_Switch' **/
void DllLibPlist::plist_free(plist_t plist) { if (IsLoaded()) _plist_free(plist); return; }
bool IAsset::IsEmpty() const { return !IsLoaded() && diskSource.isEmpty(); }
bool DllLibPlist::Load(void) { const char *error; if (IsLoaded()) return true; m_handler = dlopen(LIBPLIST_FILE, RTLD_LAZY); if (!m_handler) { fprintf(stderr, "%s\n", dlerror()); return false; } *(void **)&_plist_new_dict = dlsym(m_handler, "plist_new_dict"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); Unload(); return false; } *(void **)&_plist_dict_get_item = dlsym(m_handler, "plist_dict_get_item"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); Unload(); return false; } *(void **)&_plist_dict_get_size = dlsym(m_handler, "plist_dict_get_size"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); Unload(); return false; } *(void **)&_plist_from_bin = dlsym(m_handler, "plist_from_bin"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); Unload(); return false; } *(void **)&_plist_get_string_val = dlsym(m_handler, "plist_get_string_val"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); Unload(); return false; } *(void **)&_plist_get_real_val = dlsym(m_handler, "plist_get_real_val"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); Unload(); return false; } *(void **)&_plist_free = dlsym(m_handler, "plist_free"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); Unload(); return false; } return true; }
VOID CModelInfoSA::Request( EModelRequestType requestType, const char* szTag ) { DEBUG_TRACE("VOID CModelInfoSA::Request( BOOL bAndLoad, BOOL bWaitForLoad )"); // don't bother loading it if it already is if ( IsLoaded () ) return; if ( m_dwModelID <= 288 && m_dwModelID != 7 && !pGame->GetModelInfo ( 7 )->IsLoaded () ) { // Skin 7 must be loaded in order for other skins to work. No, really. (#4010) pGame->GetModelInfo ( 7 )->Request ( requestType, "Model 7" ); } // Bikes can sometimes get stuck when loading unless the anim file is handled like what is does here // Don't change the code below unless you can test it (by recreating the problem it solves) if ( IsVehicle () ) { uint uiAnimFileIndex = GetAnimFileIndex (); if ( uiAnimFileIndex != 0xffffffff ) { uint uiAnimId = uiAnimFileIndex + 25575; CModelInfoSA* pAnim = static_cast < CModelInfoSA* > ( pGame->GetModelInfo ( uiAnimId ) ); if ( !pAnim ) { if ( uiAnimId != 25714 ) LogEvent ( 505, "Model no anim", "", SString ( "%d (%d)", m_dwModelID, uiAnimId ) ); } else if ( !pAnim->IsLoaded() ) { OutputDebugLine ( SString ( "[Models] Requesting anim file %d for model %d", uiAnimId, m_dwModelID ) ); pAnim->Request ( requestType, szTag ); } } } if ( requestType == BLOCKING ) { pGame->GetStreaming()->RequestModel ( m_dwModelID, 0x16 ); pGame->GetStreaming()->LoadAllRequestedModels ( true, szTag ); if ( !IsLoaded() ) { // Try 3 more times, final time without high priority flag int iCount = 0; while ( iCount++ < 10 && !IsLoaded() ) { bool bOnlyPriorityModels = ( iCount < 3 || iCount & 1 ); pGame->GetStreaming()->LoadAllRequestedModels ( bOnlyPriorityModels, szTag ); } if ( !IsLoaded() ) { AddReportLog ( 6641, SString ( "Blocking load fail: %d (%s)", m_dwModelID, szTag ) ); LogEvent ( 641, "Blocking load fail", "", SString ( "%d (%s)", m_dwModelID, szTag ) ); dassert ( 0 ); } else { AddReportLog ( 6642, SString ( "Blocking load: %d (%s) (Took %d attempts)", m_dwModelID, szTag, iCount ) ); LogEvent ( 642, "Blocking load", "", SString ( "%d (%s) (Took %d attempts)", m_dwModelID, szTag, iCount ) ); } } } else { pGame->GetStreaming()->RequestModel ( m_dwModelID, 0x06 ); } }
bool FLevelModel::IsEditable() const { return (IsLoaded() == true && IsLocked() == false); }
/// \brief /// Guarantees that the resource is loaded /// /// One of the key functions of resource management. After calling this function it is /// guaranteed, that the resource is loaded. If the resource wasn't already loaded, the virtual /// Reload() function is called. Furthermore it updates the time stamp for the last accessed /// time. Call this function before any custom resource functions are called that rely on data /// being allocated in the Reload() function. inline void EnsureLoaded() { m_fLastTimeUsed = GetGlobalTime(); if (IsLoaded()) return; DoReload(); }
// //////////////////////////////////////////////////////////////////////////// bool DllLoader::CheckIsLoaded() const { if (!IsLoaded()) MLB::Utility::ThrowException("Dll '" + dll_name_ + "' is not loaded."); return(true); }
/// \brief /// Ensures that the resource is unloaded inline void EnsureUnloaded() { if (!IsLoaded()) return; VASSERT(CanUnload()); ///< this should be tested outside this function! DoUnload(); }