//
// lws_plat_init from 0x85c3b0 to 0x85c464 (180 bytes)
//
// 1 xrefs:
// > lws_create_context @ 0x859656
//
// 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:40 +0000
//
int __fastcall lws_plat_init(int a1)
{
void *v2; // r0
int v3; // r2
int v4; // r0
int result; // r0
v2 = sub_8597D0(4 * *(_DWORD *)(a1 + 4556));
*(_DWORD *)(a1 + 28) = v2;
v3 = *(_DWORD *)(a1 + 4556);
if ( v2 )
{
lws_log(4, " mem: platform fd map: %5u bytes\n", 4 * v3);
v4 = open("/dev/urandom", 0);
*(_DWORD *)(a1 + 4568) = v4;
if ( v4 < 0 )
{
lws_log(1, "Unable to open random device %s %d\n", "/dev/urandom", v4);
return 1;
}
else
{
result = pipe((int *)(a1 + 4600));
if ( result )
{
lws_log(1, "Unable to create pipe\n");
return 1;
}
else
{
**(_DWORD **)(a1 + 24) = *(_DWORD *)(a1 + 4600);
*(_WORD *)(*(_DWORD *)(a1 + 24) + 4) = 1;
*(_WORD *)(*(_DWORD *)(a1 + 24) + 6) = 0;
*(_DWORD *)(a1 + 4552) = 1;
*(_DWORD *)(a1 + 4) = sub_85BEAC;
*(_DWORD *)(a1 + 8) = sub_85BE98;
*(_DWORD *)(a1 + 12) = sub_85BEA0;
*(_DWORD *)(a1 + 16) = sub_85BE58;
*(_DWORD *)(a1 + 20) = sub_85BE78;
}
}
}
else
{
lws_log(1, "Unable to allocate lws_lookup array for %d connections\n", v3);
return 1;
}
return result;
}