//
// GJEffectManager::init from 0x1002dd4b0 to 0x1002dd730 (640 bytes)
//
// 2 xrefs:
// > GJEffectManager::create @ 0x1002dd46b
// > ??> @ 0x100909348
//
// 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
//
bool __fastcall GJEffectManager::init(GJEffectManager *a1)
{
__int64 v1; // rsi
bool result; // al
bool v4; // r13
cocos2d::CCDictionary *v5; // rax
cocos2d::CCDictionary *v6; // rax
cocos2d::CCDictionary *v7; // rdi
cocos2d::CCArray *v8; // rax
cocos2d::CCDictionary *v9; // rax
cocos2d::CCDictionary *v10; // rax
std::__vector_base::pointer begin; // rax
unsigned __int64 v12; // rdx
std::__vector_base::pointer v13; // rax
unsigned __int64 v14; // rdx
std::__vector_base::pointer v15; // rax
unsigned __int64 v16; // rdx
unsigned __int64 v17; // r12
std::__vector_base::pointer v18; // rax
std::__vector_base::pointer v19; // rdx
std::__vector_base::pointer v20; // rsi
unsigned __int64 v21; // rdi
std::__vector_base::pointer v22; // rcx
std::__vector_base::pointer v23; // rdx
__int64 v24; // rsi
result = cocos2d::CCNode::init(a1);
if ( result )
{
v4 = result;
v5 = cocos2d::CCDictionary::create();
a1->m_unkObject148 = v5;
cocos2d::CCObject::retain(v5);
v6 = cocos2d::CCDictionary::create();
a1->m_unkDict150 = v6;
v7 = v6;
cocos2d::CCObject::retain(v6);
v8 = (cocos2d::CCArray *)sub_10071F9E0(v7, v1);
a1->m_unkArray430 = v8;
cocos2d::CCObject::retain(v8);
v9 = cocos2d::CCDictionary::create();
a1->m_unkDict268 = v9;
cocos2d::CCObject::retain(v9);
v10 = cocos2d::CCDictionary::create();
a1->m_colorActionDict = v10;
cocos2d::CCObject::retain(v10);
begin = a1->m_colorActionSpriteVector.__begin_;
v12 = a1->m_colorActionSpriteVector.__end_ - begin;
if ( v12 > 0x44D )
{
if ( (std::__vector_base::pointer)((char *)a1->m_colorActionSpriteVector.__end_
- (char *)begin) != (std::__vector_base::pointer)8816 )
a1->m_colorActionSpriteVector.__end_ = begin + 1102;
}
else
{
sub_1002F0140(&a1->m_colorActionSpriteVector, 1102 - v12);
}
v13 = a1->m_colorActionVector.__begin_;
v14 = a1->m_colorActionVector.__end_ - v13;
if ( v14 > 0x44D )
{
if ( (std::__vector_base::pointer)((char *)a1->m_colorActionVector.__end_ - (char *)v13) != (std::__vector_base::pointer)8816 )
a1->m_colorActionVector.__end_ = v13 + 1102;
}
else
{
sub_1002F02A0(&a1->m_colorActionVector, 1102 - v14);
}
sub_1000DC570(&a1->m_unkVector438.__begin_, 10000, 0);
v15 = a1->m_unkVector270.__begin_;
v16 = a1->m_unkVector270.__end_ - v15;
if ( v16 > 0x270F )
{
if ( (std::__vector_base::pointer)((char *)a1->m_unkVector270.__end_ - (char *)v15) != (std::__vector_base::pointer)80000 )
a1->m_unkVector270.__end_ = v15 + 10000;
}
else
{
sub_1002F03F0(&a1->m_unkVector270, 10000 - v16);
}
v17 = 0;
sub_1000DC570(&a1->m_unkVector2f0.__begin_, 10000, 0);
v18 = a1->m_unkVector270.__begin_;
v19 = a1->m_unkVector2f0.__begin_;
v20 = a1->m_unkVector438.__begin_;
do
{
v18[v17] = nullptr;
v21 = v17 >> 6;
*(_QWORD *)&v19[8 * v21] &= __ROL8__(-2, v17);
*(_QWORD *)&v20[8 * v21] |= 1LL << v17++;
}
while ( v17 != 10000 );
v22 = a1->m_colorActionSpriteVector.__begin_;
v23 = a1->m_colorActionVector.__begin_;
v24 = 6;
result = v4;
while ( 1 )
{
*(_OWORD *)&v22[v24 - 6] = 0;
*(_OWORD *)&v22[v24 - 4] = 0;
*(_OWORD *)&v23[v24 - 6] = 0;
*(_OWORD *)&v23[v24 - 4] = 0;
if ( v24 == 1102 )
break;
*(_OWORD *)&v22[v24 - 2] = 0;
*(_OWORD *)&v22[v24] = 0;
*(_OWORD *)&v23[v24 - 2] = 0;
*(_OWORD *)&v23[v24] = 0;
v24 += 8;
}
v22[1100] = nullptr;
v23[1100] = nullptr;
v22[1101] = nullptr;
v23[1101] = nullptr;
}
return result;
}