// // lws_create_context from 0x8594dc to 0x85977a (670 bytes) // // 1 xrefs: // > cocos2d::extension::WebSocket::onSubThreadStarted @ 0x7b3288 // // 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:02:38 +0000 // int __fastcall lws_create_context(int *a1) { int v2; // r0 int v3; // r7 int result; // r0 int v5; // r0 int v6; // r4 int v7; // r3 int v8; // r7 __int16 v9; // r3 int v10; // r2 __int16 v11; // r3 int v12; // r1 int v13; // r0 int v14; // r0 int v15; // r7 int v16; // r1 int v17; // r3 int v18; // r0 char *v19; // r1 int v20; // r3 int *v21; // r8 int v22; // r9 void (__fastcall *v23)(_DWORD *, int, _DWORD, _DWORD, _DWORD); // r4 int v24; // r3 char *v25; // r0 _DWORD v26[68]; // [sp+Ch] [bp-110h] BYREF lws_log(4, "Initial logging level %d\n", dword_D200C4); lws_log(4, "Libwebsockets version: %s\n", "1.6.0 3ca4bac"); if ( (a1[14] & 0x20) != 0 ) lws_log(4, "IPV6 compiled in but disabled\n"); else lws_log(4, "IPV6 compiled in and enabled\n"); v2 = lws_log(4, "libev support not compiled in\n"); v3 = lws_plat_context_early_init(v2); result = 0; if ( !v3 ) { v5 = sub_8597D0(4632); v6 = v5; if ( !v5 ) { lws_log(1, "No memory for websocket context\n"); return 0; } *(_DWORD *)(v5 + 4580) = 0; *(_DWORD *)(v5 + 44) = a1[2]; *(_DWORD *)(v5 + 36) = a1[4]; v7 = *a1; *(_DWORD *)(v5 + 4584) = 0; *(_BYTE *)(v5 + 4164) = 0; *(_DWORD *)(v5 + 4560) = v7; *(_DWORD *)(v5 + 4588) = a1[14]; *(_DWORD *)(v5 + 32) = a1[1]; *(_DWORD *)(v5 + 4612) = a1[16]; *(_DWORD *)(v5 + 4620) = a1[18]; *(_DWORD *)(v5 + 4616) = a1[17]; memset(v26, 0, 0x10Cu); v8 = a1[18]; v26[46] = v6; if ( !v8 && a1[16] > 0 ) { lws_log(1, "info->ka_interval can't be 0 if ka_time used\n"); return 0; } v9 = *((_WORD *)a1 + 40); v10 = v9; if ( !v9 ) { v10 = 1024; v9 = 1024; } *(_WORD *)(v6 + 4624) = v9; v11 = *((_WORD *)a1 + 41); v12 = v11; if ( !v11 ) { v12 = 16; v11 = 16; } *(_WORD *)(v6 + 4626) = v11; v13 = sub_8597C4(0, v12 * v10); *(_DWORD *)(v6 + 48) = v13; if ( !v13 ) goto LABEL_33; v14 = sub_8597D0(1108 * *(__int16 *)(v6 + 4626)); *(_DWORD *)(v6 + 52) = v14; if ( !v14 ) goto LABEL_33; if ( *(__int16 *)(v6 + 4626) > 0 ) { v15 = 0; v16 = 0; while ( 1 ) { v17 = *(_DWORD *)(v6 + 48) + v16 * *(__int16 *)(v6 + 4624); ++v16; *(_DWORD *)(v14 + v15) = v17; v15 += 1108; if ( *(__int16 *)(v6 + 4626) <= v16 ) break; v14 = *(_DWORD *)(v6 + 52); } } *(_DWORD *)(v6 + 4556) = 1024; v18 = sub_8597D0(0x2000); *(_DWORD *)(v6 + 24) = v18; if ( !v18 ) { lws_log(1, "OOM allocating %d fds\n", *(_DWORD *)(v6 + 4556)); goto LABEL_33; } if ( lws_plat_init(v6, a1) ) { LABEL_33: lws_context_destroy(v6); return 0; } lws_context_init_extensions(a1, v6); *(_DWORD *)(v6 + 40) = a1[15]; lws_log(4, " mem: per-conn: %5u bytes + protocol rx buf\n", 268); strcpy((char *)(v6 + 4420), "unknown"); v19 = (char *)a1[10]; if ( v19 ) { v20 = a1[11]; if ( v20 ) { *(_DWORD *)(v6 + 4584) = v20; v19 = (char *)a1[10]; } } else { v25 = getenv("http_proxy"); if ( !v25 ) { LABEL_23: v21 = (int *)(v6 + 4608); lws_plat_drop_app_privileges(a1); *(_DWORD *)(v6 + 4608) = 0; if ( *(_DWORD *)(a1[2] + 4) ) { v22 = v6; v23 = *(void (__fastcall **)(_DWORD *, int, _DWORD, _DWORD, _DWORD))(a1[2] + 4); do { v23(v26, 27, 0, 0, 0); v24 = *v21 + 1; *v21 = v24; v23 = *(void (__fastcall **)(_DWORD *, int, _DWORD, _DWORD, _DWORD))(a1[2] + 24 * v24 + 4); } while ( v23 ); v6 = v22; } if ( *a1 == -1 ) { if ( sub_85C798(v6, 0, 1) >= 0 ) return v6; } else if ( sub_85C798(v6, 0, 0) >= 0 ) { return v6; } goto LABEL_33; } v19 = v25; } lws_set_proxy(v6, v19); goto LABEL_23; } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source