// // cocos2d::extension::WebSocket::init from 0x7b335c to 0x7b373a (990 bytes) // // 0 xrefs: // // 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 // bool __fastcall cocos2d::extension::WebSocket::init(int a1, int a2, int a3, _DWORD *a4) { int v7; // r0 unsigned int v8; // r1 unsigned __int8 *v9; // r2 int v10; // r3 unsigned __int8 *v11; // r8 unsigned int v12; // r3 unsigned __int8 *v13; // r4 unsigned __int8 *v14; // r8 unsigned int v15; // r3 unsigned __int8 *v16; // r4 int v17; // r4 unsigned __int8 *v18; // r8 int v19; // r3 int v20; // r8 unsigned __int8 *v21; // r10 size_t v22; // r3 const char *v23; // r0 int v24; // r11 unsigned __int8 *v25; // r10 unsigned int v26; // r3 int v27; // r10 size_t v28; // r3 char *v29; // r1 size_t v30; // r2 unsigned __int8 *v31; // r10 int v32; // r3 unsigned int v33; // r2 int v34; // r3 int v35; // r4 unsigned int v36; // r0 void *v37; // r0 int v38; // r4 int v39; // r11 int v40; // r0 int v41; // r0 char *v42; // r0 const char *v43; // r1 char *v44; // r0 int v45; // r2 char *v46; // r0 cocos2d::extension::WsThreadHelper *v47; // r4 _BOOL4 Thread; // r4 unsigned __int8 *v50; // [sp+14h] [bp-10h] unsigned __int8 *v51; // [sp+14h] [bp-10h] unsigned __int8 *v52[2]; // [sp+1Ch] [bp-8h] BYREF int v53; // [sp+24h] [bp+0h] BYREF unsigned int v54; // [sp+28h] [bp+4h] unsigned __int8 *v55; // [sp+2Ch] [bp+8h] int v56[3]; // [sp+30h] [bp+Ch] BYREF int v57[3]; // [sp+3Ch] [bp+18h] BYREF int v58[3]; // [sp+48h] [bp+24h] BYREF v53 = 0; v54 = 0; v55 = nullptr; if ( (*(_BYTE *)a3 & 1) != 0 ) { std::string::__init(&v53, *(const void **)(a3 + 8), *(_DWORD *)(a3 + 4)); } else { v7 = *(_DWORD *)a3; v8 = *(_DWORD *)(a3 + 4); v9 = *(unsigned __int8 **)(a3 + 8); v53 = v7; v54 = v8; v55 = v9; } v10 = (unsigned __int8)v53; *(_DWORD *)(a1 + 48) = a2; if ( (v10 & 1) != 0 ) { v11 = v55; v12 = v54; } else { v12 = v10 >> 1; v11 = (unsigned __int8 *)&v53 + 1; } if ( v12 > 4 ) { v13 = &v11[v12]; std::__search( v52, v11, &v11[v12], "ws://", (unsigned __int8 *)"", (int (__fastcall *)(int, _DWORD))std::char_traits::eq); if ( v52[0] != v13 && v52[0] == v11 ) std::string::erase((unsigned __int8 *)&v53, 0, 5u); } if ( (v53 & 1) != 0 ) { v14 = v55; v15 = v54; } else { v15 = (int)(unsigned __int8)v53 >> 1; v14 = (unsigned __int8 *)&v53 + 1; } if ( v15 <= 5 || (v16 = &v14[v15], std::__search( v52, v14, &v14[v15], "wss://", (unsigned __int8 *)"", (int (__fastcall *)(int, _DWORD))std::char_traits::eq), v52[0] == v16) || v52[0] != v14 ) { v17 = 0; } else { std::string::erase((unsigned __int8 *)&v53, 0, 6u); v17 = 1; } if ( (v53 & 1) != 0 ) { v18 = v55; v19 = v54; } else { v19 = (int)(unsigned __int8)v53 >> 1; v18 = (unsigned __int8 *)&v53 + 1; } if ( !v19 || (v21 = &v18[v19], std::__search( v52, v18, &v18[v19], ":", (unsigned __int8 *)"", (int (__fastcall *)(int, _DWORD))std::char_traits::eq), v52[0] == v21) ) { v20 = -1; LABEL_30: v24 = 80; goto LABEL_31; } v20 = v52[0] - v18; if ( v20 < 0 ) goto LABEL_30; if ( (v53 & 1) != 0 ) v22 = v54; else v22 = (int)(unsigned __int8)v53 >> 1; std::string::basic_string(v56, (unsigned __int8 *)&v53, v20 + 1, v22); if ( (v56[0] & 1) != 0 ) v23 = (const char *)v56[2]; else v23 = (char *)v56 + 1; v24 = atoi(v23); std::string::~string((int)v56); LABEL_31: if ( (v53 & 1) != 0 ) { v25 = v55; v26 = v54; } else { v26 = (int)(unsigned __int8)v53 >> 1; v25 = (unsigned __int8 *)&v53 + 1; } if ( v26 <= v20 || (v50 = &v25[v26], std::__search( v52, &v25[v20], &v25[v26], "/", (unsigned __int8 *)"", (int (__fastcall *)(int, _DWORD))std::char_traits::eq), v52[0] == v50) ) { v27 = -1; } else { v27 = v52[0] - v25; } memset(v57, 0, sizeof(v57)); std::string::__init(v57, "/", 1u); if ( v27 >= 0 ) { if ( (v53 & 1) != 0 ) v28 = v54; else v28 = (int)(unsigned __int8)v53 >> 1; std::string::basic_string(v58, (unsigned __int8 *)&v53, v27 + 1, v28); if ( (v58[0] & 1) != 0 ) { v29 = (char *)v58[2]; v30 = v58[1]; } else { v30 = (int)LOBYTE(v58[0]) >> 1; v29 = (char *)v58 + 1; } std::string::append(v57, v29, v30); std::string::~string((int)v58); } if ( (v53 & 1) != 0 ) { v31 = v55; v32 = v54; } else { v32 = (int)(unsigned __int8)v53 >> 1; v31 = (unsigned __int8 *)&v53 + 1; } if ( v32 ) { v51 = &v31[v32]; std::__search( v52, v31, &v31[v32], ":", (unsigned __int8 *)"", (int (__fastcall *)(int, _DWORD))std::char_traits::eq); if ( v52[0] != v51 && v52[0] - v31 >= 0 ) { if ( (v53 & 1) != 0 ) v33 = v54; else v33 = (int)(unsigned __int8)v53 >> 1; std::string::erase((unsigned __int8 *)&v53, v52[0] - v31, v33); } } std::string::operator=((unsigned __int8 *)(a1 + 8), (unsigned __int8 *)&v53); *(_DWORD *)(a1 + 20) = v24; std::string::operator=((unsigned __int8 *)(a1 + 24), (unsigned __int8 *)v57); *(_DWORD *)(a1 + 52) = v17; if ( a4 ) { v34 = -1431655765 * ((a4[1] - *a4) >> 2); if ( !v34 ) v34 = 1; } else { v34 = 1; } v35 = v34 + 1; if ( (unsigned int)(v34 + 1) > 0x5500000 ) v36 = -1; else v36 = 24; if ( (unsigned int)(v34 + 1) <= 0x5500000 ) v36 *= v35; v37 = (void *)operator new[](v36); *(_DWORD *)(a1 + 56) = v37; memset(v37, 0, 24 * v35); if ( a4 ) { v38 = *a4 + 1; v39 = 0x7FFFFFFF * *a4 + 0x7FFFFFFF; while ( a4[1] != v38 - 1 ) { v40 = *(unsigned __int8 *)(v38 - 1); if ( (v40 & 1) != 0 ) v41 = *(_DWORD *)(v38 + 3); else v41 = v40 >> 1; v42 = (char *)operator new[](v41 + 1); if ( (*(_BYTE *)(v38 - 1) & 1) != 0 ) v43 = *(const char **)(v38 + 7); else v43 = (const char *)v38; v44 = strcpy(v42, v43); v45 = v39 + v38; v38 += 12; *(_DWORD *)(*(_DWORD *)(a1 + 56) + 2 * v45) = v44; *(_DWORD *)(*(_DWORD *)(a1 + 56) + 2 * v45 + 4) = cocos2d::extension::WebSocketCallbackWrapper::onSocketCallback; } } else { v46 = (char *)operator new[](0x14u); **(_DWORD **)(a1 + 56) = strcpy(v46, "default-protocol"); *(_DWORD *)(*(_DWORD *)(a1 + 56) + 4) = cocos2d::extension::WebSocketCallbackWrapper::onSocketCallback; } v47 = (cocos2d::extension::WsThreadHelper *)operator new(0x50u); cocos2d::extension::WsThreadHelper::WsThreadHelper(v47); *(_DWORD *)(a1 + 36) = v47; Thread = cocos2d::extension::WsThreadHelper::createThread(v47, (const cocos2d::extension::WebSocket *)a1); std::string::~string((int)v57); std::string::~string((int)&v53); return Thread; }
GD Web Decomp Icon

GD Web Decomp

Raw Source