//
// AudioEffectsLayer::init from 0x8b8984 to 0x8b8dd0 (1100 bytes)
//
// 2 xrefs:
// > AudioEffectsLayer::create @ 0x8b8ea4
// > ??> @ 0xd60a8
//
// 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 12:56:26 +0000
//
__int64 __fastcall AudioEffectsLayer::init(AudioEffectsLayer *a1, __int64 a2)
{
unsigned __int8 v4; // w0
unsigned int v5; // w28
const char *v6; // x1
size_t v7; // x0
cocos2d::CCArray *v8; // x0
__int64 v9; // x0
unsigned __int8 v10; // w2
cocos2d::CCArray *v11; // x25
unsigned __int64 v12; // x24
_BYTE *v13; // x19
__int64 v14; // x22
unsigned __int64 v15; // x19
size_t v16; // x3
unsigned __int64 v17; // x2
char *i; // x1
size_t v19; // x2
char *v20; // x1
int v21; // w1
const char *v22; // x1
size_t v23; // x0
cocos2d::CCObject *v24; // x0
char *v25; // x2
unsigned __int64 v26; // x0
char v27; // w0
cocos2d::CCObject *v28; // x0
cocos2d::CCArray *v29; // x1
cocos2d::CCTextureCache *v30; // x0
cocos2d::CCTextureCache *v31; // x0
cocos2d::CCSpriteBatchNode *v32; // x0
unsigned int v33; // w2
__int64 v34; // x0
__int64 v35; // x2
__int64 *v37; // x20
char *v38; // x3
char *v39; // x0
_BYTE *v40; // x22
std::logic_error *exception; // x20
char *v42; // [xsp+68h] [xbp+68h]
char *v43; // [xsp+68h] [xbp+68h]
_BYTE v44[8]; // [xsp+78h] [xbp+78h] BYREF
__int64 v45; // [xsp+80h] [xbp+80h] BYREF
unsigned __int64 v46; // [xsp+88h] [xbp+88h]
void *v47; // [xsp+90h] [xbp+90h]
__int64 v48; // [xsp+98h] [xbp+98h] BYREF
__int64 v49; // [xsp+A0h] [xbp+A0h]
void *v50; // [xsp+A8h] [xbp+A8h]
__int64 v51[2]; // [xsp+B0h] [xbp+B0h] BYREF
void *v52; // [xsp+C0h] [xbp+C0h]
v44[0] = 0;
v44[1] = 0;
v44[2] = 0;
v44[3] = 0;
v4 = cocos2d::CCLayerColor::initWithColor(a1, v44);
v5 = v4;
if ( !v4 )
return v5;
v6 = (const char *)(a2 + 1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v6 = *(const char **)(a2 + 16);
v42 = (char *)v6;
v45 = 0;
v46 = 0;
v47 = nullptr;
v7 = strlen(v6);
v8 = (cocos2d::CCArray *)std::string::__init(&v45, v42, v7);
v9 = cocos2d::CCArray::create(v8);
v10 = v45;
v11 = (cocos2d::CCArray *)v9;
if ( (v45 & 1) == 0 )
{
LODWORD(v12) = (int)(unsigned __int8)v45 >> 1;
if ( !(_DWORD)v12 )
goto LABEL_6;
v13 = (char *)&v45 + 1;
v14 = -1;
v37 = (__int64 *)((char *)&v45 + (int)v12 + 1);
if ( v37 == (__int64 *)((char *)&v45 + 1) )
{
LABEL_37:
v12 = (int)v12;
goto LABEL_8;
}
LABEL_53:
v40 = v13;
if ( *v13 == 126 )
{
v14 = 0;
}
else
{
do
{
if ( v37 == (__int64 *)++v40 )
{
v14 = -1;
goto LABEL_61;
}
}
while ( *v40 != 126 );
v14 = v40 - v13;
}
LABEL_61:
LODWORD(v12) = (int)(unsigned __int8)v45 >> 1;
if ( (v45 & 1) != 0 )
{
v12 = v46;
goto LABEL_8;
}
goto LABEL_37;
}
v12 = v46;
v13 = v47;
if ( v46 )
{
v37 = (__int64 *)((char *)v47 + v46);
if ( v47 == (char *)v47 + v46 )
goto LABEL_7;
goto LABEL_53;
}
LABEL_6:
v12 = 0;
LABEL_7:
v14 = -1;
LABEL_8:
v48 = 0;
v49 = 0;
v15 = 0;
v50 = nullptr;
v16 = v14;
if ( (v45 & 1) == 0 )
goto LABEL_27;
LABEL_9:
v17 = v46;
if ( v15 > v46 )
{
LABEL_59:
exception = (std::logic_error *)_cxa_allocate_exception(0x10u);
std::logic_error::logic_error(exception, "basic_string");
*(_QWORD *)exception = off_1536D68;
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::logic_error::~logic_error);
}
for ( i = (char *)v47; ; i = (char *)&v45 + 1 )
{
v19 = v17 - v15;
v20 = &i[v15];
if ( v19 > v16 )
v19 = v16;
std::string::__init(&v48, v20, v19);
v21 = v48 & 1;
if ( v21 )
{
if ( v15 == v12 )
{
v21 = 1;
if ( !v49 )
goto LABEL_20;
}
v22 = (const char *)v50;
}
else
{
if ( v15 == v12 && !((int)(unsigned __int8)v48 >> 1) )
goto LABEL_20;
v22 = (char *)&v48 + 1;
}
v43 = (char *)v22;
v51[0] = 0;
v51[1] = 0;
v52 = nullptr;
v23 = strlen(v22);
std::string::__init(v51, v43, v23);
v24 = (cocos2d::CCObject *)cocos2d::CCString::create(v51);
cocos2d::CCArray::addObject(v11, v24);
if ( (v51[0] & 1) != 0 )
operator delete(v52);
v21 = v48 & 1;
LABEL_20:
if ( v14 == -1 )
break;
v15 = v14 + 1;
if ( (v45 & 1) != 0 )
{
v25 = (char *)v47;
v26 = v46;
}
else
{
v26 = (unsigned __int8)v45 >> 1;
v25 = (char *)&v45 + 1;
}
v14 = -1;
if ( v15 >= v26 || (v38 = &v25[v15], v39 = &v25[v26], &v25[v15] == v39) )
{
if ( !v21 )
goto LABEL_25;
}
else if ( v25[v15] == 126 )
{
LABEL_50:
v14 = v38 - v25;
if ( !v21 )
goto LABEL_25;
}
else
{
while ( v39 != ++v38 )
{
if ( *v38 == 126 )
goto LABEL_50;
}
v14 = -1;
if ( !v21 )
{
LABEL_25:
v10 = v45;
goto LABEL_26;
}
}
operator delete(v50);
v10 = v45;
LABEL_26:
v48 = 0;
v16 = v14 - v15;
v49 = 0;
v50 = nullptr;
if ( (v10 & 1) != 0 )
goto LABEL_9;
LABEL_27:
v17 = v10 >> 1;
if ( v15 > v17 )
goto LABEL_59;
}
if ( v21 )
operator delete(v50);
v27 = v45;
*((_QWORD *)a1 + 69) = v11;
if ( (v27 & 1) != 0 )
{
operator delete(v47);
v28 = *((cocos2d::CCObject **)a1 + 69);
}
else
{
v28 = v11;
}
cocos2d::CCObject::retain(v28);
AudioEffectsLayer::resetAudioVars(a1, v29);
v31 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v30);
v32 = (cocos2d::CCSpriteBatchNode *)cocos2d::CCTextureCache::addImage(v31, "GJ_GameSheet.png", 0);
v34 = cocos2d::CCSpriteBatchNode::createWithTexture(v32, (cocos2d::CCTexture2D *)((char *)&off_18 + 5), v33);
v35 = *(_QWORD *)a1;
*((_QWORD *)a1 + 68) = v34;
(*(void (__fastcall **)(AudioEffectsLayer *))(v35 + 456))(a1);
(*(void (__fastcall **)(__int64, __int64))(**((_QWORD **)a1 + 68) + 912LL))(*((_QWORD *)a1 + 68), 0x100000302LL);
*((_DWORD *)a1 + 145) = 1036831949;
return v5;
}