CQueuedPacketSender::Run
0x001ca7d0 · 405 bytes · __thiscall
_ZN19CQueuedPacketSender3RunEv
Decompiled
undefined (1 param)
/* CQueuedPacketSender::Run() */
undefined4 __thiscall CQueuedPacketSender::Run(CQueuedPacketSender *this)
{
pthread_mutex_t *__mutex;
uint *puVar1;
char cVar2;
uint uVar3;
sockaddr *psVar4;
int iVar5;
bool bVar6;
longdouble lVar7;
pthread_mutex_t *ppVar8;
iVar5 = 0x32;
__mutex = (pthread_mutex_t *)(this + 0xcc);
do {
cVar2 = CThreadEvent::Wait((uint)(this + 0xf0));
if ((cVar2 != '\0') && (this[0x144] != (CQueuedPacketSender)0x0)) {
return 0;
}
ppVar8 = __mutex;
pthread_mutex_lock(__mutex);
/* try { // try from 001ca82d to 001ca963 has its CatchHandler @ 001ca970 */
uVar3 = Plat_MSTime(ppVar8,iVar5);
bVar6 = *(int *)(net_queue_trace._28_4_ + 0x30) == 0x8deb8;
while (0 < *(int *)(this + 0xc0)) {
puVar1 = (uint *)**(undefined4 **)(this + 0xb4);
if (uVar3 < *puVar1) {
iVar5 = *puVar1 - uVar3;
if (bVar6) {
lVar7 = (longdouble)Plat_FloatTime();
Warning("SQ: sleeping for %u msecs at %f\n",iVar5,(double)lVar7);
}
goto LAB_001ca92b;
}
psVar4 = (sockaddr *)puVar1[3];
if ((*(int *)(psVar4->sa_data + 2) != 0) && (*(short *)psVar4->sa_data != 0)) {
if (bVar6) {
lVar7 = (longdouble)Plat_FloatTime();
Warning("SQ: sending %d bytes at %f\n",puVar1[0xb],(double)lVar7);
psVar4 = (sockaddr *)puVar1[3];
}
NET_SendToImpl(puVar1[2],(char *)puVar1[8],puVar1[0xb],psVar4,puVar1[6],-1);
}
puVar1[0xb] = 0;
CUtlMemory<char,int>::Purge((CUtlMemory<char,int> *)(puVar1 + 8));
puVar1[0xc] = puVar1[8];
CUtlMemory<char,int>::Purge((CUtlMemory<char,int> *)(puVar1 + 8));
puVar1[6] = 0;
CUtlMemory<char,int>::Purge((CUtlMemory<char,int> *)(puVar1 + 3));
puVar1[7] = puVar1[3];
CUtlMemory<char,int>::Purge((CUtlMemory<char,int> *)(puVar1 + 3));
operator_delete(puVar1);
CUtlPriorityQueue<CQueuedPacketSender::CQueuedPacket*,CDefUtlPriorityQueueLessFunc<CQueuedPacketSender::CQueuedPacket*>,CUtlMemory<CQueuedPacketSender::CQueuedPacket*,int>>
::RemoveAtHead((CUtlPriorityQueue<CQueuedPacketSender::CQueuedPacket*,CDefUtlPriorityQueueLessFunc<CQueuedPacketSender::CQueuedPacket*>,CUtlMemory<CQueuedPacketSender::CQueuedPacket*,int>>
*)(this + 0xb4));
}
iVar5 = 0x32;
LAB_001ca92b:
pthread_mutex_unlock(__mutex);
} while( true );
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.