//
// lws_plat_init from 0xbc2ce4 to 0xbc2e08 (292 bytes)
//
// 2 xrefs:
// > lws_create_context @ 0xbbf6a4
// > ??> @ 0xb1948
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall lws_plat_init(__int64 a1)
{
void *v2; // x0
int v3; // w3
__int64 result; // x0
_DWORD *v5; // x1
v2 = sub_BBF8A8(8LL * *(int *)(a1 + 20));
*(_QWORD *)(a1 + 8) = v2;
if ( v2 )
{
v3 = open("/dev/urandom", 0);
*(_DWORD *)(a1 + 4540) = v3;
if ( v3 < 0 )
{
lws_log(1, "Unable to open random device %s %d\n", "/dev/urandom", v3);
return 1;
}
else
{
result = pipe((int *)(a1 + 4564));
if ( (_DWORD)result )
{
lws_log(1, "Unable to create pipe\n");
return 1;
}
else
{
v5 = *(_DWORD **)a1;
*v5 = *(_DWORD *)(a1 + 4564);
v5[1] = 1;
*(_DWORD *)(a1 + 16) = 1;
*(_QWORD *)(a1 + 4624) = sub_BC2620;
*(_QWORD *)(a1 + 4632) = sub_BC2608;
*(_QWORD *)(a1 + 4640) = sub_BC2610;
*(_QWORD *)(a1 + 4648) = sub_BC2588;
*(_QWORD *)(a1 + 4656) = sub_BC25C8;
}
}
}
else
{
lws_log(1, "Unable to allocate lws_lookup array for %d connections\n", *(_DWORD *)(a1 + 20));
return 1;
}
return result;
}