/** * \todo Fix: doesn't work */ VOID CHudSA::SetZoneName( char * szName ) { DEBUG_TRACE("VOID CHudSA::SetZoneName( char * szName )"); char * szZoneNamePtr = (char *)VAR_ZoneNamePtr; if(szName != 0) { if(strlen(szName) < 50) { strcpy(szZoneName, szName); szZoneNamePtr = szZoneName; } } else { *(DWORD *)VAR_ZoneNamePtr = 0; } }
CTaskSimpleJetPackSA::CTaskSimpleJetPackSA(const CVector *pVecTargetPos, float fCruiseHeight, int nHoverTime) { DEBUG_TRACE("CTaskSimpleJetPackSA::CTaskSimpleJetPackSA(const CVector *pVecTargetPos = NULL, float fCruiseHeight = 10.0f, int nHoverTime = 0)"); this->CreateTaskInterface(sizeof(CTaskSimpleJetPackSAInterface)); DWORD dwFunc = FUNC_CTaskSimpleJetPack__Constructor; DWORD dwThisInterface = (DWORD)this->GetInterface(); _asm { mov ecx, dwThisInterface push 0 // pTargetEnt - ignored for simplicity's sake (we really don't need it) push nHoverTime push fCruiseHeight push pVecTargetPos call dwFunc } }
VOID CHudSA::SetHelpMessage( char * szMessage ) { DEBUG_TRACE("VOID CHudSA::SetHelpMessage( char * szMessage )"); wchar_t szHelp[255] = {'\0'}; MultiByteToWideChar(CP_ACP, 0, szMessage, -1, szHelp, 255); DWORD dwFunction = FUNC_SetHelpMessage; _asm { push 0 push 1 lea eax, szHelp push eax call dwFunction add esp, 0xC } }
/** * \todo Fix: doesn't work */ VOID CHudSA::SetZoneName( char * szName ) { DEBUG_TRACE("VOID CHudSA::SetZoneName( char * szName )"); char * szZoneNamePtr = (char *)VAR_ZoneNamePtr; if(szName != 0) { if(strlen(szName) < 50) { strcpy(szZoneName, szName); szZoneNamePtr = szZoneName; } } else { MemPutFast < DWORD > ( VAR_ZoneNamePtr, 0 ); } }
VOID CCameraSA::RestoreWithJumpCut() { DEBUG_TRACE("VOID CCameraSA::RestoreWithJumpCut()"); CCameraSAInterface* cameraInterface = this->GetInterface(); DWORD dwFunc = 0x50BD40; _asm { mov ecx, cameraInterface call dwFunc } dwFunc = 0x50BAB0; _asm { mov ecx, cameraInterface call dwFunc } }
/** * Called only once, when the plugin is loaded. */ NPError NP_Initialize(NPNetscapeFuncs* browserFuncs) { DEBUG_TRACE("NP_Initialize"); if (HIBYTE(browserFuncs->version) > NP_VERSION_MAJOR) { DEBUG_CRIT("Wrong API Version!"); return NPERR_INCOMPATIBLE_VERSION_ERROR; } if (browserFuncs->size < sizeof(NPNetscapeFuncs)) { DEBUG_CRIT("browserFuncs has wrong size!"); return NPERR_INVALID_FUNCTABLE_ERROR; } browser = browserFuncs; return NPERR_NO_ERROR; }
// Master thread adds accepted socket to a queue static void produce_socket(struct mg_context *ctx, const struct socket *sp) { (void) pthread_mutex_lock(&ctx->mutex); // If the queue is full, wait while (ctx->sq_head - ctx->sq_tail >= (int) ARRAY_SIZE(ctx->queue)) { (void) pthread_cond_wait(&ctx->sq_empty, &ctx->mutex); } assert(ctx->sq_head - ctx->sq_tail < (int) ARRAY_SIZE(ctx->queue)); // Copy socket to the queue and increment head ctx->queue[ctx->sq_head % ARRAY_SIZE(ctx->queue)] = *sp; ctx->sq_head++; DEBUG_TRACE(("queued socket %d", sp->sock)); (void) pthread_cond_signal(&ctx->sq_full); (void) pthread_mutex_unlock(&ctx->mutex); }
// Print error message to the opened error log stream. static void cry(struct mg_connection *conn, const char *fmt, ...) { char buf[BUFSIZ]; va_list ap; va_start(ap, fmt); (void) vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); // Do not lock when getting the callback value, here and below. // I suppose this is fine, since function cannot disappear in the // same way string option can. conn->request_info.log_message = buf; if (call_user(conn, MG_EVENT_LOG) == NULL) { DEBUG_TRACE(("[%s]", buf)); } conn->request_info.log_message = NULL; }
int UCConfMgr::LeaveConf(void) { DEBUG_TRACE(""); if(0 == m_uiConfID) { return UC_SDK_Success; } if(m_strChairManAccount == UCRegMgr::Instance().GetSelfAccount()) { TUP_RESULT tRet = tup_call_serverconf_end(m_uiConfID); INFO_LOG("EndConf:ConfID=[%d]",m_uiConfID); if(tRet != TUP_SUCCESS) { ERROR_LOG("tup_call_serverconf_end failed."); return UC_SDK_Failed; } //同时删除讨论组 (void)UCGroupMgr::Instance().DelGroup(m_strGroupID); UCGroupMgr::Instance().DelLocalGroup(m_strGroupID); } else { TUP_RESULT tRet = tup_call_serverconf_leave(m_uiConfID); INFO_LOG("LeaveConf:ConfID=[%d]",m_uiConfID); if(tRet != TUP_SUCCESS) { ERROR_LOG("tup_call_serverconf_leave failed."); return UC_SDK_Failed; } //离开讨论组 (void)UCGroupMgr::Instance().LeaveGroup(m_strGroupID); UCGroupMgr::Instance().DelLocalGroup(m_strGroupID); } //清空本地群组数据 UCGroupMgr::Instance().ClearGroupMember(); return UC_SDK_Success; }
VOID CFireManagerSA::ExtinguishPoint ( CVector & vecPosition, float fRadius ) { DEBUG_TRACE("VOID CFireManagerSA::ExtinguishPoint ( CVector & vecPosition, float fRadius )"); FLOAT fX = vecPosition.fX; FLOAT fY = vecPosition.fY; FLOAT fZ = vecPosition.fZ; DWORD dwFunction = FUNC_ExtinguishPoint; _asm { mov ecx, CLASS_CFireManager push fRadius push fZ push fY push fX call dwFunction } }
/////////////////////////////////////////////////////////////////////// /// /// @brief 此方法在阿里旺旺初始化阶段中,由阿里旺旺调用而通知插件,表示插件被加载了 /// /// @param __in IDispatch *pApplication - 应用程序对象 /// @param __in LONG lPluginCookie - 插件标示 /// /// @retval HRESULT /// /// 修改记录: \n /// /// <修改日期> <修改者> <修改内容描述>\n /// /// 2009-08-06 游枭 创建\n /// /// 备注信息: /// /////////////////////////////////////////////////////////////////////// STDMETHODIMP CRSSPlugin2::OnConnect( __in IDispatch *pApplication, __in LONG lPluginCookie ) { CComQIPtr<ISDKApplication3> spSDKApplication3(pApplication); if (spSDKApplication3) { g_spApplication3=spSDKApplication3; } DEBUG_TRACE(_T("CRssPlugin2::OnConnect")); g_plugincookie = lPluginCookie; return S_OK; }
int CTaskComplexWanderSA::GetWanderType() { DEBUG_TRACE("int CTaskComplexWander::GetWanderType()"); CTaskSAInterface *pTaskInterface = this->GetInterface(); DWORD dwFunc = ((TaskComplexWanderVTBL *)pTaskInterface->VTBL)->GetWanderType; int iReturn = NO_WANDER_TYPE; if (dwFunc && dwFunc != 0x82263A) // some tasks have no wander type 0x82263A is purecal (assert?) { _asm { mov ecx, pTaskInterface call dwFunc mov iReturn, eax } } return iReturn; }
void BeGadu::AddDeskbarIcon() { DEBUG_TRACE( "BeGadu::AddDeskbarIcon()\n" ); BDeskbar deskbar; if( !deskbar.HasItem( "BGDeskbar" ) ) { BRoster roster; entry_ref ref; status_t status = roster.FindApp( APP_MIME, &ref ); if( status != B_OK ) { fprintf( stderr, _T("Can't find BeGadu running: %s\n"), strerror( status ) ); return; } status = deskbar.AddItem( &ref ); if( status != B_OK ) { fprintf( stderr, _T("Can't put BeGadu into Deskbar: %s\n"), strerror( status ) ); return; } } }
CPed* CPoolsSA::AddPed ( ePedModel ePedType ) { DEBUG_TRACE("CPed* CPoolsSA::AddPed ( ePedModel ePedType )"); CPedSA* pPed = NULL; if ( m_pedPool.ulCount < MAX_PEDS ) { pPed = new CPlayerPedSA ( ePedType ); if ( ! AddPedToPool ( pPed ) ) { delete pPed; pPed = NULL; } } return pPed; }
void CNetworkPlayer::GetRotation( CVector3 * vecRotation ) { DEBUG_TRACE("CNetworkPlayer::GetRotation"); // Is the player ped valid? if( m_pPlayerPed && IsSpawned() ) { // Get the player rotation Quaternion quatRotation; m_pPlayerPed->GetRotation( &quatRotation ); // Copy the rotation eular angles memcpy( vecRotation, &quatRotation.toEularAngles(), sizeof(CVector3) ); // Convert the rotation to degrees vecRotation->FromRadians(); } }
CObject* CPoolsSA::GetObject ( DWORD* pGameInterface ) { DEBUG_TRACE("CObject* CPoolsSA::GetObject ( DWORD* pGameInterface )"); CObjectSAInterface* pInterface = reinterpret_cast < CObjectSAInterface* > ( pGameInterface ); if ( pInterface ) { // Lookup in the pool map for the object related to this interface. objectPool_t::mapType::iterator iter = m_objectPool.map.find ( pInterface ); if ( iter != m_objectPool.map.end () ) { return (*iter).second; } } return NULL; }
VOID CRegisteredCoronaSA::Init(DWORD Identifier) { DEBUG_TRACE("VOID CRegisteredCoronaSA::Init(DWORD Identifier)"); internalInterface->Identifier = Identifier; this->SetSize(2.5f); internalInterface->NormalAngle = 0.0f; internalInterface->Range = 450.0f; internalInterface->PullTowardsCam = 1.5f; internalInterface->Red = 255; internalInterface->Green = 55; internalInterface->Blue = 255; internalInterface->Intensity = 255; internalInterface->FadedIntensity = 255; internalInterface->FlareType = 0; internalInterface->ReflectionType = 1; internalInterface->JustCreated = 1; internalInterface->RegisteredThisFrame = 1; // won't appear in-game without this }
void CVulEngine::_ScanVul(HWND hWnd) { DWORD dwFlags = _GetScanFlags(); CWindowVulfixObserver observer( hWnd); if(!m_pVulScan) m_pVulScan = CreateVulFix(); HRESULT hr = E_POINTER; if(m_pVulScan) { m_pVulScan->SetObserver(&observer); hr = m_pVulScan->Scan(dwFlags); DEBUG_TRACE(_T("CVulEngine::_ScanVul ScanVul %x(%x) \n"), hr, dwFlags); m_pVulScan->SetObserver(NULL); } _RelayMessage(hWnd, WMH_SCAN_DONE, m_bVulScanCanceled, hr); }
/* * ecm_state_char_dev_iface_chain_msg_prep() * Generate an interface hash table chain message */ static bool ecm_state_char_dev_iface_chain_msg_prep(struct ecm_state_file_instance *sfi) { int result; int chain_len; DEBUG_TRACE("%p: Prep iface chain msg\n", sfi); /* * Get hash table chain length */ chain_len = ecm_db_iface_hash_table_lengths_get(sfi->iface_hash_index); if ((result = ecm_state_write_reset(sfi, "iface_chain"))) { return result; } if ((result = ecm_state_prefix_index_add(sfi, sfi->iface_hash_index))) { return result; } return ecm_state_write(sfi, "length", "%d", chain_len); }
CPedSAInterface* CPoolsSA::GetPedInterface ( DWORD dwGameRef ) { DEBUG_TRACE("CPedSAInterface* CPoolsSA::GetPedInterface ( DWORD dwGameRef )"); DWORD dwReturn; DWORD dwFunction = FUNC_GetPed; _asm { mov ecx, dword ptr ds:[CLASS_CPool_Ped] push dwGameRef call dwFunction add esp, 0x4 mov dwReturn, eax } CPedSAInterface* pInterface = (CPedSAInterface*)dwReturn; return pInterface; }
CPed* CPoolsSA::GetPed ( DWORD* pGameInterface ) { DEBUG_TRACE("CPed* CPoolsSA::GetPed ( DWORD* pGameInterface )"); CPedSAInterface* pInterface = reinterpret_cast < CPedSAInterface* > ( pGameInterface ); // 0x00400000 is used for bad player pointers some places in GTA if ( pInterface && pGameInterface != (DWORD*)0x00400000 ) { // Lookup in the pool map for the ped related to this interface. pedPool_t::mapType::iterator iter = m_pedPool.map.find ( pInterface ); if ( iter != m_pedPool.map.end () ) { return (*iter).second; } } return NULL; }
CObject* CPoolsSA::AddObject ( DWORD dwModelID ) { DEBUG_TRACE("CObject * CPoolsSA::AddObject ( DWORD dwModelID )"); CObjectSA* pObject = NULL; if ( m_objectPool.ulCount < MAX_OBJECTS ) { pObject = new CObjectSA ( dwModelID ); if ( ! AddObjectToPool ( pObject ) ) { delete pObject; pObject = NULL; } } return pObject; }
/** * \todo Find out what GetAngleOpenRatio actually does * @return FLOAT Not sure... */ FLOAT CDoorSA::GetAngleOpenRatio ( ) { DEBUG_TRACE("FLOAT CDoorSA::GetAngleOpenRatio ( )"); DWORD dwFunction = FUNC_GetAngleOpenRatio; DWORD dwPointer = (DWORD)GetInterface(); FLOAT fReturn = 0.0f; if ( dwPointer != 0 ) { _asm { mov ecx, dwPointer call dwFunction fstp fReturn } } return fReturn; }
CModelInfo * CGameSA::GetModelInfo(DWORD dwModelID ) { DEBUG_TRACE("CModelInfo * CGameSA::GetModelInfo(DWORD dwModelID )"); if (dwModelID < MODELINFO_MAX) { if ( ModelInfo [dwModelID ].IsValid () ) { return &ModelInfo[dwModelID]; } else { return NULL; } } else { return NULL; } }
CMatrix * CCameraSA::GetMatrix ( CMatrix * matrix ) { DEBUG_TRACE("CMatrix * CCameraSA::GetMatrix ( CMatrix * matrix )"); //_asm int 3 //CCameraSAInterface * pCamInterface = this->GetInterface(); CMatrix_Padded * pCamMatrix = &this->GetInterface()->m_cameraMatrix; // ->Placeable.matrix; if ( pCamMatrix ) { memcpy(&matrix->vFront, &pCamMatrix->vFront, sizeof(CVector)); memcpy(&matrix->vPos, &pCamMatrix->vPos, sizeof(CVector)); memcpy(&matrix->vUp, &pCamMatrix->vUp, sizeof(CVector)); memcpy(&matrix->vRight, &pCamMatrix->vRight, sizeof(CVector)); } else { memset(matrix, 0, sizeof(CMatrix)); } return matrix; }
/** * \todo Fix: doesn't work */ VOID CHudSA::SetVehicleName( char * szName ) { DEBUG_TRACE("VOID CHudSA::SetVehicleName( char * szName )"); char * szVehicleNamePtr = (char *)VAR_VehicleNamePtr; if(szName != 0) { // wchar_t szHelp[255] = {'\0'}; //MultiByteToWideChar(CP_ACP, 0, szMessage, -1, szHelp, 255); if(strlen(szName) < 50) { strcpy(szVehicleName, szName); szVehicleNamePtr = szVehicleName; } } else { *(DWORD *)VAR_VehicleNamePtr = 0; } }
CTaskSimpleStealthKillSA::CTaskSimpleStealthKillSA ( bool bKiller, CPed * pPed, const AssocGroupId animGroup ) { DEBUG_TRACE("CTaskSimpleStealthKillSA::CTaskSimpleStealthKillSA ( bool bKiller, class CPed * pPed, const AssocGroupId animGroup )"); // TODO: Find out the real size this->CreateTaskInterface ( 1024 ); DWORD dwFunc = FUNC_CTaskSimpleStealthKill__Constructor; DWORD dwThisInterface = (DWORD)this->GetInterface (); DWORD dwPedInterface = (DWORD)pPed->GetPedInterface (); _asm { mov ecx, dwThisInterface push animGroup push dwPedInterface push bKiller call dwFunc } }
/** * Checks if the door is completely open * @return BOOL TRUE if the door is fully opened, FALSE if it is opening, is closed or is missing. * \todo Check what this returns if the door has been ripped off */ BOOL CDoorSA::IsFullyOpen ( ) { DEBUG_TRACE("BOOL CDoorSA::IsFullyOpen ( )"); DWORD dwFunction = FUNC_IsFullyOpen; DWORD dwPointer = (DWORD)GetInterface(); BYTE bReturn = 0; if ( dwPointer != 0 ) { _asm { mov ecx, dwPointer call dwFunction mov bReturn, al } } return bReturn; }
/* * ecm_state_char_dev_protocol_count_msg_prep() * Generate a protocol usage message */ static bool ecm_state_char_dev_protocol_count_msg_prep(struct ecm_state_file_instance *sfi) { int result; int count; DEBUG_TRACE("%p: Prep protocol msg\n", sfi); /* * Get protocol connection total count */ count = ecm_db_connection_count_by_protocol_get(sfi->protocol); if ((result = ecm_state_write_reset(sfi, "protocol"))) { return result; } if ((result = ecm_state_prefix_index_add(sfi, sfi->protocol))) { return result; } return ecm_state_write(sfi, "connections", "%d", count); }
CTaskComplexSunbatheSA::CTaskComplexSunbatheSA ( CObject* pTowel, const bool bStartStanding ) { DEBUG_TRACE("CTaskComplexSunbatheSA::CTaskComplexSunbatheSA ( CObject* pTowel, const bool bStartStanding )"); // TODO: Find out the real size this->CreateTaskInterface ( 1024 ); DWORD dwFunc = FUNC_CTaskComplexSunbathe__Constructor; DWORD dwThisInterface = (DWORD)this->GetInterface (); DWORD dwObjectInterface = 0; if ( pTowel ) dwObjectInterface = (DWORD)pTowel->GetObjectInterface (); _asm { mov ecx, dwThisInterface push bStartStanding push dwObjectInterface; call dwFunc } }