//
// AudioEffectsLayer::init from 0x140084be0 to 0x140084d6b (395 bytes)
//
// 2 xrefs:
// > PlayLayer::setupHasCompleted @ 0x1403a6e09
// > ??> @ 0x1406c6bb8
//
// 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
//
// Hidden C++ exception states: #wind=2
char __fastcall AudioEffectsLayer::init(__int64 a1, _QWORD *a2)
{
_BYTE *v5; // rdx
size_t v6; // r8
void *v7; // rcx
cocos2d::CCTextureCache *v8; // rax
struct cocos2d::CCTexture2D *v9; // rax
struct cocos2d::CCSpriteBatchNode *v10; // rax
_QWORD v11[2]; // [rsp+20h] [rbp-48h] BYREF
void *Block[2]; // [rsp+30h] [rbp-38h] BYREF
__int128 v13; // [rsp+40h] [rbp-28h]
v11[1] = a2;
LODWORD(v11[0]) = 0;
if ( cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)v11) )
{
v5 = a2;
if ( a2[3] > 0xFu )
v5 = (_BYTE *)*a2;
*(_OWORD *)Block = 0;
v13 = 0;
v6 = -1;
do
++v6;
while ( v5[v6] );
sub_14003A930(Block, v5, v6);
*(_QWORD *)(a1 + 552) = sub_1400848C0((__int64 *)Block);
if ( *((_QWORD *)&v13 + 1) > 0xFu )
{
v7 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v13 + 1) + 1LL) >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
cocos2d::CCObject::retain(*(cocos2d::CCObject **)(a1 + 552));
AudioEffectsLayer::resetAudioVars((AudioEffectsLayer *)a1);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
v9 = cocos2d::CCTextureCache::addImage(v8, "GJ_GameSheet.png", 0);
v10 = cocos2d::CCSpriteBatchNode::createWithTexture(v9);
*(_QWORD *)(a1 + 544) = v10;
(*(void (__fastcall **)(__int64, struct cocos2d::CCSpriteBatchNode *))(*(_QWORD *)a1 + 448LL))(a1, v10);
v11[0] = 0x100000302LL;
(**(void (__fastcall ***)(__int64, __int64))(*(_QWORD *)(a1 + 544) + 320LL))(
*(_QWORD *)(a1 + 544) + 320LL,
0x100000302LL);
*(_DWORD *)(a1 + 580) = 1036831949;
sub_14003A830((__int64)a2);
return 1;
}
else
{
sub_14003A830((__int64)a2);
return 0;
}
}