//
// sub_81F940 from 0x81f940 to 0x81fa00 (192 bytes)
//
// 0 xrefs:
//
// 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:01:49 +0000
//
int __fastcall sub_81F940(int *a1, _BYTE *a2)
{
int v2; // r5
void **v5; // r9
int result; // r0
void *v7; // r10
int v8; // r0
int v9; // r5
int v10; // r0
void *v11; // [sp+8h] [bp-8h] BYREF
size_t v12; // [sp+Ch] [bp-4h] BYREF
v2 = *a1;
v5 = *(void ***)(*a1 + 332);
result = sub_833E74(*a1, *(char **)(*a1 + 34676), 0, (int)&v11, (int)&v12, 0);
if ( !result )
{
v7 = v11;
if ( memchr(v11, 0, v12) )
{
off_D200B0(v7);
return 3;
}
else
{
v8 = open((const char *)v7, 0);
*v5 = v11;
v5[1] = v11;
v5[2] = (void *)v8;
if ( __PAIR64__(*(unsigned __int8 *)(v2 + 905), v8 + 1) )
{
*a2 = 1;
return 0;
}
else
{
sub_828178(v2, "Couldn't open file %s", *(const char **)(v2 + 34676));
result = 37;
v9 = *(_DWORD *)(*a1 + 332);
if ( v9 )
{
off_D200B0(*(void **)(v9 + 4));
v10 = *(_DWORD *)(v9 + 8);
*(_DWORD *)(v9 + 4) = 0;
*(_DWORD *)v9 = 0;
if ( v10 != -1 )
close(v10);
*(_DWORD *)(v9 + 8) = -1;
return 37;
}
}
}
}
return result;
}