//
// SFXFolderObject::init from 0x82e2a0 to 0x82e3cc (300 bytes)
//
// 2 xrefs:
// > SFXFolderObject::create @ 0x82e46c
// > ??> @ 0xa1688
//
// 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 SFXFolderObject::init(__int64 a1, int a2, __int64 a3, int a4)
{
unsigned int v6; // w22
void *v7; // x0
cocos2d::CCObject *v8; // x0
unsigned int *v10; // x2
int v11; // w1
__int64 v13; // [xsp+50h] [xbp+50h] BYREF
sub_D18D28(&v13);
v6 = (unsigned __int8)SFXInfoObject::init(a1, a2, (__int64)&v13, a4, 0, 0);
v7 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v13 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v13 - 8);
*(_DWORD *)(v13 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v7);
}
if ( v6 )
{
*(_BYTE *)(a1 + 72) = (unsigned __int8)&dword_0 + 1;
v8 = (cocos2d::CCObject *)cocos2d::CCArray::create((cocos2d::CCArray *)((char *)&dword_0 + 1));
*(_QWORD *)(a1 + 88) = v8;
cocos2d::CCObject::retain(v8);
}
return v6;
}