//
// lws_plat_init from 0xe38ea4 to 0xe38fc8 (292 bytes)
//
// 2 xrefs:
// > lws_create_context @ 0xe35864
// > ??> @ 0xe8558
//
// 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:09:59 +0000
//
__int64 __fastcall lws_plat_init(__int64 a1)
{
void *v2; // x0
int v3; // w3
__int64 result; // x0
_DWORD *v5; // x1
v2 = sub_E35A68(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_E387E0;
*(_QWORD *)(a1 + 4632) = sub_E387C8;
*(_QWORD *)(a1 + 4640) = sub_E387D0;
*(_QWORD *)(a1 + 4648) = sub_E38748;
*(_QWORD *)(a1 + 4656) = sub_E38788;
}
}
}
else
{
lws_log(1, "Unable to allocate lws_lookup array for %d connections\n", *(_DWORD *)(a1 + 20));
return 1;
}
return result;
}