bool CParaNdisTX::DoPendingTasks(bool IsInterrupt)
{
    PNET_BUFFER_LIST pNBLReturnNow = nullptr;
    bool bDoKick = false;

    DoWithTXLock([&] ()
                 {
                    m_VirtQueue.ProcessTXCompletions();
                    bDoKick = SendMapped(IsInterrupt);
                    pNBLReturnNow = ProcessWaitingList();
                 });

    if (pNBLReturnNow)
    {
        CompleteOutstandingNBLChain(pNBLReturnNow, NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL);
    }
#pragma warning(pop)

    return bDoKick;
}
bool CParaNdisTX::DoPendingTasks(bool IsInterrupt)
{
    ONPAUSECOMPLETEPROC CallbackToCall = nullptr;
    PNET_BUFFER_LIST pNBLFailNow = nullptr;
    PNET_BUFFER_LIST pNBLReturnNow = nullptr;
    bool bDoKick = false;

    DoWithTXLock([&] ()
                 {
                    m_VirtQueue.ProcessTXCompletions();
                    bDoKick = SendMapped(IsInterrupt, pNBLFailNow);
                    pNBLReturnNow = ProcessWaitingList();

                    if (!m_VirtQueue.HasPacketsInHW() && m_Context->SendState == srsPausing)
                    {
                        CallbackToCall = m_Context->SendPauseCompletionProc;
                        m_Context->SendPauseCompletionProc = nullptr;
                        m_Context->SendState = srsDisabled;
                    }
                 });

    if (pNBLFailNow)
    {
        NdisMSendNetBufferListsComplete(m_Context->MiniportHandle, pNBLFailNow,
                                        NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL);
    }

    if (pNBLReturnNow)
    {
        NdisMSendNetBufferListsComplete(m_Context->MiniportHandle, pNBLReturnNow,
                                        NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL);
    }

    if (CallbackToCall != nullptr)
    {
        CallbackToCall(m_Context);
    }

    return bDoKick;
}
예제 #3
0
void CVehiclePool::Process()
{
	// Process all vehicles in the vehicle pool.
	CVehicle *pVehicle;
	DWORD dwThisTime = GetTickCount();
	
	CPlayerPool* pPlayerPool = pNetGame->GetPlayerPool();
	CLocalPlayer* pLocalPlayer = pPlayerPool->GetLocalPlayer();

	int iLocalPlayersInRange = 0;
	if (pLocalPlayer)
		iLocalPlayersInRange = pLocalPlayer->DetermineNumberOfPlayersInLocalRange();

	ProcessWaitingList();

	for(VEHICLEID x = 0; x != MAX_VEHICLES; x++)
	{
		if(GetSlotState(x) == TRUE)
		{
			// It's in use.
			pVehicle = m_pVehicles[x];

			if(m_bIsActive[x])
			{
				if(pVehicle->IsDriverLocalPlayer()) {
					pVehicle->SetInvulnerable(FALSE);
				} else {
					pVehicle->SetInvulnerable(TRUE);
				}

				if (pVehicle->GetHealth() == 0.0f) // || pVehicle->IsWrecked()) // It's dead
				{
					if (pLocalPlayer->m_LastVehicle == x) // Notify server of death
					{
						NotifyVehicleDeath(x);
					}
					continue;
				}
	
				if( pVehicle->GetVehicleSubtype() != VEHICLE_SUBTYPE_BOAT &&
					pVehicle->HasSunk() ) // Not boat and has sunk.
				{
					if (pLocalPlayer->m_LastVehicle == x) {
						NotifyVehicleDeath(x);
					}
					continue;
				}
									
				// Active and in world.
				pLocalPlayer->ProcessUndrivenSync(x, pVehicle, iLocalPlayersInRange); // sync unoccupied vehicle if needed

				/* This has an impact on undriven passenger sync. check for driver instead 
				// Kye: This the source of the audio bug?
				if(!pVehicle->IsOccupied()) {
					pVehicle->SetEngineState(FALSE);
				} else {
					pVehicle->SetEngineState(TRUE);
				}*/

				// Update the actual ingame pointer if it's not the same as the one we have listed.
				if(pVehicle->m_pVehicle != m_pGTAVehicles[x]) {
					m_pGTAVehicles[x] = pVehicle->m_pVehicle;
				}

				pVehicle->ProcessMarkers();
			}
		}
	}
}