//
// cocos2d::extension::WebSocket::onSubThreadStarted from 0xd20028 to 0xd20210 (488 bytes)
//
// 2 xrefs:
// > ??> @ 0x418f0
// > ??> @ 0x15108b0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:07:11 +0000
//
__int64 __fastcall cocos2d::extension::WebSocket::onSubThreadStarted(cocos2d::extension::WebSocket *this)
{
__int64 v2; // x3
__int64 context; // x0
__int64 v4; // x6
__int64 v5; // x0
__int64 v6; // x19
size_t v7; // x0
char *v8; // x1
char *v9; // x4
char *v10; // x5
char *v11; // x7
__int64 v12; // x0
char v13; // w1
char *v15; // [xsp+58h] [xbp+48h]
_QWORD v16[2]; // [xsp+60h] [xbp+50h] BYREF
void *v17; // [xsp+70h] [xbp+60h]
_QWORD v18[12]; // [xsp+78h] [xbp+68h] BYREF
__int64 v19; // [xsp+D8h] [xbp+C8h]
cocos2d::extension::WebSocket *v20; // [xsp+E0h] [xbp+D0h]
__int64 v21; // [xsp+E8h] [xbp+D8h]
__int64 v22; // [xsp+F0h] [xbp+E0h]
__int64 v23; // [xsp+F8h] [xbp+E8h]
__int64 v24; // [xsp+100h] [xbp+F0h]
__int64 v25; // [xsp+108h] [xbp+F8h]
__int64 v26; // [xsp+110h] [xbp+100h]
__int64 v27; // [xsp+118h] [xbp+108h]
__int64 v28; // [xsp+120h] [xbp+110h]
__int64 v29; // [xsp+128h] [xbp+118h]
__int64 v30; // [xsp+130h] [xbp+120h]
__int64 v31; // [xsp+138h] [xbp+128h]
__int64 v32; // [xsp+140h] [xbp+130h]
v19 = 0;
v20 = nullptr;
v18[0] = 0;
v18[1] = 0;
v2 = *((_QWORD *)this + 14);
memset(&v18[3], 0, 64);
v18[11] = 0xFFFFFFFF00000000LL;
v21 = 0;
v22 = 0;
v23 = 0;
v24 = 0;
v25 = 0;
v26 = 0;
v27 = 0;
v28 = 0;
v29 = 0;
v30 = 0;
v31 = 0;
v32 = 0;
LODWORD(v18[0]) = -1;
v18[2] = v2;
LODWORD(v19) = -1;
v20 = this;
context = lws_create_context(v18);
*((_QWORD *)this + 11) = context;
v4 = context;
if ( context )
{
v5 = *((_QWORD *)this + 14);
*((_DWORD *)this + 2) = 0;
v16[1] = 0;
v17 = nullptr;
v16[0] = 0;
if ( *(_QWORD *)(v5 + 8) )
{
v6 = 48;
do
{
v15 = *(char **)v5;
v7 = strlen(*(const char **)v5);
std::string::append((__int64)v16, v15, v7);
v5 = *((_QWORD *)this + 14) + v6;
if ( *(_QWORD *)(v5 + 8) )
{
std::string::append((__int64)v16, ", ", 2u);
v5 = *((_QWORD *)this + 14) + v6;
}
v6 += 48;
}
while ( *(_QWORD *)(v5 + 8) );
v4 = *((_QWORD *)this + 11);
}
v8 = (char *)this + 17;
if ( (*((_BYTE *)this + 16) & 1) != 0 )
v8 = *((char **)this + 4);
v9 = (char *)this + 49;
if ( (*((_BYTE *)this + 48) & 1) != 0 )
v9 = *((char **)this + 8);
v10 = (char *)this + 17;
if ( (*((_BYTE *)this + 16) & 1) != 0 )
v10 = *((char **)this + 4);
v11 = (char *)v16 + 1;
if ( (v16[0] & 1) != 0 )
v11 = (char *)v17;
v12 = lws_client_connect(v4, v8, *((unsigned int *)this + 10), *((unsigned int *)this + 26), v9, v10, v10, v11, -1);
v13 = v16[0];
*((_QWORD *)this + 10) = v12;
if ( (v13 & 1) != 0 )
operator delete(v17);
}
return _stack_chk_guard;
}