//
// GJEffectManager::init from 0x4a6ca0 to 0x4a6fdc (828 bytes)
//
// 0 xrefs:
//
// 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 GJEffectManager::init(GJEffectManager *a1)
{
_BOOL4 v2; // r7
cocos2d::CCDictionary *v3; // r0
cocos2d::CCDictionary *v4; // r0
cocos2d::CCArray *v5; // r0
cocos2d::CCArray *v6; // r0
cocos2d::CCDictionary *v7; // r0
cocos2d::CCDictionary *v8; // r0
ColorActionSprite **m_finish; // r2
ColorActionSprite **m_start; // r3
unsigned int v11; // r1
unsigned int v12; // r1
unsigned int v13; // r8
ColorActionSprite **v14; // r3
ColorActionSprite **v15; // r3
unsigned int v16; // r0
unsigned int v17; // r10
char *v18; // r9
ColorActionSprite **v19; // r1
size_t v20; // r5
ColorActionSprite **v21; // r1
ColorActionSprite **v22; // r5
ColorActionSprite **v23; // r0
ColorAction **v24; // r1
ColorAction **v25; // r2
unsigned int v26; // r3
int v27; // r9
ColorAction **v28; // r3
unsigned int v29; // r5
char *v30; // r10
ColorAction **v31; // r1
unsigned int v32; // r8
ColorAction **v33; // r3
ColorAction **v34; // r9
ColorAction **v35; // r0
InheritanceNode **v36; // r1
InheritanceNode **v37; // r2
unsigned int v38; // r3
int v39; // r9
InheritanceNode **v40; // r3
unsigned int v41; // r5
char *v42; // r10
InheritanceNode **v43; // r1
unsigned int v44; // r8
InheritanceNode **v45; // r3
InheritanceNode **v46; // r9
InheritanceNode **v47; // r0
unsigned int v48; // r5
InheritanceNode *v49; // r2
unsigned int v50; // r9
int v51; // r8
std::uintptr_t *m_bitptr; // r3
int i; // r3
InheritanceNode *v55; // [sp+4h] [bp-18h]
_DWORD v56[2]; // [sp+Ch] [bp-10h] BYREF
v2 = cocos2d::CCNode::init(a1);
if ( v2 )
{
v3 = cocos2d::CCDictionary::create();
a1->m_unkObject148 = v3;
cocos2d::CCObject::retain(v3);
v4 = cocos2d::CCDictionary::create();
a1->m_unkDict150 = v4;
cocos2d::CCObject::retain(v4);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
a1->m_unkArray430 = v6;
cocos2d::CCObject::retain(v6);
v7 = cocos2d::CCDictionary::create();
a1->m_unkDict268 = v7;
cocos2d::CCObject::retain(v7);
v8 = cocos2d::CCDictionary::create();
a1->m_colorActionDict = v8;
cocos2d::CCObject::retain(v8);
m_finish = a1->m_colorActionSpriteVector.m_finish;
m_start = a1->m_colorActionSpriteVector.m_start;
v11 = m_finish - m_start;
if ( v11 > 0x44D )
{
if ( v11 == 1102 )
goto LABEL_22;
v15 = m_start + 1102;
}
else
{
v12 = 1102 - v11;
v13 = v12;
if ( v12 > a1->m_colorActionSpriteVector.m_reserveEnd - m_finish )
{
v16 = std::vector::_M_check_len(
&a1->m_colorActionSpriteVector.m_start,
v12,
(int)"vector::_M_default_append");
v17 = v16;
if ( v16 )
{
if ( v16 >= 0x40000000 )
sub_772FB4(v16);
v18 = (char *)operator new(4 * v16);
}
else
{
v18 = nullptr;
}
v19 = a1->m_colorActionSpriteVector.m_start;
v20 = (char *)a1->m_colorActionSpriteVector.m_finish - (char *)v19;
if ( v20 >> 2 )
memmove(v18, v19, v20);
v21 = (ColorActionSprite **)&v18[v20];
v22 = (ColorActionSprite **)&v18[v20 + v13 * 4];
do
*v21++ = nullptr;
while ( v21 != v22 );
v23 = a1->m_colorActionSpriteVector.m_start;
if ( v23 )
operator delete(v23);
a1->m_colorActionSpriteVector.m_start = (ColorActionSprite **)v18;
a1->m_colorActionSpriteVector.m_finish = v22;
a1->m_colorActionSpriteVector.m_reserveEnd = (ColorActionSprite **)&v18[4 * v17];
LABEL_22:
v24 = a1->m_colorActionVector.m_finish;
v25 = a1->m_colorActionVector.m_start;
v26 = v24 - v25;
if ( v26 > 0x44D )
{
if ( v26 != 1102 )
a1->m_colorActionVector.m_finish = v25 + 1102;
LABEL_43:
std::vector::resize((const void **)&a1->m_unkVector438.m_start.m_bitptr, 0x2710u, 0);
v36 = a1->m_unkVector270.m_finish;
v37 = a1->m_unkVector270.m_start;
v38 = v36 - v37;
if ( v38 > 0x270F )
{
if ( v38 != 10000 )
a1->m_unkVector270.m_finish = v37 + 10000;
goto LABEL_64;
}
v39 = 4 * (10000 - v38);
if ( 10000 - v38 <= a1->m_unkVector270.m_reserveEnd - v36 )
{
v40 = &v36[v39 / 4u];
do
*v36++ = nullptr;
while ( v36 != v40 );
a1->m_unkVector270.m_finish = (InheritanceNode **)((char *)a1->m_unkVector270.m_finish + v39);
LABEL_64:
v48 = 0;
std::vector::resize((const void **)&a1->m_unkVector2f0.m_start.m_bitptr, 0x2710u, 0);
v49 = nullptr;
do
{
v50 = v48 >> 5;
v55 = v49;
a1->m_unkVector270.m_start[v48] = v49;
v51 = 1 << (v48 & 0x1F);
m_bitptr = a1->m_unkVector2f0.m_start.m_bitptr;
v56[1] = v51;
++v48;
v56[0] = &m_bitptr[v50];
std::_Bit_reference::operator=((int)v56, 0);
v49 = v55;
a1->m_unkVector438.m_start.m_bitptr[v50] |= v51;
}
while ( v48 != 10000 );
for ( i = 0; i != 1102; ++i )
{
a1->m_colorActionSpriteVector.m_start[i] = nullptr;
a1->m_colorActionVector.m_start[i] = nullptr;
}
return v2;
}
if ( 10000 - v38 < v38 )
v41 = 2 * v38;
else
v41 = 10000;
if ( v41 >= v38 && v41 < 0x40000000 )
{
if ( !v41 )
{
v42 = nullptr;
goto LABEL_55;
}
}
else
{
v41 = 0x3FFFFFFF;
}
v42 = (char *)operator new(4 * v41);
LABEL_55:
v43 = a1->m_unkVector270.m_start;
v44 = (char *)a1->m_unkVector270.m_finish - (char *)v43;
if ( v44 >> 2 )
memmove(v42, v43, (char *)a1->m_unkVector270.m_finish - (char *)v43);
v45 = (InheritanceNode **)&v42[v44];
v46 = (InheritanceNode **)&v42[v44 + v39];
do
*v45++ = nullptr;
while ( v45 != v46 );
v47 = a1->m_unkVector270.m_start;
if ( v47 )
operator delete(v47);
a1->m_unkVector270.m_start = (InheritanceNode **)v42;
a1->m_unkVector270.m_finish = v46;
a1->m_unkVector270.m_reserveEnd = (InheritanceNode **)&v42[4 * v41];
goto LABEL_64;
}
v27 = 4 * (1102 - v26);
if ( 1102 - v26 <= a1->m_colorActionVector.m_reserveEnd - v24 )
{
v28 = &v24[v27 / 4u];
do
*v24++ = nullptr;
while ( v24 != v28 );
a1->m_colorActionVector.m_finish = (ColorAction **)((char *)a1->m_colorActionVector.m_finish + v27);
goto LABEL_43;
}
if ( 1102 - v26 < v26 )
v29 = 2 * v26;
else
v29 = 1102;
if ( v29 >= v26 && v29 < 0x40000000 )
{
if ( !v29 )
{
v30 = nullptr;
goto LABEL_34;
}
}
else
{
v29 = 0x3FFFFFFF;
}
v30 = (char *)operator new(4 * v29);
LABEL_34:
v31 = a1->m_colorActionVector.m_start;
v32 = (char *)a1->m_colorActionVector.m_finish - (char *)v31;
if ( v32 >> 2 )
memmove(v30, v31, (char *)a1->m_colorActionVector.m_finish - (char *)v31);
v33 = (ColorAction **)&v30[v32];
v34 = (ColorAction **)&v30[v32 + v27];
do
*v33++ = nullptr;
while ( v33 != v34 );
v35 = a1->m_colorActionVector.m_start;
if ( v35 )
operator delete(v35);
a1->m_colorActionVector.m_start = (ColorAction **)v30;
a1->m_colorActionVector.m_finish = v34;
a1->m_colorActionVector.m_reserveEnd = (ColorAction **)&v30[4 * v29];
goto LABEL_43;
}
v14 = &m_finish[v13];
do
*m_finish++ = nullptr;
while ( m_finish != v14 );
v15 = &a1->m_colorActionSpriteVector.m_finish[v13];
}
a1->m_colorActionSpriteVector.m_finish = v15;
goto LABEL_22;
}
return v2;
}