//
// cocos2d::extension::WebSocket::onSocketCallback from 0x7b2f7e to 0x7b3142 (452 bytes)
//
// 1 xrefs:
// > cocos2d::extension::WebSocketCallbackWrapper::onSocketCallback @ 0x7b3162
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:00:09 +0000
//
int __fastcall cocos2d::extension::WebSocket::onSocketCallback(
int a1,
int a2,
unsigned int a3,
int a4,
const void *a5,
unsigned int a6)
{
int v8; // r3
int *i; // r6
_DWORD *v10; // r1
_DWORD *v11; // r5
int v12; // r0
int *v13; // r7
int v14; // r5
int v15; // r0
void *v16; // r11
void *v17; // r9
int v18; // r3
_DWORD *v19; // r7
int v20; // r0
int v21; // r5
_BYTE *v22; // r0
_BYTE *v23; // r3
void *v24; // r0
if ( a3 == 8 )
{
if ( a5 && a6 )
{
v19 = (_DWORD *)operator new(8u);
*v19 = 3;
v19[1] = 0;
v20 = operator new(0xCu);
*(_DWORD *)v20 = 0;
v21 = v20;
*(_DWORD *)(v20 + 4) = 0;
*(_BYTE *)(v20 + 8) = 0;
if ( lws_frame_is_binary(a2) )
{
v22 = (_BYTE *)operator new[](a6);
*(_BYTE *)(v21 + 8) = 1;
v23 = v22;
}
else
{
v23 = (_BYTE *)operator new[](a6 + 1);
v23[a6] = 0;
*(_BYTE *)(v21 + 8) = 0;
}
v24 = memcpy(v23, a5, a6);
v10 = v19;
*(_DWORD *)v21 = v24;
*(_DWORD *)(v21 + 4) = a6;
v19[1] = v21;
v12 = *(_DWORD *)(a1 + 36);
goto LABEL_41;
}
return 0;
}
if ( a3 <= 8 )
{
if ( a3 == 3 )
{
v11 = (_DWORD *)operator new(8u);
*v11 = 2;
v11[1] = 0;
*(_DWORD *)(a1 + 4) = 1;
lws_callback_on_writable(a2);
v12 = *(_DWORD *)(a1 + 36);
v10 = v11;
LABEL_41:
cocos2d::extension::WsThreadHelper::sendMessageToUIThread(v12, (int)v10);
return 0;
}
if ( a3 != 4 )
{
if ( a3 == 1 )
goto LABEL_15;
return 0;
}
cocos2d::extension::WsThreadHelper::quitSubThread(*(_DWORD *)(a1 + 36));
if ( *(_DWORD *)(a1 + 4) == 3 )
return 0;
v10 = (_DWORD *)operator new(8u);
v10[1] = 0;
*(_DWORD *)(a1 + 4) = 3;
LABEL_33:
*v10 = 5;
goto LABEL_40;
}
if ( a3 != 28 )
{
if ( a3 == 33 )
{
if ( !*(_DWORD *)(a1 + 4) )
goto LABEL_15;
}
else if ( a3 == 10 )
{
pthread_mutex_lock((pthread_mutex_t *)(*(_DWORD *)(a1 + 36) + 64));
for ( i = *(int **)(*(_DWORD *)(*(_DWORD *)(a1 + 36) + 56) + 4);
i != *(int **)(*(_DWORD *)(a1 + 36) + 56);
i = (int *)i[1] )
{
v13 = (int *)i[2];
if ( (unsigned int)*v13 <= 1 )
{
v14 = v13[1];
v15 = operator new[](*(_DWORD *)(v14 + 4) + 16);
v16 = (void *)(v15 + 16);
v17 = (void *)v15;
memset((void *)(v15 + 16), 0, *(_DWORD *)(v14 + 4));
memcpy(v16, *(const void **)v14, *(_DWORD *)(v14 + 4));
v18 = *v13;
if ( *v13 )
v18 = 1;
lws_write(a2, v16, *(_DWORD *)(v14 + 4), v18);
if ( *(_DWORD *)v14 )
{
operator delete[](*(void **)v14);
*(_DWORD *)v14 = 0;
}
operator delete((void *)v14);
operator delete[](v17);
}
operator delete(v13);
}
if ( i[2] )
sub_7B2C94(i);
pthread_mutex_unlock((pthread_mutex_t *)(*(_DWORD *)(a1 + 36) + 64));
lws_callback_on_writable(a2);
}
return 0;
}
v8 = *(_DWORD *)(a1 + 4);
if ( !v8 )
{
LABEL_15:
v10 = (_DWORD *)operator new(8u);
*v10 = 4;
v10[1] = 0;
*(_DWORD *)(a1 + 4) = 2;
LABEL_40:
v12 = *(_DWORD *)(a1 + 36);
goto LABEL_41;
}
if ( v8 == 2 )
{
v10 = (_DWORD *)operator new(8u);
v10[1] = 0;
goto LABEL_33;
}
return 0;
}