//
// lws_plat_init from 0x64c330 to 0x64c3e4 (180 bytes)
//
// 1 xrefs:
// > lws_create_context @ 0x6495d6
//
// 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
//
int __fastcall lws_plat_init(int a1)
{
void *v2; // r0
int v3; // r2
int v4; // r0
int result; // r0
v2 = sub_649750(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_64BE2C;
*(_DWORD *)(a1 + 8) = sub_64BE18;
*(_DWORD *)(a1 + 12) = sub_64BE20;
*(_DWORD *)(a1 + 16) = sub_64BDD8;
*(_DWORD *)(a1 + 20) = sub_64BDF8;
}
}
}
else
{
lws_log(1, "Unable to allocate lws_lookup array for %d connections\n", v3);
return 1;
}
return result;
}